@workflow/world-testing 5.1.1 → 5.1.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.
@@ -24464,16 +24464,24 @@ Caused by: ${options.cause.stack}`;
24464
24464
  static {
24465
24465
  __name(this, "MaxEventsExceededError");
24466
24466
  }
24467
+ /**
24468
+ * The events the runtime counted. A lower bound on the log's size when
24469
+ * {@link eventCountIsLowerBound} is set: the runtime stopped reading the
24470
+ * log once it held the limit.
24471
+ */
24467
24472
  eventCount;
24468
24473
  limit;
24474
+ eventCountIsLowerBound;
24469
24475
  constructor(eventCount, limit, options) {
24470
- super(formatErrorMessageWithDetails(`Workflow exceeded the maximum of ${limit} events per run`, {
24476
+ const eventCountIsLowerBound = options?.eventCountIsLowerBound === true;
24477
+ super(formatErrorMessageWithDetails(eventCountIsLowerBound ? `Workflow exceeded the maximum of ${limit} events per run (its event log holds at least ${eventCount} events)` : `Workflow exceeded the maximum of ${limit} events per run`, {
24471
24478
  hint: `${QUICKJS_SNAPSHOT_REMEDIATION} Alternatively, split the work into child workflows.`,
24472
24479
  slug: options?.slug ?? ERROR_SLUGS2.MAX_EVENTS_EXCEEDED
24473
24480
  }), { cause: options?.cause });
24474
24481
  this.name = "MaxEventsExceededError";
24475
24482
  this.eventCount = eventCount;
24476
24483
  this.limit = limit;
24484
+ this.eventCountIsLowerBound = eventCountIsLowerBound;
24477
24485
  }
24478
24486
  static is(value) {
24479
24487
  return isError2(value) && value.name === "MaxEventsExceededError";
@@ -25547,6 +25555,7 @@ var init_schema2 = __esm({
25547
25555
  doc TEXT NOT NULL,
25548
25556
  PRIMARY KEY (run_id, seq)
25549
25557
  ) WITHOUT ROWID;
25558
+ -- Named by INDEXED BY in storage/store.ts: dropping or renaming it breaks correlation lookups.
25550
25559
  CREATE INDEX events_by_correlation ON events (run_id, correlation_id, seq);
25551
25560
 
25552
25561
  CREATE TABLE steps (
@@ -57249,13 +57258,14 @@ function entityCursorClause2(cursor, sortOrder, timeColumn, idColumn) {
57249
57258
  params: [parsed.timeMs, parsed.timeMs, parsed.id]
57250
57259
  };
57251
57260
  }
57252
- var EVENT_READ_BATCH2, Store2, EVENT_CURSOR_PREFIX2;
57261
+ var EVENT_READ_BATCH2, EVENTS_BY_CORRELATION2, Store2, EVENT_CURSOR_PREFIX2;
57253
57262
  var init_store2 = __esm({
57254
57263
  "../world-local/dist/storage/store.js"() {
57255
57264
  "use strict";
57256
57265
  init_dist10();
57257
57266
  init_codec3();
57258
57267
  EVENT_READ_BATCH2 = 64;
57268
+ EVENTS_BY_CORRELATION2 = "events INDEXED BY events_by_correlation";
57259
57269
  __name(tagClause2, "tagClause");
57260
57270
  __name(tagParams2, "tagParams");
57261
57271
  Store2 = class {
@@ -57336,7 +57346,8 @@ var init_store2 = __esm({
57336
57346
  return row ? decode8(row.doc) : null;
57337
57347
  }
57338
57348
  findEvent(runId, correlationId, eventType) {
57339
- const row = this.db.get(`SELECT doc FROM events WHERE run_id = ? AND correlation_id = ? AND event_type = ?
57349
+ const row = this.db.get(`SELECT doc FROM ${EVENTS_BY_CORRELATION2}
57350
+ WHERE run_id = ? AND correlation_id = ? AND event_type = ?
57340
57351
  ORDER BY seq LIMIT 1`, runId, correlationId, eventType);
57341
57352
  return row ? decode8(row.doc) : null;
57342
57353
  }
@@ -57349,6 +57360,7 @@ var init_store2 = __esm({
57349
57360
  const sortOrder = options.sortOrder ?? "asc";
57350
57361
  const limit = Math.max(1, options.limit ?? 20);
57351
57362
  const after = parseEventCursor2(options.cursor);
57363
+ const source = options.correlationId === void 0 ? "events" : EVENTS_BY_CORRELATION2;
57352
57364
  const query = /* @__PURE__ */ __name((from, take) => {
57353
57365
  const clauses = ["run_id = ?"];
57354
57366
  const params = [runId];
@@ -57360,7 +57372,7 @@ var init_store2 = __esm({
57360
57372
  clauses.push(sortOrder === "asc" ? "seq > ?" : "seq < ?");
57361
57373
  params.push(from);
57362
57374
  }
57363
- return this.db.all(`SELECT seq, doc FROM events WHERE ${clauses.join(" AND ")}
57375
+ return this.db.all(`SELECT seq, doc FROM ${source} WHERE ${clauses.join(" AND ")}
57364
57376
  ORDER BY seq ${sortOrder === "asc" ? "ASC" : "DESC"} LIMIT ?`, ...params, take);
57365
57377
  }, "query");
57366
57378
  const page = /* @__PURE__ */ __name((data3, hasMore) => {
@@ -58286,10 +58298,10 @@ function createEventsStorage2(db, tag) {
58286
58298
  async list(params) {
58287
58299
  assertSafeEntityId2("runId", params.runId);
58288
58300
  const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION3;
58289
- const runRow = db.get("SELECT seq, seq_in_band FROM runs WHERE run_id = ?", params.runId);
58301
+ const runRow = store.getRunAnyTag(params.runId);
58290
58302
  const snapshot = {
58291
- seq: Number(runRow?.seq ?? 0),
58292
- seqInBand: Number(runRow?.seq_in_band ?? IN_BAND_SEQ_AT_RUN_CREATION2)
58303
+ seq: runRow?.seq ?? 0,
58304
+ seqInBand: runRow?.seqInBand ?? IN_BAND_SEQ_AT_RUN_CREATION2
58293
58305
  };
58294
58306
  const result2 = store.listEvents(params.runId, {
58295
58307
  cursor: params.pagination?.cursor,
@@ -58300,7 +58312,10 @@ function createEventsStorage2(db, tag) {
58300
58312
  return {
58301
58313
  ...result2,
58302
58314
  data: resolveData === "all" ? result2.data : result2.data.map((event) => stripEventDataRefs2(event, resolveData)),
58303
- snapshot
58315
+ snapshot,
58316
+ // The ceiling `run_started` reports, so a delivery that did not
58317
+ // write it enforces the same one.
58318
+ ...runRow ? { maxEvents: getMaxEventsForRun2(runRow.run) } : {}
58304
58319
  };
58305
58320
  },
58306
58321
  async listByCorrelationId(params) {
@@ -63051,7 +63066,7 @@ var version6;
63051
63066
  var init_version4 = __esm({
63052
63067
  "../world-vercel/dist/version.js"() {
63053
63068
  "use strict";
63054
- version6 = "5.6.0";
63069
+ version6 = "5.6.1";
63055
63070
  }
63056
63071
  });
63057
63072
 
@@ -91370,6 +91385,13 @@ function eventsV4Url2(baseUrl, input3) {
91370
91385
  const apiVersion = eventsApiVersion2(input3.specVersion, input3.executorSpecVersion);
91371
91386
  return `${baseUrl}/${apiVersion}/runs/${encodeURIComponent(input3.runId)}/events/${encodeURIComponent(input3.eventType)}`;
91372
91387
  }
91388
+ function maxEventsFromHeaders2(headers) {
91389
+ const raw = headers.get(MAX_EVENTS_HEADER2);
91390
+ if (raw === null || !DECIMAL_COUNTER2.test(raw))
91391
+ return void 0;
91392
+ const parsed = MaxEventsHeaderSchema2.safeParse(raw);
91393
+ return parsed.success ? parsed.data : void 0;
91394
+ }
91373
91395
  function snapshotFromHeaders2(headers) {
91374
91396
  const seq = headers.get(SNAPSHOT_SEQ_HEADER2);
91375
91397
  const seqInBand = headers.get(SNAPSHOT_SEQ_IN_BAND_HEADER2);
@@ -92109,12 +92131,14 @@ async function consumeEventFrameStream2(response, opName, replayEventObserver) {
92109
92131
  if (frame3.meta._end === 1) {
92110
92132
  const end = EventStreamEndSchema2.parse(frame3.meta);
92111
92133
  const snapshot = snapshotFromEnd2(end.snapshot) ?? snapshotFromHeaders2(response.headers);
92134
+ const maxEvents = maxEventsFromHeaders2(response.headers);
92112
92135
  return {
92113
92136
  kind: "complete",
92114
92137
  events,
92115
92138
  cursor: end.next ?? null,
92116
92139
  hasMore: end.hasMore,
92117
- ...snapshot ? { snapshot } : {}
92140
+ ...snapshot ? { snapshot } : {},
92141
+ ...maxEvents !== void 0 ? { maxEvents } : {}
92118
92142
  };
92119
92143
  }
92120
92144
  if (frame3.meta._error === 1) {
@@ -92281,7 +92305,8 @@ async function getWorkflowRunEventsV42(runId, params = {}, config5, replayEventO
92281
92305
  hasMore: consumed.hasMore,
92282
92306
  // Only a complete response reaches its sentinel, and the loop ends on
92283
92307
  // the first one, so this is the first snapshot the read saw.
92284
- ...consumed.kind === "complete" && consumed.snapshot ? { snapshot: consumed.snapshot } : {}
92308
+ ...consumed.kind === "complete" && consumed.snapshot ? { snapshot: consumed.snapshot } : {},
92309
+ ...consumed.kind === "complete" && consumed.maxEvents !== void 0 ? { maxEvents: consumed.maxEvents } : {}
92285
92310
  };
92286
92311
  }
92287
92312
  async function getEventsByCorrelationIdV42(correlationId, runId, params = {}, config5) {
@@ -92426,6 +92451,7 @@ var init_events_v42 = __esm({
92426
92451
  noop: CreateEventV4BodySchema2
92427
92452
  };
92428
92453
  MaxEventsHeaderSchema2 = external_exports2.coerce.number().int().positive();
92454
+ __name(maxEventsFromHeaders2, "maxEventsFromHeaders");
92429
92455
  EventLogSnapshotWireSchema2 = external_exports2.object({
92430
92456
  seq: external_exports2.number().int().nonnegative(),
92431
92457
  seqInBand: external_exports2.number().int().nonnegative()
@@ -92936,7 +92962,9 @@ async function getWorkflowRunEvents2(params, config5) {
92936
92962
  hasMore: result2.hasMore,
92937
92963
  // The in-band fence's counters, read before the listing, when the
92938
92964
  // backend reports them (see `capabilities.inBandFence` in index.ts).
92939
- ...result2.snapshot ? { snapshot: result2.snapshot } : {}
92965
+ ...result2.snapshot ? { snapshot: result2.snapshot } : {},
92966
+ // The run's event ceiling, when the backend reports it on a list.
92967
+ ...result2.maxEvents !== void 0 ? { maxEvents: result2.maxEvents } : {}
92940
92968
  };
92941
92969
  }
92942
92970
  function stepCreatedAtMeta2(event, stepCreatedAt) {
@@ -96213,7 +96241,7 @@ var init_global2 = __esm({
96213
96241
  function SemanticConvention6(...names) {
96214
96242
  return (value) => Object.fromEntries(names.map((name) => [name, value]));
96215
96243
  }
96216
- var WorkflowName2, WorkflowOperation2, WorkflowRunId6, WorkflowRunStatus2, WorkflowStartedAt2, WorkflowEventsCount2, WorkflowExecutionMode2, WorkflowDynamic2, WorkflowStartHook2, WorkflowStartHookRetentionUntil2, WorkflowStartHookOutcome2, WorkflowStartHookConflictingRunId2, WorkflowStartHookRejectionReason2, WorkflowStartHookErrorCode2, WorkflowStartHookConfirmAttempts2, WorkflowStartHookEnqueueFailed2, WorkflowStartHookTrigger2, WorkflowDynamicSourceHash2, WorkflowDynamicCodeBytes2, WorkflowDynamicCodeStorage2, WorkflowBundleCompileCacheHit2, WorkflowReplayLoadSource2, WorkflowParkedEventsCount2, WorkflowParkedEventId2, WorkflowParkedEventType2, WorkflowParkedStartHookEventsCount2, WorkflowArgumentsCount2, WorkflowResultType2, WorkflowTracePropagated2, WorkflowVm2, QuickJSOutcome2, QuickJSEventsPreloaded2, QuickJSEventsFetchedCount2, QuickJSEventsFetchedPages2, QuickJSPendingOpsCount2, QuickJSInlineSteps2, QuickJSSnapshotRestored2, QuickJSSnapshotDeltaEvents2, QuickJSSnapshotRestoreMs2, QuickJSSnapshotFallbackReason2, QuickJSSnapshotSaveMs2, QuickJSSnapshotPlaintextBytes2, QuickJSSnapshotStoredBytes2, WorkflowTraceMode2, WorkflowTurbo2, WorkflowNoopDelivery2, WorkflowSuperseded2, WorkflowDeliveryAttempt2, WorkflowDeliveryCount2, WorkflowDeliveryExitReason2, WorkflowDeliveryHandoff2, WorkflowConsecutiveFenceRefusals2, WorkflowReenqueueCount2, WorkflowReenqueueSkippedTooOld2, WorkflowReenqueueRecovery2, WorkflowErrorName2, WorkflowErrorMessage2, WorkflowErrorCode2, WorkflowStepsCreated2, WorkflowHooksCreated2, WorkflowWaitsCreated2, WorkflowStepsFailedSerialization2, WorkflowOwnedRecoverySteps2, WorkflowBackstopWakesArmed2, WorkflowInlineEarlyAdvances2, WorkflowInlineRunningAtTerminal2, WorkflowInlineDiscardedOutcomes2, WorkflowInlineSlotsHeldBack2, WorkflowDispatchRepublishSkipped2, WorkflowRouteType2, WorkflowRouteHandlerCached2, WorkflowRouteInvocationCount2, WorkflowRouteEntrypointAgeMs2, WorkflowRouteModuleBodyInitMs2, FaasInstance2, StepName2, StepId6, StepAttempt2, StepStatus2, StepMaxRetries2, StepTracePropagated2, StepTtfsMs2, StepStsoMs4, StepRsfsMs2, StepFinalSchedulingReplayMs2, StepLatencyOptimizations4, StepStartStrategy2, StepSkipped2, StepSkipReason2, StepArgumentsCount2, StepResultType2, StepErrorName2, StepErrorMessage2, StepFatalError2, StepRetryExhausted2, StepRetryTimeoutSeconds2, StepRetryWillRetry2, MessagingSystem2, MessagingDestinationName2, MessagingMessageId2, MessagingOperationType2, MessagingBatchMessageCount2, QueueOverheadMs2, DeploymentId2, WorkflowRunPinnedDeploymentId2, WorkflowDeploymentMismatchRetryCount2, WorkflowDeploymentMismatchRecovered2, WorkflowRunSpecVersion2, WorkflowRunSpecVersionSource2, WorkflowCapabilityProbeLatencyMs2, WorkflowCapabilityProbeCached2, WorkflowCapabilityProbeError2, HookToken2, HookId2, HookFound2, HookResilientResume2, HookLookupResult2, HookResumeCommitted2, HookWakePublished2, HookResilientResumeMaterialized2, HookResumeSetupSource2, StepDispatchPrologue2, StepDeliveryDecision2, StepDeliveryReason2, StepDeliveryLogRead2, StepDeliveryTimeoutSeconds2, ResumeTotalMs2, ResumeProducerPrepMs2, ResumeQueueDeliveryMs2, ResumeSetupMs2, ResumeReplayMs2, ResumeStepDispatchMs2, ResumeStepClaimMs2, ResumeStepPrepareMs2, ResumeTrigger2, ResumeStrategy2, ResumeSetupSource2, ResumeStepExecution2, WebhookHandlersTriggered2, WorkflowSuspensionState2, WorkflowSuspensionHookCount2, WorkflowSuspensionStepCount2, WorkflowSuspensionWaitCount2, HttpRequestMethod4, HttpRoute2, UrlFull4, ServerAddress4, ServerPort4, HttpResponseStatusCode4, ErrorType4, WorldParseFormat4, WorkflowEventsPagesLoaded2, QueueDeserializeTimeMs2, QueueExecutionTimeMs2, QueueSerializeTimeMs2, SerializationOperation2, SerializationCompressed2, SerializationCodec2, SerializationUncompressedBytes2, SerializationStoredBytes2, SerializationCompressionRatio2, SerializationGuestCodeExecutions2, SerializationGuestCodeDetails2, PeerService6, RpcSystem6, RpcService6, RpcMethod6, ErrorRetryable2, ErrorCategory2;
96244
+ var WorkflowName2, WorkflowOperation2, WorkflowRunId6, WorkflowRunStatus2, WorkflowStartedAt2, WorkflowEventsCount2, WorkflowExecutionMode2, WorkflowDynamic2, WorkflowStartHook2, WorkflowStartHookRetentionUntil2, WorkflowStartHookOutcome2, WorkflowStartHookConflictingRunId2, WorkflowStartHookRejectionReason2, WorkflowStartHookErrorCode2, WorkflowStartHookConfirmAttempts2, WorkflowStartHookEnqueueFailed2, WorkflowStartHookTrigger2, WorkflowDynamicSourceHash2, WorkflowDynamicCodeBytes2, WorkflowDynamicCodeStorage2, WorkflowBundleCompileCacheHit2, WorkflowReplayLoadSource2, WorkflowParkedEventsCount2, WorkflowParkedEventId2, WorkflowParkedEventType2, WorkflowParkedStartHookEventsCount2, WorkflowArgumentsCount2, WorkflowResultType2, WorkflowTracePropagated2, WorkflowVm2, QuickJSOutcome2, QuickJSEventsPreloaded2, QuickJSEventsFetchedCount2, QuickJSEventsFetchedPages2, QuickJSPendingOpsCount2, QuickJSInlineSteps2, QuickJSSnapshotRestored2, QuickJSSnapshotDeltaEvents2, QuickJSSnapshotRestoreMs2, QuickJSSnapshotFallbackReason2, QuickJSSnapshotSaveMs2, QuickJSSnapshotPlaintextBytes2, QuickJSSnapshotStoredBytes2, WorkflowTraceMode2, WorkflowTurbo2, WorkflowNoopDelivery2, WorkflowSuperseded2, WorkflowDeliveryAttempt2, WorkflowDeliveryCount2, WorkflowDeliveryExitReason2, WorkflowDeliveryHandoff2, WorkflowConsecutiveFenceRefusals2, WorkflowReenqueueCount2, WorkflowReenqueueSkippedTooOld2, WorkflowReenqueueRecovery2, WorkflowErrorName2, WorkflowErrorMessage2, WorkflowErrorCode2, WorkflowStepsCreated2, WorkflowHooksCreated2, WorkflowWaitsCreated2, WorkflowStepsFailedSerialization2, WorkflowOwnedRecoverySteps2, WorkflowBackstopWakesArmed2, WorkflowInlineEarlyAdvances2, WorkflowInlineRunningAtTerminal2, WorkflowInlineDiscardedOutcomes2, WorkflowInlineSlotsHeldBack2, WorkflowDispatchRepublishSkipped2, WorkflowRouteType2, WorkflowRouteHandlerCached2, WorkflowRouteInvocationCount2, WorkflowRouteEntrypointAgeMs2, WorkflowRouteModuleBodyInitMs2, FaasInstance2, StepName2, StepId6, StepAttempt2, StepStatus2, StepMaxRetries2, StepTracePropagated2, StepTtfsMs2, StepStsoMs4, StepRsfsMs2, StepFinalSchedulingReplayMs2, StepLatencyOptimizations4, StepStartStrategy2, StepSkipped2, StepSkipReason2, StepArgumentsCount2, StepResultType2, StepErrorName2, StepErrorMessage2, StepFatalError2, StepRetryExhausted2, StepRetryTimeoutSeconds2, StepRetryWillRetry2, MessagingSystem2, MessagingDestinationName2, MessagingMessageId2, MessagingOperationType2, MessagingBatchMessageCount2, QueueOverheadMs2, DeploymentId2, WorkflowRunPinnedDeploymentId2, WorkflowDeploymentMismatchRetryCount2, WorkflowDeploymentMismatchRecovered2, WorkflowRunSpecVersion2, WorkflowRunSpecVersionSource2, WorkflowCapabilityProbeLatencyMs2, WorkflowCapabilityProbeCached2, WorkflowCapabilityProbeError2, HookToken2, HookId2, HookFound2, HookResilientResume2, HookLookupResult2, HookResumeCommitted2, HookWakePublished2, HookResilientResumeMaterialized2, HookResumeSetupSource2, StepDispatchPrologue2, StepDeliveryDecision2, StepDeliveryReason2, StepDeliveryLogRead2, StepDeliveryTimeoutSeconds2, ResumeTotalMs2, ResumeProducerPrepMs2, ResumeQueueDeliveryMs2, ResumeSetupMs2, ResumeReplayMs2, ResumeStepDispatchMs2, ResumeStepClaimMs2, ResumeStepPrepareMs2, ResumeTrigger2, ResumeStrategy2, ResumeSetupSource2, ResumeStepExecution2, WebhookHandlersTriggered2, WorkflowSuspensionState2, WorkflowSuspensionHookCount2, WorkflowSuspensionStepCount2, WorkflowSuspensionWaitCount2, HttpRequestMethod4, HttpRoute2, UrlFull4, ServerAddress4, ServerPort4, HttpResponseStatusCode4, ErrorType4, WorldParseFormat4, WorkflowEventsPagesLoaded2, WorkflowEventsLoadStoppedAtLimit2, WorkflowEventsLimit2, QueueDeserializeTimeMs2, QueueExecutionTimeMs2, QueueSerializeTimeMs2, SerializationOperation2, SerializationCompressed2, SerializationCodec2, SerializationUncompressedBytes2, SerializationStoredBytes2, SerializationCompressionRatio2, SerializationGuestCodeExecutions2, SerializationGuestCodeDetails2, PeerService6, RpcSystem6, RpcService6, RpcMethod6, ErrorRetryable2, ErrorCategory2;
96217
96245
  var init_semantic_conventions2 = __esm({
96218
96246
  "../core/dist/telemetry/semantic-conventions.js"() {
96219
96247
  "use strict";
@@ -96370,6 +96398,8 @@ var init_semantic_conventions2 = __esm({
96370
96398
  ErrorType4 = SemanticConvention6("error.type");
96371
96399
  WorldParseFormat4 = SemanticConvention6("workflow.world.parse.format");
96372
96400
  WorkflowEventsPagesLoaded2 = SemanticConvention6("workflow.events.pages_loaded");
96401
+ WorkflowEventsLoadStoppedAtLimit2 = SemanticConvention6("workflow.events.load_stopped_at_limit");
96402
+ WorkflowEventsLimit2 = SemanticConvention6("workflow.events.limit");
96373
96403
  QueueDeserializeTimeMs2 = SemanticConvention6("workflow.queue.deserialize_time_ms");
96374
96404
  QueueExecutionTimeMs2 = SemanticConvention6("workflow.queue.execution_time_ms");
96375
96405
  QueueSerializeTimeMs2 = SemanticConvention6("workflow.queue.serialize_time_ms");
@@ -105386,7 +105416,9 @@ var init_abort_controller2 = __esm({
105386
105416
  var serialization_exports2 = {};
105387
105417
  __export(serialization_exports2, {
105388
105418
  FRAMED_STREAM_MAX_RECONNECTS: () => FRAMED_STREAM_MAX_RECONNECTS2,
105419
+ FRAMED_STREAM_MAX_STALLS_BELOW_TAIL: () => FRAMED_STREAM_MAX_STALLS_BELOW_TAIL2,
105389
105420
  FRAMED_STREAM_MAX_TOTAL_RECONNECTS: () => FRAMED_STREAM_MAX_TOTAL_RECONNECTS2,
105421
+ FRAMED_STREAM_MIN_STALL_SESSION_MS: () => FRAMED_STREAM_MIN_STALL_SESSION_MS2,
105390
105422
  SerializationFormat: () => SerializationFormat2,
105391
105423
  WorkflowServerReadableStream: () => WorkflowServerReadableStream2,
105392
105424
  WorkflowServerWritableStream: () => WorkflowServerWritableStream2,
@@ -105741,6 +105773,8 @@ function createReconnectingFramedStream2(runId, name, startIndex, prefetchEncryp
105741
105773
  let consumedFrames = 0;
105742
105774
  let reconnectCount = 0;
105743
105775
  let totalReconnectCount = 0;
105776
+ let stallsBelowTail = 0;
105777
+ let sessionStartedAt = 0;
105744
105778
  let reader;
105745
105779
  let canceled = false;
105746
105780
  let cancelReason;
@@ -105778,20 +105812,47 @@ function createReconnectingFramedStream2(runId, name, startIndex, prefetchEncryp
105778
105812
  }
105779
105813
  if (connectMs === void 0)
105780
105814
  connectMs = Date.now() - connectStart;
105815
+ sessionStartedAt = Date.now();
105781
105816
  reader = stream.getReader();
105782
105817
  return true;
105783
105818
  }
105784
105819
  __name(connect3, "connect");
105785
- async function isVerifiedComplete() {
105820
+ async function getStreamInfo() {
105786
105821
  try {
105787
105822
  const world = await getWorldLazy2();
105788
- const info = await world.streams.getInfo(runId, name);
105789
- return info.done && currentStartIndex + consumedFrames > info.tailIndex;
105823
+ return await world.streams.getInfo(runId, name);
105790
105824
  } catch {
105791
- return true;
105825
+ return void 0;
105792
105826
  }
105793
105827
  }
105828
+ __name(getStreamInfo, "getStreamInfo");
105829
+ function isVerifiedComplete(info) {
105830
+ if (!info)
105831
+ return true;
105832
+ return info.done && currentStartIndex + consumedFrames > info.tailIndex;
105833
+ }
105794
105834
  __name(isVerifiedComplete, "isVerifiedComplete");
105835
+ async function assertNotStalledAtHole(info) {
105836
+ if (consumedFrames > 0 || buffer3.length > 0) {
105837
+ stallsBelowTail = 0;
105838
+ return;
105839
+ }
105840
+ if (Date.now() - sessionStartedAt < FRAMED_STREAM_MIN_STALL_SESSION_MS2) {
105841
+ return;
105842
+ }
105843
+ const resolved = info ?? await getStreamInfo();
105844
+ if (!resolved)
105845
+ return;
105846
+ if (resolved.tailIndex < currentStartIndex) {
105847
+ stallsBelowTail = 0;
105848
+ return;
105849
+ }
105850
+ stallsBelowTail++;
105851
+ if (stallsBelowTail >= FRAMED_STREAM_MAX_STALLS_BELOW_TAIL2) {
105852
+ throw new StreamError2(`Stream "${name}" of run "${runId}" has no readable chunk at index ${currentStartIndex}, below its tail index ${resolved.tailIndex}: ${stallsBelowTail} consecutive reads from that index delivered nothing. The chunk is missing from storage; read from startIndex ${currentStartIndex + 1} or later to continue past it.`);
105853
+ }
105854
+ }
105855
+ __name(assertNotStalledAtHole, "assertNotStalledAtHole");
105795
105856
  async function reconnect() {
105796
105857
  if (canceled)
105797
105858
  return false;
@@ -105859,6 +105920,9 @@ function createReconnectingFramedStream2(runId, name, startIndex, prefetchEncryp
105859
105920
  return;
105860
105921
  }
105861
105922
  try {
105923
+ await assertNotStalledAtHole();
105924
+ if (canceled)
105925
+ return;
105862
105926
  if (!await reconnect())
105863
105927
  return;
105864
105928
  } catch (reconnectErr) {
@@ -105871,11 +105935,12 @@ function createReconnectingFramedStream2(runId, name, startIndex, prefetchEncryp
105871
105935
  return;
105872
105936
  if (result2.done || !result2.value) {
105873
105937
  reader = void 0;
105874
- const verifiedComplete = !reconnectSupported || await isVerifiedComplete();
105938
+ const info = reconnectSupported ? await getStreamInfo() : void 0;
105875
105939
  if (canceled)
105876
105940
  return;
105877
- if (!verifiedComplete) {
105941
+ if (reconnectSupported && !isVerifiedComplete(info)) {
105878
105942
  try {
105943
+ await assertNotStalledAtHole(info);
105879
105944
  if (!await reconnect())
105880
105945
  return;
105881
105946
  } catch (reconnectErr) {
@@ -107289,7 +107354,7 @@ function getStreamAndRequestRevivers2(allRevivers) {
107289
107354
  }
107290
107355
  return extra;
107291
107356
  }
107292
- var defaultUlid2, FRAME_HEADER_SIZE2, MAX_FRAME_SIZE2, WorkflowServerReadableStream2, FRAMED_STREAM_MAX_RECONNECTS2, getFramedStreamMaxReconnects2, FRAMED_STREAM_MAX_TOTAL_RECONNECTS2, getFramedStreamMaxTotalReconnects2, STREAM_FLUSH_INTERVAL_MS2, getEnvStreamFlushIntervalMs2, WorkflowServerWritableStream2, prepareReplayPayload2, STREAM_AND_REQUEST_KEYS2;
107357
+ var defaultUlid2, FRAME_HEADER_SIZE2, MAX_FRAME_SIZE2, WorkflowServerReadableStream2, FRAMED_STREAM_MAX_RECONNECTS2, getFramedStreamMaxReconnects2, FRAMED_STREAM_MAX_TOTAL_RECONNECTS2, getFramedStreamMaxTotalReconnects2, FRAMED_STREAM_MAX_STALLS_BELOW_TAIL2, FRAMED_STREAM_MIN_STALL_SESSION_MS2, STREAM_FLUSH_INTERVAL_MS2, getEnvStreamFlushIntervalMs2, WorkflowServerWritableStream2, prepareReplayPayload2, STREAM_AND_REQUEST_KEYS2;
107293
107358
  var init_serialization4 = __esm({
107294
107359
  "../core/dist/serialization.js"() {
107295
107360
  "use strict";
@@ -107418,6 +107483,8 @@ var init_serialization4 = __esm({
107418
107483
  }), "getFramedStreamMaxReconnects");
107419
107484
  FRAMED_STREAM_MAX_TOTAL_RECONNECTS2 = 1e3;
107420
107485
  getFramedStreamMaxTotalReconnects2 = /* @__PURE__ */ __name(() => envNumber2("WORKFLOW_FRAMED_STREAM_MAX_TOTAL_RECONNECTS", FRAMED_STREAM_MAX_TOTAL_RECONNECTS2, { integer: true, min: 1 }), "getFramedStreamMaxTotalReconnects");
107486
+ FRAMED_STREAM_MAX_STALLS_BELOW_TAIL2 = 3;
107487
+ FRAMED_STREAM_MIN_STALL_SESSION_MS2 = 1e4;
107421
107488
  __name(createReconnectingFramedStream2, "createReconnectingFramedStream");
107422
107489
  STREAM_FLUSH_INTERVAL_MS2 = 0;
107423
107490
  getEnvStreamFlushIntervalMs2 = /* @__PURE__ */ __name(() => {
@@ -107860,7 +107927,7 @@ var version7;
107860
107927
  var init_version5 = __esm({
107861
107928
  "../core/dist/version.js"() {
107862
107929
  "use strict";
107863
- version7 = "5.6.0";
107930
+ version7 = "5.6.1";
107864
107931
  }
107865
107932
  });
107866
107933
 
@@ -108215,6 +108282,7 @@ function withReplayDelta(params) {
108215
108282
  async function loadWorkflowRunEvents(runId, afterCursor, options) {
108216
108283
  const signal = options?.signal;
108217
108284
  const specVersion = options?.specVersion;
108285
+ const eventLimit = options?.eventLimit;
108218
108286
  const incremental = afterCursor !== void 0;
108219
108287
  return trace7("workflow.replay.load", async (span) => {
108220
108288
  span?.setAttributes({
@@ -108224,6 +108292,9 @@ async function loadWorkflowRunEvents(runId, afterCursor, options) {
108224
108292
  const loadedEvents = [];
108225
108293
  let snapshot;
108226
108294
  let snapshotTaken = false;
108295
+ let maxEvents;
108296
+ let workflowEventCount = 0;
108297
+ let stoppedAtLimit;
108227
108298
  const loadedEventIds = /* @__PURE__ */ new Set();
108228
108299
  const requestedCursors = /* @__PURE__ */ new Set();
108229
108300
  let cursor = afterCursor ?? null;
@@ -108257,6 +108328,7 @@ async function loadWorkflowRunEvents(runId, afterCursor, options) {
108257
108328
  loadedEventIds.clear();
108258
108329
  snapshotTaken = false;
108259
108330
  snapshot = void 0;
108331
+ workflowEventCount = 0;
108260
108332
  requestedCursors.clear();
108261
108333
  cursor = null;
108262
108334
  retriedWithoutCursor = true;
@@ -108268,7 +108340,15 @@ async function loadWorkflowRunEvents(runId, afterCursor, options) {
108268
108340
  snapshotTaken = true;
108269
108341
  snapshot = response.snapshot;
108270
108342
  }
108343
+ maxEvents = response.maxEvents ?? maxEvents;
108344
+ const before = loadedEvents.length;
108271
108345
  appendUniqueEvents(loadedEvents, response.data, loadedEventIds);
108346
+ if (eventLimit) {
108347
+ for (let i3 = before; i3 < loadedEvents.length; i3++) {
108348
+ if (!isSealedNoopEvent(loadedEvents[i3]))
108349
+ workflowEventCount++;
108350
+ }
108351
+ }
108272
108352
  hasMore = response.hasMore;
108273
108353
  assertEventPaginationProgress(runId, hasMore, response.cursor, requestedCursors);
108274
108354
  cursor = response.cursor ?? cursor;
@@ -108282,6 +108362,17 @@ async function loadWorkflowRunEvents(runId, afterCursor, options) {
108282
108362
  hasMore,
108283
108363
  pageMs: Date.now() - pageStart
108284
108364
  });
108365
+ const limit = eventLimit?.(maxEvents);
108366
+ if (hasMore && limit !== void 0 && workflowEventCount >= limit) {
108367
+ stoppedAtLimit = limit;
108368
+ runtimeLogger2.info("Event load stopped at the run event ceiling", {
108369
+ workflowRunId: runId,
108370
+ totalEvents: loadedEvents.length,
108371
+ workflowEvents: workflowEventCount,
108372
+ limit
108373
+ });
108374
+ break;
108375
+ }
108285
108376
  }
108286
108377
  runtimeLogger2.debug("Event load complete", {
108287
108378
  workflowRunId: runId,
@@ -108292,9 +108383,17 @@ async function loadWorkflowRunEvents(runId, afterCursor, options) {
108292
108383
  });
108293
108384
  span?.setAttributes({
108294
108385
  ...WorkflowEventsCount2(loadedEvents.length),
108295
- ...WorkflowEventsPagesLoaded2(pagesLoaded)
108386
+ ...WorkflowEventsPagesLoaded2(pagesLoaded),
108387
+ ...eventLimit ? WorkflowEventsLoadStoppedAtLimit2(stoppedAtLimit !== void 0) : {},
108388
+ ...stoppedAtLimit !== void 0 ? WorkflowEventsLimit2(stoppedAtLimit) : {}
108296
108389
  });
108297
- return snapshot === void 0 ? { events: loadedEvents, cursor } : { events: loadedEvents, cursor, snapshot };
108390
+ return {
108391
+ events: loadedEvents,
108392
+ cursor,
108393
+ ...snapshot !== void 0 ? { snapshot } : {},
108394
+ ...maxEvents !== void 0 ? { maxEvents } : {},
108395
+ ...stoppedAtLimit !== void 0 ? { stoppedAtEventLimit: stoppedAtLimit } : {}
108396
+ };
108298
108397
  });
108299
108398
  }
108300
108399
  function appendEventLog(log, appended) {
@@ -136172,13 +136271,14 @@ async function runWorkflowWithQuickJS2(params) {
136172
136271
  return written;
136173
136272
  } : void 0;
136174
136273
  let restoredEventCount = existingSnapshot?.metadata.eventCount ?? 0;
136175
- if (maxEventsLimit !== void 0 && restoredEventCount + events.length >= maxEventsLimit) {
136176
- throw new MaxEventsExceededError(restoredEventCount + events.length, maxEventsLimit);
136274
+ const workflowEventCount = events.filter((event) => !isSealedNoopEvent(event)).length;
136275
+ if (maxEventsLimit !== void 0 && restoredEventCount + workflowEventCount >= maxEventsLimit) {
136276
+ throw new MaxEventsExceededError(restoredEventCount + workflowEventCount, maxEventsLimit);
136177
136277
  }
136178
136278
  maybeWarnApproachingEventLimit({
136179
136279
  runId,
136180
136280
  workflowName,
136181
- eventCount: restoredEventCount + events.length,
136281
+ eventCount: restoredEventCount + workflowEventCount,
136182
136282
  limit: maxEventsLimit,
136183
136283
  isQuickJS: true
136184
136284
  });
@@ -136319,9 +136419,16 @@ async function runWorkflowWithQuickJS2(params) {
136319
136419
  failureName: result2.failed?.name
136320
136420
  });
136321
136421
  const seenEventIds = /* @__PURE__ */ new Set();
136422
+ const seenNoopIds = /* @__PURE__ */ new Set();
136423
+ const noteSeenEvent = /* @__PURE__ */ __name((event) => {
136424
+ if (!event.eventId)
136425
+ return;
136426
+ seenEventIds.add(event.eventId);
136427
+ if (isSealedNoopEvent(event))
136428
+ seenNoopIds.add(event.eventId);
136429
+ }, "noteSeenEvent");
136322
136430
  for (const e of events) {
136323
- if (e.eventId)
136324
- seenEventIds.add(e.eventId);
136431
+ noteSeenEvent(e);
136325
136432
  }
136326
136433
  let eventsProcessedSinceSnapshot = events.length;
136327
136434
  const executedStepIds = /* @__PURE__ */ new Set();
@@ -136382,8 +136489,7 @@ async function runWorkflowWithQuickJS2(params) {
136382
136489
  screenWrittenEvents([e], "listing");
136383
136490
  if (e.eventId && seenEventIds.has(e.eventId))
136384
136491
  continue;
136385
- if (e.eventId)
136386
- seenEventIds.add(e.eventId);
136492
+ noteSeenEvent(e);
136387
136493
  unseen.push(e);
136388
136494
  }
136389
136495
  if (response.cursor) {
@@ -136402,8 +136508,7 @@ async function runWorkflowWithQuickJS2(params) {
136402
136508
  const takeQueuedEvents = /* @__PURE__ */ __name(() => {
136403
136509
  const queued = logView.takeContiguous();
136404
136510
  for (const e of queued) {
136405
- if (e.eventId)
136406
- seenEventIds.add(e.eventId);
136511
+ noteSeenEvent(e);
136407
136512
  }
136408
136513
  noteFedOutcomes(queued);
136409
136514
  return queued;
@@ -137106,8 +137211,8 @@ async function runWorkflowWithQuickJS2(params) {
137106
137211
  let iteration = 0;
137107
137212
  while (result2.suspended && !runGone && !budget.isExhausted()) {
137108
137213
  iteration++;
137109
- if (maxEventsLimit !== void 0 && restoredEventCount + seenEventIds.size >= maxEventsLimit) {
137110
- throw new MaxEventsExceededError(restoredEventCount + seenEventIds.size, maxEventsLimit);
137214
+ if (maxEventsLimit !== void 0 && restoredEventCount + seenEventIds.size - seenNoopIds.size >= maxEventsLimit) {
137215
+ throw new MaxEventsExceededError(restoredEventCount + seenEventIds.size - seenNoopIds.size, maxEventsLimit);
137111
137216
  }
137112
137217
  if (params.inlineDeadlineMs !== void 0 && Date.now() >= params.inlineDeadlineMs) {
137113
137218
  deadlineReached = true;
@@ -137917,6 +138022,9 @@ async function runSpec9Delivery(delivery) {
137917
138022
  }
137918
138023
  return continuation.handoff && result2 === void 0 ? { timeoutSeconds: 0 } : result2;
137919
138024
  }
138025
+ function countWorkflowEvents(events) {
138026
+ return events.reduce((n, e) => isSealedNoopEvent(e) ? n : n + 1, 0);
138027
+ }
137920
138028
  async function runDelivery2(delivery, continuation) {
137921
138029
  const { workflowCode: workflowCode2, namespace, metadata, world, span, runLogger, workflowName, requestId, nextTraceCarrier, replayBudget, prefetchedRun, runSpecVersion } = delivery;
137922
138030
  let { resumeTracking } = delivery;
@@ -138162,11 +138270,18 @@ async function runDelivery2(delivery, continuation) {
138162
138270
  const fullLoad = /* @__PURE__ */ __name(async () => {
138163
138271
  const loaded = await writer.exclusive(async () => {
138164
138272
  const read5 = await loadWorkflowRunEvents(runId, void 0, {
138165
- specVersion: SPEC_VERSION_SINGLE_ORCHESTRATOR2
138273
+ specVersion: SPEC_VERSION_SINGLE_ORCHESTRATOR2,
138274
+ // A run past its ceiling fails on the first `limit` events
138275
+ // (the guard in the loop), so the rest are not read.
138276
+ eventLimit: clampMaxEvents
138166
138277
  });
138167
138278
  writer.adoptSnapshot(requireLoadSnapshot(runId, read5));
138168
138279
  return read5;
138169
138280
  });
138281
+ if (loaded.maxEvents !== void 0) {
138282
+ maxEventsLimit = clampMaxEvents(loaded.maxEvents);
138283
+ }
138284
+ logStoppedAtEventLimit = loaded.stoppedAtEventLimit !== void 0;
138170
138285
  for (const event of loaded.events) {
138171
138286
  prepareReplayEvent(event);
138172
138287
  }
@@ -138178,6 +138293,7 @@ async function runDelivery2(delivery, continuation) {
138178
138293
  logBehind = false;
138179
138294
  if (!log || log.cursor === null)
138180
138295
  return fullLoad();
138296
+ logStoppedAtEventLimit = false;
138181
138297
  const cursor = log.cursor;
138182
138298
  const page = await readWithDeadline((signal) => loadWorkflowRunEvents(runId, cursor, {
138183
138299
  signal,
@@ -138196,6 +138312,7 @@ async function runDelivery2(delivery, continuation) {
138196
138312
  }, "loadAfter");
138197
138313
  let workflowRun;
138198
138314
  let maxEventsLimit = clampMaxEvents(void 0);
138315
+ let logStoppedAtEventLimit = false;
138199
138316
  let workflowStartedAt = -1;
138200
138317
  let invocationStartedClean;
138201
138318
  let runStartedReceivedAtMs;
@@ -138616,6 +138733,10 @@ async function runDelivery2(delivery, continuation) {
138616
138733
  ) !== "continue") {
138617
138734
  return void 0;
138618
138735
  }
138736
+ if (logStoppedAtEventLimit) {
138737
+ workflowRun ??= run3;
138738
+ return await failRun(eventLimitError(log.events), "");
138739
+ }
138619
138740
  const hasRunStarted = log.events.some((event) => event.eventType === "run_started");
138620
138741
  if (!hasRunStarted) {
138621
138742
  try {
@@ -139408,6 +139529,21 @@ async function runDelivery2(delivery, continuation) {
139408
139529
  });
139409
139530
  return false;
139410
139531
  }, "lingerForExternalWork");
139532
+ const enforceEventLimit = /* @__PURE__ */ __name((events) => {
139533
+ if (maxEventsLimit === void 0)
139534
+ return;
139535
+ const workflowEventCount = countWorkflowEvents(events);
139536
+ if (workflowEventCount >= maxEventsLimit) {
139537
+ throw eventLimitError(events);
139538
+ }
139539
+ maybeWarnApproachingEventLimit({
139540
+ runId,
139541
+ workflowName,
139542
+ eventCount: workflowEventCount,
139543
+ limit: maxEventsLimit,
139544
+ isQuickJS: false
139545
+ });
139546
+ }, "enforceEventLimit");
139411
139547
  try {
139412
139548
  while (true) {
139413
139549
  loopIteration++;
@@ -139503,19 +139639,7 @@ async function runDelivery2(delivery, continuation) {
139503
139639
  forgetConsumedPosition(world, runId);
139504
139640
  return void 0;
139505
139641
  }
139506
- if (maxEventsLimit !== void 0) {
139507
- const workflowEventCount = log.events.reduce((n, e) => isSealedNoopEvent(e) ? n : n + 1, 0);
139508
- if (workflowEventCount >= maxEventsLimit) {
139509
- throw new MaxEventsExceededError(workflowEventCount, maxEventsLimit);
139510
- }
139511
- maybeWarnApproachingEventLimit({
139512
- runId,
139513
- workflowName,
139514
- eventCount: workflowEventCount,
139515
- limit: maxEventsLimit,
139516
- isQuickJS: false
139517
- });
139518
- }
139642
+ enforceEventLimit(log.events);
139519
139643
  runtimeLogger2.debug("Starting workflow execution", {
139520
139644
  workflowRunId: runId,
139521
139645
  loopIteration,
@@ -140512,6 +140636,11 @@ async function runDelivery2(delivery, continuation) {
140512
140636
  __name(recordDivergence, "recordDivergence");
140513
140637
  }
140514
140638
  __name(orchestrate, "orchestrate");
140639
+ function eventLimitError(events) {
140640
+ assert9(maxEventsLimit !== void 0, "The ceiling is known");
140641
+ return new MaxEventsExceededError(countWorkflowEvents(events), maxEventsLimit, { eventCountIsLowerBound: logStoppedAtEventLimit });
140642
+ }
140643
+ __name(eventLimitError, "eventLimitError");
140515
140644
  async function failRun(terminalError, effectiveWorkflowCode, replayDivergenceCount, extraLogFields = {}) {
140516
140645
  if (terminalError instanceof Error) {
140517
140646
  span?.recordException?.(terminalError);
@@ -140650,6 +140779,7 @@ var init_delivery2 = __esm({
140650
140779
  __name(turboRunCreatedEvent, "turboRunCreatedEvent");
140651
140780
  __name(startedFromBatch, "startedFromBatch");
140652
140781
  __name(runSpec9Delivery, "runSpec9Delivery");
140782
+ __name(countWorkflowEvents, "countWorkflowEvents");
140653
140783
  __name(runDelivery2, "runDelivery");
140654
140784
  spec9Orchestrator = {
140655
140785
  // A step message is exempt from failing the run: it is retried in place
@@ -170693,6 +170823,8 @@ var HttpResponseStatusCode;
170693
170823
  var ErrorType;
170694
170824
  var WorldParseFormat;
170695
170825
  var WorkflowEventsPagesLoaded;
170826
+ var WorkflowEventsLoadStoppedAtLimit;
170827
+ var WorkflowEventsLimit;
170696
170828
  var QueueDeserializeTimeMs;
170697
170829
  var QueueExecutionTimeMs;
170698
170830
  var QueueSerializeTimeMs;
@@ -170866,6 +170998,8 @@ var init_semantic_conventions = __esm2({
170866
170998
  ErrorType = SemanticConvention("error.type");
170867
170999
  WorldParseFormat = SemanticConvention("workflow.world.parse.format");
170868
171000
  WorkflowEventsPagesLoaded = SemanticConvention("workflow.events.pages_loaded");
171001
+ WorkflowEventsLoadStoppedAtLimit = SemanticConvention("workflow.events.load_stopped_at_limit");
171002
+ WorkflowEventsLimit = SemanticConvention("workflow.events.limit");
170869
171003
  QueueDeserializeTimeMs = SemanticConvention("workflow.queue.deserialize_time_ms");
170870
171004
  QueueExecutionTimeMs = SemanticConvention("workflow.queue.execution_time_ms");
170871
171005
  QueueSerializeTimeMs = SemanticConvention("workflow.queue.serialize_time_ms");
@@ -178623,7 +178757,7 @@ var version2;
178623
178757
  var init_version = __esm2({
178624
178758
  "../core/dist/version.js"() {
178625
178759
  "use strict";
178626
- version2 = "5.6.0";
178760
+ version2 = "5.6.1";
178627
178761
  }
178628
178762
  });
178629
178763
  function safetyCheckDelayMs(index) {
@@ -179493,6 +179627,7 @@ var init_schema = __esm2({
179493
179627
  doc TEXT NOT NULL,
179494
179628
  PRIMARY KEY (run_id, seq)
179495
179629
  ) WITHOUT ROWID;
179630
+ -- Named by INDEXED BY in storage/store.ts: dropping or renaming it breaks correlation lookups.
179496
179631
  CREATE INDEX events_by_correlation ON events (run_id, correlation_id, seq);
179497
179632
 
179498
179633
  CREATE TABLE steps (
@@ -210272,6 +210407,7 @@ function entityCursorClause(cursor, sortOrder, timeColumn, idColumn) {
210272
210407
  }
210273
210408
  __name(entityCursorClause, "entityCursorClause");
210274
210409
  var EVENT_READ_BATCH;
210410
+ var EVENTS_BY_CORRELATION;
210275
210411
  var Store;
210276
210412
  var EVENT_CURSOR_PREFIX;
210277
210413
  var init_store = __esm2({
@@ -210280,6 +210416,7 @@ var init_store = __esm2({
210280
210416
  init_dist4();
210281
210417
  init_codec();
210282
210418
  EVENT_READ_BATCH = 64;
210419
+ EVENTS_BY_CORRELATION = "events INDEXED BY events_by_correlation";
210283
210420
  __name2(tagClause, "tagClause");
210284
210421
  __name2(tagParams, "tagParams");
210285
210422
  Store = class {
@@ -210363,7 +210500,8 @@ var init_store = __esm2({
210363
210500
  return row ? decode3(row.doc) : null;
210364
210501
  }
210365
210502
  findEvent(runId, correlationId, eventType) {
210366
- const row = this.db.get(`SELECT doc FROM events WHERE run_id = ? AND correlation_id = ? AND event_type = ?
210503
+ const row = this.db.get(`SELECT doc FROM ${EVENTS_BY_CORRELATION}
210504
+ WHERE run_id = ? AND correlation_id = ? AND event_type = ?
210367
210505
  ORDER BY seq LIMIT 1`, runId, correlationId, eventType);
210368
210506
  return row ? decode3(row.doc) : null;
210369
210507
  }
@@ -210376,6 +210514,7 @@ var init_store = __esm2({
210376
210514
  const sortOrder = options.sortOrder ?? "asc";
210377
210515
  const limit = Math.max(1, options.limit ?? 20);
210378
210516
  const after = parseEventCursor(options.cursor);
210517
+ const source = options.correlationId === void 0 ? "events" : EVENTS_BY_CORRELATION;
210379
210518
  const query = /* @__PURE__ */ __name2((from, take) => {
210380
210519
  const clauses = [
210381
210520
  "run_id = ?"
@@ -210391,7 +210530,7 @@ var init_store = __esm2({
210391
210530
  clauses.push(sortOrder === "asc" ? "seq > ?" : "seq < ?");
210392
210531
  params.push(from);
210393
210532
  }
210394
- return this.db.all(`SELECT seq, doc FROM events WHERE ${clauses.join(" AND ")}
210533
+ return this.db.all(`SELECT seq, doc FROM ${source} WHERE ${clauses.join(" AND ")}
210395
210534
  ORDER BY seq ${sortOrder === "asc" ? "ASC" : "DESC"} LIMIT ?`, ...params, take);
210396
210535
  }, "query");
210397
210536
  const page = /* @__PURE__ */ __name2((data22, hasMore) => {
@@ -211398,10 +211537,10 @@ function createEventsStorage(db, tag) {
211398
211537
  async list(params) {
211399
211538
  assertSafeEntityId("runId", params.runId);
211400
211539
  const resolveData = params.resolveData ?? DEFAULT_RESOLVE_DATA_OPTION;
211401
- const runRow = db.get("SELECT seq, seq_in_band FROM runs WHERE run_id = ?", params.runId);
211540
+ const runRow = store.getRunAnyTag(params.runId);
211402
211541
  const snapshot = {
211403
- seq: Number(runRow?.seq ?? 0),
211404
- seqInBand: Number(runRow?.seq_in_band ?? IN_BAND_SEQ_AT_RUN_CREATION)
211542
+ seq: runRow?.seq ?? 0,
211543
+ seqInBand: runRow?.seqInBand ?? IN_BAND_SEQ_AT_RUN_CREATION
211405
211544
  };
211406
211545
  const result2 = store.listEvents(params.runId, {
211407
211546
  cursor: params.pagination?.cursor,
@@ -211412,7 +211551,12 @@ function createEventsStorage(db, tag) {
211412
211551
  return {
211413
211552
  ...result2,
211414
211553
  data: resolveData === "all" ? result2.data : result2.data.map((event) => stripEventDataRefs(event, resolveData)),
211415
- snapshot
211554
+ snapshot,
211555
+ // The ceiling `run_started` reports, so a delivery that did not
211556
+ // write it enforces the same one.
211557
+ ...runRow ? {
211558
+ maxEvents: getMaxEventsForRun(runRow.run)
211559
+ } : {}
211416
211560
  };
211417
211561
  },
211418
211562
  async listByCorrelationId(params) {
@@ -216338,7 +216482,7 @@ var version3;
216338
216482
  var init_version2 = __esm2({
216339
216483
  "../world-vercel/dist/version.js"() {
216340
216484
  "use strict";
216341
- version3 = "5.6.0";
216485
+ version3 = "5.6.1";
216342
216486
  }
216343
216487
  });
216344
216488
  function getQueueAgentOptions2() {
@@ -248439,6 +248583,13 @@ function eventsV4Url(baseUrl, input22) {
248439
248583
  return `${baseUrl}/${apiVersion}/runs/${encodeURIComponent(input22.runId)}/events/${encodeURIComponent(input22.eventType)}`;
248440
248584
  }
248441
248585
  __name(eventsV4Url, "eventsV4Url");
248586
+ function maxEventsFromHeaders(headers) {
248587
+ const raw = headers.get(MAX_EVENTS_HEADER);
248588
+ if (raw === null || !DECIMAL_COUNTER.test(raw)) return void 0;
248589
+ const parsed = MaxEventsHeaderSchema.safeParse(raw);
248590
+ return parsed.success ? parsed.data : void 0;
248591
+ }
248592
+ __name(maxEventsFromHeaders, "maxEventsFromHeaders");
248442
248593
  function snapshotFromHeaders(headers) {
248443
248594
  const seq = headers.get(SNAPSHOT_SEQ_HEADER);
248444
248595
  const seqInBand = headers.get(SNAPSHOT_SEQ_IN_BAND_HEADER);
@@ -249285,6 +249436,7 @@ async function consumeEventFrameStream(response, opName, replayEventObserver) {
249285
249436
  if (frame22.meta._end === 1) {
249286
249437
  const end = EventStreamEndSchema.parse(frame22.meta);
249287
249438
  const snapshot = snapshotFromEnd(end.snapshot) ?? snapshotFromHeaders(response.headers);
249439
+ const maxEvents = maxEventsFromHeaders(response.headers);
249288
249440
  return {
249289
249441
  kind: "complete",
249290
249442
  events,
@@ -249292,6 +249444,9 @@ async function consumeEventFrameStream(response, opName, replayEventObserver) {
249292
249444
  hasMore: end.hasMore,
249293
249445
  ...snapshot ? {
249294
249446
  snapshot
249447
+ } : {},
249448
+ ...maxEvents !== void 0 ? {
249449
+ maxEvents
249295
249450
  } : {}
249296
249451
  };
249297
249452
  }
@@ -249472,6 +249627,9 @@ async function getWorkflowRunEventsV4(runId, params = {}, config32, replayEventO
249472
249627
  // the first one, so this is the first snapshot the read saw.
249473
249628
  ...consumed.kind === "complete" && consumed.snapshot ? {
249474
249629
  snapshot: consumed.snapshot
249630
+ } : {},
249631
+ ...consumed.kind === "complete" && consumed.maxEvents !== void 0 ? {
249632
+ maxEvents: consumed.maxEvents
249475
249633
  } : {}
249476
249634
  };
249477
249635
  }
@@ -249650,6 +249808,7 @@ var init_events_v4 = __esm2({
249650
249808
  noop: CreateEventV4BodySchema
249651
249809
  };
249652
249810
  MaxEventsHeaderSchema = external_exports.coerce.number().int().positive();
249811
+ __name2(maxEventsFromHeaders, "maxEventsFromHeaders");
249653
249812
  EventLogSnapshotWireSchema = external_exports.object({
249654
249813
  seq: external_exports.number().int().nonnegative(),
249655
249814
  seqInBand: external_exports.number().int().nonnegative()
@@ -250251,6 +250410,10 @@ async function getWorkflowRunEvents(params, config32) {
250251
250410
  // backend reports them (see `capabilities.inBandFence` in index.ts).
250252
250411
  ...result2.snapshot ? {
250253
250412
  snapshot: result2.snapshot
250413
+ } : {},
250414
+ // The run's event ceiling, when the backend reports it on a list.
250415
+ ...result2.maxEvents !== void 0 ? {
250416
+ maxEvents: result2.maxEvents
250254
250417
  } : {}
250255
250418
  };
250256
250419
  }
@@ -253793,7 +253956,9 @@ var init_resume_hook = __esm2({
253793
253956
  var serialization_exports = {};
253794
253957
  __export2(serialization_exports, {
253795
253958
  FRAMED_STREAM_MAX_RECONNECTS: /* @__PURE__ */ __name(() => FRAMED_STREAM_MAX_RECONNECTS, "FRAMED_STREAM_MAX_RECONNECTS"),
253959
+ FRAMED_STREAM_MAX_STALLS_BELOW_TAIL: /* @__PURE__ */ __name(() => FRAMED_STREAM_MAX_STALLS_BELOW_TAIL, "FRAMED_STREAM_MAX_STALLS_BELOW_TAIL"),
253796
253960
  FRAMED_STREAM_MAX_TOTAL_RECONNECTS: /* @__PURE__ */ __name(() => FRAMED_STREAM_MAX_TOTAL_RECONNECTS, "FRAMED_STREAM_MAX_TOTAL_RECONNECTS"),
253961
+ FRAMED_STREAM_MIN_STALL_SESSION_MS: /* @__PURE__ */ __name(() => FRAMED_STREAM_MIN_STALL_SESSION_MS, "FRAMED_STREAM_MIN_STALL_SESSION_MS"),
253797
253962
  SerializationFormat: /* @__PURE__ */ __name(() => SerializationFormat, "SerializationFormat"),
253798
253963
  WorkflowServerReadableStream: /* @__PURE__ */ __name(() => WorkflowServerReadableStream, "WorkflowServerReadableStream"),
253799
253964
  WorkflowServerWritableStream: /* @__PURE__ */ __name(() => WorkflowServerWritableStream, "WorkflowServerWritableStream"),
@@ -254175,6 +254340,8 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
254175
254340
  let consumedFrames = 0;
254176
254341
  let reconnectCount = 0;
254177
254342
  let totalReconnectCount = 0;
254343
+ let stallsBelowTail = 0;
254344
+ let sessionStartedAt = 0;
254178
254345
  let reader;
254179
254346
  let canceled = false;
254180
254347
  let cancelReason;
@@ -254208,22 +254375,49 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
254208
254375
  return false;
254209
254376
  }
254210
254377
  if (connectMs === void 0) connectMs = Date.now() - connectStart;
254378
+ sessionStartedAt = Date.now();
254211
254379
  reader = stream.getReader();
254212
254380
  return true;
254213
254381
  }
254214
254382
  __name(connect22, "connect2");
254215
254383
  __name2(connect22, "connect");
254216
- async function isVerifiedComplete() {
254384
+ async function getStreamInfo() {
254217
254385
  try {
254218
254386
  const world = await getWorldLazy();
254219
- const info = await world.streams.getInfo(runId, name);
254220
- return info.done && currentStartIndex + consumedFrames > info.tailIndex;
254387
+ return await world.streams.getInfo(runId, name);
254221
254388
  } catch {
254222
- return true;
254389
+ return void 0;
254223
254390
  }
254224
254391
  }
254392
+ __name(getStreamInfo, "getStreamInfo");
254393
+ __name2(getStreamInfo, "getStreamInfo");
254394
+ function isVerifiedComplete(info) {
254395
+ if (!info) return true;
254396
+ return info.done && currentStartIndex + consumedFrames > info.tailIndex;
254397
+ }
254225
254398
  __name(isVerifiedComplete, "isVerifiedComplete");
254226
254399
  __name2(isVerifiedComplete, "isVerifiedComplete");
254400
+ async function assertNotStalledAtHole(info) {
254401
+ if (consumedFrames > 0 || buffer22.length > 0) {
254402
+ stallsBelowTail = 0;
254403
+ return;
254404
+ }
254405
+ if (Date.now() - sessionStartedAt < FRAMED_STREAM_MIN_STALL_SESSION_MS) {
254406
+ return;
254407
+ }
254408
+ const resolved = info ?? await getStreamInfo();
254409
+ if (!resolved) return;
254410
+ if (resolved.tailIndex < currentStartIndex) {
254411
+ stallsBelowTail = 0;
254412
+ return;
254413
+ }
254414
+ stallsBelowTail++;
254415
+ if (stallsBelowTail >= FRAMED_STREAM_MAX_STALLS_BELOW_TAIL) {
254416
+ throw new StreamError(`Stream "${name}" of run "${runId}" has no readable chunk at index ${currentStartIndex}, below its tail index ${resolved.tailIndex}: ${stallsBelowTail} consecutive reads from that index delivered nothing. The chunk is missing from storage; read from startIndex ${currentStartIndex + 1} or later to continue past it.`);
254417
+ }
254418
+ }
254419
+ __name(assertNotStalledAtHole, "assertNotStalledAtHole");
254420
+ __name2(assertNotStalledAtHole, "assertNotStalledAtHole");
254227
254421
  async function reconnect() {
254228
254422
  if (canceled) return false;
254229
254423
  if (reader) {
@@ -254282,6 +254476,8 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
254282
254476
  return;
254283
254477
  }
254284
254478
  try {
254479
+ await assertNotStalledAtHole();
254480
+ if (canceled) return;
254285
254481
  if (!await reconnect()) return;
254286
254482
  } catch (reconnectErr) {
254287
254483
  controller.error(reconnectErr);
@@ -254292,10 +254488,11 @@ function createReconnectingFramedStream(runId, name, startIndex, prefetchEncrypt
254292
254488
  if (canceled) return;
254293
254489
  if (result2.done || !result2.value) {
254294
254490
  reader = void 0;
254295
- const verifiedComplete = !reconnectSupported || await isVerifiedComplete();
254491
+ const info = reconnectSupported ? await getStreamInfo() : void 0;
254296
254492
  if (canceled) return;
254297
- if (!verifiedComplete) {
254493
+ if (reconnectSupported && !isVerifiedComplete(info)) {
254298
254494
  try {
254495
+ await assertNotStalledAtHole(info);
254299
254496
  if (!await reconnect()) return;
254300
254497
  } catch (reconnectErr) {
254301
254498
  controller.error(reconnectErr);
@@ -255779,6 +255976,8 @@ var FRAMED_STREAM_MAX_RECONNECTS;
255779
255976
  var getFramedStreamMaxReconnects;
255780
255977
  var FRAMED_STREAM_MAX_TOTAL_RECONNECTS;
255781
255978
  var getFramedStreamMaxTotalReconnects;
255979
+ var FRAMED_STREAM_MAX_STALLS_BELOW_TAIL;
255980
+ var FRAMED_STREAM_MIN_STALL_SESSION_MS;
255782
255981
  var STREAM_FLUSH_INTERVAL_MS;
255783
255982
  var getEnvStreamFlushIntervalMs;
255784
255983
  var WorkflowServerWritableStream;
@@ -255916,6 +256115,8 @@ var init_serialization2 = __esm2({
255916
256115
  integer: true,
255917
256116
  min: 1
255918
256117
  }), "getFramedStreamMaxTotalReconnects");
256118
+ FRAMED_STREAM_MAX_STALLS_BELOW_TAIL = 3;
256119
+ FRAMED_STREAM_MIN_STALL_SESSION_MS = 1e4;
255919
256120
  __name2(createReconnectingFramedStream, "createReconnectingFramedStream");
255920
256121
  STREAM_FLUSH_INTERVAL_MS = 0;
255921
256122
  getEnvStreamFlushIntervalMs = /* @__PURE__ */ __name2(() => {
@@ -264478,7 +264679,7 @@ __name2(start, "start");
264478
264679
  value: "start",
264479
264680
  configurable: true
264480
264681
  });
264481
- })(start, "step//@workflow/core/runtime/start@5.6.0//start");
264682
+ })(start, "step//@workflow/core/runtime/start@5.6.1//start");
264482
264683
  function isSingleOrchestratorRun(run22) {
264483
264684
  return (run22.specVersion ?? SPEC_VERSION_LEGACY) >= SPEC_VERSION_SINGLE_ORCHESTRATOR;
264484
264685
  }
@@ -265124,7 +265325,7 @@ var Run = class _Run {
265124
265325
  value: "readFinishedRunIds",
265125
265326
  configurable: true
265126
265327
  });
265127
- })(Run.readFinishedRunIds, "step//@workflow/core/runtime/run@5.6.0//Run.readFinishedRunIds");
265328
+ })(Run.readFinishedRunIds, "step//@workflow/core/runtime/run@5.6.1//Run.readFinishedRunIds");
265128
265329
  (function(__wf_fn, __wf_id) {
265129
265330
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265130
265331
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265133,7 +265334,7 @@ var Run = class _Run {
265133
265334
  value: "wakeUp",
265134
265335
  configurable: true
265135
265336
  });
265136
- })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.6.0//Run#wakeUp");
265337
+ })(Run.prototype["wakeUp"], "step//@workflow/core/runtime/run@5.6.1//Run#wakeUp");
265137
265338
  (function(__wf_fn, __wf_id) {
265138
265339
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265139
265340
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265142,7 +265343,7 @@ var Run = class _Run {
265142
265343
  value: "cancel",
265143
265344
  configurable: true
265144
265345
  });
265145
- })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.6.0//Run#cancel");
265346
+ })(Run.prototype["cancel"], "step//@workflow/core/runtime/run@5.6.1//Run#cancel");
265146
265347
  (function(__wf_fn, __wf_id) {
265147
265348
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265148
265349
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265151,7 +265352,7 @@ var Run = class _Run {
265151
265352
  value: "readReturnValue",
265152
265353
  configurable: true
265153
265354
  });
265154
- })(Run.prototype["readReturnValue"], "step//@workflow/core/runtime/run@5.6.0//Run#readReturnValue");
265355
+ })(Run.prototype["readReturnValue"], "step//@workflow/core/runtime/run@5.6.1//Run#readReturnValue");
265155
265356
  (function(__wf_fn, __wf_id) {
265156
265357
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265157
265358
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265160,7 +265361,7 @@ var Run = class _Run {
265160
265361
  value: "getReadable",
265161
265362
  configurable: true
265162
265363
  });
265163
- })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.6.0//Run#getReadable");
265364
+ })(Run.prototype["getReadable"], "step//@workflow/core/runtime/run@5.6.1//Run#getReadable");
265164
265365
  (function(__wf_fn, __wf_id) {
265165
265366
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265166
265367
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265169,7 +265370,7 @@ var Run = class _Run {
265169
265370
  value: "getWritable",
265170
265371
  configurable: true
265171
265372
  });
265172
- })(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.6.0//Run#getWritable");
265373
+ })(Run.prototype["getWritable"], "step//@workflow/core/runtime/run@5.6.1//Run#getWritable");
265173
265374
  (function(__wf_fn, __wf_id) {
265174
265375
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265175
265376
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265178,7 +265379,7 @@ var Run = class _Run {
265178
265379
  value: "exists",
265179
265380
  configurable: true
265180
265381
  });
265181
- })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.6.0//Run#exists");
265382
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "exists").get, "step//@workflow/core/runtime/run@5.6.1//Run#exists");
265182
265383
  (function(__wf_fn, __wf_id) {
265183
265384
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265184
265385
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265187,7 +265388,7 @@ var Run = class _Run {
265187
265388
  value: "status",
265188
265389
  configurable: true
265189
265390
  });
265190
- })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.6.0//Run#status");
265391
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "status").get, "step//@workflow/core/runtime/run@5.6.1//Run#status");
265191
265392
  (function(__wf_fn, __wf_id) {
265192
265393
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265193
265394
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265196,7 +265397,7 @@ var Run = class _Run {
265196
265397
  value: "workflowName",
265197
265398
  configurable: true
265198
265399
  });
265199
- })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.6.0//Run#workflowName");
265400
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "workflowName").get, "step//@workflow/core/runtime/run@5.6.1//Run#workflowName");
265200
265401
  (function(__wf_fn, __wf_id) {
265201
265402
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265202
265403
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265205,7 +265406,7 @@ var Run = class _Run {
265205
265406
  value: "createdAt",
265206
265407
  configurable: true
265207
265408
  });
265208
- })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.6.0//Run#createdAt");
265409
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "createdAt").get, "step//@workflow/core/runtime/run@5.6.1//Run#createdAt");
265209
265410
  (function(__wf_fn, __wf_id) {
265210
265411
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265211
265412
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265214,7 +265415,7 @@ var Run = class _Run {
265214
265415
  value: "startedAt",
265215
265416
  configurable: true
265216
265417
  });
265217
- })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.6.0//Run#startedAt");
265418
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "startedAt").get, "step//@workflow/core/runtime/run@5.6.1//Run#startedAt");
265218
265419
  (function(__wf_fn, __wf_id) {
265219
265420
  var __wf_sym = /* @__PURE__ */ Symbol.for("@workflow/core//registeredSteps"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265220
265421
  __wf_reg.set(__wf_id, __wf_fn);
@@ -265223,7 +265424,7 @@ var Run = class _Run {
265223
265424
  value: "completedAt",
265224
265425
  configurable: true
265225
265426
  });
265226
- })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.6.0//Run#completedAt");
265427
+ })(Object.getOwnPropertyDescriptor(Run.prototype, "completedAt").get, "step//@workflow/core/runtime/run@5.6.1//Run#completedAt");
265227
265428
  (function(__wf_cls, __wf_id) {
265228
265429
  var __wf_sym = /* @__PURE__ */ Symbol.for("workflow-class-registry"), __wf_reg = globalThis[__wf_sym] || (globalThis[__wf_sym] = /* @__PURE__ */ new Map());
265229
265430
  __wf_reg.set(__wf_id, __wf_cls);
@@ -265233,7 +265434,7 @@ var Run = class _Run {
265233
265434
  enumerable: false,
265234
265435
  configurable: false
265235
265436
  });
265236
- })(Run, "class//@workflow/core/runtime/run@5.6.0//Run");
265437
+ })(Run, "class//@workflow/core/runtime/run@5.6.1//Run");
265237
265438
  async function fetch2(...args) {
265238
265439
  return globalThis.fetch(...args);
265239
265440
  }
@@ -270427,13 +270628,13 @@ var Run = class _Run {
270427
270628
  return this.getWritable();
270428
270629
  }
270429
270630
  };
270430
- Run.readFinishedRunIds = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run.readFinishedRunIds");
270431
- Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#wakeUp");
270432
- Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#cancel");
270433
- Run.prototype["readReturnValue"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#readReturnValue");
270434
- Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#getReadable");
270435
- Run.prototype["getWritable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#getWritable");
270436
- var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#exists");
270631
+ Run.readFinishedRunIds = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run.readFinishedRunIds");
270632
+ Run.prototype["wakeUp"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#wakeUp");
270633
+ Run.prototype["cancel"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#cancel");
270634
+ Run.prototype["readReturnValue"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#readReturnValue");
270635
+ Run.prototype["getReadable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#getReadable");
270636
+ Run.prototype["getWritable"] = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#getWritable");
270637
+ var __step_Run$exists = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#exists");
270437
270638
  Object.defineProperty(Run.prototype, "exists", {
270438
270639
  get() {
270439
270640
  return __step_Run$exists.call(this);
@@ -270441,7 +270642,7 @@ Object.defineProperty(Run.prototype, "exists", {
270441
270642
  configurable: true,
270442
270643
  enumerable: false
270443
270644
  });
270444
- var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#status");
270645
+ var __step_Run$status = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#status");
270445
270646
  Object.defineProperty(Run.prototype, "status", {
270446
270647
  get() {
270447
270648
  return __step_Run$status.call(this);
@@ -270449,7 +270650,7 @@ Object.defineProperty(Run.prototype, "status", {
270449
270650
  configurable: true,
270450
270651
  enumerable: false
270451
270652
  });
270452
- var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#workflowName");
270653
+ var __step_Run$workflowName = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#workflowName");
270453
270654
  Object.defineProperty(Run.prototype, "workflowName", {
270454
270655
  get() {
270455
270656
  return __step_Run$workflowName.call(this);
@@ -270457,7 +270658,7 @@ Object.defineProperty(Run.prototype, "workflowName", {
270457
270658
  configurable: true,
270458
270659
  enumerable: false
270459
270660
  });
270460
- var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#createdAt");
270661
+ var __step_Run$createdAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#createdAt");
270461
270662
  Object.defineProperty(Run.prototype, "createdAt", {
270462
270663
  get() {
270463
270664
  return __step_Run$createdAt.call(this);
@@ -270465,7 +270666,7 @@ Object.defineProperty(Run.prototype, "createdAt", {
270465
270666
  configurable: true,
270466
270667
  enumerable: false
270467
270668
  });
270468
- var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#startedAt");
270669
+ var __step_Run$startedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#startedAt");
270469
270670
  Object.defineProperty(Run.prototype, "startedAt", {
270470
270671
  get() {
270471
270672
  return __step_Run$startedAt.call(this);
@@ -270473,7 +270674,7 @@ Object.defineProperty(Run.prototype, "startedAt", {
270473
270674
  configurable: true,
270474
270675
  enumerable: false
270475
270676
  });
270476
- var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.0//Run#completedAt");
270677
+ var __step_Run$completedAt = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/run@5.6.1//Run#completedAt");
270477
270678
  Object.defineProperty(Run.prototype, "completedAt", {
270478
270679
  get() {
270479
270680
  return __step_Run$completedAt.call(this);
@@ -270490,7 +270691,7 @@ Object.defineProperty(Run.prototype, "completedAt", {
270490
270691
  enumerable: false,
270491
270692
  configurable: false
270492
270693
  });
270493
- })(Run, "class//@workflow/core/runtime/run@5.6.0//Run");
270694
+ })(Run, "class//@workflow/core/runtime/run@5.6.1//Run");
270494
270695
 
270495
270696
  // ../core/dist/workflow/create-hook.js
270496
270697
  aliasSerializationClass(RUN_CLASS_ID, Run);
@@ -293929,7 +294130,7 @@ var latestNoOpWarning = globalSingleton("@workflow/core//latestNoOpWarning", 1,
293929
294130
  var probeMissWarning = globalSingleton("@workflow/core//crossDeploymentProbeMissWarning", 1, () => ({
293930
294131
  warned: false
293931
294132
  }));
293932
- var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.6.0//start");
294133
+ var start = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//@workflow/core/runtime/start@5.6.1//start");
293933
294134
 
293934
294135
  // workflows/lineage.ts
293935
294136
  var noop = globalThis[/* @__PURE__ */ Symbol.for("WORKFLOW_USE_STEP")]("step//./workflows/lineage//noop");