@swirls/looms 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (75) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/actor/cell.d.ts +1 -1
  3. package/dist/actor/routing.d.ts +5 -1
  4. package/dist/actor/routing.js +14 -3
  5. package/dist/agent/effects.d.ts +20 -2
  6. package/dist/agent/effects.js +2 -0
  7. package/dist/agent/module.d.ts +540 -504
  8. package/dist/approval/effects.d.ts +36 -27
  9. package/dist/approval/effects.js +1 -0
  10. package/dist/approval/module.d.ts +20 -2
  11. package/dist/client/client.d.ts +38 -10
  12. package/dist/client/client.js +2 -1
  13. package/dist/cloudflare/durable-object.d.ts +1 -1
  14. package/dist/cloudflare/index.d.ts +1 -1
  15. package/dist/cloudflare/index.js +1 -1
  16. package/dist/cloudflare/queue-consumer.d.ts +17 -10
  17. package/dist/cloudflare/queue-consumer.js +63 -27
  18. package/dist/cloudflare/queue-message.d.ts +4 -1
  19. package/dist/cloudflare/queue-message.js +4 -1
  20. package/dist/cloudflare/queue-worker.d.ts +7 -3
  21. package/dist/cloudflare/queue-worker.js +7 -2
  22. package/dist/cloudflare/queues.d.ts +1 -1
  23. package/dist/cloudflare/queues.js +1 -1
  24. package/dist/core/compose.d.ts +2 -1
  25. package/dist/core/compose.js +5 -0
  26. package/dist/core/effects.d.ts +84 -39
  27. package/dist/core/effects.js +29 -8
  28. package/dist/core/fold.js +87 -14
  29. package/dist/core/module-scope.d.ts +22 -8
  30. package/dist/core/module-scope.js +3 -0
  31. package/dist/core/module.d.ts +40 -9
  32. package/dist/core/module.js +25 -6
  33. package/dist/core/protocol.d.ts +12 -1
  34. package/dist/core/protocol.js +12 -0
  35. package/dist/core/published.d.ts +52 -0
  36. package/dist/core/published.js +45 -0
  37. package/dist/core/replay.d.ts +4 -2
  38. package/dist/core/state.d.ts +8 -2
  39. package/dist/core/state.js +2 -0
  40. package/dist/debugger/app/assets/{index-CUO1xyYW.js → index-CMRl_aWQ.js} +2 -2
  41. package/dist/debugger/app/assets/routes-CfXxKG45.js +47 -0
  42. package/dist/debugger/app/index.html +1 -1
  43. package/dist/debugger/events/protocol-summarize.js +2 -0
  44. package/dist/evaluator/effects.d.ts +10 -1
  45. package/dist/evaluator/effects.js +1 -0
  46. package/dist/evaluator/module.d.ts +20 -2
  47. package/dist/runtime/cancellation.js +1 -1
  48. package/dist/runtime/dispatch-effect.d.ts +2 -2
  49. package/dist/runtime/dispatch-effect.js +12 -4
  50. package/dist/runtime/effect-admission.d.ts +45 -0
  51. package/dist/runtime/effect-admission.js +70 -0
  52. package/dist/runtime/helpers.d.ts +6 -1
  53. package/dist/runtime/helpers.js +14 -5
  54. package/dist/runtime/index.d.ts +1 -0
  55. package/dist/runtime/index.js +1 -0
  56. package/dist/runtime/local-effect-executor.js +30 -8
  57. package/dist/runtime/retry-policy.js +6 -1
  58. package/dist/runtime/runtime.js +7 -2
  59. package/dist/runtime/server/routes/definitions.js +8 -1
  60. package/dist/runtime/types.d.ts +20 -5
  61. package/dist/runtime/wake-engine.js +20 -0
  62. package/dist/runtime/worker-callbacks.js +2 -2
  63. package/dist/runtime/worker-effect-dispatch.d.ts +35 -9
  64. package/dist/runtime/worker-effect-dispatch.js +105 -26
  65. package/dist/schedule/effects.d.ts +20 -2
  66. package/dist/schedule/effects.js +2 -0
  67. package/dist/schedule/module.d.ts +40 -4
  68. package/dist/testing/corpus-module.d.ts +2 -2
  69. package/dist/testing/corpus-module.js +27 -19
  70. package/dist/testing/index.js +12 -23
  71. package/dist/workflow/effects.d.ts +20 -2
  72. package/dist/workflow/effects.js +2 -0
  73. package/dist/workflow/module.d.ts +40 -4
  74. package/package.json +1 -1
  75. package/dist/debugger/app/assets/routes-lt_6J025.js +0 -47
@@ -1,20 +1,39 @@
1
+ import { Effect } from 'effect';
1
2
  import { isPrimitiveEffect, } from './effects.js';
3
+ import { validateInputEffect, } from './schema.js';
2
4
  export { DEFAULT_DEFINITION_VERSION, definitionKey } from './definition-version.js';
3
5
  /**
4
- * Middleware that runs only for one effect definition. The handler receives the effect's
6
+ * Middleware that runs only for one **local** effect definition. The handler receives the effect's
5
7
  * decoded input type and must call `next()` to continue (or `failEffect` to reject the attempt).
6
8
  *
7
- * Middleware wraps local (in-process) effect dispatch only. Effects routed to an `EffectWorker`
8
- * never see it.
9
+ * Middleware wraps local (in-process) effect dispatch only. Worker-placed effects never see it —
10
+ * pass a {@link LocalEffectDefinition} so that is a type error rather than a silent no-op.
11
+ * Prefer {@link EffectAdmission} / {@link onAdmit} for gates that must apply on both paths.
9
12
  */
10
13
  export function onEffect(definition, handler) {
11
14
  return (effect, ctx, next) => {
12
15
  if (isPrimitiveEffect(effect) || effect.type !== definition.type) {
13
16
  return next(effect, ctx);
14
17
  }
15
- // SAFETY: matched definition's phantom TInput is the schema type handlers receive after validation.
16
- // oxlint-disable-next-line typescript/no-unsafe-type-assertion
17
- return handler(effect.input, ctx, () => next(effect, ctx));
18
+ return decodeEffectInput(definition, effect.input).pipe(Effect.flatMap((input) => handler(input, ctx, () => next(effect, ctx))));
19
+ };
20
+ }
21
+ function decodeEffectInput(definition, raw) {
22
+ return validateInputEffect(definition.input, raw).pipe(
23
+ // SAFETY: decoded with the definition's own schema, whose output is the phantom TInput.
24
+ // oxlint-disable-next-line typescript/no-unsafe-type-assertion
25
+ Effect.map((input) => input));
26
+ }
27
+ /**
28
+ * Admission that runs only for one effect definition (local or worker). Prefer this over
29
+ * middleware when the gate must apply to worker-placed effects as well as local ones.
30
+ */
31
+ export function onAdmit(definition, handler) {
32
+ return (effect, ctx) => {
33
+ if (isPrimitiveEffect(effect) || effect.type !== definition.type) {
34
+ return Effect.void;
35
+ }
36
+ return decodeEffectInput(definition, effect.input).pipe(Effect.flatMap((input) => handler(input, ctx)));
18
37
  };
19
38
  }
20
39
  export function defineRuntimeModule(module) {
@@ -164,6 +164,17 @@ export declare const protocolCatalog: import("./catalog").EventCatalog<"runtime"
164
164
  readonly attempt: Schema.Finite;
165
165
  readonly error: Schema.String;
166
166
  }>;
167
+ /**
168
+ * Unacknowledged worker.dispatch rejected. The attempt enters `dispatch_wait` (same attempt,
169
+ * outbox backoff) until the host relays again or parks as ambiguous.
170
+ */
171
+ 'effect.dispatch.deferred': Schema.Struct<{
172
+ readonly effectId: Schema.String;
173
+ readonly attempt: Schema.Finite;
174
+ readonly retryAt: Schema.Finite;
175
+ readonly error: Schema.String;
176
+ readonly try: Schema.Finite;
177
+ }>;
167
178
  'effect.retry.scheduled': Schema.Struct<{
168
179
  readonly effectId: Schema.String;
169
180
  readonly attempt: Schema.Finite;
@@ -181,7 +192,7 @@ export declare const protocolCatalog: import("./catalog").EventCatalog<"runtime"
181
192
  }>;
182
193
  export type ProtocolEvent = EventsOfCatalog<typeof protocolCatalog>;
183
194
  export type ProtocolEventInput = EventInputOf<typeof protocolCatalog>;
184
- export declare const PROTOCOL_TYPES: readonly ['runtime.run.started', 'runtime.run.completed', 'runtime.run.cancelled', 'runtime.run.launched', 'runtime.child.settled', 'runtime.child.close.requested', 'runtime.run.forked', 'runtime.fork.elided', 'runtime.thread.started', 'runtime.thread.completed', 'runtime.thread.failed', 'runtime.thread.cancelled', 'runtime.thread.cancel.requested', 'runtime.wait.registered', 'runtime.wait.satisfied', 'runtime.timer.set', 'runtime.timer.fired', 'runtime.effect.failed', 'runtime.effect.attempt.started', 'runtime.effect.queued', 'runtime.effect.dispatched', 'runtime.effect.worker.started', 'runtime.effect.heartbeat', 'runtime.effect.cancel.requested', 'runtime.effect.cancelled', 'runtime.effect.completed', 'runtime.effect.timed_out', 'runtime.effect.ambiguous', 'runtime.effect.retry.scheduled', 'runtime.snapshot.taken', 'runtime.signal.received'];
195
+ export declare const PROTOCOL_TYPES: readonly ['runtime.run.started', 'runtime.run.completed', 'runtime.run.cancelled', 'runtime.run.launched', 'runtime.child.settled', 'runtime.child.close.requested', 'runtime.run.forked', 'runtime.fork.elided', 'runtime.thread.started', 'runtime.thread.completed', 'runtime.thread.failed', 'runtime.thread.cancelled', 'runtime.thread.cancel.requested', 'runtime.wait.registered', 'runtime.wait.satisfied', 'runtime.timer.set', 'runtime.timer.fired', 'runtime.effect.failed', 'runtime.effect.attempt.started', 'runtime.effect.queued', 'runtime.effect.dispatched', 'runtime.effect.worker.started', 'runtime.effect.heartbeat', 'runtime.effect.cancel.requested', 'runtime.effect.cancelled', 'runtime.effect.completed', 'runtime.effect.timed_out', 'runtime.effect.ambiguous', 'runtime.effect.dispatch.deferred', 'runtime.effect.retry.scheduled', 'runtime.snapshot.taken', 'runtime.signal.received'];
185
196
  export type ProtocolEventType = (typeof PROTOCOL_TYPES)[number];
186
197
  export declare function isProtocolType(type: string): type is ProtocolEventType;
187
198
  export type RunStartedPayload = Schema.Schema.Type<(typeof protocolCatalog.entries)['run.started']>;
@@ -160,6 +160,17 @@ export const protocolCatalog = defineEventCatalog('runtime', {
160
160
  attempt: Schema.Finite,
161
161
  error: Schema.String,
162
162
  }),
163
+ /**
164
+ * Unacknowledged worker.dispatch rejected. The attempt enters `dispatch_wait` (same attempt,
165
+ * outbox backoff) until the host relays again or parks as ambiguous.
166
+ */
167
+ 'effect.dispatch.deferred': Schema.Struct({
168
+ effectId: Schema.String,
169
+ attempt: Schema.Finite,
170
+ retryAt: Schema.Finite,
171
+ error: Schema.String,
172
+ try: Schema.Finite,
173
+ }),
163
174
  'effect.retry.scheduled': Schema.Struct({
164
175
  effectId: Schema.String,
165
176
  attempt: Schema.Finite,
@@ -204,6 +215,7 @@ export const PROTOCOL_TYPES = [
204
215
  'runtime.effect.completed',
205
216
  'runtime.effect.timed_out',
206
217
  'runtime.effect.ambiguous',
218
+ 'runtime.effect.dispatch.deferred',
207
219
  'runtime.effect.retry.scheduled',
208
220
  'runtime.snapshot.taken',
209
221
  'runtime.signal.received',
@@ -1,5 +1,7 @@
1
1
  import { Schema } from 'effect';
2
+ import type { EffectPlacement, RetryPolicy } from './effects';
2
3
  import type { RegisteredDefinition } from './module';
4
+ import { type SchemaInput } from './schema';
3
5
  import { type RunState } from './state';
4
6
  /** A registered definition as `GET /definitions` publishes it. */
5
7
  export declare const PublishedDefinitionSchema: Schema.Struct<{
@@ -24,6 +26,55 @@ export declare const DefinitionCatalogSchema: Schema.Struct<{
24
26
  }>;
25
27
  export type DefinitionCatalog = Schema.Schema.Type<typeof DefinitionCatalogSchema>;
26
28
  export declare function publishDefinition(definition: RegisteredDefinition): PublishedDefinition;
29
+ /** A declared effect as `GET /definitions/effects` publishes it. */
30
+ export declare const PublishedEffectSchema: Schema.Struct<{
31
+ readonly type: Schema.String;
32
+ readonly placement: Schema.Literals<readonly ["local", "worker"]>;
33
+ readonly deterministic: Schema.optional<Schema.Boolean>;
34
+ readonly retry: Schema.optional<Schema.Struct<{
35
+ readonly maxAttempts: Schema.Finite;
36
+ readonly backoffMs: Schema.optional<Schema.Finite>;
37
+ readonly maxBackoffMs: Schema.optional<Schema.Finite>;
38
+ readonly backoffMultiplier: Schema.optional<Schema.Finite>;
39
+ readonly scheduleToStartTimeoutMs: Schema.optional<Schema.Finite>;
40
+ readonly startToCloseTimeoutMs: Schema.optional<Schema.Finite>;
41
+ readonly heartbeatTimeoutMs: Schema.optional<Schema.Finite>;
42
+ readonly cancellationTimeoutMs: Schema.optional<Schema.Finite>;
43
+ }>>;
44
+ /** JSON Schema derived from the effect's `input`. */
45
+ readonly inputSchema: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
46
+ }>;
47
+ export type PublishedEffect = Schema.Schema.Type<typeof PublishedEffectSchema>;
48
+ export declare const EffectCatalogSchema: Schema.Struct<{
49
+ readonly effects: Schema.$Array<Schema.Struct<{
50
+ readonly type: Schema.String;
51
+ readonly placement: Schema.Literals<readonly ["local", "worker"]>;
52
+ readonly deterministic: Schema.optional<Schema.Boolean>;
53
+ readonly retry: Schema.optional<Schema.Struct<{
54
+ readonly maxAttempts: Schema.Finite;
55
+ readonly backoffMs: Schema.optional<Schema.Finite>;
56
+ readonly maxBackoffMs: Schema.optional<Schema.Finite>;
57
+ readonly backoffMultiplier: Schema.optional<Schema.Finite>;
58
+ readonly scheduleToStartTimeoutMs: Schema.optional<Schema.Finite>;
59
+ readonly startToCloseTimeoutMs: Schema.optional<Schema.Finite>;
60
+ readonly heartbeatTimeoutMs: Schema.optional<Schema.Finite>;
61
+ readonly cancellationTimeoutMs: Schema.optional<Schema.Finite>;
62
+ }>>;
63
+ /** JSON Schema derived from the effect's `input`. */
64
+ readonly inputSchema: Schema.optional<Schema.Codec<Schema.Json, Schema.Json, never, never>>;
65
+ }>>;
66
+ }>;
67
+ export type EffectCatalog = Schema.Schema.Type<typeof EffectCatalogSchema>;
68
+ interface PublishableEffect {
69
+ readonly type: string;
70
+ readonly placement: EffectPlacement;
71
+ readonly deterministic?: boolean;
72
+ readonly retry?: RetryPolicy;
73
+ readonly input?: SchemaInput;
74
+ }
75
+ export declare function publishEffect(definition: PublishableEffect): PublishedEffect;
76
+ /** Declared effects, sorted by type so the catalog is stable. */
77
+ export declare function publishEffects(effects: Iterable<PublishableEffect>): readonly PublishedEffect[];
27
78
  /** A run as `GET /runs/summaries` lists it. */
28
79
  export declare const RunSummarySchema: Schema.Struct<{
29
80
  readonly runId: Schema.String;
@@ -43,3 +94,4 @@ export declare const RunSummariesSchema: Schema.Struct<{
43
94
  readonly attributes: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.String>, never>;
44
95
  }>>;
45
96
  }>;
97
+ export {};
@@ -25,6 +25,51 @@ export function publishDefinition(definition) {
25
25
  inputSchema: jsonSchemaOfInput(definition.input),
26
26
  };
27
27
  }
28
+ const PublishedRetryPolicySchema = Schema.Struct({
29
+ maxAttempts: Schema.Finite,
30
+ backoffMs: Schema.optional(Schema.Finite),
31
+ maxBackoffMs: Schema.optional(Schema.Finite),
32
+ backoffMultiplier: Schema.optional(Schema.Finite),
33
+ scheduleToStartTimeoutMs: Schema.optional(Schema.Finite),
34
+ startToCloseTimeoutMs: Schema.optional(Schema.Finite),
35
+ heartbeatTimeoutMs: Schema.optional(Schema.Finite),
36
+ cancellationTimeoutMs: Schema.optional(Schema.Finite),
37
+ });
38
+ /** A declared effect as `GET /definitions/effects` publishes it. */
39
+ export const PublishedEffectSchema = Schema.Struct({
40
+ type: Schema.String,
41
+ placement: Schema.Literals(['local', 'worker']),
42
+ deterministic: Schema.optional(Schema.Boolean),
43
+ retry: Schema.optional(PublishedRetryPolicySchema),
44
+ /** JSON Schema derived from the effect's `input`. */
45
+ inputSchema: Schema.optional(JsonValueSchema),
46
+ });
47
+ export const EffectCatalogSchema = Schema.Struct({
48
+ effects: Schema.Array(PublishedEffectSchema),
49
+ });
50
+ export function publishEffect(definition) {
51
+ const published = {
52
+ type: definition.type,
53
+ placement: definition.placement,
54
+ };
55
+ if (definition.deterministic !== undefined) {
56
+ published.deterministic = definition.deterministic;
57
+ }
58
+ if (definition.retry !== undefined) {
59
+ published.retry = definition.retry;
60
+ }
61
+ const inputSchema = jsonSchemaOfInput(definition.input);
62
+ if (inputSchema !== undefined) {
63
+ published.inputSchema = inputSchema;
64
+ }
65
+ return published;
66
+ }
67
+ /** Declared effects, sorted by type so the catalog is stable. */
68
+ export function publishEffects(effects) {
69
+ return [...effects]
70
+ .map(publishEffect)
71
+ .toSorted((left, right) => left.type.localeCompare(right.type));
72
+ }
28
73
  /** A run as `GET /runs/summaries` lists it. */
29
74
  export const RunSummarySchema = Schema.Struct({
30
75
  runId: Schema.String,
@@ -176,13 +176,14 @@ export declare const ReplayStepSchema: Schema.Struct<{
176
176
  readonly effectExecutions: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.Struct<{
177
177
  readonly effectId: Schema.String;
178
178
  readonly attempt: Schema.Finite;
179
- readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
179
+ readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatch_wait">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
180
180
  readonly nextAttemptAt: Schema.NullOr<Schema.Finite>;
181
181
  readonly deadlineAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
182
182
  readonly startedAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
183
183
  readonly lastHeartbeatAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
184
184
  readonly heartbeatDetails: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>, never>;
185
185
  readonly lastError: Schema.NullOr<Schema.String>;
186
+ readonly dispatchTry: Schema.withDecodingDefaultKey<Schema.Finite, never>;
186
187
  }>>, never>;
187
188
  readonly completedEffectIds: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
188
189
  readonly processedIdempotencyKeys: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
@@ -330,13 +331,14 @@ export declare const ReplayStepSchema: Schema.Struct<{
330
331
  readonly effectExecutions: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.Struct<{
331
332
  readonly effectId: Schema.String;
332
333
  readonly attempt: Schema.Finite;
333
- readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
334
+ readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatch_wait">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
334
335
  readonly nextAttemptAt: Schema.NullOr<Schema.Finite>;
335
336
  readonly deadlineAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
336
337
  readonly startedAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
337
338
  readonly lastHeartbeatAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
338
339
  readonly heartbeatDetails: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>, never>;
339
340
  readonly lastError: Schema.NullOr<Schema.String>;
341
+ readonly dispatchTry: Schema.withDecodingDefaultKey<Schema.Finite, never>;
340
342
  }>>, never>;
341
343
  readonly completedEffectIds: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
342
344
  readonly processedIdempotencyKeys: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
@@ -32,7 +32,7 @@ export interface OutstandingEffect {
32
32
  export interface EffectExecutionRecord {
33
33
  effectId: string;
34
34
  attempt: number;
35
- status: 'queued' | 'dispatched' | 'started' | 'heartbeat' | 'retry_wait' | 'cancel_requested' | 'timed_out' | 'ambiguous' | 'running';
35
+ status: 'queued' | 'dispatch_wait' | 'dispatched' | 'started' | 'heartbeat' | 'retry_wait' | 'cancel_requested' | 'timed_out' | 'ambiguous' | 'running';
36
36
  nextAttemptAt: number | null;
37
37
  deadlineAt: number | null;
38
38
  /** When the current attempt started executing, locally or on a worker. */
@@ -41,6 +41,11 @@ export interface EffectExecutionRecord {
41
41
  /** Progress reported by the latest heartbeat. Survives retries so the next attempt can resume. */
42
42
  heartbeatDetails: JsonValue | null;
43
43
  lastError: string | null;
44
+ /**
45
+ * How many times the host deferred an unacknowledged worker.dispatch for this attempt.
46
+ * Used for outbox backoff; ignored for local and acknowledged-worker paths.
47
+ */
48
+ dispatchTry: number;
44
49
  }
45
50
  export interface RunStartIdentity {
46
51
  kind: string;
@@ -229,13 +234,14 @@ export declare const RunStateSchema: Schema.Struct<{
229
234
  readonly effectExecutions: Schema.withDecodingDefaultKey<Schema.$Record<Schema.String, Schema.Struct<{
230
235
  readonly effectId: Schema.String;
231
236
  readonly attempt: Schema.Finite;
232
- readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
237
+ readonly status: Schema.Union<readonly [Schema.Literal<"queued">, Schema.Literal<"dispatch_wait">, Schema.Literal<"dispatched">, Schema.Literal<"started">, Schema.Literal<"heartbeat">, Schema.Literal<"retry_wait">, Schema.Literal<"cancel_requested">, Schema.Literal<"timed_out">, Schema.Literal<"ambiguous">, Schema.Literal<"running">]>;
233
238
  readonly nextAttemptAt: Schema.NullOr<Schema.Finite>;
234
239
  readonly deadlineAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
235
240
  readonly startedAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
236
241
  readonly lastHeartbeatAt: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Finite>, never>;
237
242
  readonly heartbeatDetails: Schema.withDecodingDefaultKey<Schema.NullOr<Schema.Codec<Schema.Json, Schema.Json, never, never>>, never>;
238
243
  readonly lastError: Schema.NullOr<Schema.String>;
244
+ readonly dispatchTry: Schema.withDecodingDefaultKey<Schema.Finite, never>;
239
245
  }>>, never>;
240
246
  readonly completedEffectIds: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
241
247
  readonly processedIdempotencyKeys: Schema.withDecodingDefaultKey<Schema.$Array<Schema.String>, never>;
@@ -66,6 +66,7 @@ export const RunStateSchema = Schema.Struct({
66
66
  attempt: Schema.Finite,
67
67
  status: Schema.Union([
68
68
  Schema.Literal('queued'),
69
+ Schema.Literal('dispatch_wait'),
69
70
  Schema.Literal('dispatched'),
70
71
  Schema.Literal('started'),
71
72
  Schema.Literal('heartbeat'),
@@ -81,6 +82,7 @@ export const RunStateSchema = Schema.Struct({
81
82
  lastHeartbeatAt: Schema.NullOr(Schema.Finite).pipe(Schema.withDecodingDefaultKey(Effect.succeed(null))),
82
83
  heartbeatDetails: Schema.NullOr(JsonValueSchema).pipe(Schema.withDecodingDefaultKey(Effect.succeed(null))),
83
84
  lastError: Schema.NullOr(Schema.String),
85
+ dispatchTry: Schema.Finite.pipe(Schema.withDecodingDefaultKey(Effect.succeed(0))),
84
86
  })).pipe(Schema.withDecodingDefaultKey(Effect.succeed({}))),
85
87
  completedEffectIds: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),
86
88
  processedIdempotencyKeys: Schema.Array(Schema.String).pipe(Schema.withDecodingDefaultKey(Effect.succeed([]))),