@swirls/looms 0.9.0 → 0.10.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 (82) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/actor/routing.js +2 -1
  3. package/dist/agent/debugger/agent-chat.js +6 -5
  4. package/dist/agent/debugger/index.js +2 -1
  5. package/dist/agent/module.d.ts +799 -593
  6. package/dist/agent/module.js +31 -0
  7. package/dist/agent/scope.js +1 -0
  8. package/dist/agent/signals.d.ts +108 -15
  9. package/dist/agent/signals.js +70 -47
  10. package/dist/approval/debugger/approvals-view.js +1 -1
  11. package/dist/approval/index.d.ts +1 -0
  12. package/dist/approval/index.js +1 -0
  13. package/dist/approval/module.d.ts +42 -1
  14. package/dist/approval/module.js +53 -0
  15. package/dist/approval/scope.js +1 -0
  16. package/dist/approval/signals.d.ts +19 -13
  17. package/dist/approval/signals.js +25 -45
  18. package/dist/approval/steps.d.ts +11 -0
  19. package/dist/approval/steps.js +39 -0
  20. package/dist/cli/commands.js +2 -2
  21. package/dist/client/client.d.ts +211 -0
  22. package/dist/client/client.js +18 -1
  23. package/dist/core/index.d.ts +1 -0
  24. package/dist/core/index.js +1 -0
  25. package/dist/core/module-scope.d.ts +50 -5
  26. package/dist/core/module-scope.js +22 -2
  27. package/dist/core/module.d.ts +29 -2
  28. package/dist/core/projection.d.ts +1 -0
  29. package/dist/core/published.d.ts +59 -1
  30. package/dist/core/published.js +97 -1
  31. package/dist/core/signals.d.ts +56 -0
  32. package/dist/core/signals.js +93 -0
  33. package/dist/core/validate-event.d.ts +12 -1
  34. package/dist/core/validate-event.js +34 -11
  35. package/dist/debugger/app/assets/index-CO5gIvV8.css +2 -0
  36. package/dist/debugger/app/assets/{index-CMRl_aWQ.js → index-D-2Q7ecG.js} +2 -2
  37. package/dist/debugger/app/assets/routes-lvmllT60.js +47 -0
  38. package/dist/debugger/app/index.html +2 -2
  39. package/dist/debugger/index.d.ts +1 -1
  40. package/dist/debugger/index.js +1 -1
  41. package/dist/debugger/lib/cn.d.ts +1 -1
  42. package/dist/debugger/lib/cn.js +12 -1
  43. package/dist/debugger/plugin.d.ts +11 -1
  44. package/dist/debugger/plugin.js +41 -0
  45. package/dist/debugger/shell/debugger-shell.js +1 -1
  46. package/dist/debugger/shell/form-fields.d.ts +17 -0
  47. package/dist/debugger/shell/form-fields.js +38 -0
  48. package/dist/debugger/shell/run-action.d.ts +6 -0
  49. package/dist/debugger/shell/run-action.js +15 -0
  50. package/dist/debugger/shell/run-controls.js +3 -55
  51. package/dist/debugger/shell/schema-form.d.ts +10 -1
  52. package/dist/debugger/shell/schema-form.js +108 -10
  53. package/dist/debugger/shell/signal-form.d.ts +18 -0
  54. package/dist/debugger/shell/signal-form.js +185 -0
  55. package/dist/debugger/shell/start-form.js +2 -32
  56. package/dist/debugger/shell/use-debounced-preview.d.ts +22 -0
  57. package/dist/debugger/shell/use-debounced-preview.js +68 -0
  58. package/dist/evaluator/index.d.ts +1 -1
  59. package/dist/evaluator/index.js +1 -1
  60. package/dist/evaluator/module.d.ts +8 -1
  61. package/dist/evaluator/module.js +33 -0
  62. package/dist/evaluator/scope.js +1 -0
  63. package/dist/runtime/server/routes/definitions.d.ts +1 -1
  64. package/dist/runtime/server/routes/definitions.js +58 -2
  65. package/dist/runtime/server/routes/runs.js +25 -1
  66. package/dist/schedule/module.d.ts +117 -1
  67. package/dist/schedule/module.js +30 -0
  68. package/dist/schedule/scope.js +1 -0
  69. package/dist/schedule/signals.d.ts +59 -7
  70. package/dist/schedule/signals.js +35 -17
  71. package/dist/testing/corpus-module.d.ts +1 -1
  72. package/dist/testing/index.js +2 -1
  73. package/dist/testing/module-examples.d.ts +6 -0
  74. package/dist/testing/module-examples.js +66 -0
  75. package/dist/workflow/module.d.ts +3 -1
  76. package/dist/workflow/module.js +13 -0
  77. package/dist/workflow/scope.js +1 -0
  78. package/package.json +1 -1
  79. package/dist/debugger/app/assets/index-B7GdT1UA.css +0 -2
  80. package/dist/debugger/app/assets/routes-CfXxKG45.js +0 -47
  81. /package/dist/evaluator/{signals.d.ts → steps.d.ts} +0 -0
  82. /package/dist/evaluator/{signals.js → steps.js} +0 -0
@@ -235,248 +235,6 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
235
235
  readonly alreadyCompacted?: boolean | undefined;
236
236
  readonly consumedSteerMessageIds?: readonly string[] | undefined;
237
237
  }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
238
- readonly type: "agent.context.compacted";
239
- readonly payload: {
240
- readonly turn: number;
241
- readonly originalCount: number;
242
- readonly compactedCount: number;
243
- readonly summary?: string | undefined;
244
- readonly reason?: "manual" | "overflow" | "threshold" | undefined;
245
- readonly messages?: readonly {
246
- readonly role: "assistant" | "system" | "tool" | "user";
247
- readonly content: string;
248
- readonly toolCallId?: string | undefined;
249
- readonly name?: string | undefined;
250
- readonly toolCalls?: {
251
- readonly id: string;
252
- readonly name: string;
253
- readonly arguments: import("effect/Schema").Json;
254
- }[] | undefined;
255
- }[] | undefined;
256
- };
257
- }) | (Omit<EventInput, "payload" | "type"> & {
258
- readonly type: "agent.effects.requested";
259
- readonly payload: {
260
- readonly toolCallId: string;
261
- readonly effects: readonly ({
262
- readonly type: "runtime.spawn";
263
- readonly childThreadId: string;
264
- readonly kind: string;
265
- readonly definitionName: string;
266
- readonly definitionVersion: string;
267
- readonly input: import("effect/Schema").Json;
268
- } | {
269
- readonly type: "runtime.wait";
270
- readonly waitId: string;
271
- readonly on: {
272
- readonly type: string | readonly string[];
273
- readonly match?: import("effect/Schema").Json | undefined;
274
- } | {
275
- readonly timerAt: number;
276
- };
277
- readonly tag?: import("effect/Schema").Json | undefined;
278
- } | {
279
- readonly type: "runtime.emit";
280
- readonly event: {
281
- readonly type: string;
282
- readonly payload: import("effect/Schema").Json;
283
- readonly threadId?: string | null | undefined;
284
- readonly parentThreadId?: string | null | undefined;
285
- readonly causationId?: string | null | undefined;
286
- readonly correlationId?: string | null | undefined;
287
- readonly effectId?: string | null | undefined;
288
- readonly origin?: {
289
- readonly type: "thread";
290
- readonly threadId: string;
291
- } | {
292
- readonly type: "external";
293
- readonly actorId?: string | undefined;
294
- } | {
295
- readonly type: "system";
296
- } | {
297
- readonly type: "run";
298
- readonly runId: string;
299
- } | undefined;
300
- readonly ephemeral?: boolean | undefined;
301
- readonly id?: string | undefined;
302
- readonly ts?: number | undefined;
303
- readonly idempotencyKey?: string | null | undefined;
304
- };
305
- readonly tag?: string | undefined;
306
- } | {
307
- readonly type: "runtime.complete";
308
- readonly output: import("effect/Schema").Json;
309
- } | {
310
- readonly type: "runtime.fail";
311
- readonly error: string;
312
- } | {
313
- readonly type: "runtime.cancel";
314
- readonly threadId: string;
315
- readonly tag?: string | undefined;
316
- } | {
317
- readonly type: "runtime.launch";
318
- readonly runId: string;
319
- readonly kind: string;
320
- readonly definitionName: string;
321
- readonly definitionVersion: string;
322
- readonly input: import("effect/Schema").Json;
323
- readonly close: "terminate" | "wait";
324
- readonly tag?: string | undefined;
325
- } | {
326
- readonly type: "runtime.cancelRun";
327
- readonly runId: string;
328
- readonly tag?: string | undefined;
329
- } | {
330
- readonly type: string;
331
- readonly input: import("effect/Schema").Json;
332
- readonly tag?: string | undefined;
333
- readonly at?: number | undefined;
334
- })[];
335
- readonly waitOn?: {
336
- readonly type: string | readonly string[];
337
- readonly match?: import("effect/Schema").Json | undefined;
338
- } | undefined;
339
- };
340
- }) | (Omit<EventInput, "payload" | "type"> & {
341
- readonly type: "agent.lineage";
342
- readonly payload: {
343
- readonly depth: number;
344
- };
345
- }) | (Omit<EventInput, "payload" | "type"> & {
346
- readonly type: "agent.message";
347
- readonly payload: {
348
- readonly turn: number;
349
- readonly message: {
350
- readonly role: "assistant" | "system" | "tool" | "user";
351
- readonly content: string;
352
- readonly toolCallId?: string | undefined;
353
- readonly name?: string | undefined;
354
- readonly toolCalls?: {
355
- readonly id: string;
356
- readonly name: string;
357
- readonly arguments: import("effect/Schema").Json;
358
- }[] | undefined;
359
- };
360
- readonly usage?: {
361
- readonly input: number;
362
- readonly output: number;
363
- } | undefined;
364
- };
365
- }) | (Omit<EventInput, "payload" | "type"> & {
366
- readonly type: "agent.message.received";
367
- readonly payload: {
368
- readonly message: {
369
- readonly role: "assistant" | "system" | "tool" | "user";
370
- readonly content: string;
371
- readonly toolCallId?: string | undefined;
372
- readonly name?: string | undefined;
373
- readonly toolCalls?: {
374
- readonly id: string;
375
- readonly name: string;
376
- readonly arguments: import("effect/Schema").Json;
377
- }[] | undefined;
378
- };
379
- };
380
- }) | (Omit<EventInput, "payload" | "type"> & {
381
- readonly type: "agent.session.cancel.requested";
382
- readonly payload: {};
383
- }) | (Omit<EventInput, "payload" | "type"> & {
384
- readonly type: "agent.session.message.submitted";
385
- readonly payload: {
386
- readonly messageId: string;
387
- readonly text: string;
388
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
389
- readonly activeChildThreadId?: string | undefined;
390
- };
391
- }) | (Omit<EventInput, "payload" | "type"> & {
392
- readonly type: "agent.session.steer.delivered";
393
- readonly payload: {
394
- readonly messageId: string;
395
- readonly activeMessageId: string;
396
- };
397
- }) | (Omit<EventInput, "payload" | "type"> & {
398
- readonly type: "agent.session.turn.closed";
399
- readonly payload: {
400
- readonly messageId: string;
401
- readonly status: "cancelled" | "completed" | "failed";
402
- readonly error?: string | undefined;
403
- };
404
- }) | (Omit<EventInput, "payload" | "type"> & {
405
- readonly type: "agent.session.turn.started";
406
- readonly payload: {
407
- readonly messageId: string;
408
- readonly childThreadId: string;
409
- };
410
- }) | (Omit<EventInput, "payload" | "type"> & {
411
- readonly type: "agent.spawn.requested";
412
- readonly payload: {
413
- readonly childThreadId: string;
414
- readonly kind: string;
415
- readonly definitionName: string;
416
- readonly definitionVersion: string;
417
- readonly toolCallId: string;
418
- readonly input: import("effect/Schema").Json;
419
- readonly depth?: number | undefined;
420
- };
421
- }) | (Omit<EventInput, "payload" | "type"> & {
422
- readonly type: "agent.steered";
423
- readonly payload: {
424
- readonly turn: number;
425
- readonly messageId?: string | undefined;
426
- readonly message: {
427
- readonly role: "assistant" | "system" | "tool" | "user";
428
- readonly content: string;
429
- readonly toolCallId?: string | undefined;
430
- readonly name?: string | undefined;
431
- readonly toolCalls?: {
432
- readonly id: string;
433
- readonly name: string;
434
- readonly arguments: import("effect/Schema").Json;
435
- }[] | undefined;
436
- };
437
- readonly interrupt?: boolean | undefined;
438
- };
439
- }) | (Omit<EventInput, "payload" | "type"> & {
440
- readonly type: "agent.tool.result";
441
- readonly payload: {
442
- readonly turn: number;
443
- readonly toolCallId: string;
444
- readonly name: string;
445
- readonly result: import("effect/Schema").Json;
446
- readonly error: string | null;
447
- };
448
- }) | (Omit<EventInput, "payload" | "type"> & {
449
- readonly type: "agent.tool_call.requested";
450
- readonly payload: {
451
- readonly turn: number;
452
- readonly toolCall: {
453
- readonly id: string;
454
- readonly name: string;
455
- readonly arguments: import("effect/Schema").Json;
456
- };
457
- };
458
- }) | (Omit<EventInput, "payload" | "type"> & {
459
- readonly type: "agent.turn.started";
460
- readonly payload: {
461
- readonly turn: number;
462
- };
463
- }) | (Omit<EventInput, "payload" | "type"> & {
464
- readonly type: "agent.turn.stopped";
465
- readonly payload: {};
466
- }) | (Omit<EventInput, "payload" | "type"> & {
467
- readonly type: "agent.turn.text_delta";
468
- readonly payload: {
469
- readonly turn: number;
470
- readonly delta: string;
471
- };
472
- }) | (Omit<EventInput, "payload" | "type"> & {
473
- readonly type: "agent.turn.usage";
474
- readonly payload: {
475
- readonly turn: number;
476
- readonly input: number;
477
- readonly output: number;
478
- };
479
- }) | (Omit<EventInput, "payload" | "type"> & {
480
238
  readonly type: "runtime.child.close.requested";
481
239
  readonly payload: {
482
240
  readonly policy: "terminate" | "wait";
@@ -722,19 +480,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
722
480
  readonly payload: import("effect/Schema").Json;
723
481
  };
724
482
  };
725
- })>;
726
- executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
727
- readonly turn: number;
728
- readonly definitionName?: string | undefined;
729
- readonly definitionVersion: string;
730
- readonly toolCall: {
731
- readonly id: string;
732
- readonly name: string;
733
- readonly arguments: import("effect/Schema").Json;
734
- };
735
- readonly input?: import("effect/Schema").Json | undefined;
736
- readonly depth?: number | undefined;
737
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
483
+ }) | (Omit<EventInput, "payload" | "type"> & {
738
484
  readonly type: "agent.context.compacted";
739
485
  readonly payload: {
740
486
  readonly turn: number;
@@ -976,7 +722,19 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
976
722
  readonly input: number;
977
723
  readonly output: number;
978
724
  };
979
- }) | (Omit<EventInput, "payload" | "type"> & {
725
+ })>;
726
+ executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
727
+ readonly turn: number;
728
+ readonly definitionName?: string | undefined;
729
+ readonly definitionVersion: string;
730
+ readonly toolCall: {
731
+ readonly id: string;
732
+ readonly name: string;
733
+ readonly arguments: import("effect/Schema").Json;
734
+ };
735
+ readonly input?: import("effect/Schema").Json | undefined;
736
+ readonly depth?: number | undefined;
737
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
980
738
  readonly type: "runtime.child.close.requested";
981
739
  readonly payload: {
982
740
  readonly policy: "terminate" | "wait";
@@ -1222,6 +980,248 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1222
980
  readonly payload: import("effect/Schema").Json;
1223
981
  };
1224
982
  };
983
+ }) | (Omit<EventInput, "payload" | "type"> & {
984
+ readonly type: "agent.context.compacted";
985
+ readonly payload: {
986
+ readonly turn: number;
987
+ readonly originalCount: number;
988
+ readonly compactedCount: number;
989
+ readonly summary?: string | undefined;
990
+ readonly reason?: "manual" | "overflow" | "threshold" | undefined;
991
+ readonly messages?: readonly {
992
+ readonly role: "assistant" | "system" | "tool" | "user";
993
+ readonly content: string;
994
+ readonly toolCallId?: string | undefined;
995
+ readonly name?: string | undefined;
996
+ readonly toolCalls?: {
997
+ readonly id: string;
998
+ readonly name: string;
999
+ readonly arguments: import("effect/Schema").Json;
1000
+ }[] | undefined;
1001
+ }[] | undefined;
1002
+ };
1003
+ }) | (Omit<EventInput, "payload" | "type"> & {
1004
+ readonly type: "agent.effects.requested";
1005
+ readonly payload: {
1006
+ readonly toolCallId: string;
1007
+ readonly effects: readonly ({
1008
+ readonly type: "runtime.spawn";
1009
+ readonly childThreadId: string;
1010
+ readonly kind: string;
1011
+ readonly definitionName: string;
1012
+ readonly definitionVersion: string;
1013
+ readonly input: import("effect/Schema").Json;
1014
+ } | {
1015
+ readonly type: "runtime.wait";
1016
+ readonly waitId: string;
1017
+ readonly on: {
1018
+ readonly type: string | readonly string[];
1019
+ readonly match?: import("effect/Schema").Json | undefined;
1020
+ } | {
1021
+ readonly timerAt: number;
1022
+ };
1023
+ readonly tag?: import("effect/Schema").Json | undefined;
1024
+ } | {
1025
+ readonly type: "runtime.emit";
1026
+ readonly event: {
1027
+ readonly type: string;
1028
+ readonly payload: import("effect/Schema").Json;
1029
+ readonly threadId?: string | null | undefined;
1030
+ readonly parentThreadId?: string | null | undefined;
1031
+ readonly causationId?: string | null | undefined;
1032
+ readonly correlationId?: string | null | undefined;
1033
+ readonly effectId?: string | null | undefined;
1034
+ readonly origin?: {
1035
+ readonly type: "thread";
1036
+ readonly threadId: string;
1037
+ } | {
1038
+ readonly type: "external";
1039
+ readonly actorId?: string | undefined;
1040
+ } | {
1041
+ readonly type: "system";
1042
+ } | {
1043
+ readonly type: "run";
1044
+ readonly runId: string;
1045
+ } | undefined;
1046
+ readonly ephemeral?: boolean | undefined;
1047
+ readonly id?: string | undefined;
1048
+ readonly ts?: number | undefined;
1049
+ readonly idempotencyKey?: string | null | undefined;
1050
+ };
1051
+ readonly tag?: string | undefined;
1052
+ } | {
1053
+ readonly type: "runtime.complete";
1054
+ readonly output: import("effect/Schema").Json;
1055
+ } | {
1056
+ readonly type: "runtime.fail";
1057
+ readonly error: string;
1058
+ } | {
1059
+ readonly type: "runtime.cancel";
1060
+ readonly threadId: string;
1061
+ readonly tag?: string | undefined;
1062
+ } | {
1063
+ readonly type: "runtime.launch";
1064
+ readonly runId: string;
1065
+ readonly kind: string;
1066
+ readonly definitionName: string;
1067
+ readonly definitionVersion: string;
1068
+ readonly input: import("effect/Schema").Json;
1069
+ readonly close: "terminate" | "wait";
1070
+ readonly tag?: string | undefined;
1071
+ } | {
1072
+ readonly type: "runtime.cancelRun";
1073
+ readonly runId: string;
1074
+ readonly tag?: string | undefined;
1075
+ } | {
1076
+ readonly type: string;
1077
+ readonly input: import("effect/Schema").Json;
1078
+ readonly tag?: string | undefined;
1079
+ readonly at?: number | undefined;
1080
+ })[];
1081
+ readonly waitOn?: {
1082
+ readonly type: string | readonly string[];
1083
+ readonly match?: import("effect/Schema").Json | undefined;
1084
+ } | undefined;
1085
+ };
1086
+ }) | (Omit<EventInput, "payload" | "type"> & {
1087
+ readonly type: "agent.lineage";
1088
+ readonly payload: {
1089
+ readonly depth: number;
1090
+ };
1091
+ }) | (Omit<EventInput, "payload" | "type"> & {
1092
+ readonly type: "agent.message";
1093
+ readonly payload: {
1094
+ readonly turn: number;
1095
+ readonly message: {
1096
+ readonly role: "assistant" | "system" | "tool" | "user";
1097
+ readonly content: string;
1098
+ readonly toolCallId?: string | undefined;
1099
+ readonly name?: string | undefined;
1100
+ readonly toolCalls?: {
1101
+ readonly id: string;
1102
+ readonly name: string;
1103
+ readonly arguments: import("effect/Schema").Json;
1104
+ }[] | undefined;
1105
+ };
1106
+ readonly usage?: {
1107
+ readonly input: number;
1108
+ readonly output: number;
1109
+ } | undefined;
1110
+ };
1111
+ }) | (Omit<EventInput, "payload" | "type"> & {
1112
+ readonly type: "agent.message.received";
1113
+ readonly payload: {
1114
+ readonly message: {
1115
+ readonly role: "assistant" | "system" | "tool" | "user";
1116
+ readonly content: string;
1117
+ readonly toolCallId?: string | undefined;
1118
+ readonly name?: string | undefined;
1119
+ readonly toolCalls?: {
1120
+ readonly id: string;
1121
+ readonly name: string;
1122
+ readonly arguments: import("effect/Schema").Json;
1123
+ }[] | undefined;
1124
+ };
1125
+ };
1126
+ }) | (Omit<EventInput, "payload" | "type"> & {
1127
+ readonly type: "agent.session.cancel.requested";
1128
+ readonly payload: {};
1129
+ }) | (Omit<EventInput, "payload" | "type"> & {
1130
+ readonly type: "agent.session.message.submitted";
1131
+ readonly payload: {
1132
+ readonly messageId: string;
1133
+ readonly text: string;
1134
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1135
+ readonly activeChildThreadId?: string | undefined;
1136
+ };
1137
+ }) | (Omit<EventInput, "payload" | "type"> & {
1138
+ readonly type: "agent.session.steer.delivered";
1139
+ readonly payload: {
1140
+ readonly messageId: string;
1141
+ readonly activeMessageId: string;
1142
+ };
1143
+ }) | (Omit<EventInput, "payload" | "type"> & {
1144
+ readonly type: "agent.session.turn.closed";
1145
+ readonly payload: {
1146
+ readonly messageId: string;
1147
+ readonly status: "cancelled" | "completed" | "failed";
1148
+ readonly error?: string | undefined;
1149
+ };
1150
+ }) | (Omit<EventInput, "payload" | "type"> & {
1151
+ readonly type: "agent.session.turn.started";
1152
+ readonly payload: {
1153
+ readonly messageId: string;
1154
+ readonly childThreadId: string;
1155
+ };
1156
+ }) | (Omit<EventInput, "payload" | "type"> & {
1157
+ readonly type: "agent.spawn.requested";
1158
+ readonly payload: {
1159
+ readonly childThreadId: string;
1160
+ readonly kind: string;
1161
+ readonly definitionName: string;
1162
+ readonly definitionVersion: string;
1163
+ readonly toolCallId: string;
1164
+ readonly input: import("effect/Schema").Json;
1165
+ readonly depth?: number | undefined;
1166
+ };
1167
+ }) | (Omit<EventInput, "payload" | "type"> & {
1168
+ readonly type: "agent.steered";
1169
+ readonly payload: {
1170
+ readonly turn: number;
1171
+ readonly messageId?: string | undefined;
1172
+ readonly message: {
1173
+ readonly role: "assistant" | "system" | "tool" | "user";
1174
+ readonly content: string;
1175
+ readonly toolCallId?: string | undefined;
1176
+ readonly name?: string | undefined;
1177
+ readonly toolCalls?: {
1178
+ readonly id: string;
1179
+ readonly name: string;
1180
+ readonly arguments: import("effect/Schema").Json;
1181
+ }[] | undefined;
1182
+ };
1183
+ readonly interrupt?: boolean | undefined;
1184
+ };
1185
+ }) | (Omit<EventInput, "payload" | "type"> & {
1186
+ readonly type: "agent.tool.result";
1187
+ readonly payload: {
1188
+ readonly turn: number;
1189
+ readonly toolCallId: string;
1190
+ readonly name: string;
1191
+ readonly result: import("effect/Schema").Json;
1192
+ readonly error: string | null;
1193
+ };
1194
+ }) | (Omit<EventInput, "payload" | "type"> & {
1195
+ readonly type: "agent.tool_call.requested";
1196
+ readonly payload: {
1197
+ readonly turn: number;
1198
+ readonly toolCall: {
1199
+ readonly id: string;
1200
+ readonly name: string;
1201
+ readonly arguments: import("effect/Schema").Json;
1202
+ };
1203
+ };
1204
+ }) | (Omit<EventInput, "payload" | "type"> & {
1205
+ readonly type: "agent.turn.started";
1206
+ readonly payload: {
1207
+ readonly turn: number;
1208
+ };
1209
+ }) | (Omit<EventInput, "payload" | "type"> & {
1210
+ readonly type: "agent.turn.stopped";
1211
+ readonly payload: {};
1212
+ }) | (Omit<EventInput, "payload" | "type"> & {
1213
+ readonly type: "agent.turn.text_delta";
1214
+ readonly payload: {
1215
+ readonly turn: number;
1216
+ readonly delta: string;
1217
+ };
1218
+ }) | (Omit<EventInput, "payload" | "type"> & {
1219
+ readonly type: "agent.turn.usage";
1220
+ readonly payload: {
1221
+ readonly turn: number;
1222
+ readonly input: number;
1223
+ readonly output: number;
1224
+ };
1225
1225
  })>;
1226
1226
  }, {
1227
1227
  agent: import("@swirls/looms/core").ThreadDefinition<import("./types").AgentState>;
@@ -1248,13 +1248,13 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1248
1248
  readonly rootThreadId: string | null;
1249
1249
  readonly active: boolean;
1250
1250
  }>;
1251
- }, import("effect/Context").Service.Any> & {
1252
- readonly effects: {
1253
- callLLM: import("@swirls/looms/core").LocalEffectDefinition<{
1254
- readonly turn: number;
1255
- readonly definitionName?: string | undefined;
1256
- readonly definitionVersion: string;
1257
- readonly messages?: readonly {
1251
+ }, import("effect/Context").Service.Any, {
1252
+ userMessage: import("@swirls/looms/core").SignalDefinition<{
1253
+ readonly content: string;
1254
+ }, Omit<EventInput, "payload" | "type"> & {
1255
+ readonly type: "agent.message.received";
1256
+ readonly payload: {
1257
+ readonly message: {
1258
1258
  readonly role: "assistant" | "system" | "tool" | "user";
1259
1259
  readonly content: string;
1260
1260
  readonly toolCallId?: string | undefined;
@@ -1264,254 +1264,114 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1264
1264
  readonly name: string;
1265
1265
  readonly arguments: import("effect/Schema").Json;
1266
1266
  }[] | undefined;
1267
- }[] | undefined;
1268
- readonly input?: import("effect/Schema").Json | undefined;
1269
- readonly structuredOutput?: import("effect/Schema").Json | undefined;
1270
- readonly alreadyCompacted?: boolean | undefined;
1271
- readonly consumedSteerMessageIds?: readonly string[] | undefined;
1272
- }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
1273
- readonly type: "agent.context.compacted";
1274
- readonly payload: {
1275
- readonly turn: number;
1276
- readonly originalCount: number;
1277
- readonly compactedCount: number;
1278
- readonly summary?: string | undefined;
1279
- readonly reason?: "manual" | "overflow" | "threshold" | undefined;
1280
- readonly messages?: readonly {
1281
- readonly role: "assistant" | "system" | "tool" | "user";
1282
- readonly content: string;
1283
- readonly toolCallId?: string | undefined;
1284
- readonly name?: string | undefined;
1285
- readonly toolCalls?: {
1286
- readonly id: string;
1287
- readonly name: string;
1288
- readonly arguments: import("effect/Schema").Json;
1289
- }[] | undefined;
1290
- }[] | undefined;
1291
- };
1292
- }) | (Omit<EventInput, "payload" | "type"> & {
1293
- readonly type: "agent.effects.requested";
1294
- readonly payload: {
1295
- readonly toolCallId: string;
1296
- readonly effects: readonly ({
1297
- readonly type: "runtime.spawn";
1298
- readonly childThreadId: string;
1299
- readonly kind: string;
1300
- readonly definitionName: string;
1301
- readonly definitionVersion: string;
1302
- readonly input: import("effect/Schema").Json;
1303
- } | {
1304
- readonly type: "runtime.wait";
1305
- readonly waitId: string;
1306
- readonly on: {
1307
- readonly type: string | readonly string[];
1308
- readonly match?: import("effect/Schema").Json | undefined;
1309
- } | {
1310
- readonly timerAt: number;
1311
- };
1312
- readonly tag?: import("effect/Schema").Json | undefined;
1313
- } | {
1314
- readonly type: "runtime.emit";
1315
- readonly event: {
1316
- readonly type: string;
1317
- readonly payload: import("effect/Schema").Json;
1318
- readonly threadId?: string | null | undefined;
1319
- readonly parentThreadId?: string | null | undefined;
1320
- readonly causationId?: string | null | undefined;
1321
- readonly correlationId?: string | null | undefined;
1322
- readonly effectId?: string | null | undefined;
1323
- readonly origin?: {
1324
- readonly type: "thread";
1325
- readonly threadId: string;
1326
- } | {
1327
- readonly type: "external";
1328
- readonly actorId?: string | undefined;
1329
- } | {
1330
- readonly type: "system";
1331
- } | {
1332
- readonly type: "run";
1333
- readonly runId: string;
1334
- } | undefined;
1335
- readonly ephemeral?: boolean | undefined;
1336
- readonly id?: string | undefined;
1337
- readonly ts?: number | undefined;
1338
- readonly idempotencyKey?: string | null | undefined;
1339
- };
1340
- readonly tag?: string | undefined;
1341
- } | {
1342
- readonly type: "runtime.complete";
1343
- readonly output: import("effect/Schema").Json;
1344
- } | {
1345
- readonly type: "runtime.fail";
1346
- readonly error: string;
1347
- } | {
1348
- readonly type: "runtime.cancel";
1349
- readonly threadId: string;
1350
- readonly tag?: string | undefined;
1351
- } | {
1352
- readonly type: "runtime.launch";
1353
- readonly runId: string;
1354
- readonly kind: string;
1355
- readonly definitionName: string;
1356
- readonly definitionVersion: string;
1357
- readonly input: import("effect/Schema").Json;
1358
- readonly close: "terminate" | "wait";
1359
- readonly tag?: string | undefined;
1360
- } | {
1361
- readonly type: "runtime.cancelRun";
1362
- readonly runId: string;
1363
- readonly tag?: string | undefined;
1364
- } | {
1365
- readonly type: string;
1366
- readonly input: import("effect/Schema").Json;
1367
- readonly tag?: string | undefined;
1368
- readonly at?: number | undefined;
1369
- })[];
1370
- readonly waitOn?: {
1371
- readonly type: string | readonly string[];
1372
- readonly match?: import("effect/Schema").Json | undefined;
1373
- } | undefined;
1374
- };
1375
- }) | (Omit<EventInput, "payload" | "type"> & {
1376
- readonly type: "agent.lineage";
1377
- readonly payload: {
1378
- readonly depth: number;
1379
- };
1380
- }) | (Omit<EventInput, "payload" | "type"> & {
1381
- readonly type: "agent.message";
1382
- readonly payload: {
1383
- readonly turn: number;
1384
- readonly message: {
1385
- readonly role: "assistant" | "system" | "tool" | "user";
1386
- readonly content: string;
1387
- readonly toolCallId?: string | undefined;
1388
- readonly name?: string | undefined;
1389
- readonly toolCalls?: {
1390
- readonly id: string;
1391
- readonly name: string;
1392
- readonly arguments: import("effect/Schema").Json;
1393
- }[] | undefined;
1394
- };
1395
- readonly usage?: {
1396
- readonly input: number;
1397
- readonly output: number;
1398
- } | undefined;
1399
- };
1400
- }) | (Omit<EventInput, "payload" | "type"> & {
1401
- readonly type: "agent.message.received";
1402
- readonly payload: {
1403
- readonly message: {
1404
- readonly role: "assistant" | "system" | "tool" | "user";
1405
- readonly content: string;
1406
- readonly toolCallId?: string | undefined;
1407
- readonly name?: string | undefined;
1408
- readonly toolCalls?: {
1409
- readonly id: string;
1410
- readonly name: string;
1411
- readonly arguments: import("effect/Schema").Json;
1412
- }[] | undefined;
1413
- };
1414
- };
1415
- }) | (Omit<EventInput, "payload" | "type"> & {
1416
- readonly type: "agent.session.cancel.requested";
1417
- readonly payload: {};
1418
- }) | (Omit<EventInput, "payload" | "type"> & {
1419
- readonly type: "agent.session.message.submitted";
1420
- readonly payload: {
1421
- readonly messageId: string;
1422
- readonly text: string;
1423
- readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1424
- readonly activeChildThreadId?: string | undefined;
1425
- };
1426
- }) | (Omit<EventInput, "payload" | "type"> & {
1427
- readonly type: "agent.session.steer.delivered";
1428
- readonly payload: {
1429
- readonly messageId: string;
1430
- readonly activeMessageId: string;
1431
- };
1432
- }) | (Omit<EventInput, "payload" | "type"> & {
1433
- readonly type: "agent.session.turn.closed";
1434
- readonly payload: {
1435
- readonly messageId: string;
1436
- readonly status: "cancelled" | "completed" | "failed";
1437
- readonly error?: string | undefined;
1438
- };
1439
- }) | (Omit<EventInput, "payload" | "type"> & {
1440
- readonly type: "agent.session.turn.started";
1441
- readonly payload: {
1442
- readonly messageId: string;
1443
- readonly childThreadId: string;
1444
- };
1445
- }) | (Omit<EventInput, "payload" | "type"> & {
1446
- readonly type: "agent.spawn.requested";
1447
- readonly payload: {
1448
- readonly childThreadId: string;
1449
- readonly kind: string;
1450
- readonly definitionName: string;
1451
- readonly definitionVersion: string;
1452
- readonly toolCallId: string;
1453
- readonly input: import("effect/Schema").Json;
1454
- readonly depth?: number | undefined;
1455
1267
  };
1456
- }) | (Omit<EventInput, "payload" | "type"> & {
1457
- readonly type: "agent.steered";
1458
- readonly payload: {
1459
- readonly turn: number;
1460
- readonly messageId?: string | undefined;
1461
- readonly message: {
1462
- readonly role: "assistant" | "system" | "tool" | "user";
1463
- readonly content: string;
1464
- readonly toolCallId?: string | undefined;
1465
- readonly name?: string | undefined;
1466
- readonly toolCalls?: {
1467
- readonly id: string;
1468
- readonly name: string;
1469
- readonly arguments: import("effect/Schema").Json;
1470
- }[] | undefined;
1471
- };
1472
- readonly interrupt?: boolean | undefined;
1473
- };
1474
- }) | (Omit<EventInput, "payload" | "type"> & {
1475
- readonly type: "agent.tool.result";
1476
- readonly payload: {
1477
- readonly turn: number;
1478
- readonly toolCallId: string;
1479
- readonly name: string;
1480
- readonly result: import("effect/Schema").Json;
1481
- readonly error: string | null;
1482
- };
1483
- }) | (Omit<EventInput, "payload" | "type"> & {
1484
- readonly type: "agent.tool_call.requested";
1485
- readonly payload: {
1486
- readonly turn: number;
1487
- readonly toolCall: {
1268
+ };
1269
+ }>;
1270
+ steer: import("@swirls/looms/core").SignalDefinition<{
1271
+ readonly content: string;
1272
+ readonly interrupt?: boolean | undefined;
1273
+ }, Omit<EventInput, "payload" | "type"> & {
1274
+ readonly type: "agent.steered";
1275
+ readonly payload: {
1276
+ readonly turn: number;
1277
+ readonly messageId?: string | undefined;
1278
+ readonly message: {
1279
+ readonly role: "assistant" | "system" | "tool" | "user";
1280
+ readonly content: string;
1281
+ readonly toolCallId?: string | undefined;
1282
+ readonly name?: string | undefined;
1283
+ readonly toolCalls?: {
1488
1284
  readonly id: string;
1489
1285
  readonly name: string;
1490
1286
  readonly arguments: import("effect/Schema").Json;
1491
- };
1492
- };
1493
- }) | (Omit<EventInput, "payload" | "type"> & {
1494
- readonly type: "agent.turn.started";
1495
- readonly payload: {
1496
- readonly turn: number;
1497
- };
1498
- }) | (Omit<EventInput, "payload" | "type"> & {
1499
- readonly type: "agent.turn.stopped";
1500
- readonly payload: {};
1501
- }) | (Omit<EventInput, "payload" | "type"> & {
1502
- readonly type: "agent.turn.text_delta";
1503
- readonly payload: {
1504
- readonly turn: number;
1505
- readonly delta: string;
1287
+ }[] | undefined;
1506
1288
  };
1507
- }) | (Omit<EventInput, "payload" | "type"> & {
1508
- readonly type: "agent.turn.usage";
1509
- readonly payload: {
1510
- readonly turn: number;
1511
- readonly input: number;
1512
- readonly output: number;
1289
+ readonly interrupt?: boolean | undefined;
1290
+ };
1291
+ }>;
1292
+ stopAgentTurn: import("@swirls/looms/core").SignalDefinition<undefined, Omit<EventInput, "payload" | "type"> & {
1293
+ readonly type: "agent.turn.stopped";
1294
+ readonly payload: {};
1295
+ }>;
1296
+ submitAgentMessage: import("@swirls/looms/core").SignalDefinition<{
1297
+ readonly messageId: string;
1298
+ readonly text: string;
1299
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1300
+ readonly activeChildThreadId?: string | undefined;
1301
+ }, Omit<EventInput, "payload" | "type"> & {
1302
+ readonly type: "agent.session.message.submitted";
1303
+ readonly payload: {
1304
+ readonly messageId: string;
1305
+ readonly text: string;
1306
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1307
+ readonly activeChildThreadId?: string | undefined;
1308
+ };
1309
+ }>;
1310
+ cancelAgentTurn: import("@swirls/looms/core").SignalDefinition<{
1311
+ readonly childThreadId: string;
1312
+ }, ({
1313
+ type: 'runtime.thread.cancel.requested';
1314
+ payload: {
1315
+ threadId: string;
1316
+ };
1317
+ } | (Omit<EventInput, "payload" | "type"> & {
1318
+ readonly type: "agent.session.cancel.requested";
1319
+ readonly payload: {};
1320
+ }))[]>;
1321
+ agentSessionMessageEvents: import("@swirls/looms/core").SignalDefinition<{
1322
+ readonly messageId: string;
1323
+ readonly text: string;
1324
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1325
+ readonly activeChildThreadId?: string | undefined;
1326
+ }, ((Omit<EventInput, "payload" | "type"> & {
1327
+ readonly type: "agent.session.message.submitted";
1328
+ readonly payload: {
1329
+ readonly messageId: string;
1330
+ readonly text: string;
1331
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
1332
+ readonly activeChildThreadId?: string | undefined;
1333
+ };
1334
+ }) | (Omit<EventInput, "payload" | "type"> & {
1335
+ readonly type: "agent.steered";
1336
+ readonly payload: {
1337
+ readonly turn: number;
1338
+ readonly messageId?: string | undefined;
1339
+ readonly message: {
1340
+ readonly role: "assistant" | "system" | "tool" | "user";
1341
+ readonly content: string;
1342
+ readonly toolCallId?: string | undefined;
1343
+ readonly name?: string | undefined;
1344
+ readonly toolCalls?: {
1345
+ readonly id: string;
1346
+ readonly name: string;
1347
+ readonly arguments: import("effect/Schema").Json;
1348
+ }[] | undefined;
1513
1349
  };
1514
- }) | (Omit<EventInput, "payload" | "type"> & {
1350
+ readonly interrupt?: boolean | undefined;
1351
+ };
1352
+ }))[]>;
1353
+ }, {}> & {
1354
+ readonly effects: {
1355
+ callLLM: import("@swirls/looms/core").LocalEffectDefinition<{
1356
+ readonly turn: number;
1357
+ readonly definitionName?: string | undefined;
1358
+ readonly definitionVersion: string;
1359
+ readonly messages?: readonly {
1360
+ readonly role: "assistant" | "system" | "tool" | "user";
1361
+ readonly content: string;
1362
+ readonly toolCallId?: string | undefined;
1363
+ readonly name?: string | undefined;
1364
+ readonly toolCalls?: {
1365
+ readonly id: string;
1366
+ readonly name: string;
1367
+ readonly arguments: import("effect/Schema").Json;
1368
+ }[] | undefined;
1369
+ }[] | undefined;
1370
+ readonly input?: import("effect/Schema").Json | undefined;
1371
+ readonly structuredOutput?: import("effect/Schema").Json | undefined;
1372
+ readonly alreadyCompacted?: boolean | undefined;
1373
+ readonly consumedSteerMessageIds?: readonly string[] | undefined;
1374
+ }, import("./definitions-store").AgentDefinitionsTag | LlmTag, (Omit<EventInput, "payload" | "type"> & {
1515
1375
  readonly type: "runtime.child.close.requested";
1516
1376
  readonly payload: {
1517
1377
  readonly policy: "terminate" | "wait";
@@ -1757,19 +1617,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
1757
1617
  readonly payload: import("effect/Schema").Json;
1758
1618
  };
1759
1619
  };
1760
- })>;
1761
- executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
1762
- readonly turn: number;
1763
- readonly definitionName?: string | undefined;
1764
- readonly definitionVersion: string;
1765
- readonly toolCall: {
1766
- readonly id: string;
1767
- readonly name: string;
1768
- readonly arguments: import("effect/Schema").Json;
1769
- };
1770
- readonly input?: import("effect/Schema").Json | undefined;
1771
- readonly depth?: number | undefined;
1772
- }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
1620
+ }) | (Omit<EventInput, "payload" | "type"> & {
1773
1621
  readonly type: "agent.context.compacted";
1774
1622
  readonly payload: {
1775
1623
  readonly turn: number;
@@ -2011,7 +1859,19 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
2011
1859
  readonly input: number;
2012
1860
  readonly output: number;
2013
1861
  };
2014
- }) | (Omit<EventInput, "payload" | "type"> & {
1862
+ })>;
1863
+ executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
1864
+ readonly turn: number;
1865
+ readonly definitionName?: string | undefined;
1866
+ readonly definitionVersion: string;
1867
+ readonly toolCall: {
1868
+ readonly id: string;
1869
+ readonly name: string;
1870
+ readonly arguments: import("effect/Schema").Json;
1871
+ };
1872
+ readonly input?: import("effect/Schema").Json | undefined;
1873
+ readonly depth?: number | undefined;
1874
+ }, import("./definitions-store").AgentDefinitionsTag, (Omit<EventInput, "payload" | "type"> & {
2015
1875
  readonly type: "runtime.child.close.requested";
2016
1876
  readonly payload: {
2017
1877
  readonly policy: "terminate" | "wait";
@@ -2141,121 +2001,363 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
2141
2001
  readonly sourceSeq: number;
2142
2002
  };
2143
2003
  }) | (Omit<EventInput, "payload" | "type"> & {
2144
- readonly type: "runtime.run.launched";
2004
+ readonly type: "runtime.run.launched";
2005
+ readonly payload: {
2006
+ readonly runId: string;
2007
+ readonly kind: string;
2008
+ readonly definitionName: string;
2009
+ readonly definitionVersion: string;
2010
+ readonly effectId: string;
2011
+ readonly close: "terminate" | "wait";
2012
+ };
2013
+ }) | (Omit<EventInput, "payload" | "type"> & {
2014
+ readonly type: "runtime.run.started";
2015
+ readonly payload: {
2016
+ readonly rootThreadId?: string | undefined;
2017
+ readonly kind: string;
2018
+ readonly definitionName: string;
2019
+ readonly definitionVersion: string;
2020
+ readonly input: import("effect/Schema").Json;
2021
+ readonly requestedThreadId?: string | null | undefined;
2022
+ readonly launchedBy?: {
2023
+ readonly runId: string;
2024
+ readonly threadId: string;
2025
+ readonly effectId: string;
2026
+ readonly causationId: string;
2027
+ readonly causationSeq: number;
2028
+ } | undefined;
2029
+ readonly attributes?: {
2030
+ readonly [x: string]: string;
2031
+ } | undefined;
2032
+ readonly trace?: {
2033
+ readonly traceparent: string;
2034
+ readonly tracestate?: string | undefined;
2035
+ } | undefined;
2036
+ };
2037
+ }) | (Omit<EventInput, "payload" | "type"> & {
2038
+ readonly type: "runtime.signal.received";
2039
+ readonly payload: {
2040
+ readonly signalType: string;
2041
+ };
2042
+ }) | (Omit<EventInput, "payload" | "type"> & {
2043
+ readonly type: "runtime.snapshot.taken";
2044
+ readonly payload: {
2045
+ readonly seq: number;
2046
+ readonly stateHash: string;
2047
+ readonly state?: import("effect/Schema").Json | undefined;
2048
+ };
2049
+ }) | (Omit<EventInput, "payload" | "type"> & {
2050
+ readonly type: "runtime.thread.cancel.requested";
2051
+ readonly payload: {
2052
+ readonly threadId: string;
2053
+ };
2054
+ }) | (Omit<EventInput, "payload" | "type"> & {
2055
+ readonly type: "runtime.thread.cancelled";
2056
+ readonly payload: {
2057
+ readonly threadId: string;
2058
+ readonly reason?: string | undefined;
2059
+ readonly resumeSeq?: number | undefined;
2060
+ };
2061
+ }) | (Omit<EventInput, "payload" | "type"> & {
2062
+ readonly type: "runtime.thread.completed";
2063
+ readonly payload: {
2064
+ readonly threadId: string;
2065
+ readonly output: import("effect/Schema").Json;
2066
+ };
2067
+ }) | (Omit<EventInput, "payload" | "type"> & {
2068
+ readonly type: "runtime.thread.failed";
2069
+ readonly payload: {
2070
+ readonly threadId: string;
2071
+ readonly error: string;
2072
+ };
2073
+ }) | (Omit<EventInput, "payload" | "type"> & {
2074
+ readonly type: "runtime.thread.started";
2075
+ readonly payload: {
2076
+ readonly threadId: string;
2077
+ readonly kind: string;
2078
+ readonly definitionName: string;
2079
+ readonly definitionVersion: string;
2080
+ readonly input: import("effect/Schema").Json;
2081
+ readonly parentThreadId: string | null;
2082
+ };
2083
+ }) | (Omit<EventInput, "payload" | "type"> & {
2084
+ readonly type: "runtime.timer.fired";
2085
+ readonly payload: {
2086
+ readonly timerId: string;
2087
+ readonly waitId: string;
2088
+ };
2089
+ }) | (Omit<EventInput, "payload" | "type"> & {
2090
+ readonly type: "runtime.timer.set";
2091
+ readonly payload: {
2092
+ readonly timerId: string;
2093
+ readonly waitId: string;
2094
+ readonly wakeAt: number;
2095
+ };
2096
+ }) | (Omit<EventInput, "payload" | "type"> & {
2097
+ readonly type: "runtime.wait.registered";
2098
+ readonly payload: {
2099
+ readonly waitId: string;
2100
+ readonly threadId?: string | undefined;
2101
+ readonly on: {
2102
+ readonly type: string | readonly string[];
2103
+ readonly match?: import("effect/Schema").Json | undefined;
2104
+ } | {
2105
+ readonly timerAt: number;
2106
+ };
2107
+ readonly tag?: import("effect/Schema").Json | undefined;
2108
+ };
2109
+ }) | (Omit<EventInput, "payload" | "type"> & {
2110
+ readonly type: "runtime.wait.satisfied";
2111
+ readonly payload: {
2112
+ readonly waitId: string;
2113
+ readonly tag?: import("effect/Schema").Json | undefined;
2114
+ readonly event: {
2115
+ readonly id: string;
2116
+ readonly type: string;
2117
+ readonly payload: import("effect/Schema").Json;
2118
+ };
2119
+ };
2120
+ }) | (Omit<EventInput, "payload" | "type"> & {
2121
+ readonly type: "agent.context.compacted";
2122
+ readonly payload: {
2123
+ readonly turn: number;
2124
+ readonly originalCount: number;
2125
+ readonly compactedCount: number;
2126
+ readonly summary?: string | undefined;
2127
+ readonly reason?: "manual" | "overflow" | "threshold" | undefined;
2128
+ readonly messages?: readonly {
2129
+ readonly role: "assistant" | "system" | "tool" | "user";
2130
+ readonly content: string;
2131
+ readonly toolCallId?: string | undefined;
2132
+ readonly name?: string | undefined;
2133
+ readonly toolCalls?: {
2134
+ readonly id: string;
2135
+ readonly name: string;
2136
+ readonly arguments: import("effect/Schema").Json;
2137
+ }[] | undefined;
2138
+ }[] | undefined;
2139
+ };
2140
+ }) | (Omit<EventInput, "payload" | "type"> & {
2141
+ readonly type: "agent.effects.requested";
2142
+ readonly payload: {
2143
+ readonly toolCallId: string;
2144
+ readonly effects: readonly ({
2145
+ readonly type: "runtime.spawn";
2146
+ readonly childThreadId: string;
2147
+ readonly kind: string;
2148
+ readonly definitionName: string;
2149
+ readonly definitionVersion: string;
2150
+ readonly input: import("effect/Schema").Json;
2151
+ } | {
2152
+ readonly type: "runtime.wait";
2153
+ readonly waitId: string;
2154
+ readonly on: {
2155
+ readonly type: string | readonly string[];
2156
+ readonly match?: import("effect/Schema").Json | undefined;
2157
+ } | {
2158
+ readonly timerAt: number;
2159
+ };
2160
+ readonly tag?: import("effect/Schema").Json | undefined;
2161
+ } | {
2162
+ readonly type: "runtime.emit";
2163
+ readonly event: {
2164
+ readonly type: string;
2165
+ readonly payload: import("effect/Schema").Json;
2166
+ readonly threadId?: string | null | undefined;
2167
+ readonly parentThreadId?: string | null | undefined;
2168
+ readonly causationId?: string | null | undefined;
2169
+ readonly correlationId?: string | null | undefined;
2170
+ readonly effectId?: string | null | undefined;
2171
+ readonly origin?: {
2172
+ readonly type: "thread";
2173
+ readonly threadId: string;
2174
+ } | {
2175
+ readonly type: "external";
2176
+ readonly actorId?: string | undefined;
2177
+ } | {
2178
+ readonly type: "system";
2179
+ } | {
2180
+ readonly type: "run";
2181
+ readonly runId: string;
2182
+ } | undefined;
2183
+ readonly ephemeral?: boolean | undefined;
2184
+ readonly id?: string | undefined;
2185
+ readonly ts?: number | undefined;
2186
+ readonly idempotencyKey?: string | null | undefined;
2187
+ };
2188
+ readonly tag?: string | undefined;
2189
+ } | {
2190
+ readonly type: "runtime.complete";
2191
+ readonly output: import("effect/Schema").Json;
2192
+ } | {
2193
+ readonly type: "runtime.fail";
2194
+ readonly error: string;
2195
+ } | {
2196
+ readonly type: "runtime.cancel";
2197
+ readonly threadId: string;
2198
+ readonly tag?: string | undefined;
2199
+ } | {
2200
+ readonly type: "runtime.launch";
2201
+ readonly runId: string;
2202
+ readonly kind: string;
2203
+ readonly definitionName: string;
2204
+ readonly definitionVersion: string;
2205
+ readonly input: import("effect/Schema").Json;
2206
+ readonly close: "terminate" | "wait";
2207
+ readonly tag?: string | undefined;
2208
+ } | {
2209
+ readonly type: "runtime.cancelRun";
2210
+ readonly runId: string;
2211
+ readonly tag?: string | undefined;
2212
+ } | {
2213
+ readonly type: string;
2214
+ readonly input: import("effect/Schema").Json;
2215
+ readonly tag?: string | undefined;
2216
+ readonly at?: number | undefined;
2217
+ })[];
2218
+ readonly waitOn?: {
2219
+ readonly type: string | readonly string[];
2220
+ readonly match?: import("effect/Schema").Json | undefined;
2221
+ } | undefined;
2222
+ };
2223
+ }) | (Omit<EventInput, "payload" | "type"> & {
2224
+ readonly type: "agent.lineage";
2145
2225
  readonly payload: {
2146
- readonly runId: string;
2147
- readonly kind: string;
2148
- readonly definitionName: string;
2149
- readonly definitionVersion: string;
2150
- readonly effectId: string;
2151
- readonly close: "terminate" | "wait";
2226
+ readonly depth: number;
2152
2227
  };
2153
2228
  }) | (Omit<EventInput, "payload" | "type"> & {
2154
- readonly type: "runtime.run.started";
2229
+ readonly type: "agent.message";
2155
2230
  readonly payload: {
2156
- readonly rootThreadId?: string | undefined;
2157
- readonly kind: string;
2158
- readonly definitionName: string;
2159
- readonly definitionVersion: string;
2160
- readonly input: import("effect/Schema").Json;
2161
- readonly requestedThreadId?: string | null | undefined;
2162
- readonly launchedBy?: {
2163
- readonly runId: string;
2164
- readonly threadId: string;
2165
- readonly effectId: string;
2166
- readonly causationId: string;
2167
- readonly causationSeq: number;
2168
- } | undefined;
2169
- readonly attributes?: {
2170
- readonly [x: string]: string;
2171
- } | undefined;
2172
- readonly trace?: {
2173
- readonly traceparent: string;
2174
- readonly tracestate?: string | undefined;
2231
+ readonly turn: number;
2232
+ readonly message: {
2233
+ readonly role: "assistant" | "system" | "tool" | "user";
2234
+ readonly content: string;
2235
+ readonly toolCallId?: string | undefined;
2236
+ readonly name?: string | undefined;
2237
+ readonly toolCalls?: {
2238
+ readonly id: string;
2239
+ readonly name: string;
2240
+ readonly arguments: import("effect/Schema").Json;
2241
+ }[] | undefined;
2242
+ };
2243
+ readonly usage?: {
2244
+ readonly input: number;
2245
+ readonly output: number;
2175
2246
  } | undefined;
2176
2247
  };
2177
2248
  }) | (Omit<EventInput, "payload" | "type"> & {
2178
- readonly type: "runtime.signal.received";
2249
+ readonly type: "agent.message.received";
2179
2250
  readonly payload: {
2180
- readonly signalType: string;
2251
+ readonly message: {
2252
+ readonly role: "assistant" | "system" | "tool" | "user";
2253
+ readonly content: string;
2254
+ readonly toolCallId?: string | undefined;
2255
+ readonly name?: string | undefined;
2256
+ readonly toolCalls?: {
2257
+ readonly id: string;
2258
+ readonly name: string;
2259
+ readonly arguments: import("effect/Schema").Json;
2260
+ }[] | undefined;
2261
+ };
2181
2262
  };
2182
2263
  }) | (Omit<EventInput, "payload" | "type"> & {
2183
- readonly type: "runtime.snapshot.taken";
2184
- readonly payload: {
2185
- readonly seq: number;
2186
- readonly stateHash: string;
2187
- readonly state?: import("effect/Schema").Json | undefined;
2188
- };
2264
+ readonly type: "agent.session.cancel.requested";
2265
+ readonly payload: {};
2189
2266
  }) | (Omit<EventInput, "payload" | "type"> & {
2190
- readonly type: "runtime.thread.cancel.requested";
2267
+ readonly type: "agent.session.message.submitted";
2191
2268
  readonly payload: {
2192
- readonly threadId: string;
2269
+ readonly messageId: string;
2270
+ readonly text: string;
2271
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
2272
+ readonly activeChildThreadId?: string | undefined;
2193
2273
  };
2194
2274
  }) | (Omit<EventInput, "payload" | "type"> & {
2195
- readonly type: "runtime.thread.cancelled";
2275
+ readonly type: "agent.session.steer.delivered";
2196
2276
  readonly payload: {
2197
- readonly threadId: string;
2198
- readonly reason?: string | undefined;
2199
- readonly resumeSeq?: number | undefined;
2277
+ readonly messageId: string;
2278
+ readonly activeMessageId: string;
2200
2279
  };
2201
2280
  }) | (Omit<EventInput, "payload" | "type"> & {
2202
- readonly type: "runtime.thread.completed";
2281
+ readonly type: "agent.session.turn.closed";
2203
2282
  readonly payload: {
2204
- readonly threadId: string;
2205
- readonly output: import("effect/Schema").Json;
2283
+ readonly messageId: string;
2284
+ readonly status: "cancelled" | "completed" | "failed";
2285
+ readonly error?: string | undefined;
2206
2286
  };
2207
2287
  }) | (Omit<EventInput, "payload" | "type"> & {
2208
- readonly type: "runtime.thread.failed";
2288
+ readonly type: "agent.session.turn.started";
2209
2289
  readonly payload: {
2210
- readonly threadId: string;
2211
- readonly error: string;
2290
+ readonly messageId: string;
2291
+ readonly childThreadId: string;
2212
2292
  };
2213
2293
  }) | (Omit<EventInput, "payload" | "type"> & {
2214
- readonly type: "runtime.thread.started";
2294
+ readonly type: "agent.spawn.requested";
2215
2295
  readonly payload: {
2216
- readonly threadId: string;
2296
+ readonly childThreadId: string;
2217
2297
  readonly kind: string;
2218
2298
  readonly definitionName: string;
2219
2299
  readonly definitionVersion: string;
2300
+ readonly toolCallId: string;
2220
2301
  readonly input: import("effect/Schema").Json;
2221
- readonly parentThreadId: string | null;
2302
+ readonly depth?: number | undefined;
2222
2303
  };
2223
2304
  }) | (Omit<EventInput, "payload" | "type"> & {
2224
- readonly type: "runtime.timer.fired";
2305
+ readonly type: "agent.steered";
2225
2306
  readonly payload: {
2226
- readonly timerId: string;
2227
- readonly waitId: string;
2307
+ readonly turn: number;
2308
+ readonly messageId?: string | undefined;
2309
+ readonly message: {
2310
+ readonly role: "assistant" | "system" | "tool" | "user";
2311
+ readonly content: string;
2312
+ readonly toolCallId?: string | undefined;
2313
+ readonly name?: string | undefined;
2314
+ readonly toolCalls?: {
2315
+ readonly id: string;
2316
+ readonly name: string;
2317
+ readonly arguments: import("effect/Schema").Json;
2318
+ }[] | undefined;
2319
+ };
2320
+ readonly interrupt?: boolean | undefined;
2228
2321
  };
2229
2322
  }) | (Omit<EventInput, "payload" | "type"> & {
2230
- readonly type: "runtime.timer.set";
2323
+ readonly type: "agent.tool.result";
2231
2324
  readonly payload: {
2232
- readonly timerId: string;
2233
- readonly waitId: string;
2234
- readonly wakeAt: number;
2325
+ readonly turn: number;
2326
+ readonly toolCallId: string;
2327
+ readonly name: string;
2328
+ readonly result: import("effect/Schema").Json;
2329
+ readonly error: string | null;
2235
2330
  };
2236
2331
  }) | (Omit<EventInput, "payload" | "type"> & {
2237
- readonly type: "runtime.wait.registered";
2332
+ readonly type: "agent.tool_call.requested";
2238
2333
  readonly payload: {
2239
- readonly waitId: string;
2240
- readonly threadId?: string | undefined;
2241
- readonly on: {
2242
- readonly type: string | readonly string[];
2243
- readonly match?: import("effect/Schema").Json | undefined;
2244
- } | {
2245
- readonly timerAt: number;
2334
+ readonly turn: number;
2335
+ readonly toolCall: {
2336
+ readonly id: string;
2337
+ readonly name: string;
2338
+ readonly arguments: import("effect/Schema").Json;
2246
2339
  };
2247
- readonly tag?: import("effect/Schema").Json | undefined;
2248
2340
  };
2249
2341
  }) | (Omit<EventInput, "payload" | "type"> & {
2250
- readonly type: "runtime.wait.satisfied";
2342
+ readonly type: "agent.turn.started";
2251
2343
  readonly payload: {
2252
- readonly waitId: string;
2253
- readonly tag?: import("effect/Schema").Json | undefined;
2254
- readonly event: {
2255
- readonly id: string;
2256
- readonly type: string;
2257
- readonly payload: import("effect/Schema").Json;
2258
- };
2344
+ readonly turn: number;
2345
+ };
2346
+ }) | (Omit<EventInput, "payload" | "type"> & {
2347
+ readonly type: "agent.turn.stopped";
2348
+ readonly payload: {};
2349
+ }) | (Omit<EventInput, "payload" | "type"> & {
2350
+ readonly type: "agent.turn.text_delta";
2351
+ readonly payload: {
2352
+ readonly turn: number;
2353
+ readonly delta: string;
2354
+ };
2355
+ }) | (Omit<EventInput, "payload" | "type"> & {
2356
+ readonly type: "agent.turn.usage";
2357
+ readonly payload: {
2358
+ readonly turn: number;
2359
+ readonly input: number;
2360
+ readonly output: number;
2259
2361
  };
2260
2362
  })>;
2261
2363
  };
@@ -2286,4 +2388,108 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
2286
2388
  readonly active: boolean;
2287
2389
  }>;
2288
2390
  };
2391
+ readonly signals: {
2392
+ userMessage: import("@swirls/looms/core").SignalDefinition<{
2393
+ readonly content: string;
2394
+ }, Omit<EventInput, "payload" | "type"> & {
2395
+ readonly type: "agent.message.received";
2396
+ readonly payload: {
2397
+ readonly message: {
2398
+ readonly role: "assistant" | "system" | "tool" | "user";
2399
+ readonly content: string;
2400
+ readonly toolCallId?: string | undefined;
2401
+ readonly name?: string | undefined;
2402
+ readonly toolCalls?: {
2403
+ readonly id: string;
2404
+ readonly name: string;
2405
+ readonly arguments: import("effect/Schema").Json;
2406
+ }[] | undefined;
2407
+ };
2408
+ };
2409
+ }>;
2410
+ steer: import("@swirls/looms/core").SignalDefinition<{
2411
+ readonly content: string;
2412
+ readonly interrupt?: boolean | undefined;
2413
+ }, Omit<EventInput, "payload" | "type"> & {
2414
+ readonly type: "agent.steered";
2415
+ readonly payload: {
2416
+ readonly turn: number;
2417
+ readonly messageId?: string | undefined;
2418
+ readonly message: {
2419
+ readonly role: "assistant" | "system" | "tool" | "user";
2420
+ readonly content: string;
2421
+ readonly toolCallId?: string | undefined;
2422
+ readonly name?: string | undefined;
2423
+ readonly toolCalls?: {
2424
+ readonly id: string;
2425
+ readonly name: string;
2426
+ readonly arguments: import("effect/Schema").Json;
2427
+ }[] | undefined;
2428
+ };
2429
+ readonly interrupt?: boolean | undefined;
2430
+ };
2431
+ }>;
2432
+ stopAgentTurn: import("@swirls/looms/core").SignalDefinition<undefined, Omit<EventInput, "payload" | "type"> & {
2433
+ readonly type: "agent.turn.stopped";
2434
+ readonly payload: {};
2435
+ }>;
2436
+ submitAgentMessage: import("@swirls/looms/core").SignalDefinition<{
2437
+ readonly messageId: string;
2438
+ readonly text: string;
2439
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
2440
+ readonly activeChildThreadId?: string | undefined;
2441
+ }, Omit<EventInput, "payload" | "type"> & {
2442
+ readonly type: "agent.session.message.submitted";
2443
+ readonly payload: {
2444
+ readonly messageId: string;
2445
+ readonly text: string;
2446
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
2447
+ readonly activeChildThreadId?: string | undefined;
2448
+ };
2449
+ }>;
2450
+ cancelAgentTurn: import("@swirls/looms/core").SignalDefinition<{
2451
+ readonly childThreadId: string;
2452
+ }, ({
2453
+ type: 'runtime.thread.cancel.requested';
2454
+ payload: {
2455
+ threadId: string;
2456
+ };
2457
+ } | (Omit<EventInput, "payload" | "type"> & {
2458
+ readonly type: "agent.session.cancel.requested";
2459
+ readonly payload: {};
2460
+ }))[]>;
2461
+ agentSessionMessageEvents: import("@swirls/looms/core").SignalDefinition<{
2462
+ readonly messageId: string;
2463
+ readonly text: string;
2464
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
2465
+ readonly activeChildThreadId?: string | undefined;
2466
+ }, ((Omit<EventInput, "payload" | "type"> & {
2467
+ readonly type: "agent.session.message.submitted";
2468
+ readonly payload: {
2469
+ readonly messageId: string;
2470
+ readonly text: string;
2471
+ readonly delivery?: "followUp" | "nextTurn" | "steer" | undefined;
2472
+ readonly activeChildThreadId?: string | undefined;
2473
+ };
2474
+ }) | (Omit<EventInput, "payload" | "type"> & {
2475
+ readonly type: "agent.steered";
2476
+ readonly payload: {
2477
+ readonly turn: number;
2478
+ readonly messageId?: string | undefined;
2479
+ readonly message: {
2480
+ readonly role: "assistant" | "system" | "tool" | "user";
2481
+ readonly content: string;
2482
+ readonly toolCallId?: string | undefined;
2483
+ readonly name?: string | undefined;
2484
+ readonly toolCalls?: {
2485
+ readonly id: string;
2486
+ readonly name: string;
2487
+ readonly arguments: import("effect/Schema").Json;
2488
+ }[] | undefined;
2489
+ };
2490
+ readonly interrupt?: boolean | undefined;
2491
+ };
2492
+ }))[]>;
2493
+ };
2494
+ readonly steps: {};
2289
2495
  };