@swirls/looms 0.5.1 → 0.6.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 (46) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/actor/cell.d.ts +6 -1
  3. package/dist/actor/cell.js +1 -0
  4. package/dist/agent/definitions.d.ts +0 -12
  5. package/dist/agent/effects.js +0 -24
  6. package/dist/agent/module.d.ts +507 -507
  7. package/dist/agent/projections.d.ts +5 -0
  8. package/dist/agent/projections.js +5 -0
  9. package/dist/approval/effects.d.ts +26 -26
  10. package/dist/client/client.d.ts +2 -0
  11. package/dist/client/client.js +13 -1
  12. package/dist/client/index.d.ts +1 -1
  13. package/dist/client/index.js +1 -1
  14. package/dist/cloudflare/durable-object.d.ts +7 -1
  15. package/dist/cloudflare/durable-object.js +1 -0
  16. package/dist/cloudflare/queue-consumer.js +6 -1
  17. package/dist/core/blob-store.js +5 -1
  18. package/dist/core/definition-resolver.d.ts +16 -0
  19. package/dist/core/definition-resolver.js +23 -0
  20. package/dist/core/definition-version.d.ts +3 -0
  21. package/dist/core/definition-version.js +5 -0
  22. package/dist/core/effects.js +1 -1
  23. package/dist/core/module.d.ts +12 -3
  24. package/dist/core/module.js +18 -3
  25. package/dist/debugger/app/assets/{index-C31SnCuN.js → index-CUO1xyYW.js} +2 -2
  26. package/dist/debugger/app/assets/{routes-DPA3O5AF.js → routes-lt_6J025.js} +12 -12
  27. package/dist/debugger/app/index.html +1 -1
  28. package/dist/evaluator/effects.d.ts +33 -33
  29. package/dist/evaluator/module.d.ts +66 -66
  30. package/dist/react/store.d.ts +1 -1
  31. package/dist/react/store.js +2 -1
  32. package/dist/runtime/cancellation.js +21 -0
  33. package/dist/runtime/dispatch-effect.js +4 -1
  34. package/dist/runtime/filesystem-blob-store.js +17 -8
  35. package/dist/runtime/repository.js +2 -1
  36. package/dist/runtime/server/routes/runs.js +6 -11
  37. package/dist/runtime/sse.d.ts +3 -1
  38. package/dist/runtime/sse.js +5 -2
  39. package/dist/runtime/types.d.ts +2 -1
  40. package/dist/runtime/wake-engine.js +16 -11
  41. package/dist/runtime/worker-effect-dispatch.d.ts +3 -1
  42. package/dist/runtime/worker-effect-dispatch.js +14 -5
  43. package/dist/schedule/module.d.ts +36 -36
  44. package/dist/testing/corpus-module.js +11 -2
  45. package/dist/workflow/threads.js +5 -8
  46. package/package.json +1 -1
@@ -333,15 +333,6 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
333
333
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
334
334
  readonly type: "schedule.paused";
335
335
  readonly payload: {};
336
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
337
- readonly type: "schedule.resumed";
338
- readonly payload: {};
339
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
340
- readonly type: "schedule.retired";
341
- readonly payload: {};
342
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
343
- readonly type: "schedule.triggered";
344
- readonly payload: {};
345
336
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
346
337
  readonly type: "schedule.planned";
347
338
  readonly payload: {
@@ -365,6 +356,12 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
365
356
  readonly payload: {
366
357
  readonly reason: string;
367
358
  };
359
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
360
+ readonly type: "schedule.resumed";
361
+ readonly payload: {};
362
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
363
+ readonly type: "schedule.retired";
364
+ readonly payload: {};
368
365
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
369
366
  readonly type: "schedule.skipped";
370
367
  readonly payload: {
@@ -375,6 +372,9 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
375
372
  readonly manual: boolean;
376
373
  readonly triggerId?: string | undefined;
377
374
  };
375
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
376
+ readonly type: "schedule.triggered";
377
+ readonly payload: {};
378
378
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
379
379
  readonly type: "schedule.updated";
380
380
  readonly payload: {
@@ -675,15 +675,6 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
675
675
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
676
676
  readonly type: "schedule.paused";
677
677
  readonly payload: {};
678
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
679
- readonly type: "schedule.resumed";
680
- readonly payload: {};
681
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
682
- readonly type: "schedule.retired";
683
- readonly payload: {};
684
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
685
- readonly type: "schedule.triggered";
686
- readonly payload: {};
687
678
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
688
679
  readonly type: "schedule.planned";
689
680
  readonly payload: {
@@ -707,6 +698,12 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
707
698
  readonly payload: {
708
699
  readonly reason: string;
709
700
  };
701
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
702
+ readonly type: "schedule.resumed";
703
+ readonly payload: {};
704
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
705
+ readonly type: "schedule.retired";
706
+ readonly payload: {};
710
707
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
711
708
  readonly type: "schedule.skipped";
712
709
  readonly payload: {
@@ -717,6 +714,9 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
717
714
  readonly manual: boolean;
718
715
  readonly triggerId?: string | undefined;
719
716
  };
717
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
718
+ readonly type: "schedule.triggered";
719
+ readonly payload: {};
720
720
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
721
721
  readonly type: "schedule.updated";
722
722
  readonly payload: {
@@ -1036,15 +1036,6 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
1036
1036
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1037
1037
  readonly type: "schedule.paused";
1038
1038
  readonly payload: {};
1039
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1040
- readonly type: "schedule.resumed";
1041
- readonly payload: {};
1042
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1043
- readonly type: "schedule.retired";
1044
- readonly payload: {};
1045
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1046
- readonly type: "schedule.triggered";
1047
- readonly payload: {};
1048
1039
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1049
1040
  readonly type: "schedule.planned";
1050
1041
  readonly payload: {
@@ -1068,6 +1059,12 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
1068
1059
  readonly payload: {
1069
1060
  readonly reason: string;
1070
1061
  };
1062
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1063
+ readonly type: "schedule.resumed";
1064
+ readonly payload: {};
1065
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1066
+ readonly type: "schedule.retired";
1067
+ readonly payload: {};
1071
1068
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1072
1069
  readonly type: "schedule.skipped";
1073
1070
  readonly payload: {
@@ -1078,6 +1075,9 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
1078
1075
  readonly manual: boolean;
1079
1076
  readonly triggerId?: string | undefined;
1080
1077
  };
1078
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1079
+ readonly type: "schedule.triggered";
1080
+ readonly payload: {};
1081
1081
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1082
1082
  readonly type: "schedule.updated";
1083
1083
  readonly payload: {
@@ -1378,15 +1378,6 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
1378
1378
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1379
1379
  readonly type: "schedule.paused";
1380
1380
  readonly payload: {};
1381
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1382
- readonly type: "schedule.resumed";
1383
- readonly payload: {};
1384
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1385
- readonly type: "schedule.retired";
1386
- readonly payload: {};
1387
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1388
- readonly type: "schedule.triggered";
1389
- readonly payload: {};
1390
1381
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1391
1382
  readonly type: "schedule.planned";
1392
1383
  readonly payload: {
@@ -1410,6 +1401,12 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
1410
1401
  readonly payload: {
1411
1402
  readonly reason: string;
1412
1403
  };
1404
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1405
+ readonly type: "schedule.resumed";
1406
+ readonly payload: {};
1407
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1408
+ readonly type: "schedule.retired";
1409
+ readonly payload: {};
1413
1410
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1414
1411
  readonly type: "schedule.skipped";
1415
1412
  readonly payload: {
@@ -1420,6 +1417,9 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
1420
1417
  readonly manual: boolean;
1421
1418
  readonly triggerId?: string | undefined;
1422
1419
  };
1420
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1421
+ readonly type: "schedule.triggered";
1422
+ readonly payload: {};
1423
1423
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
1424
1424
  readonly type: "schedule.updated";
1425
1425
  readonly payload: {
@@ -19,12 +19,21 @@ const decodeCheckoutInput = Schema.decodeUnknownOption(CheckoutInputSchema);
19
19
  export function corpusModule(options) {
20
20
  const charge = defineEffect({
21
21
  type: corpusChargeV1,
22
- retry: { maxAttempts: 3, backoffMs: 1, scheduleToStartTimeoutMs: 60_000 },
22
+ retry: {
23
+ maxAttempts: 3,
24
+ backoffMs: 1,
25
+ scheduleToStartTimeoutMs: 60_000,
26
+ startToCloseTimeoutMs: 60_000,
27
+ },
23
28
  execute: options?.charge,
24
29
  });
25
30
  const chargeV2 = defineEffect({
26
31
  type: corpusChargeV2,
27
- retry: { maxAttempts: 1, scheduleToStartTimeoutMs: 60_000 },
32
+ retry: {
33
+ maxAttempts: 1,
34
+ scheduleToStartTimeoutMs: 60_000,
35
+ startToCloseTimeoutMs: 60_000,
36
+ },
28
37
  execute: options?.charge,
29
38
  });
30
39
  return defineRuntimeModule({
@@ -218,23 +218,20 @@ function unsettledChildren(state, nodeId, threadId, runId) {
218
218
  }
219
219
  /**
220
220
  * Drops a node's pending work and cancels the children it leaves running. `settled` is the child
221
- * whose result is finishing the node, which must not be cancelled. A `wait` child run stays
222
- * pending until it settles, so the node does not finish ahead of that cancellation.
221
+ * whose result is finishing the node, which must not be cancelled. Wait-policy child runs are
222
+ * cancelled here too; run-level `childClose: 'wait'` is enforced by the runtime's launched-run
223
+ * bookkeeping, not by leaving stale entries in workflow pending state.
223
224
  */
224
225
  function withoutPendingWork(state, nodeId, threadId, runId, settled = null) {
225
226
  const children = unsettledChildren(state, nodeId, threadId, runId);
226
227
  const cancels = children
227
228
  .map((child) => child.target)
228
229
  .filter((target) => target !== settled && !state.pendingCancels.includes(target));
229
- const keptSpawns = new Set(children
230
- .filter((child) => child.execution === 'run' && child.close === 'wait' && child.target !== settled)
231
- .map((child) => child.key));
232
- const keepMap = children.some((child) => child.execution === 'run' && child.close === 'wait' && child.target !== settled);
233
230
  return {
234
231
  ...state,
235
232
  pendingCancels: cancels.length === 0 ? state.pendingCancels : [...state.pendingCancels, ...cancels],
236
- pendingSpawns: state.pendingSpawns.filter((item) => item.nodeId !== nodeId || keptSpawns.has(item.childThreadId)),
237
- pendingMaps: state.pendingMaps.filter((item) => item.nodeId !== nodeId || keepMap),
233
+ pendingSpawns: state.pendingSpawns.filter((item) => item.nodeId !== nodeId),
234
+ pendingMaps: state.pendingMaps.filter((item) => item.nodeId !== nodeId),
238
235
  pendingSleeps: state.pendingSleeps.filter((item) => item.nodeId !== nodeId),
239
236
  pendingEffects: state.pendingEffects.filter((item) => item.nodeId !== nodeId),
240
237
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swirls/looms",
3
- "version": "0.5.1",
3
+ "version": "0.6.0",
4
4
  "description": "Pluggable event-sourced runtime for durable agents and workflows",
5
5
  "homepage": "https://github.com/ByteSliceHQ/looms#readme",
6
6
  "bugs": {