@swirls/looms 0.6.1 → 0.8.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.
- package/CHANGELOG.md +26 -0
- package/dist/actor/cell.d.ts +1 -1
- package/dist/actor/routing.d.ts +5 -1
- package/dist/actor/routing.js +14 -3
- package/dist/agent/effects.d.ts +20 -2
- package/dist/agent/effects.js +2 -0
- package/dist/agent/module.d.ts +40 -4
- package/dist/approval/effects.d.ts +10 -1
- package/dist/approval/effects.js +1 -0
- package/dist/approval/module.d.ts +20 -2
- package/dist/cli/commands.js +65 -1
- package/dist/client/client.d.ts +38 -10
- package/dist/client/client.js +2 -1
- package/dist/cloudflare/durable-object.d.ts +1 -1
- package/dist/cloudflare/index.d.ts +1 -1
- package/dist/cloudflare/index.js +1 -1
- package/dist/cloudflare/queue-consumer.d.ts +17 -10
- package/dist/cloudflare/queue-consumer.js +63 -27
- package/dist/cloudflare/queue-message.d.ts +4 -1
- package/dist/cloudflare/queue-message.js +4 -1
- package/dist/cloudflare/queue-worker.d.ts +7 -3
- package/dist/cloudflare/queue-worker.js +7 -2
- package/dist/cloudflare/queues.d.ts +1 -1
- package/dist/cloudflare/queues.js +1 -1
- package/dist/core/compose.d.ts +2 -1
- package/dist/core/compose.js +5 -0
- package/dist/core/effects.d.ts +84 -39
- package/dist/core/effects.js +29 -8
- package/dist/core/fold.js +34 -0
- package/dist/core/module-scope.d.ts +22 -8
- package/dist/core/module-scope.js +3 -0
- package/dist/core/module.d.ts +40 -9
- package/dist/core/module.js +25 -6
- package/dist/core/protocol.d.ts +12 -1
- package/dist/core/protocol.js +12 -0
- package/dist/core/published.d.ts +52 -0
- package/dist/core/published.js +45 -0
- package/dist/core/replay.d.ts +4 -2
- package/dist/core/state.d.ts +8 -2
- package/dist/core/state.js +2 -0
- package/dist/debugger/app/assets/{index-CUO1xyYW.js → index-CMRl_aWQ.js} +2 -2
- package/dist/debugger/app/assets/routes-CfXxKG45.js +47 -0
- package/dist/debugger/app/index.html +1 -1
- package/dist/debugger/events/protocol-summarize.js +2 -0
- package/dist/evaluator/effects.d.ts +10 -1
- package/dist/evaluator/effects.js +1 -0
- package/dist/evaluator/module.d.ts +20 -2
- package/dist/projectors/delivery.d.ts +8 -3
- package/dist/projectors/delivery.js +29 -2
- package/dist/projectors/event-log.d.ts +8 -2
- package/dist/projectors/event-log.js +47 -61
- package/dist/projectors/index.d.ts +1 -0
- package/dist/projectors/index.js +1 -0
- package/dist/projectors/postgres.d.ts +4 -1
- package/dist/projectors/postgres.js +6 -4
- package/dist/projectors/projector.d.ts +16 -0
- package/dist/projectors/projector.js +3 -0
- package/dist/projectors/replica/drizzle.d.ts +1192 -0
- package/dist/projectors/replica/drizzle.js +119 -0
- package/dist/projectors/replica/migrations.d.ts +35 -0
- package/dist/projectors/replica/migrations.js +230 -0
- package/dist/projectors/replica/postgres.d.ts +57 -0
- package/dist/projectors/replica/postgres.js +356 -0
- package/dist/projectors/schema.d.ts +2 -1
- package/dist/projectors/schema.js +2 -31
- package/dist/projectors/sqlite-delivery.js +9 -0
- package/dist/runtime/cancellation.js +1 -1
- package/dist/runtime/dispatch-effect.d.ts +2 -2
- package/dist/runtime/dispatch-effect.js +12 -4
- package/dist/runtime/effect-admission.d.ts +45 -0
- package/dist/runtime/effect-admission.js +70 -0
- package/dist/runtime/helpers.d.ts +6 -1
- package/dist/runtime/helpers.js +14 -5
- package/dist/runtime/index.d.ts +1 -0
- package/dist/runtime/index.js +1 -0
- package/dist/runtime/local-effect-executor.js +25 -3
- package/dist/runtime/retry-policy.js +6 -1
- package/dist/runtime/runtime.js +7 -2
- package/dist/runtime/server/routes/definitions.js +8 -1
- package/dist/runtime/types.d.ts +20 -5
- package/dist/runtime/wake-engine.js +20 -0
- package/dist/runtime/worker-callbacks.js +2 -2
- package/dist/runtime/worker-effect-dispatch.d.ts +35 -9
- package/dist/runtime/worker-effect-dispatch.js +105 -26
- package/dist/schedule/effects.d.ts +20 -2
- package/dist/schedule/effects.js +2 -0
- package/dist/schedule/module.d.ts +76 -40
- package/dist/testing/corpus-module.d.ts +2 -2
- package/dist/testing/corpus-module.js +27 -19
- package/dist/testing/index.js +12 -23
- package/dist/workflow/effects.d.ts +20 -2
- package/dist/workflow/effects.js +2 -0
- package/dist/workflow/module.d.ts +40 -4
- package/package.json +29 -1
- package/dist/debugger/app/assets/routes-lt_6J025.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @swirls/looms
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- ef94314: A Postgres replica copies every run into a database you own. `postgresReplica` stores the full event envelope, folds the run summary in the same transaction, and records `replicated_seq` only through a contiguous prefix, so a restored database or a replica attached mid-run catches up instead of leaving a hole. `status` reports whether that copy is complete. `purge` deletes event copies for finished runs and later deliveries skip them.
|
|
8
|
+
|
|
9
|
+
`looms replica generate` writes the versioned SQL into your migration folder (and a Drizzle journal, when you ask). `looms replica migrate` applies it. `@swirls/looms/replica/drizzle` exports the tables, and `loomsReplicaTables` adds columns your application owns.
|
|
10
|
+
|
|
11
|
+
## 0.7.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- f2bef2f: Effects declare `placement: 'local' | 'worker'` on `m.effect`, `scope.effect`, or `defineEffect`. Local effects require `execute`; worker effects forbid it and implement the handler with `workerHandlers`. Queue routes take worker definitions, local and worker handlers get distinct context types, and `defineModule` rejects effects built outside the module's catalog. `GET /definitions/effects` publishes each declared effect, including placement, retry policy, and input schema.
|
|
16
|
+
|
|
17
|
+
## Unreleased
|
|
18
|
+
|
|
19
|
+
### Minor Changes
|
|
20
|
+
|
|
21
|
+
- **Breaking:** Effect placement is explicit. `m.effect`, `scope.effect`, and `defineEffect` require `placement: 'local' | 'worker'`. Local effects must define `execute`; worker effects must not, and their handlers go in `workerHandlers`. Worker definitions no longer carry a no-op `execute`, and `hasHandler` is removed; branch on `placement` instead. The old inferred `execution` / handler-less / string-`handles` overlap model is removed. `cloudflareQueueWorker` routes take `{ effects: [definition], queue }` instead of `handles` type strings. `onEffect` only accepts local definitions; `workerHandlers` only accepts worker definitions. Handlers receive `LocalEffectContext` or `WorkerEffectContext` (`placement` discriminant); worker `emit` stays buffered until complete.
|
|
22
|
+
- **Breaking:** `defineModule` rejects effects whose events fall outside the module's catalog and `observes`, such as an effect built with another module's scope or an unscoped `defineEffect` that returns untyped events. Build effects that live in their own file with `createModuleScope(...).effect`.
|
|
23
|
+
- Effect admission hooks (`admission` / `onAdmit`) run in the host before every local attempt and before every worker dispatch, so credit checks and feature flags cover both paths. `failEffect` from admission becomes `runtime.effect.failed`; a rejected worker admission never queues. Execution middleware remains local-only.
|
|
24
|
+
- `onAdmit` and `onEffect` decode the input with the definition's schema before the hook runs, so hooks see defaults and transforms. An input that fails to decode fails the attempt.
|
|
25
|
+
- Queue tasks carry `threadId`, `causingEventId`, and `attributes`. Secrets load through the worker callback before the handler runs. `GET /definitions/effects` lists declared effects, including placement, retry policy, and input schema. `runtime.effectPlacements` lists placements; `inspectRun` / effect status includes each outstanding effect's `placement`.
|
|
26
|
+
- Creating a runtime fails when worker-placed effects have no `EffectWorker`, or when a worker claims a local-placed effect type.
|
|
27
|
+
- Unacknowledged worker dispatch failures no longer park as `ambiguous` on the first push. The attempt enters `dispatch_wait` via `runtime.effect.dispatch.deferred`, and the wake engine retries the same attempt with dedicated outbox backoff. `ambiguous` remains for missing workers, cancellation timeouts, and exhausted relays. Acknowledged transports (Cloudflare Queues) are unchanged. `retryEffect` can target `dispatch_wait`.
|
|
28
|
+
|
|
3
29
|
## 0.6.1
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
package/dist/actor/cell.d.ts
CHANGED
|
@@ -20,7 +20,7 @@ export interface ActorCellOptions<TModules extends readonly AnyRuntimeModule[] =
|
|
|
20
20
|
/** Starts runs from effect handlers. Required for schedules; there is no default inside a cell. */
|
|
21
21
|
readonly launcher?: RunLauncher;
|
|
22
22
|
/**
|
|
23
|
-
* Dispatches
|
|
23
|
+
* Dispatches worker-placed effects out of the cell (for example a
|
|
24
24
|
* Cloudflare Queue producer). Without it, worker effects cannot leave the object.
|
|
25
25
|
*/
|
|
26
26
|
readonly worker?: EffectWorker;
|
package/dist/actor/routing.d.ts
CHANGED
|
@@ -9,7 +9,11 @@ export declare function runIdFromRequest(req: Request): string | null;
|
|
|
9
9
|
* runs needs a global index, and a fork writes a second run. `host` names the backend.
|
|
10
10
|
*/
|
|
11
11
|
export declare function crossRunResponse(req: Request, host: string): Response | null;
|
|
12
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Answers definition catalogs from a module list or lazy factory without touching any run cell.
|
|
14
|
+
* `GET /definitions` is the thread-definition catalog. `GET /definitions/effects` is each declared
|
|
15
|
+
* effect, including placement.
|
|
16
|
+
*/
|
|
13
17
|
export declare function definitionsResponse(req: Request, modules: readonly AnyRuntimeModule[] | (() => readonly AnyRuntimeModule[]) | undefined): Response | null;
|
|
14
18
|
export interface ResolvedRunTarget {
|
|
15
19
|
readonly runId: string;
|
package/dist/actor/routing.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Data, Effect, Option, Predicate, Schema } from 'effect';
|
|
2
|
-
import { composeModules, createRunId, isJsonObject, publishDefinition, stringifyJson, } from '@swirls/looms/core';
|
|
2
|
+
import { composeModules, createRunId, isJsonObject, publishDefinition, publishEffects, stringifyJson, } from '@swirls/looms/core';
|
|
3
3
|
const RunTargetBodySchema = Schema.Struct({
|
|
4
4
|
runId: Schema.optional(Schema.NonEmptyString),
|
|
5
5
|
});
|
|
@@ -36,12 +36,23 @@ export function crossRunResponse(req, host) {
|
|
|
36
36
|
}
|
|
37
37
|
return null;
|
|
38
38
|
}
|
|
39
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Answers definition catalogs from a module list or lazy factory without touching any run cell.
|
|
41
|
+
* `GET /definitions` is the thread-definition catalog. `GET /definitions/effects` is each declared
|
|
42
|
+
* effect, including placement.
|
|
43
|
+
*/
|
|
40
44
|
export function definitionsResponse(req, modules) {
|
|
41
|
-
if (!modules || req.method !== 'GET'
|
|
45
|
+
if (!modules || req.method !== 'GET') {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const pathname = new URL(req.url).pathname;
|
|
49
|
+
if (pathname !== '/definitions' && pathname !== '/definitions/effects') {
|
|
42
50
|
return null;
|
|
43
51
|
}
|
|
44
52
|
const registry = composeModules(Predicate.isFunction(modules) ? modules() : modules);
|
|
53
|
+
if (pathname === '/definitions/effects') {
|
|
54
|
+
return Response.json({ effects: publishEffects(registry.effects.values()) });
|
|
55
|
+
}
|
|
45
56
|
return Response.json({
|
|
46
57
|
definitions: registry.definitions.map(publishDefinition),
|
|
47
58
|
projections: [...registry.projections.keys()],
|
package/dist/agent/effects.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type JsonValue } from '@swirls/looms/core';
|
|
|
3
3
|
import { AgentDefinitionsTag } from './definitions-store';
|
|
4
4
|
import { LlmTag } from './llm';
|
|
5
5
|
import { type ToolCall } from './types';
|
|
6
|
-
export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").
|
|
6
|
+
export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").LocalEffectDefinition<{
|
|
7
7
|
readonly turn: number;
|
|
8
8
|
readonly definitionName?: string | undefined;
|
|
9
9
|
readonly definitionVersion: string;
|
|
@@ -309,6 +309,15 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").EffectD
|
|
|
309
309
|
readonly effectId: string;
|
|
310
310
|
readonly attempt: number;
|
|
311
311
|
};
|
|
312
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
313
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
314
|
+
readonly payload: {
|
|
315
|
+
readonly effectId: string;
|
|
316
|
+
readonly attempt: number;
|
|
317
|
+
readonly retryAt: number;
|
|
318
|
+
readonly error: string;
|
|
319
|
+
readonly try: number;
|
|
320
|
+
};
|
|
312
321
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
313
322
|
readonly type: "runtime.effect.dispatched";
|
|
314
323
|
readonly payload: {
|
|
@@ -502,7 +511,7 @@ export declare const callLlmEffect: NoInfer<import("@swirls/looms/core").EffectD
|
|
|
502
511
|
};
|
|
503
512
|
};
|
|
504
513
|
})>>;
|
|
505
|
-
export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").
|
|
514
|
+
export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").LocalEffectDefinition<{
|
|
506
515
|
readonly turn: number;
|
|
507
516
|
readonly definitionName?: string | undefined;
|
|
508
517
|
readonly definitionVersion: string;
|
|
@@ -800,6 +809,15 @@ export declare const executeToolEffect: NoInfer<import("@swirls/looms/core").Eff
|
|
|
800
809
|
readonly effectId: string;
|
|
801
810
|
readonly attempt: number;
|
|
802
811
|
};
|
|
812
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
813
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
814
|
+
readonly payload: {
|
|
815
|
+
readonly effectId: string;
|
|
816
|
+
readonly attempt: number;
|
|
817
|
+
readonly retryAt: number;
|
|
818
|
+
readonly error: string;
|
|
819
|
+
readonly try: number;
|
|
820
|
+
};
|
|
803
821
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
804
822
|
readonly type: "runtime.effect.dispatched";
|
|
805
823
|
readonly payload: {
|
package/dist/agent/effects.js
CHANGED
|
@@ -74,6 +74,7 @@ function toolError(input, threadId, error) {
|
|
|
74
74
|
}
|
|
75
75
|
export const callLlmEffect = agentModule.effect({
|
|
76
76
|
type: 'agent.callLLM',
|
|
77
|
+
placement: 'local',
|
|
77
78
|
input: CallLlmInput,
|
|
78
79
|
execute: (input, ctx) => runCallLlm({
|
|
79
80
|
turn: input.turn,
|
|
@@ -263,6 +264,7 @@ function runCallLlm(args) {
|
|
|
263
264
|
}
|
|
264
265
|
export const executeToolEffect = agentModule.effect({
|
|
265
266
|
type: 'agent.executeTool',
|
|
267
|
+
placement: 'local',
|
|
266
268
|
input: ExecuteToolInput,
|
|
267
269
|
execute: (input, ctx) => Effect.gen(function* () {
|
|
268
270
|
const threadId = ctx.threadId;
|
package/dist/agent/module.d.ts
CHANGED
|
@@ -215,7 +215,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
215
215
|
readonly output: import("effect/Schema").Finite;
|
|
216
216
|
}>;
|
|
217
217
|
}>, {
|
|
218
|
-
callLLM: import("@swirls/looms/core").
|
|
218
|
+
callLLM: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
219
219
|
readonly turn: number;
|
|
220
220
|
readonly definitionName?: string | undefined;
|
|
221
221
|
readonly definitionVersion: string;
|
|
@@ -521,6 +521,15 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
521
521
|
readonly effectId: string;
|
|
522
522
|
readonly attempt: number;
|
|
523
523
|
};
|
|
524
|
+
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
525
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
526
|
+
readonly payload: {
|
|
527
|
+
readonly effectId: string;
|
|
528
|
+
readonly attempt: number;
|
|
529
|
+
readonly retryAt: number;
|
|
530
|
+
readonly error: string;
|
|
531
|
+
readonly try: number;
|
|
532
|
+
};
|
|
524
533
|
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
525
534
|
readonly type: "runtime.effect.dispatched";
|
|
526
535
|
readonly payload: {
|
|
@@ -714,7 +723,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
714
723
|
};
|
|
715
724
|
};
|
|
716
725
|
})>;
|
|
717
|
-
executeTool: import("@swirls/looms/core").
|
|
726
|
+
executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
718
727
|
readonly turn: number;
|
|
719
728
|
readonly definitionName?: string | undefined;
|
|
720
729
|
readonly definitionVersion: string;
|
|
@@ -1012,6 +1021,15 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
1012
1021
|
readonly effectId: string;
|
|
1013
1022
|
readonly attempt: number;
|
|
1014
1023
|
};
|
|
1024
|
+
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
1025
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
1026
|
+
readonly payload: {
|
|
1027
|
+
readonly effectId: string;
|
|
1028
|
+
readonly attempt: number;
|
|
1029
|
+
readonly retryAt: number;
|
|
1030
|
+
readonly error: string;
|
|
1031
|
+
readonly try: number;
|
|
1032
|
+
};
|
|
1015
1033
|
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
1016
1034
|
readonly type: "runtime.effect.dispatched";
|
|
1017
1035
|
readonly payload: {
|
|
@@ -1232,7 +1250,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
1232
1250
|
}>;
|
|
1233
1251
|
}, import("effect/Context").Service.Any> & {
|
|
1234
1252
|
readonly effects: {
|
|
1235
|
-
callLLM: import("@swirls/looms/core").
|
|
1253
|
+
callLLM: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
1236
1254
|
readonly turn: number;
|
|
1237
1255
|
readonly definitionName?: string | undefined;
|
|
1238
1256
|
readonly definitionVersion: string;
|
|
@@ -1538,6 +1556,15 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
1538
1556
|
readonly effectId: string;
|
|
1539
1557
|
readonly attempt: number;
|
|
1540
1558
|
};
|
|
1559
|
+
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
1560
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
1561
|
+
readonly payload: {
|
|
1562
|
+
readonly effectId: string;
|
|
1563
|
+
readonly attempt: number;
|
|
1564
|
+
readonly retryAt: number;
|
|
1565
|
+
readonly error: string;
|
|
1566
|
+
readonly try: number;
|
|
1567
|
+
};
|
|
1541
1568
|
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
1542
1569
|
readonly type: "runtime.effect.dispatched";
|
|
1543
1570
|
readonly payload: {
|
|
@@ -1731,7 +1758,7 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
1731
1758
|
};
|
|
1732
1759
|
};
|
|
1733
1760
|
})>;
|
|
1734
|
-
executeTool: import("@swirls/looms/core").
|
|
1761
|
+
executeTool: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
1735
1762
|
readonly turn: number;
|
|
1736
1763
|
readonly definitionName?: string | undefined;
|
|
1737
1764
|
readonly definitionVersion: string;
|
|
@@ -2029,6 +2056,15 @@ export declare function agent(options?: AgentModuleOptions): import("@swirls/loo
|
|
|
2029
2056
|
readonly effectId: string;
|
|
2030
2057
|
readonly attempt: number;
|
|
2031
2058
|
};
|
|
2059
|
+
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
2060
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
2061
|
+
readonly payload: {
|
|
2062
|
+
readonly effectId: string;
|
|
2063
|
+
readonly attempt: number;
|
|
2064
|
+
readonly retryAt: number;
|
|
2065
|
+
readonly error: string;
|
|
2066
|
+
readonly try: number;
|
|
2067
|
+
};
|
|
2032
2068
|
}) | (Omit<EventInput, "payload" | "type"> & {
|
|
2033
2069
|
readonly type: "runtime.effect.dispatched";
|
|
2034
2070
|
readonly payload: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core").
|
|
1
|
+
export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core").LocalEffectDefinition<{
|
|
2
2
|
readonly approvalId: string;
|
|
3
3
|
readonly title: string;
|
|
4
4
|
readonly description?: string | undefined;
|
|
@@ -79,6 +79,15 @@ export declare const requestApprovalEffect: NoInfer<import("@swirls/looms/core")
|
|
|
79
79
|
readonly effectId: string;
|
|
80
80
|
readonly attempt: number;
|
|
81
81
|
};
|
|
82
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
83
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
84
|
+
readonly payload: {
|
|
85
|
+
readonly effectId: string;
|
|
86
|
+
readonly attempt: number;
|
|
87
|
+
readonly retryAt: number;
|
|
88
|
+
readonly error: string;
|
|
89
|
+
readonly try: number;
|
|
90
|
+
};
|
|
82
91
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
83
92
|
readonly type: "runtime.effect.dispatched";
|
|
84
93
|
readonly payload: {
|
package/dist/approval/effects.js
CHANGED
|
@@ -2,6 +2,7 @@ import { ApprovalRequestedPayloadSchema } from './events.js';
|
|
|
2
2
|
import { approvalModule } from './scope.js';
|
|
3
3
|
export const requestApprovalEffect = approvalModule.effect({
|
|
4
4
|
type: 'approval.request',
|
|
5
|
+
placement: 'local',
|
|
5
6
|
input: ApprovalRequestedPayloadSchema,
|
|
6
7
|
execute: (input, ctx) => [
|
|
7
8
|
{
|
|
@@ -20,7 +20,7 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
20
20
|
readonly approvalId: import("effect/Schema").String;
|
|
21
21
|
}>;
|
|
22
22
|
}>, {
|
|
23
|
-
request: import("@swirls/looms/core").
|
|
23
|
+
request: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
24
24
|
readonly approvalId: string;
|
|
25
25
|
readonly title: string;
|
|
26
26
|
readonly description?: string | undefined;
|
|
@@ -101,6 +101,15 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
101
101
|
readonly effectId: string;
|
|
102
102
|
readonly attempt: number;
|
|
103
103
|
};
|
|
104
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
105
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
106
|
+
readonly payload: {
|
|
107
|
+
readonly effectId: string;
|
|
108
|
+
readonly attempt: number;
|
|
109
|
+
readonly retryAt: number;
|
|
110
|
+
readonly error: string;
|
|
111
|
+
readonly try: number;
|
|
112
|
+
};
|
|
104
113
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
105
114
|
readonly type: "runtime.effect.dispatched";
|
|
106
115
|
readonly payload: {
|
|
@@ -306,7 +315,7 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
306
315
|
}>;
|
|
307
316
|
}, import("effect/Context").Service.Any> & {
|
|
308
317
|
readonly effects: {
|
|
309
|
-
request: import("@swirls/looms/core").
|
|
318
|
+
request: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
310
319
|
readonly approvalId: string;
|
|
311
320
|
readonly title: string;
|
|
312
321
|
readonly description?: string | undefined;
|
|
@@ -387,6 +396,15 @@ export declare function approval(): import("@swirls/looms/core").RuntimeModule<"
|
|
|
387
396
|
readonly effectId: string;
|
|
388
397
|
readonly attempt: number;
|
|
389
398
|
};
|
|
399
|
+
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
400
|
+
readonly type: "runtime.effect.dispatch.deferred";
|
|
401
|
+
readonly payload: {
|
|
402
|
+
readonly effectId: string;
|
|
403
|
+
readonly attempt: number;
|
|
404
|
+
readonly retryAt: number;
|
|
405
|
+
readonly error: string;
|
|
406
|
+
readonly try: number;
|
|
407
|
+
};
|
|
390
408
|
}) | (Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
391
409
|
readonly type: "runtime.effect.dispatched";
|
|
392
410
|
readonly payload: {
|
package/dist/cli/commands.js
CHANGED
|
@@ -5,6 +5,8 @@ import { steer as steerEvent } from '@swirls/looms/agent';
|
|
|
5
5
|
import { decision } from '@swirls/looms/approval';
|
|
6
6
|
import { createLoomsClient } from '@swirls/looms/client';
|
|
7
7
|
import { stringifyJson, stringifyJsonPretty } from '@swirls/looms/core';
|
|
8
|
+
import { postgresReplica } from '@swirls/looms/projectors/replica';
|
|
9
|
+
import { generateReplicaMigrations } from '@swirls/looms/projectors/replica/migrations';
|
|
8
10
|
import { createLooms } from '@swirls/looms/runtime';
|
|
9
11
|
const VERSION = '0.0.1';
|
|
10
12
|
const urlFlag = Flag.string('url').pipe(Flag.withDescription('Looms host base URL (env LOOMS_URL)'), Flag.withFallbackConfig(Config.string('LOOMS_URL')), Flag.withDefault('http://127.0.0.1:8787'), Flag.map((url) => url.replace(/\/$/, '')));
|
|
@@ -116,7 +118,69 @@ const tail = Command.make('tail', {
|
|
|
116
118
|
yield* Stream.fromQueue(queue).pipe(Stream.runForEach((line) => Console.log(line)));
|
|
117
119
|
}));
|
|
118
120
|
})).pipe(Command.withDescription('Stream events for a run'), Command.withShortDescription('Tail run events'));
|
|
119
|
-
|
|
121
|
+
const databaseFlag = Flag.string('database').pipe(Flag.withDescription('Postgres connection string for the replica (env DATABASE_URL)'), Flag.withFallbackConfig(Config.string('DATABASE_URL')));
|
|
122
|
+
const generate = Command.make('generate', {
|
|
123
|
+
out: Flag.string('out').pipe(Flag.withDescription('Directory of SQL migrations to write into')),
|
|
124
|
+
journal: Flag.optional(Flag.string('journal').pipe(Flag.withDescription('Also update a migration journal. Only `drizzle` is supported'))),
|
|
125
|
+
check: Flag.boolean('check').pipe(Flag.withDescription('Exit non-zero when a migration is pending, and write nothing'), Flag.withDefault(false)),
|
|
126
|
+
}, Effect.fn('replica.generate')(function* ({ out, journal, check }) {
|
|
127
|
+
if (Option.isSome(journal) && journal.value !== 'drizzle') {
|
|
128
|
+
return yield* new CliError.UserError({
|
|
129
|
+
cause: journal.value,
|
|
130
|
+
userMessage: `Unknown journal "${journal.value}". Only "drizzle" is supported.`,
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
const generateOptions = Option.isSome(journal)
|
|
134
|
+
? { out, check, journal: 'drizzle' }
|
|
135
|
+
: { out, check };
|
|
136
|
+
const result = yield* tryClient(() => generateReplicaMigrations(generateOptions));
|
|
137
|
+
if (check && result.pending.length > 0) {
|
|
138
|
+
return yield* new CliError.UserError({
|
|
139
|
+
cause: result.pending,
|
|
140
|
+
userMessage: `Pending Looms replica migrations: ${result.pending.join(', ')}`,
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
if (result.written.length === 0) {
|
|
144
|
+
return yield* Console.log('Looms replica migrations are up to date');
|
|
145
|
+
}
|
|
146
|
+
for (const filename of result.written) {
|
|
147
|
+
yield* Console.log(filename);
|
|
148
|
+
}
|
|
149
|
+
return yield* Effect.void;
|
|
150
|
+
})).pipe(Command.withDescription('Write replica migrations the host does not already have'), Command.withShortDescription('Write replica SQL'));
|
|
151
|
+
const migrate = Command.make('migrate', { database: databaseFlag }, Effect.fn('replica.migrate')(function* ({ database }) {
|
|
152
|
+
const replica = postgresReplica({ url: database, migrate: 'auto' });
|
|
153
|
+
yield* tryClient(() => replica.migrate().then(() => replica.dispose?.()));
|
|
154
|
+
yield* Console.log('Looms replica migrations applied');
|
|
155
|
+
})).pipe(Command.withDescription('Apply pending replica migrations'), Command.withShortDescription('Apply replica SQL'));
|
|
156
|
+
const status = Command.make('status', {
|
|
157
|
+
database: databaseFlag,
|
|
158
|
+
run: Flag.optional(Flag.string('run').pipe(Flag.withDescription('Also print freshness for this run id'))),
|
|
159
|
+
}, Effect.fn('replica.status')(function* ({ database, run }) {
|
|
160
|
+
const replica = postgresReplica({ url: database, migrate: 'verify' });
|
|
161
|
+
const pending = yield* tryClient(() => replica.pendingMigrations());
|
|
162
|
+
yield* Console.log(pending.length === 0
|
|
163
|
+
? 'Looms replica schema is up to date'
|
|
164
|
+
: `Pending Looms replica migrations: ${pending.join(', ')}`);
|
|
165
|
+
if (Option.isSome(run)) {
|
|
166
|
+
const row = yield* tryClient(() => replica.status(run.value));
|
|
167
|
+
yield* Console.log(row ? stringifyJson(row) : `No replica row for ${run.value}`);
|
|
168
|
+
}
|
|
169
|
+
yield* tryClient(() => replica.dispose?.() ?? Promise.resolve());
|
|
170
|
+
})).pipe(Command.withDescription('Show which replica migrations are applied'), Command.withShortDescription('Replica schema status'));
|
|
171
|
+
const replica = Command.make('replica').pipe(Command.withDescription('Copy runs into a Postgres database you own'), Command.withShortDescription('Postgres replica'), Command.withSubcommands([generate, migrate, status]));
|
|
172
|
+
export const looms = loomsBase.pipe(Command.withSubcommands([
|
|
173
|
+
serve,
|
|
174
|
+
start,
|
|
175
|
+
events,
|
|
176
|
+
state,
|
|
177
|
+
approve,
|
|
178
|
+
replay,
|
|
179
|
+
signal,
|
|
180
|
+
steer,
|
|
181
|
+
tail,
|
|
182
|
+
replica,
|
|
183
|
+
]));
|
|
120
184
|
export const cliTestLayer = Layer.mergeAll(FileSystem.layerNoop({}), Path.layer, Stdio.layerTest({}), Layer.succeed(Terminal.Terminal, Terminal.make({
|
|
121
185
|
columns: Effect.succeed(80),
|
|
122
186
|
rows: Effect.succeed(24),
|
package/dist/client/client.d.ts
CHANGED
|
@@ -179,13 +179,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
179
179
|
readonly [x: string]: {
|
|
180
180
|
readonly effectId: string;
|
|
181
181
|
readonly attempt: number;
|
|
182
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
182
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
183
183
|
readonly nextAttemptAt: number | null;
|
|
184
184
|
readonly deadlineAt: number | null;
|
|
185
185
|
readonly startedAt: number | null;
|
|
186
186
|
readonly lastHeartbeatAt: number | null;
|
|
187
187
|
readonly heartbeatDetails: Schema.Json;
|
|
188
188
|
readonly lastError: string | null;
|
|
189
|
+
readonly dispatchTry: number;
|
|
189
190
|
};
|
|
190
191
|
};
|
|
191
192
|
readonly completedEffectIds: readonly string[];
|
|
@@ -348,13 +349,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
348
349
|
readonly [x: string]: {
|
|
349
350
|
readonly effectId: string;
|
|
350
351
|
readonly attempt: number;
|
|
351
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
352
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
352
353
|
readonly nextAttemptAt: number | null;
|
|
353
354
|
readonly deadlineAt: number | null;
|
|
354
355
|
readonly startedAt: number | null;
|
|
355
356
|
readonly lastHeartbeatAt: number | null;
|
|
356
357
|
readonly heartbeatDetails: Schema.Json;
|
|
357
358
|
readonly lastError: string | null;
|
|
359
|
+
readonly dispatchTry: number;
|
|
358
360
|
};
|
|
359
361
|
};
|
|
360
362
|
readonly completedEffectIds: readonly string[];
|
|
@@ -515,13 +517,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
515
517
|
readonly [x: string]: {
|
|
516
518
|
readonly effectId: string;
|
|
517
519
|
readonly attempt: number;
|
|
518
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
520
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
519
521
|
readonly nextAttemptAt: number | null;
|
|
520
522
|
readonly deadlineAt: number | null;
|
|
521
523
|
readonly startedAt: number | null;
|
|
522
524
|
readonly lastHeartbeatAt: number | null;
|
|
523
525
|
readonly heartbeatDetails: Schema.Json;
|
|
524
526
|
readonly lastError: string | null;
|
|
527
|
+
readonly dispatchTry: number;
|
|
525
528
|
};
|
|
526
529
|
};
|
|
527
530
|
readonly completedEffectIds: readonly string[];
|
|
@@ -682,13 +685,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
682
685
|
readonly [x: string]: {
|
|
683
686
|
readonly effectId: string;
|
|
684
687
|
readonly attempt: number;
|
|
685
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
688
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
686
689
|
readonly nextAttemptAt: number | null;
|
|
687
690
|
readonly deadlineAt: number | null;
|
|
688
691
|
readonly startedAt: number | null;
|
|
689
692
|
readonly lastHeartbeatAt: number | null;
|
|
690
693
|
readonly heartbeatDetails: Schema.Json;
|
|
691
694
|
readonly lastError: string | null;
|
|
695
|
+
readonly dispatchTry: number;
|
|
692
696
|
};
|
|
693
697
|
};
|
|
694
698
|
readonly completedEffectIds: readonly string[];
|
|
@@ -882,13 +886,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
882
886
|
readonly [x: string]: {
|
|
883
887
|
readonly effectId: string;
|
|
884
888
|
readonly attempt: number;
|
|
885
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
889
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
886
890
|
readonly nextAttemptAt: number | null;
|
|
887
891
|
readonly deadlineAt: number | null;
|
|
888
892
|
readonly startedAt: number | null;
|
|
889
893
|
readonly lastHeartbeatAt: number | null;
|
|
890
894
|
readonly heartbeatDetails: Schema.Json;
|
|
891
895
|
readonly lastError: string | null;
|
|
896
|
+
readonly dispatchTry: number;
|
|
892
897
|
};
|
|
893
898
|
};
|
|
894
899
|
readonly completedEffectIds: readonly string[];
|
|
@@ -1049,13 +1054,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
1049
1054
|
readonly [x: string]: {
|
|
1050
1055
|
readonly effectId: string;
|
|
1051
1056
|
readonly attempt: number;
|
|
1052
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1057
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1053
1058
|
readonly nextAttemptAt: number | null;
|
|
1054
1059
|
readonly deadlineAt: number | null;
|
|
1055
1060
|
readonly startedAt: number | null;
|
|
1056
1061
|
readonly lastHeartbeatAt: number | null;
|
|
1057
1062
|
readonly heartbeatDetails: Schema.Json;
|
|
1058
1063
|
readonly lastError: string | null;
|
|
1064
|
+
readonly dispatchTry: number;
|
|
1059
1065
|
};
|
|
1060
1066
|
};
|
|
1061
1067
|
readonly completedEffectIds: readonly string[];
|
|
@@ -1218,13 +1224,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
1218
1224
|
readonly [x: string]: {
|
|
1219
1225
|
readonly effectId: string;
|
|
1220
1226
|
readonly attempt: number;
|
|
1221
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1227
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1222
1228
|
readonly nextAttemptAt: number | null;
|
|
1223
1229
|
readonly deadlineAt: number | null;
|
|
1224
1230
|
readonly startedAt: number | null;
|
|
1225
1231
|
readonly lastHeartbeatAt: number | null;
|
|
1226
1232
|
readonly heartbeatDetails: Schema.Json;
|
|
1227
1233
|
readonly lastError: string | null;
|
|
1234
|
+
readonly dispatchTry: number;
|
|
1228
1235
|
};
|
|
1229
1236
|
};
|
|
1230
1237
|
readonly completedEffectIds: readonly string[];
|
|
@@ -1389,13 +1396,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
1389
1396
|
readonly [x: string]: {
|
|
1390
1397
|
readonly effectId: string;
|
|
1391
1398
|
readonly attempt: number;
|
|
1392
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1399
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1393
1400
|
readonly nextAttemptAt: number | null;
|
|
1394
1401
|
readonly deadlineAt: number | null;
|
|
1395
1402
|
readonly startedAt: number | null;
|
|
1396
1403
|
readonly lastHeartbeatAt: number | null;
|
|
1397
1404
|
readonly heartbeatDetails: Schema.Json;
|
|
1398
1405
|
readonly lastError: string | null;
|
|
1406
|
+
readonly dispatchTry: number;
|
|
1399
1407
|
};
|
|
1400
1408
|
};
|
|
1401
1409
|
readonly completedEffectIds: readonly string[];
|
|
@@ -1431,6 +1439,24 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
1431
1439
|
}[];
|
|
1432
1440
|
readonly projections: readonly string[];
|
|
1433
1441
|
}>;
|
|
1442
|
+
listEffects: () => Promise<{
|
|
1443
|
+
readonly effects: readonly {
|
|
1444
|
+
readonly type: string;
|
|
1445
|
+
readonly placement: "local" | "worker";
|
|
1446
|
+
readonly deterministic?: boolean | undefined;
|
|
1447
|
+
readonly retry?: {
|
|
1448
|
+
readonly maxAttempts: number;
|
|
1449
|
+
readonly backoffMs?: number | undefined;
|
|
1450
|
+
readonly maxBackoffMs?: number | undefined;
|
|
1451
|
+
readonly backoffMultiplier?: number | undefined;
|
|
1452
|
+
readonly scheduleToStartTimeoutMs?: number | undefined;
|
|
1453
|
+
readonly startToCloseTimeoutMs?: number | undefined;
|
|
1454
|
+
readonly heartbeatTimeoutMs?: number | undefined;
|
|
1455
|
+
readonly cancellationTimeoutMs?: number | undefined;
|
|
1456
|
+
} | undefined;
|
|
1457
|
+
readonly inputSchema?: Schema.Json | undefined;
|
|
1458
|
+
}[];
|
|
1459
|
+
}>;
|
|
1434
1460
|
replayTo: (runId: string, seq: number) => Promise<{
|
|
1435
1461
|
readonly runId: string;
|
|
1436
1462
|
readonly step: {
|
|
@@ -1608,13 +1634,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
1608
1634
|
readonly [x: string]: {
|
|
1609
1635
|
readonly effectId: string;
|
|
1610
1636
|
readonly attempt: number;
|
|
1611
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1637
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1612
1638
|
readonly nextAttemptAt: number | null;
|
|
1613
1639
|
readonly deadlineAt: number | null;
|
|
1614
1640
|
readonly startedAt: number | null;
|
|
1615
1641
|
readonly lastHeartbeatAt: number | null;
|
|
1616
1642
|
readonly heartbeatDetails: Schema.Json;
|
|
1617
1643
|
readonly lastError: string | null;
|
|
1644
|
+
readonly dispatchTry: number;
|
|
1618
1645
|
};
|
|
1619
1646
|
};
|
|
1620
1647
|
readonly completedEffectIds: readonly string[];
|
|
@@ -1772,13 +1799,14 @@ export declare function createLoomsClient(options?: LoomsClientOptions): {
|
|
|
1772
1799
|
readonly [x: string]: {
|
|
1773
1800
|
readonly effectId: string;
|
|
1774
1801
|
readonly attempt: number;
|
|
1775
|
-
readonly status: "ambiguous" | "cancel_requested" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1802
|
+
readonly status: "ambiguous" | "cancel_requested" | "dispatch_wait" | "dispatched" | "heartbeat" | "queued" | "retry_wait" | "running" | "started" | "timed_out";
|
|
1776
1803
|
readonly nextAttemptAt: number | null;
|
|
1777
1804
|
readonly deadlineAt: number | null;
|
|
1778
1805
|
readonly startedAt: number | null;
|
|
1779
1806
|
readonly lastHeartbeatAt: number | null;
|
|
1780
1807
|
readonly heartbeatDetails: Schema.Json;
|
|
1781
1808
|
readonly lastError: string | null;
|
|
1809
|
+
readonly dispatchTry: number;
|
|
1782
1810
|
};
|
|
1783
1811
|
};
|
|
1784
1812
|
readonly completedEffectIds: readonly string[];
|
package/dist/client/client.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Data, Effect, Option, Predicate, Schema, Stream } from 'effect';
|
|
2
|
-
import { createRunId, DefinitionCatalogSchema, EventEnvelopeSchema, readSubscriptionData, ReplayStepSchema, RunStateSchema, RunSummariesSchema, SecretContextSchema, stringifyJson, traceHeaders, } from '@swirls/looms/core';
|
|
2
|
+
import { createRunId, DefinitionCatalogSchema, EffectCatalogSchema, EventEnvelopeSchema, readSubscriptionData, ReplayStepSchema, RunStateSchema, RunSummariesSchema, SecretContextSchema, stringifyJson, traceHeaders, } from '@swirls/looms/core';
|
|
3
3
|
import { consumeSseStreamEffect, eventsFromSseData, sseFrames } from './sse.js';
|
|
4
4
|
class LoomsClientError extends Data.TaggedError('LoomsClientError') {
|
|
5
5
|
constructor(message, cause) {
|
|
@@ -254,6 +254,7 @@ export function createLoomsClient(options = {}) {
|
|
|
254
254
|
workerSecrets,
|
|
255
255
|
listRunSummaries: () => request('/runs/summaries', RunSummariesSchema),
|
|
256
256
|
listDefinitions: () => request('/definitions', DefinitionCatalogSchema),
|
|
257
|
+
listEffects: () => request('/definitions/effects', EffectCatalogSchema),
|
|
257
258
|
replayTo: (runId, seq) => request(`/runs/${encodeURIComponent(runId)}/replay?seq=${seq}`, ReplayResultSchema),
|
|
258
259
|
project: (runId, name) => request(`/runs/${encodeURIComponent(runId)}/projections/${encodeURIComponent(name)}`, ProjectionResultSchema),
|
|
259
260
|
subscribeEvents,
|
|
@@ -24,7 +24,7 @@ export interface LoomsDurableObjectConfig {
|
|
|
24
24
|
*/
|
|
25
25
|
readonly launcher?: RunLauncher;
|
|
26
26
|
/**
|
|
27
|
-
* Dispatches
|
|
27
|
+
* Dispatches worker-placed effects out of this object (typically a
|
|
28
28
|
* Cloudflare Queue producer via `cloudflareQueueWorker`). Without it, worker
|
|
29
29
|
* effects cannot leave the Durable Object.
|
|
30
30
|
*/
|
|
@@ -4,7 +4,7 @@ export { durableObjectLauncher, durableObjectScheduleHost, LoomsDurableObject, t
|
|
|
4
4
|
export { r2BlobStore, type R2BucketLike, type R2ListResult, type R2ObjectBodyLike, type R2StoredObject, } from './r2-blob-store';
|
|
5
5
|
export { routeToDurableObject, type DurableObjectNamespaceLike, type DurableObjectStubLike, } from './router';
|
|
6
6
|
export { createMemoryQueue, type MemoryQueue, type MemoryQueueOptions } from './memory-queue';
|
|
7
|
-
export { processQueueMessage, queueConsumer, QueueTaskError, type QueueBatchLike, type QueueConsumerOptions, type QueueTask, type
|
|
7
|
+
export { processQueueMessage, queueConsumer, QueueTaskError, workerHandlers, type QueueBatchLike, type QueueConsumerOptions, type QueueTask, type QueueTaskHandler, type WorkerCallbackClient, } from './queue-consumer';
|
|
8
8
|
export { readQueueEffectMessage, type QueueEffectMessage, type QueueMessageLike, } from './queue-message';
|
|
9
9
|
export { cloudflareQueuePullSource, createQueuePullConsumer, QueuePullError, type CloudflareQueuePullSourceOptions, type PulledQueueMessage, type QueueLeaseRetry, type QueuePullConsumer, type QueuePullConsumerOptions, type QueuePullResult, type QueuePullSource, } from './queue-pull';
|
|
10
10
|
export { cloudflareQueueWorker, DEFAULT_MAX_QUEUE_MESSAGE_BYTES, QueueDispatchError, type CloudflareQueueWorkerOptions, type QueueProducer, type QueueRoute, } from './queue-worker';
|