@swirls/looms 0.0.1 → 0.0.2

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,46 @@
1
+ # @swirls/looms
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - 9f3fd62: Include the package changelog in published npm artifacts.
8
+
9
+ ## 0.0.1
10
+
11
+ ### Patch Changes
12
+
13
+ - e83496a: **BREAKING**: Modules own their definitions. Pass `workflow({ definitions: [checkout] })` / `agent({ definitions: [...] })` instead of a top-level `definitions` list on `createLooms`, `createRuntime`, actor cells/hosts, or Durable Objects. Omitting `modules` installs none (no longer defaults to agent/workflow/approval).
14
+
15
+ **BREAKING**: `defineModule(options, setup)` returns the finished module. Returned `effects` / `threads` / `projections` / `definitions` are registered and exposed (e.g. `payments.effects.charge`). The old scope-only + `.build()` form is replaced by `createModuleScope` for multi-file authoring.
16
+
17
+ Compose rejects duplicate definitions and definitions whose owning module does not implement the thread kind. Starting or spawning an unsupported kind fails before run events are written; folding an unsupported kind marks the thread failed instead of inventing empty state.
18
+
19
+ - ee5f92f: Initial 0.0.1 OSS release: durable Effect runtime for agents and workflows, S2 adapter, HTTP client, React bindings, CLI, optional projectors, and demo app.
20
+ - 4c8410e: Looms DX overhaul:
21
+
22
+ - Add Standard Schema `input` typing and runtime validation for `defineAgent`, `defineWorkflow`, and `defineTool`.
23
+ - Provide Promise-based `createLooms()` facade with lazy init, typed start overloads, and universal `fetch(req) -> Response | null`.
24
+ - Add Looms-native event streaming directly against EventStore and `/api/events` (eliminating the dual-log S2 bridge).
25
+ - Add `s2Lite()` / `startS2Lite()` auto-starting dev process manager.
26
+ - Typed client generics for `createLoomsClient<typeof definitions>()`.
27
+ - Single server setup for dev and prod in demo app with no `effect` dependency.
28
+
29
+ - 4c8410e: Introduce the generic `@swirls/looms/projectors` module. Implement `Projector` or use `memory()`,
30
+ `postgres({ url })`, and `sqlite({ path })`. `createLooms({ projectors })` initializes projectors,
31
+ wraps append, and disposes them. S2 helpers now take an explicit environment bag; `serveHttp` no
32
+ longer reads `PORT`.
33
+ - f1cceb0: Optimize React SDK and Debugger for high-velocity event streaming:
34
+
35
+ - **BREAKING (`@swirls/looms/react`)**: `useRunStore(runId, options)` is now a non-subscribing handle. Subscribe via fine-grained hooks (`useProjection`, `useRunEvents`, `useRunSummary`, `useThreadTree`, `useEventCounts`, `useEventBySeq`, `useLatestEvent`, `useEventFold`, `useRunSelector`). Removed `createLoomsHooks` and `pollIntervalMs` — use `LoomsRegister` or explicit `EventsOf<…>` generics instead.
36
+ - **BREAKING (`@swirls/looms/react`)**: Materialized tables no longer include `events_log`; the event log lives only in `store.events()` / `EventIndex`. `StoreListener` is now `() => void` (re-read via store APIs).
37
+ - **Incremental Projection Caching (`@swirls/looms/react`)**: `store.project(def)` and `useProjection` fold newly arrived events from cached state (O(batch)), preserving references when unchanged.
38
+ - **Adaptive Coalescing (`@swirls/looms/react`)**: Default `coalesce: 'adaptive'` (macrotask when quiet, animation-frame under burst); also `frame`, `immediate`, `{ delayMs }`. Notify scheduling lives in `createNotifyScheduler`. Added `store.flush()`.
39
+ - **Shared `EventIndex` (`@swirls/looms/core`)**: Append-only thread/seq/count/latest indexes with lazy snapshots; used by the React client store and the debugger.
40
+ - **Debugger (`@swirls/looms/debugger`)**: Virtualized `EventStream` with stable default catalog, catalog-aware meta cache, and `useMemo` visibility filtering.
41
+
42
+ - e398380: Publish the React integration at `@swirls/looms/react` and drop the former LiveStore protocol names.
43
+
44
+ - Package and React provider are now `@swirls/looms/react` / `LoomsProvider`.
45
+ - Live event HTTP is `GET /api/events?runId=` (pull or SSE). Wire batches are Looms event envelopes.
46
+ - `LiveStoreGlobalEncoded` is now `EncodedLoomsEvent`.
package/README.md CHANGED
@@ -7,3 +7,5 @@ bun add @swirls/looms
7
7
  ```
8
8
 
9
9
  Import the core runtime from `@swirls/looms`, or use explicit modules such as `@swirls/looms/agent` and `@swirls/looms/react`. See the [repository README](https://github.com/ByteSliceHQ/looms#readme) for the full guide.
10
+
11
+ Release notes are available in [`CHANGELOG.md`](./CHANGELOG.md).
@@ -14,54 +14,58 @@ export declare const scheduleEffect: NoInfer<import("@swirls/looms/core").Effect
14
14
  } | undefined;
15
15
  readonly input?: Schema.Json | undefined;
16
16
  }, WorkflowDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
17
- readonly type: "runtime.effect.failed";
17
+ readonly type: "workflow.node.started";
18
18
  readonly payload: {
19
- readonly effectId: string;
20
- readonly error: string;
19
+ readonly nodeId: string;
21
20
  };
22
21
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
23
- readonly type: "runtime.run.completed";
22
+ readonly type: "workflow.node.finished";
24
23
  readonly payload: {
25
- readonly output: Schema.Json;
24
+ readonly nodeId: string;
25
+ readonly result: Schema.Json;
26
26
  readonly error: string | null;
27
27
  };
28
28
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
29
- readonly type: "runtime.run.started";
29
+ readonly type: "workflow.node.skipped";
30
30
  readonly payload: {
31
- readonly rootThreadId?: string | undefined;
31
+ readonly nodeId: string;
32
+ readonly reason: string;
33
+ };
34
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
35
+ readonly type: "workflow.spawn.requested";
36
+ readonly payload: {
37
+ readonly nodeId: string;
38
+ readonly childThreadId: string;
32
39
  readonly kind: string;
33
40
  readonly definitionName: string;
34
41
  readonly input: Schema.Json;
35
42
  };
36
43
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
37
- readonly type: "runtime.signal.received";
44
+ readonly type: "workflow.sleep.requested";
38
45
  readonly payload: {
39
- readonly signalType: string;
46
+ readonly nodeId: string;
47
+ readonly waitId: string;
48
+ readonly wakeAt: number;
40
49
  };
41
50
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
42
- readonly type: "runtime.snapshot.taken";
51
+ readonly type: "workflow.effects.requested";
43
52
  readonly payload: {
44
- readonly seq: number;
45
- readonly stateHash: string;
46
- readonly state?: Schema.Json | undefined;
53
+ readonly nodeId: string;
54
+ readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
47
55
  };
48
56
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
49
- readonly type: "runtime.thread.cancelled";
57
+ readonly type: "runtime.run.started";
50
58
  readonly payload: {
51
- readonly threadId: string;
52
- readonly reason?: string | undefined;
59
+ readonly rootThreadId?: string | undefined;
60
+ readonly kind: string;
61
+ readonly definitionName: string;
62
+ readonly input: Schema.Json;
53
63
  };
54
64
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
55
- readonly type: "runtime.thread.completed";
65
+ readonly type: "runtime.run.completed";
56
66
  readonly payload: {
57
- readonly threadId: string;
58
67
  readonly output: Schema.Json;
59
- };
60
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
61
- readonly type: "runtime.thread.failed";
62
- readonly payload: {
63
- readonly threadId: string;
64
- readonly error: string;
68
+ readonly error: string | null;
65
69
  };
66
70
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
67
71
  readonly type: "runtime.thread.started";
@@ -73,17 +77,22 @@ export declare const scheduleEffect: NoInfer<import("@swirls/looms/core").Effect
73
77
  readonly parentThreadId: string | null;
74
78
  };
75
79
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
76
- readonly type: "runtime.timer.fired";
80
+ readonly type: "runtime.thread.completed";
77
81
  readonly payload: {
78
- readonly timerId: string;
79
- readonly waitId: string;
82
+ readonly threadId: string;
83
+ readonly output: Schema.Json;
80
84
  };
81
85
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
82
- readonly type: "runtime.timer.set";
86
+ readonly type: "runtime.thread.failed";
83
87
  readonly payload: {
84
- readonly timerId: string;
85
- readonly waitId: string;
86
- readonly wakeAt: number;
88
+ readonly threadId: string;
89
+ readonly error: string;
90
+ };
91
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
92
+ readonly type: "runtime.thread.cancelled";
93
+ readonly payload: {
94
+ readonly threadId: string;
95
+ readonly reason?: string | undefined;
87
96
  };
88
97
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
89
98
  readonly type: "runtime.wait.registered";
@@ -110,44 +119,35 @@ export declare const scheduleEffect: NoInfer<import("@swirls/looms/core").Effect
110
119
  };
111
120
  };
112
121
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
113
- readonly type: "workflow.effects.requested";
114
- readonly payload: {
115
- readonly nodeId: string;
116
- readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
117
- };
118
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
119
- readonly type: "workflow.node.finished";
122
+ readonly type: "runtime.timer.set";
120
123
  readonly payload: {
121
- readonly nodeId: string;
122
- readonly result: Schema.Json;
123
- readonly error: string | null;
124
+ readonly timerId: string;
125
+ readonly waitId: string;
126
+ readonly wakeAt: number;
124
127
  };
125
128
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
126
- readonly type: "workflow.node.skipped";
129
+ readonly type: "runtime.timer.fired";
127
130
  readonly payload: {
128
- readonly nodeId: string;
129
- readonly reason: string;
131
+ readonly timerId: string;
132
+ readonly waitId: string;
130
133
  };
131
134
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
132
- readonly type: "workflow.node.started";
135
+ readonly type: "runtime.effect.failed";
133
136
  readonly payload: {
134
- readonly nodeId: string;
137
+ readonly effectId: string;
138
+ readonly error: string;
135
139
  };
136
140
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
137
- readonly type: "workflow.sleep.requested";
141
+ readonly type: "runtime.snapshot.taken";
138
142
  readonly payload: {
139
- readonly nodeId: string;
140
- readonly waitId: string;
141
- readonly wakeAt: number;
143
+ readonly seq: number;
144
+ readonly stateHash: string;
145
+ readonly state?: Schema.Json | undefined;
142
146
  };
143
147
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
144
- readonly type: "workflow.spawn.requested";
148
+ readonly type: "runtime.signal.received";
145
149
  readonly payload: {
146
- readonly nodeId: string;
147
- readonly childThreadId: string;
148
- readonly kind: string;
149
- readonly definitionName: string;
150
- readonly input: Schema.Json;
150
+ readonly signalType: string;
151
151
  };
152
152
  })>>;
153
153
  export declare function scheduleEvents(definition: WorkflowDefinition, binding: {
@@ -167,54 +167,58 @@ export declare const runNodeEffect: NoInfer<import("@swirls/looms/core").EffectD
167
167
  readonly [x: string]: Schema.Json;
168
168
  } | undefined;
169
169
  }, WorkflowDefinitionsTag, (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
170
- readonly type: "runtime.effect.failed";
170
+ readonly type: "workflow.node.started";
171
171
  readonly payload: {
172
- readonly effectId: string;
173
- readonly error: string;
172
+ readonly nodeId: string;
174
173
  };
175
174
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
176
- readonly type: "runtime.run.completed";
175
+ readonly type: "workflow.node.finished";
177
176
  readonly payload: {
178
- readonly output: Schema.Json;
177
+ readonly nodeId: string;
178
+ readonly result: Schema.Json;
179
179
  readonly error: string | null;
180
180
  };
181
181
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
182
- readonly type: "runtime.run.started";
182
+ readonly type: "workflow.node.skipped";
183
183
  readonly payload: {
184
- readonly rootThreadId?: string | undefined;
184
+ readonly nodeId: string;
185
+ readonly reason: string;
186
+ };
187
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
188
+ readonly type: "workflow.spawn.requested";
189
+ readonly payload: {
190
+ readonly nodeId: string;
191
+ readonly childThreadId: string;
185
192
  readonly kind: string;
186
193
  readonly definitionName: string;
187
194
  readonly input: Schema.Json;
188
195
  };
189
196
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
190
- readonly type: "runtime.signal.received";
197
+ readonly type: "workflow.sleep.requested";
191
198
  readonly payload: {
192
- readonly signalType: string;
199
+ readonly nodeId: string;
200
+ readonly waitId: string;
201
+ readonly wakeAt: number;
193
202
  };
194
203
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
195
- readonly type: "runtime.snapshot.taken";
204
+ readonly type: "workflow.effects.requested";
196
205
  readonly payload: {
197
- readonly seq: number;
198
- readonly stateHash: string;
199
- readonly state?: Schema.Json | undefined;
206
+ readonly nodeId: string;
207
+ readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
200
208
  };
201
209
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
202
- readonly type: "runtime.thread.cancelled";
210
+ readonly type: "runtime.run.started";
203
211
  readonly payload: {
204
- readonly threadId: string;
205
- readonly reason?: string | undefined;
212
+ readonly rootThreadId?: string | undefined;
213
+ readonly kind: string;
214
+ readonly definitionName: string;
215
+ readonly input: Schema.Json;
206
216
  };
207
217
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
208
- readonly type: "runtime.thread.completed";
218
+ readonly type: "runtime.run.completed";
209
219
  readonly payload: {
210
- readonly threadId: string;
211
220
  readonly output: Schema.Json;
212
- };
213
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
214
- readonly type: "runtime.thread.failed";
215
- readonly payload: {
216
- readonly threadId: string;
217
- readonly error: string;
221
+ readonly error: string | null;
218
222
  };
219
223
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
220
224
  readonly type: "runtime.thread.started";
@@ -226,17 +230,22 @@ export declare const runNodeEffect: NoInfer<import("@swirls/looms/core").EffectD
226
230
  readonly parentThreadId: string | null;
227
231
  };
228
232
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
229
- readonly type: "runtime.timer.fired";
233
+ readonly type: "runtime.thread.completed";
230
234
  readonly payload: {
231
- readonly timerId: string;
232
- readonly waitId: string;
235
+ readonly threadId: string;
236
+ readonly output: Schema.Json;
233
237
  };
234
238
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
235
- readonly type: "runtime.timer.set";
239
+ readonly type: "runtime.thread.failed";
236
240
  readonly payload: {
237
- readonly timerId: string;
238
- readonly waitId: string;
239
- readonly wakeAt: number;
241
+ readonly threadId: string;
242
+ readonly error: string;
243
+ };
244
+ }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
245
+ readonly type: "runtime.thread.cancelled";
246
+ readonly payload: {
247
+ readonly threadId: string;
248
+ readonly reason?: string | undefined;
240
249
  };
241
250
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
242
251
  readonly type: "runtime.wait.registered";
@@ -263,43 +272,34 @@ export declare const runNodeEffect: NoInfer<import("@swirls/looms/core").EffectD
263
272
  };
264
273
  };
265
274
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
266
- readonly type: "workflow.effects.requested";
267
- readonly payload: {
268
- readonly nodeId: string;
269
- readonly effects: readonly import("@swirls/looms/core").RuntimeEffect[];
270
- };
271
- }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
272
- readonly type: "workflow.node.finished";
275
+ readonly type: "runtime.timer.set";
273
276
  readonly payload: {
274
- readonly nodeId: string;
275
- readonly result: Schema.Json;
276
- readonly error: string | null;
277
+ readonly timerId: string;
278
+ readonly waitId: string;
279
+ readonly wakeAt: number;
277
280
  };
278
281
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
279
- readonly type: "workflow.node.skipped";
282
+ readonly type: "runtime.timer.fired";
280
283
  readonly payload: {
281
- readonly nodeId: string;
282
- readonly reason: string;
284
+ readonly timerId: string;
285
+ readonly waitId: string;
283
286
  };
284
287
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
285
- readonly type: "workflow.node.started";
288
+ readonly type: "runtime.effect.failed";
286
289
  readonly payload: {
287
- readonly nodeId: string;
290
+ readonly effectId: string;
291
+ readonly error: string;
288
292
  };
289
293
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
290
- readonly type: "workflow.sleep.requested";
294
+ readonly type: "runtime.snapshot.taken";
291
295
  readonly payload: {
292
- readonly nodeId: string;
293
- readonly waitId: string;
294
- readonly wakeAt: number;
296
+ readonly seq: number;
297
+ readonly stateHash: string;
298
+ readonly state?: Schema.Json | undefined;
295
299
  };
296
300
  }) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
297
- readonly type: "workflow.spawn.requested";
301
+ readonly type: "runtime.signal.received";
298
302
  readonly payload: {
299
- readonly nodeId: string;
300
- readonly childThreadId: string;
301
- readonly kind: string;
302
- readonly definitionName: string;
303
- readonly input: Schema.Json;
303
+ readonly signalType: string;
304
304
  };
305
305
  })>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swirls/looms",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "description": "Pluggable event-sourced runtime for durable agents and workflows",
5
5
  "homepage": "https://github.com/ByteSliceHQ/looms#readme",
6
6
  "bugs": {
@@ -18,6 +18,7 @@
18
18
  "files": [
19
19
  "dist",
20
20
  "README.md",
21
+ "CHANGELOG.md",
21
22
  "LICENSE"
22
23
  ],
23
24
  "type": "module",