@swirls/looms 0.2.0 → 0.3.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 (100) hide show
  1. package/CHANGELOG.md +22 -0
  2. package/dist/actor/host.js +4 -6
  3. package/dist/actor/index.d.ts +1 -1
  4. package/dist/actor/index.js +1 -1
  5. package/dist/actor/routing.d.ts +5 -0
  6. package/dist/actor/routing.js +14 -0
  7. package/dist/agent/agent-session.js +1 -0
  8. package/dist/agent/debugger/agent-chat.js +45 -11
  9. package/dist/agent/debugger/summarize.js +2 -0
  10. package/dist/agent/effects.d.ts +30 -0
  11. package/dist/agent/events.d.ts +2 -0
  12. package/dist/agent/events.js +2 -0
  13. package/dist/agent/llm.js +1 -8
  14. package/dist/agent/module.d.ts +604 -534
  15. package/dist/agent/module.js +11 -7
  16. package/dist/agent/projections.d.ts +5 -0
  17. package/dist/agent/projections.js +43 -2
  18. package/dist/agent/scope.d.ts +2 -0
  19. package/dist/agent/signals.d.ts +5 -0
  20. package/dist/agent/signals.js +7 -0
  21. package/dist/agent/threads.js +35 -21
  22. package/dist/agent/transcript.d.ts +7 -0
  23. package/dist/agent/transcript.js +19 -0
  24. package/dist/agent/types.d.ts +10 -0
  25. package/dist/agent/types.js +4 -0
  26. package/dist/approval/debugger/approvals-view.js +5 -3
  27. package/dist/approval/effects.d.ts +12 -0
  28. package/dist/approval/module.d.ts +24 -0
  29. package/dist/client/client.d.ts +292 -0
  30. package/dist/client/client.js +17 -1
  31. package/dist/cloudflare/router.d.ts +1 -1
  32. package/dist/cloudflare/router.js +6 -8
  33. package/dist/core/effects.d.ts +7 -0
  34. package/dist/core/effects.js +1 -0
  35. package/dist/core/fold.js +12 -6
  36. package/dist/core/fork.d.ts +35 -0
  37. package/dist/core/fork.js +129 -0
  38. package/dist/core/index.d.ts +1 -0
  39. package/dist/core/index.js +1 -0
  40. package/dist/core/module-scope.d.ts +1 -0
  41. package/dist/core/module.d.ts +2 -2
  42. package/dist/core/projection.js +1 -0
  43. package/dist/core/protocol.d.ts +10 -1
  44. package/dist/core/protocol.js +11 -0
  45. package/dist/core/replay.d.ts +8 -0
  46. package/dist/core/snapshots.js +3 -17
  47. package/dist/core/state.d.ts +14 -0
  48. package/dist/core/state.js +25 -2
  49. package/dist/core/store.d.ts +1 -0
  50. package/dist/debugger/app/assets/{index-Qb371t_O.js → index-BevQYa-U.js} +2 -2
  51. package/dist/debugger/app/assets/index-CgDzWJg7.css +2 -0
  52. package/dist/debugger/app/assets/routes-B17Om93i.js +47 -0
  53. package/dist/debugger/app/index.html +2 -2
  54. package/dist/debugger/components/composer.d.ts +5 -2
  55. package/dist/debugger/components/composer.js +5 -4
  56. package/dist/debugger/components/run-tree.js +2 -5
  57. package/dist/debugger/events/catalog.js +1 -3
  58. package/dist/debugger/events/protocol-summarize.js +7 -0
  59. package/dist/debugger/lib/event-counts.d.ts +2 -2
  60. package/dist/debugger/lib/event-counts.js +5 -9
  61. package/dist/debugger/shell/debugger-shell.js +1 -1
  62. package/dist/debugger/shell/run-controls.d.ts +2 -1
  63. package/dist/debugger/shell/run-controls.js +40 -13
  64. package/dist/debugger/shell/run-search.js +1 -3
  65. package/dist/evaluator/effects.d.ts +12 -0
  66. package/dist/evaluator/module.d.ts +24 -0
  67. package/dist/projectors/index-model.d.ts +13 -7
  68. package/dist/projectors/index-model.js +21 -26
  69. package/dist/projectors/memory.js +19 -11
  70. package/dist/projectors/postgres.js +20 -19
  71. package/dist/projectors/schema.js +20 -18
  72. package/dist/projectors/sqlite.js +32 -27
  73. package/dist/react/materialize.js +16 -11
  74. package/dist/react/react.d.ts +6 -2
  75. package/dist/react/react.js +5 -2
  76. package/dist/react/tables.d.ts +3 -2
  77. package/dist/runtime/cancellation.js +14 -27
  78. package/dist/runtime/errors.d.ts +39 -0
  79. package/dist/runtime/errors.js +32 -0
  80. package/dist/runtime/helpers.d.ts +2 -0
  81. package/dist/runtime/helpers.js +23 -1
  82. package/dist/runtime/index.d.ts +1 -1
  83. package/dist/runtime/index.js +1 -1
  84. package/dist/runtime/looms.d.ts +4 -0
  85. package/dist/runtime/looms.js +1 -0
  86. package/dist/runtime/run-start.js +1 -3
  87. package/dist/runtime/runtime.d.ts +1 -1
  88. package/dist/runtime/runtime.js +45 -18
  89. package/dist/runtime/server/http.d.ts +2 -0
  90. package/dist/runtime/server/http.js +17 -2
  91. package/dist/runtime/server/routes/runs.js +35 -2
  92. package/dist/runtime/types.d.ts +8 -0
  93. package/dist/runtime/wake-engine.js +5 -2
  94. package/dist/s2/snapshot-store.js +2 -6
  95. package/dist/workflow/effects.d.ts +24 -0
  96. package/dist/workflow/effects.js +1 -0
  97. package/dist/workflow/module.d.ts +48 -0
  98. package/package.json +1 -1
  99. package/dist/debugger/app/assets/index-B3Ah8WAE.css +0 -2
  100. package/dist/debugger/app/assets/routes-CjtEHgPQ.js +0 -47
@@ -1,3 +1,4 @@
1
+ import { type EventInput } from '@swirls/looms/core';
1
2
  import type { AgentDefinition, AgentSessionDefinition } from './definitions';
2
3
  import { LlmTag, type LlmAdapter, type StubLlmPolicy } from './llm';
3
4
  export interface AgentModuleOptions {
@@ -76,6 +77,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
76
77
  }>;
77
78
  readonly interrupt: import("effect/Schema").optional<import("effect/Schema").Boolean>;
78
79
  }>;
80
+ 'turn.stopped': import("effect/Schema").Struct<{}>;
79
81
  'session.message.submitted': import("effect/Schema").Struct<{
80
82
  readonly messageId: import("effect/Schema").String;
81
83
  readonly text: import("effect/Schema").String;
@@ -186,7 +188,204 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
186
188
  }[] | undefined;
187
189
  readonly input?: import("effect/Schema").Json | undefined;
188
190
  readonly consumedSteerMessageIds?: readonly string[] | undefined;
189
- }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
191
+ }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
192
+ readonly type: "runtime.effect.ambiguous";
193
+ readonly payload: {
194
+ readonly effectId: string;
195
+ readonly attempt: number;
196
+ readonly error: string;
197
+ };
198
+ }) | (Omit<EventInput, "payload" | "type"> & {
199
+ readonly type: "runtime.effect.attempt.started";
200
+ readonly payload: {
201
+ readonly effectId: string;
202
+ readonly attempt: number;
203
+ };
204
+ }) | (Omit<EventInput, "payload" | "type"> & {
205
+ readonly type: "runtime.effect.cancel.requested";
206
+ readonly payload: {
207
+ readonly effectId: string;
208
+ readonly attempt: number;
209
+ readonly deadlineAt: number | null;
210
+ };
211
+ }) | (Omit<EventInput, "payload" | "type"> & {
212
+ readonly type: "runtime.effect.cancelled";
213
+ readonly payload: {
214
+ readonly effectId: string;
215
+ readonly attempt: number;
216
+ };
217
+ }) | (Omit<EventInput, "payload" | "type"> & {
218
+ readonly type: "runtime.effect.completed";
219
+ readonly payload: {
220
+ readonly effectId: string;
221
+ readonly attempt: number;
222
+ };
223
+ }) | (Omit<EventInput, "payload" | "type"> & {
224
+ readonly type: "runtime.effect.dispatched";
225
+ readonly payload: {
226
+ readonly effectId: string;
227
+ readonly attempt: number;
228
+ readonly deadlineAt: number | null;
229
+ };
230
+ }) | (Omit<EventInput, "payload" | "type"> & {
231
+ readonly type: "runtime.effect.failed";
232
+ readonly payload: {
233
+ readonly effectId: string;
234
+ readonly error: string;
235
+ };
236
+ }) | (Omit<EventInput, "payload" | "type"> & {
237
+ readonly type: "runtime.effect.heartbeat";
238
+ readonly payload: {
239
+ readonly effectId: string;
240
+ readonly attempt: number;
241
+ readonly heartbeatAt: number;
242
+ readonly deadlineAt: number | null;
243
+ };
244
+ }) | (Omit<EventInput, "payload" | "type"> & {
245
+ readonly type: "runtime.effect.queued";
246
+ readonly payload: {
247
+ readonly effectId: string;
248
+ readonly attempt: number;
249
+ readonly deadlineAt: number | null;
250
+ };
251
+ }) | (Omit<EventInput, "payload" | "type"> & {
252
+ readonly type: "runtime.effect.retry.scheduled";
253
+ readonly payload: {
254
+ readonly effectId: string;
255
+ readonly attempt: number;
256
+ readonly nextAttemptAt: number;
257
+ readonly error: string;
258
+ };
259
+ }) | (Omit<EventInput, "payload" | "type"> & {
260
+ readonly type: "runtime.effect.timed_out";
261
+ readonly payload: {
262
+ readonly effectId: string;
263
+ readonly attempt: number;
264
+ readonly timeout: string;
265
+ };
266
+ }) | (Omit<EventInput, "payload" | "type"> & {
267
+ readonly type: "runtime.effect.worker.started";
268
+ readonly payload: {
269
+ readonly effectId: string;
270
+ readonly attempt: number;
271
+ readonly deadlineAt: number | null;
272
+ };
273
+ }) | (Omit<EventInput, "payload" | "type"> & {
274
+ readonly type: "runtime.fork.elided";
275
+ readonly payload: {
276
+ readonly type: string;
277
+ };
278
+ }) | (Omit<EventInput, "payload" | "type"> & {
279
+ readonly type: "runtime.run.cancelled";
280
+ readonly payload: {
281
+ readonly reason?: string | undefined;
282
+ };
283
+ }) | (Omit<EventInput, "payload" | "type"> & {
284
+ readonly type: "runtime.run.completed";
285
+ readonly payload: {
286
+ readonly output: import("effect/Schema").Json;
287
+ readonly error: string | null;
288
+ };
289
+ }) | (Omit<EventInput, "payload" | "type"> & {
290
+ readonly type: "runtime.run.forked";
291
+ readonly payload: {
292
+ readonly sourceRunId: string;
293
+ readonly sourceSeq: number;
294
+ };
295
+ }) | (Omit<EventInput, "payload" | "type"> & {
296
+ readonly type: "runtime.run.started";
297
+ readonly payload: {
298
+ readonly rootThreadId?: string | undefined;
299
+ readonly kind: string;
300
+ readonly definitionName: string;
301
+ readonly definitionVersion: string;
302
+ readonly input: import("effect/Schema").Json;
303
+ readonly requestedThreadId?: string | null | undefined;
304
+ };
305
+ }) | (Omit<EventInput, "payload" | "type"> & {
306
+ readonly type: "runtime.signal.received";
307
+ readonly payload: {
308
+ readonly signalType: string;
309
+ };
310
+ }) | (Omit<EventInput, "payload" | "type"> & {
311
+ readonly type: "runtime.snapshot.taken";
312
+ readonly payload: {
313
+ readonly seq: number;
314
+ readonly stateHash: string;
315
+ readonly state?: import("effect/Schema").Json | undefined;
316
+ };
317
+ }) | (Omit<EventInput, "payload" | "type"> & {
318
+ readonly type: "runtime.thread.cancel.requested";
319
+ readonly payload: {
320
+ readonly threadId: string;
321
+ };
322
+ }) | (Omit<EventInput, "payload" | "type"> & {
323
+ readonly type: "runtime.thread.cancelled";
324
+ readonly payload: {
325
+ readonly threadId: string;
326
+ readonly reason?: string | undefined;
327
+ readonly resumeSeq?: number | undefined;
328
+ };
329
+ }) | (Omit<EventInput, "payload" | "type"> & {
330
+ readonly type: "runtime.thread.completed";
331
+ readonly payload: {
332
+ readonly threadId: string;
333
+ readonly output: import("effect/Schema").Json;
334
+ };
335
+ }) | (Omit<EventInput, "payload" | "type"> & {
336
+ readonly type: "runtime.thread.failed";
337
+ readonly payload: {
338
+ readonly threadId: string;
339
+ readonly error: string;
340
+ };
341
+ }) | (Omit<EventInput, "payload" | "type"> & {
342
+ readonly type: "runtime.thread.started";
343
+ readonly payload: {
344
+ readonly threadId: string;
345
+ readonly kind: string;
346
+ readonly definitionName: string;
347
+ readonly definitionVersion: string;
348
+ readonly input: import("effect/Schema").Json;
349
+ readonly parentThreadId: string | null;
350
+ };
351
+ }) | (Omit<EventInput, "payload" | "type"> & {
352
+ readonly type: "runtime.timer.fired";
353
+ readonly payload: {
354
+ readonly timerId: string;
355
+ readonly waitId: string;
356
+ };
357
+ }) | (Omit<EventInput, "payload" | "type"> & {
358
+ readonly type: "runtime.timer.set";
359
+ readonly payload: {
360
+ readonly timerId: string;
361
+ readonly waitId: string;
362
+ readonly wakeAt: number;
363
+ };
364
+ }) | (Omit<EventInput, "payload" | "type"> & {
365
+ readonly type: "runtime.wait.registered";
366
+ readonly payload: {
367
+ readonly waitId: string;
368
+ readonly threadId?: string | undefined;
369
+ readonly on: {
370
+ readonly type: string | readonly string[];
371
+ readonly match?: import("effect/Schema").Json | undefined;
372
+ } | {
373
+ readonly timerAt: number;
374
+ };
375
+ readonly tag?: import("effect/Schema").Json | undefined;
376
+ };
377
+ }) | (Omit<EventInput, "payload" | "type"> & {
378
+ readonly type: "runtime.wait.satisfied";
379
+ readonly payload: {
380
+ readonly waitId: string;
381
+ readonly tag?: import("effect/Schema").Json | undefined;
382
+ readonly event: {
383
+ readonly id: string;
384
+ readonly type: string;
385
+ readonly payload: import("effect/Schema").Json;
386
+ };
387
+ };
388
+ }) | (Omit<EventInput, "payload" | "type"> & {
190
389
  readonly type: "agent.effects.requested";
191
390
  readonly payload: {
192
391
  readonly toolCallId: string;
@@ -252,7 +451,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
252
451
  readonly match?: import("effect/Schema").Json | undefined;
253
452
  } | undefined;
254
453
  };
255
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
454
+ }) | (Omit<EventInput, "payload" | "type"> & {
256
455
  readonly type: "agent.message";
257
456
  readonly payload: {
258
457
  readonly turn: number;
@@ -272,7 +471,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
272
471
  readonly output: number;
273
472
  } | undefined;
274
473
  };
275
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
474
+ }) | (Omit<EventInput, "payload" | "type"> & {
276
475
  readonly type: "agent.message.received";
277
476
  readonly payload: {
278
477
  readonly message: {
@@ -287,10 +486,10 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
287
486
  }[] | undefined;
288
487
  };
289
488
  };
290
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
489
+ }) | (Omit<EventInput, "payload" | "type"> & {
291
490
  readonly type: "agent.session.cancel.requested";
292
491
  readonly payload: {};
293
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
492
+ }) | (Omit<EventInput, "payload" | "type"> & {
294
493
  readonly type: "agent.session.message.submitted";
295
494
  readonly payload: {
296
495
  readonly messageId: string;
@@ -298,26 +497,26 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
298
497
  readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
299
498
  readonly activeChildThreadId?: string | undefined;
300
499
  };
301
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
500
+ }) | (Omit<EventInput, "payload" | "type"> & {
302
501
  readonly type: "agent.session.steer.delivered";
303
502
  readonly payload: {
304
503
  readonly messageId: string;
305
504
  readonly activeMessageId: string;
306
505
  };
307
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
506
+ }) | (Omit<EventInput, "payload" | "type"> & {
308
507
  readonly type: "agent.session.turn.closed";
309
508
  readonly payload: {
310
509
  readonly messageId: string;
311
510
  readonly status: "cancelled" | "completed" | "failed";
312
511
  readonly error?: string | undefined;
313
512
  };
314
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
513
+ }) | (Omit<EventInput, "payload" | "type"> & {
315
514
  readonly type: "agent.session.turn.started";
316
515
  readonly payload: {
317
516
  readonly messageId: string;
318
517
  readonly childThreadId: string;
319
518
  };
320
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
519
+ }) | (Omit<EventInput, "payload" | "type"> & {
321
520
  readonly type: "agent.spawn.requested";
322
521
  readonly payload: {
323
522
  readonly childThreadId: string;
@@ -327,7 +526,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
327
526
  readonly toolCallId: string;
328
527
  readonly input: import("effect/Schema").Json;
329
528
  };
330
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
529
+ }) | (Omit<EventInput, "payload" | "type"> & {
331
530
  readonly type: "agent.steered";
332
531
  readonly payload: {
333
532
  readonly turn: number;
@@ -345,7 +544,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
345
544
  };
346
545
  readonly interrupt?: boolean | undefined;
347
546
  };
348
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
547
+ }) | (Omit<EventInput, "payload" | "type"> & {
349
548
  readonly type: "agent.tool.result";
350
549
  readonly payload: {
351
550
  readonly turn: number;
@@ -354,7 +553,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
354
553
  readonly result: import("effect/Schema").Json;
355
554
  readonly error: string | null;
356
555
  };
357
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
556
+ }) | (Omit<EventInput, "payload" | "type"> & {
358
557
  readonly type: "agent.tool_call.requested";
359
558
  readonly payload: {
360
559
  readonly turn: number;
@@ -364,63 +563,76 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
364
563
  readonly arguments: import("effect/Schema").Json;
365
564
  };
366
565
  };
367
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
566
+ }) | (Omit<EventInput, "payload" | "type"> & {
368
567
  readonly type: "agent.turn.started";
369
568
  readonly payload: {
370
569
  readonly turn: number;
371
570
  };
372
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
571
+ }) | (Omit<EventInput, "payload" | "type"> & {
572
+ readonly type: "agent.turn.stopped";
573
+ readonly payload: {};
574
+ }) | (Omit<EventInput, "payload" | "type"> & {
373
575
  readonly type: "agent.turn.text_delta";
374
576
  readonly payload: {
375
577
  readonly turn: number;
376
578
  readonly delta: string;
377
579
  };
378
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
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;
589
+ };
590
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
379
591
  readonly type: "runtime.effect.ambiguous";
380
592
  readonly payload: {
381
593
  readonly effectId: string;
382
594
  readonly attempt: number;
383
595
  readonly error: string;
384
596
  };
385
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
597
+ }) | (Omit<EventInput, "payload" | "type"> & {
386
598
  readonly type: "runtime.effect.attempt.started";
387
599
  readonly payload: {
388
600
  readonly effectId: string;
389
601
  readonly attempt: number;
390
602
  };
391
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
603
+ }) | (Omit<EventInput, "payload" | "type"> & {
392
604
  readonly type: "runtime.effect.cancel.requested";
393
605
  readonly payload: {
394
606
  readonly effectId: string;
395
607
  readonly attempt: number;
396
608
  readonly deadlineAt: number | null;
397
609
  };
398
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
610
+ }) | (Omit<EventInput, "payload" | "type"> & {
399
611
  readonly type: "runtime.effect.cancelled";
400
612
  readonly payload: {
401
613
  readonly effectId: string;
402
614
  readonly attempt: number;
403
615
  };
404
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
616
+ }) | (Omit<EventInput, "payload" | "type"> & {
405
617
  readonly type: "runtime.effect.completed";
406
618
  readonly payload: {
407
619
  readonly effectId: string;
408
620
  readonly attempt: number;
409
621
  };
410
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
622
+ }) | (Omit<EventInput, "payload" | "type"> & {
411
623
  readonly type: "runtime.effect.dispatched";
412
624
  readonly payload: {
413
625
  readonly effectId: string;
414
626
  readonly attempt: number;
415
627
  readonly deadlineAt: number | null;
416
628
  };
417
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
629
+ }) | (Omit<EventInput, "payload" | "type"> & {
418
630
  readonly type: "runtime.effect.failed";
419
631
  readonly payload: {
420
632
  readonly effectId: string;
421
633
  readonly error: string;
422
634
  };
423
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
635
+ }) | (Omit<EventInput, "payload" | "type"> & {
424
636
  readonly type: "runtime.effect.heartbeat";
425
637
  readonly payload: {
426
638
  readonly effectId: string;
@@ -428,14 +640,14 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
428
640
  readonly heartbeatAt: number;
429
641
  readonly deadlineAt: number | null;
430
642
  };
431
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
643
+ }) | (Omit<EventInput, "payload" | "type"> & {
432
644
  readonly type: "runtime.effect.queued";
433
645
  readonly payload: {
434
646
  readonly effectId: string;
435
647
  readonly attempt: number;
436
648
  readonly deadlineAt: number | null;
437
649
  };
438
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
650
+ }) | (Omit<EventInput, "payload" | "type"> & {
439
651
  readonly type: "runtime.effect.retry.scheduled";
440
652
  readonly payload: {
441
653
  readonly effectId: string;
@@ -443,32 +655,43 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
443
655
  readonly nextAttemptAt: number;
444
656
  readonly error: string;
445
657
  };
446
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
658
+ }) | (Omit<EventInput, "payload" | "type"> & {
447
659
  readonly type: "runtime.effect.timed_out";
448
660
  readonly payload: {
449
661
  readonly effectId: string;
450
662
  readonly attempt: number;
451
663
  readonly timeout: string;
452
664
  };
453
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
665
+ }) | (Omit<EventInput, "payload" | "type"> & {
454
666
  readonly type: "runtime.effect.worker.started";
455
667
  readonly payload: {
456
668
  readonly effectId: string;
457
669
  readonly attempt: number;
458
670
  readonly deadlineAt: number | null;
459
671
  };
460
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
672
+ }) | (Omit<EventInput, "payload" | "type"> & {
673
+ readonly type: "runtime.fork.elided";
674
+ readonly payload: {
675
+ readonly type: string;
676
+ };
677
+ }) | (Omit<EventInput, "payload" | "type"> & {
461
678
  readonly type: "runtime.run.cancelled";
462
679
  readonly payload: {
463
680
  readonly reason?: string | undefined;
464
681
  };
465
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
682
+ }) | (Omit<EventInput, "payload" | "type"> & {
466
683
  readonly type: "runtime.run.completed";
467
684
  readonly payload: {
468
685
  readonly output: import("effect/Schema").Json;
469
686
  readonly error: string | null;
470
687
  };
471
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
688
+ }) | (Omit<EventInput, "payload" | "type"> & {
689
+ readonly type: "runtime.run.forked";
690
+ readonly payload: {
691
+ readonly sourceRunId: string;
692
+ readonly sourceSeq: number;
693
+ };
694
+ }) | (Omit<EventInput, "payload" | "type"> & {
472
695
  readonly type: "runtime.run.started";
473
696
  readonly payload: {
474
697
  readonly rootThreadId?: string | undefined;
@@ -478,42 +701,43 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
478
701
  readonly input: import("effect/Schema").Json;
479
702
  readonly requestedThreadId?: string | null | undefined;
480
703
  };
481
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
704
+ }) | (Omit<EventInput, "payload" | "type"> & {
482
705
  readonly type: "runtime.signal.received";
483
706
  readonly payload: {
484
707
  readonly signalType: string;
485
708
  };
486
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
709
+ }) | (Omit<EventInput, "payload" | "type"> & {
487
710
  readonly type: "runtime.snapshot.taken";
488
711
  readonly payload: {
489
712
  readonly seq: number;
490
713
  readonly stateHash: string;
491
714
  readonly state?: import("effect/Schema").Json | undefined;
492
715
  };
493
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
716
+ }) | (Omit<EventInput, "payload" | "type"> & {
494
717
  readonly type: "runtime.thread.cancel.requested";
495
718
  readonly payload: {
496
719
  readonly threadId: string;
497
720
  };
498
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
721
+ }) | (Omit<EventInput, "payload" | "type"> & {
499
722
  readonly type: "runtime.thread.cancelled";
500
723
  readonly payload: {
501
724
  readonly threadId: string;
502
725
  readonly reason?: string | undefined;
726
+ readonly resumeSeq?: number | undefined;
503
727
  };
504
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
728
+ }) | (Omit<EventInput, "payload" | "type"> & {
505
729
  readonly type: "runtime.thread.completed";
506
730
  readonly payload: {
507
731
  readonly threadId: string;
508
732
  readonly output: import("effect/Schema").Json;
509
733
  };
510
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
734
+ }) | (Omit<EventInput, "payload" | "type"> & {
511
735
  readonly type: "runtime.thread.failed";
512
736
  readonly payload: {
513
737
  readonly threadId: string;
514
738
  readonly error: string;
515
739
  };
516
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
740
+ }) | (Omit<EventInput, "payload" | "type"> & {
517
741
  readonly type: "runtime.thread.started";
518
742
  readonly payload: {
519
743
  readonly threadId: string;
@@ -523,20 +747,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
523
747
  readonly input: import("effect/Schema").Json;
524
748
  readonly parentThreadId: string | null;
525
749
  };
526
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
750
+ }) | (Omit<EventInput, "payload" | "type"> & {
527
751
  readonly type: "runtime.timer.fired";
528
752
  readonly payload: {
529
753
  readonly timerId: string;
530
754
  readonly waitId: string;
531
755
  };
532
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
756
+ }) | (Omit<EventInput, "payload" | "type"> & {
533
757
  readonly type: "runtime.timer.set";
534
758
  readonly payload: {
535
759
  readonly timerId: string;
536
760
  readonly waitId: string;
537
761
  readonly wakeAt: number;
538
762
  };
539
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
763
+ }) | (Omit<EventInput, "payload" | "type"> & {
540
764
  readonly type: "runtime.wait.registered";
541
765
  readonly payload: {
542
766
  readonly waitId: string;
@@ -549,7 +773,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
549
773
  };
550
774
  readonly tag?: import("effect/Schema").Json | undefined;
551
775
  };
552
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
776
+ }) | (Omit<EventInput, "payload" | "type"> & {
553
777
  readonly type: "runtime.wait.satisfied";
554
778
  readonly payload: {
555
779
  readonly waitId: string;
@@ -560,17 +784,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
560
784
  readonly payload: import("effect/Schema").Json;
561
785
  };
562
786
  };
563
- })>;
564
- executeTool: import("@swirls/looms/core").EffectDefinition<{
565
- readonly turn: number;
566
- readonly definitionName?: string | undefined;
567
- readonly definitionVersion: string;
568
- readonly toolCall: {
569
- readonly id: string;
570
- readonly name: string;
571
- readonly arguments: import("effect/Schema").Json;
572
- };
573
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
787
+ }) | (Omit<EventInput, "payload" | "type"> & {
574
788
  readonly type: "agent.effects.requested";
575
789
  readonly payload: {
576
790
  readonly toolCallId: string;
@@ -636,7 +850,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
636
850
  readonly match?: import("effect/Schema").Json | undefined;
637
851
  } | undefined;
638
852
  };
639
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
853
+ }) | (Omit<EventInput, "payload" | "type"> & {
640
854
  readonly type: "agent.message";
641
855
  readonly payload: {
642
856
  readonly turn: number;
@@ -656,7 +870,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
656
870
  readonly output: number;
657
871
  } | undefined;
658
872
  };
659
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
873
+ }) | (Omit<EventInput, "payload" | "type"> & {
660
874
  readonly type: "agent.message.received";
661
875
  readonly payload: {
662
876
  readonly message: {
@@ -671,10 +885,10 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
671
885
  }[] | undefined;
672
886
  };
673
887
  };
674
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
888
+ }) | (Omit<EventInput, "payload" | "type"> & {
675
889
  readonly type: "agent.session.cancel.requested";
676
890
  readonly payload: {};
677
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
891
+ }) | (Omit<EventInput, "payload" | "type"> & {
678
892
  readonly type: "agent.session.message.submitted";
679
893
  readonly payload: {
680
894
  readonly messageId: string;
@@ -682,26 +896,26 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
682
896
  readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
683
897
  readonly activeChildThreadId?: string | undefined;
684
898
  };
685
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
899
+ }) | (Omit<EventInput, "payload" | "type"> & {
686
900
  readonly type: "agent.session.steer.delivered";
687
901
  readonly payload: {
688
902
  readonly messageId: string;
689
903
  readonly activeMessageId: string;
690
904
  };
691
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
905
+ }) | (Omit<EventInput, "payload" | "type"> & {
692
906
  readonly type: "agent.session.turn.closed";
693
907
  readonly payload: {
694
908
  readonly messageId: string;
695
909
  readonly status: "cancelled" | "completed" | "failed";
696
910
  readonly error?: string | undefined;
697
911
  };
698
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
912
+ }) | (Omit<EventInput, "payload" | "type"> & {
699
913
  readonly type: "agent.session.turn.started";
700
914
  readonly payload: {
701
915
  readonly messageId: string;
702
916
  readonly childThreadId: string;
703
917
  };
704
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
918
+ }) | (Omit<EventInput, "payload" | "type"> & {
705
919
  readonly type: "agent.spawn.requested";
706
920
  readonly payload: {
707
921
  readonly childThreadId: string;
@@ -711,7 +925,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
711
925
  readonly toolCallId: string;
712
926
  readonly input: import("effect/Schema").Json;
713
927
  };
714
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
928
+ }) | (Omit<EventInput, "payload" | "type"> & {
715
929
  readonly type: "agent.steered";
716
930
  readonly payload: {
717
931
  readonly turn: number;
@@ -729,7 +943,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
729
943
  };
730
944
  readonly interrupt?: boolean | undefined;
731
945
  };
732
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
946
+ }) | (Omit<EventInput, "payload" | "type"> & {
733
947
  readonly type: "agent.tool.result";
734
948
  readonly payload: {
735
949
  readonly turn: number;
@@ -738,7 +952,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
738
952
  readonly result: import("effect/Schema").Json;
739
953
  readonly error: string | null;
740
954
  };
741
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
955
+ }) | (Omit<EventInput, "payload" | "type"> & {
742
956
  readonly type: "agent.tool_call.requested";
743
957
  readonly payload: {
744
958
  readonly turn: number;
@@ -748,244 +962,263 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
748
962
  readonly arguments: import("effect/Schema").Json;
749
963
  };
750
964
  };
751
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
965
+ }) | (Omit<EventInput, "payload" | "type"> & {
752
966
  readonly type: "agent.turn.started";
753
967
  readonly payload: {
754
968
  readonly turn: number;
755
969
  };
756
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
970
+ }) | (Omit<EventInput, "payload" | "type"> & {
971
+ readonly type: "agent.turn.stopped";
972
+ readonly payload: {};
973
+ }) | (Omit<EventInput, "payload" | "type"> & {
757
974
  readonly type: "agent.turn.text_delta";
758
975
  readonly payload: {
759
976
  readonly turn: number;
760
977
  readonly delta: string;
761
978
  };
762
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
763
- readonly type: "runtime.effect.ambiguous";
764
- readonly payload: {
765
- readonly effectId: string;
766
- readonly attempt: number;
767
- readonly error: string;
768
- };
769
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
770
- readonly type: "runtime.effect.attempt.started";
771
- readonly payload: {
772
- readonly effectId: string;
773
- readonly attempt: number;
774
- };
775
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
776
- readonly type: "runtime.effect.cancel.requested";
777
- readonly payload: {
778
- readonly effectId: string;
779
- readonly attempt: number;
780
- readonly deadlineAt: number | null;
781
- };
782
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
783
- readonly type: "runtime.effect.cancelled";
784
- readonly payload: {
785
- readonly effectId: string;
786
- readonly attempt: number;
787
- };
788
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
789
- readonly type: "runtime.effect.completed";
790
- readonly payload: {
791
- readonly effectId: string;
792
- readonly attempt: number;
793
- };
794
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
795
- readonly type: "runtime.effect.dispatched";
796
- readonly payload: {
797
- readonly effectId: string;
798
- readonly attempt: number;
799
- readonly deadlineAt: number | null;
800
- };
801
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
802
- readonly type: "runtime.effect.failed";
803
- readonly payload: {
804
- readonly effectId: string;
805
- readonly error: string;
806
- };
807
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
808
- readonly type: "runtime.effect.heartbeat";
809
- readonly payload: {
810
- readonly effectId: string;
811
- readonly attempt: number;
812
- readonly heartbeatAt: number;
813
- readonly deadlineAt: number | null;
814
- };
815
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
816
- readonly type: "runtime.effect.queued";
817
- readonly payload: {
818
- readonly effectId: string;
819
- readonly attempt: number;
820
- readonly deadlineAt: number | null;
821
- };
822
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
823
- readonly type: "runtime.effect.retry.scheduled";
824
- readonly payload: {
825
- readonly effectId: string;
826
- readonly attempt: number;
827
- readonly nextAttemptAt: number;
828
- readonly error: string;
829
- };
830
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
831
- readonly type: "runtime.effect.timed_out";
832
- readonly payload: {
833
- readonly effectId: string;
834
- readonly attempt: number;
835
- readonly timeout: string;
836
- };
837
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
838
- readonly type: "runtime.effect.worker.started";
839
- readonly payload: {
840
- readonly effectId: string;
841
- readonly attempt: number;
842
- readonly deadlineAt: number | null;
843
- };
844
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
845
- readonly type: "runtime.run.cancelled";
846
- readonly payload: {
847
- readonly reason?: string | undefined;
848
- };
849
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
850
- readonly type: "runtime.run.completed";
851
- readonly payload: {
852
- readonly output: import("effect/Schema").Json;
853
- readonly error: string | null;
854
- };
855
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
856
- readonly type: "runtime.run.started";
857
- readonly payload: {
858
- readonly rootThreadId?: string | undefined;
859
- readonly kind: string;
860
- readonly definitionName: string;
861
- readonly definitionVersion: string;
862
- readonly input: import("effect/Schema").Json;
863
- readonly requestedThreadId?: string | null | undefined;
864
- };
865
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
866
- readonly type: "runtime.signal.received";
867
- readonly payload: {
868
- readonly signalType: string;
869
- };
870
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
871
- readonly type: "runtime.snapshot.taken";
872
- readonly payload: {
873
- readonly seq: number;
874
- readonly stateHash: string;
875
- readonly state?: import("effect/Schema").Json | undefined;
876
- };
877
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
878
- readonly type: "runtime.thread.cancel.requested";
879
- readonly payload: {
880
- readonly threadId: string;
881
- };
882
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
883
- readonly type: "runtime.thread.cancelled";
884
- readonly payload: {
885
- readonly threadId: string;
886
- readonly reason?: string | undefined;
887
- };
888
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
889
- readonly type: "runtime.thread.completed";
890
- readonly payload: {
891
- readonly threadId: string;
892
- readonly output: import("effect/Schema").Json;
893
- };
894
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
895
- readonly type: "runtime.thread.failed";
896
- readonly payload: {
897
- readonly threadId: string;
898
- readonly error: string;
899
- };
900
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
901
- readonly type: "runtime.thread.started";
902
- readonly payload: {
903
- readonly threadId: string;
904
- readonly kind: string;
905
- readonly definitionName: string;
979
+ })>;
980
+ }, {
981
+ agent: import("@swirls/looms/core").ThreadDefinition<import("./types").AgentState>;
982
+ 'agent-session': import("@swirls/looms/core").ThreadDefinition<import("./types").AgentSessionState>;
983
+ }, {
984
+ conversation: import("@swirls/looms/core").ProjectionDefinition<{
985
+ readonly lines: {
986
+ readonly role: "assistant" | "system" | "tool" | "user";
987
+ readonly content: string;
988
+ readonly toolCallId?: string | undefined;
989
+ readonly name?: string | undefined;
990
+ readonly toolCalls?: {
991
+ readonly id: string;
992
+ readonly name: string;
993
+ readonly arguments: import("effect/Schema").Json;
994
+ }[] | undefined;
995
+ }[];
996
+ }>;
997
+ tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
998
+ readonly input: number;
999
+ readonly output: number;
1000
+ }>;
1001
+ turnActivity: import("@swirls/looms/core").ProjectionDefinition<{
1002
+ readonly rootThreadId: string | null;
1003
+ readonly active: boolean;
1004
+ }>;
1005
+ }, import("effect/Context").Service.Any> & {
1006
+ readonly effects: {
1007
+ callLLM: import("@swirls/looms/core").EffectDefinition<{
1008
+ readonly turn: number;
1009
+ readonly definitionName?: string | undefined;
906
1010
  readonly definitionVersion: string;
907
- readonly input: import("effect/Schema").Json;
908
- readonly parentThreadId: string | null;
909
- };
910
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
911
- readonly type: "runtime.timer.fired";
912
- readonly payload: {
913
- readonly timerId: string;
914
- readonly waitId: string;
915
- };
916
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
917
- readonly type: "runtime.timer.set";
918
- readonly payload: {
919
- readonly timerId: string;
920
- readonly waitId: string;
921
- readonly wakeAt: number;
922
- };
923
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
924
- readonly type: "runtime.wait.registered";
925
- readonly payload: {
926
- readonly waitId: string;
927
- readonly threadId?: string | undefined;
928
- readonly on: {
929
- readonly type: string | readonly string[];
930
- readonly match?: import("effect/Schema").Json | undefined;
931
- } | {
932
- readonly timerAt: number;
1011
+ readonly messages?: readonly {
1012
+ readonly role: "assistant" | "system" | "tool" | "user";
1013
+ readonly content: string;
1014
+ readonly toolCallId?: string | undefined;
1015
+ readonly name?: string | undefined;
1016
+ readonly toolCalls?: {
1017
+ readonly id: string;
1018
+ readonly name: string;
1019
+ readonly arguments: import("effect/Schema").Json;
1020
+ }[] | undefined;
1021
+ }[] | undefined;
1022
+ readonly input?: import("effect/Schema").Json | undefined;
1023
+ readonly consumedSteerMessageIds?: readonly string[] | undefined;
1024
+ }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
1025
+ readonly type: "runtime.effect.ambiguous";
1026
+ readonly payload: {
1027
+ readonly effectId: string;
1028
+ readonly attempt: number;
1029
+ readonly error: string;
933
1030
  };
934
- readonly tag?: import("effect/Schema").Json | undefined;
935
- };
936
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
937
- readonly type: "runtime.wait.satisfied";
938
- readonly payload: {
939
- readonly waitId: string;
940
- readonly tag?: import("effect/Schema").Json | undefined;
941
- readonly event: {
942
- readonly id: string;
1031
+ }) | (Omit<EventInput, "payload" | "type"> & {
1032
+ readonly type: "runtime.effect.attempt.started";
1033
+ readonly payload: {
1034
+ readonly effectId: string;
1035
+ readonly attempt: number;
1036
+ };
1037
+ }) | (Omit<EventInput, "payload" | "type"> & {
1038
+ readonly type: "runtime.effect.cancel.requested";
1039
+ readonly payload: {
1040
+ readonly effectId: string;
1041
+ readonly attempt: number;
1042
+ readonly deadlineAt: number | null;
1043
+ };
1044
+ }) | (Omit<EventInput, "payload" | "type"> & {
1045
+ readonly type: "runtime.effect.cancelled";
1046
+ readonly payload: {
1047
+ readonly effectId: string;
1048
+ readonly attempt: number;
1049
+ };
1050
+ }) | (Omit<EventInput, "payload" | "type"> & {
1051
+ readonly type: "runtime.effect.completed";
1052
+ readonly payload: {
1053
+ readonly effectId: string;
1054
+ readonly attempt: number;
1055
+ };
1056
+ }) | (Omit<EventInput, "payload" | "type"> & {
1057
+ readonly type: "runtime.effect.dispatched";
1058
+ readonly payload: {
1059
+ readonly effectId: string;
1060
+ readonly attempt: number;
1061
+ readonly deadlineAt: number | null;
1062
+ };
1063
+ }) | (Omit<EventInput, "payload" | "type"> & {
1064
+ readonly type: "runtime.effect.failed";
1065
+ readonly payload: {
1066
+ readonly effectId: string;
1067
+ readonly error: string;
1068
+ };
1069
+ }) | (Omit<EventInput, "payload" | "type"> & {
1070
+ readonly type: "runtime.effect.heartbeat";
1071
+ readonly payload: {
1072
+ readonly effectId: string;
1073
+ readonly attempt: number;
1074
+ readonly heartbeatAt: number;
1075
+ readonly deadlineAt: number | null;
1076
+ };
1077
+ }) | (Omit<EventInput, "payload" | "type"> & {
1078
+ readonly type: "runtime.effect.queued";
1079
+ readonly payload: {
1080
+ readonly effectId: string;
1081
+ readonly attempt: number;
1082
+ readonly deadlineAt: number | null;
1083
+ };
1084
+ }) | (Omit<EventInput, "payload" | "type"> & {
1085
+ readonly type: "runtime.effect.retry.scheduled";
1086
+ readonly payload: {
1087
+ readonly effectId: string;
1088
+ readonly attempt: number;
1089
+ readonly nextAttemptAt: number;
1090
+ readonly error: string;
1091
+ };
1092
+ }) | (Omit<EventInput, "payload" | "type"> & {
1093
+ readonly type: "runtime.effect.timed_out";
1094
+ readonly payload: {
1095
+ readonly effectId: string;
1096
+ readonly attempt: number;
1097
+ readonly timeout: string;
1098
+ };
1099
+ }) | (Omit<EventInput, "payload" | "type"> & {
1100
+ readonly type: "runtime.effect.worker.started";
1101
+ readonly payload: {
1102
+ readonly effectId: string;
1103
+ readonly attempt: number;
1104
+ readonly deadlineAt: number | null;
1105
+ };
1106
+ }) | (Omit<EventInput, "payload" | "type"> & {
1107
+ readonly type: "runtime.fork.elided";
1108
+ readonly payload: {
943
1109
  readonly type: string;
944
- readonly payload: import("effect/Schema").Json;
945
1110
  };
946
- };
947
- })>;
948
- }, {
949
- agent: import("@swirls/looms/core").ThreadDefinition<import("./types").AgentState>;
950
- 'agent-session': import("@swirls/looms/core").ThreadDefinition<import("./types").AgentSessionState>;
951
- }, {
952
- conversation: import("@swirls/looms/core").ProjectionDefinition<{
953
- readonly lines: {
954
- readonly role: "assistant" | "system" | "tool" | "user";
955
- readonly content: string;
956
- readonly toolCallId?: string | undefined;
957
- readonly name?: string | undefined;
958
- readonly toolCalls?: {
959
- readonly id: string;
960
- readonly name: string;
961
- readonly arguments: import("effect/Schema").Json;
962
- }[] | undefined;
963
- }[];
964
- }>;
965
- tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
966
- readonly input: number;
967
- readonly output: number;
968
- }>;
969
- }, import("effect/Context").Service.Any> & {
970
- readonly effects: {
971
- callLLM: import("@swirls/looms/core").EffectDefinition<{
972
- readonly turn: number;
973
- readonly definitionName?: string | undefined;
974
- readonly definitionVersion: string;
975
- readonly messages?: readonly {
976
- readonly role: "assistant" | "system" | "tool" | "user";
977
- readonly content: string;
978
- readonly toolCallId?: string | undefined;
979
- readonly name?: string | undefined;
980
- readonly toolCalls?: {
1111
+ }) | (Omit<EventInput, "payload" | "type"> & {
1112
+ readonly type: "runtime.run.cancelled";
1113
+ readonly payload: {
1114
+ readonly reason?: string | undefined;
1115
+ };
1116
+ }) | (Omit<EventInput, "payload" | "type"> & {
1117
+ readonly type: "runtime.run.completed";
1118
+ readonly payload: {
1119
+ readonly output: import("effect/Schema").Json;
1120
+ readonly error: string | null;
1121
+ };
1122
+ }) | (Omit<EventInput, "payload" | "type"> & {
1123
+ readonly type: "runtime.run.forked";
1124
+ readonly payload: {
1125
+ readonly sourceRunId: string;
1126
+ readonly sourceSeq: number;
1127
+ };
1128
+ }) | (Omit<EventInput, "payload" | "type"> & {
1129
+ readonly type: "runtime.run.started";
1130
+ readonly payload: {
1131
+ readonly rootThreadId?: string | undefined;
1132
+ readonly kind: string;
1133
+ readonly definitionName: string;
1134
+ readonly definitionVersion: string;
1135
+ readonly input: import("effect/Schema").Json;
1136
+ readonly requestedThreadId?: string | null | undefined;
1137
+ };
1138
+ }) | (Omit<EventInput, "payload" | "type"> & {
1139
+ readonly type: "runtime.signal.received";
1140
+ readonly payload: {
1141
+ readonly signalType: string;
1142
+ };
1143
+ }) | (Omit<EventInput, "payload" | "type"> & {
1144
+ readonly type: "runtime.snapshot.taken";
1145
+ readonly payload: {
1146
+ readonly seq: number;
1147
+ readonly stateHash: string;
1148
+ readonly state?: import("effect/Schema").Json | undefined;
1149
+ };
1150
+ }) | (Omit<EventInput, "payload" | "type"> & {
1151
+ readonly type: "runtime.thread.cancel.requested";
1152
+ readonly payload: {
1153
+ readonly threadId: string;
1154
+ };
1155
+ }) | (Omit<EventInput, "payload" | "type"> & {
1156
+ readonly type: "runtime.thread.cancelled";
1157
+ readonly payload: {
1158
+ readonly threadId: string;
1159
+ readonly reason?: string | undefined;
1160
+ readonly resumeSeq?: number | undefined;
1161
+ };
1162
+ }) | (Omit<EventInput, "payload" | "type"> & {
1163
+ readonly type: "runtime.thread.completed";
1164
+ readonly payload: {
1165
+ readonly threadId: string;
1166
+ readonly output: import("effect/Schema").Json;
1167
+ };
1168
+ }) | (Omit<EventInput, "payload" | "type"> & {
1169
+ readonly type: "runtime.thread.failed";
1170
+ readonly payload: {
1171
+ readonly threadId: string;
1172
+ readonly error: string;
1173
+ };
1174
+ }) | (Omit<EventInput, "payload" | "type"> & {
1175
+ readonly type: "runtime.thread.started";
1176
+ readonly payload: {
1177
+ readonly threadId: string;
1178
+ readonly kind: string;
1179
+ readonly definitionName: string;
1180
+ readonly definitionVersion: string;
1181
+ readonly input: import("effect/Schema").Json;
1182
+ readonly parentThreadId: string | null;
1183
+ };
1184
+ }) | (Omit<EventInput, "payload" | "type"> & {
1185
+ readonly type: "runtime.timer.fired";
1186
+ readonly payload: {
1187
+ readonly timerId: string;
1188
+ readonly waitId: string;
1189
+ };
1190
+ }) | (Omit<EventInput, "payload" | "type"> & {
1191
+ readonly type: "runtime.timer.set";
1192
+ readonly payload: {
1193
+ readonly timerId: string;
1194
+ readonly waitId: string;
1195
+ readonly wakeAt: number;
1196
+ };
1197
+ }) | (Omit<EventInput, "payload" | "type"> & {
1198
+ readonly type: "runtime.wait.registered";
1199
+ readonly payload: {
1200
+ readonly waitId: string;
1201
+ readonly threadId?: string | undefined;
1202
+ readonly on: {
1203
+ readonly type: string | readonly string[];
1204
+ readonly match?: import("effect/Schema").Json | undefined;
1205
+ } | {
1206
+ readonly timerAt: number;
1207
+ };
1208
+ readonly tag?: import("effect/Schema").Json | undefined;
1209
+ };
1210
+ }) | (Omit<EventInput, "payload" | "type"> & {
1211
+ readonly type: "runtime.wait.satisfied";
1212
+ readonly payload: {
1213
+ readonly waitId: string;
1214
+ readonly tag?: import("effect/Schema").Json | undefined;
1215
+ readonly event: {
981
1216
  readonly id: string;
982
- readonly name: string;
983
- readonly arguments: import("effect/Schema").Json;
984
- }[] | undefined;
985
- }[] | undefined;
986
- readonly input?: import("effect/Schema").Json | undefined;
987
- readonly consumedSteerMessageIds?: readonly string[] | undefined;
988
- }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1217
+ readonly type: string;
1218
+ readonly payload: import("effect/Schema").Json;
1219
+ };
1220
+ };
1221
+ }) | (Omit<EventInput, "payload" | "type"> & {
989
1222
  readonly type: "agent.effects.requested";
990
1223
  readonly payload: {
991
1224
  readonly toolCallId: string;
@@ -1051,7 +1284,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1051
1284
  readonly match?: import("effect/Schema").Json | undefined;
1052
1285
  } | undefined;
1053
1286
  };
1054
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1287
+ }) | (Omit<EventInput, "payload" | "type"> & {
1055
1288
  readonly type: "agent.message";
1056
1289
  readonly payload: {
1057
1290
  readonly turn: number;
@@ -1071,7 +1304,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1071
1304
  readonly output: number;
1072
1305
  } | undefined;
1073
1306
  };
1074
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1307
+ }) | (Omit<EventInput, "payload" | "type"> & {
1075
1308
  readonly type: "agent.message.received";
1076
1309
  readonly payload: {
1077
1310
  readonly message: {
@@ -1086,10 +1319,10 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1086
1319
  }[] | undefined;
1087
1320
  };
1088
1321
  };
1089
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1322
+ }) | (Omit<EventInput, "payload" | "type"> & {
1090
1323
  readonly type: "agent.session.cancel.requested";
1091
1324
  readonly payload: {};
1092
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1325
+ }) | (Omit<EventInput, "payload" | "type"> & {
1093
1326
  readonly type: "agent.session.message.submitted";
1094
1327
  readonly payload: {
1095
1328
  readonly messageId: string;
@@ -1097,26 +1330,26 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1097
1330
  readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1098
1331
  readonly activeChildThreadId?: string | undefined;
1099
1332
  };
1100
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1333
+ }) | (Omit<EventInput, "payload" | "type"> & {
1101
1334
  readonly type: "agent.session.steer.delivered";
1102
1335
  readonly payload: {
1103
1336
  readonly messageId: string;
1104
1337
  readonly activeMessageId: string;
1105
1338
  };
1106
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1339
+ }) | (Omit<EventInput, "payload" | "type"> & {
1107
1340
  readonly type: "agent.session.turn.closed";
1108
1341
  readonly payload: {
1109
1342
  readonly messageId: string;
1110
1343
  readonly status: "cancelled" | "completed" | "failed";
1111
1344
  readonly error?: string | undefined;
1112
1345
  };
1113
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1346
+ }) | (Omit<EventInput, "payload" | "type"> & {
1114
1347
  readonly type: "agent.session.turn.started";
1115
1348
  readonly payload: {
1116
1349
  readonly messageId: string;
1117
1350
  readonly childThreadId: string;
1118
1351
  };
1119
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1352
+ }) | (Omit<EventInput, "payload" | "type"> & {
1120
1353
  readonly type: "agent.spawn.requested";
1121
1354
  readonly payload: {
1122
1355
  readonly childThreadId: string;
@@ -1126,7 +1359,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1126
1359
  readonly toolCallId: string;
1127
1360
  readonly input: import("effect/Schema").Json;
1128
1361
  };
1129
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1362
+ }) | (Omit<EventInput, "payload" | "type"> & {
1130
1363
  readonly type: "agent.steered";
1131
1364
  readonly payload: {
1132
1365
  readonly turn: number;
@@ -1144,7 +1377,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1144
1377
  };
1145
1378
  readonly interrupt?: boolean | undefined;
1146
1379
  };
1147
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1380
+ }) | (Omit<EventInput, "payload" | "type"> & {
1148
1381
  readonly type: "agent.tool.result";
1149
1382
  readonly payload: {
1150
1383
  readonly turn: number;
@@ -1153,7 +1386,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1153
1386
  readonly result: import("effect/Schema").Json;
1154
1387
  readonly error: string | null;
1155
1388
  };
1156
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1389
+ }) | (Omit<EventInput, "payload" | "type"> & {
1157
1390
  readonly type: "agent.tool_call.requested";
1158
1391
  readonly payload: {
1159
1392
  readonly turn: number;
@@ -1163,63 +1396,76 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1163
1396
  readonly arguments: import("effect/Schema").Json;
1164
1397
  };
1165
1398
  };
1166
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1399
+ }) | (Omit<EventInput, "payload" | "type"> & {
1167
1400
  readonly type: "agent.turn.started";
1168
1401
  readonly payload: {
1169
1402
  readonly turn: number;
1170
1403
  };
1171
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1404
+ }) | (Omit<EventInput, "payload" | "type"> & {
1405
+ readonly type: "agent.turn.stopped";
1406
+ readonly payload: {};
1407
+ }) | (Omit<EventInput, "payload" | "type"> & {
1172
1408
  readonly type: "agent.turn.text_delta";
1173
1409
  readonly payload: {
1174
1410
  readonly turn: number;
1175
1411
  readonly delta: string;
1176
1412
  };
1177
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
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;
1422
+ };
1423
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
1178
1424
  readonly type: "runtime.effect.ambiguous";
1179
1425
  readonly payload: {
1180
1426
  readonly effectId: string;
1181
1427
  readonly attempt: number;
1182
1428
  readonly error: string;
1183
1429
  };
1184
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1430
+ }) | (Omit<EventInput, "payload" | "type"> & {
1185
1431
  readonly type: "runtime.effect.attempt.started";
1186
1432
  readonly payload: {
1187
1433
  readonly effectId: string;
1188
1434
  readonly attempt: number;
1189
1435
  };
1190
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1436
+ }) | (Omit<EventInput, "payload" | "type"> & {
1191
1437
  readonly type: "runtime.effect.cancel.requested";
1192
1438
  readonly payload: {
1193
1439
  readonly effectId: string;
1194
1440
  readonly attempt: number;
1195
1441
  readonly deadlineAt: number | null;
1196
1442
  };
1197
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1443
+ }) | (Omit<EventInput, "payload" | "type"> & {
1198
1444
  readonly type: "runtime.effect.cancelled";
1199
1445
  readonly payload: {
1200
1446
  readonly effectId: string;
1201
1447
  readonly attempt: number;
1202
1448
  };
1203
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1449
+ }) | (Omit<EventInput, "payload" | "type"> & {
1204
1450
  readonly type: "runtime.effect.completed";
1205
1451
  readonly payload: {
1206
1452
  readonly effectId: string;
1207
1453
  readonly attempt: number;
1208
1454
  };
1209
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1455
+ }) | (Omit<EventInput, "payload" | "type"> & {
1210
1456
  readonly type: "runtime.effect.dispatched";
1211
1457
  readonly payload: {
1212
1458
  readonly effectId: string;
1213
1459
  readonly attempt: number;
1214
1460
  readonly deadlineAt: number | null;
1215
1461
  };
1216
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1462
+ }) | (Omit<EventInput, "payload" | "type"> & {
1217
1463
  readonly type: "runtime.effect.failed";
1218
1464
  readonly payload: {
1219
1465
  readonly effectId: string;
1220
1466
  readonly error: string;
1221
1467
  };
1222
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1468
+ }) | (Omit<EventInput, "payload" | "type"> & {
1223
1469
  readonly type: "runtime.effect.heartbeat";
1224
1470
  readonly payload: {
1225
1471
  readonly effectId: string;
@@ -1227,14 +1473,14 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1227
1473
  readonly heartbeatAt: number;
1228
1474
  readonly deadlineAt: number | null;
1229
1475
  };
1230
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1476
+ }) | (Omit<EventInput, "payload" | "type"> & {
1231
1477
  readonly type: "runtime.effect.queued";
1232
1478
  readonly payload: {
1233
1479
  readonly effectId: string;
1234
1480
  readonly attempt: number;
1235
1481
  readonly deadlineAt: number | null;
1236
1482
  };
1237
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1483
+ }) | (Omit<EventInput, "payload" | "type"> & {
1238
1484
  readonly type: "runtime.effect.retry.scheduled";
1239
1485
  readonly payload: {
1240
1486
  readonly effectId: string;
@@ -1242,32 +1488,43 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1242
1488
  readonly nextAttemptAt: number;
1243
1489
  readonly error: string;
1244
1490
  };
1245
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1491
+ }) | (Omit<EventInput, "payload" | "type"> & {
1246
1492
  readonly type: "runtime.effect.timed_out";
1247
1493
  readonly payload: {
1248
1494
  readonly effectId: string;
1249
1495
  readonly attempt: number;
1250
1496
  readonly timeout: string;
1251
1497
  };
1252
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1498
+ }) | (Omit<EventInput, "payload" | "type"> & {
1253
1499
  readonly type: "runtime.effect.worker.started";
1254
1500
  readonly payload: {
1255
1501
  readonly effectId: string;
1256
1502
  readonly attempt: number;
1257
1503
  readonly deadlineAt: number | null;
1258
1504
  };
1259
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1505
+ }) | (Omit<EventInput, "payload" | "type"> & {
1506
+ readonly type: "runtime.fork.elided";
1507
+ readonly payload: {
1508
+ readonly type: string;
1509
+ };
1510
+ }) | (Omit<EventInput, "payload" | "type"> & {
1260
1511
  readonly type: "runtime.run.cancelled";
1261
1512
  readonly payload: {
1262
1513
  readonly reason?: string | undefined;
1263
1514
  };
1264
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1515
+ }) | (Omit<EventInput, "payload" | "type"> & {
1265
1516
  readonly type: "runtime.run.completed";
1266
1517
  readonly payload: {
1267
1518
  readonly output: import("effect/Schema").Json;
1268
1519
  readonly error: string | null;
1269
1520
  };
1270
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1521
+ }) | (Omit<EventInput, "payload" | "type"> & {
1522
+ readonly type: "runtime.run.forked";
1523
+ readonly payload: {
1524
+ readonly sourceRunId: string;
1525
+ readonly sourceSeq: number;
1526
+ };
1527
+ }) | (Omit<EventInput, "payload" | "type"> & {
1271
1528
  readonly type: "runtime.run.started";
1272
1529
  readonly payload: {
1273
1530
  readonly rootThreadId?: string | undefined;
@@ -1277,42 +1534,43 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1277
1534
  readonly input: import("effect/Schema").Json;
1278
1535
  readonly requestedThreadId?: string | null | undefined;
1279
1536
  };
1280
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1537
+ }) | (Omit<EventInput, "payload" | "type"> & {
1281
1538
  readonly type: "runtime.signal.received";
1282
1539
  readonly payload: {
1283
1540
  readonly signalType: string;
1284
1541
  };
1285
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1542
+ }) | (Omit<EventInput, "payload" | "type"> & {
1286
1543
  readonly type: "runtime.snapshot.taken";
1287
1544
  readonly payload: {
1288
1545
  readonly seq: number;
1289
1546
  readonly stateHash: string;
1290
1547
  readonly state?: import("effect/Schema").Json | undefined;
1291
1548
  };
1292
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1549
+ }) | (Omit<EventInput, "payload" | "type"> & {
1293
1550
  readonly type: "runtime.thread.cancel.requested";
1294
1551
  readonly payload: {
1295
1552
  readonly threadId: string;
1296
1553
  };
1297
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1554
+ }) | (Omit<EventInput, "payload" | "type"> & {
1298
1555
  readonly type: "runtime.thread.cancelled";
1299
1556
  readonly payload: {
1300
1557
  readonly threadId: string;
1301
1558
  readonly reason?: string | undefined;
1559
+ readonly resumeSeq?: number | undefined;
1302
1560
  };
1303
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1561
+ }) | (Omit<EventInput, "payload" | "type"> & {
1304
1562
  readonly type: "runtime.thread.completed";
1305
1563
  readonly payload: {
1306
1564
  readonly threadId: string;
1307
1565
  readonly output: import("effect/Schema").Json;
1308
1566
  };
1309
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1567
+ }) | (Omit<EventInput, "payload" | "type"> & {
1310
1568
  readonly type: "runtime.thread.failed";
1311
1569
  readonly payload: {
1312
1570
  readonly threadId: string;
1313
1571
  readonly error: string;
1314
1572
  };
1315
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1573
+ }) | (Omit<EventInput, "payload" | "type"> & {
1316
1574
  readonly type: "runtime.thread.started";
1317
1575
  readonly payload: {
1318
1576
  readonly threadId: string;
@@ -1322,20 +1580,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1322
1580
  readonly input: import("effect/Schema").Json;
1323
1581
  readonly parentThreadId: string | null;
1324
1582
  };
1325
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1583
+ }) | (Omit<EventInput, "payload" | "type"> & {
1326
1584
  readonly type: "runtime.timer.fired";
1327
1585
  readonly payload: {
1328
1586
  readonly timerId: string;
1329
1587
  readonly waitId: string;
1330
1588
  };
1331
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1589
+ }) | (Omit<EventInput, "payload" | "type"> & {
1332
1590
  readonly type: "runtime.timer.set";
1333
1591
  readonly payload: {
1334
1592
  readonly timerId: string;
1335
1593
  readonly waitId: string;
1336
1594
  readonly wakeAt: number;
1337
1595
  };
1338
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1596
+ }) | (Omit<EventInput, "payload" | "type"> & {
1339
1597
  readonly type: "runtime.wait.registered";
1340
1598
  readonly payload: {
1341
1599
  readonly waitId: string;
@@ -1348,7 +1606,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1348
1606
  };
1349
1607
  readonly tag?: import("effect/Schema").Json | undefined;
1350
1608
  };
1351
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1609
+ }) | (Omit<EventInput, "payload" | "type"> & {
1352
1610
  readonly type: "runtime.wait.satisfied";
1353
1611
  readonly payload: {
1354
1612
  readonly waitId: string;
@@ -1359,17 +1617,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1359
1617
  readonly payload: import("effect/Schema").Json;
1360
1618
  };
1361
1619
  };
1362
- })>;
1363
- executeTool: import("@swirls/looms/core").EffectDefinition<{
1364
- readonly turn: number;
1365
- readonly definitionName?: string | undefined;
1366
- readonly definitionVersion: string;
1367
- readonly toolCall: {
1368
- readonly id: string;
1369
- readonly name: string;
1370
- readonly arguments: import("effect/Schema").Json;
1371
- };
1372
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1620
+ }) | (Omit<EventInput, "payload" | "type"> & {
1373
1621
  readonly type: "agent.effects.requested";
1374
1622
  readonly payload: {
1375
1623
  readonly toolCallId: string;
@@ -1435,7 +1683,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1435
1683
  readonly match?: import("effect/Schema").Json | undefined;
1436
1684
  } | undefined;
1437
1685
  };
1438
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1686
+ }) | (Omit<EventInput, "payload" | "type"> & {
1439
1687
  readonly type: "agent.message";
1440
1688
  readonly payload: {
1441
1689
  readonly turn: number;
@@ -1455,7 +1703,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1455
1703
  readonly output: number;
1456
1704
  } | undefined;
1457
1705
  };
1458
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1706
+ }) | (Omit<EventInput, "payload" | "type"> & {
1459
1707
  readonly type: "agent.message.received";
1460
1708
  readonly payload: {
1461
1709
  readonly message: {
@@ -1470,10 +1718,10 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1470
1718
  }[] | undefined;
1471
1719
  };
1472
1720
  };
1473
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1721
+ }) | (Omit<EventInput, "payload" | "type"> & {
1474
1722
  readonly type: "agent.session.cancel.requested";
1475
1723
  readonly payload: {};
1476
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1724
+ }) | (Omit<EventInput, "payload" | "type"> & {
1477
1725
  readonly type: "agent.session.message.submitted";
1478
1726
  readonly payload: {
1479
1727
  readonly messageId: string;
@@ -1481,26 +1729,26 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1481
1729
  readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1482
1730
  readonly activeChildThreadId?: string | undefined;
1483
1731
  };
1484
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1732
+ }) | (Omit<EventInput, "payload" | "type"> & {
1485
1733
  readonly type: "agent.session.steer.delivered";
1486
1734
  readonly payload: {
1487
1735
  readonly messageId: string;
1488
1736
  readonly activeMessageId: string;
1489
1737
  };
1490
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1738
+ }) | (Omit<EventInput, "payload" | "type"> & {
1491
1739
  readonly type: "agent.session.turn.closed";
1492
1740
  readonly payload: {
1493
1741
  readonly messageId: string;
1494
1742
  readonly status: "cancelled" | "completed" | "failed";
1495
1743
  readonly error?: string | undefined;
1496
1744
  };
1497
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1745
+ }) | (Omit<EventInput, "payload" | "type"> & {
1498
1746
  readonly type: "agent.session.turn.started";
1499
1747
  readonly payload: {
1500
1748
  readonly messageId: string;
1501
1749
  readonly childThreadId: string;
1502
1750
  };
1503
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1751
+ }) | (Omit<EventInput, "payload" | "type"> & {
1504
1752
  readonly type: "agent.spawn.requested";
1505
1753
  readonly payload: {
1506
1754
  readonly childThreadId: string;
@@ -1510,7 +1758,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1510
1758
  readonly toolCallId: string;
1511
1759
  readonly input: import("effect/Schema").Json;
1512
1760
  };
1513
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1761
+ }) | (Omit<EventInput, "payload" | "type"> & {
1514
1762
  readonly type: "agent.steered";
1515
1763
  readonly payload: {
1516
1764
  readonly turn: number;
@@ -1528,7 +1776,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1528
1776
  };
1529
1777
  readonly interrupt?: boolean | undefined;
1530
1778
  };
1531
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1779
+ }) | (Omit<EventInput, "payload" | "type"> & {
1532
1780
  readonly type: "agent.tool.result";
1533
1781
  readonly payload: {
1534
1782
  readonly turn: number;
@@ -1537,7 +1785,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1537
1785
  readonly result: import("effect/Schema").Json;
1538
1786
  readonly error: string | null;
1539
1787
  };
1540
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1788
+ }) | (Omit<EventInput, "payload" | "type"> & {
1541
1789
  readonly type: "agent.tool_call.requested";
1542
1790
  readonly payload: {
1543
1791
  readonly turn: number;
@@ -1547,202 +1795,20 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1547
1795
  readonly arguments: import("effect/Schema").Json;
1548
1796
  };
1549
1797
  };
1550
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1798
+ }) | (Omit<EventInput, "payload" | "type"> & {
1551
1799
  readonly type: "agent.turn.started";
1552
1800
  readonly payload: {
1553
1801
  readonly turn: number;
1554
1802
  };
1555
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1803
+ }) | (Omit<EventInput, "payload" | "type"> & {
1804
+ readonly type: "agent.turn.stopped";
1805
+ readonly payload: {};
1806
+ }) | (Omit<EventInput, "payload" | "type"> & {
1556
1807
  readonly type: "agent.turn.text_delta";
1557
1808
  readonly payload: {
1558
1809
  readonly turn: number;
1559
1810
  readonly delta: string;
1560
1811
  };
1561
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1562
- readonly type: "runtime.effect.ambiguous";
1563
- readonly payload: {
1564
- readonly effectId: string;
1565
- readonly attempt: number;
1566
- readonly error: string;
1567
- };
1568
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1569
- readonly type: "runtime.effect.attempt.started";
1570
- readonly payload: {
1571
- readonly effectId: string;
1572
- readonly attempt: number;
1573
- };
1574
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1575
- readonly type: "runtime.effect.cancel.requested";
1576
- readonly payload: {
1577
- readonly effectId: string;
1578
- readonly attempt: number;
1579
- readonly deadlineAt: number | null;
1580
- };
1581
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1582
- readonly type: "runtime.effect.cancelled";
1583
- readonly payload: {
1584
- readonly effectId: string;
1585
- readonly attempt: number;
1586
- };
1587
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1588
- readonly type: "runtime.effect.completed";
1589
- readonly payload: {
1590
- readonly effectId: string;
1591
- readonly attempt: number;
1592
- };
1593
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1594
- readonly type: "runtime.effect.dispatched";
1595
- readonly payload: {
1596
- readonly effectId: string;
1597
- readonly attempt: number;
1598
- readonly deadlineAt: number | null;
1599
- };
1600
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1601
- readonly type: "runtime.effect.failed";
1602
- readonly payload: {
1603
- readonly effectId: string;
1604
- readonly error: string;
1605
- };
1606
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1607
- readonly type: "runtime.effect.heartbeat";
1608
- readonly payload: {
1609
- readonly effectId: string;
1610
- readonly attempt: number;
1611
- readonly heartbeatAt: number;
1612
- readonly deadlineAt: number | null;
1613
- };
1614
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1615
- readonly type: "runtime.effect.queued";
1616
- readonly payload: {
1617
- readonly effectId: string;
1618
- readonly attempt: number;
1619
- readonly deadlineAt: number | null;
1620
- };
1621
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1622
- readonly type: "runtime.effect.retry.scheduled";
1623
- readonly payload: {
1624
- readonly effectId: string;
1625
- readonly attempt: number;
1626
- readonly nextAttemptAt: number;
1627
- readonly error: string;
1628
- };
1629
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1630
- readonly type: "runtime.effect.timed_out";
1631
- readonly payload: {
1632
- readonly effectId: string;
1633
- readonly attempt: number;
1634
- readonly timeout: string;
1635
- };
1636
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1637
- readonly type: "runtime.effect.worker.started";
1638
- readonly payload: {
1639
- readonly effectId: string;
1640
- readonly attempt: number;
1641
- readonly deadlineAt: number | null;
1642
- };
1643
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1644
- readonly type: "runtime.run.cancelled";
1645
- readonly payload: {
1646
- readonly reason?: string | undefined;
1647
- };
1648
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1649
- readonly type: "runtime.run.completed";
1650
- readonly payload: {
1651
- readonly output: import("effect/Schema").Json;
1652
- readonly error: string | null;
1653
- };
1654
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1655
- readonly type: "runtime.run.started";
1656
- readonly payload: {
1657
- readonly rootThreadId?: string | undefined;
1658
- readonly kind: string;
1659
- readonly definitionName: string;
1660
- readonly definitionVersion: string;
1661
- readonly input: import("effect/Schema").Json;
1662
- readonly requestedThreadId?: string | null | undefined;
1663
- };
1664
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1665
- readonly type: "runtime.signal.received";
1666
- readonly payload: {
1667
- readonly signalType: string;
1668
- };
1669
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1670
- readonly type: "runtime.snapshot.taken";
1671
- readonly payload: {
1672
- readonly seq: number;
1673
- readonly stateHash: string;
1674
- readonly state?: import("effect/Schema").Json | undefined;
1675
- };
1676
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1677
- readonly type: "runtime.thread.cancel.requested";
1678
- readonly payload: {
1679
- readonly threadId: string;
1680
- };
1681
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1682
- readonly type: "runtime.thread.cancelled";
1683
- readonly payload: {
1684
- readonly threadId: string;
1685
- readonly reason?: string | undefined;
1686
- };
1687
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1688
- readonly type: "runtime.thread.completed";
1689
- readonly payload: {
1690
- readonly threadId: string;
1691
- readonly output: import("effect/Schema").Json;
1692
- };
1693
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1694
- readonly type: "runtime.thread.failed";
1695
- readonly payload: {
1696
- readonly threadId: string;
1697
- readonly error: string;
1698
- };
1699
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1700
- readonly type: "runtime.thread.started";
1701
- readonly payload: {
1702
- readonly threadId: string;
1703
- readonly kind: string;
1704
- readonly definitionName: string;
1705
- readonly definitionVersion: string;
1706
- readonly input: import("effect/Schema").Json;
1707
- readonly parentThreadId: string | null;
1708
- };
1709
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1710
- readonly type: "runtime.timer.fired";
1711
- readonly payload: {
1712
- readonly timerId: string;
1713
- readonly waitId: string;
1714
- };
1715
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1716
- readonly type: "runtime.timer.set";
1717
- readonly payload: {
1718
- readonly timerId: string;
1719
- readonly waitId: string;
1720
- readonly wakeAt: number;
1721
- };
1722
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1723
- readonly type: "runtime.wait.registered";
1724
- readonly payload: {
1725
- readonly waitId: string;
1726
- readonly threadId?: string | undefined;
1727
- readonly on: {
1728
- readonly type: string | readonly string[];
1729
- readonly match?: import("effect/Schema").Json | undefined;
1730
- } | {
1731
- readonly timerAt: number;
1732
- };
1733
- readonly tag?: import("effect/Schema").Json | undefined;
1734
- };
1735
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1736
- readonly type: "runtime.wait.satisfied";
1737
- readonly payload: {
1738
- readonly waitId: string;
1739
- readonly tag?: import("effect/Schema").Json | undefined;
1740
- readonly event: {
1741
- readonly id: string;
1742
- readonly type: string;
1743
- readonly payload: import("effect/Schema").Json;
1744
- };
1745
- };
1746
1812
  })>;
1747
1813
  };
1748
1814
  readonly threads: {
@@ -1767,5 +1833,9 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1767
1833
  readonly input: number;
1768
1834
  readonly output: number;
1769
1835
  }>;
1836
+ turnActivity: import("@swirls/looms/core").ProjectionDefinition<{
1837
+ readonly rootThreadId: string | null;
1838
+ readonly active: boolean;
1839
+ }>;
1770
1840
  };
1771
1841
  };