@swirls/looms 0.24.0 → 0.26.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 (116) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/actor/cell.d.ts +3 -1
  3. package/dist/actor/cell.js +1 -0
  4. package/dist/actor/host.d.ts +3 -1
  5. package/dist/actor/host.js +2 -1
  6. package/dist/actor/routing.d.ts +6 -3
  7. package/dist/actor/routing.js +6 -4
  8. package/dist/agent/agent-session.js +2 -2
  9. package/dist/agent/debugger/agent-chat.js +4 -3
  10. package/dist/agent/definitions.d.ts +3 -1
  11. package/dist/agent/effects.js +5 -3
  12. package/dist/agent/module.d.ts +730 -730
  13. package/dist/agent/threads.js +4 -1
  14. package/dist/approval/effects.d.ts +26 -26
  15. package/dist/approval/module.d.ts +52 -52
  16. package/dist/approval/steps.d.ts +3 -1
  17. package/dist/approval/steps.js +2 -2
  18. package/dist/client/client.d.ts +7 -1
  19. package/dist/client/client.js +5 -2
  20. package/dist/cloudflare/durable-object.d.ts +3 -1
  21. package/dist/cloudflare/durable-object.js +1 -0
  22. package/dist/cloudflare/queue-consumer.d.ts +3 -1
  23. package/dist/cloudflare/queue-consumer.js +2 -1
  24. package/dist/cloudflare/router.d.ts +3 -1
  25. package/dist/cloudflare/router.js +1 -1
  26. package/dist/core/compose.d.ts +8 -2
  27. package/dist/core/compose.js +6 -3
  28. package/dist/core/effects.d.ts +3 -0
  29. package/dist/core/envelope.d.ts +2 -0
  30. package/dist/core/envelope.js +2 -2
  31. package/dist/core/event-codec.d.ts +4 -3
  32. package/dist/core/event-codec.js +7 -7
  33. package/dist/core/fold.d.ts +3 -0
  34. package/dist/core/fold.js +3 -1
  35. package/dist/core/fork.js +1 -1
  36. package/dist/core/ids.d.ts +70 -5
  37. package/dist/core/ids.js +164 -41
  38. package/dist/core/snapshots.d.ts +2 -0
  39. package/dist/core/snapshots.js +2 -1
  40. package/dist/core/thread.d.ts +8 -0
  41. package/dist/debugger/app/assets/index-D_FKxPrN.js +23 -0
  42. package/dist/debugger/app/assets/routes-CkwzFejg.js +47 -0
  43. package/dist/debugger/app/index.html +1 -1
  44. package/dist/debugger/context.d.ts +4 -1
  45. package/dist/debugger/context.js +4 -4
  46. package/dist/debugger/shell/debugger-shell.d.ts +4 -1
  47. package/dist/debugger/shell/debugger-shell.js +2 -2
  48. package/dist/debugger/shell/use-start-run.d.ts +1 -1
  49. package/dist/debugger/shell/use-start-run.js +1 -2
  50. package/dist/evaluator/steps.d.ts +2 -2
  51. package/dist/evaluator/steps.js +3 -3
  52. package/dist/react/react.d.ts +8 -3
  53. package/dist/react/react.js +15 -2
  54. package/dist/react/store.d.ts +5 -1
  55. package/dist/react/store.js +5 -4
  56. package/dist/runtime/cancellation.js +5 -5
  57. package/dist/runtime/deadline-transition-planner.d.ts +1 -0
  58. package/dist/runtime/deadline-transition-planner.js +8 -7
  59. package/dist/runtime/effect-admission.js +1 -0
  60. package/dist/runtime/helpers.d.ts +6 -5
  61. package/dist/runtime/helpers.js +8 -8
  62. package/dist/runtime/local-effect-executor.js +15 -10
  63. package/dist/runtime/looms.d.ts +6 -1
  64. package/dist/runtime/looms.js +4 -1
  65. package/dist/runtime/retry-policy.d.ts +2 -1
  66. package/dist/runtime/retry-policy.js +2 -1
  67. package/dist/runtime/runtime.js +10 -10
  68. package/dist/runtime/server/routes/runs.js +5 -5
  69. package/dist/runtime/types.d.ts +7 -1
  70. package/dist/runtime/wake-engine.js +10 -9
  71. package/dist/runtime/worker-callbacks.js +9 -8
  72. package/dist/runtime/worker-effect-dispatch.d.ts +3 -2
  73. package/dist/runtime/worker-effect-dispatch.js +7 -5
  74. package/dist/swarm/board.d.ts +292 -0
  75. package/dist/swarm/board.js +123 -0
  76. package/dist/swarm/conformance.d.ts +15 -0
  77. package/dist/swarm/conformance.js +225 -0
  78. package/dist/swarm/definitions.d.ts +94 -0
  79. package/dist/swarm/definitions.js +51 -0
  80. package/dist/swarm/effects.d.ts +4720 -0
  81. package/dist/swarm/effects.js +296 -0
  82. package/dist/swarm/ensure.d.ts +16 -0
  83. package/dist/swarm/ensure.js +24 -0
  84. package/dist/swarm/events.d.ts +240 -0
  85. package/dist/swarm/events.js +49 -0
  86. package/dist/swarm/index.d.ts +15 -0
  87. package/dist/swarm/index.js +15 -0
  88. package/dist/swarm/memory-board.d.ts +10 -0
  89. package/dist/swarm/memory-board.js +344 -0
  90. package/dist/swarm/module.d.ts +9593 -0
  91. package/dist/swarm/module.js +94 -0
  92. package/dist/swarm/projections.d.ts +60 -0
  93. package/dist/swarm/projections.js +102 -0
  94. package/dist/swarm/prompt.d.ts +4 -0
  95. package/dist/swarm/prompt.js +35 -0
  96. package/dist/swarm/scope.d.ts +357 -0
  97. package/dist/swarm/scope.js +8 -0
  98. package/dist/swarm/services.d.ts +29 -0
  99. package/dist/swarm/services.js +40 -0
  100. package/dist/swarm/signals.d.ts +14 -0
  101. package/dist/swarm/signals.js +15 -0
  102. package/dist/swarm/steps.d.ts +15 -0
  103. package/dist/swarm/steps.js +27 -0
  104. package/dist/swarm/threads.d.ts +41 -0
  105. package/dist/swarm/threads.js +244 -0
  106. package/dist/swarm/tools.d.ts +20 -0
  107. package/dist/swarm/tools.js +100 -0
  108. package/dist/workflow/effects.js +6 -5
  109. package/dist/workflow/graph.d.ts +3 -3
  110. package/dist/workflow/graph.js +5 -5
  111. package/dist/workflow/module.d.ts +8 -2
  112. package/dist/workflow/threads.d.ts +14 -2
  113. package/dist/workflow/threads.js +54 -44
  114. package/package.json +7 -2
  115. package/dist/debugger/app/assets/index-CxbIGkpY.js +0 -22
  116. package/dist/debugger/app/assets/routes-Ch30UGik.js +0 -47
@@ -282,6 +282,252 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
282
282
  readonly alreadyCompacted?: boolean | undefined;
283
283
  readonly consumedSteerMessageIds?: readonly string[] | undefined;
284
284
  }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
285
+ readonly type: "runtime.child.close.requested";
286
+ readonly payload: {
287
+ readonly policy: "terminate" | "wait";
288
+ };
289
+ }) | (Omit<EventInput, "payload" | "type"> & {
290
+ readonly type: "runtime.child.settled";
291
+ readonly payload: {
292
+ readonly runId: string;
293
+ readonly status: "cancelled" | "completed" | "failed";
294
+ readonly output: import("effect/Schema").Json;
295
+ readonly error: string | null;
296
+ };
297
+ }) | (Omit<EventInput, "payload" | "type"> & {
298
+ readonly type: "runtime.effect.ambiguous";
299
+ readonly payload: {
300
+ readonly effectId: string;
301
+ readonly attempt: number;
302
+ readonly error: string;
303
+ };
304
+ }) | (Omit<EventInput, "payload" | "type"> & {
305
+ readonly type: "runtime.effect.attempt.started";
306
+ readonly payload: {
307
+ readonly effectId: string;
308
+ readonly attempt: number;
309
+ };
310
+ }) | (Omit<EventInput, "payload" | "type"> & {
311
+ readonly type: "runtime.effect.cancel.requested";
312
+ readonly payload: {
313
+ readonly effectId: string;
314
+ readonly attempt: number;
315
+ readonly deadlineAt: number | null;
316
+ };
317
+ }) | (Omit<EventInput, "payload" | "type"> & {
318
+ readonly type: "runtime.effect.cancelled";
319
+ readonly payload: {
320
+ readonly effectId: string;
321
+ readonly attempt: number;
322
+ };
323
+ }) | (Omit<EventInput, "payload" | "type"> & {
324
+ readonly type: "runtime.effect.completed";
325
+ readonly payload: {
326
+ readonly effectId: string;
327
+ readonly attempt: number;
328
+ };
329
+ }) | (Omit<EventInput, "payload" | "type"> & {
330
+ readonly type: "runtime.effect.dispatch.deferred";
331
+ readonly payload: {
332
+ readonly effectId: string;
333
+ readonly attempt: number;
334
+ readonly retryAt: number;
335
+ readonly error: string;
336
+ readonly try: number;
337
+ };
338
+ }) | (Omit<EventInput, "payload" | "type"> & {
339
+ readonly type: "runtime.effect.dispatched";
340
+ readonly payload: {
341
+ readonly effectId: string;
342
+ readonly attempt: number;
343
+ readonly deadlineAt: number | null;
344
+ };
345
+ }) | (Omit<EventInput, "payload" | "type"> & {
346
+ readonly type: "runtime.effect.failed";
347
+ readonly payload: {
348
+ readonly effectId: string;
349
+ readonly error: string;
350
+ readonly nonRetryable?: boolean | undefined;
351
+ readonly retryAfterMs?: number | undefined;
352
+ };
353
+ }) | (Omit<EventInput, "payload" | "type"> & {
354
+ readonly type: "runtime.effect.heartbeat";
355
+ readonly payload: {
356
+ readonly effectId: string;
357
+ readonly attempt: number;
358
+ readonly heartbeatAt: number;
359
+ readonly deadlineAt: number | null;
360
+ readonly details?: import("effect/Schema").Json | undefined;
361
+ };
362
+ }) | (Omit<EventInput, "payload" | "type"> & {
363
+ readonly type: "runtime.effect.queued";
364
+ readonly payload: {
365
+ readonly effectId: string;
366
+ readonly attempt: number;
367
+ readonly deadlineAt: number | null;
368
+ };
369
+ }) | (Omit<EventInput, "payload" | "type"> & {
370
+ readonly type: "runtime.effect.retry.scheduled";
371
+ readonly payload: {
372
+ readonly effectId: string;
373
+ readonly attempt: number;
374
+ readonly nextAttemptAt: number;
375
+ readonly error: string;
376
+ };
377
+ }) | (Omit<EventInput, "payload" | "type"> & {
378
+ readonly type: "runtime.effect.timed_out";
379
+ readonly payload: {
380
+ readonly effectId: string;
381
+ readonly attempt: number;
382
+ readonly timeout: string;
383
+ };
384
+ }) | (Omit<EventInput, "payload" | "type"> & {
385
+ readonly type: "runtime.effect.worker.started";
386
+ readonly payload: {
387
+ readonly effectId: string;
388
+ readonly attempt: number;
389
+ readonly deadlineAt: number | null;
390
+ };
391
+ }) | (Omit<EventInput, "payload" | "type"> & {
392
+ readonly type: "runtime.fork.elided";
393
+ readonly payload: {
394
+ readonly type: string;
395
+ };
396
+ }) | (Omit<EventInput, "payload" | "type"> & {
397
+ readonly type: "runtime.run.cancelled";
398
+ readonly payload: {
399
+ readonly reason?: string | undefined;
400
+ };
401
+ }) | (Omit<EventInput, "payload" | "type"> & {
402
+ readonly type: "runtime.run.completed";
403
+ readonly payload: {
404
+ readonly output: import("effect/Schema").Json;
405
+ readonly error: string | null;
406
+ };
407
+ }) | (Omit<EventInput, "payload" | "type"> & {
408
+ readonly type: "runtime.run.forked";
409
+ readonly payload: {
410
+ readonly sourceRunId: string;
411
+ readonly sourceSeq: number;
412
+ };
413
+ }) | (Omit<EventInput, "payload" | "type"> & {
414
+ readonly type: "runtime.run.launched";
415
+ readonly payload: {
416
+ readonly runId: string;
417
+ readonly kind: string;
418
+ readonly definitionName: string;
419
+ readonly definitionVersion: string;
420
+ readonly effectId: string;
421
+ readonly close: "terminate" | "wait";
422
+ };
423
+ }) | (Omit<EventInput, "payload" | "type"> & {
424
+ readonly type: "runtime.run.started";
425
+ readonly payload: {
426
+ readonly rootThreadId?: string | undefined;
427
+ readonly kind: string;
428
+ readonly definitionName: string;
429
+ readonly definitionVersion: string;
430
+ readonly input: import("effect/Schema").Json;
431
+ readonly requestedThreadId?: string | null | undefined;
432
+ readonly launchedBy?: {
433
+ readonly runId: string;
434
+ readonly threadId: string;
435
+ readonly effectId: string;
436
+ readonly causationId: string;
437
+ readonly causationSeq: number;
438
+ } | undefined;
439
+ readonly attributes?: {
440
+ readonly [x: string]: string;
441
+ } | undefined;
442
+ readonly trace?: {
443
+ readonly traceparent: string;
444
+ readonly tracestate?: string | undefined;
445
+ } | undefined;
446
+ };
447
+ }) | (Omit<EventInput, "payload" | "type"> & {
448
+ readonly type: "runtime.signal.received";
449
+ readonly payload: {
450
+ readonly signalType: string;
451
+ };
452
+ }) | (Omit<EventInput, "payload" | "type"> & {
453
+ readonly type: "runtime.snapshot.taken";
454
+ readonly payload: {
455
+ readonly seq: number;
456
+ readonly stateHash: string;
457
+ readonly state?: import("effect/Schema").Json | undefined;
458
+ };
459
+ }) | (Omit<EventInput, "payload" | "type"> & {
460
+ readonly type: "runtime.thread.cancel.requested";
461
+ readonly payload: {
462
+ readonly threadId: string;
463
+ };
464
+ }) | (Omit<EventInput, "payload" | "type"> & {
465
+ readonly type: "runtime.thread.cancelled";
466
+ readonly payload: {
467
+ readonly threadId: string;
468
+ readonly reason?: string | undefined;
469
+ readonly resumeSeq?: number | undefined;
470
+ };
471
+ }) | (Omit<EventInput, "payload" | "type"> & {
472
+ readonly type: "runtime.thread.completed";
473
+ readonly payload: {
474
+ readonly threadId: string;
475
+ readonly output: import("effect/Schema").Json;
476
+ };
477
+ }) | (Omit<EventInput, "payload" | "type"> & {
478
+ readonly type: "runtime.thread.failed";
479
+ readonly payload: {
480
+ readonly threadId: string;
481
+ readonly error: string;
482
+ };
483
+ }) | (Omit<EventInput, "payload" | "type"> & {
484
+ readonly type: "runtime.thread.started";
485
+ readonly payload: {
486
+ readonly threadId: string;
487
+ readonly kind: string;
488
+ readonly definitionName: string;
489
+ readonly definitionVersion: string;
490
+ readonly input: import("effect/Schema").Json;
491
+ readonly parentThreadId: string | null;
492
+ };
493
+ }) | (Omit<EventInput, "payload" | "type"> & {
494
+ readonly type: "runtime.timer.fired";
495
+ readonly payload: {
496
+ readonly timerId: string;
497
+ readonly waitId: string;
498
+ };
499
+ }) | (Omit<EventInput, "payload" | "type"> & {
500
+ readonly type: "runtime.timer.set";
501
+ readonly payload: {
502
+ readonly timerId: string;
503
+ readonly waitId: string;
504
+ readonly wakeAt: number;
505
+ };
506
+ }) | (Omit<EventInput, "payload" | "type"> & {
507
+ readonly type: "runtime.wait.registered";
508
+ readonly payload: {
509
+ readonly waitId: string;
510
+ readonly threadId?: string | undefined;
511
+ readonly on: {
512
+ readonly type: string | readonly string[];
513
+ readonly match?: import("effect/Schema").Json | undefined;
514
+ } | {
515
+ readonly timerAt: number;
516
+ };
517
+ readonly tag?: import("effect/Schema").Json | undefined;
518
+ };
519
+ }) | (Omit<EventInput, "payload" | "type"> & {
520
+ readonly type: "runtime.wait.satisfied";
521
+ readonly payload: {
522
+ readonly waitId: string;
523
+ readonly tag?: import("effect/Schema").Json | undefined;
524
+ readonly event: {
525
+ readonly id: string;
526
+ readonly type: string;
527
+ readonly payload: import("effect/Schema").Json;
528
+ };
529
+ };
530
+ }) | (Omit<EventInput, "payload" | "type"> & {
285
531
  readonly type: "agent.context.compacted";
286
532
  readonly payload: {
287
533
  readonly turn: number;
@@ -564,16 +810,28 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
564
810
  readonly input: number;
565
811
  readonly output: number;
566
812
  };
567
- }) | (Omit<EventInput, "payload" | "type"> & {
568
- readonly type: "runtime.child.close.requested";
569
- readonly payload: {
570
- readonly policy: "terminate" | "wait";
571
- };
572
- }) | (Omit<EventInput, "payload" | "type"> & {
573
- readonly type: "runtime.child.settled";
574
- readonly payload: {
575
- readonly runId: string;
576
- readonly status: "cancelled" | "completed" | "failed";
813
+ })>;
814
+ executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
815
+ readonly turn: number;
816
+ readonly definitionName?: string | undefined;
817
+ readonly definitionVersion: string;
818
+ readonly toolCall: {
819
+ readonly id: string;
820
+ readonly name: string;
821
+ readonly arguments: import("effect/Schema").Json;
822
+ };
823
+ readonly input?: import("effect/Schema").Json | undefined;
824
+ readonly depth?: number | undefined;
825
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
826
+ readonly type: "runtime.child.close.requested";
827
+ readonly payload: {
828
+ readonly policy: "terminate" | "wait";
829
+ };
830
+ }) | (Omit<EventInput, "payload" | "type"> & {
831
+ readonly type: "runtime.child.settled";
832
+ readonly payload: {
833
+ readonly runId: string;
834
+ readonly status: "cancelled" | "completed" | "failed";
577
835
  readonly output: import("effect/Schema").Json;
578
836
  readonly error: string | null;
579
837
  };
@@ -810,19 +1068,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
810
1068
  readonly payload: import("effect/Schema").Json;
811
1069
  };
812
1070
  };
813
- })>;
814
- executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
815
- readonly turn: number;
816
- readonly definitionName?: string | undefined;
817
- readonly definitionVersion: string;
818
- readonly toolCall: {
819
- readonly id: string;
820
- readonly name: string;
821
- readonly arguments: import("effect/Schema").Json;
822
- };
823
- readonly input?: import("effect/Schema").Json | undefined;
824
- readonly depth?: number | undefined;
825
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
1071
+ }) | (Omit<EventInput, "payload" | "type"> & {
826
1072
  readonly type: "agent.context.compacted";
827
1073
  readonly payload: {
828
1074
  readonly turn: number;
@@ -1105,299 +1351,212 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1105
1351
  readonly input: number;
1106
1352
  readonly output: number;
1107
1353
  };
1108
- }) | (Omit<EventInput, "payload" | "type"> & {
1109
- readonly type: "runtime.child.close.requested";
1110
- readonly payload: {
1111
- readonly policy: "terminate" | "wait";
1112
- };
1113
- }) | (Omit<EventInput, "payload" | "type"> & {
1114
- readonly type: "runtime.child.settled";
1354
+ })>;
1355
+ }, {
1356
+ agent: import("@swirls/looms/core").ThreadDefinition<import("./types").AgentState>;
1357
+ 'agent-session': import("@swirls/looms/core").ThreadDefinition<import("./types").AgentSessionState>;
1358
+ }, {
1359
+ conversation: import("@swirls/looms/core").ProjectionDefinition<{
1360
+ readonly lines: {
1361
+ readonly role: "assistant" | "system" | "tool" | "user";
1362
+ readonly content: string;
1363
+ readonly attachments?: readonly {
1364
+ readonly id: string;
1365
+ readonly mediaType: string;
1366
+ readonly name?: string | undefined;
1367
+ readonly size?: number | undefined;
1368
+ readonly url?: string | undefined;
1369
+ }[] | undefined;
1370
+ readonly toolCallId?: string | undefined;
1371
+ readonly name?: string | undefined;
1372
+ readonly toolCalls?: {
1373
+ readonly id: string;
1374
+ readonly name: string;
1375
+ readonly arguments: import("effect/Schema").Json;
1376
+ }[] | undefined;
1377
+ }[];
1378
+ }>;
1379
+ tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
1380
+ readonly input: number;
1381
+ readonly output: number;
1382
+ }>;
1383
+ turnActivity: import("@swirls/looms/core").ProjectionDefinition<{
1384
+ readonly rootThreadId: string | null;
1385
+ readonly active: boolean;
1386
+ }>;
1387
+ }, import("effect/Context").Service.Any, {
1388
+ userMessage: import("@swirls/looms/core").SignalDefinition<{
1389
+ readonly content: string;
1390
+ readonly attachments?: readonly {
1391
+ readonly id: string;
1392
+ readonly mediaType: string;
1393
+ readonly name?: string | undefined;
1394
+ readonly size?: number | undefined;
1395
+ readonly url?: string | undefined;
1396
+ }[] | undefined;
1397
+ }, Omit<EventInput, "payload" | "type"> & {
1398
+ readonly type: "agent.message.received";
1115
1399
  readonly payload: {
1116
- readonly runId: string;
1117
- readonly status: "cancelled" | "completed" | "failed";
1118
- readonly output: import("effect/Schema").Json;
1119
- readonly error: string | null;
1400
+ readonly message: {
1401
+ readonly role: "assistant" | "system" | "tool" | "user";
1402
+ readonly content: string;
1403
+ readonly attachments?: readonly {
1404
+ readonly id: string;
1405
+ readonly mediaType: string;
1406
+ readonly name?: string | undefined;
1407
+ readonly size?: number | undefined;
1408
+ readonly url?: string | undefined;
1409
+ }[] | undefined;
1410
+ readonly toolCallId?: string | undefined;
1411
+ readonly name?: string | undefined;
1412
+ readonly toolCalls?: {
1413
+ readonly id: string;
1414
+ readonly name: string;
1415
+ readonly arguments: import("effect/Schema").Json;
1416
+ }[] | undefined;
1417
+ };
1120
1418
  };
1121
- }) | (Omit<EventInput, "payload" | "type"> & {
1122
- readonly type: "runtime.effect.ambiguous";
1419
+ }>;
1420
+ steer: import("@swirls/looms/core").SignalDefinition<{
1421
+ readonly content: string;
1422
+ readonly attachments?: readonly {
1423
+ readonly id: string;
1424
+ readonly mediaType: string;
1425
+ readonly name?: string | undefined;
1426
+ readonly size?: number | undefined;
1427
+ readonly url?: string | undefined;
1428
+ }[] | undefined;
1429
+ readonly interrupt?: boolean | undefined;
1430
+ }, Omit<EventInput, "payload" | "type"> & {
1431
+ readonly type: "agent.steered";
1123
1432
  readonly payload: {
1124
- readonly effectId: string;
1125
- readonly attempt: number;
1126
- readonly error: string;
1433
+ readonly turn: number;
1434
+ readonly messageId?: string | undefined;
1435
+ readonly message: {
1436
+ readonly role: "assistant" | "system" | "tool" | "user";
1437
+ readonly content: string;
1438
+ readonly attachments?: readonly {
1439
+ readonly id: string;
1440
+ readonly mediaType: string;
1441
+ readonly name?: string | undefined;
1442
+ readonly size?: number | undefined;
1443
+ readonly url?: string | undefined;
1444
+ }[] | undefined;
1445
+ readonly toolCallId?: string | undefined;
1446
+ readonly name?: string | undefined;
1447
+ readonly toolCalls?: {
1448
+ readonly id: string;
1449
+ readonly name: string;
1450
+ readonly arguments: import("effect/Schema").Json;
1451
+ }[] | undefined;
1452
+ };
1453
+ readonly interrupt?: boolean | undefined;
1127
1454
  };
1128
- }) | (Omit<EventInput, "payload" | "type"> & {
1129
- readonly type: "runtime.effect.attempt.started";
1455
+ }>;
1456
+ stopAgentTurn: import("@swirls/looms/core").SignalDefinition<undefined, Omit<EventInput, "payload" | "type"> & {
1457
+ readonly type: "agent.turn.stopped";
1458
+ readonly payload: {};
1459
+ }>;
1460
+ submitAgentMessage: import("@swirls/looms/core").SignalDefinition<{
1461
+ readonly messageId: string;
1462
+ readonly text: string;
1463
+ readonly attachments?: readonly {
1464
+ readonly id: string;
1465
+ readonly mediaType: string;
1466
+ readonly name?: string | undefined;
1467
+ readonly size?: number | undefined;
1468
+ readonly url?: string | undefined;
1469
+ }[] | undefined;
1470
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1471
+ readonly activeChildThreadId?: string | undefined;
1472
+ }, Omit<EventInput, "payload" | "type"> & {
1473
+ readonly type: "agent.session.message.submitted";
1130
1474
  readonly payload: {
1131
- readonly effectId: string;
1132
- readonly attempt: number;
1475
+ readonly messageId: string;
1476
+ readonly text: string;
1477
+ readonly attachments?: readonly {
1478
+ readonly id: string;
1479
+ readonly mediaType: string;
1480
+ readonly name?: string | undefined;
1481
+ readonly size?: number | undefined;
1482
+ readonly url?: string | undefined;
1483
+ }[] | undefined;
1484
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1485
+ readonly activeChildThreadId?: string | undefined;
1133
1486
  };
1134
- }) | (Omit<EventInput, "payload" | "type"> & {
1135
- readonly type: "runtime.effect.cancel.requested";
1136
- readonly payload: {
1137
- readonly effectId: string;
1138
- readonly attempt: number;
1139
- readonly deadlineAt: number | null;
1487
+ }>;
1488
+ cancelAgentTurn: import("@swirls/looms/core").SignalDefinition<{
1489
+ readonly childThreadId: string;
1490
+ }, ({
1491
+ type: 'runtime.thread.cancel.requested';
1492
+ payload: {
1493
+ threadId: string;
1140
1494
  };
1141
- }) | (Omit<EventInput, "payload" | "type"> & {
1142
- readonly type: "runtime.effect.cancelled";
1495
+ } | (Omit<EventInput, "payload" | "type"> & {
1496
+ readonly type: "agent.session.cancel.requested";
1497
+ readonly payload: {};
1498
+ }))[]>;
1499
+ agentSessionMessageEvents: import("@swirls/looms/core").SignalDefinition<{
1500
+ readonly messageId: string;
1501
+ readonly text: string;
1502
+ readonly attachments?: readonly {
1503
+ readonly id: string;
1504
+ readonly mediaType: string;
1505
+ readonly name?: string | undefined;
1506
+ readonly size?: number | undefined;
1507
+ readonly url?: string | undefined;
1508
+ }[] | undefined;
1509
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1510
+ readonly activeChildThreadId?: string | undefined;
1511
+ }, ((Omit<EventInput, "payload" | "type"> & {
1512
+ readonly type: "agent.session.message.submitted";
1143
1513
  readonly payload: {
1144
- readonly effectId: string;
1145
- readonly attempt: number;
1514
+ readonly messageId: string;
1515
+ readonly text: string;
1516
+ readonly attachments?: readonly {
1517
+ readonly id: string;
1518
+ readonly mediaType: string;
1519
+ readonly name?: string | undefined;
1520
+ readonly size?: number | undefined;
1521
+ readonly url?: string | undefined;
1522
+ }[] | undefined;
1523
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1524
+ readonly activeChildThreadId?: string | undefined;
1146
1525
  };
1147
1526
  }) | (Omit<EventInput, "payload" | "type"> & {
1148
- readonly type: "runtime.effect.completed";
1527
+ readonly type: "agent.steered";
1149
1528
  readonly payload: {
1150
- readonly effectId: string;
1151
- readonly attempt: number;
1529
+ readonly turn: number;
1530
+ readonly messageId?: string | undefined;
1531
+ readonly message: {
1532
+ readonly role: "assistant" | "system" | "tool" | "user";
1533
+ readonly content: string;
1534
+ readonly attachments?: readonly {
1535
+ readonly id: string;
1536
+ readonly mediaType: string;
1537
+ readonly name?: string | undefined;
1538
+ readonly size?: number | undefined;
1539
+ readonly url?: string | undefined;
1540
+ }[] | undefined;
1541
+ readonly toolCallId?: string | undefined;
1542
+ readonly name?: string | undefined;
1543
+ readonly toolCalls?: {
1544
+ readonly id: string;
1545
+ readonly name: string;
1546
+ readonly arguments: import("effect/Schema").Json;
1547
+ }[] | undefined;
1548
+ };
1549
+ readonly interrupt?: boolean | undefined;
1152
1550
  };
1153
- }) | (Omit<EventInput, "payload" | "type"> & {
1154
- readonly type: "runtime.effect.dispatch.deferred";
1155
- readonly payload: {
1156
- readonly effectId: string;
1157
- readonly attempt: number;
1158
- readonly retryAt: number;
1159
- readonly error: string;
1160
- readonly try: number;
1161
- };
1162
- }) | (Omit<EventInput, "payload" | "type"> & {
1163
- readonly type: "runtime.effect.dispatched";
1164
- readonly payload: {
1165
- readonly effectId: string;
1166
- readonly attempt: number;
1167
- readonly deadlineAt: number | null;
1168
- };
1169
- }) | (Omit<EventInput, "payload" | "type"> & {
1170
- readonly type: "runtime.effect.failed";
1171
- readonly payload: {
1172
- readonly effectId: string;
1173
- readonly error: string;
1174
- readonly nonRetryable?: boolean | undefined;
1175
- readonly retryAfterMs?: number | undefined;
1176
- };
1177
- }) | (Omit<EventInput, "payload" | "type"> & {
1178
- readonly type: "runtime.effect.heartbeat";
1179
- readonly payload: {
1180
- readonly effectId: string;
1181
- readonly attempt: number;
1182
- readonly heartbeatAt: number;
1183
- readonly deadlineAt: number | null;
1184
- readonly details?: import("effect/Schema").Json | undefined;
1185
- };
1186
- }) | (Omit<EventInput, "payload" | "type"> & {
1187
- readonly type: "runtime.effect.queued";
1188
- readonly payload: {
1189
- readonly effectId: string;
1190
- readonly attempt: number;
1191
- readonly deadlineAt: number | null;
1192
- };
1193
- }) | (Omit<EventInput, "payload" | "type"> & {
1194
- readonly type: "runtime.effect.retry.scheduled";
1195
- readonly payload: {
1196
- readonly effectId: string;
1197
- readonly attempt: number;
1198
- readonly nextAttemptAt: number;
1199
- readonly error: string;
1200
- };
1201
- }) | (Omit<EventInput, "payload" | "type"> & {
1202
- readonly type: "runtime.effect.timed_out";
1203
- readonly payload: {
1204
- readonly effectId: string;
1205
- readonly attempt: number;
1206
- readonly timeout: string;
1207
- };
1208
- }) | (Omit<EventInput, "payload" | "type"> & {
1209
- readonly type: "runtime.effect.worker.started";
1210
- readonly payload: {
1211
- readonly effectId: string;
1212
- readonly attempt: number;
1213
- readonly deadlineAt: number | null;
1214
- };
1215
- }) | (Omit<EventInput, "payload" | "type"> & {
1216
- readonly type: "runtime.fork.elided";
1217
- readonly payload: {
1218
- readonly type: string;
1219
- };
1220
- }) | (Omit<EventInput, "payload" | "type"> & {
1221
- readonly type: "runtime.run.cancelled";
1222
- readonly payload: {
1223
- readonly reason?: string | undefined;
1224
- };
1225
- }) | (Omit<EventInput, "payload" | "type"> & {
1226
- readonly type: "runtime.run.completed";
1227
- readonly payload: {
1228
- readonly output: import("effect/Schema").Json;
1229
- readonly error: string | null;
1230
- };
1231
- }) | (Omit<EventInput, "payload" | "type"> & {
1232
- readonly type: "runtime.run.forked";
1233
- readonly payload: {
1234
- readonly sourceRunId: string;
1235
- readonly sourceSeq: number;
1236
- };
1237
- }) | (Omit<EventInput, "payload" | "type"> & {
1238
- readonly type: "runtime.run.launched";
1239
- readonly payload: {
1240
- readonly runId: string;
1241
- readonly kind: string;
1242
- readonly definitionName: string;
1243
- readonly definitionVersion: string;
1244
- readonly effectId: string;
1245
- readonly close: "terminate" | "wait";
1246
- };
1247
- }) | (Omit<EventInput, "payload" | "type"> & {
1248
- readonly type: "runtime.run.started";
1249
- readonly payload: {
1250
- readonly rootThreadId?: string | undefined;
1251
- readonly kind: string;
1252
- readonly definitionName: string;
1253
- readonly definitionVersion: string;
1254
- readonly input: import("effect/Schema").Json;
1255
- readonly requestedThreadId?: string | null | undefined;
1256
- readonly launchedBy?: {
1257
- readonly runId: string;
1258
- readonly threadId: string;
1259
- readonly effectId: string;
1260
- readonly causationId: string;
1261
- readonly causationSeq: number;
1262
- } | undefined;
1263
- readonly attributes?: {
1264
- readonly [x: string]: string;
1265
- } | undefined;
1266
- readonly trace?: {
1267
- readonly traceparent: string;
1268
- readonly tracestate?: string | undefined;
1269
- } | undefined;
1270
- };
1271
- }) | (Omit<EventInput, "payload" | "type"> & {
1272
- readonly type: "runtime.signal.received";
1273
- readonly payload: {
1274
- readonly signalType: string;
1275
- };
1276
- }) | (Omit<EventInput, "payload" | "type"> & {
1277
- readonly type: "runtime.snapshot.taken";
1278
- readonly payload: {
1279
- readonly seq: number;
1280
- readonly stateHash: string;
1281
- readonly state?: import("effect/Schema").Json | undefined;
1282
- };
1283
- }) | (Omit<EventInput, "payload" | "type"> & {
1284
- readonly type: "runtime.thread.cancel.requested";
1285
- readonly payload: {
1286
- readonly threadId: string;
1287
- };
1288
- }) | (Omit<EventInput, "payload" | "type"> & {
1289
- readonly type: "runtime.thread.cancelled";
1290
- readonly payload: {
1291
- readonly threadId: string;
1292
- readonly reason?: string | undefined;
1293
- readonly resumeSeq?: number | undefined;
1294
- };
1295
- }) | (Omit<EventInput, "payload" | "type"> & {
1296
- readonly type: "runtime.thread.completed";
1297
- readonly payload: {
1298
- readonly threadId: string;
1299
- readonly output: import("effect/Schema").Json;
1300
- };
1301
- }) | (Omit<EventInput, "payload" | "type"> & {
1302
- readonly type: "runtime.thread.failed";
1303
- readonly payload: {
1304
- readonly threadId: string;
1305
- readonly error: string;
1306
- };
1307
- }) | (Omit<EventInput, "payload" | "type"> & {
1308
- readonly type: "runtime.thread.started";
1309
- readonly payload: {
1310
- readonly threadId: string;
1311
- readonly kind: string;
1312
- readonly definitionName: string;
1551
+ }))[]>;
1552
+ }, {}> & {
1553
+ readonly effects: {
1554
+ callLLM: import("@swirls/looms/core").LocalEffectDefinition<{
1555
+ readonly turn: number;
1556
+ readonly messageTurn?: number | undefined;
1557
+ readonly definitionName?: string | undefined;
1313
1558
  readonly definitionVersion: string;
1314
- readonly input: import("effect/Schema").Json;
1315
- readonly parentThreadId: string | null;
1316
- };
1317
- }) | (Omit<EventInput, "payload" | "type"> & {
1318
- readonly type: "runtime.timer.fired";
1319
- readonly payload: {
1320
- readonly timerId: string;
1321
- readonly waitId: string;
1322
- };
1323
- }) | (Omit<EventInput, "payload" | "type"> & {
1324
- readonly type: "runtime.timer.set";
1325
- readonly payload: {
1326
- readonly timerId: string;
1327
- readonly waitId: string;
1328
- readonly wakeAt: number;
1329
- };
1330
- }) | (Omit<EventInput, "payload" | "type"> & {
1331
- readonly type: "runtime.wait.registered";
1332
- readonly payload: {
1333
- readonly waitId: string;
1334
- readonly threadId?: string | undefined;
1335
- readonly on: {
1336
- readonly type: string | readonly string[];
1337
- readonly match?: import("effect/Schema").Json | undefined;
1338
- } | {
1339
- readonly timerAt: number;
1340
- };
1341
- readonly tag?: import("effect/Schema").Json | undefined;
1342
- };
1343
- }) | (Omit<EventInput, "payload" | "type"> & {
1344
- readonly type: "runtime.wait.satisfied";
1345
- readonly payload: {
1346
- readonly waitId: string;
1347
- readonly tag?: import("effect/Schema").Json | undefined;
1348
- readonly event: {
1349
- readonly id: string;
1350
- readonly type: string;
1351
- readonly payload: import("effect/Schema").Json;
1352
- };
1353
- };
1354
- })>;
1355
- }, {
1356
- agent: import("@swirls/looms/core").ThreadDefinition<import("./types").AgentState>;
1357
- 'agent-session': import("@swirls/looms/core").ThreadDefinition<import("./types").AgentSessionState>;
1358
- }, {
1359
- conversation: import("@swirls/looms/core").ProjectionDefinition<{
1360
- readonly lines: {
1361
- readonly role: "assistant" | "system" | "tool" | "user";
1362
- readonly content: string;
1363
- readonly attachments?: readonly {
1364
- readonly id: string;
1365
- readonly mediaType: string;
1366
- readonly name?: string | undefined;
1367
- readonly size?: number | undefined;
1368
- readonly url?: string | undefined;
1369
- }[] | undefined;
1370
- readonly toolCallId?: string | undefined;
1371
- readonly name?: string | undefined;
1372
- readonly toolCalls?: {
1373
- readonly id: string;
1374
- readonly name: string;
1375
- readonly arguments: import("effect/Schema").Json;
1376
- }[] | undefined;
1377
- }[];
1378
- }>;
1379
- tokenUsage: import("@swirls/looms/core").ProjectionDefinition<{
1380
- readonly input: number;
1381
- readonly output: number;
1382
- }>;
1383
- turnActivity: import("@swirls/looms/core").ProjectionDefinition<{
1384
- readonly rootThreadId: string | null;
1385
- readonly active: boolean;
1386
- }>;
1387
- }, import("effect/Context").Service.Any, {
1388
- userMessage: import("@swirls/looms/core").SignalDefinition<{
1389
- readonly content: string;
1390
- readonly attachments?: readonly {
1391
- readonly id: string;
1392
- readonly mediaType: string;
1393
- readonly name?: string | undefined;
1394
- readonly size?: number | undefined;
1395
- readonly url?: string | undefined;
1396
- }[] | undefined;
1397
- }, Omit<EventInput, "payload" | "type"> & {
1398
- readonly type: "agent.message.received";
1399
- readonly payload: {
1400
- readonly message: {
1559
+ readonly messages?: readonly {
1401
1560
  readonly role: "assistant" | "system" | "tool" | "user";
1402
1561
  readonly content: string;
1403
1562
  readonly attachments?: readonly {
@@ -1414,171 +1573,258 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1414
1573
  readonly name: string;
1415
1574
  readonly arguments: import("effect/Schema").Json;
1416
1575
  }[] | undefined;
1576
+ }[] | undefined;
1577
+ readonly input?: import("effect/Schema").Json | undefined;
1578
+ readonly structuredOutput?: import("effect/Schema").Json | undefined;
1579
+ readonly alreadyCompacted?: boolean | undefined;
1580
+ readonly consumedSteerMessageIds?: readonly string[] | undefined;
1581
+ }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
1582
+ readonly type: "runtime.child.close.requested";
1583
+ readonly payload: {
1584
+ readonly policy: "terminate" | "wait";
1585
+ };
1586
+ }) | (Omit<EventInput, "payload" | "type"> & {
1587
+ readonly type: "runtime.child.settled";
1588
+ readonly payload: {
1589
+ readonly runId: string;
1590
+ readonly status: "cancelled" | "completed" | "failed";
1591
+ readonly output: import("effect/Schema").Json;
1592
+ readonly error: string | null;
1593
+ };
1594
+ }) | (Omit<EventInput, "payload" | "type"> & {
1595
+ readonly type: "runtime.effect.ambiguous";
1596
+ readonly payload: {
1597
+ readonly effectId: string;
1598
+ readonly attempt: number;
1599
+ readonly error: string;
1600
+ };
1601
+ }) | (Omit<EventInput, "payload" | "type"> & {
1602
+ readonly type: "runtime.effect.attempt.started";
1603
+ readonly payload: {
1604
+ readonly effectId: string;
1605
+ readonly attempt: number;
1606
+ };
1607
+ }) | (Omit<EventInput, "payload" | "type"> & {
1608
+ readonly type: "runtime.effect.cancel.requested";
1609
+ readonly payload: {
1610
+ readonly effectId: string;
1611
+ readonly attempt: number;
1612
+ readonly deadlineAt: number | null;
1613
+ };
1614
+ }) | (Omit<EventInput, "payload" | "type"> & {
1615
+ readonly type: "runtime.effect.cancelled";
1616
+ readonly payload: {
1617
+ readonly effectId: string;
1618
+ readonly attempt: number;
1619
+ };
1620
+ }) | (Omit<EventInput, "payload" | "type"> & {
1621
+ readonly type: "runtime.effect.completed";
1622
+ readonly payload: {
1623
+ readonly effectId: string;
1624
+ readonly attempt: number;
1625
+ };
1626
+ }) | (Omit<EventInput, "payload" | "type"> & {
1627
+ readonly type: "runtime.effect.dispatch.deferred";
1628
+ readonly payload: {
1629
+ readonly effectId: string;
1630
+ readonly attempt: number;
1631
+ readonly retryAt: number;
1632
+ readonly error: string;
1633
+ readonly try: number;
1634
+ };
1635
+ }) | (Omit<EventInput, "payload" | "type"> & {
1636
+ readonly type: "runtime.effect.dispatched";
1637
+ readonly payload: {
1638
+ readonly effectId: string;
1639
+ readonly attempt: number;
1640
+ readonly deadlineAt: number | null;
1641
+ };
1642
+ }) | (Omit<EventInput, "payload" | "type"> & {
1643
+ readonly type: "runtime.effect.failed";
1644
+ readonly payload: {
1645
+ readonly effectId: string;
1646
+ readonly error: string;
1647
+ readonly nonRetryable?: boolean | undefined;
1648
+ readonly retryAfterMs?: number | undefined;
1649
+ };
1650
+ }) | (Omit<EventInput, "payload" | "type"> & {
1651
+ readonly type: "runtime.effect.heartbeat";
1652
+ readonly payload: {
1653
+ readonly effectId: string;
1654
+ readonly attempt: number;
1655
+ readonly heartbeatAt: number;
1656
+ readonly deadlineAt: number | null;
1657
+ readonly details?: import("effect/Schema").Json | undefined;
1658
+ };
1659
+ }) | (Omit<EventInput, "payload" | "type"> & {
1660
+ readonly type: "runtime.effect.queued";
1661
+ readonly payload: {
1662
+ readonly effectId: string;
1663
+ readonly attempt: number;
1664
+ readonly deadlineAt: number | null;
1665
+ };
1666
+ }) | (Omit<EventInput, "payload" | "type"> & {
1667
+ readonly type: "runtime.effect.retry.scheduled";
1668
+ readonly payload: {
1669
+ readonly effectId: string;
1670
+ readonly attempt: number;
1671
+ readonly nextAttemptAt: number;
1672
+ readonly error: string;
1673
+ };
1674
+ }) | (Omit<EventInput, "payload" | "type"> & {
1675
+ readonly type: "runtime.effect.timed_out";
1676
+ readonly payload: {
1677
+ readonly effectId: string;
1678
+ readonly attempt: number;
1679
+ readonly timeout: string;
1680
+ };
1681
+ }) | (Omit<EventInput, "payload" | "type"> & {
1682
+ readonly type: "runtime.effect.worker.started";
1683
+ readonly payload: {
1684
+ readonly effectId: string;
1685
+ readonly attempt: number;
1686
+ readonly deadlineAt: number | null;
1687
+ };
1688
+ }) | (Omit<EventInput, "payload" | "type"> & {
1689
+ readonly type: "runtime.fork.elided";
1690
+ readonly payload: {
1691
+ readonly type: string;
1692
+ };
1693
+ }) | (Omit<EventInput, "payload" | "type"> & {
1694
+ readonly type: "runtime.run.cancelled";
1695
+ readonly payload: {
1696
+ readonly reason?: string | undefined;
1697
+ };
1698
+ }) | (Omit<EventInput, "payload" | "type"> & {
1699
+ readonly type: "runtime.run.completed";
1700
+ readonly payload: {
1701
+ readonly output: import("effect/Schema").Json;
1702
+ readonly error: string | null;
1703
+ };
1704
+ }) | (Omit<EventInput, "payload" | "type"> & {
1705
+ readonly type: "runtime.run.forked";
1706
+ readonly payload: {
1707
+ readonly sourceRunId: string;
1708
+ readonly sourceSeq: number;
1709
+ };
1710
+ }) | (Omit<EventInput, "payload" | "type"> & {
1711
+ readonly type: "runtime.run.launched";
1712
+ readonly payload: {
1713
+ readonly runId: string;
1714
+ readonly kind: string;
1715
+ readonly definitionName: string;
1716
+ readonly definitionVersion: string;
1717
+ readonly effectId: string;
1718
+ readonly close: "terminate" | "wait";
1719
+ };
1720
+ }) | (Omit<EventInput, "payload" | "type"> & {
1721
+ readonly type: "runtime.run.started";
1722
+ readonly payload: {
1723
+ readonly rootThreadId?: string | undefined;
1724
+ readonly kind: string;
1725
+ readonly definitionName: string;
1726
+ readonly definitionVersion: string;
1727
+ readonly input: import("effect/Schema").Json;
1728
+ readonly requestedThreadId?: string | null | undefined;
1729
+ readonly launchedBy?: {
1730
+ readonly runId: string;
1731
+ readonly threadId: string;
1732
+ readonly effectId: string;
1733
+ readonly causationId: string;
1734
+ readonly causationSeq: number;
1735
+ } | undefined;
1736
+ readonly attributes?: {
1737
+ readonly [x: string]: string;
1738
+ } | undefined;
1739
+ readonly trace?: {
1740
+ readonly traceparent: string;
1741
+ readonly tracestate?: string | undefined;
1742
+ } | undefined;
1743
+ };
1744
+ }) | (Omit<EventInput, "payload" | "type"> & {
1745
+ readonly type: "runtime.signal.received";
1746
+ readonly payload: {
1747
+ readonly signalType: string;
1748
+ };
1749
+ }) | (Omit<EventInput, "payload" | "type"> & {
1750
+ readonly type: "runtime.snapshot.taken";
1751
+ readonly payload: {
1752
+ readonly seq: number;
1753
+ readonly stateHash: string;
1754
+ readonly state?: import("effect/Schema").Json | undefined;
1755
+ };
1756
+ }) | (Omit<EventInput, "payload" | "type"> & {
1757
+ readonly type: "runtime.thread.cancel.requested";
1758
+ readonly payload: {
1759
+ readonly threadId: string;
1417
1760
  };
1418
- };
1419
- }>;
1420
- steer: import("@swirls/looms/core").SignalDefinition<{
1421
- readonly content: string;
1422
- readonly attachments?: readonly {
1423
- readonly id: string;
1424
- readonly mediaType: string;
1425
- readonly name?: string | undefined;
1426
- readonly size?: number | undefined;
1427
- readonly url?: string | undefined;
1428
- }[] | undefined;
1429
- readonly interrupt?: boolean | undefined;
1430
- }, Omit<EventInput, "payload" | "type"> & {
1431
- readonly type: "agent.steered";
1432
- readonly payload: {
1433
- readonly turn: number;
1434
- readonly messageId?: string | undefined;
1435
- readonly message: {
1436
- readonly role: "assistant" | "system" | "tool" | "user";
1437
- readonly content: string;
1438
- readonly attachments?: readonly {
1439
- readonly id: string;
1440
- readonly mediaType: string;
1441
- readonly name?: string | undefined;
1442
- readonly size?: number | undefined;
1443
- readonly url?: string | undefined;
1444
- }[] | undefined;
1445
- readonly toolCallId?: string | undefined;
1446
- readonly name?: string | undefined;
1447
- readonly toolCalls?: {
1448
- readonly id: string;
1449
- readonly name: string;
1450
- readonly arguments: import("effect/Schema").Json;
1451
- }[] | undefined;
1761
+ }) | (Omit<EventInput, "payload" | "type"> & {
1762
+ readonly type: "runtime.thread.cancelled";
1763
+ readonly payload: {
1764
+ readonly threadId: string;
1765
+ readonly reason?: string | undefined;
1766
+ readonly resumeSeq?: number | undefined;
1452
1767
  };
1453
- readonly interrupt?: boolean | undefined;
1454
- };
1455
- }>;
1456
- stopAgentTurn: import("@swirls/looms/core").SignalDefinition<undefined, Omit<EventInput, "payload" | "type"> & {
1457
- readonly type: "agent.turn.stopped";
1458
- readonly payload: {};
1459
- }>;
1460
- submitAgentMessage: import("@swirls/looms/core").SignalDefinition<{
1461
- readonly messageId: string;
1462
- readonly text: string;
1463
- readonly attachments?: readonly {
1464
- readonly id: string;
1465
- readonly mediaType: string;
1466
- readonly name?: string | undefined;
1467
- readonly size?: number | undefined;
1468
- readonly url?: string | undefined;
1469
- }[] | undefined;
1470
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1471
- readonly activeChildThreadId?: string | undefined;
1472
- }, Omit<EventInput, "payload" | "type"> & {
1473
- readonly type: "agent.session.message.submitted";
1474
- readonly payload: {
1475
- readonly messageId: string;
1476
- readonly text: string;
1477
- readonly attachments?: readonly {
1478
- readonly id: string;
1479
- readonly mediaType: string;
1480
- readonly name?: string | undefined;
1481
- readonly size?: number | undefined;
1482
- readonly url?: string | undefined;
1483
- }[] | undefined;
1484
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1485
- readonly activeChildThreadId?: string | undefined;
1486
- };
1487
- }>;
1488
- cancelAgentTurn: import("@swirls/looms/core").SignalDefinition<{
1489
- readonly childThreadId: string;
1490
- }, ({
1491
- type: 'runtime.thread.cancel.requested';
1492
- payload: {
1493
- threadId: string;
1494
- };
1495
- } | (Omit<EventInput, "payload" | "type"> & {
1496
- readonly type: "agent.session.cancel.requested";
1497
- readonly payload: {};
1498
- }))[]>;
1499
- agentSessionMessageEvents: import("@swirls/looms/core").SignalDefinition<{
1500
- readonly messageId: string;
1501
- readonly text: string;
1502
- readonly attachments?: readonly {
1503
- readonly id: string;
1504
- readonly mediaType: string;
1505
- readonly name?: string | undefined;
1506
- readonly size?: number | undefined;
1507
- readonly url?: string | undefined;
1508
- }[] | undefined;
1509
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1510
- readonly activeChildThreadId?: string | undefined;
1511
- }, ((Omit<EventInput, "payload" | "type"> & {
1512
- readonly type: "agent.session.message.submitted";
1513
- readonly payload: {
1514
- readonly messageId: string;
1515
- readonly text: string;
1516
- readonly attachments?: readonly {
1517
- readonly id: string;
1518
- readonly mediaType: string;
1519
- readonly name?: string | undefined;
1520
- readonly size?: number | undefined;
1521
- readonly url?: string | undefined;
1522
- }[] | undefined;
1523
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1524
- readonly activeChildThreadId?: string | undefined;
1525
- };
1526
- }) | (Omit<EventInput, "payload" | "type"> & {
1527
- readonly type: "agent.steered";
1528
- readonly payload: {
1529
- readonly turn: number;
1530
- readonly messageId?: string | undefined;
1531
- readonly message: {
1532
- readonly role: "assistant" | "system" | "tool" | "user";
1533
- readonly content: string;
1534
- readonly attachments?: readonly {
1535
- readonly id: string;
1536
- readonly mediaType: string;
1537
- readonly name?: string | undefined;
1538
- readonly size?: number | undefined;
1539
- readonly url?: string | undefined;
1540
- }[] | undefined;
1541
- readonly toolCallId?: string | undefined;
1542
- readonly name?: string | undefined;
1543
- readonly toolCalls?: {
1544
- readonly id: string;
1545
- readonly name: string;
1546
- readonly arguments: import("effect/Schema").Json;
1547
- }[] | undefined;
1768
+ }) | (Omit<EventInput, "payload" | "type"> & {
1769
+ readonly type: "runtime.thread.completed";
1770
+ readonly payload: {
1771
+ readonly threadId: string;
1772
+ readonly output: import("effect/Schema").Json;
1548
1773
  };
1549
- readonly interrupt?: boolean | undefined;
1550
- };
1551
- }))[]>;
1552
- }, {}> & {
1553
- readonly effects: {
1554
- callLLM: import("@swirls/looms/core").LocalEffectDefinition<{
1555
- readonly turn: number;
1556
- readonly messageTurn?: number | undefined;
1557
- readonly definitionName?: string | undefined;
1558
- readonly definitionVersion: string;
1559
- readonly messages?: readonly {
1560
- readonly role: "assistant" | "system" | "tool" | "user";
1561
- readonly content: string;
1562
- readonly attachments?: readonly {
1563
- readonly id: string;
1564
- readonly mediaType: string;
1565
- readonly name?: string | undefined;
1566
- readonly size?: number | undefined;
1567
- readonly url?: string | undefined;
1568
- }[] | undefined;
1569
- readonly toolCallId?: string | undefined;
1570
- readonly name?: string | undefined;
1571
- readonly toolCalls?: {
1774
+ }) | (Omit<EventInput, "payload" | "type"> & {
1775
+ readonly type: "runtime.thread.failed";
1776
+ readonly payload: {
1777
+ readonly threadId: string;
1778
+ readonly error: string;
1779
+ };
1780
+ }) | (Omit<EventInput, "payload" | "type"> & {
1781
+ readonly type: "runtime.thread.started";
1782
+ readonly payload: {
1783
+ readonly threadId: string;
1784
+ readonly kind: string;
1785
+ readonly definitionName: string;
1786
+ readonly definitionVersion: string;
1787
+ readonly input: import("effect/Schema").Json;
1788
+ readonly parentThreadId: string | null;
1789
+ };
1790
+ }) | (Omit<EventInput, "payload" | "type"> & {
1791
+ readonly type: "runtime.timer.fired";
1792
+ readonly payload: {
1793
+ readonly timerId: string;
1794
+ readonly waitId: string;
1795
+ };
1796
+ }) | (Omit<EventInput, "payload" | "type"> & {
1797
+ readonly type: "runtime.timer.set";
1798
+ readonly payload: {
1799
+ readonly timerId: string;
1800
+ readonly waitId: string;
1801
+ readonly wakeAt: number;
1802
+ };
1803
+ }) | (Omit<EventInput, "payload" | "type"> & {
1804
+ readonly type: "runtime.wait.registered";
1805
+ readonly payload: {
1806
+ readonly waitId: string;
1807
+ readonly threadId?: string | undefined;
1808
+ readonly on: {
1809
+ readonly type: string | readonly string[];
1810
+ readonly match?: import("effect/Schema").Json | undefined;
1811
+ } | {
1812
+ readonly timerAt: number;
1813
+ };
1814
+ readonly tag?: import("effect/Schema").Json | undefined;
1815
+ };
1816
+ }) | (Omit<EventInput, "payload" | "type"> & {
1817
+ readonly type: "runtime.wait.satisfied";
1818
+ readonly payload: {
1819
+ readonly waitId: string;
1820
+ readonly tag?: import("effect/Schema").Json | undefined;
1821
+ readonly event: {
1572
1822
  readonly id: string;
1573
- readonly name: string;
1574
- readonly arguments: import("effect/Schema").Json;
1575
- }[] | undefined;
1576
- }[] | undefined;
1577
- readonly input?: import("effect/Schema").Json | undefined;
1578
- readonly structuredOutput?: import("effect/Schema").Json | undefined;
1579
- readonly alreadyCompacted?: boolean | undefined;
1580
- readonly consumedSteerMessageIds?: readonly string[] | undefined;
1581
- }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
1823
+ readonly type: string;
1824
+ readonly payload: import("effect/Schema").Json;
1825
+ };
1826
+ };
1827
+ }) | (Omit<EventInput, "payload" | "type"> & {
1582
1828
  readonly type: "agent.context.compacted";
1583
1829
  readonly payload: {
1584
1830
  readonly turn: number;
@@ -1861,7 +2107,19 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1861
2107
  readonly input: number;
1862
2108
  readonly output: number;
1863
2109
  };
1864
- }) | (Omit<EventInput, "payload" | "type"> & {
2110
+ })>;
2111
+ executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
2112
+ readonly turn: number;
2113
+ readonly definitionName?: string | undefined;
2114
+ readonly definitionVersion: string;
2115
+ readonly toolCall: {
2116
+ readonly id: string;
2117
+ readonly name: string;
2118
+ readonly arguments: import("effect/Schema").Json;
2119
+ };
2120
+ readonly input?: import("effect/Schema").Json | undefined;
2121
+ readonly depth?: number | undefined;
2122
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
1865
2123
  readonly type: "runtime.child.close.requested";
1866
2124
  readonly payload: {
1867
2125
  readonly policy: "terminate" | "wait";
@@ -2100,26 +2358,14 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
2100
2358
  readonly type: "runtime.wait.satisfied";
2101
2359
  readonly payload: {
2102
2360
  readonly waitId: string;
2103
- readonly tag?: import("effect/Schema").Json | undefined;
2104
- readonly event: {
2105
- readonly id: string;
2106
- readonly type: string;
2107
- readonly payload: import("effect/Schema").Json;
2108
- };
2109
- };
2110
- })>;
2111
- executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
2112
- readonly turn: number;
2113
- readonly definitionName?: string | undefined;
2114
- readonly definitionVersion: string;
2115
- readonly toolCall: {
2116
- readonly id: string;
2117
- readonly name: string;
2118
- readonly arguments: import("effect/Schema").Json;
2361
+ readonly tag?: import("effect/Schema").Json | undefined;
2362
+ readonly event: {
2363
+ readonly id: string;
2364
+ readonly type: string;
2365
+ readonly payload: import("effect/Schema").Json;
2366
+ };
2119
2367
  };
2120
- readonly input?: import("effect/Schema").Json | undefined;
2121
- readonly depth?: number | undefined;
2122
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
2368
+ }) | (Omit<EventInput, "payload" | "type"> & {
2123
2369
  readonly type: "agent.context.compacted";
2124
2370
  readonly payload: {
2125
2371
  readonly turn: number;
@@ -2402,252 +2648,6 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
2402
2648
  readonly input: number;
2403
2649
  readonly output: number;
2404
2650
  };
2405
- }) | (Omit<EventInput, "payload" | "type"> & {
2406
- readonly type: "runtime.child.close.requested";
2407
- readonly payload: {
2408
- readonly policy: "terminate" | "wait";
2409
- };
2410
- }) | (Omit<EventInput, "payload" | "type"> & {
2411
- readonly type: "runtime.child.settled";
2412
- readonly payload: {
2413
- readonly runId: string;
2414
- readonly status: "cancelled" | "completed" | "failed";
2415
- readonly output: import("effect/Schema").Json;
2416
- readonly error: string | null;
2417
- };
2418
- }) | (Omit<EventInput, "payload" | "type"> & {
2419
- readonly type: "runtime.effect.ambiguous";
2420
- readonly payload: {
2421
- readonly effectId: string;
2422
- readonly attempt: number;
2423
- readonly error: string;
2424
- };
2425
- }) | (Omit<EventInput, "payload" | "type"> & {
2426
- readonly type: "runtime.effect.attempt.started";
2427
- readonly payload: {
2428
- readonly effectId: string;
2429
- readonly attempt: number;
2430
- };
2431
- }) | (Omit<EventInput, "payload" | "type"> & {
2432
- readonly type: "runtime.effect.cancel.requested";
2433
- readonly payload: {
2434
- readonly effectId: string;
2435
- readonly attempt: number;
2436
- readonly deadlineAt: number | null;
2437
- };
2438
- }) | (Omit<EventInput, "payload" | "type"> & {
2439
- readonly type: "runtime.effect.cancelled";
2440
- readonly payload: {
2441
- readonly effectId: string;
2442
- readonly attempt: number;
2443
- };
2444
- }) | (Omit<EventInput, "payload" | "type"> & {
2445
- readonly type: "runtime.effect.completed";
2446
- readonly payload: {
2447
- readonly effectId: string;
2448
- readonly attempt: number;
2449
- };
2450
- }) | (Omit<EventInput, "payload" | "type"> & {
2451
- readonly type: "runtime.effect.dispatch.deferred";
2452
- readonly payload: {
2453
- readonly effectId: string;
2454
- readonly attempt: number;
2455
- readonly retryAt: number;
2456
- readonly error: string;
2457
- readonly try: number;
2458
- };
2459
- }) | (Omit<EventInput, "payload" | "type"> & {
2460
- readonly type: "runtime.effect.dispatched";
2461
- readonly payload: {
2462
- readonly effectId: string;
2463
- readonly attempt: number;
2464
- readonly deadlineAt: number | null;
2465
- };
2466
- }) | (Omit<EventInput, "payload" | "type"> & {
2467
- readonly type: "runtime.effect.failed";
2468
- readonly payload: {
2469
- readonly effectId: string;
2470
- readonly error: string;
2471
- readonly nonRetryable?: boolean | undefined;
2472
- readonly retryAfterMs?: number | undefined;
2473
- };
2474
- }) | (Omit<EventInput, "payload" | "type"> & {
2475
- readonly type: "runtime.effect.heartbeat";
2476
- readonly payload: {
2477
- readonly effectId: string;
2478
- readonly attempt: number;
2479
- readonly heartbeatAt: number;
2480
- readonly deadlineAt: number | null;
2481
- readonly details?: import("effect/Schema").Json | undefined;
2482
- };
2483
- }) | (Omit<EventInput, "payload" | "type"> & {
2484
- readonly type: "runtime.effect.queued";
2485
- readonly payload: {
2486
- readonly effectId: string;
2487
- readonly attempt: number;
2488
- readonly deadlineAt: number | null;
2489
- };
2490
- }) | (Omit<EventInput, "payload" | "type"> & {
2491
- readonly type: "runtime.effect.retry.scheduled";
2492
- readonly payload: {
2493
- readonly effectId: string;
2494
- readonly attempt: number;
2495
- readonly nextAttemptAt: number;
2496
- readonly error: string;
2497
- };
2498
- }) | (Omit<EventInput, "payload" | "type"> & {
2499
- readonly type: "runtime.effect.timed_out";
2500
- readonly payload: {
2501
- readonly effectId: string;
2502
- readonly attempt: number;
2503
- readonly timeout: string;
2504
- };
2505
- }) | (Omit<EventInput, "payload" | "type"> & {
2506
- readonly type: "runtime.effect.worker.started";
2507
- readonly payload: {
2508
- readonly effectId: string;
2509
- readonly attempt: number;
2510
- readonly deadlineAt: number | null;
2511
- };
2512
- }) | (Omit<EventInput, "payload" | "type"> & {
2513
- readonly type: "runtime.fork.elided";
2514
- readonly payload: {
2515
- readonly type: string;
2516
- };
2517
- }) | (Omit<EventInput, "payload" | "type"> & {
2518
- readonly type: "runtime.run.cancelled";
2519
- readonly payload: {
2520
- readonly reason?: string | undefined;
2521
- };
2522
- }) | (Omit<EventInput, "payload" | "type"> & {
2523
- readonly type: "runtime.run.completed";
2524
- readonly payload: {
2525
- readonly output: import("effect/Schema").Json;
2526
- readonly error: string | null;
2527
- };
2528
- }) | (Omit<EventInput, "payload" | "type"> & {
2529
- readonly type: "runtime.run.forked";
2530
- readonly payload: {
2531
- readonly sourceRunId: string;
2532
- readonly sourceSeq: number;
2533
- };
2534
- }) | (Omit<EventInput, "payload" | "type"> & {
2535
- readonly type: "runtime.run.launched";
2536
- readonly payload: {
2537
- readonly runId: string;
2538
- readonly kind: string;
2539
- readonly definitionName: string;
2540
- readonly definitionVersion: string;
2541
- readonly effectId: string;
2542
- readonly close: "terminate" | "wait";
2543
- };
2544
- }) | (Omit<EventInput, "payload" | "type"> & {
2545
- readonly type: "runtime.run.started";
2546
- readonly payload: {
2547
- readonly rootThreadId?: string | undefined;
2548
- readonly kind: string;
2549
- readonly definitionName: string;
2550
- readonly definitionVersion: string;
2551
- readonly input: import("effect/Schema").Json;
2552
- readonly requestedThreadId?: string | null | undefined;
2553
- readonly launchedBy?: {
2554
- readonly runId: string;
2555
- readonly threadId: string;
2556
- readonly effectId: string;
2557
- readonly causationId: string;
2558
- readonly causationSeq: number;
2559
- } | undefined;
2560
- readonly attributes?: {
2561
- readonly [x: string]: string;
2562
- } | undefined;
2563
- readonly trace?: {
2564
- readonly traceparent: string;
2565
- readonly tracestate?: string | undefined;
2566
- } | undefined;
2567
- };
2568
- }) | (Omit<EventInput, "payload" | "type"> & {
2569
- readonly type: "runtime.signal.received";
2570
- readonly payload: {
2571
- readonly signalType: string;
2572
- };
2573
- }) | (Omit<EventInput, "payload" | "type"> & {
2574
- readonly type: "runtime.snapshot.taken";
2575
- readonly payload: {
2576
- readonly seq: number;
2577
- readonly stateHash: string;
2578
- readonly state?: import("effect/Schema").Json | undefined;
2579
- };
2580
- }) | (Omit<EventInput, "payload" | "type"> & {
2581
- readonly type: "runtime.thread.cancel.requested";
2582
- readonly payload: {
2583
- readonly threadId: string;
2584
- };
2585
- }) | (Omit<EventInput, "payload" | "type"> & {
2586
- readonly type: "runtime.thread.cancelled";
2587
- readonly payload: {
2588
- readonly threadId: string;
2589
- readonly reason?: string | undefined;
2590
- readonly resumeSeq?: number | undefined;
2591
- };
2592
- }) | (Omit<EventInput, "payload" | "type"> & {
2593
- readonly type: "runtime.thread.completed";
2594
- readonly payload: {
2595
- readonly threadId: string;
2596
- readonly output: import("effect/Schema").Json;
2597
- };
2598
- }) | (Omit<EventInput, "payload" | "type"> & {
2599
- readonly type: "runtime.thread.failed";
2600
- readonly payload: {
2601
- readonly threadId: string;
2602
- readonly error: string;
2603
- };
2604
- }) | (Omit<EventInput, "payload" | "type"> & {
2605
- readonly type: "runtime.thread.started";
2606
- readonly payload: {
2607
- readonly threadId: string;
2608
- readonly kind: string;
2609
- readonly definitionName: string;
2610
- readonly definitionVersion: string;
2611
- readonly input: import("effect/Schema").Json;
2612
- readonly parentThreadId: string | null;
2613
- };
2614
- }) | (Omit<EventInput, "payload" | "type"> & {
2615
- readonly type: "runtime.timer.fired";
2616
- readonly payload: {
2617
- readonly timerId: string;
2618
- readonly waitId: string;
2619
- };
2620
- }) | (Omit<EventInput, "payload" | "type"> & {
2621
- readonly type: "runtime.timer.set";
2622
- readonly payload: {
2623
- readonly timerId: string;
2624
- readonly waitId: string;
2625
- readonly wakeAt: number;
2626
- };
2627
- }) | (Omit<EventInput, "payload" | "type"> & {
2628
- readonly type: "runtime.wait.registered";
2629
- readonly payload: {
2630
- readonly waitId: string;
2631
- readonly threadId?: string | undefined;
2632
- readonly on: {
2633
- readonly type: string | readonly string[];
2634
- readonly match?: import("effect/Schema").Json | undefined;
2635
- } | {
2636
- readonly timerAt: number;
2637
- };
2638
- readonly tag?: import("effect/Schema").Json | undefined;
2639
- };
2640
- }) | (Omit<EventInput, "payload" | "type"> & {
2641
- readonly type: "runtime.wait.satisfied";
2642
- readonly payload: {
2643
- readonly waitId: string;
2644
- readonly tag?: import("effect/Schema").Json | undefined;
2645
- readonly event: {
2646
- readonly id: string;
2647
- readonly type: string;
2648
- readonly payload: import("effect/Schema").Json;
2649
- };
2650
- };
2651
2651
  })>;
2652
2652
  };
2653
2653
  readonly threads: {