eve 0.38.1 → 0.38.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/src/cli/commands/registry.js +1 -1
  3. package/dist/src/cli/dev/tui/tool-presentation.js +1 -1
  4. package/dist/src/compiled/.vendor-stamp.json +5 -5
  5. package/dist/src/compiled/@workflow/core/events-consumer.d.ts +97 -0
  6. package/dist/src/compiled/@workflow/core/index.js +2 -2
  7. package/dist/src/compiled/@workflow/core/private.js +1 -1
  8. package/dist/src/compiled/@workflow/core/runtime/constants.d.ts +35 -0
  9. package/dist/src/compiled/@workflow/core/runtime/helpers.d.ts +127 -93
  10. package/dist/src/compiled/@workflow/core/runtime/quickjs-entrypoint.d.ts +8 -9
  11. package/dist/src/compiled/@workflow/core/runtime/replay-budget.d.ts +8 -0
  12. package/dist/src/compiled/@workflow/core/runtime/resume-latency.d.ts +143 -0
  13. package/dist/src/compiled/@workflow/core/runtime/step-executor.d.ts +27 -12
  14. package/dist/src/compiled/@workflow/core/runtime/suspension-handler.d.ts +39 -8
  15. package/dist/src/compiled/@workflow/core/runtime/world-compatibility.d.ts +6 -5
  16. package/dist/src/compiled/@workflow/core/runtime.js +3 -3
  17. package/dist/src/compiled/@workflow/core/telemetry/semantic-conventions.d.ts +81 -0
  18. package/dist/src/compiled/@workflow/core/test-support/orchestrator-context.d.ts +25 -0
  19. package/dist/src/compiled/@workflow/core/version.d.ts +1 -1
  20. package/dist/src/compiled/@workflow/core/workflow.js +1 -1
  21. package/dist/src/compiled/@workflow/errors/index.d.ts +18 -2
  22. package/dist/src/compiled/@workflow/errors/index.js +1 -1
  23. package/dist/src/compiled/@workflow/world/analytics.d.ts +9 -0
  24. package/dist/src/compiled/@workflow/world/events.d.ts +76 -87
  25. package/dist/src/compiled/@workflow/world/index.d.ts +3 -3
  26. package/dist/src/compiled/@workflow/world/interfaces.d.ts +45 -45
  27. package/dist/src/compiled/@workflow/world/queue.d.ts +86 -0
  28. package/dist/src/compiled/@workflow/world/slot-identity.d.ts +15 -0
  29. package/dist/src/compiled/@workflow/world/spec-version.d.ts +30 -18
  30. package/dist/src/compiled/@workflow/world/test-support/duplicate-event-fixtures.d.ts +41 -0
  31. package/dist/src/compiled/@workflow/world-local/index.js +5 -5
  32. package/dist/src/compiled/@workflow/world-vercel/index.js +12 -12
  33. package/dist/src/compiled/_chunks/workflow/{attribute-changes-DZtQkszH.js → attribute-changes-B8K0pwpH.js} +1 -1
  34. package/dist/src/compiled/_chunks/workflow/{dist-CPlyFOVo.js → dist-BRGbNjhD.js} +1 -1
  35. package/dist/src/compiled/_chunks/workflow/{dist-xQXN70ED.js → dist-CqvWKNQv.js} +1 -1
  36. package/dist/src/compiled/_chunks/workflow/frames-DoexhtxJ.js +3 -0
  37. package/dist/src/compiled/_chunks/workflow/private-z_2Kcwee.js +1 -0
  38. package/dist/src/compiled/_chunks/workflow/resume-hook-DO_MuJlY.js +1 -0
  39. package/dist/src/compiled/_chunks/workflow/run-lq7-eG0l.js +1 -0
  40. package/dist/src/compiled/_chunks/workflow/sleep-7TgF3i-e.js +1 -0
  41. package/dist/src/compiled/_chunks/workflow/wait-until-BPSgt1Wg.js +15 -0
  42. package/dist/src/compiled/_chunks/workflow/ws-transport-TYZ9zwoZ.js +1 -0
  43. package/dist/src/compiler/model-catalog.js +1 -1
  44. package/dist/src/compiler/normalize-agent-config.js +1 -1
  45. package/dist/src/execution/create-session-step.d.ts +1 -0
  46. package/dist/src/execution/create-session-step.js +1 -1
  47. package/dist/src/execution/dispatch-runtime-actions-shared.d.ts +1 -1
  48. package/dist/src/execution/node-step.js +1 -1
  49. package/dist/src/execution/session-callback-step.d.ts +8 -0
  50. package/dist/src/execution/session-callback-step.js +1 -1
  51. package/dist/src/execution/session.d.ts +2 -0
  52. package/dist/src/execution/session.js +1 -1
  53. package/dist/src/execution/task-event-callback.d.ts +5 -6
  54. package/dist/src/execution/task-event-callback.js +1 -1
  55. package/dist/src/execution/tasks/child/instructions.d.ts +3 -0
  56. package/dist/src/execution/tasks/child/instructions.js +1 -0
  57. package/dist/src/execution/tasks/child/steps.d.ts +7 -1
  58. package/dist/src/execution/tasks/child/steps.js +1 -1
  59. package/dist/src/execution/tasks/child/update.d.ts +10 -0
  60. package/dist/src/execution/tasks/child/update.js +1 -0
  61. package/dist/src/execution/tasks/child/workflow.d.ts +3 -3
  62. package/dist/src/execution/tasks/child/workflow.js +1 -1
  63. package/dist/src/execution/tasks/parent/agent-views.js +1 -1
  64. package/dist/src/execution/tasks/parent/control-shared.d.ts +1 -1
  65. package/dist/src/execution/tasks/parent/dispatch-task-step.d.ts +1 -1
  66. package/dist/src/execution/tasks/parent/dispatch-task-step.js +1 -1
  67. package/dist/src/execution/tasks/parent/dispatch.d.ts +5 -3
  68. package/dist/src/execution/tasks/parent/dispatch.js +1 -1
  69. package/dist/src/execution/workflow-entry.js +1 -1
  70. package/dist/src/execution/workflow-steps.js +1 -1
  71. package/dist/src/harness/advertised-tools.d.ts +3 -0
  72. package/dist/src/harness/advertised-tools.js +1 -1
  73. package/dist/src/harness/tool-loop.js +2 -2
  74. package/dist/src/internal/application/package.js +1 -1
  75. package/dist/src/internal/workflow/development-world-client.js +1 -1
  76. package/dist/src/runtime/framework-tools/index.js +1 -1
  77. package/dist/src/runtime/framework-tools/tasks.d.ts +6 -7
  78. package/dist/src/runtime/framework-tools/tasks.js +1 -1
  79. package/dist/src/runtime/prompt/compose.js +1 -1
  80. package/dist/src/runtime/session-callback-route.js +1 -1
  81. package/dist/src/setup/scaffold/create/project.js +1 -1
  82. package/dist/src/tasks/task-id.d.ts +1 -2
  83. package/dist/src/tasks/task-id.js +1 -1
  84. package/dist/src/tasks/task-inbox-token.d.ts +2 -0
  85. package/dist/src/tasks/task-inbox-token.js +1 -0
  86. package/dist/src/tasks/types.d.ts +9 -1
  87. package/dist/src/tasks/wire.d.ts +2 -3
  88. package/docs/channels/custom.mdx +1 -0
  89. package/docs/channels/mcp.mdx +185 -0
  90. package/docs/channels/meta.json +1 -0
  91. package/docs/channels/overview.mdx +6 -1
  92. package/docs/guides/auth-and-route-protection.md +1 -0
  93. package/docs/guides/dev-tui.md +1 -0
  94. package/docs/instructions.mdx +1 -0
  95. package/package.json +6 -6
  96. package/dist/src/compiled/_chunks/workflow/frames-BBs-9k1d.js +0 -3
  97. package/dist/src/compiled/_chunks/workflow/private-UQtz8ZcW.js +0 -1
  98. package/dist/src/compiled/_chunks/workflow/resume-hook-CYtSorp6.js +0 -1
  99. package/dist/src/compiled/_chunks/workflow/run-Cjo0A3NO.js +0 -1
  100. package/dist/src/compiled/_chunks/workflow/sleep-C1P0OWBm.js +0 -1
  101. package/dist/src/compiled/_chunks/workflow/wait-until-CT1ve8qB.js +0 -15
  102. package/dist/src/compiled/_chunks/workflow/ws-transport-beXxD0s_.js +0 -1
  103. package/dist/src/execution/tasks/parent/send.d.ts +0 -25
  104. package/dist/src/execution/tasks/parent/send.js +0 -1
@@ -38,15 +38,14 @@ export declare function isFirstInvocation(preloadedEvents: readonly Event[] | un
38
38
  * This replaces the `node:vm` replay path (runWorkflow + EventsConsumer)
39
39
  * with a QuickJS VM invocation that performs the same full event replay.
40
40
  *
41
- * KNOWN GAP — precondition guard: unlike the node:vm path, no event write
42
- * in this file participates in the optimistic-concurrency precondition
43
- * guard (`withPreconditionRetry` + `stateUpdatedAtForCreate`), which
44
- * protects a writer holding a stale event-log snapshot from clobbering a
45
- * concurrent one. The engine currently relies on per-(runId,
46
- * correlationId) event uniqueness (EntityConflictError dedup) alone. This
47
- * is a deliberate simplification while the engine is experimental — wiring
48
- * the guard is tracked follow-up work; anyone adding new write paths here
49
- * should not assume parity with the node engine on this axis.
41
+ * KNOWN GAP — slot snapshot: unlike the node:vm path, no event write in
42
+ * this file carries {@link CreateEventParams.eventCount}, so a World never
43
+ * learns which events the writer had not seen and never reports them back.
44
+ * The engine currently relies on per-(runId, correlationId) event
45
+ * uniqueness (EntityConflictError dedup) alone. This is a deliberate
46
+ * simplification while the engine is experimental — wiring the snapshot is
47
+ * tracked follow-up work; anyone adding new write paths here should not
48
+ * assume parity with the node engine on this axis.
50
49
  */
51
50
  export declare function runWorkflowWithQuickJS(params: {
52
51
  workflowCode: string;
@@ -1,3 +1,4 @@
1
+ import { type SlotSnapshotParams } from './helpers.js';
1
2
  /**
2
3
  * Per-invocation accounting of the *non-step* portion of a workflow
3
4
  * handler run: deterministic event-log replay, workflow-VM execution
@@ -85,5 +86,12 @@ export declare function handleReplayBudgetExhausted(args: {
85
86
  requestId: string | undefined;
86
87
  attempt: number;
87
88
  limitMs: number;
89
+ /**
90
+ * How much of the log the replay that ran out of budget had loaded. Carried
91
+ * onto the terminal write for the same reason every other write from that
92
+ * replay carries it: the run is being failed on a view of the log, and the
93
+ * World should be told which view.
94
+ */
95
+ slotSnapshot?: SlotSnapshotParams;
88
96
  }): Promise<void>;
89
97
  //# sourceMappingURL=replay-budget.d.ts.map
@@ -0,0 +1,143 @@
1
+ import type { HookResumeTiming } from '#compiled/@workflow/world/index.js';
2
+ /**
3
+ * Hook-triggered time-to-resume (TTR): wall-clock from entry into
4
+ * `resumeHook()` (T0) to the first line of the next durable step (T7), plus a
5
+ * decomposition into non-overlapping phases that sum exactly to it.
6
+ *
7
+ * ```text
8
+ * T0 resumeHook() entered
9
+ * producer_prep — hook lookup, serialization, encryption
10
+ * T1 queue publish requested
11
+ * queue_delivery — network + VQS delivery (incl. any affinity re-route)
12
+ * T2 final consumer's queue handler entered
13
+ * resume_setup — affinity check, hook_received re-ensure, replay preload
14
+ * T3 replay begins
15
+ * replay — VM/session creation and workflow replay
16
+ * T4 next durable step encountered
17
+ * step_dispatch — suspension handling, inline batch or queue dispatch
18
+ * T5 step_started request begins
19
+ * step_claim — the claim round trip
20
+ * T6 step_started response returned
21
+ * step_prepare — key resolution, argument hydration, context setup
22
+ * T7 immediately before stepFn.apply()
23
+ * ```
24
+ *
25
+ * The producer's direct `hook_received` POST races the queue publish on the
26
+ * parallel fast path, so it deliberately has no phase of its own — the two
27
+ * overlap, and representing both as additive phases would double-count. It
28
+ * remains visible as a contextual span (`hook.resume`).
29
+ *
30
+ * T0/T1 are stamped on the producer's machine and T2..T7 on the consumer's, so
31
+ * the measurement is subject to cross-machine clock skew. Rather than clamp
32
+ * (which would break the sum-equals-total property this decomposition exists
33
+ * for), a non-monotonic boundary set drops the whole sample — see
34
+ * {@link computeResumeTtrAttributes}.
35
+ */
36
+ /** What caused the resumption being measured. Only hooks are measured today. */
37
+ export type ResumeTrigger = 'hook';
38
+ /** Which `resumeHook()` dispatch path produced this resume. */
39
+ export type ResumeStrategy = 'parallel' | 'sequential';
40
+ /**
41
+ * How the consuming invocation initialized its replay state:
42
+ *
43
+ * - `hook_preload` — the hoisted `hook_received` write returned a usable
44
+ * replay preload, so neither `run_started` nor the initial `events.list` ran.
45
+ * - `run_started` — the generic `run_started` setup ran (including the fast
46
+ * path's fallback, where the hoisted write succeeded but returned no usable
47
+ * preload).
48
+ * - `event_load` — neither setup ran because the run arrived already loaded,
49
+ * so setup was a plain event load. No current path produces it (the one
50
+ * preloaded-run path, the background-step fall-through, consumes the
51
+ * tracking on its own step first); it is the honest default rather than a
52
+ * live value, and keeps the dimension total if such a path is added.
53
+ */
54
+ export type ResumeSetupSource = 'hook_preload' | 'run_started' | 'event_load';
55
+ /** Whether the measured step ran in the resuming invocation or a queued one. */
56
+ export type ResumeStepExecution = 'inline' | 'dispatched';
57
+ /**
58
+ * The resume boundaries observed so far, threaded from the queue handler into
59
+ * `executeStep`. Producer fields arrive on the queue message
60
+ * ({@link HookResumeTiming}); consumer fields are stamped by the invocation
61
+ * that replays the resume.
62
+ *
63
+ * The runtime holds at most one of these per invocation and CONSUMES it when
64
+ * it hands it to the execution that will attempt the next durable step, so a
65
+ * later step in the same invocation — or a retry of the same step — never
66
+ * re-reports the same resumption. Within one inline batch the object is
67
+ * shared by every step and the {@link ResumeTtrTracking.reported} latch picks
68
+ * the single reporter.
69
+ */
70
+ export interface ResumeTtrTracking {
71
+ trigger: ResumeTrigger;
72
+ /** Absent only if an older producer omitted it from the queue message. */
73
+ strategy?: ResumeStrategy;
74
+ /** T0 — entry into `resumeHook()`. */
75
+ resumeRequestedAtMs: number;
76
+ /** T1 — immediately before the queue publish was requested. */
77
+ queuePublishRequestedAtMs: number;
78
+ /**
79
+ * T2 — entry into the FINAL consumer's queue handler. A delivery that
80
+ * re-routes for deployment affinity never stamps this, so the re-routed hop
81
+ * stays inside `queue_delivery` where it belongs.
82
+ */
83
+ consumerStartedAtMs: number;
84
+ /** T3 — this invocation's first replay pass. */
85
+ replayStartedAtMs?: number;
86
+ /** T4 — replay first encountered a durable step after the resume. */
87
+ nextStepEncounteredAtMs?: number;
88
+ setupSource?: ResumeSetupSource;
89
+ stepExecution: ResumeStepExecution;
90
+ /**
91
+ * One-shot latch, set by the step executor once this resumption has been
92
+ * reported. Every step of an inline batch is handed the SAME tracking
93
+ * object, so the first one to reach user code takes the measurement and the
94
+ * rest see this and skip — one resumption, one sample, without pinning the
95
+ * sample to a step that may lose its create-claim and never run.
96
+ *
97
+ * Deliberately not part of {@link HookResumeTiming}: it is invocation-local
98
+ * state, and a queue message carries the boundaries, not the claim.
99
+ */
100
+ reported?: boolean;
101
+ }
102
+ /**
103
+ * Rebuild tracking from a queue message's timing object. Returns undefined for
104
+ * a message that carries none (an older producer, or any non-hook delivery) —
105
+ * the caller then simply reports no TTR.
106
+ */
107
+ export declare function resumeTrackingFromMessage(timing: HookResumeTiming | undefined, stepExecution: ResumeStepExecution): ResumeTtrTracking | undefined;
108
+ /**
109
+ * Serialize tracking back onto a queue message, for the case where the
110
+ * resuming invocation dispatches the next durable step to another invocation
111
+ * instead of running it inline. Returns undefined when the tracking is not
112
+ * complete enough to be worth forwarding.
113
+ */
114
+ export declare function resumeTimingForMessage(tracking: ResumeTtrTracking | undefined): HookResumeTiming | undefined;
115
+ /**
116
+ * Compute the TTR span attributes for a step that is the first durable step
117
+ * following a hook resume. Returns undefined — emitting nothing at all — when
118
+ * any of these hold:
119
+ *
120
+ * - the invocation carries no resume tracking (not a hook resume, or an older
121
+ * queue message with no timing);
122
+ * - this is a retry (`attempt !== 1`), which measures a re-execution rather
123
+ * than the resumption;
124
+ * - a required boundary is missing, non-finite, or out of order.
125
+ *
126
+ * `step_claim_ms` is the one phase that may be individually omitted. Under
127
+ * optimistic inline start the `step_started` claim is deliberately NOT awaited
128
+ * before the body runs, so its completion instant does not exist yet at T7;
129
+ * rather than invent one, the claim phase is dropped and `step_prepare_ms`
130
+ * spans T5→T7. The sum-equals-total property holds either way.
131
+ */
132
+ export declare function computeResumeTtrAttributes(params: {
133
+ tracking: ResumeTtrTracking | undefined;
134
+ /** The attempt number of the execution about to run. */
135
+ attempt: number;
136
+ /** T5 — `Date.now()` immediately before the `step_started` request. */
137
+ stepClaimStartedAtMs: number | undefined;
138
+ /** T6 — `Date.now()` once the `step_started` response returned. */
139
+ stepClaimCompletedAtMs: number | undefined;
140
+ /** T7 — `Date.now()` immediately before `stepFn.apply()`. */
141
+ stepCodeStartedAtMs: number;
142
+ }): Record<string, string | number> | undefined;
143
+ //# sourceMappingURL=resume-latency.d.ts.map
@@ -1,7 +1,8 @@
1
1
  import type { Event, SerializedData, World } from '#compiled/@workflow/world/index.js';
2
2
  import type { PayloadKey } from '../serialization/encryption.js';
3
- import { type PreconditionSnapshotParams } from './helpers.js';
3
+ import { type SlotSnapshotParams } from './helpers.js';
4
4
  import { ReplayRecoveryReporter } from './replay-recovery-reporter.js';
5
+ import { type ResumeTtrTracking } from './resume-latency.js';
5
6
  import { type StepLatencyTracking } from './step-latency.js';
6
7
  export declare const DEFAULT_STEP_MAX_RETRIES = 3;
7
8
  export interface StepExecutorParams {
@@ -59,20 +60,25 @@ export interface StepExecutorParams {
59
60
  */
60
61
  inlineDeltaSinceCursor?: string;
61
62
  /**
62
- * Precondition-guard snapshot of the event log the caller's replay loaded, to
63
- * attach to this step's `step_started` claim. On the lazy inline path the
64
- * claim is the step's FIRST durable write (its `step_created` is deferred),
65
- * so without this the claim would bypass the optimistic-concurrency guard
66
- * entirely: a replay working from a stale view could claim — and then commit
67
- * — a step scheduled without observing an event it never loaded. A
68
- * guard-enforcing World rejects a stale claim with `PreconditionFailedError`
63
+ * How much of the run's log the caller's replay had loaded when it scheduled
64
+ * this step, as the highest slot that log occupies. Seeds the snapshot every
65
+ * write this executor makes carries; each committed event advances it to its
66
+ * own slot, so a later write never names a position that predates an earlier
67
+ * one from the same step.
68
+ *
69
+ * It matters most on the lazy inline path, where the `step_started` claim is
70
+ * the step's FIRST durable write (its `step_created` is deferred): without a
71
+ * seed the claim would name no position at all, and a replay working from a
72
+ * stale view could claim — and then commit — a step scheduled without
73
+ * observing an event it never loaded.
74
+ *
75
+ * A World that fences rejects a stale claim with `PreconditionFailedError`
69
76
  * (412); executeStep does NOT translate that rejection (re-claiming in place
70
77
  * would still commit the stale schedule), so it propagates for the caller to
71
- * abandon the batch and restart its replay. Undefined when the guard is
72
- * disabled or the caller has no snapshot; Worlds that don't enforce the guard
73
- * ignore it.
78
+ * abandon the batch and restart its replay. Undefined for a caller with
79
+ * nothing loaded.
74
80
  */
75
- preconditionSnapshot?: PreconditionSnapshotParams;
81
+ slotSnapshot?: SlotSnapshotParams;
76
82
  /**
77
83
  * Suppress optimistic inline start for this step regardless of
78
84
  * `WORKFLOW_OPTIMISTIC_INLINE_START` / `forceOptimisticStart`: take the
@@ -111,6 +117,15 @@ export interface StepExecutorParams {
111
117
  * runtime/step-latency.ts.
112
118
  */
113
119
  latencyTracking?: StepLatencyTracking;
120
+ /**
121
+ * Hook-resume TTR telemetry: the boundaries of a hook resumption whose next
122
+ * durable step is the one this call is about to execute. When set, the
123
+ * executor closes the measurement against the `step_started` claim and the
124
+ * wall clock taken immediately before user code, and attaches the total plus
125
+ * its phase breakdown to this step's `step.execute` span. Set by the runtime
126
+ * for exactly one step per resumption — see runtime/resume-latency.ts.
127
+ */
128
+ resumeTracking?: ResumeTtrTracking;
114
129
  /**
115
130
  * Authoritative attempt number for this execution, used to bound retries
116
131
  * against `maxRetries` BEFORE the body runs. In order to also catch
@@ -1,5 +1,5 @@
1
1
  import type { Span } from '#compiled/@opentelemetry/api/index.js';
2
- import { type SerializedData, type WorkflowRun, type World } from '#compiled/@workflow/world/index.js';
2
+ import { type SerializedData, type TraceCarrier, type ValidQueueName, type WorkflowRun, type World } from '#compiled/@workflow/world/index.js';
3
3
  import type { StepInvocationQueueItem, WorkflowSuspension } from '../global.js';
4
4
  import { type LoadedEventLog } from './helpers.js';
5
5
  import { ReplayRecoveryReporter } from './replay-recovery-reporter.js';
@@ -11,12 +11,13 @@ export interface SuspensionHandlerParams {
11
11
  requestId?: string;
12
12
  /**
13
13
  * The runtime's loaded event log. Every event creation this suspension makes
14
- * is sent with the precondition snapshot derived from it, so a backend that
15
- * has recorded an event the replay did not see rejects the write with a 412
16
- * instead of accepting a divergent event. The rejection is not retried here:
17
- * the event's correlation id was minted by *this* replay's seeded sequence,
18
- * so re-committing it against a corrected log would persist an event no
19
- * correct replay produces. The caller restarts the replay instead.
14
+ * names the position it was derived from, so a backend that has recorded
15
+ * events the replay did not see can report them back on the write — or, if
16
+ * it would rather refuse than report, reject it with a 412. A rejection is
17
+ * not retried here: the event's correlation id was minted by *this* replay's
18
+ * seeded sequence, so re-committing it against a corrected log would persist
19
+ * an event no correct replay produces. The caller restarts the replay
20
+ * instead.
20
21
  */
21
22
  eventLog?: LoadedEventLog;
22
23
  /**
@@ -31,6 +32,26 @@ export interface SuspensionHandlerParams {
31
32
  runReadyBarrier?: Promise<unknown>;
32
33
  /** One-shot telemetry reporter, activated only after replay has recovered. */
33
34
  replayRecoveryReporter?: ReplayRecoveryReporter;
35
+ /**
36
+ * Resilient step dispatch: when provided (and the per-step eligibility gates
37
+ * pass — see the step ops below), each newly created non-inline step's
38
+ * `step_created` write is parallelized with its step-execution queue
39
+ * publish, and the queue message carries the serialized step input
40
+ * (`stepInput`) so the consumer can idempotently re-ensure the event if the
41
+ * direct write failed transiently. Steps queued this way are reported in
42
+ * {@link SuspensionHandlerResult.queuedStepCorrelationIds} so the caller
43
+ * skips them in its own dispatch pass. Omitted by callers that must not
44
+ * queue (terminal drain, tests) — creates then behave exactly as before.
45
+ */
46
+ stepDispatch?: {
47
+ /** The unified workflow queue this run's step messages are published to. */
48
+ queueName: ValidQueueName;
49
+ /**
50
+ * Lazily resolves the trace carrier to stamp on the step messages.
51
+ * Called at most once per suspension (memoized here).
52
+ */
53
+ getTraceCarrier: () => Promise<TraceCarrier>;
54
+ };
34
55
  }
35
56
  /**
36
57
  * Result of handling a suspension. Returns pending step items so the caller
@@ -48,6 +69,16 @@ export interface SuspensionHandlerResult {
48
69
  * into the same batch boundary.
49
70
  */
50
71
  createdStepCorrelationIds: Set<string>;
72
+ /**
73
+ * Correlation IDs of steps this suspension call already published
74
+ * step-execution queue messages for, via resilient step dispatch (the
75
+ * `step_created` write parallelized with a `stepInput`-carrying queue
76
+ * publish). The caller MUST NOT dispatch these again — the message is
77
+ * already out (a duplicate would be deduped by its idempotency key, but
78
+ * costs a wasted round-trip). Empty when {@link SuspensionHandlerParams.stepDispatch}
79
+ * was not provided or no step was eligible.
80
+ */
81
+ queuedStepCorrelationIds: Set<string>;
51
82
  /**
52
83
  * How many events this phase's writes reported back as occupying slots they
53
84
  * skipped over, already merged into the caller's `eventLog.events`. Nonzero
@@ -122,5 +153,5 @@ export interface SuspensionHandlerResult {
122
153
  * 1. Hooks are processed first to prevent race conditions with webhook receivers
123
154
  * 2. Step events and wait events are created in parallel
124
155
  */
125
- export declare function handleSuspension({ suspension, world, run, span, requestId, eventLog, runReadyBarrier, replayRecoveryReporter, }: SuspensionHandlerParams): Promise<SuspensionHandlerResult>;
156
+ export declare function handleSuspension({ suspension, world, run, span, requestId, eventLog, runReadyBarrier, replayRecoveryReporter, stepDispatch, }: SuspensionHandlerParams): Promise<SuspensionHandlerResult>;
126
157
  //# sourceMappingURL=suspension-handler.d.ts.map
@@ -9,11 +9,12 @@ type WorldSpecVersionMetadata = Pick<World, 'specVersion'>;
9
9
  * ceiling means a World built against a newer spec than this runtime knows how
10
10
  * to read.
11
11
  *
12
- * The range has a floor and a ceiling rather than a single value because a
13
- * World may opt into a spec version above the default: `world-vercel` declares
14
- * the slot-identity version so its new runs are created with slot event ids,
15
- * while every other World stays on the default. An equality check would make
16
- * this runtime refuse the adapter shipped alongside it.
12
+ * Both bounds are the same version today, so this currently admits exactly one.
13
+ * It stays written as a range because the two constants answer different
14
+ * questions and come apart while a spec bump is staged: the ceiling rises when
15
+ * this runtime learns to read the next version, the floor when that version
16
+ * becomes the one Worlds stamp. An equality check against either constant alone
17
+ * would reject a World during that window.
17
18
  */
18
19
  export declare function assertWorldSupportsRuntimeProtocol(world: WorldSpecVersionMetadata): void;
19
20
  export {};