@swirls/looms 0.9.0 → 0.11.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 +32 -0
- package/dist/actor/cell.d.ts +3 -1
- package/dist/actor/cell.js +1 -0
- package/dist/actor/host.d.ts +3 -1
- package/dist/actor/host.js +1 -0
- package/dist/actor/routing.js +2 -1
- package/dist/agent/debugger/agent-chat.js +6 -5
- package/dist/agent/debugger/index.js +2 -1
- package/dist/agent/module.d.ts +207 -1
- package/dist/agent/module.js +31 -0
- package/dist/agent/scope.js +1 -0
- package/dist/agent/signals.d.ts +108 -15
- package/dist/agent/signals.js +70 -47
- package/dist/approval/debugger/approvals-view.js +1 -1
- package/dist/approval/index.d.ts +1 -0
- package/dist/approval/index.js +1 -0
- package/dist/approval/module.d.ts +42 -1
- package/dist/approval/module.js +53 -0
- package/dist/approval/scope.js +1 -0
- package/dist/approval/signals.d.ts +19 -13
- package/dist/approval/signals.js +25 -45
- package/dist/approval/steps.d.ts +11 -0
- package/dist/approval/steps.js +39 -0
- package/dist/cli/commands.d.ts +1 -1
- package/dist/cli/commands.js +49 -14
- package/dist/client/client.d.ts +231 -21
- package/dist/client/client.js +20 -2
- package/dist/cloudflare/delete-terminal-run-storage.d.ts +39 -0
- package/dist/cloudflare/delete-terminal-run-storage.js +98 -0
- package/dist/cloudflare/durable-object.d.ts +11 -1
- package/dist/cloudflare/durable-object.js +23 -0
- package/dist/cloudflare/index.d.ts +1 -0
- package/dist/cloudflare/index.js +1 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/module-scope.d.ts +50 -5
- package/dist/core/module-scope.js +22 -2
- package/dist/core/module.d.ts +29 -2
- package/dist/core/projection.d.ts +1 -0
- package/dist/core/published.d.ts +59 -1
- package/dist/core/published.js +97 -1
- package/dist/core/run-context.d.ts +50 -0
- package/dist/core/run-context.js +21 -1
- package/dist/core/signals.d.ts +56 -0
- package/dist/core/signals.js +93 -0
- package/dist/core/validate-event.d.ts +12 -1
- package/dist/core/validate-event.js +34 -11
- package/dist/debugger/app/assets/index-CO5gIvV8.css +2 -0
- package/dist/debugger/app/assets/{index-CMRl_aWQ.js → index-VTotlHcm.js} +2 -2
- package/dist/debugger/app/assets/routes-CEdsN9DO.js +47 -0
- package/dist/debugger/app/index.html +2 -2
- package/dist/debugger/index.d.ts +1 -1
- package/dist/debugger/index.js +1 -1
- package/dist/debugger/lib/cn.d.ts +1 -1
- package/dist/debugger/lib/cn.js +12 -1
- package/dist/debugger/plugin.d.ts +11 -1
- package/dist/debugger/plugin.js +41 -0
- package/dist/debugger/shell/debugger-shell.js +1 -1
- package/dist/debugger/shell/form-fields.d.ts +17 -0
- package/dist/debugger/shell/form-fields.js +38 -0
- package/dist/debugger/shell/run-action.d.ts +6 -0
- package/dist/debugger/shell/run-action.js +15 -0
- package/dist/debugger/shell/run-controls.js +3 -55
- package/dist/debugger/shell/schema-form.d.ts +10 -1
- package/dist/debugger/shell/schema-form.js +108 -10
- package/dist/debugger/shell/signal-form.d.ts +18 -0
- package/dist/debugger/shell/signal-form.js +185 -0
- package/dist/debugger/shell/start-form.js +2 -32
- package/dist/debugger/shell/use-debounced-preview.d.ts +22 -0
- package/dist/debugger/shell/use-debounced-preview.js +68 -0
- package/dist/evaluator/index.d.ts +1 -1
- package/dist/evaluator/index.js +1 -1
- package/dist/evaluator/module.d.ts +8 -1
- package/dist/evaluator/module.js +33 -0
- package/dist/evaluator/scope.js +1 -0
- package/dist/projectors/event-log-ops.d.ts +0 -6
- package/dist/projectors/event-log-ops.js +2 -12
- package/dist/projectors/event-log.d.ts +10 -5
- package/dist/projectors/event-log.js +26 -22
- package/dist/projectors/replica/columns.d.ts +41 -0
- package/dist/projectors/replica/columns.js +77 -0
- package/dist/projectors/replica/drizzle.d.ts +328 -57
- package/dist/projectors/replica/drizzle.js +18 -14
- package/dist/projectors/replica/migrations.d.ts +25 -5
- package/dist/projectors/replica/migrations.js +62 -14
- package/dist/projectors/replica/postgres.d.ts +12 -11
- package/dist/projectors/replica/postgres.js +12 -26
- package/dist/projectors/replica/sqlite-bun.d.ts +3 -1
- package/dist/projectors/replica/sqlite-bun.js +6 -2
- package/dist/projectors/replica/sqlite-migrations.d.ts +5 -5
- package/dist/projectors/replica/sqlite-migrations.js +22 -9
- package/dist/projectors/replica/sqlite.d.ts +12 -11
- package/dist/projectors/replica/sqlite.js +23 -16
- package/dist/runtime/looms.d.ts +27 -36
- package/dist/runtime/looms.js +1 -0
- package/dist/runtime/runtime.js +7 -1
- package/dist/runtime/server/http.js +4 -2
- package/dist/runtime/server/routes/definitions.d.ts +1 -1
- package/dist/runtime/server/routes/definitions.js +58 -2
- package/dist/runtime/server/routes/runs.js +25 -1
- package/dist/runtime/types.d.ts +6 -1
- package/dist/schedule/module.d.ts +117 -1
- package/dist/schedule/module.js +30 -0
- package/dist/schedule/scope.js +1 -0
- package/dist/schedule/signals.d.ts +59 -7
- package/dist/schedule/signals.js +35 -17
- package/dist/testing/corpus-module.d.ts +1 -1
- package/dist/testing/index.js +2 -1
- package/dist/testing/module-examples.d.ts +6 -0
- package/dist/testing/module-examples.js +66 -0
- package/dist/workflow/module.d.ts +3 -1
- package/dist/workflow/module.js +13 -0
- package/dist/workflow/scope.js +1 -0
- package/package.json +1 -1
- package/dist/debugger/app/assets/index-B7GdT1UA.css +0 -2
- package/dist/debugger/app/assets/routes-CfXxKG45.js +0 -47
- /package/dist/evaluator/{signals.d.ts → steps.d.ts} +0 -0
- /package/dist/evaluator/{signals.js → steps.js} +0 -0
package/dist/runtime/looms.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
import { type AnyRuntimeModule, type DebuggerHost, type DefinitionInput, type DefinitionRef, type DefinitionResolver, type EventEnvelope, type EventInput, type BlobStore, type EventStore, type EventStoreTrimCoverage, type JsonValue, type SnapshotStore, type ProjectionDefinition, type ReplayStep, type RunLauncher, type RunState } from '@swirls/looms/core';
|
|
1
|
+
import { type AnyRuntimeModule, type DebuggerHost, type DefinitionInput, type DefinitionRef, type DefinitionResolver, type EventEnvelope, type EventInput, type BlobStore, type EventStore, type EventStoreTrimCoverage, type JsonValue, type SnapshotStore, type ProjectionDefinition, type HasRequiredAttributes, type ReplayStep, type RunAttributeFields, type RunAttributesOption, type RunLauncher, type RunState } from '@swirls/looms/core';
|
|
2
2
|
import type { RuntimeObserver } from './observer';
|
|
3
3
|
import { type EffectWorker, type LoomsRuntime, type RunOperationalStatus, type StartRunArgs, type WakeScheduler, type WorkerCallbackInput, type WorkerCallbackResult } from './runtime';
|
|
4
4
|
import { type Authorize, type RunningServer } from './server';
|
|
5
|
-
export interface CreateLoomsOptions {
|
|
5
|
+
export interface CreateLoomsOptions<Fields extends RunAttributeFields = RunAttributeFields> {
|
|
6
6
|
/** Runtime modules to enable. Pass `agent()`, `workflow()`, `approval()`, and/or your own. */
|
|
7
7
|
readonly modules?: readonly AnyRuntimeModule[];
|
|
8
|
+
/**
|
|
9
|
+
* Declared run attributes, from `defineRunAttributes`. They type `attributes` on every start.
|
|
10
|
+
* A start that misses a `required` attribute or sends an undeclared one is rejected.
|
|
11
|
+
*/
|
|
12
|
+
readonly attributes?: Fields;
|
|
8
13
|
/**
|
|
9
14
|
* Loads a definition that was not registered on a module. Registered definitions are checked
|
|
10
15
|
* first. A run pins the resolved version on its start event.
|
|
@@ -64,7 +69,22 @@ export interface StartResult {
|
|
|
64
69
|
readonly threadId: string;
|
|
65
70
|
readonly state: RunState;
|
|
66
71
|
}
|
|
67
|
-
export
|
|
72
|
+
export type LoomsStartOptions<Fields extends RunAttributeFields = RunAttributeFields> = {
|
|
73
|
+
runId?: string;
|
|
74
|
+
threadId?: string;
|
|
75
|
+
idempotencyKey?: string;
|
|
76
|
+
secrets?: StartRunArgs['secrets'];
|
|
77
|
+
trace?: StartRunArgs['trace'];
|
|
78
|
+
} & RunAttributesOption<Fields>;
|
|
79
|
+
export type LoomsStartRunArgs<Fields extends RunAttributeFields = RunAttributeFields> = {
|
|
80
|
+
kind: string;
|
|
81
|
+
definitionName: string;
|
|
82
|
+
definitionVersion?: string;
|
|
83
|
+
input?: JsonValue;
|
|
84
|
+
} & LoomsStartOptions<Fields>;
|
|
85
|
+
/** `start`'s arguments after the definition. Options are required when an attribute is. */
|
|
86
|
+
export type LoomsStartArgs<TDef extends DefinitionRef, Fields extends RunAttributeFields = RunAttributeFields> = HasRequiredAttributes<Fields> extends true ? [input: DefinitionInput<TDef> | undefined, options: LoomsStartOptions<Fields>] : [input?: DefinitionInput<TDef>, options?: LoomsStartOptions<Fields>];
|
|
87
|
+
export interface Looms<Fields extends RunAttributeFields = RunAttributeFields> {
|
|
68
88
|
readonly runtime: Promise<LoomsRuntime>;
|
|
69
89
|
readonly store: Promise<EventStore>;
|
|
70
90
|
ready(): Promise<{
|
|
@@ -72,40 +92,11 @@ export interface Looms {
|
|
|
72
92
|
runtime: LoomsRuntime;
|
|
73
93
|
}>;
|
|
74
94
|
/** Start a run from a definition object; the input type follows the definition's schema. */
|
|
75
|
-
start<TDef extends DefinitionRef>(definition: TDef,
|
|
76
|
-
runId?: string;
|
|
77
|
-
threadId?: string;
|
|
78
|
-
idempotencyKey?: string;
|
|
79
|
-
attributes?: StartRunArgs['attributes'];
|
|
80
|
-
secrets?: StartRunArgs['secrets'];
|
|
81
|
-
trace?: StartRunArgs['trace'];
|
|
82
|
-
}): Promise<StartResult>;
|
|
95
|
+
start<TDef extends DefinitionRef>(definition: TDef, ...args: LoomsStartArgs<TDef, Fields>): Promise<StartResult>;
|
|
83
96
|
/** Start a run by `{ kind, definitionName }` when you only have names (HTTP bodies, CLIs). */
|
|
84
|
-
startRun(args:
|
|
85
|
-
kind: string;
|
|
86
|
-
definitionName: string;
|
|
87
|
-
definitionVersion?: string;
|
|
88
|
-
input?: JsonValue;
|
|
89
|
-
runId?: string;
|
|
90
|
-
threadId?: string;
|
|
91
|
-
idempotencyKey?: string;
|
|
92
|
-
attributes?: StartRunArgs['attributes'];
|
|
93
|
-
secrets?: StartRunArgs['secrets'];
|
|
94
|
-
trace?: StartRunArgs['trace'];
|
|
95
|
-
}): Promise<StartResult>;
|
|
97
|
+
startRun(args: LoomsStartRunArgs<Fields>): Promise<StartResult>;
|
|
96
98
|
/** Commit a run's start and schedule a wake without waiting for it. */
|
|
97
|
-
launchRun(args:
|
|
98
|
-
kind: string;
|
|
99
|
-
definitionName: string;
|
|
100
|
-
definitionVersion?: string;
|
|
101
|
-
input?: JsonValue;
|
|
102
|
-
runId?: string;
|
|
103
|
-
threadId?: string;
|
|
104
|
-
idempotencyKey?: string;
|
|
105
|
-
attributes?: StartRunArgs['attributes'];
|
|
106
|
-
secrets?: StartRunArgs['secrets'];
|
|
107
|
-
trace?: StartRunArgs['trace'];
|
|
108
|
-
}): Promise<StartResult>;
|
|
99
|
+
launchRun(args: LoomsStartRunArgs<Fields>): Promise<StartResult>;
|
|
109
100
|
getRun(runId: string): Promise<RunState>;
|
|
110
101
|
getEvents(runId: string, options?: {
|
|
111
102
|
fromSeq?: number;
|
|
@@ -135,4 +126,4 @@ export interface Looms {
|
|
|
135
126
|
}): RunningServer;
|
|
136
127
|
stop(): Promise<void>;
|
|
137
128
|
}
|
|
138
|
-
export declare function createLooms(options?: CreateLoomsOptions): Looms
|
|
129
|
+
export declare function createLooms<const Fields extends RunAttributeFields = RunAttributeFields>(options?: CreateLoomsOptions<Fields>): Looms<Fields>;
|
package/dist/runtime/looms.js
CHANGED
|
@@ -55,6 +55,7 @@ export function createLooms(options = {}) {
|
|
|
55
55
|
maxInFlightWorkerEffects: options.maxInFlightWorkerEffects,
|
|
56
56
|
observer: options.observer,
|
|
57
57
|
definitionResolver: options.definitionResolver,
|
|
58
|
+
attributes: options.attributes,
|
|
58
59
|
});
|
|
59
60
|
if (options.rescanTimers !== false) {
|
|
60
61
|
yield* runtime.rescanTimers.pipe(Effect.provideService(EventStoreTag, store), Effect.tapError(Effect.logError), Effect.ignore);
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Clock, Effect, ManagedRuntime, Predicate } from 'effect';
|
|
2
|
-
import { cachedDefinitionResolver, chainDefinitionResolvers, composeModules, createEvent, createThreadId, createRunId, DEFAULT_DEFINITION_VERSION, DEFAULT_SNAPSHOT_EVERY, staticDefinitionResolver, descendantThreadIds, EventStoreTag, foldRun, hasEntries, isRunTerminal, unavailableRunLauncher, planFork, project, readTraceContext, replayTo, sameStringRecord, summarizeRun, } from '@swirls/looms/core';
|
|
2
|
+
import { cachedDefinitionResolver, chainDefinitionResolvers, composeModules, createEvent, createThreadId, createRunId, DEFAULT_DEFINITION_VERSION, DEFAULT_SNAPSHOT_EVERY, staticDefinitionResolver, descendantThreadIds, EventStoreTag, foldRun, hasEntries, InvalidRunAttributesError, isRunTerminal, runAttributeIssues, unavailableRunLauncher, planFork, project, readTraceContext, replayTo, sameStringRecord, summarizeRun, } from '@swirls/looms/core';
|
|
3
3
|
import { createCancellation } from './cancellation.js';
|
|
4
4
|
import { nextRuntimeDeadline } from './deadline-transition-planner.js';
|
|
5
5
|
import { ForkConflictError, RunNotFinishedError, RunNotFoundError, RunTerminalError, RuntimeExecutionError, SecretContextConflictError, StartRunConflictError, } from './errors.js';
|
|
@@ -158,6 +158,12 @@ export function createRuntime(options) {
|
|
|
158
158
|
return committed.value;
|
|
159
159
|
});
|
|
160
160
|
const commitStart = (args, runId) => Effect.gen(function* () {
|
|
161
|
+
if (options.attributes) {
|
|
162
|
+
const issues = runAttributeIssues(options.attributes, args.attributes ?? {});
|
|
163
|
+
if (issues.length > 0) {
|
|
164
|
+
return yield* new InvalidRunAttributesError(issues);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
161
167
|
const definitionVersion = args.definitionVersion ?? DEFAULT_DEFINITION_VERSION;
|
|
162
168
|
const resolved = yield* definitionResolver.resolve(args.kind, args.definitionName, definitionVersion);
|
|
163
169
|
if (!resolved) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Data, Effect, Schema } from 'effect';
|
|
2
|
-
import { EventStoreTag, ForkSourceError, InvalidEventError, InvalidInputError, JsonValueSchema, } from '@swirls/looms/core';
|
|
2
|
+
import { EventStoreTag, ForkSourceError, InvalidEventError, InvalidInputError, InvalidRunAttributesError, JsonValueSchema, } from '@swirls/looms/core';
|
|
3
3
|
import { ForkConflictError, RunNotFinishedError, RunNotFoundError, RunOverloadedError, RunTerminalError, StartRunConflictError, } from '../runtime.js';
|
|
4
4
|
export class RequestBodyError extends Data.TaggedError('RequestBodyError') {
|
|
5
5
|
constructor(cause) {
|
|
@@ -57,7 +57,9 @@ export function toErrorResponse(err) {
|
|
|
57
57
|
if (err instanceof RequestBodyError || err instanceof RequestQueryError) {
|
|
58
58
|
return Response.json({ error: err.message }, { status: 400 });
|
|
59
59
|
}
|
|
60
|
-
if (err instanceof InvalidInputError ||
|
|
60
|
+
if (err instanceof InvalidInputError ||
|
|
61
|
+
err instanceof InvalidEventError ||
|
|
62
|
+
err instanceof InvalidRunAttributesError) {
|
|
61
63
|
return Response.json({ error: err.message, issues: err.issues }, { status: 400 });
|
|
62
64
|
}
|
|
63
65
|
if (err instanceof RunOverloadedError) {
|
|
@@ -1,6 +1,14 @@
|
|
|
1
|
-
import { Effect } from 'effect';
|
|
2
|
-
import { publishDefinition, publishEffects } from '@swirls/looms/core';
|
|
1
|
+
import { Effect, Schema } from 'effect';
|
|
2
|
+
import { findSignal, JsonValueSchema, publishDefinition, publishEffects, publishEvents, publishModules, publishSignals, runSignal, validateEventInput, } from '@swirls/looms/core';
|
|
3
|
+
import { EventInputBodySchema, readJson } from '../http.js';
|
|
3
4
|
import { route } from '../route-table.js';
|
|
5
|
+
const PreviewSignalBodySchema = Schema.Struct({
|
|
6
|
+
input: Schema.optional(JsonValueSchema),
|
|
7
|
+
threadId: Schema.optional(Schema.String),
|
|
8
|
+
});
|
|
9
|
+
const PreviewEventsBodySchema = Schema.Struct({
|
|
10
|
+
events: Schema.Array(EventInputBodySchema),
|
|
11
|
+
});
|
|
4
12
|
export function definitionRoutes({ runtime }) {
|
|
5
13
|
return [
|
|
6
14
|
route({
|
|
@@ -12,6 +20,7 @@ export function definitionRoutes({ runtime }) {
|
|
|
12
20
|
const catalog = {
|
|
13
21
|
definitions: runtime.registry.definitions.map(publishDefinition),
|
|
14
22
|
projections: [...runtime.registry.projections.keys()],
|
|
23
|
+
modules: publishModules(runtime.registry.modules),
|
|
15
24
|
};
|
|
16
25
|
return Effect.succeed(Response.json(catalog));
|
|
17
26
|
},
|
|
@@ -23,5 +32,52 @@ export function definitionRoutes({ runtime }) {
|
|
|
23
32
|
access: 'read',
|
|
24
33
|
handle: () => Effect.succeed(Response.json({ effects: publishEffects(runtime.registry.effects.values()) })),
|
|
25
34
|
}),
|
|
35
|
+
route({
|
|
36
|
+
method: 'GET',
|
|
37
|
+
path: '/definitions/signals',
|
|
38
|
+
name: 'definitions.signals',
|
|
39
|
+
access: 'read',
|
|
40
|
+
handle: () => Effect.succeed(Response.json({ signals: publishSignals(runtime.registry.modules) })),
|
|
41
|
+
}),
|
|
42
|
+
route({
|
|
43
|
+
method: 'GET',
|
|
44
|
+
path: '/definitions/events',
|
|
45
|
+
name: 'definitions.events',
|
|
46
|
+
access: 'read',
|
|
47
|
+
handle: () => Effect.succeed(Response.json({ events: publishEvents(runtime.registry.modules) })),
|
|
48
|
+
}),
|
|
49
|
+
route({
|
|
50
|
+
method: 'POST',
|
|
51
|
+
path: '/definitions/signals/:namespace/:name/preview',
|
|
52
|
+
name: 'definitions.signals.preview',
|
|
53
|
+
access: 'read',
|
|
54
|
+
handle: ({ req, params }) =>
|
|
55
|
+
// SAFETY: Effect.gen residual R is never here; Schema.decode errors become RequestBodyError via toErrorResponse.
|
|
56
|
+
Effect.gen(function* () {
|
|
57
|
+
const definition = findSignal(runtime.registry.modules, params.namespace, params.name);
|
|
58
|
+
if (!definition) {
|
|
59
|
+
return Response.json({ error: `Unknown signal ${params.namespace}.${params.name}` }, { status: 404 });
|
|
60
|
+
}
|
|
61
|
+
const body = yield* readJson(req).pipe(Effect.flatMap(Schema.decodeUnknownEffect(PreviewSignalBodySchema)));
|
|
62
|
+
const events = yield* runSignal(definition, body.input ?? null, body.threadId);
|
|
63
|
+
return Response.json({ events });
|
|
64
|
+
}),
|
|
65
|
+
}),
|
|
66
|
+
route({
|
|
67
|
+
method: 'POST',
|
|
68
|
+
path: '/definitions/events/preview',
|
|
69
|
+
name: 'definitions.events.preview',
|
|
70
|
+
access: 'read',
|
|
71
|
+
handle: ({ req }) =>
|
|
72
|
+
// SAFETY: Effect.gen residual R is never here; validateEventInput failures are already in the Error channel.
|
|
73
|
+
Effect.gen(function* () {
|
|
74
|
+
const body = yield* readJson(req).pipe(Effect.flatMap(Schema.decodeUnknownEffect(PreviewEventsBodySchema)));
|
|
75
|
+
const events = [];
|
|
76
|
+
for (const input of body.events) {
|
|
77
|
+
events.push(yield* validateEventInput(runtime.registry.catalogs, input));
|
|
78
|
+
}
|
|
79
|
+
return Response.json({ events });
|
|
80
|
+
}),
|
|
81
|
+
}),
|
|
26
82
|
];
|
|
27
83
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from 'effect';
|
|
2
|
-
import { createRunId, EventStoreTag, JsonValueSchema, RunAttributesSchema, readTraceHeaders, SecretContextSchema, stringifyJson, subscriptionFilter, subscriptionFromSeq, } from '@swirls/looms/core';
|
|
2
|
+
import { createRunId, EventStoreTag, findSignal, JsonValueSchema, RunAttributesSchema, readTraceHeaders, runSignal, SecretContextSchema, stringifyJson, subscriptionFilter, subscriptionFromSeq, } from '@swirls/looms/core';
|
|
3
3
|
import { createEventStreamResponse } from '../../sse.js';
|
|
4
4
|
import { acceptsEventStream, EventInputBodySchema, extractIdempotencyKey, provideStore, readIntegerQuery, readJson, readOptionalJson, RequestQueryError, } from '../http.js';
|
|
5
5
|
import { route } from '../route-table.js';
|
|
@@ -21,6 +21,11 @@ const SignalBodySchema = Schema.Struct({
|
|
|
21
21
|
threadId: Schema.optional(Schema.NullOr(Schema.String)),
|
|
22
22
|
idempotencyKey: Schema.optional(Schema.String),
|
|
23
23
|
});
|
|
24
|
+
const NamedSignalBodySchema = Schema.Struct({
|
|
25
|
+
input: Schema.optional(JsonValueSchema),
|
|
26
|
+
threadId: Schema.optional(Schema.String),
|
|
27
|
+
idempotencyKey: Schema.optional(Schema.String),
|
|
28
|
+
});
|
|
24
29
|
const CancelBodySchema = Schema.Struct({
|
|
25
30
|
threadId: Schema.optional(Schema.String),
|
|
26
31
|
});
|
|
@@ -194,6 +199,25 @@ export function runRoutes({ runtime, store }) {
|
|
|
194
199
|
return Response.json({ runId: params.runId, state });
|
|
195
200
|
}),
|
|
196
201
|
}),
|
|
202
|
+
route({
|
|
203
|
+
method: 'POST',
|
|
204
|
+
path: '/runs/:runId/signals/:namespace/:name',
|
|
205
|
+
name: 'runs.signal.named',
|
|
206
|
+
access: 'write',
|
|
207
|
+
handle: ({ req, params }) =>
|
|
208
|
+
// SAFETY: Effect.gen residual R is never here; decode/run errors map to Error via route handlers.
|
|
209
|
+
Effect.gen(function* () {
|
|
210
|
+
const definition = findSignal(runtime.registry.modules, params.namespace, params.name);
|
|
211
|
+
if (!definition) {
|
|
212
|
+
return Response.json({ error: `Unknown signal ${params.namespace}.${params.name}` }, { status: 404 });
|
|
213
|
+
}
|
|
214
|
+
const body = yield* readJson(req).pipe(Effect.flatMap(Schema.decodeUnknownEffect(NamedSignalBodySchema)));
|
|
215
|
+
const events = yield* runSignal(definition, body.input ?? null, body.threadId);
|
|
216
|
+
const idempotencyKey = extractIdempotencyKey(req, body.idempotencyKey);
|
|
217
|
+
const state = yield* provideStore(runtime.signal(params.runId, events, { idempotencyKey }), store);
|
|
218
|
+
return Response.json({ runId: params.runId, state });
|
|
219
|
+
}),
|
|
220
|
+
}),
|
|
197
221
|
route({
|
|
198
222
|
method: 'POST',
|
|
199
223
|
path: '/runs/:runId/wake',
|
package/dist/runtime/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Effect } from 'effect';
|
|
2
|
-
import type { AnyRuntimeModule, ComposedRegistry, DefinitionResolver, EventEnvelope, EventInput, WorkerCallback, WorkerCallbackInput, DefinitionResolveError, WorkerCallbackResult, WorkerSecretsResult, EventStore, EventStoreAppendError, EventStoreError, EventStoreFencedError, EventStoreTag, EventStoreTrimCoverage, RunLauncher, RunLaunchSource, RunAttributes, SecretContext, TraceContext, EventStoreTruncationError, JsonValue, ProjectionDefinition, ReplayStep, RunState, RunSummary, SnapshotStore, SnapshotStoreError } from '@swirls/looms/core';
|
|
2
|
+
import type { AnyRuntimeModule, ComposedRegistry, DefinitionResolver, EventEnvelope, EventInput, WorkerCallback, WorkerCallbackInput, DefinitionResolveError, WorkerCallbackResult, WorkerSecretsResult, EventStore, EventStoreAppendError, EventStoreError, EventStoreFencedError, EventStoreTag, EventStoreTrimCoverage, RunLauncher, RunLaunchSource, RunAttributeFields, RunAttributes, SecretContext, TraceContext, EventStoreTruncationError, JsonValue, ProjectionDefinition, ReplayStep, RunState, RunSummary, SnapshotStore, SnapshotStoreError } from '@swirls/looms/core';
|
|
3
3
|
import type { EventStoreTrimmedError } from '@swirls/looms/core';
|
|
4
4
|
import type { DuplicateEffectDispatchError, MaxWakeIterationsError } from './errors';
|
|
5
5
|
import type { RuntimeObserver } from './observer';
|
|
@@ -57,6 +57,11 @@ export interface CreateRuntimeOptions<TModules extends readonly AnyRuntimeModule
|
|
|
57
57
|
readonly worker?: EffectWorker;
|
|
58
58
|
/** Failure-isolated, framework-neutral operational event sink. */
|
|
59
59
|
readonly observer?: RuntimeObserver;
|
|
60
|
+
/**
|
|
61
|
+
* Declared run attributes. When set, a start that misses a `required` attribute or sends an
|
|
62
|
+
* undeclared one fails with `InvalidRunAttributesError` and writes no events.
|
|
63
|
+
*/
|
|
64
|
+
readonly attributes?: RunAttributeFields;
|
|
60
65
|
}
|
|
61
66
|
export interface EffectWorkerTask {
|
|
62
67
|
readonly runId: string;
|
|
@@ -783,7 +783,64 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
|
|
|
783
783
|
readonly reason?: string | undefined;
|
|
784
784
|
}[];
|
|
785
785
|
}>;
|
|
786
|
-
}, import("effect/Context").Service.Any
|
|
786
|
+
}, import("effect/Context").Service.Any, {
|
|
787
|
+
update: import("@swirls/looms/core").SignalDefinition<{
|
|
788
|
+
readonly spec?: {
|
|
789
|
+
readonly type: "cron";
|
|
790
|
+
readonly expr: string;
|
|
791
|
+
readonly tz?: string | undefined;
|
|
792
|
+
} | {
|
|
793
|
+
readonly type: "every";
|
|
794
|
+
readonly everyMs: number;
|
|
795
|
+
readonly anchor?: number | undefined;
|
|
796
|
+
} | {
|
|
797
|
+
readonly type: "once";
|
|
798
|
+
readonly at: number;
|
|
799
|
+
} | undefined;
|
|
800
|
+
readonly input?: import("effect/Schema").Json | undefined;
|
|
801
|
+
readonly endAt?: number | null | undefined;
|
|
802
|
+
readonly maxFires?: number | null | undefined;
|
|
803
|
+
readonly definitionName?: string | undefined;
|
|
804
|
+
readonly definitionVersion?: string | undefined;
|
|
805
|
+
}, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
806
|
+
readonly type: "schedule.updated";
|
|
807
|
+
readonly payload: {
|
|
808
|
+
readonly spec?: {
|
|
809
|
+
readonly type: "cron";
|
|
810
|
+
readonly expr: string;
|
|
811
|
+
readonly tz?: string | undefined;
|
|
812
|
+
} | {
|
|
813
|
+
readonly type: "every";
|
|
814
|
+
readonly everyMs: number;
|
|
815
|
+
readonly anchor?: number | undefined;
|
|
816
|
+
} | {
|
|
817
|
+
readonly type: "once";
|
|
818
|
+
readonly at: number;
|
|
819
|
+
} | undefined;
|
|
820
|
+
readonly input?: import("effect/Schema").Json | undefined;
|
|
821
|
+
readonly endAt?: number | null | undefined;
|
|
822
|
+
readonly maxFires?: number | null | undefined;
|
|
823
|
+
readonly definitionName?: string | undefined;
|
|
824
|
+
readonly definitionVersion?: string | undefined;
|
|
825
|
+
};
|
|
826
|
+
}>;
|
|
827
|
+
pause: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
828
|
+
readonly type: "schedule.paused";
|
|
829
|
+
readonly payload: {};
|
|
830
|
+
}>;
|
|
831
|
+
resume: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
832
|
+
readonly type: "schedule.resumed";
|
|
833
|
+
readonly payload: {};
|
|
834
|
+
}>;
|
|
835
|
+
retire: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
836
|
+
readonly type: "schedule.retired";
|
|
837
|
+
readonly payload: {};
|
|
838
|
+
}>;
|
|
839
|
+
trigger: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
840
|
+
readonly type: "schedule.triggered";
|
|
841
|
+
readonly payload: {};
|
|
842
|
+
}>;
|
|
843
|
+
}, {}> & {
|
|
787
844
|
readonly effects: {
|
|
788
845
|
plan: import("@swirls/looms/core").LocalEffectDefinition<{
|
|
789
846
|
readonly spec: {
|
|
@@ -1507,4 +1564,63 @@ export declare function schedule(options?: ScheduleModuleOptions): import("@swir
|
|
|
1507
1564
|
}[];
|
|
1508
1565
|
}>;
|
|
1509
1566
|
};
|
|
1567
|
+
readonly signals: {
|
|
1568
|
+
update: import("@swirls/looms/core").SignalDefinition<{
|
|
1569
|
+
readonly spec?: {
|
|
1570
|
+
readonly type: "cron";
|
|
1571
|
+
readonly expr: string;
|
|
1572
|
+
readonly tz?: string | undefined;
|
|
1573
|
+
} | {
|
|
1574
|
+
readonly type: "every";
|
|
1575
|
+
readonly everyMs: number;
|
|
1576
|
+
readonly anchor?: number | undefined;
|
|
1577
|
+
} | {
|
|
1578
|
+
readonly type: "once";
|
|
1579
|
+
readonly at: number;
|
|
1580
|
+
} | undefined;
|
|
1581
|
+
readonly input?: import("effect/Schema").Json | undefined;
|
|
1582
|
+
readonly endAt?: number | null | undefined;
|
|
1583
|
+
readonly maxFires?: number | null | undefined;
|
|
1584
|
+
readonly definitionName?: string | undefined;
|
|
1585
|
+
readonly definitionVersion?: string | undefined;
|
|
1586
|
+
}, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1587
|
+
readonly type: "schedule.updated";
|
|
1588
|
+
readonly payload: {
|
|
1589
|
+
readonly spec?: {
|
|
1590
|
+
readonly type: "cron";
|
|
1591
|
+
readonly expr: string;
|
|
1592
|
+
readonly tz?: string | undefined;
|
|
1593
|
+
} | {
|
|
1594
|
+
readonly type: "every";
|
|
1595
|
+
readonly everyMs: number;
|
|
1596
|
+
readonly anchor?: number | undefined;
|
|
1597
|
+
} | {
|
|
1598
|
+
readonly type: "once";
|
|
1599
|
+
readonly at: number;
|
|
1600
|
+
} | undefined;
|
|
1601
|
+
readonly input?: import("effect/Schema").Json | undefined;
|
|
1602
|
+
readonly endAt?: number | null | undefined;
|
|
1603
|
+
readonly maxFires?: number | null | undefined;
|
|
1604
|
+
readonly definitionName?: string | undefined;
|
|
1605
|
+
readonly definitionVersion?: string | undefined;
|
|
1606
|
+
};
|
|
1607
|
+
}>;
|
|
1608
|
+
pause: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1609
|
+
readonly type: "schedule.paused";
|
|
1610
|
+
readonly payload: {};
|
|
1611
|
+
}>;
|
|
1612
|
+
resume: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1613
|
+
readonly type: "schedule.resumed";
|
|
1614
|
+
readonly payload: {};
|
|
1615
|
+
}>;
|
|
1616
|
+
retire: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1617
|
+
readonly type: "schedule.retired";
|
|
1618
|
+
readonly payload: {};
|
|
1619
|
+
}>;
|
|
1620
|
+
trigger: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
1621
|
+
readonly type: "schedule.triggered";
|
|
1622
|
+
readonly payload: {};
|
|
1623
|
+
}>;
|
|
1624
|
+
};
|
|
1625
|
+
readonly steps: {};
|
|
1510
1626
|
};
|
package/dist/schedule/module.js
CHANGED
|
@@ -3,6 +3,7 @@ import { ScheduleDefinitionsLive } from './definitions-store.js';
|
|
|
3
3
|
import { fireEffect, planEffect } from './effects.js';
|
|
4
4
|
import { scheduleStatus } from './projections.js';
|
|
5
5
|
import { scheduleModule } from './scope.js';
|
|
6
|
+
import { pause, resume, retire, trigger, update } from './signals.js';
|
|
6
7
|
import { DEFAULT_MIN_INTERVAL_MS } from './specs.js';
|
|
7
8
|
import { createScheduleThread } from './threads.js';
|
|
8
9
|
export function schedule(options = {}) {
|
|
@@ -14,6 +15,35 @@ export function schedule(options = {}) {
|
|
|
14
15
|
threads: { schedule: createScheduleThread(definitions, minIntervalMs) },
|
|
15
16
|
effects: { plan: planEffect, fire: fireEffect },
|
|
16
17
|
projections: { scheduleStatus },
|
|
18
|
+
signals: { update, pause, resume, retire, trigger },
|
|
19
|
+
examples: [
|
|
20
|
+
{
|
|
21
|
+
name: 'a fire updates status and recent history',
|
|
22
|
+
events: [
|
|
23
|
+
scheduleModule.input('planned', {
|
|
24
|
+
nextAt: 1_000,
|
|
25
|
+
generation: 1,
|
|
26
|
+
spec: { type: 'once', at: 1_000 },
|
|
27
|
+
}),
|
|
28
|
+
scheduleModule.input('fired', {
|
|
29
|
+
at: 1_000,
|
|
30
|
+
runId: 'run_child',
|
|
31
|
+
nextAt: null,
|
|
32
|
+
generation: 1,
|
|
33
|
+
manual: false,
|
|
34
|
+
}),
|
|
35
|
+
],
|
|
36
|
+
projections: {
|
|
37
|
+
scheduleStatus: {
|
|
38
|
+
spec: { type: 'once', at: 1_000 },
|
|
39
|
+
status: 'running',
|
|
40
|
+
nextAt: null,
|
|
41
|
+
fireCount: 1,
|
|
42
|
+
recent: [{ at: 1_000, runId: 'run_child', outcome: 'fired' }],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
17
47
|
services: () => ScheduleDefinitionsLive(definitions),
|
|
18
48
|
bindHost(host) {
|
|
19
49
|
definitions.useResolver(host.definitionResolver);
|
package/dist/schedule/scope.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type {
|
|
1
|
+
import { Schema } from 'effect';
|
|
2
|
+
import type { JsonValue } from '@swirls/looms/core';
|
|
3
|
+
import { type ScheduleSpec } from './specs';
|
|
3
4
|
export interface ScheduleUpdate {
|
|
4
5
|
readonly spec?: ScheduleSpec;
|
|
5
6
|
readonly input?: JsonValue | null;
|
|
@@ -11,15 +12,66 @@ export interface ScheduleUpdate {
|
|
|
11
12
|
readonly definitionVersion?: string;
|
|
12
13
|
}
|
|
13
14
|
/** Replace the spec, stored input, or bounds. A no-op when nothing changed. */
|
|
14
|
-
export declare
|
|
15
|
+
export declare const update: import("@swirls/looms/core").SignalDefinition<{
|
|
16
|
+
readonly spec?: {
|
|
17
|
+
readonly type: "cron";
|
|
18
|
+
readonly expr: string;
|
|
19
|
+
readonly tz?: string | undefined;
|
|
20
|
+
} | {
|
|
21
|
+
readonly type: "every";
|
|
22
|
+
readonly everyMs: number;
|
|
23
|
+
readonly anchor?: number | undefined;
|
|
24
|
+
} | {
|
|
25
|
+
readonly type: "once";
|
|
26
|
+
readonly at: number;
|
|
27
|
+
} | undefined;
|
|
28
|
+
readonly input?: Schema.Json | undefined;
|
|
29
|
+
readonly endAt?: number | null | undefined;
|
|
30
|
+
readonly maxFires?: number | null | undefined;
|
|
31
|
+
readonly definitionName?: string | undefined;
|
|
32
|
+
readonly definitionVersion?: string | undefined;
|
|
33
|
+
}, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
34
|
+
readonly type: "schedule.updated";
|
|
35
|
+
readonly payload: {
|
|
36
|
+
readonly spec?: {
|
|
37
|
+
readonly type: "cron";
|
|
38
|
+
readonly expr: string;
|
|
39
|
+
readonly tz?: string | undefined;
|
|
40
|
+
} | {
|
|
41
|
+
readonly type: "every";
|
|
42
|
+
readonly everyMs: number;
|
|
43
|
+
readonly anchor?: number | undefined;
|
|
44
|
+
} | {
|
|
45
|
+
readonly type: "once";
|
|
46
|
+
readonly at: number;
|
|
47
|
+
} | undefined;
|
|
48
|
+
readonly input?: Schema.Json | undefined;
|
|
49
|
+
readonly endAt?: number | null | undefined;
|
|
50
|
+
readonly maxFires?: number | null | undefined;
|
|
51
|
+
readonly definitionName?: string | undefined;
|
|
52
|
+
readonly definitionVersion?: string | undefined;
|
|
53
|
+
};
|
|
54
|
+
}>;
|
|
15
55
|
/** Drop the armed fire and delete the alarm. A later `resume` rebases from now. */
|
|
16
|
-
export declare
|
|
56
|
+
export declare const pause: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
57
|
+
readonly type: "schedule.paused";
|
|
58
|
+
readonly payload: {};
|
|
59
|
+
}>;
|
|
17
60
|
/** Arm the next fire after now. Missed fires are not caught up. */
|
|
18
|
-
export declare
|
|
61
|
+
export declare const resume: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
62
|
+
readonly type: "schedule.resumed";
|
|
63
|
+
readonly payload: {};
|
|
64
|
+
}>;
|
|
19
65
|
/**
|
|
20
66
|
* Park a removed schedule without cancelling it, so the same run id can be resumed.
|
|
21
67
|
* Cancel remains the permanent delete.
|
|
22
68
|
*/
|
|
23
|
-
export declare
|
|
69
|
+
export declare const retire: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
70
|
+
readonly type: "schedule.retired";
|
|
71
|
+
readonly payload: {};
|
|
72
|
+
}>;
|
|
24
73
|
/** Start one target run now, without moving the armed fire. */
|
|
25
|
-
export declare
|
|
74
|
+
export declare const trigger: import("@swirls/looms/core").SignalDefinition<undefined, Omit<import("@swirls/looms/core").EventInput, "payload" | "type"> & {
|
|
75
|
+
readonly type: "schedule.triggered";
|
|
76
|
+
readonly payload: {};
|
|
77
|
+
}>;
|
package/dist/schedule/signals.js
CHANGED
|
@@ -1,33 +1,51 @@
|
|
|
1
|
+
import { Schema } from 'effect';
|
|
1
2
|
import { scheduleModule } from './scope.js';
|
|
3
|
+
import { ScheduleSpecSchema } from './specs.js';
|
|
4
|
+
const ScheduleUpdateSchema = Schema.Struct({
|
|
5
|
+
spec: Schema.optional(ScheduleSpecSchema),
|
|
6
|
+
input: Schema.optional(Schema.NullOr(Schema.Json)),
|
|
7
|
+
endAt: Schema.optional(Schema.NullOr(Schema.Finite)),
|
|
8
|
+
maxFires: Schema.optional(Schema.NullOr(Schema.Finite)),
|
|
9
|
+
definitionName: Schema.optional(Schema.String),
|
|
10
|
+
definitionVersion: Schema.optional(Schema.String),
|
|
11
|
+
});
|
|
2
12
|
/** Replace the spec, stored input, or bounds. A no-op when nothing changed. */
|
|
3
|
-
export
|
|
4
|
-
|
|
13
|
+
export const update = scheduleModule.signal({
|
|
14
|
+
description: 'Replace the schedule spec, stored input, or bounds.',
|
|
15
|
+
input: ScheduleUpdateSchema,
|
|
16
|
+
build: (patch) => scheduleModule.input('updated', {
|
|
5
17
|
...(patch.spec === undefined ? undefined : { spec: patch.spec }),
|
|
6
18
|
...(patch.input === undefined ? undefined : { input: patch.input }),
|
|
7
19
|
...(patch.endAt === undefined ? undefined : { endAt: patch.endAt }),
|
|
8
20
|
...(patch.maxFires === undefined ? undefined : { maxFires: patch.maxFires }),
|
|
9
|
-
...(patch.definitionName === undefined
|
|
21
|
+
...(patch.definitionName === undefined
|
|
22
|
+
? undefined
|
|
23
|
+
: { definitionName: patch.definitionName }),
|
|
10
24
|
...(patch.definitionVersion === undefined
|
|
11
25
|
? undefined
|
|
12
26
|
: { definitionVersion: patch.definitionVersion }),
|
|
13
|
-
})
|
|
14
|
-
}
|
|
27
|
+
}),
|
|
28
|
+
});
|
|
15
29
|
/** Drop the armed fire and delete the alarm. A later `resume` rebases from now. */
|
|
16
|
-
export
|
|
17
|
-
|
|
18
|
-
}
|
|
30
|
+
export const pause = scheduleModule.signal({
|
|
31
|
+
description: 'Drop the armed fire and delete the alarm.',
|
|
32
|
+
build: () => scheduleModule.input('paused', {}),
|
|
33
|
+
});
|
|
19
34
|
/** Arm the next fire after now. Missed fires are not caught up. */
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
}
|
|
35
|
+
export const resume = scheduleModule.signal({
|
|
36
|
+
description: 'Arm the next fire after now without catching up missed fires.',
|
|
37
|
+
build: () => scheduleModule.input('resumed', {}),
|
|
38
|
+
});
|
|
23
39
|
/**
|
|
24
40
|
* Park a removed schedule without cancelling it, so the same run id can be resumed.
|
|
25
41
|
* Cancel remains the permanent delete.
|
|
26
42
|
*/
|
|
27
|
-
export
|
|
28
|
-
|
|
29
|
-
}
|
|
43
|
+
export const retire = scheduleModule.signal({
|
|
44
|
+
description: 'Park a removed schedule without cancelling it.',
|
|
45
|
+
build: () => scheduleModule.input('retired', {}),
|
|
46
|
+
});
|
|
30
47
|
/** Start one target run now, without moving the armed fire. */
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
}
|
|
48
|
+
export const trigger = scheduleModule.signal({
|
|
49
|
+
description: 'Start one target run now without moving the armed fire.',
|
|
50
|
+
build: () => scheduleModule.input('triggered', {}),
|
|
51
|
+
});
|
package/dist/testing/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Effect } from 'effect';
|
|
2
2
|
import { composeModules, EventStoreTag, makeMemoryEventStore, ModuleCompositionError, EventStoreError, snapshotStoreOf, withSnapshotStore, } from '@swirls/looms/core';
|
|
3
3
|
import { createRuntime } from '@swirls/looms/runtime';
|
|
4
|
+
import { moduleExampleErrors } from './module-examples.js';
|
|
4
5
|
import { assertReplayDeterministicEvents } from './replay-corpus.js';
|
|
5
6
|
export function createTestRuntime(modules) {
|
|
6
7
|
return Effect.runPromise(makeMemoryEventStore.pipe(Effect.map((store) => {
|
|
@@ -44,7 +45,7 @@ export function moduleConformance(module) {
|
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
47
|
try {
|
|
47
|
-
composeModules([module]);
|
|
48
|
+
errors.push(...moduleExampleErrors(module, composeModules([module]).catalogs));
|
|
48
49
|
}
|
|
49
50
|
catch (err) {
|
|
50
51
|
errors.push(err instanceof ModuleCompositionError ? err.message : String(err));
|