@workflow/web 5.0.0 → 5.0.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.
- package/build/client/assets/app-Cruj5elv.css +1 -0
- package/build/client/assets/{arrow-up-right-jHPcOZmb.js → arrow-up-right-CCSP9ily.js} +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-CBBI0JQ-.js → highlighted-body-B3W2YXNL-QxC_q3zz.js} +1 -1
- package/build/client/assets/{home-BcIEUw9E.js → home-D3lvKrxA.js} +27 -25
- package/build/client/assets/{loader-circle-HeezuKOU.js → loader-circle-BV40-ex9.js} +1 -1
- package/build/client/assets/{manifest-a541ae9e.js → manifest-b2d18a63.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-ClcCzUqi.js → mermaid-3ZIDBTTL-DYqrMrvl.js} +283 -193
- package/build/client/assets/root-D51qsCcK.css +1 -0
- package/build/client/assets/{root-DLS5V7HU.js → root-cIgKV8UA.js} +6 -6
- package/build/client/assets/{run-detail-DWoMKBqC.js → run-detail-xT6TzcQH.js} +4 -4
- package/build/client/assets/{workflow-graph-viewer-syfKq6DB.js → workflow-graph-viewer-DDSZhqQ2.js} +19 -8
- package/build/client/assets/{zstd-browser-decoder-D2p6f8lN.js → zstd-browser-decoder-BbUG_G04.js} +1 -1
- package/build/server/assets/{app-CLF3fhv7.js → app-DtQP9zzZ.js} +1922 -831
- package/build/server/assets/{highlighted-body-B3W2YXNL-D21NaJQ0.js → highlighted-body-B3W2YXNL-0R2gvzDD.js} +1 -1
- package/build/server/assets/{index-DnTW8Yiv.js → index-HeFIWQE6.js} +1 -1
- package/build/server/assets/{index-y9xp70jn.js → index-xhDuD_-a.js} +63 -60
- package/build/server/assets/{mermaid-3ZIDBTTL-DlUUmZjL.js → mermaid-3ZIDBTTL-Bubx0Bc0.js} +1 -1
- package/build/server/assets/{token-DXiZgST4.js → token-Dp-Ryz8o.js} +1 -1
- package/build/server/assets/{token-util-BvEnPXwK.js → token-util-D-AD5yDZ.js} +1 -1
- package/build/server/assets/{wrapper-BsMfBV09.js → wrapper-ikjqnRtL.js} +9 -9
- package/build/server/assets/{zstd-browser-decoder-d2YJZBik.js → zstd-browser-decoder-uUOME713.js} +1 -1
- package/build/server/index.js +2 -2
- package/package.json +8 -8
- package/build/client/assets/app-BIKwaF7E.css +0 -1
- package/build/client/assets/root-grl25rxS.css +0 -1
|
@@ -13088,11 +13088,11 @@ function requireReactDomServerLegacy_node_production() {
|
|
|
13088
13088
|
throw Error(
|
|
13089
13089
|
"Expected the resume to render <" + node$jscomp$0[0] + "> in this slot but instead it rendered <" + name2 + ">. The tree doesn't match so React will fallback to client rendering."
|
|
13090
13090
|
);
|
|
13091
|
-
var
|
|
13091
|
+
var childNodes2 = node$jscomp$0[2];
|
|
13092
13092
|
name2 = node$jscomp$0[3];
|
|
13093
13093
|
keyOrIndex = task.node;
|
|
13094
13094
|
task.replay = {
|
|
13095
|
-
nodes:
|
|
13095
|
+
nodes: childNodes2,
|
|
13096
13096
|
slots: name2,
|
|
13097
13097
|
pendingTasks: 1
|
|
13098
13098
|
};
|
|
@@ -13114,7 +13114,7 @@ function requireReactDomServerLegacy_node_production() {
|
|
|
13114
13114
|
abortRemainingReplayNodes(
|
|
13115
13115
|
request2,
|
|
13116
13116
|
key,
|
|
13117
|
-
|
|
13117
|
+
childNodes2,
|
|
13118
13118
|
name2,
|
|
13119
13119
|
type,
|
|
13120
13120
|
props
|
|
@@ -13168,10 +13168,10 @@ function requireReactDomServerLegacy_node_production() {
|
|
|
13168
13168
|
break b;
|
|
13169
13169
|
}
|
|
13170
13170
|
} catch (error2) {
|
|
13171
|
-
props.status = 4,
|
|
13171
|
+
props.status = 4, childNodes2 = getThrownInfo(task.componentStack), replay = logRecoverableError(
|
|
13172
13172
|
request2,
|
|
13173
13173
|
error2,
|
|
13174
|
-
|
|
13174
|
+
childNodes2
|
|
13175
13175
|
), props.errorDigest = replay, task.replay.pendingTasks--, request2.clientRenderedBoundaries.push(props);
|
|
13176
13176
|
} finally {
|
|
13177
13177
|
task.blockedBoundary = parentBoundary, task.hoistableState = parentHoistableState, task.replay = previousReplaySet, task.keyPath = prevKeyPath;
|
|
@@ -13212,8 +13212,8 @@ function requireReactDomServerLegacy_node_production() {
|
|
|
13212
13212
|
"Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render."
|
|
13213
13213
|
);
|
|
13214
13214
|
case REACT_LAZY_TYPE:
|
|
13215
|
-
|
|
13216
|
-
node2 =
|
|
13215
|
+
childNodes2 = node2._init;
|
|
13216
|
+
node2 = childNodes2(node2._payload);
|
|
13217
13217
|
if (12 === request2.status) throw null;
|
|
13218
13218
|
renderNodeDestructive(request2, task, node2, childIndex);
|
|
13219
13219
|
return;
|
|
@@ -13222,13 +13222,13 @@ function requireReactDomServerLegacy_node_production() {
|
|
|
13222
13222
|
renderChildrenArray(request2, task, node2, childIndex);
|
|
13223
13223
|
return;
|
|
13224
13224
|
}
|
|
13225
|
-
null === node2 || "object" !== typeof node2 ?
|
|
13226
|
-
if (
|
|
13227
|
-
node2 =
|
|
13225
|
+
null === node2 || "object" !== typeof node2 ? childNodes2 = null : (childNodes2 = MAYBE_ITERATOR_SYMBOL && node2[MAYBE_ITERATOR_SYMBOL] || node2["@@iterator"], childNodes2 = "function" === typeof childNodes2 ? childNodes2 : null);
|
|
13226
|
+
if (childNodes2 && (childNodes2 = childNodes2.call(node2))) {
|
|
13227
|
+
node2 = childNodes2.next();
|
|
13228
13228
|
if (!node2.done) {
|
|
13229
13229
|
props = [];
|
|
13230
13230
|
do
|
|
13231
|
-
props.push(node2.value), node2 =
|
|
13231
|
+
props.push(node2.value), node2 = childNodes2.next();
|
|
13232
13232
|
while (!node2.done);
|
|
13233
13233
|
renderChildrenArray(request2, task, props, childIndex);
|
|
13234
13234
|
}
|
|
@@ -17725,11 +17725,11 @@ function requireReactDomServer_node_production() {
|
|
|
17725
17725
|
throw Error(
|
|
17726
17726
|
"Expected the resume to render <" + node$jscomp$0[0] + "> in this slot but instead it rendered <" + name2 + ">. The tree doesn't match so React will fallback to client rendering."
|
|
17727
17727
|
);
|
|
17728
|
-
var
|
|
17728
|
+
var childNodes2 = node$jscomp$0[2];
|
|
17729
17729
|
name2 = node$jscomp$0[3];
|
|
17730
17730
|
keyOrIndex = task.node;
|
|
17731
17731
|
task.replay = {
|
|
17732
|
-
nodes:
|
|
17732
|
+
nodes: childNodes2,
|
|
17733
17733
|
slots: name2,
|
|
17734
17734
|
pendingTasks: 1
|
|
17735
17735
|
};
|
|
@@ -17751,7 +17751,7 @@ function requireReactDomServer_node_production() {
|
|
|
17751
17751
|
abortRemainingReplayNodes(
|
|
17752
17752
|
request2,
|
|
17753
17753
|
key,
|
|
17754
|
-
|
|
17754
|
+
childNodes2,
|
|
17755
17755
|
name2,
|
|
17756
17756
|
type,
|
|
17757
17757
|
props
|
|
@@ -17805,10 +17805,10 @@ function requireReactDomServer_node_production() {
|
|
|
17805
17805
|
break b;
|
|
17806
17806
|
}
|
|
17807
17807
|
} catch (error2) {
|
|
17808
|
-
props.status = 4,
|
|
17808
|
+
props.status = 4, childNodes2 = getThrownInfo(task.componentStack), replay = logRecoverableError(
|
|
17809
17809
|
request2,
|
|
17810
17810
|
error2,
|
|
17811
|
-
|
|
17811
|
+
childNodes2
|
|
17812
17812
|
), props.errorDigest = replay, task.replay.pendingTasks--, request2.clientRenderedBoundaries.push(props);
|
|
17813
17813
|
} finally {
|
|
17814
17814
|
task.blockedBoundary = parentBoundary, task.hoistableState = parentHoistableState, task.replay = previousReplaySet, task.keyPath = prevKeyPath;
|
|
@@ -17849,8 +17849,8 @@ function requireReactDomServer_node_production() {
|
|
|
17849
17849
|
"Portals are not currently supported by the server renderer. Render them conditionally so that they only appear on the client render."
|
|
17850
17850
|
);
|
|
17851
17851
|
case REACT_LAZY_TYPE:
|
|
17852
|
-
|
|
17853
|
-
node2 =
|
|
17852
|
+
childNodes2 = node2._init;
|
|
17853
|
+
node2 = childNodes2(node2._payload);
|
|
17854
17854
|
if (12 === request2.status) throw null;
|
|
17855
17855
|
renderNodeDestructive(request2, task, node2, childIndex);
|
|
17856
17856
|
return;
|
|
@@ -17859,13 +17859,13 @@ function requireReactDomServer_node_production() {
|
|
|
17859
17859
|
renderChildrenArray(request2, task, node2, childIndex);
|
|
17860
17860
|
return;
|
|
17861
17861
|
}
|
|
17862
|
-
null === node2 || "object" !== typeof node2 ?
|
|
17863
|
-
if (
|
|
17864
|
-
node2 =
|
|
17862
|
+
null === node2 || "object" !== typeof node2 ? childNodes2 = null : (childNodes2 = MAYBE_ITERATOR_SYMBOL && node2[MAYBE_ITERATOR_SYMBOL] || node2["@@iterator"], childNodes2 = "function" === typeof childNodes2 ? childNodes2 : null);
|
|
17863
|
+
if (childNodes2 && (childNodes2 = childNodes2.call(node2))) {
|
|
17864
|
+
node2 = childNodes2.next();
|
|
17865
17865
|
if (!node2.done) {
|
|
17866
17866
|
props = [];
|
|
17867
17867
|
do
|
|
17868
|
-
props.push(node2.value), node2 =
|
|
17868
|
+
props.push(node2.value), node2 = childNodes2.next();
|
|
17869
17869
|
while (!node2.done);
|
|
17870
17870
|
renderChildrenArray(request2, task, props, childIndex);
|
|
17871
17871
|
}
|
|
@@ -23099,10 +23099,10 @@ function requireReactDomServerLegacy_node_development() {
|
|
|
23099
23099
|
throw Error(
|
|
23100
23100
|
"Expected the resume to render <" + node2[0] + "> in this slot but instead it rendered <" + name2 + ">. The tree doesn't match so React will fallback to client rendering."
|
|
23101
23101
|
);
|
|
23102
|
-
var
|
|
23102
|
+
var childNodes2 = node2[2];
|
|
23103
23103
|
node2 = node2[3];
|
|
23104
23104
|
name2 = task.node;
|
|
23105
|
-
task.replay = { nodes:
|
|
23105
|
+
task.replay = { nodes: childNodes2, slots: node2, pendingTasks: 1 };
|
|
23106
23106
|
try {
|
|
23107
23107
|
renderElement(request2, task, keyPath, type, props, ref2);
|
|
23108
23108
|
if (1 === task.replay.pendingTasks && 0 < task.replay.nodes.length)
|
|
@@ -23123,7 +23123,7 @@ function requireReactDomServerLegacy_node_development() {
|
|
|
23123
23123
|
abortRemainingReplayNodes(
|
|
23124
23124
|
props,
|
|
23125
23125
|
request2,
|
|
23126
|
-
|
|
23126
|
+
childNodes2,
|
|
23127
23127
|
ref2,
|
|
23128
23128
|
keyPath,
|
|
23129
23129
|
node2,
|
|
@@ -23175,12 +23175,12 @@ function requireReactDomServerLegacy_node_development() {
|
|
|
23175
23175
|
break a;
|
|
23176
23176
|
}
|
|
23177
23177
|
} catch (error2) {
|
|
23178
|
-
props.status = CLIENT_RENDERED,
|
|
23178
|
+
props.status = CLIENT_RENDERED, childNodes2 = getThrownInfo(task.componentStack), replay = logRecoverableError(
|
|
23179
23179
|
request2,
|
|
23180
23180
|
error2,
|
|
23181
|
-
|
|
23181
|
+
childNodes2,
|
|
23182
23182
|
task.debugTask
|
|
23183
|
-
), encodeErrorForBoundary(props, replay, error2,
|
|
23183
|
+
), encodeErrorForBoundary(props, replay, error2, childNodes2, false), task.replay.pendingTasks--, request2.clientRenderedBoundaries.push(props);
|
|
23184
23184
|
} finally {
|
|
23185
23185
|
task.blockedBoundary = parentBoundary, task.hoistableState = parentHoistableState, task.replay = previousReplaySet, task.keyPath = prevKeyPath;
|
|
23186
23186
|
}
|
|
@@ -29727,10 +29727,10 @@ function requireReactDomServer_node_development() {
|
|
|
29727
29727
|
throw Error(
|
|
29728
29728
|
"Expected the resume to render <" + node2[0] + "> in this slot but instead it rendered <" + name2 + ">. The tree doesn't match so React will fallback to client rendering."
|
|
29729
29729
|
);
|
|
29730
|
-
var
|
|
29730
|
+
var childNodes2 = node2[2];
|
|
29731
29731
|
node2 = node2[3];
|
|
29732
29732
|
name2 = task.node;
|
|
29733
|
-
task.replay = { nodes:
|
|
29733
|
+
task.replay = { nodes: childNodes2, slots: node2, pendingTasks: 1 };
|
|
29734
29734
|
try {
|
|
29735
29735
|
renderElement(request2, task, keyPath, type, props, ref2);
|
|
29736
29736
|
if (1 === task.replay.pendingTasks && 0 < task.replay.nodes.length)
|
|
@@ -29751,7 +29751,7 @@ function requireReactDomServer_node_development() {
|
|
|
29751
29751
|
abortRemainingReplayNodes(
|
|
29752
29752
|
props,
|
|
29753
29753
|
request2,
|
|
29754
|
-
|
|
29754
|
+
childNodes2,
|
|
29755
29755
|
ref2,
|
|
29756
29756
|
keyPath,
|
|
29757
29757
|
node2,
|
|
@@ -29803,12 +29803,12 @@ function requireReactDomServer_node_development() {
|
|
|
29803
29803
|
break a;
|
|
29804
29804
|
}
|
|
29805
29805
|
} catch (error2) {
|
|
29806
|
-
props.status = CLIENT_RENDERED,
|
|
29806
|
+
props.status = CLIENT_RENDERED, childNodes2 = getThrownInfo(task.componentStack), replay = logRecoverableError(
|
|
29807
29807
|
request2,
|
|
29808
29808
|
error2,
|
|
29809
|
-
|
|
29809
|
+
childNodes2,
|
|
29810
29810
|
task.debugTask
|
|
29811
|
-
), encodeErrorForBoundary(props, replay, error2,
|
|
29811
|
+
), encodeErrorForBoundary(props, replay, error2, childNodes2, false), task.replay.pendingTasks--, request2.clientRenderedBoundaries.push(props);
|
|
29812
29812
|
} finally {
|
|
29813
29813
|
task.blockedBoundary = parentBoundary, task.hoistableState = parentHoistableState, task.replay = previousReplaySet, task.keyPath = prevKeyPath;
|
|
29814
29814
|
}
|
|
@@ -48825,6 +48825,11 @@ const HookResumeContextSchema = compile(object$1({
|
|
|
48825
48825
|
// Named `runSpecVersion` to distinguish it from the hook's own `specVersion`.
|
|
48826
48826
|
runSpecVersion: number$3().optional(),
|
|
48827
48827
|
workflowCoreVersion: string$2().optional(),
|
|
48828
|
+
// Node.js version of the run's creating deployment, mirrored from
|
|
48829
|
+
// `executionContext.nodeVersion`. Decides whether a resume may write zstd
|
|
48830
|
+
// (which needs Node.js >= 22.15) or must use gzip. Absent on runs created
|
|
48831
|
+
// before the field existed and on non-Node runtimes, where writers use gzip.
|
|
48832
|
+
nodeVersion: string$2().optional(),
|
|
48828
48833
|
traceCarrier: TraceCarrierSchema.optional(),
|
|
48829
48834
|
// The run's published X25519 public key (base64), mirrored from the run
|
|
48830
48835
|
// entity. Lets a resume seal (`encp`) its payload to the run without reading
|
|
@@ -49002,6 +49007,115 @@ function eventIdToSlot(eventId) {
|
|
|
49002
49007
|
const slot = Number(body2);
|
|
49003
49008
|
return Number.isSafeInteger(slot) && slot >= FIRST_EVENT_SLOT ? slot : null;
|
|
49004
49009
|
}
|
|
49010
|
+
const SnapshotMetadataSchema = object$1({
|
|
49011
|
+
/**
|
|
49012
|
+
* Pagination cursor for events.list() — the snapshot was taken at
|
|
49013
|
+
* this point in the event log. On restore, only events AFTER this
|
|
49014
|
+
* cursor need to be fetched.
|
|
49015
|
+
*/
|
|
49016
|
+
eventsCursor: string$2().nullable(),
|
|
49017
|
+
/** Timestamp when the snapshot was created */
|
|
49018
|
+
createdAt: date$2(),
|
|
49019
|
+
/**
|
|
49020
|
+
* Number of events the run had processed when the snapshot was taken.
|
|
49021
|
+
* Restores see only the delta after `eventsCursor`, so guards that need
|
|
49022
|
+
* the TOTAL log size (the server-supplied max-events ceiling) add this
|
|
49023
|
+
* to the delta. Optional for snapshots written before the field existed
|
|
49024
|
+
* (treated as 0 — the ceiling degrades to delta-only for those, exactly
|
|
49025
|
+
* the pre-field behavior).
|
|
49026
|
+
*/
|
|
49027
|
+
eventCount: number$3().int().nonnegative().optional(),
|
|
49028
|
+
/**
|
|
49029
|
+
* Number of draws the run's seeded PRNG had consumed when the snapshot
|
|
49030
|
+
* was taken. On restore the runtime re-seeds from the run's BASE seed
|
|
49031
|
+
* and fast-forwards this many draws, so correlation-id generation
|
|
49032
|
+
* continues at the exact position full replay would have reached —
|
|
49033
|
+
* keeping ids identical across snapshot generations AND identical to a
|
|
49034
|
+
* no-snapshot run (which is what makes concurrent invocations restored
|
|
49035
|
+
* from different snapshots of the same run still collide on the world's
|
|
49036
|
+
* per-(runId, correlationId) dedup).
|
|
49037
|
+
*/
|
|
49038
|
+
rngDraws: number$3().int().nonnegative().optional(),
|
|
49039
|
+
/**
|
|
49040
|
+
* Snapshot-portable token of the engine's host-serde capture root: the
|
|
49041
|
+
* container of pristine intrinsics/samples/symbols captured before any
|
|
49042
|
+
* user code ran, whose box lives inside the snapshot's memory image. A
|
|
49043
|
+
* restore re-adopts it by this token so serde initialization executes
|
|
49044
|
+
* no guest code after user code has run. Required to restore (format
|
|
49045
|
+
* version >= 2); snapshots without it are treated as a miss.
|
|
49046
|
+
*/
|
|
49047
|
+
serdeRootPtr: number$3().int().optional(),
|
|
49048
|
+
/**
|
|
49049
|
+
* The monotonic correlation-id ULID factory's last output when the
|
|
49050
|
+
* snapshot was taken (undefined if the run had drawn none). The
|
|
49051
|
+
* factory's state lives host-side and does not survive into the memory
|
|
49052
|
+
* image; on restore the runtime continues the sequence from this value
|
|
49053
|
+
* (same-timestamp base32 increment), so a restored invocation emits
|
|
49054
|
+
* the exact ids a full replay would — keeping concurrent invocations
|
|
49055
|
+
* of the same run dedupable via per-(runId, correlationId) uniqueness.
|
|
49056
|
+
*/
|
|
49057
|
+
lastUlid: string$2().optional(),
|
|
49058
|
+
/**
|
|
49059
|
+
* Exact engine build (quickjs-wasi package version) that captured the
|
|
49060
|
+
* heap image. The image's own QJSS header is identical across builds,
|
|
49061
|
+
* so restoring under a different build would pass deserialization and
|
|
49062
|
+
* execute as undefined behavior in the interpreter — a real hazard
|
|
49063
|
+
* during a rolling deploy that bumps quickjs-wasi, when live snapshots
|
|
49064
|
+
* from the old build meet instances running the new one. Readers MUST
|
|
49065
|
+
* treat a mismatch (or absence) as a clean miss.
|
|
49066
|
+
*/
|
|
49067
|
+
engineVersion: string$2().optional(),
|
|
49068
|
+
/**
|
|
49069
|
+
* The deterministic replay clock's high-water mark (ms since epoch) at
|
|
49070
|
+
* capture. The clock lives host-side; without this a restored VM's
|
|
49071
|
+
* `Date.now()` regresses to the run-creation time until the first
|
|
49072
|
+
* delta event advances it, so restores initialize the clock to
|
|
49073
|
+
* `max(derived, clockMs)`.
|
|
49074
|
+
*/
|
|
49075
|
+
clockMs: number$3().optional(),
|
|
49076
|
+
/**
|
|
49077
|
+
* Snapshot format tag. A reader that doesn't recognize the version
|
|
49078
|
+
* treats the snapshot as a clean miss (full replay) instead of handing
|
|
49079
|
+
* an incompatible heap to the WASM engine.
|
|
49080
|
+
*/
|
|
49081
|
+
formatVersion: number$3().int().optional()
|
|
49082
|
+
});
|
|
49083
|
+
const ENVELOPE_MAGIC = [87, 83, 78, 80];
|
|
49084
|
+
const ENVELOPE_VERSION = 1;
|
|
49085
|
+
const ENVELOPE_HEADER_LEN = 9;
|
|
49086
|
+
function encodeSnapshotEnvelope(metadata, data2) {
|
|
49087
|
+
const metaBytes = new TextEncoder().encode(JSON.stringify(metadata));
|
|
49088
|
+
const out = new Uint8Array(ENVELOPE_HEADER_LEN + metaBytes.length + data2.length);
|
|
49089
|
+
out.set(ENVELOPE_MAGIC, 0);
|
|
49090
|
+
out[4] = ENVELOPE_VERSION;
|
|
49091
|
+
new DataView(out.buffer).setUint32(5, metaBytes.length, true);
|
|
49092
|
+
out.set(metaBytes, ENVELOPE_HEADER_LEN);
|
|
49093
|
+
out.set(data2, ENVELOPE_HEADER_LEN + metaBytes.length);
|
|
49094
|
+
return out;
|
|
49095
|
+
}
|
|
49096
|
+
function decodeSnapshotEnvelope(bytes) {
|
|
49097
|
+
if (bytes.length < ENVELOPE_HEADER_LEN)
|
|
49098
|
+
return null;
|
|
49099
|
+
for (let i = 0; i < ENVELOPE_MAGIC.length; i++) {
|
|
49100
|
+
if (bytes[i] !== ENVELOPE_MAGIC[i])
|
|
49101
|
+
return null;
|
|
49102
|
+
}
|
|
49103
|
+
if (bytes[4] !== ENVELOPE_VERSION)
|
|
49104
|
+
return null;
|
|
49105
|
+
const metaLen = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength).getUint32(5, true);
|
|
49106
|
+
if (ENVELOPE_HEADER_LEN + metaLen > bytes.length)
|
|
49107
|
+
return null;
|
|
49108
|
+
try {
|
|
49109
|
+
const metaJson = new TextDecoder().decode(bytes.subarray(ENVELOPE_HEADER_LEN, ENVELOPE_HEADER_LEN + metaLen));
|
|
49110
|
+
const metadata = SnapshotMetadataSchema.passthrough().parse(JSON.parse(metaJson));
|
|
49111
|
+
return {
|
|
49112
|
+
metadata,
|
|
49113
|
+
data: bytes.subarray(ENVELOPE_HEADER_LEN + metaLen)
|
|
49114
|
+
};
|
|
49115
|
+
} catch {
|
|
49116
|
+
return null;
|
|
49117
|
+
}
|
|
49118
|
+
}
|
|
49005
49119
|
const SPEC_VERSION_LEGACY = 1;
|
|
49006
49120
|
const SPEC_VERSION_SUPPORTS_EVENT_SOURCING = 2;
|
|
49007
49121
|
const SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT = 3;
|
|
@@ -52689,6 +52803,13 @@ function requireMs() {
|
|
|
52689
52803
|
var msExports = requireMs();
|
|
52690
52804
|
const ms = /* @__PURE__ */ getDefaultExportFromCjs(msExports);
|
|
52691
52805
|
function parseDurationToDate(param) {
|
|
52806
|
+
const date2 = durationToDate(param);
|
|
52807
|
+
if (Number.isNaN(date2.getTime())) {
|
|
52808
|
+
throw new Error(typeof param === "object" ? "Invalid date: the Date object does not hold a valid time." : `Invalid duration: ${JSON.stringify(param)} ends past the latest time a Date can represent.`);
|
|
52809
|
+
}
|
|
52810
|
+
return date2;
|
|
52811
|
+
}
|
|
52812
|
+
function durationToDate(param) {
|
|
52692
52813
|
if (typeof param === "string") {
|
|
52693
52814
|
const durationMs = ms(param);
|
|
52694
52815
|
if (typeof durationMs !== "number" || durationMs < 0) {
|
|
@@ -55132,7 +55253,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
55132
55253
|
}
|
|
55133
55254
|
async function hydrateResourceIOAsync(resource, key) {
|
|
55134
55255
|
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
55135
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
55256
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-uUOME713.js");
|
|
55136
55257
|
ensureZstdDecoderRegistered();
|
|
55137
55258
|
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
55138
55259
|
const revivers = getRevivers();
|
|
@@ -56844,47 +56965,201 @@ function CollapsibleContent({ children: children2, className }) {
|
|
|
56844
56965
|
function Collapsible({ label, children: children2, disabled, defaultOpen, onOpenChange }) {
|
|
56845
56966
|
return jsxRuntimeExports.jsxs(CollapsibleRoot, { disabled, defaultOpen, onOpenChange, children: [jsxRuntimeExports.jsx(CollapsibleTrigger, { children: label }), children2 != null && jsxRuntimeExports.jsx(CollapsibleContent, { children: children2 })] });
|
|
56846
56967
|
}
|
|
56847
|
-
|
|
56848
|
-
|
|
56849
|
-
|
|
56850
|
-
|
|
56851
|
-
|
|
56852
|
-
|
|
56968
|
+
function setRef(ref2, value) {
|
|
56969
|
+
if (typeof ref2 === "function") {
|
|
56970
|
+
return ref2(value);
|
|
56971
|
+
} else if (ref2 !== null && ref2 !== void 0) {
|
|
56972
|
+
ref2.current = value;
|
|
56973
|
+
}
|
|
56974
|
+
}
|
|
56975
|
+
function composeRefs(...refs) {
|
|
56976
|
+
return (node2) => {
|
|
56977
|
+
let hasCleanup = false;
|
|
56978
|
+
const cleanups = refs.map((ref2) => {
|
|
56979
|
+
const cleanup = setRef(ref2, node2);
|
|
56980
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
56981
|
+
hasCleanup = true;
|
|
56982
|
+
}
|
|
56983
|
+
return cleanup;
|
|
56984
|
+
});
|
|
56985
|
+
if (hasCleanup) {
|
|
56986
|
+
return () => {
|
|
56987
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
56988
|
+
const cleanup = cleanups[i];
|
|
56989
|
+
if (typeof cleanup == "function") {
|
|
56990
|
+
cleanup();
|
|
56991
|
+
} else {
|
|
56992
|
+
setRef(refs[i], null);
|
|
56993
|
+
}
|
|
56994
|
+
}
|
|
56995
|
+
};
|
|
56996
|
+
}
|
|
56997
|
+
};
|
|
56998
|
+
}
|
|
56999
|
+
function useComposedRefs(...refs) {
|
|
57000
|
+
return reactExports.useCallback(composeRefs(...refs), refs);
|
|
57001
|
+
}
|
|
57002
|
+
var Slot$3 = reactExports.forwardRef((props, forwardedRef) => {
|
|
57003
|
+
const { children: children2, ...slotProps } = props;
|
|
57004
|
+
const childrenArray = reactExports.Children.toArray(children2);
|
|
57005
|
+
const slottable = childrenArray.find(isSlottable$1);
|
|
57006
|
+
if (slottable) {
|
|
57007
|
+
const newElement = slottable.props.children;
|
|
57008
|
+
const newChildren = childrenArray.map((child) => {
|
|
57009
|
+
if (child === slottable) {
|
|
57010
|
+
if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
|
|
57011
|
+
return reactExports.isValidElement(newElement) ? newElement.props.children : null;
|
|
57012
|
+
} else {
|
|
57013
|
+
return child;
|
|
57014
|
+
}
|
|
57015
|
+
});
|
|
57016
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone$1, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
|
|
57017
|
+
}
|
|
57018
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone$1, { ...slotProps, ref: forwardedRef, children: children2 });
|
|
57019
|
+
});
|
|
57020
|
+
Slot$3.displayName = "Slot";
|
|
57021
|
+
var SlotClone$1 = reactExports.forwardRef((props, forwardedRef) => {
|
|
57022
|
+
const { children: children2, ...slotProps } = props;
|
|
57023
|
+
if (reactExports.isValidElement(children2)) {
|
|
57024
|
+
const childrenRef = getElementRef$2(children2);
|
|
57025
|
+
return reactExports.cloneElement(children2, {
|
|
57026
|
+
...mergeProps$1(slotProps, children2.props),
|
|
57027
|
+
// @ts-ignore
|
|
57028
|
+
ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef
|
|
57029
|
+
});
|
|
57030
|
+
}
|
|
57031
|
+
return reactExports.Children.count(children2) > 1 ? reactExports.Children.only(null) : null;
|
|
57032
|
+
});
|
|
57033
|
+
SlotClone$1.displayName = "SlotClone";
|
|
57034
|
+
var Slottable$1 = ({ children: children2 }) => {
|
|
57035
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children2 });
|
|
57036
|
+
};
|
|
57037
|
+
function isSlottable$1(child) {
|
|
57038
|
+
return reactExports.isValidElement(child) && child.type === Slottable$1;
|
|
57039
|
+
}
|
|
57040
|
+
function mergeProps$1(slotProps, childProps) {
|
|
57041
|
+
const overrideProps = { ...childProps };
|
|
57042
|
+
for (const propName in childProps) {
|
|
57043
|
+
const slotPropValue = slotProps[propName];
|
|
57044
|
+
const childPropValue = childProps[propName];
|
|
57045
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
57046
|
+
if (isHandler) {
|
|
57047
|
+
if (slotPropValue && childPropValue) {
|
|
57048
|
+
overrideProps[propName] = (...args) => {
|
|
57049
|
+
childPropValue(...args);
|
|
57050
|
+
slotPropValue(...args);
|
|
57051
|
+
};
|
|
57052
|
+
} else if (slotPropValue) {
|
|
57053
|
+
overrideProps[propName] = slotPropValue;
|
|
57054
|
+
}
|
|
57055
|
+
} else if (propName === "style") {
|
|
57056
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
57057
|
+
} else if (propName === "className") {
|
|
57058
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
57059
|
+
}
|
|
57060
|
+
}
|
|
57061
|
+
return { ...slotProps, ...overrideProps };
|
|
57062
|
+
}
|
|
57063
|
+
function getElementRef$2(element2) {
|
|
57064
|
+
var _a3, _b2;
|
|
57065
|
+
let getter = (_a3 = Object.getOwnPropertyDescriptor(element2.props, "ref")) == null ? void 0 : _a3.get;
|
|
57066
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
57067
|
+
if (mayWarn) {
|
|
57068
|
+
return element2.ref;
|
|
57069
|
+
}
|
|
57070
|
+
getter = (_b2 = Object.getOwnPropertyDescriptor(element2, "ref")) == null ? void 0 : _b2.get;
|
|
57071
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
57072
|
+
if (mayWarn) {
|
|
57073
|
+
return element2.props.ref;
|
|
57074
|
+
}
|
|
57075
|
+
return element2.props.ref || element2.ref;
|
|
57076
|
+
}
|
|
57077
|
+
var Root$6 = Slot$3;
|
|
57078
|
+
const buttonVariants = cva([
|
|
57079
|
+
"group/trigger relative m-0 inline-flex max-w-full shrink-0 items-center justify-center gap-2",
|
|
57080
|
+
"cursor-pointer select-none whitespace-nowrap border-0 align-baseline font-medium no-underline outline-none",
|
|
57081
|
+
"transform translate-z-0",
|
|
57082
|
+
// Fill, text and border all come from --themed-*; the fallbacks below are
|
|
57083
|
+
// the inverted `default` variant, so it declares no colour tokens at all.
|
|
57084
|
+
"text-[var(--themed-fg,_var(--ds-background-100))]",
|
|
57085
|
+
"bg-[var(--themed-bg,_var(--ds-gray-1000))]",
|
|
57086
|
+
"shadow-[0_0_0_1px_var(--themed-border,_transparent)]",
|
|
57087
|
+
// Every variant declares --themed-hover-bg, so there is a single
|
|
57088
|
+
// `hover:bg-*` utility on the element and a call site that needs its own
|
|
57089
|
+
// hover fill replaces it in both themes at once.
|
|
57090
|
+
"hover:bg-[var(--themed-hover-bg)]",
|
|
56853
57091
|
"transition-[border-color,background,color,transform,box-shadow] duration-150 ease-in-out",
|
|
56854
|
-
// Geist invert hover: literal fallbacks (no token dep, so it resolves in any
|
|
56855
|
-
// consuming app), darkened via ancestor theme class without a registered variant.
|
|
56856
|
-
"hover:bg-[var(--themed-hover-bg,_hsl(0,_0%,_22%))]",
|
|
56857
|
-
"[.dark-theme_&]:hover:bg-[var(--themed-hover-bg,_hsl(0,_0%,_80%))]",
|
|
56858
|
-
"[[data-theme=dark]_&]:hover:bg-[var(--themed-hover-bg,_hsl(0,_0%,_80%))]",
|
|
56859
|
-
// Geist focus ring as arbitrary properties (no bare `outline`/ambiguous
|
|
56860
|
-
// arbitrary-color utilities, which differ between Tailwind v3 and v4).
|
|
56861
57092
|
"focus-visible:[outline:2px_solid_var(--ds-focus-color)] focus-visible:[outline-offset:2px]",
|
|
56862
|
-
|
|
56863
|
-
|
|
56864
|
-
"disabled:bg-gray-100 disabled
|
|
56865
|
-
"aria-disabled:bg-gray-100 aria-disabled:text-gray-700 aria-disabled:hover:bg-gray-100"
|
|
57093
|
+
"[&_svg]:shrink-0",
|
|
57094
|
+
// Disabled buttons flatten to the gray-100 fill with a gray-400 border.
|
|
57095
|
+
"disabled:cursor-not-allowed disabled:bg-gray-100 disabled:text-gray-700 disabled:[--themed-border:_var(--ds-gray-400)] disabled:hover:bg-gray-100",
|
|
57096
|
+
"aria-disabled:cursor-not-allowed aria-disabled:bg-gray-100 aria-disabled:text-gray-700 aria-disabled:[--themed-border:_var(--ds-gray-400)] aria-disabled:hover:bg-gray-100"
|
|
56866
57097
|
], {
|
|
56867
57098
|
variants: {
|
|
56868
57099
|
variant: {
|
|
56869
|
-
|
|
56870
|
-
|
|
56871
|
-
|
|
57100
|
+
// No `--ds-*` token sits one step lighter/darker than the inverted
|
|
57101
|
+
// fill, so its hover colours are literal — and they have to flip with
|
|
57102
|
+
// the theme, because the fill itself does.
|
|
57103
|
+
default: [
|
|
57104
|
+
"[--themed-hover-bg:_hsl(0,_0%,_22%)]",
|
|
57105
|
+
"[.dark_&]:[--themed-hover-bg:_hsl(0,_0%,_80%)]",
|
|
57106
|
+
"[.dark-theme_&]:[--themed-hover-bg:_hsl(0,_0%,_80%)]",
|
|
57107
|
+
"[[data-theme=dark]_&]:[--themed-hover-bg:_hsl(0,_0%,_80%)]"
|
|
57108
|
+
],
|
|
57109
|
+
secondary: [
|
|
57110
|
+
"[--themed-bg:_var(--ds-background-100)]",
|
|
57111
|
+
"[--themed-fg:_var(--ds-gray-1000)]",
|
|
57112
|
+
"[--themed-border:_var(--ds-gray-400)]",
|
|
57113
|
+
"[--themed-hover-bg:_var(--ds-gray-100)]",
|
|
57114
|
+
"[.dark_&]:[--themed-hover-bg:_var(--ds-gray-200)]",
|
|
57115
|
+
"[.dark-theme_&]:[--themed-hover-bg:_var(--ds-gray-200)]",
|
|
57116
|
+
"[[data-theme=dark]_&]:[--themed-hover-bg:_var(--ds-gray-200)]"
|
|
57117
|
+
],
|
|
57118
|
+
// Tertiary is the one variant allowed to go borderless when disabled;
|
|
57119
|
+
// it drops to 50% opacity instead.
|
|
57120
|
+
tertiary: [
|
|
57121
|
+
"[--themed-bg:_transparent]",
|
|
57122
|
+
"[--themed-fg:_var(--ds-gray-1000)]",
|
|
57123
|
+
"[--themed-border:_transparent]",
|
|
57124
|
+
// The alpha token already flips with the theme.
|
|
57125
|
+
"[--themed-hover-bg:_var(--ds-gray-alpha-200)]",
|
|
57126
|
+
"disabled:bg-transparent disabled:opacity-50 disabled:shadow-none disabled:hover:bg-transparent",
|
|
57127
|
+
"aria-disabled:bg-transparent aria-disabled:opacity-50 aria-disabled:shadow-none aria-disabled:hover:bg-transparent"
|
|
57128
|
+
]
|
|
56872
57129
|
},
|
|
57130
|
+
// Radii are literal rather than `rounded-md`/`rounded-lg`: apps that
|
|
57131
|
+
// still carry a shadcn theme redefine the `--radius-*` scale, and these
|
|
57132
|
+
// corners should not move with it.
|
|
56873
57133
|
size: {
|
|
56874
|
-
|
|
56875
|
-
|
|
56876
|
-
|
|
56877
|
-
|
|
57134
|
+
tiny: "h-6 gap-1 rounded-[4px] px-1.5 text-button-12 [&_svg]:size-3",
|
|
57135
|
+
small: "h-8 rounded-[6px] px-3 text-button-14 [&_svg]:size-4",
|
|
57136
|
+
medium: "h-9 rounded-[6px] px-4 text-button-14 [&_svg]:size-4",
|
|
57137
|
+
large: "h-10 rounded-[8px] px-5 text-button-16 [&_svg]:size-4"
|
|
57138
|
+
},
|
|
57139
|
+
// Icon-only buttons: square keeps the size's radius, circle is a pill.
|
|
57140
|
+
shape: {
|
|
57141
|
+
square: "aspect-square px-0",
|
|
57142
|
+
circle: "aspect-square rounded-full px-0"
|
|
56878
57143
|
}
|
|
56879
57144
|
},
|
|
56880
57145
|
defaultVariants: {
|
|
56881
57146
|
variant: "default",
|
|
56882
|
-
size: "
|
|
57147
|
+
size: "medium"
|
|
56883
57148
|
}
|
|
56884
57149
|
});
|
|
56885
|
-
|
|
56886
|
-
|
|
56887
|
-
|
|
57150
|
+
const Button = reactExports.forwardRef(({ className, variant, size: size2, shape, asChild = false, type, ...props }, ref2) => {
|
|
57151
|
+
const Comp = asChild ? Slot$3 : "button";
|
|
57152
|
+
return jsxRuntimeExports.jsx(Comp, {
|
|
57153
|
+
ref: ref2,
|
|
57154
|
+
// `type` only means anything on a real <button>; forwarding it to the
|
|
57155
|
+
// anchor (or whatever else) an `asChild` call site renders would be
|
|
57156
|
+
// invalid HTML.
|
|
57157
|
+
type: asChild ? type : type ?? "button",
|
|
57158
|
+
className: cn$4(buttonVariants({ variant, size: size2, shape, className })),
|
|
57159
|
+
...props
|
|
57160
|
+
});
|
|
57161
|
+
});
|
|
57162
|
+
Button.displayName = "Button";
|
|
56888
57163
|
function summarizeArrayBufferView(value) {
|
|
56889
57164
|
const ta = value;
|
|
56890
57165
|
const name2 = ta.constructor.name;
|
|
@@ -57094,7 +57369,7 @@ const RunClickContext = reactExports.createContext(void 0);
|
|
|
57094
57369
|
function EncryptedInlineLabel() {
|
|
57095
57370
|
const ctx = reactExports.useContext(DecryptClickContext);
|
|
57096
57371
|
if (ctx) {
|
|
57097
|
-
return jsxRuntimeExports.jsxs(Button
|
|
57372
|
+
return jsxRuntimeExports.jsxs(Button, { size: "tiny", className: "align-baseline", disabled: ctx.isDecrypting || ctx.isDecryptDisabled, title: ctx.isDecryptDisabled ? ctx.decryptDisabledReason : void 0, onClick: (e) => {
|
|
57098
57373
|
e.stopPropagation();
|
|
57099
57374
|
ctx.onDecrypt();
|
|
57100
57375
|
}, children: [ctx.isDecrypting ? jsxRuntimeExports.jsx(Spinner, { size: 10 }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3" }), jsxRuntimeExports.jsx("span", { children: "Decrypt" })] });
|
|
@@ -57538,7 +57813,7 @@ const encryptedPlaceholderPreview = `{
|
|
|
57538
57813
|
}`;
|
|
57539
57814
|
function EncryptedDataBlock() {
|
|
57540
57815
|
const ctx = reactExports.useContext(DecryptClickContext);
|
|
57541
|
-
return jsxRuntimeExports.jsxs("div", { className: "relative min-h-20 overflow-hidden rounded-md border border-gray-alpha-400 bg-background-100", children: [jsxRuntimeExports.jsx("pre", { "aria-hidden": "true", className: "pointer-events-none m-0 select-none p-3 font-mono text-label-12 text-gray-900 blur-[4px]", children: encryptedPlaceholderPreview }), jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: ctx ? jsxRuntimeExports.jsxs(Button
|
|
57816
|
+
return jsxRuntimeExports.jsxs("div", { className: "relative min-h-20 overflow-hidden rounded-md border border-gray-alpha-400 bg-background-100", children: [jsxRuntimeExports.jsx("pre", { "aria-hidden": "true", className: "pointer-events-none m-0 select-none p-3 font-mono text-label-12 text-gray-900 blur-[4px]", children: encryptedPlaceholderPreview }), jsxRuntimeExports.jsx("div", { className: "absolute inset-0 flex items-center justify-center", children: ctx ? jsxRuntimeExports.jsxs(Button, { onClick: ctx.onDecrypt, disabled: ctx.isDecrypting || ctx.isDecryptDisabled, title: ctx.isDecryptDisabled ? ctx.decryptDisabledReason : void 0, size: "tiny", children: [ctx.isDecrypting ? jsxRuntimeExports.jsx(Spinner, { size: 10 }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3" }), jsxRuntimeExports.jsx("span", { children: "Decrypt" })] }) : jsxRuntimeExports.jsxs("span", { className: "inline-flex items-center gap-1 rounded border border-gray-alpha-400 bg-gray-100 px-1.5 py-0.5 text-button-12 font-medium text-gray-700", children: [jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3" }), "Encrypted"] }) })] });
|
|
57542
57817
|
}
|
|
57543
57818
|
const serializeForClipboard = (value) => {
|
|
57544
57819
|
if (typeof value === "string")
|
|
@@ -57659,116 +57934,6 @@ function AttrSetEventBlock({ data: data2 }) {
|
|
|
57659
57934
|
const writerLabel = describeWriter(data2.writer);
|
|
57660
57935
|
return jsxRuntimeExports.jsxs("div", { className: "flex flex-col px-3 py-1", children: [jsxRuntimeExports.jsx("div", { className: "flex flex-col", children: data2.changes.map((change, index2) => jsxRuntimeExports.jsx(AttributeRow, { attributeKey: change.key, removed: change.value === null, value: change.value ?? void 0 }, `${change.key}:${index2}`)) }), writerLabel && jsxRuntimeExports.jsx("div", { className: "border-gray-alpha-400 border-t py-1.5 text-gray-700 text-label-12", children: writerLabel })] });
|
|
57661
57936
|
}
|
|
57662
|
-
function setRef(ref2, value) {
|
|
57663
|
-
if (typeof ref2 === "function") {
|
|
57664
|
-
return ref2(value);
|
|
57665
|
-
} else if (ref2 !== null && ref2 !== void 0) {
|
|
57666
|
-
ref2.current = value;
|
|
57667
|
-
}
|
|
57668
|
-
}
|
|
57669
|
-
function composeRefs(...refs) {
|
|
57670
|
-
return (node2) => {
|
|
57671
|
-
let hasCleanup = false;
|
|
57672
|
-
const cleanups = refs.map((ref2) => {
|
|
57673
|
-
const cleanup = setRef(ref2, node2);
|
|
57674
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
57675
|
-
hasCleanup = true;
|
|
57676
|
-
}
|
|
57677
|
-
return cleanup;
|
|
57678
|
-
});
|
|
57679
|
-
if (hasCleanup) {
|
|
57680
|
-
return () => {
|
|
57681
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
57682
|
-
const cleanup = cleanups[i];
|
|
57683
|
-
if (typeof cleanup == "function") {
|
|
57684
|
-
cleanup();
|
|
57685
|
-
} else {
|
|
57686
|
-
setRef(refs[i], null);
|
|
57687
|
-
}
|
|
57688
|
-
}
|
|
57689
|
-
};
|
|
57690
|
-
}
|
|
57691
|
-
};
|
|
57692
|
-
}
|
|
57693
|
-
function useComposedRefs(...refs) {
|
|
57694
|
-
return reactExports.useCallback(composeRefs(...refs), refs);
|
|
57695
|
-
}
|
|
57696
|
-
var Slot$3 = reactExports.forwardRef((props, forwardedRef) => {
|
|
57697
|
-
const { children: children2, ...slotProps } = props;
|
|
57698
|
-
const childrenArray = reactExports.Children.toArray(children2);
|
|
57699
|
-
const slottable = childrenArray.find(isSlottable$1);
|
|
57700
|
-
if (slottable) {
|
|
57701
|
-
const newElement = slottable.props.children;
|
|
57702
|
-
const newChildren = childrenArray.map((child) => {
|
|
57703
|
-
if (child === slottable) {
|
|
57704
|
-
if (reactExports.Children.count(newElement) > 1) return reactExports.Children.only(null);
|
|
57705
|
-
return reactExports.isValidElement(newElement) ? newElement.props.children : null;
|
|
57706
|
-
} else {
|
|
57707
|
-
return child;
|
|
57708
|
-
}
|
|
57709
|
-
});
|
|
57710
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone$1, { ...slotProps, ref: forwardedRef, children: reactExports.isValidElement(newElement) ? reactExports.cloneElement(newElement, void 0, newChildren) : null });
|
|
57711
|
-
}
|
|
57712
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone$1, { ...slotProps, ref: forwardedRef, children: children2 });
|
|
57713
|
-
});
|
|
57714
|
-
Slot$3.displayName = "Slot";
|
|
57715
|
-
var SlotClone$1 = reactExports.forwardRef((props, forwardedRef) => {
|
|
57716
|
-
const { children: children2, ...slotProps } = props;
|
|
57717
|
-
if (reactExports.isValidElement(children2)) {
|
|
57718
|
-
const childrenRef = getElementRef$2(children2);
|
|
57719
|
-
return reactExports.cloneElement(children2, {
|
|
57720
|
-
...mergeProps$1(slotProps, children2.props),
|
|
57721
|
-
// @ts-ignore
|
|
57722
|
-
ref: forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef
|
|
57723
|
-
});
|
|
57724
|
-
}
|
|
57725
|
-
return reactExports.Children.count(children2) > 1 ? reactExports.Children.only(null) : null;
|
|
57726
|
-
});
|
|
57727
|
-
SlotClone$1.displayName = "SlotClone";
|
|
57728
|
-
var Slottable$1 = ({ children: children2 }) => {
|
|
57729
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: children2 });
|
|
57730
|
-
};
|
|
57731
|
-
function isSlottable$1(child) {
|
|
57732
|
-
return reactExports.isValidElement(child) && child.type === Slottable$1;
|
|
57733
|
-
}
|
|
57734
|
-
function mergeProps$1(slotProps, childProps) {
|
|
57735
|
-
const overrideProps = { ...childProps };
|
|
57736
|
-
for (const propName in childProps) {
|
|
57737
|
-
const slotPropValue = slotProps[propName];
|
|
57738
|
-
const childPropValue = childProps[propName];
|
|
57739
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
57740
|
-
if (isHandler) {
|
|
57741
|
-
if (slotPropValue && childPropValue) {
|
|
57742
|
-
overrideProps[propName] = (...args) => {
|
|
57743
|
-
childPropValue(...args);
|
|
57744
|
-
slotPropValue(...args);
|
|
57745
|
-
};
|
|
57746
|
-
} else if (slotPropValue) {
|
|
57747
|
-
overrideProps[propName] = slotPropValue;
|
|
57748
|
-
}
|
|
57749
|
-
} else if (propName === "style") {
|
|
57750
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
57751
|
-
} else if (propName === "className") {
|
|
57752
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
57753
|
-
}
|
|
57754
|
-
}
|
|
57755
|
-
return { ...slotProps, ...overrideProps };
|
|
57756
|
-
}
|
|
57757
|
-
function getElementRef$2(element2) {
|
|
57758
|
-
var _a3, _b2;
|
|
57759
|
-
let getter = (_a3 = Object.getOwnPropertyDescriptor(element2.props, "ref")) == null ? void 0 : _a3.get;
|
|
57760
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
57761
|
-
if (mayWarn) {
|
|
57762
|
-
return element2.ref;
|
|
57763
|
-
}
|
|
57764
|
-
getter = (_b2 = Object.getOwnPropertyDescriptor(element2, "ref")) == null ? void 0 : _b2.get;
|
|
57765
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
57766
|
-
if (mayWarn) {
|
|
57767
|
-
return element2.props.ref;
|
|
57768
|
-
}
|
|
57769
|
-
return element2.props.ref || element2.ref;
|
|
57770
|
-
}
|
|
57771
|
-
var Root$6 = Slot$3;
|
|
57772
57937
|
var debounce_1;
|
|
57773
57938
|
var hasRequiredDebounce;
|
|
57774
57939
|
function requireDebounce() {
|
|
@@ -59952,7 +60117,7 @@ const deserializer = ($2, _2) => {
|
|
|
59952
60117
|
return unpair;
|
|
59953
60118
|
};
|
|
59954
60119
|
const deserialize$3 = (serialized) => deserializer(/* @__PURE__ */ new Map(), serialized)(0);
|
|
59955
|
-
const EMPTY = "";
|
|
60120
|
+
const EMPTY$1 = "";
|
|
59956
60121
|
const { toString: toString$2 } = {};
|
|
59957
60122
|
const { keys } = Object;
|
|
59958
60123
|
const typeOf = (value) => {
|
|
@@ -59962,17 +60127,17 @@ const typeOf = (value) => {
|
|
|
59962
60127
|
const asString = toString$2.call(value).slice(8, -1);
|
|
59963
60128
|
switch (asString) {
|
|
59964
60129
|
case "Array":
|
|
59965
|
-
return [ARRAY, EMPTY];
|
|
60130
|
+
return [ARRAY, EMPTY$1];
|
|
59966
60131
|
case "Object":
|
|
59967
|
-
return [OBJECT$2, EMPTY];
|
|
60132
|
+
return [OBJECT$2, EMPTY$1];
|
|
59968
60133
|
case "Date":
|
|
59969
|
-
return [DATE, EMPTY];
|
|
60134
|
+
return [DATE, EMPTY$1];
|
|
59970
60135
|
case "RegExp":
|
|
59971
|
-
return [REGEXP, EMPTY];
|
|
60136
|
+
return [REGEXP, EMPTY$1];
|
|
59972
60137
|
case "Map":
|
|
59973
|
-
return [MAP, EMPTY];
|
|
60138
|
+
return [MAP, EMPTY$1];
|
|
59974
60139
|
case "Set":
|
|
59975
|
-
return [SET, EMPTY];
|
|
60140
|
+
return [SET, EMPTY$1];
|
|
59976
60141
|
case "DataView":
|
|
59977
60142
|
return [ARRAY, asString];
|
|
59978
60143
|
}
|
|
@@ -86076,7 +86241,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
86076
86241
|
var et = ({ className: e, language: t, style: o, isIncomplete: n, ...s2 }) => jsxRuntimeExports.jsx("div", { className: f("my-4 flex w-full flex-col gap-2 rounded-xl border border-border bg-sidebar p-2", e), "data-incomplete": n || void 0, "data-language": t, "data-streamdown": "code-block", style: { contentVisibility: "auto", containIntrinsicSize: "auto 200px", ...o }, ...s2 });
|
|
86077
86242
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
86078
86243
|
var ot = ({ language: e }) => jsxRuntimeExports.jsx("div", { className: "flex h-8 items-center text-muted-foreground text-xs", "data-language": e, "data-streamdown": "code-block-header", children: jsxRuntimeExports.jsx("span", { className: "ml-1 font-mono lowercase", children: e }) });
|
|
86079
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
86244
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-0R2gvzDD.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
86080
86245
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
86081
86246
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
86082
86247
|
return jsxRuntimeExports.jsx(Se.Provider, { value: { code: e }, children: jsxRuntimeExports.jsxs(et, { isIncomplete: s2, language: t, children: [jsxRuntimeExports.jsx(ot, { language: t }), n ? jsxRuntimeExports.jsx("div", { className: "pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end", children: jsxRuntimeExports.jsx("div", { className: "pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur", "data-streamdown": "code-block-actions", children: n }) }) : null, jsxRuntimeExports.jsx(reactExports.Suspense, { fallback: jsxRuntimeExports.jsx(Qe, { className: o, language: t, result: c, ...r2 }), children: jsxRuntimeExports.jsx(dn, { className: o, code: i, language: t, raw: c, ...r2 }) })] }) });
|
|
@@ -86398,7 +86563,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
86398
86563
|
}, []), jsxRuntimeExports.jsxs("div", { className: "relative", ref: i, children: [jsxRuntimeExports.jsx("button", { className: f("cursor-pointer p-1 text-muted-foreground transition-all hover:text-foreground disabled:cursor-not-allowed disabled:opacity-50", t), disabled: c, onClick: () => r2(!s2), title: "Download table", type: "button", children: e != null ? e : jsxRuntimeExports.jsx(Z, { size: 14 }) }), s2 ? jsxRuntimeExports.jsxs("div", { className: "absolute top-full right-0 z-10 mt-1 min-w-[120px] overflow-hidden rounded-md border border-border bg-background shadow-lg", children: [jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("csv"), title: "Download table as CSV", type: "button", children: "CSV" }), jsxRuntimeExports.jsx("button", { className: "w-full px-3 py-2 text-left text-sm transition-colors hover:bg-muted/40", onClick: () => a2("markdown"), title: "Download table as Markdown", type: "button", children: "Markdown" })] }) : null] });
|
|
86399
86564
|
};
|
|
86400
86565
|
var Vt = ({ children: e, className: t, showControls: o, ...n }) => jsxRuntimeExports.jsxs("div", { className: "my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2", "data-streamdown": "table-wrapper", children: [o ? jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-end gap-1", children: [jsxRuntimeExports.jsx(Ht, {}), jsxRuntimeExports.jsx(Dt, {})] }) : null, jsxRuntimeExports.jsx("div", { className: "border-collapse overflow-x-auto overscroll-y-auto rounded-md border border-border bg-background", children: jsxRuntimeExports.jsx("table", { className: f("w-full divide-y divide-border", t), "data-streamdown": "table", ...n, children: e }) })] });
|
|
86401
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
86566
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-Bubx0Bc0.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
86402
86567
|
function ke(e, t) {
|
|
86403
86568
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
86404
86569
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -92177,56 +92342,6 @@ function ConnectionStatus() {
|
|
|
92177
92342
|
] }) })
|
|
92178
92343
|
] });
|
|
92179
92344
|
}
|
|
92180
|
-
const DEFAULT_PAGE_SIZE = 10;
|
|
92181
|
-
function cn(...inputs) {
|
|
92182
|
-
return twMerge(clsx(inputs));
|
|
92183
|
-
}
|
|
92184
|
-
const LIVE_UPDATE_INTERVAL_MS$1 = 5e3;
|
|
92185
|
-
function getPaginationDisplay(currentPage, totalPages, hasMore) {
|
|
92186
|
-
if (hasMore) {
|
|
92187
|
-
return `Page ${currentPage} of ${totalPages}+`;
|
|
92188
|
-
}
|
|
92189
|
-
return `Page ${currentPage} of ${totalPages}`;
|
|
92190
|
-
}
|
|
92191
|
-
const buttonVariants = cva(
|
|
92192
|
-
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0",
|
|
92193
|
-
{
|
|
92194
|
-
variants: {
|
|
92195
|
-
variant: {
|
|
92196
|
-
default: "bg-primary text-primary-foreground hover:bg-primary/90",
|
|
92197
|
-
destructive: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
92198
|
-
outline: "border border-input bg-background hover:bg-accent hover:text-accent-foreground",
|
|
92199
|
-
secondary: "bg-secondary text-secondary-foreground hover:bg-secondary/80",
|
|
92200
|
-
ghost: "hover:bg-accent hover:text-accent-foreground",
|
|
92201
|
-
link: "text-primary underline-offset-4 hover:underline"
|
|
92202
|
-
},
|
|
92203
|
-
size: {
|
|
92204
|
-
default: "h-10 px-4 py-2",
|
|
92205
|
-
sm: "h-9 rounded-md px-3",
|
|
92206
|
-
lg: "h-11 rounded-md px-8",
|
|
92207
|
-
icon: "h-10 w-10"
|
|
92208
|
-
}
|
|
92209
|
-
},
|
|
92210
|
-
defaultVariants: {
|
|
92211
|
-
variant: "default",
|
|
92212
|
-
size: "default"
|
|
92213
|
-
}
|
|
92214
|
-
}
|
|
92215
|
-
);
|
|
92216
|
-
const Button = reactExports.forwardRef(
|
|
92217
|
-
({ className, variant, size: size2, asChild = false, ...props }, ref2) => {
|
|
92218
|
-
const Comp = asChild ? Slot$3 : "button";
|
|
92219
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92220
|
-
Comp,
|
|
92221
|
-
{
|
|
92222
|
-
className: cn(buttonVariants({ variant, size: size2, className })),
|
|
92223
|
-
ref: ref2,
|
|
92224
|
-
...props
|
|
92225
|
-
}
|
|
92226
|
-
);
|
|
92227
|
-
}
|
|
92228
|
-
);
|
|
92229
|
-
Button.displayName = "Button";
|
|
92230
92345
|
let decoder$1;
|
|
92231
92346
|
try {
|
|
92232
92347
|
decoder$1 = new TextDecoder();
|
|
@@ -94633,8 +94748,8 @@ function HealthCheckButton() {
|
|
|
94633
94748
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
94634
94749
|
Button,
|
|
94635
94750
|
{
|
|
94636
|
-
variant: "
|
|
94637
|
-
size: "
|
|
94751
|
+
variant: "tertiary",
|
|
94752
|
+
size: "small",
|
|
94638
94753
|
onClick: runChecks,
|
|
94639
94754
|
disabled: isChecking,
|
|
94640
94755
|
className: "gap-1.5",
|
|
@@ -94651,6 +94766,17 @@ function HealthCheckButton() {
|
|
|
94651
94766
|
] }) })
|
|
94652
94767
|
] });
|
|
94653
94768
|
}
|
|
94769
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
94770
|
+
function cn(...inputs) {
|
|
94771
|
+
return twMerge(clsx(inputs));
|
|
94772
|
+
}
|
|
94773
|
+
const LIVE_UPDATE_INTERVAL_MS$1 = 5e3;
|
|
94774
|
+
function getPaginationDisplay(currentPage, totalPages, hasMore) {
|
|
94775
|
+
if (hasMore) {
|
|
94776
|
+
return `Page ${currentPage} of ${totalPages}+`;
|
|
94777
|
+
}
|
|
94778
|
+
return `Page ${currentPage} of ${totalPages}`;
|
|
94779
|
+
}
|
|
94654
94780
|
function SegmentedControl({
|
|
94655
94781
|
value,
|
|
94656
94782
|
onValueChange,
|
|
@@ -94701,7 +94827,7 @@ function ThemePicker() {
|
|
|
94701
94827
|
);
|
|
94702
94828
|
}
|
|
94703
94829
|
function DocsLink$1() {
|
|
94704
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { asChild: true, variant: "
|
|
94830
|
+
return /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { asChild: true, variant: "secondary", size: "small", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
94705
94831
|
"a",
|
|
94706
94832
|
{
|
|
94707
94833
|
href: "https://workflow-sdk.dev/docs/observability",
|
|
@@ -95337,7 +95463,7 @@ async function linkToTraceCarrier(carrier) {
|
|
|
95337
95463
|
return { context };
|
|
95338
95464
|
}
|
|
95339
95465
|
function matchesDebugNamespace(namespace2, patternList) {
|
|
95340
|
-
if (!patternList) {
|
|
95466
|
+
if (typeof patternList !== "string" || !patternList) {
|
|
95341
95467
|
return false;
|
|
95342
95468
|
}
|
|
95343
95469
|
let enabled = false;
|
|
@@ -95474,6 +95600,7 @@ const STREAM_SERVER_RUN_ID_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_RUN_ID");
|
|
|
95474
95600
|
const STREAM_SERVER_DEPLOYMENT_ID_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_DEPLOYMENT_ID");
|
|
95475
95601
|
const STREAM_SERVER_PUBLIC_KEY_SYMBOL = Symbol.for("WORKFLOW_STREAM_SERVER_PUBLIC_KEY");
|
|
95476
95602
|
const STREAM_DRAIN_SYMBOL = Symbol.for("WORKFLOW_STREAM_DRAIN");
|
|
95603
|
+
const STREAM_RELEASE_SYMBOL = Symbol.for("WORKFLOW_STREAM_RELEASE");
|
|
95477
95604
|
const BODY_INIT_SYMBOL = Symbol.for("BODY_INIT");
|
|
95478
95605
|
const WEBHOOK_RESPONSE_WRITABLE = Symbol.for("WEBHOOK_RESPONSE_WRITABLE");
|
|
95479
95606
|
const WORKFLOW_CLASS_REGISTRY = Symbol.for("workflow-class-registry");
|
|
@@ -95553,12 +95680,12 @@ function isReadableUnlockedNotClosed(readable2) {
|
|
|
95553
95680
|
return true;
|
|
95554
95681
|
}
|
|
95555
95682
|
function resolveAfterDrain(state) {
|
|
95556
|
-
const
|
|
95557
|
-
|
|
95558
|
-
state.
|
|
95559
|
-
|
|
95560
|
-
}
|
|
95561
|
-
|
|
95683
|
+
const release = async () => {
|
|
95684
|
+
var _a3, _b2;
|
|
95685
|
+
await ((_a3 = state.drainBarrier) == null ? void 0 : _a3.call(state));
|
|
95686
|
+
await ((_b2 = state.releaseTransport) == null ? void 0 : _b2.call(state));
|
|
95687
|
+
};
|
|
95688
|
+
release().then(() => state.resolve(), (err) => state.reject(err));
|
|
95562
95689
|
}
|
|
95563
95690
|
function markFlushableFrameProduced(state) {
|
|
95564
95691
|
state.producedFrames++;
|
|
@@ -95640,6 +95767,7 @@ function trackFlushableWritable(writable, state, WritableStreamConstructor = Wri
|
|
|
95640
95767
|
return Promise.resolve(false);
|
|
95641
95768
|
}
|
|
95642
95769
|
settlement = (async () => {
|
|
95770
|
+
var _a3;
|
|
95643
95771
|
try {
|
|
95644
95772
|
try {
|
|
95645
95773
|
await checkpointWriter.write(checkpoint);
|
|
@@ -95652,6 +95780,7 @@ function trackFlushableWritable(writable, state, WritableStreamConstructor = Wri
|
|
|
95652
95780
|
}
|
|
95653
95781
|
}
|
|
95654
95782
|
await drainFlushableSnapshot(state);
|
|
95783
|
+
await ((_a3 = state.releaseTransport) == null ? void 0 : _a3.call(state));
|
|
95655
95784
|
if (!state.doneResolved) {
|
|
95656
95785
|
state.doneResolved = true;
|
|
95657
95786
|
state.resolve();
|
|
@@ -95723,6 +95852,10 @@ function flushablePipe(source, sink, state) {
|
|
|
95723
95852
|
if (typeof drain === "function") {
|
|
95724
95853
|
state.drainBarrier = drain;
|
|
95725
95854
|
}
|
|
95855
|
+
const release = sink[STREAM_RELEASE_SYMBOL];
|
|
95856
|
+
if (typeof release === "function") {
|
|
95857
|
+
state.releaseTransport = release;
|
|
95858
|
+
}
|
|
95726
95859
|
return flushablePipePerChunk(source, sink, state);
|
|
95727
95860
|
}
|
|
95728
95861
|
async function flushablePipePerChunk(source, sink, state) {
|
|
@@ -95776,6 +95909,8 @@ async function flushablePipePerChunk(source, sink, state) {
|
|
|
95776
95909
|
await state.drainBarrier().catch(() => {
|
|
95777
95910
|
});
|
|
95778
95911
|
}
|
|
95912
|
+
await writer.abort(err).catch(() => {
|
|
95913
|
+
});
|
|
95779
95914
|
if (!state.doneResolved) {
|
|
95780
95915
|
state.doneResolved = true;
|
|
95781
95916
|
state.reject(err);
|
|
@@ -95884,6 +96019,9 @@ const typedArrayBuffer = protoGetter(TypedArrayPrototype, "buffer");
|
|
|
95884
96019
|
const typedArrayByteOffset = protoGetter(TypedArrayPrototype, "byteOffset");
|
|
95885
96020
|
const typedArrayByteLength = protoGetter(TypedArrayPrototype, "byteLength");
|
|
95886
96021
|
const typedArrayLength = protoGetter(TypedArrayPrototype, "length");
|
|
96022
|
+
const typedArraySet = uncurryThis(TypedArrayPrototype.set);
|
|
96023
|
+
const HostArrayBuffer = ArrayBuffer;
|
|
96024
|
+
const HostUint8Array = Uint8Array;
|
|
95887
96025
|
const dataViewBuffer = protoGetter(DataView.prototype, "buffer");
|
|
95888
96026
|
const dataViewByteOffset = protoGetter(DataView.prototype, "byteOffset");
|
|
95889
96027
|
const dataViewByteLength = protoGetter(DataView.prototype, "byteLength");
|
|
@@ -95988,7 +96126,14 @@ function headersToEntries(value) {
|
|
|
95988
96126
|
recordProxy(value);
|
|
95989
96127
|
return Array.from(value);
|
|
95990
96128
|
}
|
|
95991
|
-
|
|
96129
|
+
try {
|
|
96130
|
+
return [...headersIterator(value)];
|
|
96131
|
+
} catch (error2) {
|
|
96132
|
+
if (!(error2 instanceof TypeError))
|
|
96133
|
+
throw error2;
|
|
96134
|
+
recordGuestCode("method", "Headers[Symbol.iterator]");
|
|
96135
|
+
return Array.from(value);
|
|
96136
|
+
}
|
|
95992
96137
|
}
|
|
95993
96138
|
function mapToEntries(value) {
|
|
95994
96139
|
return [...mapEntries(value)];
|
|
@@ -96128,12 +96273,19 @@ const hardenedStringifyOperations = {
|
|
|
96128
96273
|
entriesOf: (map2) => mapToEntries(map2),
|
|
96129
96274
|
viewInfo: (view) => {
|
|
96130
96275
|
const info = viewInfo(view);
|
|
96276
|
+
const length = types$5.isDataView(view) ? 0 : typedArrayLength(view);
|
|
96277
|
+
const bufferByteLength = types$5.isSharedArrayBuffer(info.buffer) ? sharedArrayBufferByteLength(info.buffer) : arrayBufferByteLength(info.buffer);
|
|
96278
|
+
if (info.byteLength === bufferByteLength) {
|
|
96279
|
+
return { ...info, length, bufferByteLength };
|
|
96280
|
+
}
|
|
96281
|
+
const copy = new HostArrayBuffer(info.byteLength);
|
|
96282
|
+
typedArraySet(new HostUint8Array(copy), new HostUint8Array(info.buffer, info.byteOffset, info.byteLength));
|
|
96131
96283
|
return {
|
|
96132
|
-
|
|
96133
|
-
|
|
96134
|
-
|
|
96135
|
-
length
|
|
96136
|
-
bufferByteLength:
|
|
96284
|
+
buffer: copy,
|
|
96285
|
+
byteOffset: 0,
|
|
96286
|
+
byteLength: info.byteLength,
|
|
96287
|
+
length,
|
|
96288
|
+
bufferByteLength: info.byteLength
|
|
96137
96289
|
};
|
|
96138
96290
|
},
|
|
96139
96291
|
shapeOf: (value) => {
|
|
@@ -96820,7 +96972,7 @@ function isZstdAvailable() {
|
|
|
96820
96972
|
function isGzipAvailable() {
|
|
96821
96973
|
return typeof CompressionStream === "function" && typeof DecompressionStream === "function";
|
|
96822
96974
|
}
|
|
96823
|
-
async function pipeThroughTransform(data2, transform2) {
|
|
96975
|
+
async function pipeThroughTransform(data2, transform2, maxOutputBytes) {
|
|
96824
96976
|
const writer = transform2.writable.getWriter();
|
|
96825
96977
|
const writePromise = writer.write(data2).then(() => writer.close());
|
|
96826
96978
|
writePromise.catch(() => {
|
|
@@ -96847,22 +96999,26 @@ async function pipeThroughTransform(data2, transform2) {
|
|
|
96847
96999
|
async function gzipBytes(data2) {
|
|
96848
97000
|
return pipeThroughTransform(data2, new CompressionStream("gzip"));
|
|
96849
97001
|
}
|
|
96850
|
-
async function gunzipBytes(data2) {
|
|
97002
|
+
async function gunzipBytes(data2, maxOutputBytes) {
|
|
96851
97003
|
return pipeThroughTransform(data2, new DecompressionStream("gzip"));
|
|
96852
97004
|
}
|
|
96853
|
-
function
|
|
97005
|
+
function zstdOpts(z2) {
|
|
96854
97006
|
var _a3;
|
|
96855
|
-
const z2 = getNodeZlib$1();
|
|
96856
97007
|
const level = (_a3 = z2 == null ? void 0 : z2.constants) == null ? void 0 : _a3.ZSTD_c_compressionLevel;
|
|
96857
|
-
|
|
96858
|
-
return new Uint8Array(z2.zstdCompressSync(data2, opts));
|
|
97008
|
+
return level !== void 0 ? { params: { [level]: ZSTD_LEVEL } } : void 0;
|
|
96859
97009
|
}
|
|
96860
|
-
function
|
|
97010
|
+
function zstdBytes(data2) {
|
|
97011
|
+
const z2 = getNodeZlib$1();
|
|
97012
|
+
return new Uint8Array(z2.zstdCompressSync(data2, zstdOpts(z2)));
|
|
97013
|
+
}
|
|
97014
|
+
function unzstdBytes(data2, maxOutputBytes) {
|
|
96861
97015
|
const z2 = getNodeZlib$1();
|
|
96862
97016
|
if (!(z2 == null ? void 0 : z2.zstdDecompressSync)) {
|
|
96863
97017
|
throw new Error("Compressed (zstd) workflow data encountered but node:zlib zstd support is not available in this runtime (requires Node.js 22.15+). In the browser, register a zstd decoder via registerZstdDecoder (serialization-format.ts).");
|
|
96864
97018
|
}
|
|
96865
|
-
|
|
97019
|
+
{
|
|
97020
|
+
return new Uint8Array(z2.zstdDecompressSync(data2));
|
|
97021
|
+
}
|
|
96866
97022
|
}
|
|
96867
97023
|
function recordStats(stats2, codec, uncompressedBytes, storedBytes) {
|
|
96868
97024
|
if (!stats2)
|
|
@@ -96873,24 +97029,25 @@ function recordStats(stats2, codec, uncompressedBytes, storedBytes) {
|
|
|
96873
97029
|
stats2.uncompressedBytes = uncompressedBytes;
|
|
96874
97030
|
stats2.storedBytes = storedBytes;
|
|
96875
97031
|
}
|
|
96876
|
-
function selectWriteCodec() {
|
|
97032
|
+
function selectWriteCodec(mode) {
|
|
96877
97033
|
const override = codecOverrideFromEnv();
|
|
96878
|
-
if (override === "gzip")
|
|
97034
|
+
if (mode === "gzip" || override === "gzip") {
|
|
96879
97035
|
return isGzipAvailable() ? "gzip" : "none";
|
|
97036
|
+
}
|
|
96880
97037
|
if (isZstdAvailable())
|
|
96881
97038
|
return "zstd";
|
|
96882
97039
|
if (isGzipAvailable())
|
|
96883
97040
|
return "gzip";
|
|
96884
97041
|
return "none";
|
|
96885
97042
|
}
|
|
96886
|
-
async function compress(data2,
|
|
97043
|
+
async function compress(data2, mode, stats2, opts) {
|
|
96887
97044
|
if (!(data2 instanceof Uint8Array))
|
|
96888
97045
|
return data2;
|
|
96889
|
-
if (!
|
|
97046
|
+
if (!mode || data2.length < COMPRESSION_MIN_BYTES || isCompressionDisabledByEnv()) {
|
|
96890
97047
|
recordStats(stats2, "none", data2.length, data2.length);
|
|
96891
97048
|
return data2;
|
|
96892
97049
|
}
|
|
96893
|
-
const codec = selectWriteCodec();
|
|
97050
|
+
const codec = selectWriteCodec(mode);
|
|
96894
97051
|
if (codec === "none") {
|
|
96895
97052
|
recordStats(stats2, "none", data2.length, data2.length);
|
|
96896
97053
|
return data2;
|
|
@@ -96905,7 +97062,7 @@ async function compress(data2, enabled, stats2) {
|
|
|
96905
97062
|
recordStats(stats2, codec, data2.length, wrappedLength);
|
|
96906
97063
|
return encodeWithFormatPrefix(format2, compressed);
|
|
96907
97064
|
}
|
|
96908
|
-
async function decompress$2(data2, stats2) {
|
|
97065
|
+
async function decompress$2(data2, stats2, opts) {
|
|
96909
97066
|
if (!(data2 instanceof Uint8Array))
|
|
96910
97067
|
return data2;
|
|
96911
97068
|
const prefix = peekFormatPrefix$1(data2);
|
|
@@ -96951,7 +97108,7 @@ async function serialize$3(value, encryptionKey, options) {
|
|
|
96951
97108
|
try {
|
|
96952
97109
|
const payload = devalueCodec.serialize(value, "client", options);
|
|
96953
97110
|
const prefixed = encodeWithFormatPrefix(SerializationFormat$1.DEVALUE_V1, payload);
|
|
96954
|
-
const compressed = await compress(prefixed, (options == null ? void 0 : options.compression)
|
|
97111
|
+
const compressed = await compress(prefixed, (options == null ? void 0 : options.compression) ?? false, options == null ? void 0 : options.compressionStats);
|
|
96955
97112
|
return encrypt(compressed, encryptionKey);
|
|
96956
97113
|
} catch (error2) {
|
|
96957
97114
|
rethrowIfRuntimeError(error2);
|
|
@@ -96977,7 +97134,7 @@ async function serialize$2(value, encryptionKey, options) {
|
|
|
96977
97134
|
try {
|
|
96978
97135
|
const payload = devalueCodec.serialize(value, "step", options);
|
|
96979
97136
|
const prefixed = encodeWithFormatPrefix(SerializationFormat$1.DEVALUE_V1, payload);
|
|
96980
|
-
const compressed = await compress(prefixed, (options == null ? void 0 : options.compression)
|
|
97137
|
+
const compressed = await compress(prefixed, (options == null ? void 0 : options.compression) ?? false, options == null ? void 0 : options.compressionStats);
|
|
96981
97138
|
return encrypt(compressed, encryptionKey);
|
|
96982
97139
|
} catch (error2) {
|
|
96983
97140
|
rethrowIfRuntimeError(error2);
|
|
@@ -97909,6 +98066,15 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
97909
98066
|
enumerable: false,
|
|
97910
98067
|
writable: false
|
|
97911
98068
|
});
|
|
98069
|
+
Object.defineProperty(this, STREAM_RELEASE_SYMBOL, {
|
|
98070
|
+
value: async () => {
|
|
98071
|
+
var _a3;
|
|
98072
|
+
const session = await writeSessionPromise.catch(() => void 0);
|
|
98073
|
+
await ((_a3 = session == null ? void 0 : session.release) == null ? void 0 : _a3.call(session));
|
|
98074
|
+
},
|
|
98075
|
+
enumerable: false,
|
|
98076
|
+
writable: false
|
|
98077
|
+
});
|
|
97912
98078
|
}
|
|
97913
98079
|
}
|
|
97914
98080
|
function getAllBaseReducers(global2 = globalThis) {
|
|
@@ -98680,7 +98846,7 @@ function getWorkflowRevivers(global2 = globalThis) {
|
|
|
98680
98846
|
}
|
|
98681
98847
|
};
|
|
98682
98848
|
}
|
|
98683
|
-
function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deploymentId, streamStates) {
|
|
98849
|
+
function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deploymentId, streamStates, runReadyBarrier) {
|
|
98684
98850
|
return {
|
|
98685
98851
|
...getCommonRevivers(global2),
|
|
98686
98852
|
// StepFunction reviver for step context - returns raw step function
|
|
@@ -98796,7 +98962,7 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
98796
98962
|
pollReadableLock(userReadable, state);
|
|
98797
98963
|
return userReadable;
|
|
98798
98964
|
} else {
|
|
98799
|
-
const transform2 = getDeserializeStream(getStepRevivers(global2, ops, runId, cryptoKey, deploymentId), cryptoKey);
|
|
98965
|
+
const transform2 = getDeserializeStream(getStepRevivers(global2, ops, runId, cryptoKey, deploymentId, streamStates, runReadyBarrier), cryptoKey);
|
|
98800
98966
|
const state = createFlushableState();
|
|
98801
98967
|
ops.push(state.promise);
|
|
98802
98968
|
flushablePipe(readable2, transform2.writable, state).catch(() => {
|
|
@@ -98809,8 +98975,9 @@ function getStepRevivers(global2 = globalThis, ops, runId, cryptoKey, deployment
|
|
|
98809
98975
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
98810
98976
|
const targetDeploymentId = typeof value.deploymentId === "string" ? value.deploymentId : targetRunId === runId ? deploymentId : void 0;
|
|
98811
98977
|
const targetKey = targetRunId === runId ? cryptoKey : lazyForwardedWritableEncryptionKey(targetRunId, targetDeploymentId, value.encryptionPublicKey);
|
|
98812
|
-
const
|
|
98813
|
-
const
|
|
98978
|
+
const targetRunReady = targetRunId === runId ? runReadyBarrier : void 0;
|
|
98979
|
+
const serialize2 = getSerializeStream(getStepReducers(global2, ops, targetRunId, targetKey, false, targetRunReady), targetKey);
|
|
98980
|
+
const serverWritable = new WorkflowServerWritableStream(targetRunId, value.name, targetRunReady);
|
|
98814
98981
|
const state = createFlushableState();
|
|
98815
98982
|
state.deferReleaseSettlement = streamStates !== void 0;
|
|
98816
98983
|
ops.push(state.promise);
|
|
@@ -98931,12 +99098,12 @@ async function dehydrateStepArguments(value, _runId, key, global2 = globalThis,
|
|
|
98931
99098
|
throw new SerializationError(message2, { hint: hint2, cause });
|
|
98932
99099
|
}
|
|
98933
99100
|
}
|
|
98934
|
-
async function hydrateStepArguments(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId, streamStates) {
|
|
99101
|
+
async function hydrateStepArguments(value, runId, key, ops = [], global2 = globalThis, extraRevivers = {}, deploymentId, streamStates, runReadyBarrier) {
|
|
98935
99102
|
const compressionStats = {};
|
|
98936
99103
|
const result = await deserialize$1(value, key, {
|
|
98937
99104
|
global: global2,
|
|
98938
99105
|
extraRevivers: {
|
|
98939
|
-
...getStreamAndRequestRevivers(getStepRevivers(global2, ops, runId, key, deploymentId, streamStates)),
|
|
99106
|
+
...getStreamAndRequestRevivers(getStepRevivers(global2, ops, runId, key, deploymentId, streamStates, runReadyBarrier)),
|
|
98940
99107
|
...extraRevivers
|
|
98941
99108
|
},
|
|
98942
99109
|
compressionStats
|
|
@@ -104635,14 +104802,23 @@ Parser2.acorn = {
|
|
|
104635
104802
|
function parse$2(input, options) {
|
|
104636
104803
|
return Parser2.parse(input, options);
|
|
104637
104804
|
}
|
|
104805
|
+
function dynamicStartRefusal(message2, options) {
|
|
104806
|
+
return Object.assign(new WorkflowRuntimeError(message2, options), {
|
|
104807
|
+
fatal: true
|
|
104808
|
+
});
|
|
104809
|
+
}
|
|
104810
|
+
function dynamicStartRefusalFrom(error2) {
|
|
104811
|
+
return dynamicStartRefusal(error2 instanceof Error ? error2.message : String(error2), { cause: error2 });
|
|
104812
|
+
}
|
|
104638
104813
|
const DYNAMIC_WORKFLOW_SOURCE_MAX_BYTES = 128 * 1024;
|
|
104639
104814
|
const DYNAMIC_WORKFLOW_CODE_INLINE_MAX_BYTES = 24 * 1024;
|
|
104640
104815
|
const SAFE_DYNAMIC_IDENTIFIER = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
|
|
104816
|
+
const DYNAMIC_WORKFLOW_EXPORT_NAME_MAX_LENGTH = 64;
|
|
104641
104817
|
const SAFE_DYNAMIC_EXPORT_NAME = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
104642
104818
|
const UNSUPPORTED_DYNAMIC_MODULE_SYNTAX = /^[ \t]*(?:import(?:\s+[\w$]|\s*(?:[*{(]|['"]))|export(?:\s+(?:async\s+)?(?:function|const|let|var|class|default)\b|\s*[{*]))/m;
|
|
104643
104819
|
function assertDynamicWorkflowIdentifier(kind, value) {
|
|
104644
104820
|
if (!SAFE_DYNAMIC_IDENTIFIER.test(value)) {
|
|
104645
|
-
throw
|
|
104821
|
+
throw dynamicStartRefusal(`Invalid dynamic workflow ${kind} ${JSON.stringify(value)}. Use a valid JavaScript identifier: letters, digits, "_" and "$", not starting with a digit.`);
|
|
104646
104822
|
}
|
|
104647
104823
|
}
|
|
104648
104824
|
function stableJsonStringify(value) {
|
|
@@ -104659,7 +104835,7 @@ async function sha256Hex(input) {
|
|
|
104659
104835
|
return Array.from(new Uint8Array(digest)).map((byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
104660
104836
|
}
|
|
104661
104837
|
const DYNAMIC_WORKFLOW_ECMA_VERSION = 2024;
|
|
104662
|
-
function parseDynamicWorkflowSource(source) {
|
|
104838
|
+
function parseDynamicWorkflowSource(source, exportName) {
|
|
104663
104839
|
try {
|
|
104664
104840
|
return parse$2(source, {
|
|
104665
104841
|
ecmaVersion: DYNAMIC_WORKFLOW_ECMA_VERSION,
|
|
@@ -104667,7 +104843,7 @@ function parseDynamicWorkflowSource(source) {
|
|
|
104667
104843
|
});
|
|
104668
104844
|
} catch (error2) {
|
|
104669
104845
|
const message2 = error2 instanceof Error ? error2.message : String(error2);
|
|
104670
|
-
throw
|
|
104846
|
+
throw dynamicStartRefusal(`Dynamic workflow source is not valid JavaScript: ${message2}. The source is evaluated as-is, so it cannot contain TypeScript syntax or module declarations. If the error is at an \`await\`, declare the function as \`async function ${exportName}(...)\`.`);
|
|
104671
104847
|
}
|
|
104672
104848
|
}
|
|
104673
104849
|
function assertGeneratedWorkflowCodeParses(workflowCode) {
|
|
@@ -104678,35 +104854,70 @@ function assertGeneratedWorkflowCodeParses(workflowCode) {
|
|
|
104678
104854
|
});
|
|
104679
104855
|
} catch (error2) {
|
|
104680
104856
|
const message2 = error2 instanceof Error ? error2.message : String(error2);
|
|
104681
|
-
throw
|
|
104857
|
+
throw dynamicStartRefusal(`Generated dynamic workflow code is not valid JavaScript: ${message2}.`);
|
|
104682
104858
|
}
|
|
104683
104859
|
}
|
|
104684
104860
|
function validateDynamicWorkflowSource(source, exportName) {
|
|
104685
104861
|
const byteLength = new TextEncoder().encode(source).byteLength;
|
|
104686
104862
|
if (byteLength > DYNAMIC_WORKFLOW_SOURCE_MAX_BYTES) {
|
|
104687
|
-
throw
|
|
104863
|
+
throw dynamicStartRefusal(`Dynamic workflow source is ${byteLength} bytes, over the ${DYNAMIC_WORKFLOW_SOURCE_MAX_BYTES}-byte limit.`);
|
|
104688
104864
|
}
|
|
104689
104865
|
if (UNSUPPORTED_DYNAMIC_MODULE_SYNTAX.test(source)) {
|
|
104690
|
-
throw
|
|
104691
|
-
}
|
|
104692
|
-
const program = parseDynamicWorkflowSource(source);
|
|
104693
|
-
const declarations = program.body.filter((node2) => node2.type === "FunctionDeclaration" && node2.id.name === exportName);
|
|
104694
|
-
const declaration = declarations.length === 1 ? declarations[0] : void 0;
|
|
104695
|
-
if (!declaration || !declaration.async || declaration.generator) {
|
|
104696
|
-
throw new WorkflowRuntimeError(`Dynamic workflow source must declare \`async function ${exportName}(...)\` at top level.`);
|
|
104866
|
+
throw dynamicStartRefusal("Dynamic workflow source cannot use `import` or `export`. Reach registered steps through the injected `steps` object instead.");
|
|
104697
104867
|
}
|
|
104868
|
+
const program = parseDynamicWorkflowSource(source, exportName);
|
|
104869
|
+
const declaration = findWorkflowDeclaration(program, exportName);
|
|
104698
104870
|
const firstStatement = declaration.body.body[0];
|
|
104699
104871
|
if ((firstStatement == null ? void 0 : firstStatement.type) !== "ExpressionStatement" || firstStatement.directive !== "use workflow") {
|
|
104700
|
-
throw
|
|
104872
|
+
throw dynamicStartRefusal(`Dynamic workflow function ${JSON.stringify(exportName)} must open with a "use workflow" directive.`);
|
|
104701
104873
|
}
|
|
104702
|
-
if (
|
|
104703
|
-
throw
|
|
104874
|
+
if (hasDirective(program, "use step")) {
|
|
104875
|
+
throw dynamicStartRefusal('Dynamic workflow source cannot declare "use step" functions. Register the step with the deployment and expose it through `experimental_dynamic.steps` instead.');
|
|
104704
104876
|
}
|
|
104705
104877
|
}
|
|
104878
|
+
function findWorkflowDeclaration(program, exportName) {
|
|
104879
|
+
const expected = `Dynamic workflow source must declare \`async function ${exportName}(...)\` at top level`;
|
|
104880
|
+
const declarations = program.body.filter((node2) => node2.type === "FunctionDeclaration" && node2.id.name === exportName);
|
|
104881
|
+
const [declaration] = declarations;
|
|
104882
|
+
let problem = "";
|
|
104883
|
+
if (declarations.length > 1) {
|
|
104884
|
+
problem = ` exactly once, but declares \`function ${exportName}\` ${declarations.length} times`;
|
|
104885
|
+
} else if (declaration == null ? void 0 : declaration.generator) {
|
|
104886
|
+
problem = `, but \`${exportName}\` is a generator function`;
|
|
104887
|
+
} else if (declaration && !declaration.async) {
|
|
104888
|
+
problem = `, but \`${exportName}\` is not async`;
|
|
104889
|
+
}
|
|
104890
|
+
if (!declaration || problem) {
|
|
104891
|
+
throw dynamicStartRefusal(`${expected}${problem}.`);
|
|
104892
|
+
}
|
|
104893
|
+
return declaration;
|
|
104894
|
+
}
|
|
104895
|
+
function hasDirective(program, directive) {
|
|
104896
|
+
const pending = [program];
|
|
104897
|
+
while (pending.length > 0) {
|
|
104898
|
+
const node2 = pending.pop();
|
|
104899
|
+
if (node2.directive === directive)
|
|
104900
|
+
return true;
|
|
104901
|
+
for (const child of childNodes(node2))
|
|
104902
|
+
pending.push(child);
|
|
104903
|
+
}
|
|
104904
|
+
return false;
|
|
104905
|
+
}
|
|
104906
|
+
function childNodes(node2) {
|
|
104907
|
+
const children2 = [];
|
|
104908
|
+
for (const value of Object.values(node2)) {
|
|
104909
|
+
for (const child of Array.isArray(value) ? value : [value]) {
|
|
104910
|
+
if (child && typeof child === "object" && "type" in child) {
|
|
104911
|
+
children2.push(child);
|
|
104912
|
+
}
|
|
104913
|
+
}
|
|
104914
|
+
}
|
|
104915
|
+
return children2;
|
|
104916
|
+
}
|
|
104706
104917
|
function resolveStepId(alias, value) {
|
|
104707
104918
|
const stepId = value && typeof value === "object" || typeof value === "function" ? value.stepId : void 0;
|
|
104708
104919
|
if (typeof stepId !== "string" || stepId.length === 0) {
|
|
104709
|
-
throw
|
|
104920
|
+
throw dynamicStartRefusal(`Dynamic workflow step ${JSON.stringify(alias)} must be an imported step function or an object with a non-empty \`stepId\`.`);
|
|
104710
104921
|
}
|
|
104711
104922
|
return stepId;
|
|
104712
104923
|
}
|
|
@@ -104715,13 +104926,16 @@ function dynamicWorkflowName(metadata) {
|
|
|
104715
104926
|
}
|
|
104716
104927
|
async function compileDynamicWorkflow(source, options) {
|
|
104717
104928
|
const exportName = options.exportName ?? "workflow";
|
|
104929
|
+
if (exportName.length > DYNAMIC_WORKFLOW_EXPORT_NAME_MAX_LENGTH) {
|
|
104930
|
+
throw dynamicStartRefusal(`Dynamic workflow exportName is ${exportName.length} characters, over the ${DYNAMIC_WORKFLOW_EXPORT_NAME_MAX_LENGTH}-character limit. It becomes part of the workflow id and queue name.`);
|
|
104931
|
+
}
|
|
104718
104932
|
assertDynamicWorkflowIdentifier("exportName", exportName);
|
|
104719
104933
|
if (!SAFE_DYNAMIC_EXPORT_NAME.test(exportName)) {
|
|
104720
|
-
throw
|
|
104934
|
+
throw dynamicStartRefusal(`Invalid dynamic workflow exportName ${JSON.stringify(exportName)}. Use letters, digits, and "_", not starting with a digit; "$" cannot appear in workflow queue names.`);
|
|
104721
104935
|
}
|
|
104722
104936
|
validateDynamicWorkflowSource(source, exportName);
|
|
104723
104937
|
if (!options.steps || Object.keys(options.steps).length === 0) {
|
|
104724
|
-
throw
|
|
104938
|
+
throw dynamicStartRefusal("Dynamic workflow options must expose at least one registered step through `experimental_dynamic.steps`.");
|
|
104725
104939
|
}
|
|
104726
104940
|
const stepEntries = Object.entries(options.steps).sort(([a2], [b2]) => a2 < b2 ? -1 : a2 > b2 ? 1 : 0).map(([alias, value]) => {
|
|
104727
104941
|
assertDynamicWorkflowIdentifier("step alias", alias);
|
|
@@ -104783,173 +104997,6 @@ function readDynamicWorkflowMetadata(executionContext) {
|
|
|
104783
104997
|
steps: candidate.steps && typeof candidate.steps === "object" ? candidate.steps : {}
|
|
104784
104998
|
};
|
|
104785
104999
|
}
|
|
104786
|
-
const version$1 = "5.0.0";
|
|
104787
|
-
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
104788
|
-
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@()[\]]+$/;
|
|
104789
|
-
function getWorkflowQueueName(workflowName, namespace2) {
|
|
104790
|
-
if (!SAFE_WORKFLOW_NAME_PATTERN.test(workflowName)) {
|
|
104791
|
-
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, at signs, parentheses, or square brackets`);
|
|
104792
|
-
}
|
|
104793
|
-
const prefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace2));
|
|
104794
|
-
return `${prefix}${workflowName}`;
|
|
104795
|
-
}
|
|
104796
|
-
const generateId = monotonicFactory();
|
|
104797
|
-
function getHealthCheckStreamName(correlationId) {
|
|
104798
|
-
return `__health_check__${correlationId}`;
|
|
104799
|
-
}
|
|
104800
|
-
function generateHealthCheckRunId(correlationId) {
|
|
104801
|
-
return `wrun_hc_${correlationId}`;
|
|
104802
|
-
}
|
|
104803
|
-
const HEALTH_CHECK_POLL_INTERVAL = 100;
|
|
104804
|
-
const HEALTH_CHECK_READ_TIMEOUT = 500;
|
|
104805
|
-
function withDeadline(promise2, ms2) {
|
|
104806
|
-
let timer2;
|
|
104807
|
-
return Promise.race([
|
|
104808
|
-
promise2,
|
|
104809
|
-
new Promise((_2, reject) => {
|
|
104810
|
-
timer2 = setTimeout(() => reject(new Error(`Operation timed out after ${ms2}ms`)), ms2);
|
|
104811
|
-
})
|
|
104812
|
-
]).finally(() => clearTimeout(timer2));
|
|
104813
|
-
}
|
|
104814
|
-
async function readStreamWithTimeout(reader, readTimeout) {
|
|
104815
|
-
const chunks = [];
|
|
104816
|
-
let done = false;
|
|
104817
|
-
let timedOut = false;
|
|
104818
|
-
while (!done && !timedOut) {
|
|
104819
|
-
const readPromise = reader.read();
|
|
104820
|
-
const timeoutPromise = new Promise((resolve2) => setTimeout(() => {
|
|
104821
|
-
timedOut = true;
|
|
104822
|
-
resolve2({ done: true, value: void 0 });
|
|
104823
|
-
}, readTimeout));
|
|
104824
|
-
const result = await Promise.race([readPromise, timeoutPromise]);
|
|
104825
|
-
done = result.done;
|
|
104826
|
-
if (result.value)
|
|
104827
|
-
chunks.push(result.value);
|
|
104828
|
-
}
|
|
104829
|
-
return { chunks, timedOut };
|
|
104830
|
-
}
|
|
104831
|
-
function parseHealthCheckResponse(chunks) {
|
|
104832
|
-
if (chunks.length === 0)
|
|
104833
|
-
return null;
|
|
104834
|
-
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
104835
|
-
const combined = new Uint8Array(totalLength);
|
|
104836
|
-
let offset3 = 0;
|
|
104837
|
-
for (const chunk of chunks) {
|
|
104838
|
-
combined.set(chunk, offset3);
|
|
104839
|
-
offset3 += chunk.length;
|
|
104840
|
-
}
|
|
104841
|
-
const responseText = new TextDecoder().decode(combined);
|
|
104842
|
-
let response2;
|
|
104843
|
-
try {
|
|
104844
|
-
response2 = JSON.parse(responseText);
|
|
104845
|
-
} catch {
|
|
104846
|
-
if (responseText.length > 0) {
|
|
104847
|
-
return { healthy: true, format: "text" };
|
|
104848
|
-
}
|
|
104849
|
-
return null;
|
|
104850
|
-
}
|
|
104851
|
-
if (typeof response2 !== "object" || response2 === null || !("healthy" in response2) || typeof response2.healthy !== "boolean") {
|
|
104852
|
-
return null;
|
|
104853
|
-
}
|
|
104854
|
-
const r2 = response2;
|
|
104855
|
-
const parsed = {
|
|
104856
|
-
healthy: r2.healthy,
|
|
104857
|
-
format: "json"
|
|
104858
|
-
};
|
|
104859
|
-
if (typeof r2.specVersion === "number") {
|
|
104860
|
-
parsed.specVersion = r2.specVersion;
|
|
104861
|
-
}
|
|
104862
|
-
if (typeof r2.workflowCoreVersion === "string") {
|
|
104863
|
-
parsed.workflowCoreVersion = r2.workflowCoreVersion;
|
|
104864
|
-
}
|
|
104865
|
-
if (typeof r2.encryptionPublicKey === "string") {
|
|
104866
|
-
parsed.encryptionPublicKey = r2.encryptionPublicKey;
|
|
104867
|
-
}
|
|
104868
|
-
if (typeof r2.hookResumeInputVersion === "number") {
|
|
104869
|
-
parsed.hookResumeInputVersion = r2.hookResumeInputVersion;
|
|
104870
|
-
}
|
|
104871
|
-
if (typeof r2.dynamicWorkflowVersion === "number") {
|
|
104872
|
-
parsed.dynamicWorkflowVersion = r2.dynamicWorkflowVersion;
|
|
104873
|
-
}
|
|
104874
|
-
return parsed;
|
|
104875
|
-
}
|
|
104876
|
-
async function healthCheck(world, options) {
|
|
104877
|
-
var _a3;
|
|
104878
|
-
const timeout2 = (options == null ? void 0 : options.timeout) ?? DEFAULT_HEALTH_CHECK_TIMEOUT;
|
|
104879
|
-
const correlationId = ((_a3 = world.createRunId) == null ? void 0 : _a3.call(world)) ?? generateId();
|
|
104880
|
-
const streamName = getHealthCheckStreamName(correlationId);
|
|
104881
|
-
const queueName = `${getQueueTopicPrefix("workflow", resolveQueueNamespace(options == null ? void 0 : options.namespace))}health_check`;
|
|
104882
|
-
const startTime = Date.now();
|
|
104883
|
-
try {
|
|
104884
|
-
await world.queue(queueName, {
|
|
104885
|
-
__healthCheck: true,
|
|
104886
|
-
correlationId,
|
|
104887
|
-
...(options == null ? void 0 : options.runId) ? { runId: options.runId } : {}
|
|
104888
|
-
}, {
|
|
104889
|
-
// Use JSON transport so the health check works against both
|
|
104890
|
-
// old (JSON-only) and new (dual) deployments.
|
|
104891
|
-
specVersion: SPEC_VERSION_LEGACY,
|
|
104892
|
-
deploymentId: options == null ? void 0 : options.deploymentId
|
|
104893
|
-
});
|
|
104894
|
-
while (Date.now() - startTime < timeout2) {
|
|
104895
|
-
try {
|
|
104896
|
-
const remainingMs = timeout2 - (Date.now() - startTime);
|
|
104897
|
-
const stream2 = await withDeadline(world.streams.get(generateHealthCheckRunId(correlationId), streamName), remainingMs);
|
|
104898
|
-
const reader = stream2.getReader();
|
|
104899
|
-
const { chunks, timedOut } = await readStreamWithTimeout(reader, HEALTH_CHECK_READ_TIMEOUT);
|
|
104900
|
-
if (timedOut) {
|
|
104901
|
-
try {
|
|
104902
|
-
reader.cancel();
|
|
104903
|
-
} catch {
|
|
104904
|
-
}
|
|
104905
|
-
await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
|
|
104906
|
-
continue;
|
|
104907
|
-
}
|
|
104908
|
-
const response2 = parseHealthCheckResponse(chunks);
|
|
104909
|
-
if (response2) {
|
|
104910
|
-
return {
|
|
104911
|
-
...response2,
|
|
104912
|
-
latencyMs: Date.now() - startTime
|
|
104913
|
-
};
|
|
104914
|
-
}
|
|
104915
|
-
await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
|
|
104916
|
-
} catch {
|
|
104917
|
-
await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
|
|
104918
|
-
}
|
|
104919
|
-
}
|
|
104920
|
-
return {
|
|
104921
|
-
healthy: false,
|
|
104922
|
-
error: `Health check timed out after ${timeout2}ms`
|
|
104923
|
-
};
|
|
104924
|
-
} catch (error2) {
|
|
104925
|
-
return {
|
|
104926
|
-
healthy: false,
|
|
104927
|
-
error: error2 instanceof Error ? error2.message : String(error2)
|
|
104928
|
-
};
|
|
104929
|
-
}
|
|
104930
|
-
}
|
|
104931
|
-
function normalizeAttributeChanges(attrs, options = {}, writer) {
|
|
104932
|
-
if (attrs === null || typeof attrs !== "object" || Array.isArray(attrs)) {
|
|
104933
|
-
throw new FatalError(`setAttributes requires a plain object, got ${attrs === null ? "null" : Array.isArray(attrs) ? "array" : typeof attrs}`);
|
|
104934
|
-
}
|
|
104935
|
-
const changes = Object.entries(attrs).map(([key, value]) => ({
|
|
104936
|
-
key,
|
|
104937
|
-
value: value === void 0 ? null : value
|
|
104938
|
-
}));
|
|
104939
|
-
if (changes.length === 0)
|
|
104940
|
-
return changes;
|
|
104941
|
-
const allowReservedAttributes = options.allowReservedAttributes === true;
|
|
104942
|
-
try {
|
|
104943
|
-
validateAttributeChanges(changes, { allowReservedAttributes });
|
|
104944
|
-
if (writer) ;
|
|
104945
|
-
} catch (err) {
|
|
104946
|
-
if (err instanceof AttributeValidationError) {
|
|
104947
|
-
throw new FatalError(err.message);
|
|
104948
|
-
}
|
|
104949
|
-
throw err;
|
|
104950
|
-
}
|
|
104951
|
-
return changes;
|
|
104952
|
-
}
|
|
104953
105000
|
var re = { exports: {} };
|
|
104954
105001
|
var constants$6;
|
|
104955
105002
|
var hasRequiredConstants$6;
|
|
@@ -106891,7 +106938,8 @@ const FORMAT_VERSION_TABLE = [
|
|
|
106891
106938
|
// bump to the next beta. A too-low cutoff makes new producers write
|
|
106892
106939
|
// compressed payloads to consumers that cannot decompress them; too-high
|
|
106893
106940
|
// merely delays the optimization (safe). gzip and zstd ship together, so
|
|
106894
|
-
// they share a min version
|
|
106941
|
+
// they share a min version. zstd additionally requires the run's runtime to
|
|
106942
|
+
// decode it; see `getRunCapabilities`.
|
|
106895
106943
|
{ format: SerializationFormat$1.GZIP, minVersion: "5.0.0-beta.18" },
|
|
106896
106944
|
{ format: SerializationFormat$1.ZSTD, minVersion: "5.0.0-beta.18" },
|
|
106897
106945
|
// TODO(release): verify this matches the actual version that ships sealed-box
|
|
@@ -106922,7 +106970,25 @@ const CAPABILITY_VERSION_TABLE = [
|
|
|
106922
106970
|
const BASELINE_FORMATS = /* @__PURE__ */ new Set([
|
|
106923
106971
|
SerializationFormat$1.DEVALUE_V1
|
|
106924
106972
|
]);
|
|
106925
|
-
|
|
106973
|
+
const ZSTD_NODE_RANGE = "^22.15.0 || >=23.8.0";
|
|
106974
|
+
function nodeVersionSupportsZstd(nodeVersion) {
|
|
106975
|
+
if (typeof nodeVersion !== "string" || !semver.valid(nodeVersion)) {
|
|
106976
|
+
return false;
|
|
106977
|
+
}
|
|
106978
|
+
return semver.satisfies(nodeVersion, ZSTD_NODE_RANGE);
|
|
106979
|
+
}
|
|
106980
|
+
function getCurrentNodeVersion() {
|
|
106981
|
+
var _a3;
|
|
106982
|
+
try {
|
|
106983
|
+
const versions = (_a3 = globalThis.process) == null ? void 0 : _a3.versions;
|
|
106984
|
+
if (!versions || versions.bun || versions.deno)
|
|
106985
|
+
return void 0;
|
|
106986
|
+
return typeof versions.node === "string" ? versions.node : void 0;
|
|
106987
|
+
} catch {
|
|
106988
|
+
return void 0;
|
|
106989
|
+
}
|
|
106990
|
+
}
|
|
106991
|
+
function getRunCapabilities(workflowCoreVersion, nodeVersion) {
|
|
106926
106992
|
if (!workflowCoreVersion || !semver.valid(workflowCoreVersion)) {
|
|
106927
106993
|
return {
|
|
106928
106994
|
supportedFormats: BASELINE_FORMATS,
|
|
@@ -106935,6 +107001,9 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
106935
107001
|
formats.add(format2);
|
|
106936
107002
|
}
|
|
106937
107003
|
}
|
|
107004
|
+
if (!nodeVersionSupportsZstd(nodeVersion)) {
|
|
107005
|
+
formats.delete(SerializationFormat$1.ZSTD);
|
|
107006
|
+
}
|
|
106938
107007
|
const result = {
|
|
106939
107008
|
supportedFormats: formats,
|
|
106940
107009
|
framedByteStreams: false
|
|
@@ -106946,6 +107015,182 @@ function getRunCapabilities(workflowCoreVersion) {
|
|
|
106946
107015
|
}
|
|
106947
107016
|
return result;
|
|
106948
107017
|
}
|
|
107018
|
+
function getCompressionMode(capabilities) {
|
|
107019
|
+
if (!capabilities.supportedFormats.has(SerializationFormat$1.GZIP)) {
|
|
107020
|
+
return false;
|
|
107021
|
+
}
|
|
107022
|
+
return capabilities.supportedFormats.has(SerializationFormat$1.ZSTD) ? true : "gzip";
|
|
107023
|
+
}
|
|
107024
|
+
const version$1 = "5.1.0";
|
|
107025
|
+
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
107026
|
+
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@()[\]]+$/;
|
|
107027
|
+
function getWorkflowQueueName(workflowName, namespace2) {
|
|
107028
|
+
if (!SAFE_WORKFLOW_NAME_PATTERN.test(workflowName)) {
|
|
107029
|
+
throw new Error(`Invalid workflow name "${workflowName}": must only contain alphanumeric characters, underscores, hyphens, dots, forward slashes, at signs, parentheses, or square brackets`);
|
|
107030
|
+
}
|
|
107031
|
+
const prefix = getQueueTopicPrefix("workflow", resolveQueueNamespace(namespace2));
|
|
107032
|
+
return `${prefix}${workflowName}`;
|
|
107033
|
+
}
|
|
107034
|
+
const generateId = monotonicFactory();
|
|
107035
|
+
function getHealthCheckStreamName(correlationId) {
|
|
107036
|
+
return `__health_check__${correlationId}`;
|
|
107037
|
+
}
|
|
107038
|
+
function generateHealthCheckRunId(correlationId) {
|
|
107039
|
+
return `wrun_hc_${correlationId}`;
|
|
107040
|
+
}
|
|
107041
|
+
const HEALTH_CHECK_POLL_INTERVAL = 100;
|
|
107042
|
+
const HEALTH_CHECK_READ_TIMEOUT = 500;
|
|
107043
|
+
function withDeadline(promise2, ms2) {
|
|
107044
|
+
let timer2;
|
|
107045
|
+
return Promise.race([
|
|
107046
|
+
promise2,
|
|
107047
|
+
new Promise((_2, reject) => {
|
|
107048
|
+
timer2 = setTimeout(() => reject(new Error(`Operation timed out after ${ms2}ms`)), ms2);
|
|
107049
|
+
})
|
|
107050
|
+
]).finally(() => clearTimeout(timer2));
|
|
107051
|
+
}
|
|
107052
|
+
async function readStreamWithTimeout(reader, readTimeout) {
|
|
107053
|
+
const chunks = [];
|
|
107054
|
+
let done = false;
|
|
107055
|
+
let timedOut = false;
|
|
107056
|
+
while (!done && !timedOut) {
|
|
107057
|
+
const readPromise = reader.read();
|
|
107058
|
+
const timeoutPromise = new Promise((resolve2) => setTimeout(() => {
|
|
107059
|
+
timedOut = true;
|
|
107060
|
+
resolve2({ done: true, value: void 0 });
|
|
107061
|
+
}, readTimeout));
|
|
107062
|
+
const result = await Promise.race([readPromise, timeoutPromise]);
|
|
107063
|
+
done = result.done;
|
|
107064
|
+
if (result.value)
|
|
107065
|
+
chunks.push(result.value);
|
|
107066
|
+
}
|
|
107067
|
+
return { chunks, timedOut };
|
|
107068
|
+
}
|
|
107069
|
+
function parseHealthCheckResponse(chunks) {
|
|
107070
|
+
if (chunks.length === 0)
|
|
107071
|
+
return null;
|
|
107072
|
+
const totalLength = chunks.reduce((sum, chunk) => sum + chunk.length, 0);
|
|
107073
|
+
const combined = new Uint8Array(totalLength);
|
|
107074
|
+
let offset3 = 0;
|
|
107075
|
+
for (const chunk of chunks) {
|
|
107076
|
+
combined.set(chunk, offset3);
|
|
107077
|
+
offset3 += chunk.length;
|
|
107078
|
+
}
|
|
107079
|
+
const responseText = new TextDecoder().decode(combined);
|
|
107080
|
+
let response2;
|
|
107081
|
+
try {
|
|
107082
|
+
response2 = JSON.parse(responseText);
|
|
107083
|
+
} catch {
|
|
107084
|
+
if (responseText.length > 0) {
|
|
107085
|
+
return { healthy: true, format: "text" };
|
|
107086
|
+
}
|
|
107087
|
+
return null;
|
|
107088
|
+
}
|
|
107089
|
+
if (typeof response2 !== "object" || response2 === null || !("healthy" in response2) || typeof response2.healthy !== "boolean") {
|
|
107090
|
+
return null;
|
|
107091
|
+
}
|
|
107092
|
+
const r2 = response2;
|
|
107093
|
+
const parsed = {
|
|
107094
|
+
healthy: r2.healthy,
|
|
107095
|
+
format: "json"
|
|
107096
|
+
};
|
|
107097
|
+
if (typeof r2.specVersion === "number") {
|
|
107098
|
+
parsed.specVersion = r2.specVersion;
|
|
107099
|
+
}
|
|
107100
|
+
if (typeof r2.workflowCoreVersion === "string") {
|
|
107101
|
+
parsed.workflowCoreVersion = r2.workflowCoreVersion;
|
|
107102
|
+
}
|
|
107103
|
+
if (typeof r2.nodeVersion === "string") {
|
|
107104
|
+
parsed.nodeVersion = r2.nodeVersion;
|
|
107105
|
+
}
|
|
107106
|
+
if (typeof r2.encryptionPublicKey === "string") {
|
|
107107
|
+
parsed.encryptionPublicKey = r2.encryptionPublicKey;
|
|
107108
|
+
}
|
|
107109
|
+
if (typeof r2.hookResumeInputVersion === "number") {
|
|
107110
|
+
parsed.hookResumeInputVersion = r2.hookResumeInputVersion;
|
|
107111
|
+
}
|
|
107112
|
+
if (typeof r2.dynamicWorkflowVersion === "number") {
|
|
107113
|
+
parsed.dynamicWorkflowVersion = r2.dynamicWorkflowVersion;
|
|
107114
|
+
}
|
|
107115
|
+
return parsed;
|
|
107116
|
+
}
|
|
107117
|
+
async function healthCheck(world, options) {
|
|
107118
|
+
var _a3;
|
|
107119
|
+
const timeout2 = (options == null ? void 0 : options.timeout) ?? DEFAULT_HEALTH_CHECK_TIMEOUT;
|
|
107120
|
+
const correlationId = ((_a3 = world.createRunId) == null ? void 0 : _a3.call(world)) ?? generateId();
|
|
107121
|
+
const streamName = getHealthCheckStreamName(correlationId);
|
|
107122
|
+
const queueName = `${getQueueTopicPrefix("workflow", resolveQueueNamespace(options == null ? void 0 : options.namespace))}health_check`;
|
|
107123
|
+
const startTime = Date.now();
|
|
107124
|
+
try {
|
|
107125
|
+
await world.queue(queueName, {
|
|
107126
|
+
__healthCheck: true,
|
|
107127
|
+
correlationId,
|
|
107128
|
+
...(options == null ? void 0 : options.runId) ? { runId: options.runId } : {}
|
|
107129
|
+
}, {
|
|
107130
|
+
// Use JSON transport so the health check works against both
|
|
107131
|
+
// old (JSON-only) and new (dual) deployments.
|
|
107132
|
+
specVersion: SPEC_VERSION_LEGACY,
|
|
107133
|
+
deploymentId: options == null ? void 0 : options.deploymentId
|
|
107134
|
+
});
|
|
107135
|
+
while (Date.now() - startTime < timeout2) {
|
|
107136
|
+
try {
|
|
107137
|
+
const remainingMs = timeout2 - (Date.now() - startTime);
|
|
107138
|
+
const stream2 = await withDeadline(world.streams.get(generateHealthCheckRunId(correlationId), streamName), remainingMs);
|
|
107139
|
+
const reader = stream2.getReader();
|
|
107140
|
+
const { chunks, timedOut } = await readStreamWithTimeout(reader, HEALTH_CHECK_READ_TIMEOUT);
|
|
107141
|
+
if (timedOut) {
|
|
107142
|
+
try {
|
|
107143
|
+
reader.cancel();
|
|
107144
|
+
} catch {
|
|
107145
|
+
}
|
|
107146
|
+
await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
|
|
107147
|
+
continue;
|
|
107148
|
+
}
|
|
107149
|
+
const response2 = parseHealthCheckResponse(chunks);
|
|
107150
|
+
if (response2) {
|
|
107151
|
+
return {
|
|
107152
|
+
...response2,
|
|
107153
|
+
latencyMs: Date.now() - startTime
|
|
107154
|
+
};
|
|
107155
|
+
}
|
|
107156
|
+
await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
|
|
107157
|
+
} catch {
|
|
107158
|
+
await new Promise((resolve2) => setTimeout(resolve2, HEALTH_CHECK_POLL_INTERVAL));
|
|
107159
|
+
}
|
|
107160
|
+
}
|
|
107161
|
+
return {
|
|
107162
|
+
healthy: false,
|
|
107163
|
+
error: `Health check timed out after ${timeout2}ms`
|
|
107164
|
+
};
|
|
107165
|
+
} catch (error2) {
|
|
107166
|
+
return {
|
|
107167
|
+
healthy: false,
|
|
107168
|
+
error: error2 instanceof Error ? error2.message : String(error2)
|
|
107169
|
+
};
|
|
107170
|
+
}
|
|
107171
|
+
}
|
|
107172
|
+
function normalizeAttributeChanges(attrs, options = {}, writer) {
|
|
107173
|
+
if (attrs === null || typeof attrs !== "object" || Array.isArray(attrs)) {
|
|
107174
|
+
throw new FatalError(`setAttributes requires a plain object, got ${attrs === null ? "null" : Array.isArray(attrs) ? "array" : typeof attrs}`);
|
|
107175
|
+
}
|
|
107176
|
+
const changes = Object.entries(attrs).map(([key, value]) => ({
|
|
107177
|
+
key,
|
|
107178
|
+
value: value === void 0 ? null : value
|
|
107179
|
+
}));
|
|
107180
|
+
if (changes.length === 0)
|
|
107181
|
+
return changes;
|
|
107182
|
+
const allowReservedAttributes = options.allowReservedAttributes === true;
|
|
107183
|
+
try {
|
|
107184
|
+
validateAttributeChanges(changes, { allowReservedAttributes });
|
|
107185
|
+
if (writer) ;
|
|
107186
|
+
} catch (err) {
|
|
107187
|
+
if (err instanceof AttributeValidationError) {
|
|
107188
|
+
throw new FatalError(err.message);
|
|
107189
|
+
}
|
|
107190
|
+
throw err;
|
|
107191
|
+
}
|
|
107192
|
+
return changes;
|
|
107193
|
+
}
|
|
106949
107194
|
const WORKFLOW_VMS = ["node", "quickjs"];
|
|
106950
107195
|
function getWorkflowVmFromEnv(env2 = process.env) {
|
|
106951
107196
|
const raw2 = env2.WORKFLOW_VM;
|
|
@@ -106956,8 +107201,18 @@ function getWorkflowVmFromEnv(env2 = process.env) {
|
|
|
106956
107201
|
}
|
|
106957
107202
|
throw new WorkflowRuntimeError(`Invalid WORKFLOW_VM value: "${raw2}". Expected one of: ${WORKFLOW_VMS.join(", ")}.`);
|
|
106958
107203
|
}
|
|
107204
|
+
function getSnapshotThresholdFromEnv(env2 = process.env) {
|
|
107205
|
+
const raw2 = env2.WORKFLOW_SNAPSHOT_THRESHOLD;
|
|
107206
|
+
if (raw2 === void 0 || raw2 === "")
|
|
107207
|
+
return void 0;
|
|
107208
|
+
const parsed = /^\d+$/.test(raw2) ? Number(raw2) : Number.NaN;
|
|
107209
|
+
if (!Number.isSafeInteger(parsed)) {
|
|
107210
|
+
throw new WorkflowRuntimeError(`Invalid WORKFLOW_SNAPSHOT_THRESHOLD value: "${raw2}". Expected a non-negative integer (0 disables snapshotting).`);
|
|
107211
|
+
}
|
|
107212
|
+
return parsed;
|
|
107213
|
+
}
|
|
106959
107214
|
function waitUntil(promise2) {
|
|
106960
|
-
void import("./index-
|
|
107215
|
+
void import("./index-HeFIWQE6.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
106961
107216
|
waitUntil2(promise2);
|
|
106962
107217
|
});
|
|
106963
107218
|
}
|
|
@@ -107054,7 +107309,7 @@ async function probeCrossDeployment(world, options) {
|
|
|
107054
107309
|
}
|
|
107055
107310
|
function assertDynamicWorkflowsEnabled() {
|
|
107056
107311
|
if (!isDynamicWorkflowsEnabled()) {
|
|
107057
|
-
throw
|
|
107312
|
+
throw dynamicStartRefusal(`Dynamic workflows are disabled on this deployment, so no run was created. Set ${DYNAMIC_WORKFLOWS_ENV}=1 on the deployment to enable them.`);
|
|
107058
107313
|
}
|
|
107059
107314
|
}
|
|
107060
107315
|
async function start$1(workflow, argsOrOptions, options) {
|
|
@@ -107072,7 +107327,7 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
107072
107327
|
if (typeof workflow === "string") {
|
|
107073
107328
|
const dynamicOptions = opts.experimental_dynamic;
|
|
107074
107329
|
if (!dynamicOptions) {
|
|
107075
|
-
throw
|
|
107330
|
+
throw dynamicStartRefusal("'start' was given workflow source but no `experimental_dynamic` options. Pass `{ experimental_dynamic: { steps } }` to declare which registered steps the source may call.");
|
|
107076
107331
|
}
|
|
107077
107332
|
const compiled = await compileDynamicWorkflow(workflow, dynamicOptions);
|
|
107078
107333
|
assertDynamicWorkflowsEnabled();
|
|
@@ -107127,28 +107382,31 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
107127
107382
|
}
|
|
107128
107383
|
const crossDeployment = deploymentId !== currentDeploymentId;
|
|
107129
107384
|
if (dynamicWorkflow && crossDeployment) {
|
|
107130
|
-
const
|
|
107131
|
-
throw
|
|
107385
|
+
const message2 = `Dynamic workflows can only start on the current deployment. This start targets ${JSON.stringify(deploymentId)} from ${currentDeploymentId === void 0 ? "an unknown current deployment" : JSON.stringify(currentDeploymentId)}, so no run was created.`;
|
|
107386
|
+
throw currentDeploymentId === void 0 ? new WorkflowRuntimeError(message2) : dynamicStartRefusal(message2);
|
|
107132
107387
|
}
|
|
107133
107388
|
const runId = `wrun_${world.createRunId ? world.createRunId(opts) : ulid()}`;
|
|
107134
107389
|
if (dynamicWorkflow && !((_a3 = world.capabilities) == null ? void 0 : _a3.dynamicWorkflowCode)) {
|
|
107135
|
-
throw
|
|
107390
|
+
throw dynamicStartRefusal("Dynamic workflows require a World that declares `capabilities.dynamicWorkflowCode`. This World does not, so no run was created.");
|
|
107136
107391
|
}
|
|
107137
107392
|
let framedByteStreams;
|
|
107138
|
-
let
|
|
107393
|
+
let targetCompression;
|
|
107394
|
+
let targetNodeVersion;
|
|
107139
107395
|
let targetHookResumeInputVersion;
|
|
107140
107396
|
let probedRunPublicKey;
|
|
107141
107397
|
let targetSpecVersion;
|
|
107142
107398
|
let specVersionSource;
|
|
107143
107399
|
if (!crossDeployment) {
|
|
107144
107400
|
framedByteStreams = true;
|
|
107145
|
-
|
|
107401
|
+
targetCompression = true;
|
|
107402
|
+
targetNodeVersion = getCurrentNodeVersion();
|
|
107146
107403
|
targetHookResumeInputVersion = HOOK_RESUME_INPUT_VERSION;
|
|
107147
107404
|
targetSpecVersion = world.specVersion;
|
|
107148
107405
|
specVersionSource = "same-deployment";
|
|
107149
107406
|
} else if (typeof ((_b2 = world.streams) == null ? void 0 : _b2.get) !== "function") {
|
|
107150
107407
|
framedByteStreams = false;
|
|
107151
|
-
|
|
107408
|
+
targetCompression = false;
|
|
107409
|
+
targetNodeVersion = void 0;
|
|
107152
107410
|
targetHookResumeInputVersion = void 0;
|
|
107153
107411
|
({ specVersion: targetSpecVersion, source: specVersionSource } = resolveCrossDeploymentSpecVersion(void 0, world.specVersion));
|
|
107154
107412
|
} else {
|
|
@@ -107158,9 +107416,10 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
107158
107416
|
namespace: opts.namespace
|
|
107159
107417
|
});
|
|
107160
107418
|
probedRunPublicKey = probe == null ? void 0 : probe.encryptionPublicKey;
|
|
107161
|
-
const capabilities = getRunCapabilities(probe == null ? void 0 : probe.workflowCoreVersion);
|
|
107419
|
+
const capabilities = getRunCapabilities(probe == null ? void 0 : probe.workflowCoreVersion, probe == null ? void 0 : probe.nodeVersion);
|
|
107162
107420
|
framedByteStreams = capabilities.framedByteStreams;
|
|
107163
|
-
|
|
107421
|
+
targetCompression = getCompressionMode(capabilities);
|
|
107422
|
+
targetNodeVersion = probe == null ? void 0 : probe.nodeVersion;
|
|
107164
107423
|
targetHookResumeInputVersion = probe == null ? void 0 : probe.hookResumeInputVersion;
|
|
107165
107424
|
({ specVersion: targetSpecVersion, source: specVersionSource } = resolveCrossDeploymentSpecVersion(probe, world.specVersion));
|
|
107166
107425
|
span == null ? void 0 : span.setAttributes({
|
|
@@ -107240,19 +107499,26 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
107240
107499
|
encryptionPublicKey = rawKey ? bytesToBase64((await deriveRunKeyPair(rawKey)).publicKey) : void 0;
|
|
107241
107500
|
}
|
|
107242
107501
|
const workflowVm = getWorkflowVmFromEnv();
|
|
107502
|
+
const snapshotThreshold = getSnapshotThresholdFromEnv();
|
|
107243
107503
|
const executionContext = {
|
|
107244
107504
|
traceCarrier,
|
|
107245
107505
|
workflowCoreVersion: version$1,
|
|
107506
|
+
...targetNodeVersion ? { nodeVersion: targetNodeVersion } : {},
|
|
107246
107507
|
features: { encryption: !!encryptionKey },
|
|
107247
107508
|
...targetHookResumeInputVersion !== void 0 ? { hookResumeInputVersion: targetHookResumeInputVersion } : {},
|
|
107248
107509
|
...workflowVm ? { workflowVm } : {},
|
|
107510
|
+
...snapshotThreshold !== void 0 ? { snapshotThreshold } : {},
|
|
107249
107511
|
...opts.replayedFromRunId ? { replayedFromRunId: opts.replayedFromRunId } : {},
|
|
107250
107512
|
...dynamicWorkflow ? { dynamicWorkflow: dynamicWorkflow.metadata } : {}
|
|
107251
107513
|
};
|
|
107252
107514
|
if (dynamicWorkflow) {
|
|
107253
|
-
|
|
107515
|
+
try {
|
|
107516
|
+
(_d2 = world.validateRunExecutionContext) == null ? void 0 : _d2.call(world, executionContext);
|
|
107517
|
+
} catch (err) {
|
|
107518
|
+
throw dynamicStartRefusalFrom(err);
|
|
107519
|
+
}
|
|
107254
107520
|
}
|
|
107255
|
-
const compression =
|
|
107521
|
+
const compression = specVersion >= SPEC_VERSION_SUPPORTS_COMPRESSION ? targetCompression : false;
|
|
107256
107522
|
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat, framedByteStreams, compression);
|
|
107257
107523
|
let dynamicWorkflowCode;
|
|
107258
107524
|
let dynamicWorkflowCodeRef;
|
|
@@ -107275,20 +107541,27 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
107275
107541
|
...dynamicWorkflowCodeRef ? { dynamicWorkflowCodeRef } : {}
|
|
107276
107542
|
} : {};
|
|
107277
107543
|
const creatorEnvironment = (_e2 = world.getEnvironment) == null ? void 0 : _e2.call(world);
|
|
107544
|
+
const runCreated = world.events.create(runId, {
|
|
107545
|
+
eventType: "run_created",
|
|
107546
|
+
specVersion,
|
|
107547
|
+
eventData: {
|
|
107548
|
+
deploymentId,
|
|
107549
|
+
workflowName,
|
|
107550
|
+
input: workflowArguments,
|
|
107551
|
+
executionContext,
|
|
107552
|
+
...encryptionPublicKey ? { encryptionPublicKey } : {},
|
|
107553
|
+
...attributeSeed,
|
|
107554
|
+
...dynamicWorkflowSeed
|
|
107555
|
+
}
|
|
107556
|
+
}, { v1Compat });
|
|
107557
|
+
if (dynamicWorkflow) {
|
|
107558
|
+
const { run: run2 } = await runCreated;
|
|
107559
|
+
if (run2.dynamicWorkflowCode === void 0) {
|
|
107560
|
+
throw new WorkflowRuntimeError(`Workflow run ${runId} was created, but this deployment's Workflow backend did not store its dynamic workflow code, so the run can never be replayed. It was not queued, so it will not execute. Dynamic workflows require a backend with encrypted dynamic-source storage; upgrade it, or start a workflow function from the build-time manifest instead.`);
|
|
107561
|
+
}
|
|
107562
|
+
}
|
|
107278
107563
|
const [runCreatedResult, queueResult] = await Promise.allSettled([
|
|
107279
|
-
|
|
107280
|
-
eventType: "run_created",
|
|
107281
|
-
specVersion,
|
|
107282
|
-
eventData: {
|
|
107283
|
-
deploymentId,
|
|
107284
|
-
workflowName,
|
|
107285
|
-
input: workflowArguments,
|
|
107286
|
-
executionContext,
|
|
107287
|
-
...encryptionPublicKey ? { encryptionPublicKey } : {},
|
|
107288
|
-
...attributeSeed,
|
|
107289
|
-
...dynamicWorkflowSeed
|
|
107290
|
-
}
|
|
107291
|
-
}, { v1Compat }),
|
|
107564
|
+
runCreated,
|
|
107292
107565
|
world.queue(queueName, {
|
|
107293
107566
|
runId,
|
|
107294
107567
|
traceCarrier,
|
|
@@ -107333,9 +107606,6 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
107333
107606
|
if (!v1Compat && result.run.runId !== runId) {
|
|
107334
107607
|
throw new WorkflowRuntimeError(`Server returned different runId than requested: expected ${runId}, got ${result.run.runId}`);
|
|
107335
107608
|
}
|
|
107336
|
-
if (dynamicWorkflow && result.run.dynamicWorkflowCode === void 0) {
|
|
107337
|
-
throw new WorkflowRuntimeError(`Workflow run ${runId} was created, but this deployment's Workflow backend did not store its dynamic workflow code, so the run can never be replayed. Dynamic workflows require a backend with encrypted dynamic-source storage; upgrade it, or start a workflow function from the build-time manifest instead.`);
|
|
107338
|
-
}
|
|
107339
107609
|
}
|
|
107340
107610
|
safeWaitUntil(Promise.all(ops), (err) => {
|
|
107341
107611
|
runtimeLogger.warn("Background flush of workflow argument streams failed", {
|
|
@@ -108184,7 +108454,7 @@ function resolveRecoverActiveRuns(config2) {
|
|
|
108184
108454
|
function resolveDirectBaseUrl(config2) {
|
|
108185
108455
|
return config2.baseUrl ?? process.env.WORKFLOW_LOCAL_BASE_URL ?? createWorkflowBaseUrl("http://localhost");
|
|
108186
108456
|
}
|
|
108187
|
-
async function resolveBaseUrl
|
|
108457
|
+
async function resolveBaseUrl(config2) {
|
|
108188
108458
|
if (config2.baseUrl) {
|
|
108189
108459
|
return config2.baseUrl;
|
|
108190
108460
|
}
|
|
@@ -135990,7 +136260,7 @@ function createQueue$2(config2) {
|
|
|
135990
136260
|
}), { method: "POST", headers: headers2, body: body2 });
|
|
135991
136261
|
response2 = await directHandler(req);
|
|
135992
136262
|
} else {
|
|
135993
|
-
const baseUrl = await resolveBaseUrl
|
|
136263
|
+
const baseUrl = await resolveBaseUrl(config2);
|
|
135994
136264
|
const url = createWorkflowUrl(baseUrl, { type: "flow" });
|
|
135995
136265
|
response2 = nodeHttpAgents ? await nodeHttpFetch(url, {
|
|
135996
136266
|
method: "POST",
|
|
@@ -140519,6 +140789,12 @@ function createEventsStorage(basedir, tag) {
|
|
|
140519
140789
|
return { event: occupant };
|
|
140520
140790
|
}
|
|
140521
140791
|
}
|
|
140792
|
+
if (data2.eventType === "hook_created" && data2.correlationId) {
|
|
140793
|
+
const occupant = await readJSONWithFallback(basedir, "events", `${effectiveRunId}-${eventId}`, ReadEventSchema, tag);
|
|
140794
|
+
if ((occupant == null ? void 0 : occupant.eventType) === "hook_created" && occupant.correlationId === data2.correlationId) {
|
|
140795
|
+
break;
|
|
140796
|
+
}
|
|
140797
|
+
}
|
|
140522
140798
|
if (!await bumpEventSlot(attempt)) {
|
|
140523
140799
|
break;
|
|
140524
140800
|
}
|
|
@@ -140691,6 +140967,34 @@ function createEventsStorage(basedir, tag) {
|
|
|
140691
140967
|
});
|
|
140692
140968
|
return { ...storage, create: create2 };
|
|
140693
140969
|
}
|
|
140970
|
+
function createSnapshotsStorage$1(basedir) {
|
|
140971
|
+
const snapshotsDir = path$3.join(basedir, "snapshots");
|
|
140972
|
+
function envelopePath(runId) {
|
|
140973
|
+
assertSafeEntityId("runId", runId);
|
|
140974
|
+
return resolveWithinBase(snapshotsDir, `${runId}.snapshot`);
|
|
140975
|
+
}
|
|
140976
|
+
return {
|
|
140977
|
+
async save(runId, data2, metadata) {
|
|
140978
|
+
await ensureDir(snapshotsDir);
|
|
140979
|
+
await write(envelopePath(runId), Buffer.from(encodeSnapshotEnvelope(metadata, data2)), { overwrite: true });
|
|
140980
|
+
},
|
|
140981
|
+
async load(runId) {
|
|
140982
|
+
let envelope;
|
|
140983
|
+
try {
|
|
140984
|
+
envelope = await readBuffer(envelopePath(runId));
|
|
140985
|
+
} catch (error2) {
|
|
140986
|
+
if (error2.code === "ENOENT") {
|
|
140987
|
+
return null;
|
|
140988
|
+
}
|
|
140989
|
+
throw error2;
|
|
140990
|
+
}
|
|
140991
|
+
return decodeSnapshotEnvelope(new Uint8Array(envelope.buffer, envelope.byteOffset, envelope.byteLength));
|
|
140992
|
+
},
|
|
140993
|
+
async delete(runId) {
|
|
140994
|
+
await fs$1.rm(envelopePath(runId), { force: true });
|
|
140995
|
+
}
|
|
140996
|
+
};
|
|
140997
|
+
}
|
|
140694
140998
|
function createStepsStorage(basedir, tag) {
|
|
140695
140999
|
return {
|
|
140696
141000
|
get: (async (runId, stepId, params) => {
|
|
@@ -140737,11 +141041,13 @@ function createStorage$1(basedir, tag) {
|
|
|
140737
141041
|
const steps = createStepsStorage(basedir, tag);
|
|
140738
141042
|
const events2 = createEventsStorage(basedir, tag);
|
|
140739
141043
|
const hooks = createHooksStorage(basedir, tag);
|
|
141044
|
+
const snapshots = createSnapshotsStorage$1(basedir);
|
|
140740
141045
|
return {
|
|
140741
141046
|
runs: instrumentObject$1("world.runs", runs),
|
|
140742
141047
|
steps: instrumentObject$1("world.steps", steps),
|
|
140743
141048
|
events: instrumentObject$1("world.events", events2),
|
|
140744
141049
|
hooks: instrumentObject$1("world.hooks", hooks),
|
|
141050
|
+
experimental_snapshots: instrumentObject$1("world.experimental_snapshots", snapshots),
|
|
140745
141051
|
clearCache: () => events2.clearCache()
|
|
140746
141052
|
};
|
|
140747
141053
|
}
|
|
@@ -140803,7 +141109,7 @@ function createWorld$2(args) {
|
|
|
140803
141109
|
const basedir = mergedConfig.dataDir;
|
|
140804
141110
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
140805
141111
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
140806
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
141112
|
+
const { HookSchema: HookSchema2 } = await import("./index-xhDuD_-a.js");
|
|
140807
141113
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
140808
141114
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
140809
141115
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -140986,8 +141292,8 @@ function requireGetVercelOidcToken() {
|
|
|
140986
141292
|
}
|
|
140987
141293
|
try {
|
|
140988
141294
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
140989
|
-
await import("./token-util-
|
|
140990
|
-
await import("./token-
|
|
141295
|
+
await import("./token-util-D-AD5yDZ.js").then((n) => n.t),
|
|
141296
|
+
await import("./token-Dp-Ryz8o.js").then((n) => n.t)
|
|
140991
141297
|
]);
|
|
140992
141298
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
140993
141299
|
await refreshToken(options);
|
|
@@ -141550,7 +141856,7 @@ function requireDist() {
|
|
|
141550
141856
|
return dist;
|
|
141551
141857
|
}
|
|
141552
141858
|
var distExports = requireDist();
|
|
141553
|
-
const version = "5.
|
|
141859
|
+
const version = "5.1.0";
|
|
141554
141860
|
const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
|
|
141555
141861
|
dispatcher: void 0,
|
|
141556
141862
|
queueDispatcher: void 0,
|
|
@@ -141862,12 +142168,15 @@ function createEventsDispatcher(agentOverrides) {
|
|
|
141862
142168
|
...h2 ? EVENTS_AGENT_OPTIONS : EVENTS_AGENT_OPTIONS_NO_H2,
|
|
141863
142169
|
...agentOverrides
|
|
141864
142170
|
}), EVENTS_RETRY_AGENT_OPTIONS);
|
|
141865
|
-
if (!h2) {
|
|
142171
|
+
if (!h2 || !supportsCompose(agent2)) {
|
|
141866
142172
|
return agent2;
|
|
141867
142173
|
}
|
|
141868
142174
|
const streamedBodyAgent = new undiciExports.RetryAgent(new undiciExports.Agent({ ...EVENTS_AGENT_OPTIONS_NO_H2, ...agentOverrides }), EVENTS_RETRY_AGENT_OPTIONS);
|
|
141869
142175
|
return withBoundLifecycle(agent2, agent2.compose(createH2MultiplexInterceptor(streamedBodyAgent)), streamedBodyAgent);
|
|
141870
142176
|
}
|
|
142177
|
+
function supportsCompose(dispatcher2) {
|
|
142178
|
+
return typeof dispatcher2.compose === "function";
|
|
142179
|
+
}
|
|
141871
142180
|
function withBoundLifecycle(agent2, composed, companion) {
|
|
141872
142181
|
return new Proxy(composed, {
|
|
141873
142182
|
get: (target2, key) => {
|
|
@@ -141888,7 +142197,8 @@ function createStreamDispatcher(retryOptions, agentOverrides) {
|
|
|
141888
142197
|
return new undiciExports.RetryAgent(new undiciExports.Agent({ ...STREAM_AGENT_OPTIONS, ...agentOverrides }), retryOptions);
|
|
141889
142198
|
}
|
|
141890
142199
|
function createQueueDispatcher() {
|
|
141891
|
-
|
|
142200
|
+
const agent2 = new undiciExports.Agent(getQueueAgentOptions());
|
|
142201
|
+
return new undiciExports.RetryAgent(supportsCompose(agent2) ? agent2.compose(deadlineInterceptor(getQueueRequestTimeoutMs())) : agent2, RETRY_AGENT_OPTIONS);
|
|
141892
142202
|
}
|
|
141893
142203
|
function getDefaultQueueDispatcher() {
|
|
141894
142204
|
pools.queueDispatcher ?? (pools.queueDispatcher = createQueueDispatcher());
|
|
@@ -142034,6 +142344,8 @@ const StepStsoMs = SemanticConvention("step.stso_ms");
|
|
|
142034
142344
|
const StepLatencyOptimizations = SemanticConvention("step.latency_optimizations");
|
|
142035
142345
|
const WorkflowWsUrl = SemanticConvention("workflow.events.ws.url");
|
|
142036
142346
|
const WorkflowWsRequestId = SemanticConvention("workflow.events.ws.req_id");
|
|
142347
|
+
const WorkflowWsRequestParts = SemanticConvention("workflow.events.ws.request_parts");
|
|
142348
|
+
const WorkflowWsReplyParts = SemanticConvention("workflow.events.ws.reply_parts");
|
|
142037
142349
|
const WorkflowWsReconnectAttempt = SemanticConvention("workflow.events.ws.reconnect_attempt");
|
|
142038
142350
|
const REQUEST_TIMEOUT_MS = 6e4;
|
|
142039
142351
|
const TRANSIENT_TRANSPORT_ERROR_CODES = /* @__PURE__ */ new Set([
|
|
@@ -142149,7 +142461,7 @@ function parseRetryAfter(value) {
|
|
|
142149
142461
|
const parsed = parseInt(value, 10);
|
|
142150
142462
|
return Number.isNaN(parsed) ? void 0 : parsed;
|
|
142151
142463
|
}
|
|
142152
|
-
function headersToRecord(headers2) {
|
|
142464
|
+
function headersToRecord$1(headers2) {
|
|
142153
142465
|
const out = {};
|
|
142154
142466
|
headers2.forEach((value, key) => {
|
|
142155
142467
|
out[key] = value;
|
|
@@ -143278,11 +143590,11 @@ function validateRunExecutionContext(value) {
|
|
|
143278
143590
|
}
|
|
143279
143591
|
const bytes = new TextEncoder().encode(json).byteLength;
|
|
143280
143592
|
if (bytes > MAX_EXECUTION_CONTEXT_BYTES) {
|
|
143281
|
-
throw new WorkflowRuntimeError(`Dynamic workflow execution context is ${bytes} bytes, exceeding the ${MAX_EXECUTION_CONTEXT_BYTES}-byte limit, so no run was created. Bind fewer steps through \`experimental_dynamic.steps
|
|
143593
|
+
throw new WorkflowRuntimeError(`Dynamic workflow execution context is ${bytes} bytes, exceeding the ${MAX_EXECUTION_CONTEXT_BYTES}-byte limit, so no run was created. Each step binding counts its alias and its step ID, which comes from the step's file path and function name and is usually the longer of the two; the \`exportName\` counts too. Bind fewer steps through \`experimental_dynamic.steps\`, or shorten the aliases, the step files' paths or names, or the \`exportName\`.`);
|
|
143282
143594
|
}
|
|
143283
143595
|
}
|
|
143284
143596
|
async function getDeadline() {
|
|
143285
|
-
const { getDeadline: getDeadline2 } = await import("./index-
|
|
143597
|
+
const { getDeadline: getDeadline2 } = await import("./index-HeFIWQE6.js").then((n) => n.i);
|
|
143286
143598
|
return getDeadline2();
|
|
143287
143599
|
}
|
|
143288
143600
|
const WORKFLOW_SERVER_SERVICE = {
|
|
@@ -145808,6 +146120,18 @@ var MessageCorruptedError = class extends Error {
|
|
|
145808
146120
|
this.name = "MessageCorruptedError";
|
|
145809
146121
|
}
|
|
145810
146122
|
};
|
|
146123
|
+
var MessageLockedError = class extends MessageNotAvailableError {
|
|
146124
|
+
constructor(messageId, retryAfter) {
|
|
146125
|
+
super(
|
|
146126
|
+
messageId,
|
|
146127
|
+
retryAfter !== void 0 ? `temporarily locked. Retry after ${retryAfter} seconds.` : "temporarily locked. Try again later."
|
|
146128
|
+
);
|
|
146129
|
+
/** Suggested retry delay in seconds, if provided by the server. */
|
|
146130
|
+
__publicField(this, "retryAfter");
|
|
146131
|
+
this.name = "MessageLockedError";
|
|
146132
|
+
this.retryAfter = retryAfter;
|
|
146133
|
+
}
|
|
146134
|
+
};
|
|
145811
146135
|
var TooManyRequestsError = class extends Error {
|
|
145812
146136
|
constructor(message2 = "Too many requests", retryAfter) {
|
|
145813
146137
|
super(message2);
|
|
@@ -145835,6 +146159,12 @@ var BadRequestError = class extends Error {
|
|
|
145835
146159
|
this.name = "BadRequestError";
|
|
145836
146160
|
}
|
|
145837
146161
|
};
|
|
146162
|
+
var PayloadTooLargeError = class extends Error {
|
|
146163
|
+
constructor(message2) {
|
|
146164
|
+
super(message2);
|
|
146165
|
+
this.name = "PayloadTooLargeError";
|
|
146166
|
+
}
|
|
146167
|
+
};
|
|
145838
146168
|
var InternalServerError = class extends Error {
|
|
145839
146169
|
constructor(message2 = "Unexpected server error") {
|
|
145840
146170
|
super(message2);
|
|
@@ -145980,12 +146310,13 @@ var ConsumerGroup = class {
|
|
|
145980
146310
|
* - On transient failures (5xx, network errors): retry every 3 seconds
|
|
145981
146311
|
* - On 4xx client errors: stop retrying (the lease is lost or invalid)
|
|
145982
146312
|
*
|
|
145983
|
-
* @param
|
|
146313
|
+
* @param message - The message ID and receipt handle for the active lease
|
|
145984
146314
|
* @param options - Optional configuration
|
|
145985
146315
|
* @param options.visibilityDeadline - Absolute deadline (from server's `ce-vqsvisibilitydeadline`)
|
|
145986
146316
|
* when the current visibility timeout expires. Used to calculate the first extension delay.
|
|
145987
146317
|
*/
|
|
145988
|
-
startVisibilityExtension(
|
|
146318
|
+
startVisibilityExtension(message2, options) {
|
|
146319
|
+
const { messageId, receiptHandle } = message2;
|
|
145989
146320
|
let isRunning = true;
|
|
145990
146321
|
let isResolved = false;
|
|
145991
146322
|
let resolveLifecycle;
|
|
@@ -146017,6 +146348,7 @@ var ConsumerGroup = class {
|
|
|
146017
146348
|
}
|
|
146018
146349
|
try {
|
|
146019
146350
|
await this.client.changeVisibility({
|
|
146351
|
+
messageId,
|
|
146020
146352
|
queueName: this.topicName,
|
|
146021
146353
|
consumerGroup: this.consumerGroupName,
|
|
146022
146354
|
receiptHandle,
|
|
@@ -146075,10 +146407,7 @@ var ConsumerGroup = class {
|
|
|
146075
146407
|
}
|
|
146076
146408
|
}
|
|
146077
146409
|
async processMessage(message2, handler, options) {
|
|
146078
|
-
const stopExtension = this.startVisibilityExtension(
|
|
146079
|
-
message2.receiptHandle,
|
|
146080
|
-
options
|
|
146081
|
-
);
|
|
146410
|
+
const stopExtension = this.startVisibilityExtension(message2, options);
|
|
146082
146411
|
const DEFAULT_RETENTION_MS = 864e5;
|
|
146083
146412
|
const metadata = {
|
|
146084
146413
|
messageId: message2.messageId,
|
|
@@ -146093,6 +146422,7 @@ var ConsumerGroup = class {
|
|
|
146093
146422
|
await handler(message2.payload, metadata);
|
|
146094
146423
|
await stopExtension();
|
|
146095
146424
|
await this.client.acknowledgeMessage({
|
|
146425
|
+
messageId: message2.messageId,
|
|
146096
146426
|
queueName: this.topicName,
|
|
146097
146427
|
consumerGroup: this.consumerGroupName,
|
|
146098
146428
|
receiptHandle: message2.receiptHandle
|
|
@@ -146111,6 +146441,7 @@ var ConsumerGroup = class {
|
|
|
146111
146441
|
try {
|
|
146112
146442
|
await this.directiveCallWithRetries(
|
|
146113
146443
|
() => this.client.acknowledgeMessage({
|
|
146444
|
+
messageId: message2.messageId,
|
|
146114
146445
|
queueName: this.topicName,
|
|
146115
146446
|
consumerGroup: this.consumerGroupName,
|
|
146116
146447
|
receiptHandle: message2.receiptHandle
|
|
@@ -146126,6 +146457,7 @@ var ConsumerGroup = class {
|
|
|
146126
146457
|
try {
|
|
146127
146458
|
await this.directiveCallWithRetries(
|
|
146128
146459
|
() => this.client.changeVisibility({
|
|
146460
|
+
messageId: message2.messageId,
|
|
146129
146461
|
queueName: this.topicName,
|
|
146130
146462
|
consumerGroup: this.consumerGroupName,
|
|
146131
146463
|
receiptHandle: message2.receiptHandle,
|
|
@@ -146185,7 +146517,8 @@ var ConsumerGroup = class {
|
|
|
146185
146517
|
queueName: this.topicName,
|
|
146186
146518
|
consumerGroup: this.consumerGroupName,
|
|
146187
146519
|
visibilityTimeoutSeconds: this.visibilityTimeout,
|
|
146188
|
-
limit
|
|
146520
|
+
limit,
|
|
146521
|
+
cursorFallback: options && "cursorFallback" in options ? options.cursorFallback : void 0
|
|
146189
146522
|
})) {
|
|
146190
146523
|
messagesProcessed++;
|
|
146191
146524
|
await this.processMessage(message2, handler, { retry: retry2 });
|
|
@@ -146237,7 +146570,7 @@ var Topic = class {
|
|
|
146237
146570
|
headers: options == null ? void 0 : options.headers,
|
|
146238
146571
|
telemetry: options == null ? void 0 : options.telemetry
|
|
146239
146572
|
});
|
|
146240
|
-
if (result.messageId && isDevMode()) {
|
|
146573
|
+
if (result.messageId && isDevMode() && !this.client.usesLocalBroker()) {
|
|
146241
146574
|
invokeDevHandlers(
|
|
146242
146575
|
this.topicName,
|
|
146243
146576
|
result.messageId,
|
|
@@ -146649,6 +146982,8 @@ function registerHandlerForFile(filePath, handler, client2, options) {
|
|
|
146649
146982
|
return true;
|
|
146650
146983
|
}
|
|
146651
146984
|
function registerDevHandler(handler, client2, options, _testCallerPath) {
|
|
146985
|
+
var _a3, _b2;
|
|
146986
|
+
if ((_b2 = (_a3 = getApiClient(client2)).usesLocalBroker) == null ? void 0 : _b2.call(_a3)) return;
|
|
146652
146987
|
const callerPath = _testCallerPath ?? extractCallerFilePath();
|
|
146653
146988
|
if (!callerPath) {
|
|
146654
146989
|
console.warn(
|
|
@@ -147433,30 +147768,69 @@ function parseRetryAfterSeconds(value) {
|
|
|
147433
147768
|
}
|
|
147434
147769
|
return void 0;
|
|
147435
147770
|
}
|
|
147436
|
-
function
|
|
147771
|
+
async function readHttpErrorResponse(response2) {
|
|
147772
|
+
var _a3;
|
|
147773
|
+
const text2 = await response2.text();
|
|
147774
|
+
if (!((_a3 = response2.headers.get("Content-Type")) == null ? void 0 : _a3.toLowerCase().includes("json"))) {
|
|
147775
|
+
return {
|
|
147776
|
+
response: response2,
|
|
147777
|
+
message: text2
|
|
147778
|
+
};
|
|
147779
|
+
}
|
|
147780
|
+
try {
|
|
147781
|
+
const body2 = JSON.parse(text2);
|
|
147782
|
+
if (typeof body2 !== "object" || body2 === null) {
|
|
147783
|
+
return { response: response2, message: text2 };
|
|
147784
|
+
}
|
|
147785
|
+
const error2 = "error" in body2 ? body2.error : void 0;
|
|
147786
|
+
let message2 = text2;
|
|
147787
|
+
if (typeof error2 === "string") {
|
|
147788
|
+
message2 = error2;
|
|
147789
|
+
} else if (typeof error2 === "object" && error2 !== null && "message" in error2 && typeof error2.message === "string") {
|
|
147790
|
+
message2 = error2.message;
|
|
147791
|
+
}
|
|
147792
|
+
return {
|
|
147793
|
+
response: response2,
|
|
147794
|
+
message: message2,
|
|
147795
|
+
originalMessageId: "originalMessageId" in body2 && typeof body2.originalMessageId === "string" ? body2.originalMessageId : void 0
|
|
147796
|
+
};
|
|
147797
|
+
} catch {
|
|
147798
|
+
return { response: response2, message: text2 };
|
|
147799
|
+
}
|
|
147800
|
+
}
|
|
147801
|
+
function throwCommonHttpError(error2, operation, badRequestDefault = "Invalid parameters") {
|
|
147802
|
+
const { status, statusText } = error2.response;
|
|
147803
|
+
const message2 = error2.message;
|
|
147804
|
+
const statusDescription = statusText ? `${status} ${statusText}` : `${status}`;
|
|
147805
|
+
if (status === 503 && error2.response.headers.get("Vqs-Error-Code") === "consumer_registry_not_configured") {
|
|
147806
|
+
throw new ConsumerRegistryNotConfiguredError(
|
|
147807
|
+
message2 || "Consumer registry not configured"
|
|
147808
|
+
);
|
|
147809
|
+
}
|
|
147810
|
+
if (status === 413) {
|
|
147811
|
+
throw new PayloadTooLargeError(message2 || "Request payload is too large");
|
|
147812
|
+
}
|
|
147437
147813
|
if (status === 400) {
|
|
147438
|
-
throw new BadRequestError(
|
|
147814
|
+
throw new BadRequestError(message2 || badRequestDefault);
|
|
147439
147815
|
}
|
|
147440
147816
|
if (status === 429) {
|
|
147441
147817
|
throw new TooManyRequestsError(
|
|
147442
|
-
|
|
147443
|
-
parseRetryAfterSeconds(
|
|
147818
|
+
message2 || `Too many requests: ${operation}`,
|
|
147819
|
+
parseRetryAfterSeconds(error2.response.headers.get("Retry-After"))
|
|
147444
147820
|
);
|
|
147445
147821
|
}
|
|
147446
147822
|
if (status === 401) {
|
|
147447
|
-
throw new UnauthorizedError(
|
|
147823
|
+
throw new UnauthorizedError(message2 || void 0);
|
|
147448
147824
|
}
|
|
147449
147825
|
if (status === 403) {
|
|
147450
|
-
throw new ForbiddenError(
|
|
147826
|
+
throw new ForbiddenError(message2 || void 0);
|
|
147451
147827
|
}
|
|
147452
147828
|
if (status >= 500) {
|
|
147453
147829
|
throw new InternalServerError(
|
|
147454
|
-
|
|
147830
|
+
message2 || `Server error: ${statusDescription}`
|
|
147455
147831
|
);
|
|
147456
147832
|
}
|
|
147457
|
-
throw new Error(
|
|
147458
|
-
errorText || `Failed to ${operation}: ${status} ${statusText}`
|
|
147459
|
-
);
|
|
147833
|
+
throw new Error(message2 || `Failed to ${operation}: ${statusDescription}`);
|
|
147460
147834
|
}
|
|
147461
147835
|
function parseQueueHeaders(headers2) {
|
|
147462
147836
|
const messageId = headers2.get("Vqs-Message-Id");
|
|
@@ -147490,12 +147864,29 @@ function validateRegion(region) {
|
|
|
147490
147864
|
}
|
|
147491
147865
|
}
|
|
147492
147866
|
var DEFAULT_BASE_URL_RESOLVER = (region) => new URL(`https://${region}.vercel-queue.com`);
|
|
147493
|
-
function
|
|
147494
|
-
|
|
147867
|
+
function stripTrailingSlashes(path2) {
|
|
147868
|
+
let end = path2.length;
|
|
147869
|
+
while (end > 0 && path2[end - 1] === "/") {
|
|
147870
|
+
end--;
|
|
147871
|
+
}
|
|
147872
|
+
return path2.slice(0, end);
|
|
147873
|
+
}
|
|
147874
|
+
function supportsLocalQueueBroker(version2) {
|
|
147875
|
+
if (!version2 || version2.length > 256) return false;
|
|
147876
|
+
const match2 = version2.match(
|
|
147877
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-([\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*))?(?:\+[\da-zA-Z-]+(?:\.[\da-zA-Z-]+)*)?$/
|
|
147878
|
+
);
|
|
147879
|
+
if (!match2 || match2[0] !== version2) return false;
|
|
147880
|
+
const [major, minor, patch2] = match2.slice(1, 4).map(Number);
|
|
147881
|
+
const prerelease = match2[4];
|
|
147882
|
+
if (![major, minor, patch2].every(Number.isSafeInteger) || (prerelease == null ? void 0 : prerelease.split(".").some((part) => /^0\d+$/.test(part)))) {
|
|
147883
|
+
return false;
|
|
147884
|
+
}
|
|
147885
|
+
return major > 59 || major === 59 && (minor > 26 || minor === 26 && (patch2 > 0 || !prerelease));
|
|
147495
147886
|
}
|
|
147496
147887
|
var BASE_PATH = "/api/v3/topic";
|
|
147497
147888
|
var ApiClient = class _ApiClient {
|
|
147498
|
-
constructor(options) {
|
|
147889
|
+
constructor(options, localResource) {
|
|
147499
147890
|
__publicField(this, "baseUrl");
|
|
147500
147891
|
__publicField(this, "customHeaders");
|
|
147501
147892
|
__publicField(this, "providedToken");
|
|
@@ -147505,12 +147896,36 @@ var ApiClient = class _ApiClient {
|
|
|
147505
147896
|
__publicField(this, "transport");
|
|
147506
147897
|
__publicField(this, "region");
|
|
147507
147898
|
__publicField(this, "baseUrlResolver");
|
|
147899
|
+
// Keep injected credentials separate from explicit tokens: a regional resolver
|
|
147900
|
+
// can select a different endpoint, where the broker token must not be used.
|
|
147901
|
+
__publicField(this, "localResource");
|
|
147508
147902
|
__publicField(this, "dispatcher");
|
|
147509
147903
|
__publicField(this, "telemetry");
|
|
147904
|
+
var _a3;
|
|
147510
147905
|
validateRegion(options.region);
|
|
147511
147906
|
this.region = options.region;
|
|
147512
|
-
this.
|
|
147513
|
-
|
|
147907
|
+
this.localResource = localResource ?? null;
|
|
147908
|
+
if (localResource === void 0 && isDevMode() && supportsLocalQueueBroker(process.env.VERCEL_CLI_VERSION)) {
|
|
147909
|
+
const injectedUrl = process.env.VERCEL_QUEUE_BASE_URL;
|
|
147910
|
+
if (injectedUrl) {
|
|
147911
|
+
try {
|
|
147912
|
+
this.localResource = {
|
|
147913
|
+
baseUrl: new URL(injectedUrl),
|
|
147914
|
+
token: process.env.VERCEL_QUEUE_TOKEN
|
|
147915
|
+
};
|
|
147916
|
+
} catch (cause) {
|
|
147917
|
+
if (!options.resolveBaseUrl) {
|
|
147918
|
+
throw new Error(
|
|
147919
|
+
"Invalid VERCEL_QUEUE_BASE_URL: expected an absolute URL",
|
|
147920
|
+
{ cause }
|
|
147921
|
+
);
|
|
147922
|
+
}
|
|
147923
|
+
}
|
|
147924
|
+
}
|
|
147925
|
+
}
|
|
147926
|
+
const localBaseUrl = (_a3 = this.localResource) == null ? void 0 : _a3.baseUrl;
|
|
147927
|
+
this.baseUrlResolver = options.resolveBaseUrl ?? (localBaseUrl ? () => new URL(localBaseUrl) : DEFAULT_BASE_URL_RESOLVER);
|
|
147928
|
+
this.baseUrl = this.baseUrlResolver(this.region);
|
|
147514
147929
|
this.customHeaders = options.headers || {};
|
|
147515
147930
|
this.providedToken = options.token;
|
|
147516
147931
|
this.transport = options.transport || new JsonTransport$1();
|
|
@@ -147532,16 +147947,24 @@ var ApiClient = class _ApiClient {
|
|
|
147532
147947
|
* region indicated by the incoming `ce-vqsregion` header.
|
|
147533
147948
|
*/
|
|
147534
147949
|
withRegion(region) {
|
|
147535
|
-
return new _ApiClient(
|
|
147536
|
-
|
|
147537
|
-
|
|
147538
|
-
|
|
147539
|
-
|
|
147540
|
-
|
|
147541
|
-
|
|
147542
|
-
|
|
147543
|
-
|
|
147544
|
-
|
|
147950
|
+
return new _ApiClient(
|
|
147951
|
+
{
|
|
147952
|
+
region,
|
|
147953
|
+
resolveBaseUrl: this.baseUrlResolver,
|
|
147954
|
+
token: this.providedToken,
|
|
147955
|
+
headers: { ...this.customHeaders },
|
|
147956
|
+
deploymentId: this.explicitlyUnpinned ? null : this.resolvedDeploymentId,
|
|
147957
|
+
transport: this.transport,
|
|
147958
|
+
dispatcher: this.dispatcher,
|
|
147959
|
+
telemetry: this.telemetry
|
|
147960
|
+
},
|
|
147961
|
+
this.localResource
|
|
147962
|
+
);
|
|
147963
|
+
}
|
|
147964
|
+
usesLocalBroker() {
|
|
147965
|
+
var _a3;
|
|
147966
|
+
const local = (_a3 = this.localResource) == null ? void 0 : _a3.baseUrl;
|
|
147967
|
+
return local !== void 0 && this.baseUrl.origin === local.origin && stripTrailingSlashes(this.baseUrl.pathname) === stripTrailingSlashes(local.pathname);
|
|
147545
147968
|
}
|
|
147546
147969
|
getRegion() {
|
|
147547
147970
|
return this.region;
|
|
@@ -147561,23 +147984,32 @@ var ApiClient = class _ApiClient {
|
|
|
147561
147984
|
);
|
|
147562
147985
|
}
|
|
147563
147986
|
getSendDeploymentId() {
|
|
147564
|
-
if (isDevMode()) {
|
|
147987
|
+
if (this.usesLocalBroker() || isDevMode()) {
|
|
147565
147988
|
return void 0;
|
|
147566
147989
|
}
|
|
147567
147990
|
this.requireDeploymentId();
|
|
147568
147991
|
return this.pinSends ? this.resolvedDeploymentId : void 0;
|
|
147569
147992
|
}
|
|
147570
147993
|
getConsumeDeploymentId() {
|
|
147571
|
-
if (isDevMode()) {
|
|
147994
|
+
if (this.usesLocalBroker() || isDevMode()) {
|
|
147572
147995
|
return void 0;
|
|
147573
147996
|
}
|
|
147574
147997
|
this.requireDeploymentId();
|
|
147575
147998
|
return this.resolvedDeploymentId;
|
|
147576
147999
|
}
|
|
147577
148000
|
async getToken() {
|
|
148001
|
+
var _a3;
|
|
147578
148002
|
if (this.providedToken) {
|
|
147579
148003
|
return this.providedToken;
|
|
147580
148004
|
}
|
|
148005
|
+
if (this.usesLocalBroker()) {
|
|
148006
|
+
if ((_a3 = this.localResource) == null ? void 0 : _a3.token) {
|
|
148007
|
+
return this.localResource.token;
|
|
148008
|
+
}
|
|
148009
|
+
throw new Error(
|
|
148010
|
+
"Missing local queue token. VERCEL_QUEUE_BASE_URL selects a local broker, but VERCEL_QUEUE_TOKEN is not set. Start your app with a Vercel CLI version that supports local Queues, or provide an explicit token."
|
|
148011
|
+
);
|
|
148012
|
+
}
|
|
147581
148013
|
try {
|
|
147582
148014
|
return await distExports.getVercelOidcToken();
|
|
147583
148015
|
} catch (err) {
|
|
@@ -147602,7 +148034,7 @@ Cause: ${cause}`
|
|
|
147602
148034
|
const encodedQueue = encodeURIComponent(queueName);
|
|
147603
148035
|
const segments = pathSegments.map((s2) => encodeURIComponent(s2));
|
|
147604
148036
|
const path2 = segments.length > 0 ? "/" + segments.join("/") : "";
|
|
147605
|
-
const basePath = this.baseUrl.pathname
|
|
148037
|
+
const basePath = stripTrailingSlashes(this.baseUrl.pathname);
|
|
147606
148038
|
return `${this.baseUrl.origin}${basePath}${BASE_PATH}/${encodedQueue}${path2}`;
|
|
147607
148039
|
}
|
|
147608
148040
|
async fetch(url, init2) {
|
|
@@ -147627,7 +148059,7 @@ Cause: ${cause}`
|
|
|
147627
148059
|
}
|
|
147628
148060
|
console.debug("[VQS Debug] Request:", JSON.stringify(logData, null, 2));
|
|
147629
148061
|
}
|
|
147630
|
-
init2.headers.set("User-Agent", `@vercel/queue/${"0.
|
|
148062
|
+
init2.headers.set("User-Agent", `@vercel/queue/${"0.8.0"}`);
|
|
147631
148063
|
init2.headers.set("Vqs-Client-Ts", (/* @__PURE__ */ new Date()).toISOString());
|
|
147632
148064
|
const fetchInit = this.dispatcher ? { ...init2, dispatcher: this.dispatcher } : init2;
|
|
147633
148065
|
const response2 = await fetch(url, fetchInit);
|
|
@@ -147666,24 +148098,14 @@ Cause: ${cause}`
|
|
|
147666
148098
|
...body2 instanceof ReadableStream && { duplex: "half" }
|
|
147667
148099
|
});
|
|
147668
148100
|
if (!response2.ok) {
|
|
147669
|
-
const
|
|
148101
|
+
const error2 = await readHttpErrorResponse(response2);
|
|
147670
148102
|
if (response2.status === 502 && response2.headers.get("Vqs-Error-Code") === "consumer_discovery_failed") {
|
|
147671
148103
|
throw new ConsumerDiscoveryError(
|
|
147672
|
-
|
|
148104
|
+
error2.message || "Consumer discovery failed",
|
|
147673
148105
|
deploymentId
|
|
147674
148106
|
);
|
|
147675
148107
|
}
|
|
147676
|
-
|
|
147677
|
-
throw new ConsumerRegistryNotConfiguredError(
|
|
147678
|
-
errorText || "Consumer registry not configured"
|
|
147679
|
-
);
|
|
147680
|
-
}
|
|
147681
|
-
throwCommonHttpError(
|
|
147682
|
-
response2.status,
|
|
147683
|
-
response2.statusText,
|
|
147684
|
-
errorText,
|
|
147685
|
-
"send message"
|
|
147686
|
-
);
|
|
148108
|
+
throwCommonHttpError(error2, "send message");
|
|
147687
148109
|
}
|
|
147688
148110
|
if (response2.status === 202) {
|
|
147689
148111
|
await response2.text();
|
|
@@ -147730,18 +148152,8 @@ Cause: ${cause}`
|
|
|
147730
148152
|
duplex: "half"
|
|
147731
148153
|
});
|
|
147732
148154
|
if (!response2.ok) {
|
|
147733
|
-
const
|
|
147734
|
-
|
|
147735
|
-
throw new ConsumerRegistryNotConfiguredError(
|
|
147736
|
-
errorText || "Consumer registry not configured"
|
|
147737
|
-
);
|
|
147738
|
-
}
|
|
147739
|
-
throwCommonHttpError(
|
|
147740
|
-
response2.status,
|
|
147741
|
-
response2.statusText,
|
|
147742
|
-
errorText,
|
|
147743
|
-
"send message batch"
|
|
147744
|
-
);
|
|
148155
|
+
const error2 = await readHttpErrorResponse(response2);
|
|
148156
|
+
throwCommonHttpError(error2, "send message batch");
|
|
147745
148157
|
}
|
|
147746
148158
|
const { results } = await response2.json();
|
|
147747
148159
|
if (results.length !== messages.length) {
|
|
@@ -147781,7 +148193,13 @@ Cause: ${cause}`
|
|
|
147781
148193
|
}
|
|
147782
148194
|
async *receiveMessages(options) {
|
|
147783
148195
|
const transport = this.transport;
|
|
147784
|
-
const {
|
|
148196
|
+
const {
|
|
148197
|
+
queueName,
|
|
148198
|
+
consumerGroup,
|
|
148199
|
+
visibilityTimeoutSeconds,
|
|
148200
|
+
limit,
|
|
148201
|
+
cursorFallback
|
|
148202
|
+
} = options;
|
|
147785
148203
|
if (limit !== void 0 && (limit < 1 || limit > 10)) {
|
|
147786
148204
|
throw new InvalidLimitError(limit);
|
|
147787
148205
|
}
|
|
@@ -147799,6 +148217,9 @@ Cause: ${cause}`
|
|
|
147799
148217
|
if (limit !== void 0) {
|
|
147800
148218
|
headers2.set("Vqs-Max-Messages", limit.toString());
|
|
147801
148219
|
}
|
|
148220
|
+
if (cursorFallback !== void 0) {
|
|
148221
|
+
headers2.set("Vqs-Cursor-Fallback", cursorFallback);
|
|
148222
|
+
}
|
|
147802
148223
|
const effectiveDeploymentId = this.getConsumeDeploymentId();
|
|
147803
148224
|
if (effectiveDeploymentId) {
|
|
147804
148225
|
headers2.set("Vqs-Deployment-Id", effectiveDeploymentId);
|
|
@@ -147815,11 +148236,8 @@ Cause: ${cause}`
|
|
|
147815
148236
|
return;
|
|
147816
148237
|
}
|
|
147817
148238
|
if (!response2.ok) {
|
|
147818
|
-
const errorText = await response2.text();
|
|
147819
148239
|
throwCommonHttpError(
|
|
147820
|
-
response2
|
|
147821
|
-
response2.statusText,
|
|
147822
|
-
errorText,
|
|
148240
|
+
await readHttpErrorResponse(response2),
|
|
147823
148241
|
"receive messages"
|
|
147824
148242
|
);
|
|
147825
148243
|
}
|
|
@@ -147871,33 +148289,26 @@ Cause: ${cause}`
|
|
|
147871
148289
|
}
|
|
147872
148290
|
);
|
|
147873
148291
|
if (!response2.ok) {
|
|
147874
|
-
const
|
|
148292
|
+
const error2 = await readHttpErrorResponse(response2);
|
|
147875
148293
|
if (response2.status === 404) {
|
|
147876
148294
|
throw new MessageNotFoundError(messageId);
|
|
147877
148295
|
}
|
|
147878
148296
|
if (response2.status === 409) {
|
|
147879
|
-
|
|
147880
|
-
try {
|
|
147881
|
-
errorData = JSON.parse(errorText);
|
|
147882
|
-
} catch {
|
|
147883
|
-
}
|
|
147884
|
-
if (errorData.originalMessageId) {
|
|
148297
|
+
if (error2.originalMessageId) {
|
|
147885
148298
|
throw new MessageNotAvailableError(
|
|
147886
148299
|
messageId,
|
|
147887
|
-
`This message was a duplicate - use originalMessageId: ${
|
|
148300
|
+
`This message was a duplicate - use originalMessageId: ${error2.originalMessageId}`
|
|
147888
148301
|
);
|
|
147889
148302
|
}
|
|
147890
|
-
throw new
|
|
148303
|
+
throw new MessageLockedError(
|
|
148304
|
+
messageId,
|
|
148305
|
+
parseRetryAfterSeconds(response2.headers.get("Retry-After"))
|
|
148306
|
+
);
|
|
147891
148307
|
}
|
|
147892
148308
|
if (response2.status === 410) {
|
|
147893
148309
|
throw new MessageAlreadyProcessedError(messageId);
|
|
147894
148310
|
}
|
|
147895
|
-
throwCommonHttpError(
|
|
147896
|
-
response2.status,
|
|
147897
|
-
response2.statusText,
|
|
147898
|
-
errorText,
|
|
147899
|
-
"receive message by ID"
|
|
147900
|
-
);
|
|
148311
|
+
throwCommonHttpError(error2, "receive message by ID");
|
|
147901
148312
|
}
|
|
147902
148313
|
for await (const multipartMessage of parseMultipartStream(response2)) {
|
|
147903
148314
|
const parsedHeaders = parseQueueHeaders(multipartMessage.headers);
|
|
@@ -147920,8 +148331,7 @@ Cause: ${cause}`
|
|
|
147920
148331
|
throw new MessageNotFoundError(messageId);
|
|
147921
148332
|
}
|
|
147922
148333
|
async acknowledgeMessage(options) {
|
|
147923
|
-
|
|
147924
|
-
const { queueName, consumerGroup, receiptHandle } = options;
|
|
148334
|
+
const { messageId, queueName, consumerGroup, receiptHandle } = options;
|
|
147925
148335
|
const headers2 = new Headers({
|
|
147926
148336
|
Authorization: `Bearer ${await this.getToken()}`,
|
|
147927
148337
|
...this.customHeaders
|
|
@@ -147944,31 +148354,28 @@ Cause: ${cause}`
|
|
|
147944
148354
|
}
|
|
147945
148355
|
);
|
|
147946
148356
|
if (!response2.ok) {
|
|
147947
|
-
const
|
|
148357
|
+
const error2 = await readHttpErrorResponse(response2);
|
|
147948
148358
|
if (response2.status === 404) {
|
|
147949
|
-
throw new MessageNotFoundError(
|
|
148359
|
+
throw new MessageNotFoundError(messageId);
|
|
147950
148360
|
}
|
|
147951
148361
|
if (response2.status === 409) {
|
|
147952
148362
|
throw new MessageNotAvailableError(
|
|
147953
|
-
|
|
147954
|
-
|
|
148363
|
+
messageId,
|
|
148364
|
+
error2.message || "Invalid receipt handle, message not in correct state, or already processed"
|
|
147955
148365
|
);
|
|
147956
148366
|
}
|
|
147957
148367
|
throwCommonHttpError(
|
|
147958
|
-
|
|
147959
|
-
response2.statusText,
|
|
147960
|
-
errorText,
|
|
148368
|
+
error2,
|
|
147961
148369
|
"acknowledge message",
|
|
147962
|
-
"Missing or invalid receipt handle"
|
|
147963
|
-
((_a3 = response2.headers) == null ? void 0 : _a3.get("Retry-After")) ?? null
|
|
148370
|
+
"Missing or invalid receipt handle"
|
|
147964
148371
|
);
|
|
147965
148372
|
}
|
|
147966
148373
|
await response2.text();
|
|
147967
148374
|
return { acknowledged: true };
|
|
147968
148375
|
}
|
|
147969
148376
|
async changeVisibility(options) {
|
|
147970
|
-
var _a3;
|
|
147971
148377
|
const {
|
|
148378
|
+
messageId,
|
|
147972
148379
|
queueName,
|
|
147973
148380
|
consumerGroup,
|
|
147974
148381
|
receiptHandle,
|
|
@@ -147998,23 +148405,20 @@ Cause: ${cause}`
|
|
|
147998
148405
|
}
|
|
147999
148406
|
);
|
|
148000
148407
|
if (!response2.ok) {
|
|
148001
|
-
const
|
|
148408
|
+
const error2 = await readHttpErrorResponse(response2);
|
|
148002
148409
|
if (response2.status === 404) {
|
|
148003
|
-
throw new MessageNotFoundError(
|
|
148410
|
+
throw new MessageNotFoundError(messageId);
|
|
148004
148411
|
}
|
|
148005
148412
|
if (response2.status === 409) {
|
|
148006
148413
|
throw new MessageNotAvailableError(
|
|
148007
|
-
|
|
148008
|
-
|
|
148414
|
+
messageId,
|
|
148415
|
+
error2.message || "Invalid receipt handle, message not in correct state, or already processed"
|
|
148009
148416
|
);
|
|
148010
148417
|
}
|
|
148011
148418
|
throwCommonHttpError(
|
|
148012
|
-
|
|
148013
|
-
response2.statusText,
|
|
148014
|
-
errorText,
|
|
148419
|
+
error2,
|
|
148015
148420
|
"change visibility",
|
|
148016
|
-
"Missing receipt handle or invalid visibility timeout"
|
|
148017
|
-
((_a3 = response2.headers) == null ? void 0 : _a3.get("Retry-After")) ?? null
|
|
148421
|
+
"Missing receipt handle or invalid visibility timeout"
|
|
148018
148422
|
);
|
|
148019
148423
|
}
|
|
148020
148424
|
await response2.text();
|
|
@@ -148053,6 +148457,25 @@ function resolveCallbackRequest(input) {
|
|
|
148053
148457
|
}
|
|
148054
148458
|
return input;
|
|
148055
148459
|
}
|
|
148460
|
+
function skippedDeliveryReason(error2) {
|
|
148461
|
+
if (error2 instanceof MessageAlreadyProcessedError || error2 instanceof Error && error2.name === "MessageAlreadyProcessedError") {
|
|
148462
|
+
return "already_processed";
|
|
148463
|
+
}
|
|
148464
|
+
if (error2 instanceof MessageNotAvailableError || error2 instanceof Error && error2.name === "MessageNotAvailableError") {
|
|
148465
|
+
return "not_available";
|
|
148466
|
+
}
|
|
148467
|
+
return null;
|
|
148468
|
+
}
|
|
148469
|
+
function reportSkippedDelivery(reason, messageId) {
|
|
148470
|
+
console.debug(
|
|
148471
|
+
`Queue callback skipped (${reason}) for message ${messageId ?? "<unknown>"}: the message was already handled or is no longer available to this consumer.`
|
|
148472
|
+
);
|
|
148473
|
+
return {
|
|
148474
|
+
status: "skipped",
|
|
148475
|
+
reason,
|
|
148476
|
+
...messageId !== void 0 ? { messageId } : {}
|
|
148477
|
+
};
|
|
148478
|
+
}
|
|
148056
148479
|
function getApiClient(client2) {
|
|
148057
148480
|
return getApi(client2);
|
|
148058
148481
|
}
|
|
@@ -148096,7 +148519,7 @@ var QueueClient = class {
|
|
|
148096
148519
|
headers: options == null ? void 0 : options.headers,
|
|
148097
148520
|
telemetry: options == null ? void 0 : options.telemetry
|
|
148098
148521
|
});
|
|
148099
|
-
if (result.messageId && isDevMode()) {
|
|
148522
|
+
if (result.messageId && isDevMode() && !api2.usesLocalBroker()) {
|
|
148100
148523
|
invokeDevHandlers(
|
|
148101
148524
|
topicName,
|
|
148102
148525
|
result.messageId,
|
|
@@ -148120,7 +148543,7 @@ var QueueClient = class {
|
|
|
148120
148543
|
messages,
|
|
148121
148544
|
telemetry: options == null ? void 0 : options.telemetry
|
|
148122
148545
|
});
|
|
148123
|
-
if (!isDevMode()) {
|
|
148546
|
+
if (!isDevMode() || api2.usesLocalBroker()) {
|
|
148124
148547
|
return results;
|
|
148125
148548
|
}
|
|
148126
148549
|
const region = api2.getRegion();
|
|
@@ -148159,13 +148582,13 @@ var QueueClient = class {
|
|
|
148159
148582
|
*/
|
|
148160
148583
|
__publicField(this, "handleCallback", (handler, options) => {
|
|
148161
148584
|
var _a3, _b2;
|
|
148162
|
-
if (isDevMode()) {
|
|
148585
|
+
if (isDevMode() && !getApi(this).usesLocalBroker()) {
|
|
148163
148586
|
registerDevHandler(handler, this, options);
|
|
148164
148587
|
}
|
|
148165
148588
|
const telemetry = resolveTelemetryConfig((_b2 = (_a3 = getApi(this)).getTelemetry) == null ? void 0 : _b2.call(_a3));
|
|
148166
148589
|
return async (requestOrEvent) => {
|
|
148167
148590
|
const request2 = resolveCallbackRequest(requestOrEvent);
|
|
148168
|
-
if (isDevMode() && request2.headers.get("x-vercel-queue-prime") === "1") {
|
|
148591
|
+
if (isDevMode() && !getApi(this).usesLocalBroker() && request2.headers.get("x-vercel-queue-prime") === "1") {
|
|
148169
148592
|
const primeFile = request2.headers.get("x-vercel-queue-prime-file");
|
|
148170
148593
|
if (primeFile) {
|
|
148171
148594
|
registerDevHandler(
|
|
@@ -148177,11 +148600,13 @@ var QueueClient = class {
|
|
|
148177
148600
|
}
|
|
148178
148601
|
return Response.json({ status: "primed" });
|
|
148179
148602
|
}
|
|
148603
|
+
let parsed;
|
|
148180
148604
|
try {
|
|
148181
|
-
|
|
148605
|
+
parsed = await parseCallback(request2);
|
|
148606
|
+
const callback = parsed;
|
|
148182
148607
|
await withConsumerSpan(
|
|
148183
148608
|
request2.headers,
|
|
148184
|
-
() => handleCallback(handler,
|
|
148609
|
+
() => handleCallback(handler, callback, {
|
|
148185
148610
|
client: this,
|
|
148186
148611
|
visibilityTimeoutSeconds: options == null ? void 0 : options.visibilityTimeoutSeconds,
|
|
148187
148612
|
retry: options == null ? void 0 : options.retry
|
|
@@ -148190,6 +148615,12 @@ var QueueClient = class {
|
|
|
148190
148615
|
);
|
|
148191
148616
|
return Response.json({ status: "success" });
|
|
148192
148617
|
} catch (error2) {
|
|
148618
|
+
const skipped = skippedDeliveryReason(error2);
|
|
148619
|
+
if (skipped) {
|
|
148620
|
+
return Response.json(
|
|
148621
|
+
reportSkippedDelivery(skipped, parsed == null ? void 0 : parsed.messageId)
|
|
148622
|
+
);
|
|
148623
|
+
}
|
|
148193
148624
|
console.error("Queue callback error:", error2);
|
|
148194
148625
|
if (error2 instanceof Error && (error2.message.includes("Invalid content type") || error2.message.includes("Invalid CloudEvent") || error2.message.includes("Missing required CloudEvent") || error2.message.includes("Failed to parse CloudEvent") || error2.message.includes("Binary mode callback"))) {
|
|
148195
148626
|
return Response.json({ error: error2.message }, { status: 400 });
|
|
@@ -148223,7 +148654,7 @@ var QueueClient = class {
|
|
|
148223
148654
|
*/
|
|
148224
148655
|
__publicField(this, "handleNodeCallback", (handler, options) => {
|
|
148225
148656
|
var _a3, _b2;
|
|
148226
|
-
if (isDevMode()) {
|
|
148657
|
+
if (isDevMode() && !getApi(this).usesLocalBroker()) {
|
|
148227
148658
|
registerDevHandler(handler, this, options);
|
|
148228
148659
|
}
|
|
148229
148660
|
const telemetry = resolveTelemetryConfig((_b2 = (_a3 = getApi(this)).getTelemetry) == null ? void 0 : _b2.call(_a3));
|
|
@@ -148233,7 +148664,7 @@ var QueueClient = class {
|
|
|
148233
148664
|
return;
|
|
148234
148665
|
}
|
|
148235
148666
|
const primeHeader = req.headers["x-vercel-queue-prime"];
|
|
148236
|
-
if (isDevMode() && primeHeader === "1") {
|
|
148667
|
+
if (isDevMode() && !getApi(this).usesLocalBroker() && primeHeader === "1") {
|
|
148237
148668
|
const primeFileHeader = req.headers["x-vercel-queue-prime-file"];
|
|
148238
148669
|
const primeFile = Array.isArray(primeFileHeader) ? primeFileHeader[0] : primeFileHeader;
|
|
148239
148670
|
if (primeFile) {
|
|
@@ -148247,11 +148678,13 @@ var QueueClient = class {
|
|
|
148247
148678
|
res.status(200).json({ status: "primed" });
|
|
148248
148679
|
return;
|
|
148249
148680
|
}
|
|
148681
|
+
let parsed;
|
|
148250
148682
|
try {
|
|
148251
|
-
|
|
148683
|
+
parsed = parseRawCallback(req.body, req.headers);
|
|
148684
|
+
const callback = parsed;
|
|
148252
148685
|
await withConsumerSpan(
|
|
148253
148686
|
req.headers,
|
|
148254
|
-
() => handleCallback(handler,
|
|
148687
|
+
() => handleCallback(handler, callback, {
|
|
148255
148688
|
client: this,
|
|
148256
148689
|
visibilityTimeoutSeconds: options == null ? void 0 : options.visibilityTimeoutSeconds,
|
|
148257
148690
|
retry: options == null ? void 0 : options.retry
|
|
@@ -148260,6 +148693,11 @@ var QueueClient = class {
|
|
|
148260
148693
|
);
|
|
148261
148694
|
res.status(200).json({ status: "success" });
|
|
148262
148695
|
} catch (error2) {
|
|
148696
|
+
const skipped = skippedDeliveryReason(error2);
|
|
148697
|
+
if (skipped) {
|
|
148698
|
+
res.status(200).json(reportSkippedDelivery(skipped, parsed == null ? void 0 : parsed.messageId));
|
|
148699
|
+
return;
|
|
148700
|
+
}
|
|
148263
148701
|
console.error("Queue callback error:", error2);
|
|
148264
148702
|
if (error2 instanceof Error && (error2.message.includes("Invalid content type") || error2.message.includes("Invalid CloudEvent") || error2.message.includes("Missing required CloudEvent") || error2.message.includes("Failed to parse CloudEvent") || error2.message.includes("Binary mode callback"))) {
|
|
148265
148703
|
res.status(400).json({ error: error2.message });
|
|
@@ -148278,7 +148716,24 @@ function missingDeploymentIdMessage(operation) {
|
|
|
148278
148716
|
}
|
|
148279
148717
|
function isWsEventsTransportEnabled() {
|
|
148280
148718
|
var _a3;
|
|
148281
|
-
return ((_a3 = process.env.WORKFLOW_EVENTS_TRANSPORT) == null ? void 0 : _a3.trim().toLowerCase())
|
|
148719
|
+
return ((_a3 = process.env.WORKFLOW_EVENTS_TRANSPORT) == null ? void 0 : _a3.trim().toLowerCase()) !== "http";
|
|
148720
|
+
}
|
|
148721
|
+
function wsEventsTransportOverrideWorkflows() {
|
|
148722
|
+
const raw2 = process.env.WORKFLOW_EVENTS_TRANSPORT_WS_OVERRIDE_WORKFLOWS;
|
|
148723
|
+
if (!raw2)
|
|
148724
|
+
return [];
|
|
148725
|
+
return raw2.split(",").map((token) => token.trim()).filter((token) => token.length > 0);
|
|
148726
|
+
}
|
|
148727
|
+
function isWsEventsTransportEnabledForWorkflow(workflowName) {
|
|
148728
|
+
if (isWsEventsTransportEnabled())
|
|
148729
|
+
return true;
|
|
148730
|
+
if (!workflowName)
|
|
148731
|
+
return false;
|
|
148732
|
+
const functionName = workflowName.slice(workflowName.lastIndexOf("//") + 2);
|
|
148733
|
+
return wsEventsTransportOverrideWorkflows().some((token) => token === workflowName || token === functionName);
|
|
148734
|
+
}
|
|
148735
|
+
function isWsEventsTransportPossible() {
|
|
148736
|
+
return isWsEventsTransportEnabled() || wsEventsTransportOverrideWorkflows().length > 0;
|
|
148282
148737
|
}
|
|
148283
148738
|
function isWsEventsTransportStrict() {
|
|
148284
148739
|
const raw2 = process.env.WORKFLOW_INTERNAL_EVENTS_TRANSPORT_STRICT;
|
|
@@ -148435,7 +148890,14 @@ function getRunIdFromPayload(payload) {
|
|
|
148435
148890
|
}
|
|
148436
148891
|
return void 0;
|
|
148437
148892
|
}
|
|
148438
|
-
|
|
148893
|
+
function getWorkflowNameFromQueueName(queueName) {
|
|
148894
|
+
try {
|
|
148895
|
+
return parseQueueName(queueName).id;
|
|
148896
|
+
} catch {
|
|
148897
|
+
return void 0;
|
|
148898
|
+
}
|
|
148899
|
+
}
|
|
148900
|
+
const wsEventsChannelForInvocation = (runId, workflowName, config2) => {
|
|
148439
148901
|
let claim2;
|
|
148440
148902
|
return {
|
|
148441
148903
|
/**
|
|
@@ -148446,9 +148908,10 @@ const wsEventsChannelForInvocation = (runId, config2) => {
|
|
|
148446
148908
|
* the claim it is releasing.
|
|
148447
148909
|
*/
|
|
148448
148910
|
open() {
|
|
148449
|
-
if (!runId || !
|
|
148911
|
+
if (!runId || !isWsEventsTransportEnabledForWorkflow(workflowName)) {
|
|
148450
148912
|
return;
|
|
148451
|
-
|
|
148913
|
+
}
|
|
148914
|
+
claim2 = Promise.resolve().then(() => wsTransport).then(({ openWsChannel: openWsChannel2 }) => openWsChannel2(runId, config2, { workflowName })).catch(() => void 0);
|
|
148452
148915
|
},
|
|
148453
148916
|
/**
|
|
148454
148917
|
* Awaited, unlike the open: work scheduled after the handler returns is not
|
|
@@ -148656,7 +149119,7 @@ function createQueue$1(config2) {
|
|
|
148656
149119
|
const invocation = invocationStorage.getStore();
|
|
148657
149120
|
const requestId = invocation == null ? void 0 : invocation.requestId;
|
|
148658
149121
|
const { payload, queueName, deploymentId } = MessageWrapper.parse(message2);
|
|
148659
|
-
const wsEvents = wsEventsChannelForInvocation(getRunIdFromPayload(payload), config2);
|
|
149122
|
+
const wsEvents = wsEventsChannelForInvocation(getRunIdFromPayload(payload), getWorkflowNameFromQueueName(queueName), config2);
|
|
148660
149123
|
const collectStepIds = !("stepId" in payload && typeof payload.stepId === "string");
|
|
148661
149124
|
wsEvents.open();
|
|
148662
149125
|
try {
|
|
@@ -148778,6 +149241,21 @@ class ReplayEventObserverError extends Error {
|
|
|
148778
149241
|
this.name = "ReplayEventObserverError";
|
|
148779
149242
|
}
|
|
148780
149243
|
}
|
|
149244
|
+
class AfterCommitError extends Error {
|
|
149245
|
+
constructor(error2) {
|
|
149246
|
+
super("Event log read after a committed write failed", { cause: error2 });
|
|
149247
|
+
__publicField(this, "error");
|
|
149248
|
+
this.error = error2;
|
|
149249
|
+
this.name = "AfterCommitError";
|
|
149250
|
+
}
|
|
149251
|
+
}
|
|
149252
|
+
const STEP_OUTCOME_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
149253
|
+
"step_completed",
|
|
149254
|
+
"step_retrying"
|
|
149255
|
+
]);
|
|
149256
|
+
function recordsStepOutcome(eventType) {
|
|
149257
|
+
return STEP_OUTCOME_EVENT_TYPES.has(eventType);
|
|
149258
|
+
}
|
|
148781
149259
|
const EVENT_RETRY_ELIGIBILITY = {
|
|
148782
149260
|
// Creates: conditional create → 409 EntityConflictError if it already exists.
|
|
148783
149261
|
run_created: {
|
|
@@ -148863,6 +149341,8 @@ const EVENT_RETRY_ELIGIBILITY = {
|
|
|
148863
149341
|
};
|
|
148864
149342
|
const MAX_EVENT_POST_RETRIES = 2;
|
|
148865
149343
|
const THROTTLE_RETRY_BUDGET_MS = 3e4;
|
|
149344
|
+
const THROTTLE_DEADLINE_RESERVE_MS = 15e3;
|
|
149345
|
+
const THROTTLE_RETRY_MAX_BUDGET_MS = 15 * 6e4;
|
|
148866
149346
|
const DEFAULT_THROTTLE_RETRY_AFTER_SECONDS = 1;
|
|
148867
149347
|
const EVENT_POST_RETRY_BASE_MS = 100;
|
|
148868
149348
|
const EVENT_POST_RETRY_JITTER_MS = 50;
|
|
@@ -148931,7 +149411,21 @@ function isRetryableEventPostError(err) {
|
|
|
148931
149411
|
}
|
|
148932
149412
|
return collectErrorMarkers(err).some((m2) => TRANSIENT_CODES.has(m2));
|
|
148933
149413
|
}
|
|
148934
|
-
const sleep$1 = (ms2) => new Promise((resolve2) =>
|
|
149414
|
+
const sleep$1 = (ms2, signal) => new Promise((resolve2, reject) => {
|
|
149415
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
149416
|
+
reject(signal.reason);
|
|
149417
|
+
return;
|
|
149418
|
+
}
|
|
149419
|
+
const onAbort = () => {
|
|
149420
|
+
clearTimeout(timer2);
|
|
149421
|
+
reject(signal == null ? void 0 : signal.reason);
|
|
149422
|
+
};
|
|
149423
|
+
const timer2 = setTimeout(() => {
|
|
149424
|
+
signal == null ? void 0 : signal.removeEventListener("abort", onAbort);
|
|
149425
|
+
resolve2();
|
|
149426
|
+
}, ms2);
|
|
149427
|
+
signal == null ? void 0 : signal.addEventListener("abort", onAbort, { once: true });
|
|
149428
|
+
});
|
|
148935
149429
|
const RETRY_DEBUG_ENABLED = typeof process !== "undefined" && typeof process.env.DEBUG === "string" && (process.env.DEBUG.includes("workflow:") || process.env.DEBUG === "*");
|
|
148936
149430
|
function logRetry(message2, fields) {
|
|
148937
149431
|
if (!RETRY_DEBUG_ENABLED)
|
|
@@ -148945,23 +149439,48 @@ function errorMarker(err) {
|
|
|
148945
149439
|
}
|
|
148946
149440
|
return collectErrorMarkers(err)[0] ?? (err instanceof Error ? err.name : "unknown");
|
|
148947
149441
|
}
|
|
148948
|
-
function
|
|
149442
|
+
async function resolveDeadlineMs() {
|
|
149443
|
+
try {
|
|
149444
|
+
const deadline = await getDeadline();
|
|
149445
|
+
const ms2 = deadline == null ? void 0 : deadline.getTime();
|
|
149446
|
+
return ms2 !== void 0 && Number.isFinite(ms2) ? ms2 : void 0;
|
|
149447
|
+
} catch {
|
|
149448
|
+
return void 0;
|
|
149449
|
+
}
|
|
149450
|
+
}
|
|
149451
|
+
function createThrottleWaiter(target2, budget) {
|
|
148949
149452
|
let waitedMs = 0;
|
|
148950
|
-
|
|
149453
|
+
let limit;
|
|
149454
|
+
return async (err, signal) => {
|
|
148951
149455
|
const waitMs = Math.max(1, typeof err.retryAfter === "number" ? err.retryAfter : DEFAULT_THROTTLE_RETRY_AFTER_SECONDS) * 1e3;
|
|
148952
|
-
if (
|
|
149456
|
+
if (limit === void 0) {
|
|
149457
|
+
const deadlineMs = await resolveDeadlineMs();
|
|
149458
|
+
limit = {
|
|
149459
|
+
budgetMs: budget === "invocation" && deadlineMs !== void 0 ? THROTTLE_RETRY_MAX_BUDGET_MS : THROTTLE_RETRY_BUDGET_MS,
|
|
149460
|
+
deadlineMs
|
|
149461
|
+
};
|
|
149462
|
+
}
|
|
149463
|
+
const outlastsInvocation = limit.deadlineMs !== void 0 && Date.now() + waitMs > limit.deadlineMs - THROTTLE_DEADLINE_RESERVE_MS;
|
|
149464
|
+
if (waitedMs + waitMs > limit.budgetMs || outlastsInvocation) {
|
|
148953
149465
|
logRetry("throttle retry budget exhausted; surfacing to the queue", {
|
|
148954
|
-
|
|
149466
|
+
target: target2,
|
|
149467
|
+
budget,
|
|
148955
149468
|
waitedMs,
|
|
148956
|
-
retryAfter: err.retryAfter
|
|
149469
|
+
retryAfter: err.retryAfter,
|
|
149470
|
+
outlastsInvocation
|
|
148957
149471
|
});
|
|
148958
149472
|
throw err;
|
|
148959
149473
|
}
|
|
148960
149474
|
waitedMs += waitMs;
|
|
148961
|
-
console.warn(`[workflow] Throttled (429)
|
|
148962
|
-
await sleep$1(waitMs);
|
|
149475
|
+
console.warn(`[workflow] Throttled (429) ${target2}; retrying in-process in ${waitMs / 1e3}s`);
|
|
149476
|
+
await sleep$1(waitMs, signal);
|
|
148963
149477
|
};
|
|
148964
149478
|
}
|
|
149479
|
+
function throttleBudgetFor(eventType, options) {
|
|
149480
|
+
if ((options == null ? void 0 : options.batchIdempotent) !== void 0)
|
|
149481
|
+
return "bounded";
|
|
149482
|
+
return (options == null ? void 0 : options.afterStepBody) === true || recordsStepOutcome(eventType) ? "invocation" : "bounded";
|
|
149483
|
+
}
|
|
148965
149484
|
function isEligibleForTransientRetry(eventType, options) {
|
|
148966
149485
|
var _a3;
|
|
148967
149486
|
if ((options == null ? void 0 : options.batchIdempotent) !== void 0) {
|
|
@@ -148971,11 +149490,13 @@ function isEligibleForTransientRetry(eventType, options) {
|
|
|
148971
149490
|
}
|
|
148972
149491
|
async function withEventPostRetry(fn2, eventType, options) {
|
|
148973
149492
|
const retryable = isEligibleForTransientRetry(eventType, options);
|
|
148974
|
-
const waitOutThrottle = createThrottleWaiter(eventType);
|
|
149493
|
+
const waitOutThrottle = createThrottleWaiter(`writing ${eventType} event`, throttleBudgetFor(eventType, options));
|
|
148975
149494
|
for (let attempt = 0; ; ) {
|
|
148976
149495
|
try {
|
|
148977
149496
|
return await fn2();
|
|
148978
149497
|
} catch (err) {
|
|
149498
|
+
if (err instanceof AfterCommitError)
|
|
149499
|
+
throw err;
|
|
148979
149500
|
if (ThrottleError.is(err)) {
|
|
148980
149501
|
await waitOutThrottle(err);
|
|
148981
149502
|
continue;
|
|
@@ -149017,6 +149538,29 @@ function encodeFrame(meta, body2) {
|
|
|
149017
149538
|
out.set(body2, 4 + metaBytes.byteLength + 4);
|
|
149018
149539
|
return out;
|
|
149019
149540
|
}
|
|
149541
|
+
function decodeFrame(raw2) {
|
|
149542
|
+
const view = new DataView(raw2.buffer, raw2.byteOffset, raw2.byteLength);
|
|
149543
|
+
if (raw2.byteLength < 4) {
|
|
149544
|
+
throw new Error("ws frame shorter than the meta length prefix");
|
|
149545
|
+
}
|
|
149546
|
+
const metaEnd = 4 + view.getUint32(0, false);
|
|
149547
|
+
if (raw2.byteLength < metaEnd + 4) {
|
|
149548
|
+
throw new Error("ws frame too short for meta + body length prefix");
|
|
149549
|
+
}
|
|
149550
|
+
const meta = decode$1(raw2.subarray(4, metaEnd));
|
|
149551
|
+
if (meta === null || typeof meta !== "object" || Array.isArray(meta)) {
|
|
149552
|
+
throw new Error("ws frame meta must be a CBOR map");
|
|
149553
|
+
}
|
|
149554
|
+
const bodyStart = metaEnd + 4;
|
|
149555
|
+
const bodyEnd = bodyStart + view.getUint32(metaEnd, false);
|
|
149556
|
+
if (raw2.byteLength !== bodyEnd) {
|
|
149557
|
+
throw new Error(raw2.byteLength < bodyEnd ? "ws frame shorter than its declared body length" : `ws frame has ${raw2.byteLength - bodyEnd} trailing bytes`);
|
|
149558
|
+
}
|
|
149559
|
+
return {
|
|
149560
|
+
meta,
|
|
149561
|
+
body: raw2.subarray(bodyStart, bodyEnd)
|
|
149562
|
+
};
|
|
149563
|
+
}
|
|
149020
149564
|
async function* decodeFrames(source) {
|
|
149021
149565
|
const chunks = Symbol.asyncIterator in source ? source[Symbol.asyncIterator]() : readerToIterator(source.getReader());
|
|
149022
149566
|
let buffer2 = new Uint8Array(0);
|
|
@@ -149285,7 +149829,7 @@ async function fetchV4(url, init2, config2, opName, attributes) {
|
|
|
149285
149829
|
logLabel: opName,
|
|
149286
149830
|
// Read the body as bytes, not text: a CBOR error body (the fence 412
|
|
149287
149831
|
// carries event payloads back) does not survive a UTF-8 decode.
|
|
149288
|
-
buildError: async (response3) => errorFromV4Response(response3.status, headersToRecord(response3.headers), new Uint8Array(await response3.arrayBuffer()), opName, url)
|
|
149832
|
+
buildError: async (response3) => errorFromV4Response(response3.status, headersToRecord$1(response3.headers), new Uint8Array(await response3.arrayBuffer()), opName, url)
|
|
149289
149833
|
});
|
|
149290
149834
|
if (!response2.body) {
|
|
149291
149835
|
noteEventsTransportOutcome(dispatcher2);
|
|
@@ -149671,14 +150215,14 @@ async function postWorkflowRunEventV4(input, responseType, config2) {
|
|
|
149671
150215
|
}
|
|
149672
150216
|
const STRICT_WS_EVENT_TYPES = /* @__PURE__ */ new Set(["step_completed"]);
|
|
149673
150217
|
function assertWsFallbackAllowed(eventType) {
|
|
149674
|
-
if (!isWsEventsTransportStrict())
|
|
150218
|
+
if (!isWsEventsTransportStrict() || !isWsEventsTransportEnabled())
|
|
149675
150219
|
return;
|
|
149676
150220
|
if (!STRICT_WS_EVENT_TYPES.has(eventType))
|
|
149677
150221
|
return;
|
|
149678
150222
|
throw new Error(`world-vercel: ${eventType} fell back to the HTTP events transport while the WS gate was on. WORKFLOW_INTERNAL_EVENTS_TRANSPORT_STRICT is set, so this is a failure rather than a silent demotion: no channel was resolvable for this run at write time.`);
|
|
149679
150223
|
}
|
|
149680
150224
|
async function createWorkflowRunEventV4(input, config2) {
|
|
149681
|
-
if (
|
|
150225
|
+
if (isWsEventsTransportPossible()) {
|
|
149682
150226
|
const reply = await postEventFrameOverWs(input, config2);
|
|
149683
150227
|
if (reply)
|
|
149684
150228
|
return decodeCreateEventResponse(reply, input.eventType);
|
|
@@ -149805,6 +150349,11 @@ function replyMetaToHeaderRecord(meta) {
|
|
|
149805
150349
|
out["x-vercel-mitigated"] = meta.mitigated;
|
|
149806
150350
|
return out;
|
|
149807
150351
|
}
|
|
150352
|
+
function recordWsReplyParts(span, reply) {
|
|
150353
|
+
const { replyParts = 1 } = reply;
|
|
150354
|
+
if (replyParts > 1)
|
|
150355
|
+
span == null ? void 0 : span.setAttributes({ ...WorkflowWsReplyParts(replyParts) });
|
|
150356
|
+
}
|
|
149808
150357
|
function wsReplyStatus(reply, endpoint) {
|
|
149809
150358
|
const { status } = reply.meta;
|
|
149810
150359
|
if (typeof status !== "number") {
|
|
@@ -149845,6 +150394,14 @@ async function postEventFrameOverWs(input, config2) {
|
|
|
149845
150394
|
reply = await transport.request((reqId) => {
|
|
149846
150395
|
span == null ? void 0 : span.setAttributes({ ...WorkflowWsRequestId(reqId) });
|
|
149847
150396
|
return encodeFrame({ reqId, type: "event", event: buildPostFrameMeta(input) }, input.payload ?? new Uint8Array(0));
|
|
150397
|
+
}, {
|
|
150398
|
+
// Also before sending, for the same reason: a split request that
|
|
150399
|
+
// ends in a close or a timeout is the case worth spotting.
|
|
150400
|
+
onMessages: (count2) => {
|
|
150401
|
+
if (count2 > 1) {
|
|
150402
|
+
span == null ? void 0 : span.setAttributes({ ...WorkflowWsRequestParts(count2) });
|
|
150403
|
+
}
|
|
150404
|
+
}
|
|
149848
150405
|
});
|
|
149849
150406
|
} catch (err) {
|
|
149850
150407
|
const error2 = new WorkflowWorldError(`POST ${endpoint} transport failure: ${err instanceof Error ? err.message : String(err)}`, { url: wsUrl, code: "TRANSPORT", cause: err });
|
|
@@ -149853,6 +150410,7 @@ async function postEventFrameOverWs(input, config2) {
|
|
|
149853
150410
|
throw error2;
|
|
149854
150411
|
}
|
|
149855
150412
|
const ms2 = Date.now() - start2;
|
|
150413
|
+
recordWsReplyParts(span, reply);
|
|
149856
150414
|
const status = wsReplyStatus(reply, endpoint);
|
|
149857
150415
|
const headerRecord = replyMetaToHeaderRecord(reply.meta);
|
|
149858
150416
|
const headers2 = {
|
|
@@ -150018,11 +150576,18 @@ async function consumeReplayLogResponse(response2, { runId, eventsRemoteRefBehav
|
|
|
150018
150576
|
if (!page.cursor) {
|
|
150019
150577
|
throw new WorkflowWorldError("v4 createEvent: partial event stream missing cursor", { code: "SCHEMA_VALIDATION" });
|
|
150020
150578
|
}
|
|
150021
|
-
|
|
150022
|
-
|
|
150023
|
-
|
|
150024
|
-
|
|
150025
|
-
|
|
150579
|
+
let suffix;
|
|
150580
|
+
try {
|
|
150581
|
+
suffix = await getWorkflowRunEventsV4(runId, {
|
|
150582
|
+
cursor: page.cursor,
|
|
150583
|
+
// The suffix of a replay log is the same replay log.
|
|
150584
|
+
remoteRefBehavior: eventsRemoteRefBehavior === "skip-step-inputs" ? "skip-step-inputs" : "resolve"
|
|
150585
|
+
}, config2, replayEventObserver);
|
|
150586
|
+
} catch (err) {
|
|
150587
|
+
if (ThrottleError.is(err))
|
|
150588
|
+
throw new AfterCommitError(err);
|
|
150589
|
+
throw err;
|
|
150590
|
+
}
|
|
150026
150591
|
return {
|
|
150027
150592
|
events: [...page.events, ...suffix.events],
|
|
150028
150593
|
cursor: suffix.cursor ?? page.cursor,
|
|
@@ -150085,9 +150650,22 @@ async function getWorkflowRunEventsV4(runId, params = {}, config2, replayEventOb
|
|
|
150085
150650
|
let cursor = params.cursor ?? null;
|
|
150086
150651
|
let partialStreamRetries = 0;
|
|
150087
150652
|
let consumed;
|
|
150088
|
-
|
|
150653
|
+
const fullLog = params.limit === void 0;
|
|
150654
|
+
const waitOutThrottle = createThrottleWaiter("reading events", "bounded");
|
|
150655
|
+
for (; ; ) {
|
|
150089
150656
|
const pageCursor = cursor ?? void 0;
|
|
150090
|
-
|
|
150657
|
+
try {
|
|
150658
|
+
consumed = await consumeListWithSkipFallback(baseUrl, params.remoteRefBehavior, (remoteRefBehavior) => `${baseUrl}/v4/runs/${encodeURIComponent(runId)}/events` + paginationToQuery({
|
|
150659
|
+
...params,
|
|
150660
|
+
remoteRefBehavior,
|
|
150661
|
+
cursor: pageCursor
|
|
150662
|
+
}), headers2, config2, "listEvents", replayEventObserver);
|
|
150663
|
+
} catch (err) {
|
|
150664
|
+
if (!fullLog || !ThrottleError.is(err))
|
|
150665
|
+
throw err;
|
|
150666
|
+
await waitOutThrottle(err);
|
|
150667
|
+
continue;
|
|
150668
|
+
}
|
|
150091
150669
|
const cursorAdvanced = !!consumed.cursor && consumed.cursor !== cursor;
|
|
150092
150670
|
if (consumed.kind === "partial") {
|
|
150093
150671
|
if (params.limit !== void 0 || !cursorAdvanced || partialStreamRetries === MAX_PARTIAL_STREAM_RETRIES) {
|
|
@@ -150101,7 +150679,9 @@ async function getWorkflowRunEventsV4(runId, params = {}, config2, replayEventOb
|
|
|
150101
150679
|
for (const event of consumed.events) {
|
|
150102
150680
|
events2.push(event);
|
|
150103
150681
|
}
|
|
150104
|
-
|
|
150682
|
+
if (consumed.kind !== "partial")
|
|
150683
|
+
break;
|
|
150684
|
+
}
|
|
150105
150685
|
return {
|
|
150106
150686
|
events: events2,
|
|
150107
150687
|
cursor: consumed.cursor || (partialStreamRetries > 0 ? cursor : null),
|
|
@@ -150560,7 +151140,8 @@ async function createWorkflowRunEvent(id2, data2, params, config2) {
|
|
|
150560
151140
|
// The atomic lazy-resume shape is deduplicated server-side by the
|
|
150561
151141
|
// (runId, resumeId) claim, so its POST is idempotent-on-retry even
|
|
150562
151142
|
// though plain hook_received is not; see EVENT_RETRY_ELIGIBILITY.
|
|
150563
|
-
idempotentHookResume: data2.eventType === "hook_received" && (params == null ? void 0 : params.resumeId) !== void 0 && (params == null ? void 0 : params.resumePayloadDigest) !== void 0
|
|
151143
|
+
idempotentHookResume: data2.eventType === "hook_received" && (params == null ? void 0 : params.resumeId) !== void 0 && (params == null ? void 0 : params.resumePayloadDigest) !== void 0,
|
|
151144
|
+
afterStepBody: (params == null ? void 0 : params.afterStepBody) === true
|
|
150564
151145
|
});
|
|
150565
151146
|
if (data2.eventType === "run_created" && !result.run) {
|
|
150566
151147
|
throw new WorkflowWorldError(`${data2.eventType} response is missing the run entity`, { code: "SCHEMA_VALIDATION" });
|
|
@@ -150575,6 +151156,8 @@ async function createWorkflowRunEvent(id2, data2, params, config2) {
|
|
|
150575
151156
|
} catch (err) {
|
|
150576
151157
|
if (err instanceof ReplayEventObserverError)
|
|
150577
151158
|
throw err.error;
|
|
151159
|
+
if (err instanceof AfterCommitError)
|
|
151160
|
+
throw err.error;
|
|
150578
151161
|
if (HookForceClaimedError.is(err) && data2.eventType === "hook_received") {
|
|
150579
151162
|
const token = (_c2 = data2.eventData) == null ? void 0 : _c2.token;
|
|
150580
151163
|
throw new HookForceClaimedError(typeof token === "string" ? token : err.token, err.claimedByRunId, err.claimedByHookId);
|
|
@@ -150792,7 +151375,126 @@ async function getHookByToken$1(token, config2) {
|
|
|
150792
151375
|
throw error2;
|
|
150793
151376
|
}
|
|
150794
151377
|
}
|
|
151378
|
+
function headersToRecord(headers2) {
|
|
151379
|
+
const record2 = {};
|
|
151380
|
+
for (const [key, value] of headers2) {
|
|
151381
|
+
record2[key] = value;
|
|
151382
|
+
}
|
|
151383
|
+
return record2;
|
|
151384
|
+
}
|
|
151385
|
+
function snapshotDiag(fields) {
|
|
151386
|
+
if (!HTTP_DEBUG_ENABLED)
|
|
151387
|
+
return;
|
|
151388
|
+
console.debug("[workflow:world-vercel:http] WORLD_SNAPSHOT_DIAG", fields);
|
|
151389
|
+
}
|
|
151390
|
+
const MAX_SNAPSHOT_ENVELOPE_BYTES = 64 * 1024 * 1024;
|
|
151391
|
+
function createSnapshotsStorage(config2) {
|
|
151392
|
+
return {
|
|
151393
|
+
async save(runId, data2, metadata) {
|
|
151394
|
+
const t0 = performance.now();
|
|
151395
|
+
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
151396
|
+
const url = `${baseUrl}/v2/runs/${encodeURIComponent(runId)}/snapshot`;
|
|
151397
|
+
const envelope = encodeSnapshotEnvelope(metadata, data2);
|
|
151398
|
+
if (envelope.byteLength > MAX_SNAPSHOT_ENVELOPE_BYTES) {
|
|
151399
|
+
snapshotDiag({
|
|
151400
|
+
op: "save",
|
|
151401
|
+
runId,
|
|
151402
|
+
outcome: "too_large",
|
|
151403
|
+
wireBytes: envelope.byteLength
|
|
151404
|
+
});
|
|
151405
|
+
throw new WorkflowWorldError(`Snapshot for run ${runId} is ${envelope.byteLength} bytes, over the ${MAX_SNAPSHOT_ENVELOPE_BYTES}-byte limit; not uploading`, { url });
|
|
151406
|
+
}
|
|
151407
|
+
headers2.set("Content-Type", "application/octet-stream");
|
|
151408
|
+
headers2.set("X-Snapshot-Events-Cursor", metadata.eventsCursor ?? "");
|
|
151409
|
+
headers2.set("X-Snapshot-Created-At", metadata.createdAt.toISOString());
|
|
151410
|
+
await injectTraceContextIntoHeaders(headers2);
|
|
151411
|
+
const putStart = performance.now();
|
|
151412
|
+
const response2 = await undiciExports.request(url, {
|
|
151413
|
+
method: "PUT",
|
|
151414
|
+
body: envelope,
|
|
151415
|
+
headers: headersToRecord(headers2),
|
|
151416
|
+
dispatcher: getDispatcher(config2)
|
|
151417
|
+
});
|
|
151418
|
+
const putDurationMs = Math.round(performance.now() - putStart);
|
|
151419
|
+
if (response2.statusCode < 200 || response2.statusCode >= 300) {
|
|
151420
|
+
const text2 = await response2.body.text().catch(() => "");
|
|
151421
|
+
throw new WorkflowWorldError(`PUT /v2/runs/${runId}/snapshot -> HTTP ${response2.statusCode}: ${text2}`, { url, status: response2.statusCode });
|
|
151422
|
+
}
|
|
151423
|
+
await response2.body.text();
|
|
151424
|
+
snapshotDiag({
|
|
151425
|
+
op: "save",
|
|
151426
|
+
runId,
|
|
151427
|
+
// Bytes received from the core — already compressed and
|
|
151428
|
+
// encrypted upstream. The world transports them opaquely
|
|
151429
|
+
// (envelope framing adds the metadata header).
|
|
151430
|
+
wireBytes: envelope.byteLength,
|
|
151431
|
+
putDurationMs,
|
|
151432
|
+
totalDurationMs: Math.round(performance.now() - t0)
|
|
151433
|
+
});
|
|
151434
|
+
},
|
|
151435
|
+
async load(runId) {
|
|
151436
|
+
const t0 = performance.now();
|
|
151437
|
+
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
151438
|
+
const url = `${baseUrl}/v2/runs/${encodeURIComponent(runId)}/snapshot`;
|
|
151439
|
+
headers2.set("Accept", "application/octet-stream");
|
|
151440
|
+
await injectTraceContextIntoHeaders(headers2);
|
|
151441
|
+
const getStart = performance.now();
|
|
151442
|
+
const response2 = await fetch(url, {
|
|
151443
|
+
method: "GET",
|
|
151444
|
+
headers: headers2,
|
|
151445
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher
|
|
151446
|
+
dispatcher: getDispatcher(config2)
|
|
151447
|
+
});
|
|
151448
|
+
const getDurationMs = Math.round(performance.now() - getStart);
|
|
151449
|
+
if (response2.status === 404) {
|
|
151450
|
+
await response2.text().catch(() => {
|
|
151451
|
+
});
|
|
151452
|
+
snapshotDiag({
|
|
151453
|
+
op: "load",
|
|
151454
|
+
runId,
|
|
151455
|
+
outcome: "not_found",
|
|
151456
|
+
getDurationMs,
|
|
151457
|
+
totalDurationMs: Math.round(performance.now() - t0)
|
|
151458
|
+
});
|
|
151459
|
+
return null;
|
|
151460
|
+
}
|
|
151461
|
+
if (!response2.ok) {
|
|
151462
|
+
const text2 = await response2.text().catch(() => "");
|
|
151463
|
+
throw new WorkflowWorldError(`GET /v2/runs/${runId}/snapshot -> HTTP ${response2.status}: ${text2}`, { url, status: response2.status });
|
|
151464
|
+
}
|
|
151465
|
+
const buffer2 = await response2.arrayBuffer();
|
|
151466
|
+
const envelope = new Uint8Array(buffer2);
|
|
151467
|
+
const decoded = decodeSnapshotEnvelope(envelope);
|
|
151468
|
+
snapshotDiag({
|
|
151469
|
+
op: "load",
|
|
151470
|
+
runId,
|
|
151471
|
+
outcome: decoded ? "ok" : "undecodable_envelope",
|
|
151472
|
+
wireBytes: envelope.byteLength,
|
|
151473
|
+
getDurationMs,
|
|
151474
|
+
totalDurationMs: Math.round(performance.now() - t0)
|
|
151475
|
+
});
|
|
151476
|
+
return decoded;
|
|
151477
|
+
},
|
|
151478
|
+
async delete(runId) {
|
|
151479
|
+
const { baseUrl, headers: headers2 } = await getHttpConfig(config2);
|
|
151480
|
+
const url = `${baseUrl}/v2/runs/${encodeURIComponent(runId)}/snapshot`;
|
|
151481
|
+
await injectTraceContextIntoHeaders(headers2);
|
|
151482
|
+
const response2 = await fetch(url, {
|
|
151483
|
+
method: "DELETE",
|
|
151484
|
+
headers: headers2,
|
|
151485
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici dispatcher
|
|
151486
|
+
dispatcher: getDispatcher(config2)
|
|
151487
|
+
});
|
|
151488
|
+
if (!response2.ok && response2.status !== 404) {
|
|
151489
|
+
const text2 = await response2.text().catch(() => "");
|
|
151490
|
+
throw new WorkflowWorldError(`DELETE /v2/runs/${runId}/snapshot -> HTTP ${response2.status}: ${text2}`, { url, status: response2.status });
|
|
151491
|
+
}
|
|
151492
|
+
await response2.text();
|
|
151493
|
+
}
|
|
151494
|
+
};
|
|
151495
|
+
}
|
|
150795
151496
|
function createStorage(config2) {
|
|
151497
|
+
const snapshots = createSnapshotsStorage(config2);
|
|
150796
151498
|
const storage = {
|
|
150797
151499
|
// Storage interface with namespaced methods
|
|
150798
151500
|
runs: {
|
|
@@ -150824,7 +151526,8 @@ function createStorage(config2) {
|
|
|
150824
151526
|
runs: instrumentObject("world.runs", storage.runs),
|
|
150825
151527
|
steps: instrumentObject("world.steps", storage.steps),
|
|
150826
151528
|
events: instrumentObject("world.events", storage.events),
|
|
150827
|
-
hooks: instrumentObject("world.hooks", storage.hooks)
|
|
151529
|
+
hooks: instrumentObject("world.hooks", storage.hooks),
|
|
151530
|
+
experimental_snapshots: instrumentObject("world.experimental_snapshots", snapshots)
|
|
150828
151531
|
};
|
|
150829
151532
|
}
|
|
150830
151533
|
const MAX_CHUNKS_PER_STREAM_WRITE = 1e3;
|
|
@@ -150856,6 +151559,8 @@ function encodeNormalizedMultiChunks(binaryChunks) {
|
|
|
150856
151559
|
}
|
|
150857
151560
|
const STREAM_WS_V1_MAX_CHUNKS_PER_WRITE = MAX_CHUNKS_PER_STREAM_WRITE;
|
|
150858
151561
|
const STREAM_WS_V1_MAX_CHUNK_BYTES = 10 * 1024 * 1024;
|
|
151562
|
+
const STREAM_WS_V1_WRITE_ENVELOPE_MAX_BYTES = 128;
|
|
151563
|
+
const CHUNK_RECORD_PREFIX_BYTES = 4;
|
|
150859
151564
|
const NonnegativeIntegerSchema = number$3().int().nonnegative();
|
|
150860
151565
|
const RequestIdSchema = NonnegativeIntegerSchema;
|
|
150861
151566
|
const StreamWriterIdSchema = string$2().regex(/^wrtr_[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/);
|
|
@@ -150885,7 +151590,8 @@ const StreamWsErrorMetaSchema = object$1({
|
|
|
150885
151590
|
type: literal$1("error"),
|
|
150886
151591
|
reqId: RequestIdSchema.optional(),
|
|
150887
151592
|
status: number$3().int(),
|
|
150888
|
-
message: string$2().optional()
|
|
151593
|
+
message: string$2().optional(),
|
|
151594
|
+
retryAfter: string$2().optional()
|
|
150889
151595
|
});
|
|
150890
151596
|
const StreamWsDrainMetaSchema = object$1({
|
|
150891
151597
|
type: literal$1("drain"),
|
|
@@ -150920,6 +151626,18 @@ function encodeStreamWsWriteRequest(meta, chunks) {
|
|
|
150920
151626
|
}
|
|
150921
151627
|
return encodeFrame(parsed, encodeNormalizedMultiChunks(binaryChunks));
|
|
150922
151628
|
}
|
|
151629
|
+
function streamWsWriteBatchEnd(chunks, start2, maxMessageBytes) {
|
|
151630
|
+
const countEnd = Math.min(chunks.length, start2 + STREAM_WS_V1_MAX_CHUNKS_PER_WRITE);
|
|
151631
|
+
let bytes = STREAM_WS_V1_WRITE_ENVELOPE_MAX_BYTES + CHUNK_RECORD_PREFIX_BYTES + chunks[start2].byteLength;
|
|
151632
|
+
let end = start2 + 1;
|
|
151633
|
+
while (end < countEnd) {
|
|
151634
|
+
bytes += CHUNK_RECORD_PREFIX_BYTES + chunks[end].byteLength;
|
|
151635
|
+
if (bytes > maxMessageBytes)
|
|
151636
|
+
break;
|
|
151637
|
+
end++;
|
|
151638
|
+
}
|
|
151639
|
+
return end;
|
|
151640
|
+
}
|
|
150923
151641
|
function encodeStreamWsCloseRequest(meta) {
|
|
150924
151642
|
return encodeFrame(StreamWsCloseRequestMetaSchema.parse(meta), new Uint8Array());
|
|
150925
151643
|
}
|
|
@@ -150929,6 +151647,209 @@ function parseStreamWsReply(meta, body2) {
|
|
|
150929
151647
|
}
|
|
150930
151648
|
return StreamWsReplyMetaSchema.parse(meta);
|
|
150931
151649
|
}
|
|
151650
|
+
const WS_FLAGS_HEADER = "x-workflow-ws-flags";
|
|
151651
|
+
const WS_FLAG_FRAME_PARTS = "frame-parts";
|
|
151652
|
+
const WS_CLIENT_FLAGS = [WS_FLAG_FRAME_PARTS];
|
|
151653
|
+
const WS_PART_TYPE = "part";
|
|
151654
|
+
const DEFAULT_WS_MAX_MESSAGE_BYTES = 12 * 1024 * 1024;
|
|
151655
|
+
const MAX_WS_MAX_MESSAGE_BYTES = 16 * 1024 * 1024;
|
|
151656
|
+
const MIN_WS_MAX_MESSAGE_BYTES = 2 * 1024 * 1024;
|
|
151657
|
+
function wsMaxMessageBytes() {
|
|
151658
|
+
return envNumber("WORKFLOW_WS_MAX_MESSAGE_BYTES", DEFAULT_WS_MAX_MESSAGE_BYTES, {
|
|
151659
|
+
min: MIN_WS_MAX_MESSAGE_BYTES,
|
|
151660
|
+
max: MAX_WS_MAX_MESSAGE_BYTES,
|
|
151661
|
+
integer: true
|
|
151662
|
+
});
|
|
151663
|
+
}
|
|
151664
|
+
function encodeWsFrameMessages(meta, body2, maxMessageBytes) {
|
|
151665
|
+
const whole = encodeFrame(meta, body2);
|
|
151666
|
+
if (whole.byteLength <= maxMessageBytes)
|
|
151667
|
+
return [whole];
|
|
151668
|
+
if (body2.byteLength > WS_MAX_FRAME_BYTES) {
|
|
151669
|
+
throw new WsFrameTooLargeError(`ws frame body of ${body2.byteLength} bytes is over the ${WS_MAX_FRAME_BYTES}-byte limit for a split frame`);
|
|
151670
|
+
}
|
|
151671
|
+
const reqId = meta.reqId;
|
|
151672
|
+
if (!isClientReqId(reqId)) {
|
|
151673
|
+
throw new Error(`ws frame of ${whole.byteLength} bytes exceeds the ${maxMessageBytes}-byte message limit and has no reqId to split it under`);
|
|
151674
|
+
}
|
|
151675
|
+
const bound = body2.byteLength + 1;
|
|
151676
|
+
const firstHeaderBytes = encodeFrame({ ...meta, partIndex: 0, partCount: bound }, EMPTY).byteLength;
|
|
151677
|
+
const continuationHeaderBytes = encodeFrame(continuationMeta(reqId, bound, bound), EMPTY).byteLength;
|
|
151678
|
+
const firstSlice = maxMessageBytes - firstHeaderBytes;
|
|
151679
|
+
const continuationSlice = maxMessageBytes - continuationHeaderBytes;
|
|
151680
|
+
if (firstSlice <= 0 || continuationSlice <= 0) {
|
|
151681
|
+
throw new Error(`ws frame meta does not fit in the ${maxMessageBytes}-byte message limit`);
|
|
151682
|
+
}
|
|
151683
|
+
const rest = body2.byteLength - firstSlice;
|
|
151684
|
+
const partCount = 1 + Math.ceil(rest / continuationSlice);
|
|
151685
|
+
if (partCount > WS_MAX_PART_COUNT) {
|
|
151686
|
+
throw new Error(`ws frame of ${whole.byteLength} bytes needs ${partCount} parts at a ${maxMessageBytes}-byte message limit; at most ${WS_MAX_PART_COUNT} are allowed`);
|
|
151687
|
+
}
|
|
151688
|
+
const messages = [
|
|
151689
|
+
encodeFrame({ ...meta, partIndex: 0, partCount }, body2.subarray(0, firstSlice))
|
|
151690
|
+
];
|
|
151691
|
+
for (let index2 = 1; index2 < partCount; index2++) {
|
|
151692
|
+
const start2 = firstSlice + (index2 - 1) * continuationSlice;
|
|
151693
|
+
messages.push(encodeFrame(continuationMeta(reqId, index2, partCount), body2.subarray(start2, Math.min(start2 + continuationSlice, body2.byteLength))));
|
|
151694
|
+
}
|
|
151695
|
+
return messages;
|
|
151696
|
+
}
|
|
151697
|
+
const EMPTY = new Uint8Array(0);
|
|
151698
|
+
function splitEncodedFrame(frame2, maxMessageBytes) {
|
|
151699
|
+
if (frame2.byteLength <= maxMessageBytes)
|
|
151700
|
+
return [frame2];
|
|
151701
|
+
const { meta, body: body2 } = decodeFrame(frame2);
|
|
151702
|
+
return encodeWsFrameMessages(meta, body2, maxMessageBytes);
|
|
151703
|
+
}
|
|
151704
|
+
function continuationMeta(reqId, partIndex, partCount) {
|
|
151705
|
+
return { type: WS_PART_TYPE, reqId, partIndex, partCount };
|
|
151706
|
+
}
|
|
151707
|
+
class WsFrameTooLargeError extends Error {
|
|
151708
|
+
constructor() {
|
|
151709
|
+
super(...arguments);
|
|
151710
|
+
__publicField(this, "name", "WsFrameTooLargeError");
|
|
151711
|
+
}
|
|
151712
|
+
}
|
|
151713
|
+
class WsPartProtocolError extends Error {
|
|
151714
|
+
constructor() {
|
|
151715
|
+
super(...arguments);
|
|
151716
|
+
__publicField(this, "name", "WsPartProtocolError");
|
|
151717
|
+
}
|
|
151718
|
+
}
|
|
151719
|
+
const WS_MAX_FRAME_BYTES = 256 * 1024 * 1024;
|
|
151720
|
+
const WS_MAX_OPEN_FRAMES = 1;
|
|
151721
|
+
const WS_MAX_PART_COUNT = 257;
|
|
151722
|
+
class WsPartAssembler {
|
|
151723
|
+
constructor(options = {}) {
|
|
151724
|
+
__publicField(this, "open", /* @__PURE__ */ new Map());
|
|
151725
|
+
__publicField(this, "maxFrameBytes");
|
|
151726
|
+
__publicField(this, "maxBodyBytes");
|
|
151727
|
+
__publicField(this, "onTooLarge");
|
|
151728
|
+
__publicField(this, "maxOpenFrames");
|
|
151729
|
+
__publicField(this, "maxPartCount");
|
|
151730
|
+
__publicField(this, "wanted");
|
|
151731
|
+
__publicField(this, "onDiscarded");
|
|
151732
|
+
this.maxFrameBytes = options.maxFrameBytes ?? WS_MAX_FRAME_BYTES;
|
|
151733
|
+
this.maxBodyBytes = Math.min(options.maxBodyBytes ?? this.maxFrameBytes, this.maxFrameBytes);
|
|
151734
|
+
this.onTooLarge = options.onTooLarge ?? (() => {
|
|
151735
|
+
});
|
|
151736
|
+
this.maxOpenFrames = options.maxOpenFrames ?? WS_MAX_OPEN_FRAMES;
|
|
151737
|
+
this.maxPartCount = options.maxPartCount ?? WS_MAX_PART_COUNT;
|
|
151738
|
+
this.wanted = options.wanted ?? (() => true);
|
|
151739
|
+
this.onDiscarded = options.onDiscarded ?? (() => {
|
|
151740
|
+
});
|
|
151741
|
+
}
|
|
151742
|
+
accept(frame2) {
|
|
151743
|
+
const { meta, body: body2 } = frame2;
|
|
151744
|
+
if (meta.type === WS_PART_TYPE)
|
|
151745
|
+
return this.continue(meta, body2);
|
|
151746
|
+
const { reqId, partIndex, partCount } = meta;
|
|
151747
|
+
if (!("partIndex" in meta) && !("partCount" in meta)) {
|
|
151748
|
+
if (isClientReqId(reqId) && this.open.has(reqId)) {
|
|
151749
|
+
throw new WsPartProtocolError(`whole frame for reqId ${reqId} while its split frame is open`);
|
|
151750
|
+
}
|
|
151751
|
+
return frame2;
|
|
151752
|
+
}
|
|
151753
|
+
if (!isClientReqId(reqId)) {
|
|
151754
|
+
throw new WsPartProtocolError("first part has no valid reqId");
|
|
151755
|
+
}
|
|
151756
|
+
if (partIndex !== 0) {
|
|
151757
|
+
throw new WsPartProtocolError(`first part for reqId ${reqId} has partIndex ${String(partIndex)}, expected 0`);
|
|
151758
|
+
}
|
|
151759
|
+
if (!isPartCount(partCount) || partCount > this.maxPartCount) {
|
|
151760
|
+
throw new WsPartProtocolError(`first part for reqId ${reqId} has invalid partCount ${String(partCount)} (2..${this.maxPartCount})`);
|
|
151761
|
+
}
|
|
151762
|
+
if (this.open.has(reqId)) {
|
|
151763
|
+
throw new WsPartProtocolError(`second first part for reqId ${reqId} while one is open`);
|
|
151764
|
+
}
|
|
151765
|
+
if (this.open.size >= this.maxOpenFrames) {
|
|
151766
|
+
throw new WsPartProtocolError(`more than ${this.maxOpenFrames} split frames open at once`);
|
|
151767
|
+
}
|
|
151768
|
+
const { partIndex: _index, partCount: _count, ...frameMeta } = meta;
|
|
151769
|
+
const entry2 = {
|
|
151770
|
+
meta: frameMeta,
|
|
151771
|
+
partCount,
|
|
151772
|
+
nextIndex: 1,
|
|
151773
|
+
chunks: [],
|
|
151774
|
+
bytes: 0,
|
|
151775
|
+
discard: !this.wanted(reqId),
|
|
151776
|
+
tooLarge: false
|
|
151777
|
+
};
|
|
151778
|
+
this.open.set(reqId, entry2);
|
|
151779
|
+
this.addChunk(reqId, entry2, body2);
|
|
151780
|
+
return void 0;
|
|
151781
|
+
}
|
|
151782
|
+
/** Number of split frames still arriving. */
|
|
151783
|
+
get openFrames() {
|
|
151784
|
+
return this.open.size;
|
|
151785
|
+
}
|
|
151786
|
+
continue(meta, body2) {
|
|
151787
|
+
const keys2 = Object.keys(meta);
|
|
151788
|
+
if (keys2.length !== 4 || !("reqId" in meta) || !("partIndex" in meta) || !("partCount" in meta)) {
|
|
151789
|
+
throw new WsPartProtocolError(`continuation part must have exactly type, reqId, partIndex and partCount, got ${keys2.join(", ")}`);
|
|
151790
|
+
}
|
|
151791
|
+
const { reqId, partIndex, partCount } = meta;
|
|
151792
|
+
if (!isClientReqId(reqId)) {
|
|
151793
|
+
throw new WsPartProtocolError("continuation part has no valid reqId");
|
|
151794
|
+
}
|
|
151795
|
+
const entry2 = this.open.get(reqId);
|
|
151796
|
+
if (!entry2) {
|
|
151797
|
+
throw new WsPartProtocolError(`continuation part for reqId ${reqId} with no open frame`);
|
|
151798
|
+
}
|
|
151799
|
+
if (partCount !== entry2.partCount) {
|
|
151800
|
+
throw new WsPartProtocolError(`continuation part for reqId ${reqId} has partCount ${String(partCount)}, expected ${entry2.partCount}`);
|
|
151801
|
+
}
|
|
151802
|
+
if (partIndex !== entry2.nextIndex) {
|
|
151803
|
+
throw new WsPartProtocolError(`continuation part for reqId ${reqId} has partIndex ${String(partIndex)}, expected ${entry2.nextIndex}`);
|
|
151804
|
+
}
|
|
151805
|
+
const last = entry2.nextIndex === entry2.partCount - 1;
|
|
151806
|
+
this.addChunk(reqId, entry2, body2);
|
|
151807
|
+
entry2.nextIndex++;
|
|
151808
|
+
if (!last)
|
|
151809
|
+
return void 0;
|
|
151810
|
+
this.close(reqId);
|
|
151811
|
+
if (entry2.tooLarge) {
|
|
151812
|
+
this.onTooLarge(reqId, entry2.bytes);
|
|
151813
|
+
return void 0;
|
|
151814
|
+
}
|
|
151815
|
+
if (entry2.discard) {
|
|
151816
|
+
this.onDiscarded(reqId);
|
|
151817
|
+
return void 0;
|
|
151818
|
+
}
|
|
151819
|
+
const joined = new Uint8Array(entry2.bytes);
|
|
151820
|
+
let offset3 = 0;
|
|
151821
|
+
for (const chunk of entry2.chunks) {
|
|
151822
|
+
joined.set(chunk, offset3);
|
|
151823
|
+
offset3 += chunk.byteLength;
|
|
151824
|
+
}
|
|
151825
|
+
return { meta: entry2.meta, body: joined };
|
|
151826
|
+
}
|
|
151827
|
+
addChunk(reqId, entry2, body2) {
|
|
151828
|
+
if (entry2.bytes + body2.byteLength > this.maxFrameBytes) {
|
|
151829
|
+
this.close(reqId);
|
|
151830
|
+
throw new WsPartProtocolError(`frame for reqId ${reqId} exceeds ${this.maxFrameBytes} bytes`);
|
|
151831
|
+
}
|
|
151832
|
+
entry2.bytes += body2.byteLength;
|
|
151833
|
+
if (!entry2.discard && entry2.bytes > this.maxBodyBytes) {
|
|
151834
|
+
entry2.discard = true;
|
|
151835
|
+
entry2.tooLarge = true;
|
|
151836
|
+
entry2.chunks = [];
|
|
151837
|
+
}
|
|
151838
|
+
if (entry2.discard)
|
|
151839
|
+
return;
|
|
151840
|
+
entry2.chunks.push(body2.slice());
|
|
151841
|
+
}
|
|
151842
|
+
/** Forget an open frame, releasing its buffered bytes. */
|
|
151843
|
+
close(reqId) {
|
|
151844
|
+
this.open.delete(reqId);
|
|
151845
|
+
}
|
|
151846
|
+
}
|
|
151847
|
+
function isClientReqId(value) {
|
|
151848
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 0;
|
|
151849
|
+
}
|
|
151850
|
+
function isPartCount(value) {
|
|
151851
|
+
return typeof value === "number" && Number.isInteger(value) && value >= 2;
|
|
151852
|
+
}
|
|
150932
151853
|
const STREAM_WS_INITIAL_CONNECT_TIMEOUT_MS = 1e4;
|
|
150933
151854
|
const STREAM_WS_RECONNECT_BUDGET_MS = 250;
|
|
150934
151855
|
const STREAM_WS_CLOSE_BUDGET_MS = 250;
|
|
@@ -150957,7 +151878,7 @@ function beginNormalWsClose(ws, reason) {
|
|
|
150957
151878
|
await observed;
|
|
150958
151879
|
span == null ? void 0 : span.setAttribute("workflow.stream.ws.close_cleanup_timeout", timedOut);
|
|
150959
151880
|
});
|
|
150960
|
-
void import("./index-
|
|
151881
|
+
void import("./index-HeFIWQE6.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => waitUntil2(cleanup)).catch(() => {
|
|
150961
151882
|
});
|
|
150962
151883
|
void cleanup.catch(() => {
|
|
150963
151884
|
});
|
|
@@ -151027,18 +151948,19 @@ class StreamWsRequestNotSentError extends Error {
|
|
|
151027
151948
|
this.name = "StreamWsRequestNotSentError";
|
|
151028
151949
|
}
|
|
151029
151950
|
}
|
|
151030
|
-
|
|
151031
|
-
|
|
151032
|
-
|
|
151033
|
-
|
|
151034
|
-
|
|
151035
|
-
|
|
151036
|
-
|
|
151037
|
-
|
|
151951
|
+
class StreamWsThrottledError extends Error {
|
|
151952
|
+
constructor(message2, retryAfter) {
|
|
151953
|
+
super(message2);
|
|
151954
|
+
__publicField(this, "retryAfter");
|
|
151955
|
+
this.retryAfter = retryAfter;
|
|
151956
|
+
this.name = "StreamWsThrottledError";
|
|
151957
|
+
}
|
|
151958
|
+
}
|
|
151959
|
+
class StreamWsCloseRetriableError extends Error {
|
|
151960
|
+
constructor(message2) {
|
|
151961
|
+
super(message2);
|
|
151962
|
+
this.name = "StreamWsCloseRetriableError";
|
|
151038
151963
|
}
|
|
151039
|
-
if (!frame2)
|
|
151040
|
-
throw new Error("stream WebSocket message has no frame");
|
|
151041
|
-
return frame2;
|
|
151042
151964
|
}
|
|
151043
151965
|
function asBytes(raw2) {
|
|
151044
151966
|
if (raw2 instanceof Uint8Array)
|
|
@@ -151065,6 +151987,10 @@ class VercelStreamWriteSession {
|
|
|
151065
151987
|
__publicField(this, "nextReqId", 1);
|
|
151066
151988
|
__publicField(this, "pending");
|
|
151067
151989
|
__publicField(this, "poisonError");
|
|
151990
|
+
/** The socket that returned a 429 whose retry is still waiting. */
|
|
151991
|
+
__publicField(this, "throttledSocket");
|
|
151992
|
+
/** Aborted on dispose or poison, ending any throttle wait early. */
|
|
151993
|
+
__publicField(this, "terminated", new AbortController());
|
|
151068
151994
|
__publicField(this, "wsUrl");
|
|
151069
151995
|
__publicField(this, "closeAcknowledged", false);
|
|
151070
151996
|
__publicField(this, "idleReconnects", 0);
|
|
@@ -151114,29 +152040,45 @@ class VercelStreamWriteSession {
|
|
|
151114
152040
|
await this.transportDecision;
|
|
151115
152041
|
this.assertUsable();
|
|
151116
152042
|
if (this.mode === "http") {
|
|
151117
|
-
await this.
|
|
152043
|
+
await this.writeHttpOrFail(chunks);
|
|
151118
152044
|
return;
|
|
151119
152045
|
}
|
|
151120
|
-
|
|
151121
|
-
|
|
152046
|
+
const maxMessageBytes = wsMaxMessageBytes();
|
|
152047
|
+
const binaryChunks = normalizeStreamChunks(chunks);
|
|
152048
|
+
for (let offset3 = 0; offset3 < chunks.length; ) {
|
|
152049
|
+
const end = streamWsWriteBatchEnd(binaryChunks, offset3, maxMessageBytes);
|
|
152050
|
+
const batch = binaryChunks.slice(offset3, end);
|
|
151122
152051
|
let reply;
|
|
151123
152052
|
try {
|
|
151124
|
-
reply = await this.
|
|
152053
|
+
reply = await this.requestRetryingThrottle("write", (reqId) => encodeStreamWsWriteRequest({
|
|
151125
152054
|
type: "write",
|
|
151126
152055
|
reqId,
|
|
151127
152056
|
chunkSeq: chunkSeq + offset3,
|
|
151128
152057
|
numChunks: batch.length
|
|
151129
|
-
}, batch), offset3 === 0 ? timing : void 0, { chunkSeq: chunkSeq + offset3, numChunks: batch.length });
|
|
152058
|
+
}, batch), offset3 === 0 ? timing : void 0, { chunkSeq: chunkSeq + offset3, numChunks: batch.length }, maxMessageBytes);
|
|
151130
152059
|
} catch (error2) {
|
|
151131
152060
|
if (!(error2 instanceof StreamWsRequestNotSentError))
|
|
151132
152061
|
throw error2;
|
|
151133
152062
|
this.fallbackToHttpBeforeSend();
|
|
151134
|
-
await this.
|
|
152063
|
+
await this.writeHttpOrFail(chunks.slice(offset3));
|
|
151135
152064
|
return;
|
|
151136
152065
|
}
|
|
151137
152066
|
if (reply.type !== "write_ack") {
|
|
151138
152067
|
throw this.poison(new Error(`stream WebSocket write received ${reply.type}`));
|
|
151139
152068
|
}
|
|
152069
|
+
offset3 = end;
|
|
152070
|
+
}
|
|
152071
|
+
}
|
|
152072
|
+
/**
|
|
152073
|
+
* An HTTP write whose outcome may be unknown fails the writer, as on every
|
|
152074
|
+
* other transport, so a queued write cannot apply ahead of it.
|
|
152075
|
+
*/
|
|
152076
|
+
async writeHttpOrFail(chunks) {
|
|
152077
|
+
try {
|
|
152078
|
+
await this.writeHttp(chunks);
|
|
152079
|
+
} catch (error2) {
|
|
152080
|
+
this.failUnknown(error2);
|
|
152081
|
+
throw this.poisonError;
|
|
151140
152082
|
}
|
|
151141
152083
|
}
|
|
151142
152084
|
shouldWriteHttpWhileConnecting() {
|
|
@@ -151190,11 +152132,19 @@ class VercelStreamWriteSession {
|
|
|
151190
152132
|
if (this.mode === "deferred")
|
|
151191
152133
|
this.mode = "waiting_to_connect";
|
|
151192
152134
|
}
|
|
152135
|
+
release() {
|
|
152136
|
+
return this.enqueue(async () => {
|
|
152137
|
+
if (this.mode === "closed" || this.mode === "poisoned")
|
|
152138
|
+
return;
|
|
152139
|
+
this.fallbackToHttpBeforeSend("stream writer released");
|
|
152140
|
+
});
|
|
152141
|
+
}
|
|
151193
152142
|
dispose() {
|
|
151194
152143
|
var _a3;
|
|
151195
152144
|
if (this.mode === "closed")
|
|
151196
152145
|
return;
|
|
151197
152146
|
this.mode = "closed";
|
|
152147
|
+
this.terminated.abort();
|
|
151198
152148
|
this.finishDrainWait();
|
|
151199
152149
|
const pending = this.pending;
|
|
151200
152150
|
this.pending = void 0;
|
|
@@ -151221,25 +152171,29 @@ class VercelStreamWriteSession {
|
|
|
151221
152171
|
this.mode = "closed";
|
|
151222
152172
|
return;
|
|
151223
152173
|
}
|
|
151224
|
-
|
|
151225
|
-
try {
|
|
151226
|
-
reply = await this.request((reqId) => encodeStreamWsCloseRequest({ type: "close", reqId }));
|
|
151227
|
-
} catch (error2) {
|
|
151228
|
-
if (!(error2 instanceof StreamWsRequestNotSentError))
|
|
151229
|
-
throw error2;
|
|
151230
|
-
this.fallbackToHttpBeforeSend();
|
|
151231
|
-
await this.closeHttp();
|
|
151232
|
-
this.mode = "closed";
|
|
151233
|
-
return;
|
|
151234
|
-
}
|
|
151235
|
-
if (reply.type !== "close_ack") {
|
|
151236
|
-
throw this.poison(new Error(`stream WebSocket close received ${reply.type}`));
|
|
151237
|
-
}
|
|
151238
|
-
this.mode = "closed";
|
|
151239
|
-
if (this.socket)
|
|
151240
|
-
beginNormalWsClose(this.socket, "stream closed");
|
|
152174
|
+
await this.closeOverWs();
|
|
151241
152175
|
});
|
|
151242
152176
|
}
|
|
152177
|
+
async closeOverWs() {
|
|
152178
|
+
let reply;
|
|
152179
|
+
try {
|
|
152180
|
+
reply = await this.requestRetryingThrottle("close", (reqId) => encodeStreamWsCloseRequest({ type: "close", reqId }));
|
|
152181
|
+
} catch (error2) {
|
|
152182
|
+
const httpRetry = error2 instanceof StreamWsRequestNotSentError || error2 instanceof StreamWsCloseRetriableError;
|
|
152183
|
+
if (!httpRetry)
|
|
152184
|
+
throw error2;
|
|
152185
|
+
this.fallbackToHttpBeforeSend();
|
|
152186
|
+
await this.closeHttp();
|
|
152187
|
+
this.mode = "closed";
|
|
152188
|
+
return;
|
|
152189
|
+
}
|
|
152190
|
+
if (reply.type !== "close_ack") {
|
|
152191
|
+
throw this.poison(new Error(`stream WebSocket close received ${reply.type}`));
|
|
152192
|
+
}
|
|
152193
|
+
this.mode = "closed";
|
|
152194
|
+
if (this.socket)
|
|
152195
|
+
beginNormalWsClose(this.socket, "stream closed");
|
|
152196
|
+
}
|
|
151243
152197
|
enqueue(operation) {
|
|
151244
152198
|
const result = this.tail.then(operation);
|
|
151245
152199
|
this.tail = result.catch(() => {
|
|
@@ -151309,7 +152263,7 @@ class VercelStreamWriteSession {
|
|
|
151309
152263
|
return http3;
|
|
151310
152264
|
});
|
|
151311
152265
|
const [{ WebSocket: WebSocketImpl }, http2] = await Promise.all([
|
|
151312
|
-
import("./wrapper-
|
|
152266
|
+
import("./wrapper-ikjqnRtL.js"),
|
|
151313
152267
|
httpPromise
|
|
151314
152268
|
]);
|
|
151315
152269
|
if (this.mode !== "connecting")
|
|
@@ -151338,7 +152292,7 @@ class VercelStreamWriteSession {
|
|
|
151338
152292
|
return;
|
|
151339
152293
|
timing.socketStartedAt = now$1();
|
|
151340
152294
|
const ws = new WebSocketImpl(url, {
|
|
151341
|
-
headers: headersToRecord(http2.headers)
|
|
152295
|
+
headers: headersToRecord$1(http2.headers)
|
|
151342
152296
|
});
|
|
151343
152297
|
this.socket = ws;
|
|
151344
152298
|
ws.binaryType = "nodebuffer";
|
|
@@ -151375,7 +152329,15 @@ class VercelStreamWriteSession {
|
|
|
151375
152329
|
fallback();
|
|
151376
152330
|
return;
|
|
151377
152331
|
}
|
|
151378
|
-
this.
|
|
152332
|
+
void this.inbound.then(() => {
|
|
152333
|
+
if (ws !== this.socket)
|
|
152334
|
+
return;
|
|
152335
|
+
if (this.isIdleThrottledSocket(ws)) {
|
|
152336
|
+
this.leaveThrottledSocketForHttp();
|
|
152337
|
+
return;
|
|
152338
|
+
}
|
|
152339
|
+
this.failUnknown(error2);
|
|
152340
|
+
});
|
|
151379
152341
|
});
|
|
151380
152342
|
ws.once("close", (code2) => {
|
|
151381
152343
|
if (!opened) {
|
|
@@ -151392,9 +152354,8 @@ class VercelStreamWriteSession {
|
|
|
151392
152354
|
});
|
|
151393
152355
|
}
|
|
151394
152356
|
async handleMessage(raw2, receivedAt) {
|
|
151395
|
-
var _a3;
|
|
151396
152357
|
try {
|
|
151397
|
-
const frame2 =
|
|
152358
|
+
const frame2 = decodeFrame(raw2);
|
|
151398
152359
|
const reply = parseStreamWsReply(frame2.meta, frame2.body);
|
|
151399
152360
|
if (reply.type === "drain") {
|
|
151400
152361
|
this.handleDrain(reply.reason, reply.graceMs);
|
|
@@ -151413,8 +152374,7 @@ class VercelStreamWriteSession {
|
|
|
151413
152374
|
if (reply.type === "close_ack")
|
|
151414
152375
|
this.closeAcknowledged = true;
|
|
151415
152376
|
if (reply.type === "error") {
|
|
151416
|
-
pending.reject(this.
|
|
151417
|
-
(_a3 = this.socket) == null ? void 0 : _a3.close(1011, "stream request failed");
|
|
152377
|
+
pending.reject(this.requestError(pending, reply));
|
|
151418
152378
|
} else {
|
|
151419
152379
|
if (reply.type === "write_ack")
|
|
151420
152380
|
this.idleReconnects = 0;
|
|
@@ -151466,6 +152426,10 @@ class VercelStreamWriteSession {
|
|
|
151466
152426
|
this.failUnknown(new Error("stream WebSocket closed before reply"));
|
|
151467
152427
|
return;
|
|
151468
152428
|
}
|
|
152429
|
+
if (socket && this.isIdleThrottledSocket(socket) && this.mode === "ws") {
|
|
152430
|
+
this.leaveThrottledSocketForHttp();
|
|
152431
|
+
return;
|
|
152432
|
+
}
|
|
151469
152433
|
if (this.mode === "draining" && code2 !== 1001) {
|
|
151470
152434
|
this.drainReason = void 0;
|
|
151471
152435
|
this.mode = "http";
|
|
@@ -151502,7 +152466,7 @@ class VercelStreamWriteSession {
|
|
|
151502
152466
|
this.connect = this.startConnect();
|
|
151503
152467
|
this.transportDecision = this.makeTransportDecision(true);
|
|
151504
152468
|
}
|
|
151505
|
-
async request(buildFrame, writeTiming, writeMetadata) {
|
|
152469
|
+
async request(operation, buildFrame, writeTiming, writeMetadata, maxMessageBytes = wsMaxMessageBytes()) {
|
|
151506
152470
|
this.assertUsable();
|
|
151507
152471
|
const ws = this.socket;
|
|
151508
152472
|
if (this.mode !== "ws" || !ws || ws.readyState !== 1) {
|
|
@@ -151515,6 +152479,9 @@ class VercelStreamWriteSession {
|
|
|
151515
152479
|
} catch (error2) {
|
|
151516
152480
|
throw new StreamWsRequestNotSentError(error2);
|
|
151517
152481
|
}
|
|
152482
|
+
if (frame2.byteLength > maxMessageBytes) {
|
|
152483
|
+
throw new StreamWsRequestNotSentError(new Error(`stream WebSocket message is ${frame2.byteLength} bytes; maximum is ${maxMessageBytes}`));
|
|
152484
|
+
}
|
|
151518
152485
|
const connectionTiming = this.connectionTiming;
|
|
151519
152486
|
const connectionFirstWrite = (connectionTiming == null ? void 0 : connectionTiming.firstWriteSent) === false;
|
|
151520
152487
|
const detailedTiming = writeTiming && (writeTiming.sessionFirstWrite || connectionFirstWrite) ? writeTiming : void 0;
|
|
@@ -151542,7 +152509,7 @@ class VercelStreamWriteSession {
|
|
|
151542
152509
|
this.failUnknown(new Error(`stream WebSocket request ${reqId} timed out with no reply`));
|
|
151543
152510
|
}, getRequestTimeoutMs());
|
|
151544
152511
|
(_a3 = timer2.unref) == null ? void 0 : _a3.call(timer2);
|
|
151545
|
-
pending = { reqId, resolve: resolve2, reject, timer: timer2 };
|
|
152512
|
+
pending = { reqId, operation, resolve: resolve2, reject, timer: timer2 };
|
|
151546
152513
|
this.pending = pending;
|
|
151547
152514
|
try {
|
|
151548
152515
|
if (detailedTiming) {
|
|
@@ -151575,11 +152542,79 @@ class VercelStreamWriteSession {
|
|
|
151575
152542
|
this.releaseDrainWait = void 0;
|
|
151576
152543
|
release == null ? void 0 : release();
|
|
151577
152544
|
}
|
|
151578
|
-
fallbackToHttpBeforeSend() {
|
|
152545
|
+
fallbackToHttpBeforeSend(reason = "HTTP fallback before send") {
|
|
152546
|
+
this.mode = "http";
|
|
152547
|
+
this.drainReason = void 0;
|
|
152548
|
+
const socket = this.socket;
|
|
152549
|
+
this.socket = void 0;
|
|
152550
|
+
this.transportDecision = Promise.resolve();
|
|
152551
|
+
this.finishDrainWait();
|
|
152552
|
+
if (socket)
|
|
152553
|
+
beginNormalWsClose(socket, reason);
|
|
152554
|
+
}
|
|
152555
|
+
/**
|
|
152556
|
+
* Classifies a correlated error and applies its session effect
|
|
152557
|
+
* synchronously, before a close the server queued behind it is handled.
|
|
152558
|
+
*/
|
|
152559
|
+
requestError(pending, reply) {
|
|
151579
152560
|
var _a3;
|
|
152561
|
+
const detail = `(${reply.status}): ${reply.message ?? "unknown error"}`;
|
|
152562
|
+
if (reply.status === 429) {
|
|
152563
|
+
this.throttledSocket = this.socket;
|
|
152564
|
+
return new StreamWsThrottledError(`stream WebSocket ${pending.operation} throttled ${detail}`, parseRetryAfter(reply.retryAfter));
|
|
152565
|
+
}
|
|
152566
|
+
if (pending.operation === "close" && reply.status >= 500 && reply.status <= 599) {
|
|
152567
|
+
this.fallbackToHttpBeforeSend("stream close retried over HTTP");
|
|
152568
|
+
return new StreamWsCloseRetriableError(`stream WebSocket close failed ${detail}`);
|
|
152569
|
+
}
|
|
152570
|
+
const poisoned = this.poison(new Error(`stream WebSocket request failed ${detail}`));
|
|
152571
|
+
(_a3 = this.socket) == null ? void 0 : _a3.close(1011, "stream request failed");
|
|
152572
|
+
return poisoned;
|
|
152573
|
+
}
|
|
152574
|
+
/**
|
|
152575
|
+
* Sends one request, resending it (same frame contents, new reqId) after
|
|
152576
|
+
* each correlated 429 on the shared event-write throttle budget. A resend
|
|
152577
|
+
* whose socket closed meanwhile, or one past the budget, throws
|
|
152578
|
+
* StreamWsRequestNotSentError, which callers turn into an HTTP fallback.
|
|
152579
|
+
*/
|
|
152580
|
+
async requestRetryingThrottle(operation, buildFrame, writeTiming, writeMetadata, maxMessageBytes) {
|
|
152581
|
+
const waitOutThrottle = createThrottleWaiter(operation === "write" ? "writing stream chunks" : "writing stream close", "bounded");
|
|
152582
|
+
for (let attempt = 0; ; attempt++) {
|
|
152583
|
+
try {
|
|
152584
|
+
return await this.request(operation, buildFrame, attempt === 0 ? writeTiming : void 0, writeMetadata, maxMessageBytes);
|
|
152585
|
+
} catch (error2) {
|
|
152586
|
+
if (!(error2 instanceof StreamWsThrottledError))
|
|
152587
|
+
throw error2;
|
|
152588
|
+
await this.waitOutThrottle(waitOutThrottle, error2);
|
|
152589
|
+
}
|
|
152590
|
+
}
|
|
152591
|
+
}
|
|
152592
|
+
async waitOutThrottle(wait, error2) {
|
|
152593
|
+
try {
|
|
152594
|
+
await wait(error2, this.terminated.signal);
|
|
152595
|
+
} catch {
|
|
152596
|
+
this.assertUsable();
|
|
152597
|
+
this.fallbackToHttpBeforeSend("stream request throttled");
|
|
152598
|
+
throw new StreamWsRequestNotSentError(error2);
|
|
152599
|
+
} finally {
|
|
152600
|
+
this.throttledSocket = void 0;
|
|
152601
|
+
}
|
|
152602
|
+
await this.transportDecision;
|
|
152603
|
+
this.assertUsable();
|
|
152604
|
+
}
|
|
152605
|
+
isIdleThrottledSocket(socket) {
|
|
152606
|
+
return !this.pending && socket === this.throttledSocket && socket === this.socket;
|
|
152607
|
+
}
|
|
152608
|
+
/**
|
|
152609
|
+
* The connection ended after a retryable rejection with nothing outstanding:
|
|
152610
|
+
* the rejected request did not apply, so it and everything after it can go
|
|
152611
|
+
* over HTTP rather than reconnecting.
|
|
152612
|
+
*/
|
|
152613
|
+
leaveThrottledSocketForHttp() {
|
|
152614
|
+
this.drainReason = void 0;
|
|
151580
152615
|
this.mode = "http";
|
|
151581
|
-
(_a3 = this.socket) == null ? void 0 : _a3.close(1e3, "HTTP fallback before send");
|
|
151582
152616
|
this.socket = void 0;
|
|
152617
|
+
this.finishDrainWait();
|
|
151583
152618
|
}
|
|
151584
152619
|
failUnknown(error2) {
|
|
151585
152620
|
var _a3;
|
|
@@ -151597,6 +152632,7 @@ class VercelStreamWriteSession {
|
|
|
151597
152632
|
if (this.mode !== "poisoned") {
|
|
151598
152633
|
this.mode = "poisoned";
|
|
151599
152634
|
this.poisonError = error2;
|
|
152635
|
+
this.terminated.abort();
|
|
151600
152636
|
}
|
|
151601
152637
|
return this.poisonError;
|
|
151602
152638
|
}
|
|
@@ -155550,15 +156586,6 @@ function readAuthorization(headers2) {
|
|
|
155550
156586
|
}
|
|
155551
156587
|
return null;
|
|
155552
156588
|
}
|
|
155553
|
-
async function decodeOneFrame(raw2) {
|
|
155554
|
-
const source = (async function* () {
|
|
155555
|
-
yield raw2;
|
|
155556
|
-
})();
|
|
155557
|
-
for await (const frame2 of decodeFrames(source)) {
|
|
155558
|
-
return frame2;
|
|
155559
|
-
}
|
|
155560
|
-
throw new Error("ws-transport: received an empty/unframed message");
|
|
155561
|
-
}
|
|
155562
156589
|
function errorFrameMessage(body2) {
|
|
155563
156590
|
if (body2.byteLength === 0)
|
|
155564
156591
|
return "(no message)";
|
|
@@ -155601,18 +156628,20 @@ class WsEventsTransport {
|
|
|
155601
156628
|
}
|
|
155602
156629
|
/** Send one request frame and wait for its matching reply. `buildFrame`
|
|
155603
156630
|
* receives the reqId to embed in the meta before framing. */
|
|
155604
|
-
async request(buildFrame) {
|
|
156631
|
+
async request(buildFrame, options = {}) {
|
|
156632
|
+
var _a3;
|
|
155605
156633
|
if (this.closed) {
|
|
155606
156634
|
throw new WsTransportError(`workflow-server events WS channel for ${this.wsUrl} is closed`);
|
|
155607
156635
|
}
|
|
155608
156636
|
const conn = await this.ensureConnected();
|
|
155609
156637
|
const reqId = conn.nextReqId++;
|
|
155610
|
-
const
|
|
156638
|
+
const messages = splitEncodedFrame(buildFrame(reqId), wsMaxMessageBytes());
|
|
156639
|
+
(_a3 = options.onMessages) == null ? void 0 : _a3.call(options, messages.length);
|
|
155611
156640
|
const timeoutMs = getRequestTimeoutMs();
|
|
155612
156641
|
let deadline;
|
|
155613
156642
|
try {
|
|
155614
|
-
|
|
155615
|
-
var
|
|
156643
|
+
const reply = await new Promise((resolve2, reject) => {
|
|
156644
|
+
var _a4;
|
|
155616
156645
|
conn.pending.set(reqId, { resolve: resolve2, reject });
|
|
155617
156646
|
deadline = setTimeout(() => {
|
|
155618
156647
|
if (!conn.pending.delete(reqId))
|
|
@@ -155620,15 +156649,18 @@ class WsEventsTransport {
|
|
|
155620
156649
|
reject(new WsTransportError(`workflow-server events WS request ${reqId} to ${this.wsUrl} timed out after ${timeoutMs}ms with no reply`));
|
|
155621
156650
|
this.failConnection(conn, `workflow-server events WS connection to ${this.wsUrl} abandoned after request ${reqId} timed out`);
|
|
155622
156651
|
}, timeoutMs);
|
|
155623
|
-
(
|
|
155624
|
-
|
|
156652
|
+
(_a4 = deadline.unref) == null ? void 0 : _a4.call(deadline);
|
|
156653
|
+
const onSent = (err) => {
|
|
155625
156654
|
if (!err)
|
|
155626
156655
|
return;
|
|
155627
156656
|
if (conn.pending.delete(reqId)) {
|
|
155628
156657
|
reject(new WsTransportError(`workflow-server events WS send failed: ${describeError(err)}`, { cause: err }));
|
|
155629
156658
|
}
|
|
155630
|
-
}
|
|
156659
|
+
};
|
|
156660
|
+
for (const message2 of messages)
|
|
156661
|
+
conn.ws.send(message2, onSent);
|
|
155631
156662
|
});
|
|
156663
|
+
return { ...reply, requestParts: messages.length };
|
|
155632
156664
|
} finally {
|
|
155633
156665
|
if (deadline !== void 0)
|
|
155634
156666
|
clearTimeout(deadline);
|
|
@@ -155654,8 +156686,7 @@ class WsEventsTransport {
|
|
|
155654
156686
|
* That de-opt covers the handshake only. A channel that connects and then
|
|
155655
156687
|
* fails every write stays registered and keeps taking the WS path, so the
|
|
155656
156688
|
* fallback is per-invocation rather than a circuit breaker. Tolerable while
|
|
155657
|
-
* the transport is opt-in; defaulting it on
|
|
155658
|
-
* de-opt too.
|
|
156689
|
+
* the transport is opt-in; defaulting it on needs a write-failure de-opt too.
|
|
155659
156690
|
*/
|
|
155660
156691
|
open() {
|
|
155661
156692
|
if (this.closed)
|
|
@@ -155743,6 +156774,7 @@ class WsEventsTransport {
|
|
|
155743
156774
|
carrier.forEach((value, key) => {
|
|
155744
156775
|
headers2[key] = value;
|
|
155745
156776
|
});
|
|
156777
|
+
headers2[WS_FLAGS_HEADER] = WS_CLIENT_FLAGS.join(", ");
|
|
155746
156778
|
return headers2;
|
|
155747
156779
|
}
|
|
155748
156780
|
consumeDrainReason() {
|
|
@@ -155797,7 +156829,18 @@ class WsEventsTransport {
|
|
|
155797
156829
|
const headers2 = await this.resolveUpgradeHeaders();
|
|
155798
156830
|
const ws2 = new WebSocket(this.wsUrl, { headers: headers2 });
|
|
155799
156831
|
ws2.binaryType = "nodebuffer";
|
|
155800
|
-
|
|
156832
|
+
const pending = /* @__PURE__ */ new Map();
|
|
156833
|
+
conn = {
|
|
156834
|
+
ws: ws2,
|
|
156835
|
+
nextReqId: 1,
|
|
156836
|
+
pending,
|
|
156837
|
+
// A split reply for a request that already settled (its deadline
|
|
156838
|
+
// or a send error) is read through, not buffered.
|
|
156839
|
+
parts: new WsPartAssembler({
|
|
156840
|
+
wanted: (reqId) => pending.has(reqId),
|
|
156841
|
+
onDiscarded: (reqId) => console.error(`world-vercel: ws events transport received a split reply for unknown reqId ${reqId} from ${this.wsUrl} (already settled); dropping it.`)
|
|
156842
|
+
})
|
|
156843
|
+
};
|
|
155801
156844
|
} catch (err) {
|
|
155802
156845
|
console.error(`world-vercel: ws events transport could not open a connection to ${this.wsUrl}: ${describeError(err)}`);
|
|
155803
156846
|
reject(err instanceof WsTransportError ? err : new WsTransportError(`workflow-server events WS connection to ${this.wsUrl} could not be opened: ${describeError(err)}`, { cause: err }));
|
|
@@ -155817,7 +156860,7 @@ class WsEventsTransport {
|
|
|
155817
156860
|
resolve2(conn);
|
|
155818
156861
|
});
|
|
155819
156862
|
ws.on("message", (raw2) => {
|
|
155820
|
-
|
|
156863
|
+
this.handleMessage(conn, new Uint8Array(raw2));
|
|
155821
156864
|
});
|
|
155822
156865
|
ws.on("error", (err) => {
|
|
155823
156866
|
console.error(`world-vercel: ws events transport socket error (${this.wsUrl}): ${describeError(err)}`);
|
|
@@ -155871,16 +156914,22 @@ class WsEventsTransport {
|
|
|
155871
156914
|
(_a3 = timer2.unref) == null ? void 0 : _a3.call(timer2);
|
|
155872
156915
|
this.reconnectTimer = timer2;
|
|
155873
156916
|
}
|
|
155874
|
-
|
|
155875
|
-
|
|
156917
|
+
/** Synchronous so parts of a split reply are always assembled in arrival
|
|
156918
|
+
* order. */
|
|
156919
|
+
handleMessage(conn, raw2) {
|
|
156920
|
+
let message2;
|
|
155876
156921
|
try {
|
|
155877
|
-
|
|
156922
|
+
message2 = decodeFrame(raw2);
|
|
155878
156923
|
} catch (err) {
|
|
155879
156924
|
const detail = `could not decode a ${raw2.byteLength}-byte reply frame from ${this.wsUrl}: ${describeError(err)}`;
|
|
155880
156925
|
console.error(`world-vercel: ws events transport ${detail}`);
|
|
155881
156926
|
this.failConnection(conn, `workflow-server events WS transport ${detail}`);
|
|
155882
156927
|
return;
|
|
155883
156928
|
}
|
|
156929
|
+
const assembled = this.assemble(conn, message2);
|
|
156930
|
+
if (assembled === void 0)
|
|
156931
|
+
return;
|
|
156932
|
+
const { frame: decoded, parts: replyParts } = assembled;
|
|
155884
156933
|
if (decoded.meta.type === "drain") {
|
|
155885
156934
|
const reason = decoded.meta.reason === "auth_expiry" ? "auth_expiry" : "max_duration";
|
|
155886
156935
|
this.lastDrainReason = reason;
|
|
@@ -155906,7 +156955,30 @@ class WsEventsTransport {
|
|
|
155906
156955
|
return;
|
|
155907
156956
|
}
|
|
155908
156957
|
conn.pending.delete(reqId);
|
|
155909
|
-
pending.resolve({ meta: decoded.meta, body: decoded.body });
|
|
156958
|
+
pending.resolve({ meta: decoded.meta, body: decoded.body, replyParts });
|
|
156959
|
+
}
|
|
156960
|
+
/**
|
|
156961
|
+
* Feed one decoded message to the connection's part assembler. Returns the
|
|
156962
|
+
* complete frame with the number of messages it arrived as, or `undefined`
|
|
156963
|
+
* while a split frame is still arriving. A part that breaks the protocol
|
|
156964
|
+
* leaves the rest of the stream unmatchable, the same as an undecodable
|
|
156965
|
+
* frame, so it fails the connection and also returns `undefined`.
|
|
156966
|
+
*/
|
|
156967
|
+
assemble(conn, message2) {
|
|
156968
|
+
let frame2;
|
|
156969
|
+
try {
|
|
156970
|
+
frame2 = conn.parts.accept(message2);
|
|
156971
|
+
} catch (err) {
|
|
156972
|
+
const detail = err instanceof WsPartProtocolError ? `received a split reply from ${this.wsUrl} that breaks the part protocol: ${err.message}` : `could not assemble a split reply from ${this.wsUrl}: ${describeError(err)}`;
|
|
156973
|
+
console.error(`world-vercel: ws events transport ${detail}`);
|
|
156974
|
+
this.failConnection(conn, `workflow-server events WS transport ${detail}`);
|
|
156975
|
+
return void 0;
|
|
156976
|
+
}
|
|
156977
|
+
if (frame2 === void 0)
|
|
156978
|
+
return void 0;
|
|
156979
|
+
const { type, partCount } = message2.meta;
|
|
156980
|
+
const parts = type === "part" && typeof partCount === "number" ? partCount : 1;
|
|
156981
|
+
return { frame: frame2, parts };
|
|
155910
156982
|
}
|
|
155911
156983
|
failAllPending(conn, err) {
|
|
155912
156984
|
for (const pending of conn.pending.values()) {
|
|
@@ -155965,9 +157037,10 @@ function toEventsWsUrl(baseUrl, runId) {
|
|
|
155965
157037
|
url.pathname = `${url.pathname.replace(/\/$/, "")}/websockets/v1/runs/${encodeURIComponent(runId)}`;
|
|
155966
157038
|
return url.toString();
|
|
155967
157039
|
}
|
|
155968
|
-
function openWsChannel(runId, config2) {
|
|
155969
|
-
if (!
|
|
157040
|
+
function openWsChannel(runId, config2, options = {}) {
|
|
157041
|
+
if (!isWsEventsTransportEnabledForWorkflow(options.workflowName)) {
|
|
155970
157042
|
return void 0;
|
|
157043
|
+
}
|
|
155971
157044
|
const resolved = resolveChannelUrl(runId, config2);
|
|
155972
157045
|
if (!resolved)
|
|
155973
157046
|
return void 0;
|
|
@@ -155979,7 +157052,7 @@ function openWsChannel(runId, config2) {
|
|
|
155979
157052
|
if (forceRefresh)
|
|
155980
157053
|
await refreshOidcTokenBestEffort();
|
|
155981
157054
|
const { headers: headers2 } = await getHttpConfig(config2);
|
|
155982
|
-
return headersToRecord(headers2);
|
|
157055
|
+
return headersToRecord$1(headers2);
|
|
155983
157056
|
});
|
|
155984
157057
|
transport.open();
|
|
155985
157058
|
let released = false;
|
|
@@ -156958,15 +158031,17 @@ async function computeResumePayloadDigest(bytes) {
|
|
|
156958
158031
|
return hex2;
|
|
156959
158032
|
}
|
|
156960
158033
|
function resumeContextFromRun(run2) {
|
|
156961
|
-
var _a3, _b2, _c2;
|
|
158034
|
+
var _a3, _b2, _c2, _d2;
|
|
156962
158035
|
const coreVersion = (_a3 = run2.executionContext) == null ? void 0 : _a3.workflowCoreVersion;
|
|
156963
158036
|
const traceCarrier = (_b2 = run2.executionContext) == null ? void 0 : _b2.traceCarrier;
|
|
156964
158037
|
const hookResumeInputVersion = (_c2 = run2.executionContext) == null ? void 0 : _c2.hookResumeInputVersion;
|
|
158038
|
+
const nodeVersion = (_d2 = run2.executionContext) == null ? void 0 : _d2.nodeVersion;
|
|
156965
158039
|
return {
|
|
156966
158040
|
deploymentId: run2.deploymentId,
|
|
156967
158041
|
workflowName: run2.workflowName,
|
|
156968
158042
|
runSpecVersion: run2.specVersion,
|
|
156969
158043
|
workflowCoreVersion: typeof coreVersion === "string" ? coreVersion : void 0,
|
|
158044
|
+
nodeVersion: typeof nodeVersion === "string" ? nodeVersion : void 0,
|
|
156970
158045
|
traceCarrier: traceCarrier && typeof traceCarrier === "object" ? traceCarrier : void 0,
|
|
156971
158046
|
encryptionPublicKey: run2.encryptionPublicKey,
|
|
156972
158047
|
hookResumeInputVersion: typeof hookResumeInputVersion === "number" ? hookResumeInputVersion : void 0
|
|
@@ -157158,7 +158233,7 @@ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKe
|
|
|
157158
158233
|
if (info.run && isTerminalWorkflowRunStatus(info.run.status)) {
|
|
157159
158234
|
throw new HookNotFoundError(hook.token);
|
|
157160
158235
|
}
|
|
157161
|
-
const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion);
|
|
158236
|
+
const capabilities = getRunCapabilities(resumeContext.workflowCoreVersion, resumeContext.nodeVersion);
|
|
157162
158237
|
let payloadKey;
|
|
157163
158238
|
const runPublicKey = encryptionKeyOverride ? (
|
|
157164
158239
|
// The caller already holds a key (resumeWebhook resolved one to
|
|
@@ -157175,7 +158250,7 @@ async function resumeHookAttempt(world, span, tokenOrHook, payload, encryptionKe
|
|
|
157175
158250
|
}
|
|
157176
158251
|
payloadKey = encryptionKey;
|
|
157177
158252
|
}
|
|
157178
|
-
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION
|
|
158253
|
+
const compression = (resumeContext.runSpecVersion ?? 0) >= SPEC_VERSION_SUPPORTS_COMPRESSION ? getCompressionMode(capabilities) : false;
|
|
157179
158254
|
const ops = [];
|
|
157180
158255
|
const readbackOps = [];
|
|
157181
158256
|
const v1Compat = isLegacySpecVersion(hook.specVersion);
|
|
@@ -164402,8 +165477,8 @@ function HooksTable({
|
|
|
164402
165477
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
164403
165478
|
Button,
|
|
164404
165479
|
{
|
|
164405
|
-
variant: "
|
|
164406
|
-
size: "
|
|
165480
|
+
variant: "secondary",
|
|
165481
|
+
size: "small",
|
|
164407
165482
|
onClick: onRefresh,
|
|
164408
165483
|
disabled: loading,
|
|
164409
165484
|
children: [
|
|
@@ -164456,9 +165531,10 @@ function HooksTable({
|
|
|
164456
165531
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
164457
165532
|
Button,
|
|
164458
165533
|
{
|
|
164459
|
-
variant: "
|
|
164460
|
-
size: "
|
|
164461
|
-
|
|
165534
|
+
variant: "tertiary",
|
|
165535
|
+
size: "small",
|
|
165536
|
+
shape: "square",
|
|
165537
|
+
"aria-label": "Hook actions",
|
|
164462
165538
|
onClick: (e) => e.stopPropagation(),
|
|
164463
165539
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Ellipsis, { className: "h-4 w-4" })
|
|
164464
165540
|
}
|
|
@@ -164484,8 +165560,8 @@ function HooksTable({
|
|
|
164484
165560
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
164485
165561
|
Button,
|
|
164486
165562
|
{
|
|
164487
|
-
variant: "
|
|
164488
|
-
size: "
|
|
165563
|
+
variant: "secondary",
|
|
165564
|
+
size: "small",
|
|
164489
165565
|
onClick: previousPage,
|
|
164490
165566
|
disabled: !hasPreviousPage,
|
|
164491
165567
|
children: [
|
|
@@ -164497,8 +165573,8 @@ function HooksTable({
|
|
|
164497
165573
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
164498
165574
|
Button,
|
|
164499
165575
|
{
|
|
164500
|
-
variant: "
|
|
164501
|
-
size: "
|
|
165576
|
+
variant: "secondary",
|
|
165577
|
+
size: "small",
|
|
164502
165578
|
onClick: nextPage,
|
|
164503
165579
|
disabled: !hasNextPage,
|
|
164504
165580
|
children: [
|
|
@@ -166246,8 +167322,8 @@ function SelectionBar({
|
|
|
166246
167322
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
166247
167323
|
Button,
|
|
166248
167324
|
{
|
|
166249
|
-
variant: "
|
|
166250
|
-
size: "
|
|
167325
|
+
variant: "tertiary",
|
|
167326
|
+
size: "small",
|
|
166251
167327
|
className: "h-7 px-2 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",
|
|
166252
167328
|
onClick: onClearSelection,
|
|
166253
167329
|
children: [
|
|
@@ -166345,9 +167421,11 @@ function ErrorCodeBadge({
|
|
|
166345
167421
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
166346
167422
|
Button,
|
|
166347
167423
|
{
|
|
166348
|
-
variant: "
|
|
166349
|
-
size: "
|
|
167424
|
+
variant: "tertiary",
|
|
167425
|
+
size: "tiny",
|
|
167426
|
+
shape: "square",
|
|
166350
167427
|
className: "h-5 w-5 shrink-0",
|
|
167428
|
+
"aria-label": "Copy error code",
|
|
166351
167429
|
onClick: handleCopy,
|
|
166352
167430
|
children: copied ? /* @__PURE__ */ jsxRuntimeExports.jsx(Check, { className: "h-2.5 w-2.5 text-muted-foreground" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Copy, { className: "h-2.5 w-2.5 text-muted-foreground" })
|
|
166353
167431
|
}
|
|
@@ -166614,8 +167692,8 @@ function RunActionsButtons({
|
|
|
166614
167692
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
166615
167693
|
Button,
|
|
166616
167694
|
{
|
|
166617
|
-
variant: "
|
|
166618
|
-
size: "
|
|
167695
|
+
variant: "secondary",
|
|
167696
|
+
size: "small",
|
|
166619
167697
|
onClick: onRerunClick,
|
|
166620
167698
|
disabled: !canRerun,
|
|
166621
167699
|
children: [
|
|
@@ -166630,8 +167708,8 @@ function RunActionsButtons({
|
|
|
166630
167708
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
166631
167709
|
Button,
|
|
166632
167710
|
{
|
|
166633
|
-
variant: "
|
|
166634
|
-
size: "
|
|
167711
|
+
variant: "secondary",
|
|
167712
|
+
size: "small",
|
|
166635
167713
|
onClick: onCancelClick,
|
|
166636
167714
|
disabled: !canCancel,
|
|
166637
167715
|
children: [
|
|
@@ -166644,7 +167722,16 @@ function RunActionsButtons({
|
|
|
166644
167722
|
] }),
|
|
166645
167723
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenu, { children: [
|
|
166646
167724
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
166647
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
167725
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
167726
|
+
Button,
|
|
167727
|
+
{
|
|
167728
|
+
variant: "secondary",
|
|
167729
|
+
size: "small",
|
|
167730
|
+
shape: "square",
|
|
167731
|
+
"aria-label": "More actions",
|
|
167732
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Ellipsis, { className: "h-4 w-4" })
|
|
167733
|
+
}
|
|
167734
|
+
) }) }),
|
|
166648
167735
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: "More actions" })
|
|
166649
167736
|
] }),
|
|
166650
167737
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuContent, { align: "end", children: [
|
|
@@ -166933,9 +168020,10 @@ function LazyDropdownMenu({
|
|
|
166933
168020
|
/* @__PURE__ */ jsxRuntimeExports.jsx(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
166934
168021
|
Button,
|
|
166935
168022
|
{
|
|
166936
|
-
variant: "
|
|
166937
|
-
size: "
|
|
166938
|
-
|
|
168023
|
+
variant: "tertiary",
|
|
168024
|
+
size: "small",
|
|
168025
|
+
shape: "square",
|
|
168026
|
+
"aria-label": "Run actions",
|
|
166939
168027
|
onClick: (e) => e.stopPropagation(),
|
|
166940
168028
|
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Ellipsis, { className: "h-4 w-4" })
|
|
166941
168029
|
}
|
|
@@ -167133,8 +168221,8 @@ function FilterControls({
|
|
|
167133
168221
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
167134
168222
|
Button,
|
|
167135
168223
|
{
|
|
167136
|
-
variant: "
|
|
167137
|
-
size: "
|
|
168224
|
+
variant: "secondary",
|
|
168225
|
+
size: "small",
|
|
167138
168226
|
onClick: onSortToggle,
|
|
167139
168227
|
disabled: loading,
|
|
167140
168228
|
children: [
|
|
@@ -167149,8 +168237,8 @@ function FilterControls({
|
|
|
167149
168237
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
167150
168238
|
Button,
|
|
167151
168239
|
{
|
|
167152
|
-
variant: "
|
|
167153
|
-
size: "
|
|
168240
|
+
variant: "secondary",
|
|
168241
|
+
size: "small",
|
|
167154
168242
|
onClick: onRefresh,
|
|
167155
168243
|
disabled: loading,
|
|
167156
168244
|
children: [
|
|
@@ -167519,8 +168607,8 @@ function RunsTable({ onRunClick }) {
|
|
|
167519
168607
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
167520
168608
|
Button,
|
|
167521
168609
|
{
|
|
167522
|
-
variant: "
|
|
167523
|
-
size: "
|
|
168610
|
+
variant: "tertiary",
|
|
168611
|
+
size: "small",
|
|
167524
168612
|
className: "h-7 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",
|
|
167525
168613
|
onClick: handleBulkReenqueue,
|
|
167526
168614
|
disabled: isBulkReenqueuing || selectedRuns.length === 0,
|
|
@@ -167536,8 +168624,8 @@ function RunsTable({ onRunClick }) {
|
|
|
167536
168624
|
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "inline-flex", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
167537
168625
|
Button,
|
|
167538
168626
|
{
|
|
167539
|
-
variant: "
|
|
167540
|
-
size: "
|
|
168627
|
+
variant: "tertiary",
|
|
168628
|
+
size: "small",
|
|
167541
168629
|
className: "h-7 text-primary-foreground hover:bg-primary-foreground/10 hover:text-primary-foreground",
|
|
167542
168630
|
onClick: handleBulkCancel,
|
|
167543
168631
|
disabled: isBulkCancelling || exceedsBulkCancelLimit,
|
|
@@ -171755,9 +172843,9 @@ function updateParentLookup(node2, parentLookup) {
|
|
|
171755
172843
|
if (!node2.parentId) {
|
|
171756
172844
|
return;
|
|
171757
172845
|
}
|
|
171758
|
-
const
|
|
171759
|
-
if (
|
|
171760
|
-
|
|
172846
|
+
const childNodes2 = parentLookup.get(node2.parentId);
|
|
172847
|
+
if (childNodes2) {
|
|
172848
|
+
childNodes2.set(node2.id, node2);
|
|
171761
172849
|
} else {
|
|
171762
172850
|
parentLookup.set(node2.parentId, /* @__PURE__ */ new Map([[node2.id, node2]]));
|
|
171763
172851
|
}
|
|
@@ -173185,7 +174273,7 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
173185
174273
|
};
|
|
173186
174274
|
let node2 = void 0;
|
|
173187
174275
|
let containerBounds = null;
|
|
173188
|
-
let
|
|
174276
|
+
let childNodes2 = [];
|
|
173189
174277
|
let parentNode = void 0;
|
|
173190
174278
|
let parentExtent = void 0;
|
|
173191
174279
|
let childExtent = void 0;
|
|
@@ -173220,11 +174308,11 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
173220
174308
|
parentNode = nodeLookup.get(node2.parentId);
|
|
173221
174309
|
parentExtent = parentNode && node2.extent === "parent" ? nodeToParentExtent(parentNode) : void 0;
|
|
173222
174310
|
}
|
|
173223
|
-
|
|
174311
|
+
childNodes2 = [];
|
|
173224
174312
|
childExtent = void 0;
|
|
173225
174313
|
for (const [childId, child] of nodeLookup) {
|
|
173226
174314
|
if (child.parentId === nodeId) {
|
|
173227
|
-
|
|
174315
|
+
childNodes2.push({
|
|
173228
174316
|
id: childId,
|
|
173229
174317
|
position: { ...child.position },
|
|
173230
174318
|
extent: child.extent
|
|
@@ -173271,10 +174359,10 @@ function XYResizer({ domNode, nodeId, getStoreItems, onChange, onEnd }) {
|
|
|
173271
174359
|
change.y = isYPosChange ? y2 : prevValues.y;
|
|
173272
174360
|
prevValues.x = change.x;
|
|
173273
174361
|
prevValues.y = change.y;
|
|
173274
|
-
if (
|
|
174362
|
+
if (childNodes2.length > 0) {
|
|
173275
174363
|
const xChange = x2 - prevX;
|
|
173276
174364
|
const yChange = y2 - prevY;
|
|
173277
|
-
for (const childNode of
|
|
174365
|
+
for (const childNode of childNodes2) {
|
|
173278
174366
|
childNode.position = {
|
|
173279
174367
|
x: childNode.position.x - xChange + nodeOrigin[0] * (width - prevWidth),
|
|
173280
174368
|
y: childNode.position.y - yChange + nodeOrigin[1] * (height - prevHeight)
|
|
@@ -179353,7 +180441,7 @@ function AlertDialogCancel({
|
|
|
179353
180441
|
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
179354
180442
|
Cancel,
|
|
179355
180443
|
{
|
|
179356
|
-
className: cn(buttonVariants({ variant: "
|
|
180444
|
+
className: cn(buttonVariants({ variant: "secondary" }), className),
|
|
179357
180445
|
...props
|
|
179358
180446
|
}
|
|
179359
180447
|
);
|
|
@@ -180571,7 +181659,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
180571
181659
|
__proto__: null,
|
|
180572
181660
|
loader
|
|
180573
181661
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
180574
|
-
const serverManifest = { "entry": { "module": "/assets/entry.client-DmlDFlyx.js", "imports": ["/assets/index-thGVuYbY.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-
|
|
181662
|
+
const serverManifest = { "entry": { "module": "/assets/entry.client-DmlDFlyx.js", "imports": ["/assets/index-thGVuYbY.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": true, "module": "/assets/root-cIgKV8UA.js", "imports": ["/assets/index-thGVuYbY.js", "/assets/mermaid-3ZIDBTTL-DYqrMrvl.js", "/assets/loader-circle-BV40-ex9.js", "/assets/arrow-up-right-CCSP9ily.js"], "css": ["/assets/root-D51qsCcK.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-D3lvKrxA.js", "imports": ["/assets/index-thGVuYbY.js", "/assets/workflow-graph-viewer-DDSZhqQ2.js", "/assets/mermaid-3ZIDBTTL-DYqrMrvl.js", "/assets/loader-circle-BV40-ex9.js"], "css": ["/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-xT6TzcQH.js", "imports": ["/assets/index-thGVuYbY.js", "/assets/workflow-graph-viewer-DDSZhqQ2.js", "/assets/mermaid-3ZIDBTTL-DYqrMrvl.js", "/assets/arrow-up-right-CCSP9ily.js"], "css": ["/assets/run-detail-CWoGxu_0.css", "/assets/workflow-graph-viewer-DnlNuQQH.css", "/assets/mermaid-3ZIDBTTL-D8CjRQta.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-b2d18a63.js", "version": "b2d18a63", "sri": void 0 };
|
|
180575
181663
|
const assetsBuildDirectory = "build/client";
|
|
180576
181664
|
const basename = "/";
|
|
180577
181665
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|
|
@@ -180713,7 +181801,7 @@ export {
|
|
|
180713
181801
|
RETENTION_ATTRIBUTE as Z,
|
|
180714
181802
|
RETENTION_DEFAULT as _,
|
|
180715
181803
|
ANALYTICS_MAX_ATTRIBUTE_FILTERS as a,
|
|
180716
|
-
|
|
181804
|
+
mintedSpecVersion as a$,
|
|
180717
181805
|
ROOT_RUN_ID_ATTRIBUTE as a0,
|
|
180718
181806
|
RUN_ENTITY_KEY as a1,
|
|
180719
181807
|
RunInputSchema as a2,
|
|
@@ -180724,87 +181812,90 @@ export {
|
|
|
180724
181812
|
SPEC_VERSION_SUPPORTS_ATTRIBUTES as a7,
|
|
180725
181813
|
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as a8,
|
|
180726
181814
|
SPEC_VERSION_SUPPORTS_COMPRESSION as a9,
|
|
180727
|
-
|
|
180728
|
-
|
|
180729
|
-
|
|
180730
|
-
|
|
180731
|
-
|
|
180732
|
-
|
|
180733
|
-
|
|
180734
|
-
|
|
180735
|
-
|
|
180736
|
-
|
|
180737
|
-
|
|
180738
|
-
|
|
180739
|
-
|
|
180740
|
-
|
|
180741
|
-
|
|
180742
|
-
|
|
180743
|
-
|
|
180744
|
-
|
|
180745
|
-
|
|
180746
|
-
|
|
180747
|
-
|
|
180748
|
-
|
|
180749
|
-
|
|
180750
|
-
|
|
180751
|
-
|
|
180752
|
-
|
|
180753
|
-
|
|
181815
|
+
classifyEntityEvent as aA,
|
|
181816
|
+
decodeSnapshotEnvelope as aB,
|
|
181817
|
+
encodeSnapshotEnvelope as aC,
|
|
181818
|
+
entityEventClass as aD,
|
|
181819
|
+
entityResolveData as aE,
|
|
181820
|
+
envFlag as aF,
|
|
181821
|
+
envNumber as aG,
|
|
181822
|
+
eventIdToSlot as aH,
|
|
181823
|
+
getEventDataPayloadField as aI,
|
|
181824
|
+
getEventDataRefFields as aJ,
|
|
181825
|
+
getMaxEventsPerRun as aK,
|
|
181826
|
+
getQueueTopicPrefix as aL,
|
|
181827
|
+
isChildEntityCreationEvent as aM,
|
|
181828
|
+
isChildEntityCreationEventType as aN,
|
|
181829
|
+
isHookEventRequiringExistence as aO,
|
|
181830
|
+
isHookLifecycleEventType as aP,
|
|
181831
|
+
isLegacySpecVersion as aQ,
|
|
181832
|
+
isNodeHttpEnabled as aR,
|
|
181833
|
+
isSealedNoopEvent$1 as aS,
|
|
181834
|
+
isSlotBody as aT,
|
|
181835
|
+
isSlotEventId as aU,
|
|
181836
|
+
isStepEventType as aV,
|
|
181837
|
+
isTerminalRunEventType as aW,
|
|
181838
|
+
isTerminalStepEventType as aX,
|
|
181839
|
+
isTerminalStepStatus as aY,
|
|
181840
|
+
isTerminalWorkflowRunStatus as aZ,
|
|
181841
|
+
isWaitEventType as a_,
|
|
180754
181842
|
SPEC_VERSION_SUPPORTS_EVENT_SOURCING as aa,
|
|
180755
181843
|
SPEC_VERSION_SUPPORTS_HOOK_FORCE_CLAIM as ab,
|
|
180756
181844
|
SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as ac,
|
|
180757
181845
|
STEP_EVENT_TYPES as ad,
|
|
180758
181846
|
SerializedDataSchema as ae,
|
|
180759
|
-
|
|
180760
|
-
|
|
180761
|
-
|
|
180762
|
-
|
|
180763
|
-
|
|
180764
|
-
|
|
180765
|
-
|
|
180766
|
-
|
|
180767
|
-
|
|
180768
|
-
|
|
180769
|
-
|
|
180770
|
-
|
|
180771
|
-
|
|
180772
|
-
|
|
180773
|
-
|
|
180774
|
-
|
|
180775
|
-
|
|
180776
|
-
|
|
180777
|
-
|
|
180778
|
-
|
|
180779
|
-
|
|
181847
|
+
SnapshotMetadataSchema as af,
|
|
181848
|
+
StepSchema as ag,
|
|
181849
|
+
StepStatusSchema as ah,
|
|
181850
|
+
StructuredErrorSchema as ai,
|
|
181851
|
+
TERMINAL_EVENT_CLASSES as aj,
|
|
181852
|
+
TERMINAL_RUN_EVENT_TYPES as ak,
|
|
181853
|
+
TERMINAL_STEP_EVENT_TYPES as al,
|
|
181854
|
+
TERMINAL_STEP_STATUSES as am,
|
|
181855
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as an,
|
|
181856
|
+
TerminalRunEventTypeSchema as ao,
|
|
181857
|
+
TerminalStepStatusSchema as ap,
|
|
181858
|
+
TerminalWorkflowRunStatusSchema as aq,
|
|
181859
|
+
ValidQueueName as ar,
|
|
181860
|
+
WAIT_EVENT_TYPES as as,
|
|
181861
|
+
WaitSchema as at,
|
|
181862
|
+
WaitStatusSchema as au,
|
|
181863
|
+
WorkflowInvokePayloadSchema as av,
|
|
181864
|
+
WorkflowRunBaseSchema as aw,
|
|
181865
|
+
WorkflowRunSchema as ax,
|
|
181866
|
+
WorkflowRunStatusSchema as ay,
|
|
181867
|
+
applyAttributeChanges as az,
|
|
180780
181868
|
ANALYTICS_PAGE_LIMIT as b,
|
|
180781
|
-
|
|
180782
|
-
|
|
180783
|
-
|
|
180784
|
-
|
|
180785
|
-
|
|
180786
|
-
|
|
180787
|
-
|
|
180788
|
-
|
|
180789
|
-
|
|
180790
|
-
|
|
180791
|
-
|
|
180792
|
-
|
|
180793
|
-
|
|
180794
|
-
|
|
180795
|
-
|
|
180796
|
-
|
|
180797
|
-
|
|
180798
|
-
|
|
180799
|
-
|
|
180800
|
-
|
|
180801
|
-
|
|
180802
|
-
|
|
180803
|
-
|
|
180804
|
-
|
|
180805
|
-
|
|
180806
|
-
|
|
180807
|
-
|
|
181869
|
+
parseQueueName as b0,
|
|
181870
|
+
readRunRetention as b1,
|
|
181871
|
+
reenqueueActiveRuns as b2,
|
|
181872
|
+
requiresNewerWorld as b3,
|
|
181873
|
+
resolveQueueNamespace as b4,
|
|
181874
|
+
slotToEventId as b5,
|
|
181875
|
+
stripEventDataRefs as b6,
|
|
181876
|
+
ulidToDate as b7,
|
|
181877
|
+
validateAttributeChanges as b8,
|
|
181878
|
+
validateAttributeEventDataSize as b9,
|
|
181879
|
+
validateUlidTimestamp as ba,
|
|
181880
|
+
workflowRunIdSchema as bb,
|
|
181881
|
+
reactExports as bc,
|
|
181882
|
+
R as bd,
|
|
181883
|
+
Ks as be,
|
|
181884
|
+
jsxRuntimeExports as bf,
|
|
181885
|
+
Qe as bg,
|
|
181886
|
+
registerZstdDecoder as bh,
|
|
181887
|
+
WebSocket as bi,
|
|
181888
|
+
permessageDeflate as bj,
|
|
181889
|
+
receiver as bk,
|
|
181890
|
+
sender as bl,
|
|
181891
|
+
websocketServer as bm,
|
|
181892
|
+
stream as bn,
|
|
181893
|
+
extension as bo,
|
|
181894
|
+
subprotocol as bp,
|
|
181895
|
+
getDefaultExportFromCjs as bq,
|
|
181896
|
+
requireTokenUtil as br,
|
|
181897
|
+
requireTokenError as bs,
|
|
181898
|
+
createFetchHandler as bt,
|
|
180808
181899
|
ANALYTICS_RUN_SCOPED_PAGE_LIMIT as c,
|
|
180809
181900
|
ATTRIBUTE_EVENT_DATA_MAX_BYTES as d,
|
|
180810
181901
|
ATTRIBUTE_KEY_MAX_LENGTH as e,
|