@workflow/web 5.0.0-beta.48 → 5.0.0-beta.49
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/server/assets/{app-CeZRs20L.js → app-BktG_kyr.js} +912 -555
- package/build/server/assets/{highlighted-body-B3W2YXNL-jO_hupW2.js → highlighted-body-B3W2YXNL-B3n-nCiA.js} +1 -1
- package/build/server/assets/{index-dJuvq1GP.js → index-EldBi9Vs.js} +1 -1
- package/build/server/assets/{index-DshIaniU.js → index-SGZlzYCB.js} +75 -71
- package/build/server/assets/{mermaid-3ZIDBTTL-2Pe4e_TP.js → mermaid-3ZIDBTTL-CG8N1j_9.js} +1 -1
- package/build/server/assets/{token-DAVWictz.js → token-tFJ2cDc9.js} +1 -1
- package/build/server/assets/{token-util-BMRcW3Qd.js → token-util-C4igRPyO.js} +1 -1
- package/build/server/assets/{websocket-server-DXnHomzQ.js → websocket-server-Czz0Pxs-.js} +1 -1
- package/build/server/assets/{wrapper-Bw3PP1up.js → wrapper-BPjS6joc.js} +3 -3
- package/build/server/assets/{ws-transport-Dv7yY5un.js → ws-transport-DUA3rYTp.js} +2 -2
- package/build/server/assets/{zstd-browser-decoder-DJTnP4ZA.js → zstd-browser-decoder-BhzrSkhl.js} +1 -1
- package/build/server/index.js +3 -3
- package/package.json +7 -7
|
@@ -13,7 +13,7 @@ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot
|
|
|
13
13
|
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
14
14
|
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
15
15
|
var __superGet = (cls, obj, key) => __reflectGet(__getProtoOf(cls), key, obj);
|
|
16
|
-
var _a2, _b, _c, _d, _listeners, _onabort, _reader, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _worldPromise, _Run_instances, lazyWorldPromise_get, _encryptionKeyPromise, _resilientStart, getEncryptionKey_fn, getEncryptionKeyLazily_fn, resolveTerminalReturnValue_fn, pollReturnValue_fn;
|
|
16
|
+
var _a2, _b, _c, _d, _listeners, _onabort, _reader, _root, _hasMagic, _uflag, _parts, _parent, _parentIndex, _negs, _filledNegs, _options, _toString, _emptyExt, _AST_instances, fillNegs_fn, _AST_static, parseAST_fn, canAdoptWithSpace_fn, canAdopt_fn, canAdoptType_fn, adoptWithSpace_fn, adopt_fn, canUsurpType_fn, canUsurp_fn, usurp_fn, flatten_fn, partsToRegExp_fn, parseGlob_fn, _Minimatch_instances, matchGlobstar_fn, matchGlobStarBodySections_fn, matchOne_fn, _worldPromise, _Run_instances, lazyWorldPromise_get, _encryptionKeyPromise, _resilientStart, getEncryptionKey_fn, getEncryptionKeyLazily_fn, getMetadata_fn, resolveTerminalReturnValue_fn, pollReturnValue_fn;
|
|
17
17
|
import { createRequire as __wkfCreateRequire } from "node:module";
|
|
18
18
|
if (typeof require === "undefined") {
|
|
19
19
|
globalThis.require = __wkfCreateRequire(import.meta.url);
|
|
@@ -56873,6 +56873,25 @@ const z$2 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty(
|
|
|
56873
56873
|
const RESERVED_ATTRIBUTE_KEY_PREFIX = "$";
|
|
56874
56874
|
const ROOT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}rootRunId`;
|
|
56875
56875
|
const PARENT_RUN_ID_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}parentRunId`;
|
|
56876
|
+
const RETENTION_ATTRIBUTE = `${RESERVED_ATTRIBUTE_KEY_PREFIX}retention`;
|
|
56877
|
+
const RETENTION_ZERO = "0";
|
|
56878
|
+
const RETENTION_DEFAULT = "default";
|
|
56879
|
+
const RETENTION_INTEGER_PATTERN = /^(?:0|[1-9]\d*)$/;
|
|
56880
|
+
function readRunRetention(attributes) {
|
|
56881
|
+
const raw2 = attributes == null ? void 0 : attributes[RETENTION_ATTRIBUTE];
|
|
56882
|
+
if (raw2 === void 0) {
|
|
56883
|
+
return { mode: "default", wellFormed: false, unsupported: false };
|
|
56884
|
+
}
|
|
56885
|
+
if (RETENTION_INTEGER_PATTERN.test(raw2)) {
|
|
56886
|
+
return raw2 === RETENTION_ZERO ? { mode: "none", raw: raw2, wellFormed: true, unsupported: false } : { mode: "default", raw: raw2, wellFormed: true, unsupported: true };
|
|
56887
|
+
}
|
|
56888
|
+
return {
|
|
56889
|
+
mode: "default",
|
|
56890
|
+
raw: raw2,
|
|
56891
|
+
wellFormed: false,
|
|
56892
|
+
unsupported: raw2 !== RETENTION_DEFAULT
|
|
56893
|
+
};
|
|
56894
|
+
}
|
|
56876
56895
|
const ATTRIBUTE_KEY_MAX_LENGTH = 256;
|
|
56877
56896
|
const ATTRIBUTE_VALUE_MAX_BYTES = 256;
|
|
56878
56897
|
const ATTRIBUTE_MAX_PER_RUN = 64;
|
|
@@ -59668,8 +59687,14 @@ class EntityConflictError extends WorkflowWorldError {
|
|
|
59668
59687
|
}
|
|
59669
59688
|
}
|
|
59670
59689
|
class RunExpiredError extends WorkflowWorldError {
|
|
59671
|
-
constructor(message2) {
|
|
59672
|
-
super(message2);
|
|
59690
|
+
constructor(message2, runId, runStatus, expiredAt) {
|
|
59691
|
+
super(message2, { status: 410, code: "run-expired" });
|
|
59692
|
+
__publicField(this, "runId");
|
|
59693
|
+
__publicField(this, "runStatus");
|
|
59694
|
+
__publicField(this, "expiredAt");
|
|
59695
|
+
this.runId = runId;
|
|
59696
|
+
this.runStatus = runStatus;
|
|
59697
|
+
this.expiredAt = expiredAt;
|
|
59673
59698
|
this.name = "RunExpiredError";
|
|
59674
59699
|
}
|
|
59675
59700
|
static is(value) {
|
|
@@ -61082,7 +61107,7 @@ function replaceEncryptedAndExpiredWithMarkers(resource) {
|
|
|
61082
61107
|
}
|
|
61083
61108
|
async function hydrateResourceIOAsync(resource, key) {
|
|
61084
61109
|
const { hydrateDataWithKey: hydrateDataWithKey2, deriveRunPayloadKeys: deriveRunPayloadKeys2 } = await Promise.resolve().then(() => serializationFormat);
|
|
61085
|
-
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-
|
|
61110
|
+
const { ensureZstdDecoderRegistered } = await import("./zstd-browser-decoder-BhzrSkhl.js");
|
|
61086
61111
|
ensureZstdDecoderRegistered();
|
|
61087
61112
|
const cryptoKey = key ? await deriveRunPayloadKeys2(key) : void 0;
|
|
61088
61113
|
const revivers = getRevivers();
|
|
@@ -92021,7 +92046,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
92021
92046
|
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 });
|
|
92022
92047
|
var Se = reactExports.createContext({ code: "" }), de = () => reactExports.useContext(Se);
|
|
92023
92048
|
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 }) });
|
|
92024
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
92049
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-B3n-nCiA.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
92025
92050
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
92026
92051
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
92027
92052
|
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 }) })] }) });
|
|
@@ -92343,7 +92368,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
92343
92368
|
}, []), 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] });
|
|
92344
92369
|
};
|
|
92345
92370
|
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 }) })] });
|
|
92346
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
92371
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-CG8N1j_9.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
92347
92372
|
function ke(e, t) {
|
|
92348
92373
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
92349
92374
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -103416,6 +103441,13 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
103416
103441
|
pendingRunReady = void 0;
|
|
103417
103442
|
}
|
|
103418
103443
|
};
|
|
103444
|
+
const writerId = `wrtr_${defaultUlid()}`;
|
|
103445
|
+
const writeSessionPromise = ensureRunReady().then(async () => {
|
|
103446
|
+
var _a3, _b2;
|
|
103447
|
+
const world = await worldPromise;
|
|
103448
|
+
return (_b2 = (_a3 = world.streams).createWriteSession) == null ? void 0 : _b2.call(_a3, runId, name2, { writerId });
|
|
103449
|
+
});
|
|
103450
|
+
let nextChunkSeq = 0;
|
|
103419
103451
|
let buffer2 = [];
|
|
103420
103452
|
let bufferBytes = 0;
|
|
103421
103453
|
let inFlightChunks = 0;
|
|
@@ -103458,14 +103490,18 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
103458
103490
|
const sendGroup = async (group, bytes, groupT0) => {
|
|
103459
103491
|
await ensureRunReady();
|
|
103460
103492
|
const world = await worldPromise;
|
|
103493
|
+
const session = await writeSessionPromise;
|
|
103461
103494
|
const dispatchAt = Date.now();
|
|
103462
|
-
if (
|
|
103495
|
+
if (session) {
|
|
103496
|
+
await session.write(nextChunkSeq, group);
|
|
103497
|
+
} else if (typeof world.streams.writeMulti === "function" && group.length > 1) {
|
|
103463
103498
|
await world.streams.writeMulti(runId, name2, group);
|
|
103464
103499
|
} else {
|
|
103465
103500
|
for (const chunk of group) {
|
|
103466
103501
|
await world.streams.write(runId, name2, chunk);
|
|
103467
103502
|
}
|
|
103468
103503
|
}
|
|
103504
|
+
nextChunkSeq += group.length;
|
|
103469
103505
|
if (groupT0 !== void 0) {
|
|
103470
103506
|
recordStreamWriteFlush(groupT0, dispatchAt, runId, name2, group.length, bytes, Date.now() - dispatchAt);
|
|
103471
103507
|
}
|
|
@@ -103580,11 +103616,17 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
103580
103616
|
await drain();
|
|
103581
103617
|
await ensureRunReady();
|
|
103582
103618
|
const world = await worldPromise;
|
|
103619
|
+
const session = await writeSessionPromise;
|
|
103583
103620
|
const closeStart = Date.now();
|
|
103584
|
-
|
|
103621
|
+
if (session) {
|
|
103622
|
+
await session.close();
|
|
103623
|
+
} else {
|
|
103624
|
+
await world.streams.close(runId, name2);
|
|
103625
|
+
}
|
|
103585
103626
|
recordStreamClose(closeStart, runId, name2);
|
|
103586
103627
|
},
|
|
103587
103628
|
async abort(reason) {
|
|
103629
|
+
var _a3;
|
|
103588
103630
|
try {
|
|
103589
103631
|
await drain();
|
|
103590
103632
|
} catch {
|
|
@@ -103597,6 +103639,8 @@ class WorkflowServerWritableStream extends WritableStream {
|
|
|
103597
103639
|
bufferBytes = 0;
|
|
103598
103640
|
sinkError ?? (sinkError = reason ?? new Error("Stream aborted"));
|
|
103599
103641
|
rejectWaiters(sinkError);
|
|
103642
|
+
const session = await writeSessionPromise.catch(() => void 0);
|
|
103643
|
+
await ((_a3 = session == null ? void 0 : session.dispose) == null ? void 0 : _a3.call(session));
|
|
103600
103644
|
}
|
|
103601
103645
|
});
|
|
103602
103646
|
Object.defineProperty(this, STREAM_DRAIN_SYMBOL, {
|
|
@@ -104071,6 +104115,42 @@ async function getForwardedWritableEncryptionKey(runId, deploymentId, encryption
|
|
|
104071
104115
|
const rawKey = deploymentId ? await world.getEncryptionKeyForRun(runId, { deploymentId }) : await world.getEncryptionKeyForRun(await world.runs.get(runId));
|
|
104072
104116
|
return rawKey ? await importKey(rawKey, ["encrypt"]) : void 0;
|
|
104073
104117
|
}
|
|
104118
|
+
function tagForwardedWritableTarget(writable, { deploymentId, encryptionPublicKey }) {
|
|
104119
|
+
if (typeof deploymentId === "string") {
|
|
104120
|
+
Object.defineProperty(writable, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL, {
|
|
104121
|
+
value: deploymentId,
|
|
104122
|
+
writable: false
|
|
104123
|
+
});
|
|
104124
|
+
}
|
|
104125
|
+
if (typeof encryptionPublicKey === "string") {
|
|
104126
|
+
Object.defineProperty(writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
104127
|
+
value: encryptionPublicKey,
|
|
104128
|
+
writable: false
|
|
104129
|
+
});
|
|
104130
|
+
}
|
|
104131
|
+
}
|
|
104132
|
+
function createForwardedWritable({ global: global2, ops, runId, name: name2, key, deploymentId, encryptionPublicKey, runReadyBarrier }) {
|
|
104133
|
+
const serialize2 = getSerializeStream(getExternalReducers(global2, ops, runId, key), key);
|
|
104134
|
+
const serverWritable = new WorkflowServerWritableStream(runId, name2, runReadyBarrier);
|
|
104135
|
+
const state = createFlushableState();
|
|
104136
|
+
ops.push(state.promise);
|
|
104137
|
+
flushablePipe(serialize2.readable, serverWritable, state).catch(() => {
|
|
104138
|
+
});
|
|
104139
|
+
pollWritableLock(serialize2.writable, state);
|
|
104140
|
+
Object.defineProperty(serialize2.writable, STREAM_NAME_SYMBOL, {
|
|
104141
|
+
value: name2,
|
|
104142
|
+
writable: false
|
|
104143
|
+
});
|
|
104144
|
+
Object.defineProperty(serialize2.writable, STREAM_SERVER_RUN_ID_SYMBOL, {
|
|
104145
|
+
value: runId,
|
|
104146
|
+
writable: false
|
|
104147
|
+
});
|
|
104148
|
+
tagForwardedWritableTarget(serialize2.writable, {
|
|
104149
|
+
deploymentId,
|
|
104150
|
+
encryptionPublicKey
|
|
104151
|
+
});
|
|
104152
|
+
return serialize2.writable;
|
|
104153
|
+
}
|
|
104074
104154
|
function getRunReadableStream(global2, ops, runId, name2, startIndex, cryptoKey) {
|
|
104075
104155
|
let reader;
|
|
104076
104156
|
let lockState;
|
|
@@ -104187,34 +104267,15 @@ function getExternalRevivers(global2 = globalThis, ops, runId, cryptoKey, option
|
|
|
104187
104267
|
WritableStream: (value) => {
|
|
104188
104268
|
const targetRunId = typeof value.runId === "string" ? value.runId : runId;
|
|
104189
104269
|
const targetKey = targetRunId === runId ? cryptoKey : getForwardedWritableEncryptionKey(targetRunId, value.deploymentId, value.encryptionPublicKey);
|
|
104190
|
-
|
|
104191
|
-
|
|
104192
|
-
|
|
104193
|
-
|
|
104194
|
-
|
|
104195
|
-
|
|
104196
|
-
|
|
104197
|
-
|
|
104198
|
-
value: value.name,
|
|
104199
|
-
writable: false
|
|
104270
|
+
return createForwardedWritable({
|
|
104271
|
+
global: global2,
|
|
104272
|
+
ops,
|
|
104273
|
+
runId: targetRunId,
|
|
104274
|
+
name: value.name,
|
|
104275
|
+
key: targetKey,
|
|
104276
|
+
deploymentId: value.deploymentId,
|
|
104277
|
+
encryptionPublicKey: value.encryptionPublicKey
|
|
104200
104278
|
});
|
|
104201
|
-
Object.defineProperty(serialize2.writable, STREAM_SERVER_RUN_ID_SYMBOL, {
|
|
104202
|
-
value: targetRunId,
|
|
104203
|
-
writable: false
|
|
104204
|
-
});
|
|
104205
|
-
if (typeof value.deploymentId === "string") {
|
|
104206
|
-
Object.defineProperty(serialize2.writable, STREAM_SERVER_DEPLOYMENT_ID_SYMBOL, {
|
|
104207
|
-
value: value.deploymentId,
|
|
104208
|
-
writable: false
|
|
104209
|
-
});
|
|
104210
|
-
}
|
|
104211
|
-
if (typeof value.encryptionPublicKey === "string") {
|
|
104212
|
-
Object.defineProperty(serialize2.writable, STREAM_SERVER_PUBLIC_KEY_SYMBOL, {
|
|
104213
|
-
value: value.encryptionPublicKey,
|
|
104214
|
-
writable: false
|
|
104215
|
-
});
|
|
104216
|
-
}
|
|
104217
|
-
return serialize2.writable;
|
|
104218
104279
|
},
|
|
104219
104280
|
AbortController: (value) => reviveAbortController(value, ops, runId),
|
|
104220
104281
|
AbortSignal: (value) => reviveAbortSignal(value, ops, runId)
|
|
@@ -104671,7 +104732,7 @@ globalSingleton("@workflow/core//envWarnings", 1, () => ({
|
|
|
104671
104732
|
maxInlineStepsValues: /* @__PURE__ */ new Set(),
|
|
104672
104733
|
maxEventsValues: /* @__PURE__ */ new Set()
|
|
104673
104734
|
}));
|
|
104674
|
-
const version$1 = "5.0.0-beta.
|
|
104735
|
+
const version$1 = "5.0.0-beta.49";
|
|
104675
104736
|
const DEFAULT_HEALTH_CHECK_TIMEOUT = 3e4;
|
|
104676
104737
|
const SAFE_WORKFLOW_NAME_PATTERN = /^[a-zA-Z0-9_\-./@]+$/;
|
|
104677
104738
|
function getWorkflowQueueName(workflowName, namespace2) {
|
|
@@ -105306,7 +105367,7 @@ async function write(filePath, data, opts) {
|
|
|
105306
105367
|
}
|
|
105307
105368
|
async function readJSON(filePath, decoder2) {
|
|
105308
105369
|
try {
|
|
105309
|
-
const content2 = await promises.readFile(filePath, "utf-8");
|
|
105370
|
+
const content2 = await withWindowsRetry(() => promises.readFile(filePath, "utf-8"));
|
|
105310
105371
|
return decoder2.parse(JSON.parse(content2, jsonReviver));
|
|
105311
105372
|
} catch (error2) {
|
|
105312
105373
|
if (error2.code === "ENOENT")
|
|
@@ -132248,7 +132309,7 @@ function envTimeoutMs(name2, fallback) {
|
|
|
132248
132309
|
const parsed = Number.parseInt(raw2, 10);
|
|
132249
132310
|
return Number.isFinite(parsed) && parsed >= 0 ? parsed : fallback;
|
|
132250
132311
|
}
|
|
132251
|
-
function getQueueAgentOptions() {
|
|
132312
|
+
function getQueueAgentOptions$1() {
|
|
132252
132313
|
return {
|
|
132253
132314
|
bodyTimeout: envTimeoutMs("WORKFLOW_LOCAL_BODY_TIMEOUT_MS", DEFAULT_BODY_TIMEOUT_MS),
|
|
132254
132315
|
connections: 1e3,
|
|
@@ -132271,7 +132332,7 @@ function isDetachedArrayBufferQueueError(error2) {
|
|
|
132271
132332
|
return false;
|
|
132272
132333
|
}
|
|
132273
132334
|
function createQueue$2(config2) {
|
|
132274
|
-
const agentOptions = getQueueAgentOptions();
|
|
132335
|
+
const agentOptions = getQueueAgentOptions$1();
|
|
132275
132336
|
const nodeHttpAgents = isNodeHttpEnabled() ? createNodeHttpAgents({
|
|
132276
132337
|
maxSockets: agentOptions.connections,
|
|
132277
132338
|
keepAliveMs: agentOptions.keepAliveTimeout
|
|
@@ -134704,6 +134765,500 @@ async function deleteAllHooksForRun(basedir, runId) {
|
|
|
134704
134765
|
await deleteHookByRunMarkerFile(basedir, marker.fileId);
|
|
134705
134766
|
}
|
|
134706
134767
|
}
|
|
134768
|
+
const chunkIds = globalSingleton("@workflow/world-local//streamerMonotonicUlid", 1, () => ({ next: monotonicFactory(() => Math.random()) }));
|
|
134769
|
+
const monotonicUlid = (seedTime) => chunkIds.next(seedTime);
|
|
134770
|
+
const RunStreamsSchema = object$1({
|
|
134771
|
+
streams: array$1(string$3())
|
|
134772
|
+
});
|
|
134773
|
+
const EOF_MARKER = 1;
|
|
134774
|
+
function isEofByte(byte) {
|
|
134775
|
+
return byte === EOF_MARKER;
|
|
134776
|
+
}
|
|
134777
|
+
function serializeChunk(chunk) {
|
|
134778
|
+
const eofByte = Buffer.from([chunk.eof ? EOF_MARKER : 0]);
|
|
134779
|
+
return Buffer.concat([eofByte, chunk.chunk]);
|
|
134780
|
+
}
|
|
134781
|
+
function isEofChunk(serialized) {
|
|
134782
|
+
return isEofByte(serialized[0]);
|
|
134783
|
+
}
|
|
134784
|
+
function deserializeChunk(serialized) {
|
|
134785
|
+
const eof = isEofChunk(serialized);
|
|
134786
|
+
const chunk = Buffer.from(serialized.subarray(1));
|
|
134787
|
+
return { eof, chunk };
|
|
134788
|
+
}
|
|
134789
|
+
async function listChunkEntries(chunksDir) {
|
|
134790
|
+
try {
|
|
134791
|
+
return await fs$1.readdir(chunksDir);
|
|
134792
|
+
} catch (error2) {
|
|
134793
|
+
if (error2.code === "ENOENT")
|
|
134794
|
+
return [];
|
|
134795
|
+
throw error2;
|
|
134796
|
+
}
|
|
134797
|
+
}
|
|
134798
|
+
function addChunkFilesByExtension(extMap, entries, sourceExtension, fileExtension = sourceExtension, include = () => true) {
|
|
134799
|
+
for (const entry2 of entries) {
|
|
134800
|
+
if (!entry2.endsWith(sourceExtension))
|
|
134801
|
+
continue;
|
|
134802
|
+
const file2 = entry2.slice(0, -sourceExtension.length);
|
|
134803
|
+
if (include(file2))
|
|
134804
|
+
extMap.set(file2, fileExtension);
|
|
134805
|
+
}
|
|
134806
|
+
}
|
|
134807
|
+
function chunkDirForStream(chunksBaseDir, name2) {
|
|
134808
|
+
assertSafeEntityId("streamName", name2);
|
|
134809
|
+
return path$3.join(chunksBaseDir, name2);
|
|
134810
|
+
}
|
|
134811
|
+
async function listChunkFilesForStream(chunksBaseDir, name2, tag) {
|
|
134812
|
+
const dir = chunkDirForStream(chunksBaseDir, name2);
|
|
134813
|
+
const entries = await listChunkEntries(dir);
|
|
134814
|
+
const extMap = /* @__PURE__ */ new Map();
|
|
134815
|
+
addChunkFilesByExtension(extMap, entries, ".json");
|
|
134816
|
+
addChunkFilesByExtension(extMap, entries, ".bin", ".bin", tag ? (file2) => !file2.endsWith(`.${tag}`) : void 0);
|
|
134817
|
+
if (tag) {
|
|
134818
|
+
const taggedExtension = `.${tag}.bin`;
|
|
134819
|
+
addChunkFilesByExtension(extMap, entries, taggedExtension);
|
|
134820
|
+
}
|
|
134821
|
+
const files = [...extMap.keys()].sort();
|
|
134822
|
+
return { files, extMap, dir };
|
|
134823
|
+
}
|
|
134824
|
+
const PURGED_STREAM_TOMBSTONE_ID = `chnk_${"0".repeat(26)}`;
|
|
134825
|
+
async function purgeRunStreamData(basedir, runId, tag) {
|
|
134826
|
+
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
134827
|
+
const tagSuffix = tag ? `.${tag}` : "";
|
|
134828
|
+
let names;
|
|
134829
|
+
try {
|
|
134830
|
+
assertSafeEntityId("runId", runId);
|
|
134831
|
+
const mapping = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
134832
|
+
names = (mapping == null ? void 0 : mapping.streams) ?? [];
|
|
134833
|
+
} catch (error2) {
|
|
134834
|
+
logStreamPurgeFailure(`streams of ${runId}`, error2);
|
|
134835
|
+
return;
|
|
134836
|
+
}
|
|
134837
|
+
for (const name2 of names) {
|
|
134838
|
+
try {
|
|
134839
|
+
const dir = chunkDirForStream(chunksBaseDir, name2);
|
|
134840
|
+
await write(path$3.join(dir, `${PURGED_STREAM_TOMBSTONE_ID}${tagSuffix}.bin`), serializeChunk({ chunk: Buffer.from([]), eof: true }), { overwrite: true });
|
|
134841
|
+
for (const entry2 of await listChunkEntries(dir)) {
|
|
134842
|
+
if (entry2.startsWith(PURGED_STREAM_TOMBSTONE_ID))
|
|
134843
|
+
continue;
|
|
134844
|
+
if (!entry2.endsWith(".bin") && !entry2.endsWith(".json"))
|
|
134845
|
+
continue;
|
|
134846
|
+
await withWindowsRetry(() => fs$1.unlink(path$3.join(dir, entry2))).catch((error2) => {
|
|
134847
|
+
if (error2.code !== "ENOENT")
|
|
134848
|
+
logStreamPurgeFailure(entry2, error2);
|
|
134849
|
+
});
|
|
134850
|
+
}
|
|
134851
|
+
} catch (error2) {
|
|
134852
|
+
logStreamPurgeFailure(name2, error2);
|
|
134853
|
+
}
|
|
134854
|
+
}
|
|
134855
|
+
}
|
|
134856
|
+
function logStreamPurgeFailure(target2, error2) {
|
|
134857
|
+
console.warn(`[world-local] Failed to purge stream data for ${target2}:`, error2 instanceof Error ? error2.message : error2);
|
|
134858
|
+
}
|
|
134859
|
+
function createStreamer$1(basedir, tag) {
|
|
134860
|
+
const tagSuffix = tag ? `.${tag}` : "";
|
|
134861
|
+
const streamEmitter = new EventEmitter();
|
|
134862
|
+
const registeredStreams = /* @__PURE__ */ new Set();
|
|
134863
|
+
async function registerStreamForRun(runId, streamName) {
|
|
134864
|
+
assertSafeEntityId("runId", runId);
|
|
134865
|
+
assertSafeEntityId("streamName", streamName);
|
|
134866
|
+
const cacheKey = `${runId}:${streamName}`;
|
|
134867
|
+
if (registeredStreams.has(cacheKey)) {
|
|
134868
|
+
return;
|
|
134869
|
+
}
|
|
134870
|
+
const runStreamsPath = taggedPath(basedir, "streams/runs", runId, tag);
|
|
134871
|
+
const existing = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
134872
|
+
const streams = (existing == null ? void 0 : existing.streams) ?? [];
|
|
134873
|
+
if (!streams.includes(streamName)) {
|
|
134874
|
+
streams.push(streamName);
|
|
134875
|
+
await writeJSON(runStreamsPath, { streams }, { overwrite: true });
|
|
134876
|
+
}
|
|
134877
|
+
registeredStreams.add(cacheKey);
|
|
134878
|
+
}
|
|
134879
|
+
function toBuffer(chunk) {
|
|
134880
|
+
if (typeof chunk === "string") {
|
|
134881
|
+
return Buffer.from(new TextEncoder().encode(chunk));
|
|
134882
|
+
} else if (chunk instanceof Buffer) {
|
|
134883
|
+
return chunk;
|
|
134884
|
+
} else {
|
|
134885
|
+
return Buffer.from(chunk);
|
|
134886
|
+
}
|
|
134887
|
+
}
|
|
134888
|
+
return {
|
|
134889
|
+
streams: {
|
|
134890
|
+
async write(_runId, name2, chunk) {
|
|
134891
|
+
const chunkId = `chnk_${monotonicUlid()}`;
|
|
134892
|
+
const runId = await _runId;
|
|
134893
|
+
await registerStreamForRun(runId, name2);
|
|
134894
|
+
const chunkBuffer = toBuffer(chunk);
|
|
134895
|
+
const serialized = serializeChunk({
|
|
134896
|
+
chunk: chunkBuffer,
|
|
134897
|
+
eof: false
|
|
134898
|
+
});
|
|
134899
|
+
const chunkPath = path$3.join(chunkDirForStream(path$3.join(basedir, "streams", "chunks"), name2), `${chunkId}${tagSuffix}.bin`);
|
|
134900
|
+
await write(chunkPath, serialized);
|
|
134901
|
+
const chunkData = Uint8Array.from(chunkBuffer);
|
|
134902
|
+
streamEmitter.emit(`chunk:${name2}`, {
|
|
134903
|
+
streamName: name2,
|
|
134904
|
+
chunkData,
|
|
134905
|
+
chunkId
|
|
134906
|
+
});
|
|
134907
|
+
},
|
|
134908
|
+
async writeMulti(_runId, name2, chunks) {
|
|
134909
|
+
if (chunks.length === 0)
|
|
134910
|
+
return;
|
|
134911
|
+
const chunkIds2 = chunks.map(() => `chnk_${monotonicUlid()}`);
|
|
134912
|
+
const runId = await _runId;
|
|
134913
|
+
await registerStreamForRun(runId, name2);
|
|
134914
|
+
const chunkBuffers = chunks.map((chunk) => toBuffer(chunk));
|
|
134915
|
+
const writePromises = chunkBuffers.map(async (chunkBuffer, i) => {
|
|
134916
|
+
const chunkId = chunkIds2[i];
|
|
134917
|
+
const serialized = serializeChunk({
|
|
134918
|
+
chunk: chunkBuffer,
|
|
134919
|
+
eof: false
|
|
134920
|
+
});
|
|
134921
|
+
const chunkPath = path$3.join(chunkDirForStream(path$3.join(basedir, "streams", "chunks"), name2), `${chunkId}${tagSuffix}.bin`);
|
|
134922
|
+
await write(chunkPath, serialized);
|
|
134923
|
+
return {
|
|
134924
|
+
chunkId,
|
|
134925
|
+
chunkData: Uint8Array.from(chunkBuffer)
|
|
134926
|
+
};
|
|
134927
|
+
});
|
|
134928
|
+
for (const writePromise of writePromises) {
|
|
134929
|
+
const { chunkId, chunkData } = await writePromise;
|
|
134930
|
+
streamEmitter.emit(`chunk:${name2}`, {
|
|
134931
|
+
streamName: name2,
|
|
134932
|
+
chunkData,
|
|
134933
|
+
chunkId
|
|
134934
|
+
});
|
|
134935
|
+
}
|
|
134936
|
+
},
|
|
134937
|
+
async close(_runId, name2) {
|
|
134938
|
+
const chunkId = `chnk_${monotonicUlid()}`;
|
|
134939
|
+
const runId = await _runId;
|
|
134940
|
+
await registerStreamForRun(runId, name2);
|
|
134941
|
+
const chunkPath = path$3.join(chunkDirForStream(path$3.join(basedir, "streams", "chunks"), name2), `${chunkId}${tagSuffix}.bin`);
|
|
134942
|
+
await write(chunkPath, serializeChunk({ chunk: Buffer.from([]), eof: true }));
|
|
134943
|
+
streamEmitter.emit(`close:${name2}`, { streamName: name2 });
|
|
134944
|
+
},
|
|
134945
|
+
async list(runId) {
|
|
134946
|
+
assertSafeEntityId("runId", runId);
|
|
134947
|
+
const data = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
134948
|
+
return (data == null ? void 0 : data.streams) ?? [];
|
|
134949
|
+
},
|
|
134950
|
+
async getChunks(_runId, name2, options) {
|
|
134951
|
+
const limit = (options == null ? void 0 : options.limit) ?? 100;
|
|
134952
|
+
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
134953
|
+
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
134954
|
+
let startIndex = 0;
|
|
134955
|
+
if (options == null ? void 0 : options.cursor) {
|
|
134956
|
+
try {
|
|
134957
|
+
const decoded = JSON.parse(Buffer.from(options.cursor, "base64").toString("utf-8"));
|
|
134958
|
+
startIndex = decoded.i;
|
|
134959
|
+
} catch {
|
|
134960
|
+
startIndex = 0;
|
|
134961
|
+
}
|
|
134962
|
+
}
|
|
134963
|
+
let streamDone = false;
|
|
134964
|
+
const resultChunks = [];
|
|
134965
|
+
let dataIndex = 0;
|
|
134966
|
+
for (const file2 of chunkFiles) {
|
|
134967
|
+
const ext2 = fileExtMap.get(file2) ?? ".bin";
|
|
134968
|
+
const filePath = path$3.join(chunksDir, `${file2}${ext2}`);
|
|
134969
|
+
if (dataIndex < startIndex) {
|
|
134970
|
+
if (isEofByte(await readFirstByte(filePath))) {
|
|
134971
|
+
streamDone = true;
|
|
134972
|
+
break;
|
|
134973
|
+
}
|
|
134974
|
+
dataIndex++;
|
|
134975
|
+
continue;
|
|
134976
|
+
}
|
|
134977
|
+
if (resultChunks.length >= limit) {
|
|
134978
|
+
if (isEofByte(await readFirstByte(filePath))) {
|
|
134979
|
+
streamDone = true;
|
|
134980
|
+
} else {
|
|
134981
|
+
dataIndex++;
|
|
134982
|
+
}
|
|
134983
|
+
break;
|
|
134984
|
+
}
|
|
134985
|
+
const chunk = deserializeChunk(await readBuffer(filePath));
|
|
134986
|
+
if (chunk.eof) {
|
|
134987
|
+
streamDone = true;
|
|
134988
|
+
break;
|
|
134989
|
+
}
|
|
134990
|
+
resultChunks.push({
|
|
134991
|
+
index: dataIndex,
|
|
134992
|
+
data: Uint8Array.from(chunk.chunk)
|
|
134993
|
+
});
|
|
134994
|
+
dataIndex++;
|
|
134995
|
+
}
|
|
134996
|
+
const hasMore = !streamDone && dataIndex > startIndex + resultChunks.length;
|
|
134997
|
+
const nextIndex = startIndex + resultChunks.length;
|
|
134998
|
+
const nextCursor = hasMore ? Buffer.from(JSON.stringify({ i: nextIndex })).toString("base64") : null;
|
|
134999
|
+
return {
|
|
135000
|
+
data: resultChunks,
|
|
135001
|
+
cursor: nextCursor,
|
|
135002
|
+
hasMore,
|
|
135003
|
+
done: streamDone
|
|
135004
|
+
};
|
|
135005
|
+
},
|
|
135006
|
+
async getInfo(_runId, name2) {
|
|
135007
|
+
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
135008
|
+
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
135009
|
+
let streamDone = false;
|
|
135010
|
+
let dataCount = 0;
|
|
135011
|
+
for (const file2 of chunkFiles) {
|
|
135012
|
+
const ext2 = fileExtMap.get(file2) ?? ".bin";
|
|
135013
|
+
if (isEofByte(await readFirstByte(path$3.join(chunksDir, `${file2}${ext2}`)))) {
|
|
135014
|
+
streamDone = true;
|
|
135015
|
+
break;
|
|
135016
|
+
}
|
|
135017
|
+
dataCount++;
|
|
135018
|
+
}
|
|
135019
|
+
return { tailIndex: dataCount - 1, done: streamDone };
|
|
135020
|
+
},
|
|
135021
|
+
async get(_runId, name2, startIndex = 0) {
|
|
135022
|
+
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
135023
|
+
let teardown = () => {
|
|
135024
|
+
};
|
|
135025
|
+
let pollInterval = null;
|
|
135026
|
+
let streamClosed = false;
|
|
135027
|
+
return new ReadableStream({
|
|
135028
|
+
async start(controller) {
|
|
135029
|
+
const deliveredChunkIds = /* @__PURE__ */ new Set();
|
|
135030
|
+
const bufferedEventChunks = [];
|
|
135031
|
+
let isReadingFromDisk = true;
|
|
135032
|
+
let pendingClose = false;
|
|
135033
|
+
const chunkListener = (event) => {
|
|
135034
|
+
if (event.chunkData.byteLength === 0) {
|
|
135035
|
+
deliveredChunkIds.add(event.chunkId);
|
|
135036
|
+
return;
|
|
135037
|
+
}
|
|
135038
|
+
if (isReadingFromDisk) {
|
|
135039
|
+
deliveredChunkIds.add(event.chunkId);
|
|
135040
|
+
bufferedEventChunks.push({
|
|
135041
|
+
chunkId: event.chunkId,
|
|
135042
|
+
chunkData: Uint8Array.from(event.chunkData)
|
|
135043
|
+
});
|
|
135044
|
+
} else if (!deliveredChunkIds.has(event.chunkId)) {
|
|
135045
|
+
deliveredChunkIds.add(event.chunkId);
|
|
135046
|
+
controller.enqueue(Uint8Array.from(event.chunkData));
|
|
135047
|
+
}
|
|
135048
|
+
};
|
|
135049
|
+
const closeListener = () => {
|
|
135050
|
+
if (isReadingFromDisk) {
|
|
135051
|
+
pendingClose = true;
|
|
135052
|
+
return;
|
|
135053
|
+
}
|
|
135054
|
+
streamClosed = true;
|
|
135055
|
+
teardown();
|
|
135056
|
+
try {
|
|
135057
|
+
controller.close();
|
|
135058
|
+
} catch {
|
|
135059
|
+
}
|
|
135060
|
+
};
|
|
135061
|
+
teardown = () => {
|
|
135062
|
+
streamEmitter.off(`chunk:${name2}`, chunkListener);
|
|
135063
|
+
streamEmitter.off(`close:${name2}`, closeListener);
|
|
135064
|
+
if (pollInterval) {
|
|
135065
|
+
clearInterval(pollInterval);
|
|
135066
|
+
pollInterval = null;
|
|
135067
|
+
}
|
|
135068
|
+
};
|
|
135069
|
+
streamEmitter.on(`chunk:${name2}`, chunkListener);
|
|
135070
|
+
streamEmitter.on(`close:${name2}`, closeListener);
|
|
135071
|
+
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
135072
|
+
let dataChunkCount = chunkFiles.length;
|
|
135073
|
+
if (typeof startIndex === "number" && startIndex < 0 && chunkFiles.length > 0) {
|
|
135074
|
+
const lastFile = chunkFiles[chunkFiles.length - 1];
|
|
135075
|
+
const lastExt = fileExtMap.get(lastFile) ?? ".bin";
|
|
135076
|
+
if (isEofByte(await readFirstByte(path$3.join(chunksDir, `${lastFile}${lastExt}`)))) {
|
|
135077
|
+
dataChunkCount--;
|
|
135078
|
+
}
|
|
135079
|
+
}
|
|
135080
|
+
const resolvedStartIndex = typeof startIndex === "number" && startIndex < 0 ? Math.max(0, dataChunkCount + startIndex) : startIndex;
|
|
135081
|
+
let isComplete = false;
|
|
135082
|
+
for (let i = resolvedStartIndex; i < chunkFiles.length; i++) {
|
|
135083
|
+
const file2 = chunkFiles[i];
|
|
135084
|
+
const chunkId = file2;
|
|
135085
|
+
if (deliveredChunkIds.has(chunkId)) {
|
|
135086
|
+
continue;
|
|
135087
|
+
}
|
|
135088
|
+
const ext2 = fileExtMap.get(file2) ?? ".bin";
|
|
135089
|
+
const chunk = deserializeChunk(await readBuffer(path$3.join(chunksDir, `${file2}${ext2}`)));
|
|
135090
|
+
if ((chunk == null ? void 0 : chunk.eof) === true) {
|
|
135091
|
+
isComplete = true;
|
|
135092
|
+
break;
|
|
135093
|
+
}
|
|
135094
|
+
deliveredChunkIds.add(chunkId);
|
|
135095
|
+
if (chunk.chunk.byteLength) {
|
|
135096
|
+
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
135097
|
+
}
|
|
135098
|
+
}
|
|
135099
|
+
isReadingFromDisk = false;
|
|
135100
|
+
bufferedEventChunks.sort((a2, b2) => a2.chunkId.localeCompare(b2.chunkId));
|
|
135101
|
+
for (const buffered of bufferedEventChunks) {
|
|
135102
|
+
controller.enqueue(Uint8Array.from(buffered.chunkData));
|
|
135103
|
+
}
|
|
135104
|
+
if (isComplete) {
|
|
135105
|
+
streamClosed = true;
|
|
135106
|
+
teardown();
|
|
135107
|
+
try {
|
|
135108
|
+
controller.close();
|
|
135109
|
+
} catch {
|
|
135110
|
+
}
|
|
135111
|
+
return;
|
|
135112
|
+
}
|
|
135113
|
+
if (pendingClose) {
|
|
135114
|
+
streamClosed = true;
|
|
135115
|
+
teardown();
|
|
135116
|
+
try {
|
|
135117
|
+
controller.close();
|
|
135118
|
+
} catch {
|
|
135119
|
+
}
|
|
135120
|
+
return;
|
|
135121
|
+
}
|
|
135122
|
+
for (let i = 0; i < resolvedStartIndex && i < chunkFiles.length; i++) {
|
|
135123
|
+
deliveredChunkIds.add(chunkFiles[i]);
|
|
135124
|
+
}
|
|
135125
|
+
if (streamClosed) {
|
|
135126
|
+
teardown();
|
|
135127
|
+
return;
|
|
135128
|
+
}
|
|
135129
|
+
let isPolling = false;
|
|
135130
|
+
pollInterval = setInterval(async () => {
|
|
135131
|
+
if (isPolling)
|
|
135132
|
+
return;
|
|
135133
|
+
isPolling = true;
|
|
135134
|
+
try {
|
|
135135
|
+
const { files: currentFiles, extMap: currentExtMap } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
135136
|
+
for (const file2 of currentFiles) {
|
|
135137
|
+
const chunkId = file2;
|
|
135138
|
+
if (deliveredChunkIds.has(chunkId))
|
|
135139
|
+
continue;
|
|
135140
|
+
deliveredChunkIds.add(chunkId);
|
|
135141
|
+
const ext2 = currentExtMap.get(file2) ?? ".bin";
|
|
135142
|
+
const chunk = deserializeChunk(await readBuffer(path$3.join(chunksDir, `${file2}${ext2}`)));
|
|
135143
|
+
if ((chunk == null ? void 0 : chunk.eof) === true) {
|
|
135144
|
+
streamClosed = true;
|
|
135145
|
+
teardown();
|
|
135146
|
+
try {
|
|
135147
|
+
controller.close();
|
|
135148
|
+
} catch {
|
|
135149
|
+
}
|
|
135150
|
+
return;
|
|
135151
|
+
}
|
|
135152
|
+
if (streamClosed)
|
|
135153
|
+
return;
|
|
135154
|
+
if (chunk.chunk.byteLength) {
|
|
135155
|
+
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
135156
|
+
}
|
|
135157
|
+
}
|
|
135158
|
+
} catch (err) {
|
|
135159
|
+
if (!(err instanceof Error && "code" in err)) {
|
|
135160
|
+
console.error("[world-local] Unexpected polling error:", err);
|
|
135161
|
+
}
|
|
135162
|
+
} finally {
|
|
135163
|
+
isPolling = false;
|
|
135164
|
+
}
|
|
135165
|
+
}, 100);
|
|
135166
|
+
},
|
|
135167
|
+
cancel() {
|
|
135168
|
+
streamClosed = true;
|
|
135169
|
+
teardown();
|
|
135170
|
+
}
|
|
135171
|
+
});
|
|
135172
|
+
}
|
|
135173
|
+
}
|
|
135174
|
+
};
|
|
135175
|
+
}
|
|
135176
|
+
function purgesUserDataOnFinish(attributes) {
|
|
135177
|
+
const retention = readRunRetention(attributes);
|
|
135178
|
+
if (retention.unsupported) {
|
|
135179
|
+
console.warn(`[world-local] Ignoring unrecognized ${RETENTION_ATTRIBUTE} value ${JSON.stringify(retention.raw)}; keeping the run's data.`);
|
|
135180
|
+
}
|
|
135181
|
+
return retention.mode === "none";
|
|
135182
|
+
}
|
|
135183
|
+
function withRunPayloadsPurged(run2, purgedAt) {
|
|
135184
|
+
return {
|
|
135185
|
+
...run2,
|
|
135186
|
+
input: void 0,
|
|
135187
|
+
output: void 0,
|
|
135188
|
+
error: void 0,
|
|
135189
|
+
expiredAt: purgedAt
|
|
135190
|
+
};
|
|
135191
|
+
}
|
|
135192
|
+
async function purgeRunEntityData(basedir, runId, tag) {
|
|
135193
|
+
await Promise.all([
|
|
135194
|
+
scrubEntityFiles(path$3.join(basedir, "steps"), runId, (step) => {
|
|
135195
|
+
step.input = void 0;
|
|
135196
|
+
step.output = void 0;
|
|
135197
|
+
step.error = void 0;
|
|
135198
|
+
}),
|
|
135199
|
+
scrubEntityFiles(path$3.join(basedir, "events"), runId, (event) => {
|
|
135200
|
+
const eventData = event.eventData;
|
|
135201
|
+
if (!eventData || typeof eventData !== "object")
|
|
135202
|
+
return;
|
|
135203
|
+
for (const field of getEventDataRefFields(String(event.eventType))) {
|
|
135204
|
+
delete eventData[field];
|
|
135205
|
+
}
|
|
135206
|
+
}),
|
|
135207
|
+
scrubHookMetadata(basedir, runId),
|
|
135208
|
+
purgeRunStreamData(basedir, runId, tag)
|
|
135209
|
+
]);
|
|
135210
|
+
}
|
|
135211
|
+
const RawEntitySchema = record(string$3(), any());
|
|
135212
|
+
async function scrubEntityFiles(directory, runId, scrub) {
|
|
135213
|
+
let fileIds;
|
|
135214
|
+
try {
|
|
135215
|
+
fileIds = await listJSONFiles(directory);
|
|
135216
|
+
} catch (error2) {
|
|
135217
|
+
logPurgeFailure(directory, error2);
|
|
135218
|
+
return;
|
|
135219
|
+
}
|
|
135220
|
+
for (const fileId of fileIds) {
|
|
135221
|
+
if (!fileId.startsWith(`${runId}-`))
|
|
135222
|
+
continue;
|
|
135223
|
+
const filePath = path$3.join(directory, `${fileId}.json`);
|
|
135224
|
+
try {
|
|
135225
|
+
const raw2 = await readJSON(filePath, RawEntitySchema);
|
|
135226
|
+
if (!raw2)
|
|
135227
|
+
continue;
|
|
135228
|
+
scrub(raw2);
|
|
135229
|
+
await writeJSON(filePath, raw2, { overwrite: true });
|
|
135230
|
+
} catch (error2) {
|
|
135231
|
+
logPurgeFailure(filePath, error2);
|
|
135232
|
+
}
|
|
135233
|
+
}
|
|
135234
|
+
}
|
|
135235
|
+
async function scrubHookMetadata(basedir, runId) {
|
|
135236
|
+
let markers;
|
|
135237
|
+
try {
|
|
135238
|
+
await ensureHookIndexes(basedir);
|
|
135239
|
+
markers = await listHookByRunMarkers(basedir, runId);
|
|
135240
|
+
} catch (error2) {
|
|
135241
|
+
logPurgeFailure(`hooks of ${runId}`, error2);
|
|
135242
|
+
return;
|
|
135243
|
+
}
|
|
135244
|
+
for (const marker of markers) {
|
|
135245
|
+
if (!marker.hookId)
|
|
135246
|
+
continue;
|
|
135247
|
+
try {
|
|
135248
|
+
const hookPath = taggedPath(basedir, "hooks", marker.hookId, marker.tag);
|
|
135249
|
+
const hook = await readJSON(hookPath, RawEntitySchema);
|
|
135250
|
+
if (!hook || hook.runId !== runId)
|
|
135251
|
+
continue;
|
|
135252
|
+
hook.metadata = void 0;
|
|
135253
|
+
await writeJSON(hookPath, hook, { overwrite: true });
|
|
135254
|
+
} catch (error2) {
|
|
135255
|
+
logPurgeFailure(marker.hookId, error2);
|
|
135256
|
+
}
|
|
135257
|
+
}
|
|
135258
|
+
}
|
|
135259
|
+
function logPurgeFailure(target2, error2) {
|
|
135260
|
+
console.warn(`[world-local] Failed to purge user data for ${target2}:`, error2 instanceof Error ? error2.message : error2);
|
|
135261
|
+
}
|
|
134707
135262
|
const emitter = new EventEmitter();
|
|
134708
135263
|
emitter.setMaxListeners(0);
|
|
134709
135264
|
const RUN_STATUS_POLL_INTERVAL_MS = 100;
|
|
@@ -134777,13 +135332,18 @@ async function handleLegacyEvent(basedir, runId, data, currentRun, params) {
|
|
|
134777
135332
|
updatedAt: now2,
|
|
134778
135333
|
attributes: currentRun.attributes
|
|
134779
135334
|
};
|
|
135335
|
+
const purged = purgesUserDataOnFinish(run2.attributes);
|
|
135336
|
+
const stored = purged ? withRunPayloadsPurged(run2, now2) : run2;
|
|
134780
135337
|
const runPath = resolveWithinBase(basedir, "runs", `${runId}.json`);
|
|
134781
|
-
await writeJSON(runPath,
|
|
135338
|
+
await writeJSON(runPath, stored, { overwrite: true });
|
|
134782
135339
|
signalRunTerminal(runId);
|
|
134783
135340
|
await deleteAllHooksForRun(basedir, runId);
|
|
135341
|
+
if (purged) {
|
|
135342
|
+
await purgeRunEntityData(basedir, runId, void 0);
|
|
135343
|
+
}
|
|
134784
135344
|
return {
|
|
134785
135345
|
event: void 0,
|
|
134786
|
-
run: filterRunData$1(
|
|
135346
|
+
run: filterRunData$1(stored, resolveData)
|
|
134787
135347
|
};
|
|
134788
135348
|
}
|
|
134789
135349
|
case "wait_completed":
|
|
@@ -135083,17 +135643,19 @@ async function deleteAllWaitsForRun(basedir, runId) {
|
|
|
135083
135643
|
async function writeRunUnderLifecycleLock(basedir, runId, tag, proposed) {
|
|
135084
135644
|
return withRunFileLock(runId, async () => {
|
|
135085
135645
|
const fresh = await readJSON(taggedPath(basedir, "runs", runId, tag), WorkflowRunSchema);
|
|
135086
|
-
const
|
|
135087
|
-
|
|
135088
|
-
|
|
135089
|
-
|
|
135646
|
+
const attributes = (fresh == null ? void 0 : fresh.attributes) ?? proposed.attributes;
|
|
135647
|
+
let next2 = { ...proposed, attributes };
|
|
135648
|
+
const purged = isTerminalWorkflowRunStatus(next2.status) && purgesUserDataOnFinish(attributes);
|
|
135649
|
+
if (purged) {
|
|
135650
|
+
next2 = withRunPayloadsPurged(next2, /* @__PURE__ */ new Date());
|
|
135651
|
+
}
|
|
135090
135652
|
await writeJSON(taggedPath(basedir, "runs", runId, tag), next2, {
|
|
135091
135653
|
overwrite: true
|
|
135092
135654
|
});
|
|
135093
135655
|
if (isTerminalWorkflowRunStatus(next2.status)) {
|
|
135094
135656
|
signalRunTerminal(runId);
|
|
135095
135657
|
}
|
|
135096
|
-
return next2;
|
|
135658
|
+
return { run: next2, purged };
|
|
135097
135659
|
});
|
|
135098
135660
|
}
|
|
135099
135661
|
function createEventsStorage(basedir, tag) {
|
|
@@ -135520,6 +136082,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
135520
136082
|
event = { ...event, eventData };
|
|
135521
136083
|
}
|
|
135522
136084
|
let run2;
|
|
136085
|
+
let runPurged = false;
|
|
135523
136086
|
let step;
|
|
135524
136087
|
let hook;
|
|
135525
136088
|
let wait;
|
|
@@ -135583,7 +136146,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
135583
136146
|
maxEvents: getMaxEventsPerRun()
|
|
135584
136147
|
};
|
|
135585
136148
|
}
|
|
135586
|
-
|
|
136149
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
135587
136150
|
runId: currentRun.runId,
|
|
135588
136151
|
deploymentId: currentRun.deploymentId,
|
|
135589
136152
|
workflowName: currentRun.workflowName,
|
|
@@ -135601,11 +136164,13 @@ function createEventsStorage(basedir, tag) {
|
|
|
135601
136164
|
attributes: currentRun.attributes,
|
|
135602
136165
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
135603
136166
|
});
|
|
136167
|
+
run2 = written.run;
|
|
136168
|
+
runPurged = written.purged;
|
|
135604
136169
|
}
|
|
135605
136170
|
} else if (data.eventType === "run_completed" && "eventData" in data) {
|
|
135606
136171
|
const completedData = data.eventData;
|
|
135607
136172
|
if (currentRun) {
|
|
135608
|
-
|
|
136173
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
135609
136174
|
runId: currentRun.runId,
|
|
135610
136175
|
deploymentId: currentRun.deploymentId,
|
|
135611
136176
|
workflowName: currentRun.workflowName,
|
|
@@ -135623,6 +136188,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
135623
136188
|
attributes: currentRun.attributes,
|
|
135624
136189
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
135625
136190
|
});
|
|
136191
|
+
run2 = written.run;
|
|
136192
|
+
runPurged = written.purged;
|
|
135626
136193
|
await Promise.all([
|
|
135627
136194
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
135628
136195
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
@@ -135631,7 +136198,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
135631
136198
|
} else if (data.eventType === "run_failed" && "eventData" in data) {
|
|
135632
136199
|
const failedData = data.eventData;
|
|
135633
136200
|
if (currentRun) {
|
|
135634
|
-
|
|
136201
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
135635
136202
|
runId: currentRun.runId,
|
|
135636
136203
|
deploymentId: currentRun.deploymentId,
|
|
135637
136204
|
workflowName: currentRun.workflowName,
|
|
@@ -135650,6 +136217,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
135650
136217
|
attributes: currentRun.attributes,
|
|
135651
136218
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
135652
136219
|
});
|
|
136220
|
+
run2 = written.run;
|
|
136221
|
+
runPurged = written.purged;
|
|
135653
136222
|
await Promise.all([
|
|
135654
136223
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
135655
136224
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
@@ -135657,7 +136226,7 @@ function createEventsStorage(basedir, tag) {
|
|
|
135657
136226
|
}
|
|
135658
136227
|
} else if (data.eventType === "run_cancelled") {
|
|
135659
136228
|
if (currentRun) {
|
|
135660
|
-
|
|
136229
|
+
const written = await writeRunUnderLifecycleLock(basedir, effectiveRunId, tag, {
|
|
135661
136230
|
runId: currentRun.runId,
|
|
135662
136231
|
deploymentId: currentRun.deploymentId,
|
|
135663
136232
|
workflowName: currentRun.workflowName,
|
|
@@ -135675,6 +136244,8 @@ function createEventsStorage(basedir, tag) {
|
|
|
135675
136244
|
attributes: currentRun.attributes,
|
|
135676
136245
|
encryptionPublicKey: currentRun.encryptionPublicKey
|
|
135677
136246
|
});
|
|
136247
|
+
run2 = written.run;
|
|
136248
|
+
runPurged = written.purged;
|
|
135678
136249
|
await Promise.all([
|
|
135679
136250
|
deleteAllHooksForRun(basedir, effectiveRunId),
|
|
135680
136251
|
deleteAllWaitsForRun(basedir, effectiveRunId)
|
|
@@ -136128,6 +136699,10 @@ function createEventsStorage(basedir, tag) {
|
|
|
136128
136699
|
await writeHookByRunMarker(basedir, hook.runId, hook.hookId, tag);
|
|
136129
136700
|
await writeJSON(taggedPath(basedir, "hooks", hook.hookId, tag), hook, hookEntityWriteOptions);
|
|
136130
136701
|
}
|
|
136702
|
+
if (runPurged) {
|
|
136703
|
+
await purgeRunEntityData(basedir, effectiveRunId, tag);
|
|
136704
|
+
clearRunCache(effectiveRunId);
|
|
136705
|
+
}
|
|
136131
136706
|
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
136132
136707
|
const filteredEvent = stripEventDataRefs(event, resolveData);
|
|
136133
136708
|
let eventPage;
|
|
@@ -136326,379 +136901,6 @@ function createStorage$1(basedir, tag) {
|
|
|
136326
136901
|
clearCache: () => events2.clearCache()
|
|
136327
136902
|
};
|
|
136328
136903
|
}
|
|
136329
|
-
const chunkIds = globalSingleton("@workflow/world-local//streamerMonotonicUlid", 1, () => ({ next: monotonicFactory(() => Math.random()) }));
|
|
136330
|
-
const monotonicUlid = (seedTime) => chunkIds.next(seedTime);
|
|
136331
|
-
const RunStreamsSchema = object$1({
|
|
136332
|
-
streams: array$1(string$3())
|
|
136333
|
-
});
|
|
136334
|
-
const EOF_MARKER = 1;
|
|
136335
|
-
function isEofByte(byte) {
|
|
136336
|
-
return byte === EOF_MARKER;
|
|
136337
|
-
}
|
|
136338
|
-
function serializeChunk(chunk) {
|
|
136339
|
-
const eofByte = Buffer.from([chunk.eof ? EOF_MARKER : 0]);
|
|
136340
|
-
return Buffer.concat([eofByte, chunk.chunk]);
|
|
136341
|
-
}
|
|
136342
|
-
function isEofChunk(serialized) {
|
|
136343
|
-
return isEofByte(serialized[0]);
|
|
136344
|
-
}
|
|
136345
|
-
function deserializeChunk(serialized) {
|
|
136346
|
-
const eof = isEofChunk(serialized);
|
|
136347
|
-
const chunk = Buffer.from(serialized.subarray(1));
|
|
136348
|
-
return { eof, chunk };
|
|
136349
|
-
}
|
|
136350
|
-
async function listChunkEntries(chunksDir) {
|
|
136351
|
-
try {
|
|
136352
|
-
return await fs$1.readdir(chunksDir);
|
|
136353
|
-
} catch (error2) {
|
|
136354
|
-
if (error2.code === "ENOENT")
|
|
136355
|
-
return [];
|
|
136356
|
-
throw error2;
|
|
136357
|
-
}
|
|
136358
|
-
}
|
|
136359
|
-
function addChunkFilesByExtension(extMap, entries, sourceExtension, fileExtension = sourceExtension, include = () => true) {
|
|
136360
|
-
for (const entry2 of entries) {
|
|
136361
|
-
if (!entry2.endsWith(sourceExtension))
|
|
136362
|
-
continue;
|
|
136363
|
-
const file2 = entry2.slice(0, -sourceExtension.length);
|
|
136364
|
-
if (include(file2))
|
|
136365
|
-
extMap.set(file2, fileExtension);
|
|
136366
|
-
}
|
|
136367
|
-
}
|
|
136368
|
-
function chunkDirForStream(chunksBaseDir, name2) {
|
|
136369
|
-
assertSafeEntityId("streamName", name2);
|
|
136370
|
-
return path$3.join(chunksBaseDir, name2);
|
|
136371
|
-
}
|
|
136372
|
-
async function listChunkFilesForStream(chunksBaseDir, name2, tag) {
|
|
136373
|
-
const dir = chunkDirForStream(chunksBaseDir, name2);
|
|
136374
|
-
const entries = await listChunkEntries(dir);
|
|
136375
|
-
const extMap = /* @__PURE__ */ new Map();
|
|
136376
|
-
addChunkFilesByExtension(extMap, entries, ".json");
|
|
136377
|
-
addChunkFilesByExtension(extMap, entries, ".bin", ".bin", tag ? (file2) => !file2.endsWith(`.${tag}`) : void 0);
|
|
136378
|
-
if (tag) {
|
|
136379
|
-
const taggedExtension = `.${tag}.bin`;
|
|
136380
|
-
addChunkFilesByExtension(extMap, entries, taggedExtension);
|
|
136381
|
-
}
|
|
136382
|
-
const files = [...extMap.keys()].sort();
|
|
136383
|
-
return { files, extMap, dir };
|
|
136384
|
-
}
|
|
136385
|
-
function createStreamer$1(basedir, tag) {
|
|
136386
|
-
const tagSuffix = tag ? `.${tag}` : "";
|
|
136387
|
-
const streamEmitter = new EventEmitter();
|
|
136388
|
-
const registeredStreams = /* @__PURE__ */ new Set();
|
|
136389
|
-
async function registerStreamForRun(runId, streamName) {
|
|
136390
|
-
assertSafeEntityId("runId", runId);
|
|
136391
|
-
assertSafeEntityId("streamName", streamName);
|
|
136392
|
-
const cacheKey = `${runId}:${streamName}`;
|
|
136393
|
-
if (registeredStreams.has(cacheKey)) {
|
|
136394
|
-
return;
|
|
136395
|
-
}
|
|
136396
|
-
const runStreamsPath = taggedPath(basedir, "streams/runs", runId, tag);
|
|
136397
|
-
const existing = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
136398
|
-
const streams = (existing == null ? void 0 : existing.streams) ?? [];
|
|
136399
|
-
if (!streams.includes(streamName)) {
|
|
136400
|
-
streams.push(streamName);
|
|
136401
|
-
await writeJSON(runStreamsPath, { streams }, { overwrite: true });
|
|
136402
|
-
}
|
|
136403
|
-
registeredStreams.add(cacheKey);
|
|
136404
|
-
}
|
|
136405
|
-
function toBuffer(chunk) {
|
|
136406
|
-
if (typeof chunk === "string") {
|
|
136407
|
-
return Buffer.from(new TextEncoder().encode(chunk));
|
|
136408
|
-
} else if (chunk instanceof Buffer) {
|
|
136409
|
-
return chunk;
|
|
136410
|
-
} else {
|
|
136411
|
-
return Buffer.from(chunk);
|
|
136412
|
-
}
|
|
136413
|
-
}
|
|
136414
|
-
return {
|
|
136415
|
-
streams: {
|
|
136416
|
-
async write(_runId, name2, chunk) {
|
|
136417
|
-
const chunkId = `chnk_${monotonicUlid()}`;
|
|
136418
|
-
const runId = await _runId;
|
|
136419
|
-
await registerStreamForRun(runId, name2);
|
|
136420
|
-
const chunkBuffer = toBuffer(chunk);
|
|
136421
|
-
const serialized = serializeChunk({
|
|
136422
|
-
chunk: chunkBuffer,
|
|
136423
|
-
eof: false
|
|
136424
|
-
});
|
|
136425
|
-
const chunkPath = path$3.join(chunkDirForStream(path$3.join(basedir, "streams", "chunks"), name2), `${chunkId}${tagSuffix}.bin`);
|
|
136426
|
-
await write(chunkPath, serialized);
|
|
136427
|
-
const chunkData = Uint8Array.from(chunkBuffer);
|
|
136428
|
-
streamEmitter.emit(`chunk:${name2}`, {
|
|
136429
|
-
streamName: name2,
|
|
136430
|
-
chunkData,
|
|
136431
|
-
chunkId
|
|
136432
|
-
});
|
|
136433
|
-
},
|
|
136434
|
-
async writeMulti(_runId, name2, chunks) {
|
|
136435
|
-
if (chunks.length === 0)
|
|
136436
|
-
return;
|
|
136437
|
-
const chunkIds2 = chunks.map(() => `chnk_${monotonicUlid()}`);
|
|
136438
|
-
const runId = await _runId;
|
|
136439
|
-
await registerStreamForRun(runId, name2);
|
|
136440
|
-
const chunkBuffers = chunks.map((chunk) => toBuffer(chunk));
|
|
136441
|
-
const writePromises = chunkBuffers.map(async (chunkBuffer, i) => {
|
|
136442
|
-
const chunkId = chunkIds2[i];
|
|
136443
|
-
const serialized = serializeChunk({
|
|
136444
|
-
chunk: chunkBuffer,
|
|
136445
|
-
eof: false
|
|
136446
|
-
});
|
|
136447
|
-
const chunkPath = path$3.join(chunkDirForStream(path$3.join(basedir, "streams", "chunks"), name2), `${chunkId}${tagSuffix}.bin`);
|
|
136448
|
-
await write(chunkPath, serialized);
|
|
136449
|
-
return {
|
|
136450
|
-
chunkId,
|
|
136451
|
-
chunkData: Uint8Array.from(chunkBuffer)
|
|
136452
|
-
};
|
|
136453
|
-
});
|
|
136454
|
-
for (const writePromise of writePromises) {
|
|
136455
|
-
const { chunkId, chunkData } = await writePromise;
|
|
136456
|
-
streamEmitter.emit(`chunk:${name2}`, {
|
|
136457
|
-
streamName: name2,
|
|
136458
|
-
chunkData,
|
|
136459
|
-
chunkId
|
|
136460
|
-
});
|
|
136461
|
-
}
|
|
136462
|
-
},
|
|
136463
|
-
async close(_runId, name2) {
|
|
136464
|
-
const chunkId = `chnk_${monotonicUlid()}`;
|
|
136465
|
-
const runId = await _runId;
|
|
136466
|
-
await registerStreamForRun(runId, name2);
|
|
136467
|
-
const chunkPath = path$3.join(chunkDirForStream(path$3.join(basedir, "streams", "chunks"), name2), `${chunkId}${tagSuffix}.bin`);
|
|
136468
|
-
await write(chunkPath, serializeChunk({ chunk: Buffer.from([]), eof: true }));
|
|
136469
|
-
streamEmitter.emit(`close:${name2}`, { streamName: name2 });
|
|
136470
|
-
},
|
|
136471
|
-
async list(runId) {
|
|
136472
|
-
assertSafeEntityId("runId", runId);
|
|
136473
|
-
const data = await readJSONWithFallback(basedir, "streams/runs", runId, RunStreamsSchema, tag);
|
|
136474
|
-
return (data == null ? void 0 : data.streams) ?? [];
|
|
136475
|
-
},
|
|
136476
|
-
async getChunks(_runId, name2, options) {
|
|
136477
|
-
const limit = (options == null ? void 0 : options.limit) ?? 100;
|
|
136478
|
-
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
136479
|
-
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
136480
|
-
let startIndex = 0;
|
|
136481
|
-
if (options == null ? void 0 : options.cursor) {
|
|
136482
|
-
try {
|
|
136483
|
-
const decoded = JSON.parse(Buffer.from(options.cursor, "base64").toString("utf-8"));
|
|
136484
|
-
startIndex = decoded.i;
|
|
136485
|
-
} catch {
|
|
136486
|
-
startIndex = 0;
|
|
136487
|
-
}
|
|
136488
|
-
}
|
|
136489
|
-
let streamDone = false;
|
|
136490
|
-
const resultChunks = [];
|
|
136491
|
-
let dataIndex = 0;
|
|
136492
|
-
for (const file2 of chunkFiles) {
|
|
136493
|
-
const ext2 = fileExtMap.get(file2) ?? ".bin";
|
|
136494
|
-
const filePath = path$3.join(chunksDir, `${file2}${ext2}`);
|
|
136495
|
-
if (dataIndex < startIndex) {
|
|
136496
|
-
if (isEofByte(await readFirstByte(filePath))) {
|
|
136497
|
-
streamDone = true;
|
|
136498
|
-
break;
|
|
136499
|
-
}
|
|
136500
|
-
dataIndex++;
|
|
136501
|
-
continue;
|
|
136502
|
-
}
|
|
136503
|
-
if (resultChunks.length >= limit) {
|
|
136504
|
-
if (isEofByte(await readFirstByte(filePath))) {
|
|
136505
|
-
streamDone = true;
|
|
136506
|
-
} else {
|
|
136507
|
-
dataIndex++;
|
|
136508
|
-
}
|
|
136509
|
-
break;
|
|
136510
|
-
}
|
|
136511
|
-
const chunk = deserializeChunk(await readBuffer(filePath));
|
|
136512
|
-
if (chunk.eof) {
|
|
136513
|
-
streamDone = true;
|
|
136514
|
-
break;
|
|
136515
|
-
}
|
|
136516
|
-
resultChunks.push({
|
|
136517
|
-
index: dataIndex,
|
|
136518
|
-
data: Uint8Array.from(chunk.chunk)
|
|
136519
|
-
});
|
|
136520
|
-
dataIndex++;
|
|
136521
|
-
}
|
|
136522
|
-
const hasMore = !streamDone && dataIndex > startIndex + resultChunks.length;
|
|
136523
|
-
const nextIndex = startIndex + resultChunks.length;
|
|
136524
|
-
const nextCursor = hasMore ? Buffer.from(JSON.stringify({ i: nextIndex })).toString("base64") : null;
|
|
136525
|
-
return {
|
|
136526
|
-
data: resultChunks,
|
|
136527
|
-
cursor: nextCursor,
|
|
136528
|
-
hasMore,
|
|
136529
|
-
done: streamDone
|
|
136530
|
-
};
|
|
136531
|
-
},
|
|
136532
|
-
async getInfo(_runId, name2) {
|
|
136533
|
-
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
136534
|
-
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
136535
|
-
let streamDone = false;
|
|
136536
|
-
let dataCount = 0;
|
|
136537
|
-
for (const file2 of chunkFiles) {
|
|
136538
|
-
const ext2 = fileExtMap.get(file2) ?? ".bin";
|
|
136539
|
-
if (isEofByte(await readFirstByte(path$3.join(chunksDir, `${file2}${ext2}`)))) {
|
|
136540
|
-
streamDone = true;
|
|
136541
|
-
break;
|
|
136542
|
-
}
|
|
136543
|
-
dataCount++;
|
|
136544
|
-
}
|
|
136545
|
-
return { tailIndex: dataCount - 1, done: streamDone };
|
|
136546
|
-
},
|
|
136547
|
-
async get(_runId, name2, startIndex = 0) {
|
|
136548
|
-
const chunksBaseDir = path$3.join(basedir, "streams", "chunks");
|
|
136549
|
-
let teardown = () => {
|
|
136550
|
-
};
|
|
136551
|
-
let pollInterval = null;
|
|
136552
|
-
let streamClosed = false;
|
|
136553
|
-
return new ReadableStream({
|
|
136554
|
-
async start(controller) {
|
|
136555
|
-
const deliveredChunkIds = /* @__PURE__ */ new Set();
|
|
136556
|
-
const bufferedEventChunks = [];
|
|
136557
|
-
let isReadingFromDisk = true;
|
|
136558
|
-
let pendingClose = false;
|
|
136559
|
-
const chunkListener = (event) => {
|
|
136560
|
-
if (event.chunkData.byteLength === 0) {
|
|
136561
|
-
deliveredChunkIds.add(event.chunkId);
|
|
136562
|
-
return;
|
|
136563
|
-
}
|
|
136564
|
-
if (isReadingFromDisk) {
|
|
136565
|
-
deliveredChunkIds.add(event.chunkId);
|
|
136566
|
-
bufferedEventChunks.push({
|
|
136567
|
-
chunkId: event.chunkId,
|
|
136568
|
-
chunkData: Uint8Array.from(event.chunkData)
|
|
136569
|
-
});
|
|
136570
|
-
} else if (!deliveredChunkIds.has(event.chunkId)) {
|
|
136571
|
-
deliveredChunkIds.add(event.chunkId);
|
|
136572
|
-
controller.enqueue(Uint8Array.from(event.chunkData));
|
|
136573
|
-
}
|
|
136574
|
-
};
|
|
136575
|
-
const closeListener = () => {
|
|
136576
|
-
if (isReadingFromDisk) {
|
|
136577
|
-
pendingClose = true;
|
|
136578
|
-
return;
|
|
136579
|
-
}
|
|
136580
|
-
streamClosed = true;
|
|
136581
|
-
teardown();
|
|
136582
|
-
try {
|
|
136583
|
-
controller.close();
|
|
136584
|
-
} catch {
|
|
136585
|
-
}
|
|
136586
|
-
};
|
|
136587
|
-
teardown = () => {
|
|
136588
|
-
streamEmitter.off(`chunk:${name2}`, chunkListener);
|
|
136589
|
-
streamEmitter.off(`close:${name2}`, closeListener);
|
|
136590
|
-
if (pollInterval) {
|
|
136591
|
-
clearInterval(pollInterval);
|
|
136592
|
-
pollInterval = null;
|
|
136593
|
-
}
|
|
136594
|
-
};
|
|
136595
|
-
streamEmitter.on(`chunk:${name2}`, chunkListener);
|
|
136596
|
-
streamEmitter.on(`close:${name2}`, closeListener);
|
|
136597
|
-
const { files: chunkFiles, extMap: fileExtMap, dir: chunksDir } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
136598
|
-
let dataChunkCount = chunkFiles.length;
|
|
136599
|
-
if (typeof startIndex === "number" && startIndex < 0 && chunkFiles.length > 0) {
|
|
136600
|
-
const lastFile = chunkFiles[chunkFiles.length - 1];
|
|
136601
|
-
const lastExt = fileExtMap.get(lastFile) ?? ".bin";
|
|
136602
|
-
if (isEofByte(await readFirstByte(path$3.join(chunksDir, `${lastFile}${lastExt}`)))) {
|
|
136603
|
-
dataChunkCount--;
|
|
136604
|
-
}
|
|
136605
|
-
}
|
|
136606
|
-
const resolvedStartIndex = typeof startIndex === "number" && startIndex < 0 ? Math.max(0, dataChunkCount + startIndex) : startIndex;
|
|
136607
|
-
let isComplete = false;
|
|
136608
|
-
for (let i = resolvedStartIndex; i < chunkFiles.length; i++) {
|
|
136609
|
-
const file2 = chunkFiles[i];
|
|
136610
|
-
const chunkId = file2;
|
|
136611
|
-
if (deliveredChunkIds.has(chunkId)) {
|
|
136612
|
-
continue;
|
|
136613
|
-
}
|
|
136614
|
-
const ext2 = fileExtMap.get(file2) ?? ".bin";
|
|
136615
|
-
const chunk = deserializeChunk(await readBuffer(path$3.join(chunksDir, `${file2}${ext2}`)));
|
|
136616
|
-
if ((chunk == null ? void 0 : chunk.eof) === true) {
|
|
136617
|
-
isComplete = true;
|
|
136618
|
-
break;
|
|
136619
|
-
}
|
|
136620
|
-
deliveredChunkIds.add(chunkId);
|
|
136621
|
-
if (chunk.chunk.byteLength) {
|
|
136622
|
-
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
136623
|
-
}
|
|
136624
|
-
}
|
|
136625
|
-
isReadingFromDisk = false;
|
|
136626
|
-
bufferedEventChunks.sort((a2, b2) => a2.chunkId.localeCompare(b2.chunkId));
|
|
136627
|
-
for (const buffered of bufferedEventChunks) {
|
|
136628
|
-
controller.enqueue(Uint8Array.from(buffered.chunkData));
|
|
136629
|
-
}
|
|
136630
|
-
if (isComplete) {
|
|
136631
|
-
streamClosed = true;
|
|
136632
|
-
teardown();
|
|
136633
|
-
try {
|
|
136634
|
-
controller.close();
|
|
136635
|
-
} catch {
|
|
136636
|
-
}
|
|
136637
|
-
return;
|
|
136638
|
-
}
|
|
136639
|
-
if (pendingClose) {
|
|
136640
|
-
streamClosed = true;
|
|
136641
|
-
teardown();
|
|
136642
|
-
try {
|
|
136643
|
-
controller.close();
|
|
136644
|
-
} catch {
|
|
136645
|
-
}
|
|
136646
|
-
return;
|
|
136647
|
-
}
|
|
136648
|
-
for (let i = 0; i < resolvedStartIndex && i < chunkFiles.length; i++) {
|
|
136649
|
-
deliveredChunkIds.add(chunkFiles[i]);
|
|
136650
|
-
}
|
|
136651
|
-
if (streamClosed) {
|
|
136652
|
-
teardown();
|
|
136653
|
-
return;
|
|
136654
|
-
}
|
|
136655
|
-
let isPolling = false;
|
|
136656
|
-
pollInterval = setInterval(async () => {
|
|
136657
|
-
if (isPolling)
|
|
136658
|
-
return;
|
|
136659
|
-
isPolling = true;
|
|
136660
|
-
try {
|
|
136661
|
-
const { files: currentFiles, extMap: currentExtMap } = await listChunkFilesForStream(chunksBaseDir, name2, tag);
|
|
136662
|
-
for (const file2 of currentFiles) {
|
|
136663
|
-
const chunkId = file2;
|
|
136664
|
-
if (deliveredChunkIds.has(chunkId))
|
|
136665
|
-
continue;
|
|
136666
|
-
deliveredChunkIds.add(chunkId);
|
|
136667
|
-
const ext2 = currentExtMap.get(file2) ?? ".bin";
|
|
136668
|
-
const chunk = deserializeChunk(await readBuffer(path$3.join(chunksDir, `${file2}${ext2}`)));
|
|
136669
|
-
if ((chunk == null ? void 0 : chunk.eof) === true) {
|
|
136670
|
-
streamClosed = true;
|
|
136671
|
-
teardown();
|
|
136672
|
-
try {
|
|
136673
|
-
controller.close();
|
|
136674
|
-
} catch {
|
|
136675
|
-
}
|
|
136676
|
-
return;
|
|
136677
|
-
}
|
|
136678
|
-
if (streamClosed)
|
|
136679
|
-
return;
|
|
136680
|
-
if (chunk.chunk.byteLength) {
|
|
136681
|
-
controller.enqueue(Uint8Array.from(chunk.chunk));
|
|
136682
|
-
}
|
|
136683
|
-
}
|
|
136684
|
-
} catch (err) {
|
|
136685
|
-
if (!(err instanceof Error && "code" in err)) {
|
|
136686
|
-
console.error("[world-local] Unexpected polling error:", err);
|
|
136687
|
-
}
|
|
136688
|
-
} finally {
|
|
136689
|
-
isPolling = false;
|
|
136690
|
-
}
|
|
136691
|
-
}, 100);
|
|
136692
|
-
},
|
|
136693
|
-
cancel() {
|
|
136694
|
-
streamClosed = true;
|
|
136695
|
-
teardown();
|
|
136696
|
-
}
|
|
136697
|
-
});
|
|
136698
|
-
}
|
|
136699
|
-
}
|
|
136700
|
-
};
|
|
136701
|
-
}
|
|
136702
136904
|
function createWorld$2(args) {
|
|
136703
136905
|
const definedArgs = args ? Object.fromEntries(Object.entries(args).filter(([, value]) => value !== void 0)) : {};
|
|
136704
136906
|
const mergedConfig = { ...config.value, ...definedArgs };
|
|
@@ -136750,7 +136952,7 @@ function createWorld$2(args) {
|
|
|
136750
136952
|
const basedir = mergedConfig.dataDir;
|
|
136751
136953
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
136752
136954
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
136753
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
136955
|
+
const { HookSchema: HookSchema2 } = await import("./index-SGZlzYCB.js");
|
|
136754
136956
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
136755
136957
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
136756
136958
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -136933,8 +137135,8 @@ function requireGetVercelOidcToken() {
|
|
|
136933
137135
|
}
|
|
136934
137136
|
try {
|
|
136935
137137
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
136936
|
-
await import("./token-util-
|
|
136937
|
-
await import("./token-
|
|
137138
|
+
await import("./token-util-C4igRPyO.js").then((n) => n.t),
|
|
137139
|
+
await import("./token-tFJ2cDc9.js").then((n) => n.t)
|
|
136938
137140
|
]);
|
|
136939
137141
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
136940
137142
|
await refreshToken(options);
|
|
@@ -137497,9 +137699,10 @@ function requireDist() {
|
|
|
137497
137699
|
return dist;
|
|
137498
137700
|
}
|
|
137499
137701
|
var distExports = requireDist();
|
|
137500
|
-
const version = "5.0.0-beta.
|
|
137702
|
+
const version = "5.0.0-beta.45";
|
|
137501
137703
|
const pools = globalSingleton("@workflow/world-vercel//httpPools", 1, () => ({
|
|
137502
137704
|
dispatcher: void 0,
|
|
137705
|
+
queueDispatcher: void 0,
|
|
137503
137706
|
streamDispatcher: void 0,
|
|
137504
137707
|
streamCloseDispatcher: void 0,
|
|
137505
137708
|
nodeHttpAgents: void 0
|
|
@@ -137520,6 +137723,64 @@ const DEFAULT_AGENT_OPTIONS = {
|
|
|
137520
137723
|
// head-of-line blocking that deadlocks the webhook respondWith mechanism.
|
|
137521
137724
|
pipelining: 1
|
|
137522
137725
|
};
|
|
137726
|
+
const QUEUE_AGENT_CONNECTIONS = 64;
|
|
137727
|
+
const QUEUE_REQUEST_TIMEOUT_MS = 3e4;
|
|
137728
|
+
const getQueueRequestTimeoutMs = () => envNumber("WORKFLOW_VERCEL_QUEUE_TIMEOUT_MS", QUEUE_REQUEST_TIMEOUT_MS, {
|
|
137729
|
+
integer: true,
|
|
137730
|
+
min: 5e3,
|
|
137731
|
+
max: 12e4
|
|
137732
|
+
});
|
|
137733
|
+
function getQueueAgentOptions() {
|
|
137734
|
+
const timeoutMs = getQueueRequestTimeoutMs();
|
|
137735
|
+
return {
|
|
137736
|
+
...DEFAULT_AGENT_OPTIONS,
|
|
137737
|
+
connections: envNumber("WORKFLOW_VERCEL_QUEUE_CONNECTIONS", QUEUE_AGENT_CONNECTIONS, { integer: true, min: 1, max: 1024 }),
|
|
137738
|
+
headersTimeout: timeoutMs,
|
|
137739
|
+
bodyTimeout: timeoutMs
|
|
137740
|
+
};
|
|
137741
|
+
}
|
|
137742
|
+
const ForwardingHandler = undiciExports.DecoratorHandler;
|
|
137743
|
+
function deadlineInterceptor(timeoutMs) {
|
|
137744
|
+
var _expired, _controller, _timer, _DeadlineHandler_instances, abort_fn;
|
|
137745
|
+
class DeadlineHandler extends ForwardingHandler {
|
|
137746
|
+
constructor(handler) {
|
|
137747
|
+
var _a3, _b2;
|
|
137748
|
+
super(handler);
|
|
137749
|
+
__privateAdd(this, _DeadlineHandler_instances);
|
|
137750
|
+
__privateAdd(this, _expired, false);
|
|
137751
|
+
__privateAdd(this, _controller);
|
|
137752
|
+
__privateAdd(this, _timer);
|
|
137753
|
+
__privateSet(this, _timer, setTimeout(() => {
|
|
137754
|
+
__privateSet(this, _expired, true);
|
|
137755
|
+
__privateMethod(this, _DeadlineHandler_instances, abort_fn).call(this);
|
|
137756
|
+
}, timeoutMs));
|
|
137757
|
+
(_b2 = (_a3 = __privateGet(this, _timer)).unref) == null ? void 0 : _b2.call(_a3);
|
|
137758
|
+
}
|
|
137759
|
+
onRequestStart(controller, context) {
|
|
137760
|
+
__privateSet(this, _controller, controller);
|
|
137761
|
+
super.onRequestStart(controller, context);
|
|
137762
|
+
if (__privateGet(this, _expired))
|
|
137763
|
+
__privateMethod(this, _DeadlineHandler_instances, abort_fn).call(this);
|
|
137764
|
+
}
|
|
137765
|
+
onResponseEnd(controller, trailers) {
|
|
137766
|
+
clearTimeout(__privateGet(this, _timer));
|
|
137767
|
+
super.onResponseEnd(controller, trailers);
|
|
137768
|
+
}
|
|
137769
|
+
onResponseError(controller, error2) {
|
|
137770
|
+
clearTimeout(__privateGet(this, _timer));
|
|
137771
|
+
super.onResponseError(controller, error2);
|
|
137772
|
+
}
|
|
137773
|
+
}
|
|
137774
|
+
_expired = new WeakMap();
|
|
137775
|
+
_controller = new WeakMap();
|
|
137776
|
+
_timer = new WeakMap();
|
|
137777
|
+
_DeadlineHandler_instances = new WeakSet();
|
|
137778
|
+
abort_fn = function() {
|
|
137779
|
+
var _a3;
|
|
137780
|
+
(_a3 = __privateGet(this, _controller)) == null ? void 0 : _a3.abort(new Error(`Queue request exceeded its ${timeoutMs}ms deadline`));
|
|
137781
|
+
};
|
|
137782
|
+
return (dispatch2) => (opts, handler) => dispatch2(opts, new DeadlineHandler(handler));
|
|
137783
|
+
}
|
|
137523
137784
|
const EVENTS_AGENT_OPTIONS = {
|
|
137524
137785
|
...BASE_AGENT_OPTIONS,
|
|
137525
137786
|
allowH2: true,
|
|
@@ -137699,7 +137960,7 @@ function getDispatcher(config2) {
|
|
|
137699
137960
|
return resolveDispatcher(config2, getDefaultDispatcher);
|
|
137700
137961
|
}
|
|
137701
137962
|
function getQueueDispatcher(config2) {
|
|
137702
|
-
return (config2
|
|
137963
|
+
return resolveDispatcher(config2, getDefaultQueueDispatcher);
|
|
137703
137964
|
}
|
|
137704
137965
|
function getEventsDispatcher(config2) {
|
|
137705
137966
|
return resolveDispatcher(config2, () => eventsRecycler.get());
|
|
@@ -137732,6 +137993,13 @@ function withBoundLifecycle(agent2, composed) {
|
|
|
137732
137993
|
function createStreamDispatcher(retryOptions, agentOverrides) {
|
|
137733
137994
|
return new undiciExports.RetryAgent(new undiciExports.Agent({ ...STREAM_AGENT_OPTIONS, ...agentOverrides }), retryOptions);
|
|
137734
137995
|
}
|
|
137996
|
+
function createQueueDispatcher() {
|
|
137997
|
+
return new undiciExports.RetryAgent(new undiciExports.Agent(getQueueAgentOptions()).compose(deadlineInterceptor(getQueueRequestTimeoutMs())), RETRY_AGENT_OPTIONS);
|
|
137998
|
+
}
|
|
137999
|
+
function getDefaultQueueDispatcher() {
|
|
138000
|
+
pools.queueDispatcher ?? (pools.queueDispatcher = createQueueDispatcher());
|
|
138001
|
+
return pools.queueDispatcher;
|
|
138002
|
+
}
|
|
137735
138003
|
function getDefaultDispatcher() {
|
|
137736
138004
|
pools.dispatcher ?? (pools.dispatcher = makeRetryDispatcher(DEFAULT_AGENT_OPTIONS, RETRY_AGENT_OPTIONS));
|
|
137737
138005
|
return pools.dispatcher;
|
|
@@ -139020,7 +139288,7 @@ function createGetEncryptionKeyForRun(projectId, teamId, token, dispatcher2) {
|
|
|
139020
139288
|
};
|
|
139021
139289
|
}
|
|
139022
139290
|
async function getDeadline() {
|
|
139023
|
-
const { getDeadline: getDeadline2 } = await import("./index-
|
|
139291
|
+
const { getDeadline: getDeadline2 } = await import("./index-EldBi9Vs.js").then((n) => n.i);
|
|
139024
139292
|
return getDeadline2();
|
|
139025
139293
|
}
|
|
139026
139294
|
const WORKFLOW_SERVER_SERVICE = {
|
|
@@ -143973,7 +144241,7 @@ const wsEventsChannelForInvocation = (runId, config2) => {
|
|
|
143973
144241
|
open() {
|
|
143974
144242
|
if (!runId || !isWsEventsTransportEnabled())
|
|
143975
144243
|
return;
|
|
143976
|
-
claim = import("./ws-transport-
|
|
144244
|
+
claim = import("./ws-transport-DUA3rYTp.js").then(({ openWsChannel }) => openWsChannel(runId, config2)).catch(() => void 0);
|
|
143977
144245
|
},
|
|
143978
144246
|
/**
|
|
143979
144247
|
* Awaited, unlike the open: work scheduled after the handler returns is not
|
|
@@ -145188,7 +145456,7 @@ function wsReplyStatus(reply, endpoint) {
|
|
|
145188
145456
|
return status;
|
|
145189
145457
|
}
|
|
145190
145458
|
async function postEventFrameOverWs(input, config2) {
|
|
145191
|
-
const { resolveWsTransport } = await import("./ws-transport-
|
|
145459
|
+
const { resolveWsTransport } = await import("./ws-transport-DUA3rYTp.js");
|
|
145192
145460
|
const { runId } = input;
|
|
145193
145461
|
const resolved = resolveWsTransport(runId, config2);
|
|
145194
145462
|
if (!resolved)
|
|
@@ -146125,7 +146393,34 @@ function createStorage(config2) {
|
|
|
146125
146393
|
hooks: instrumentObject("world.hooks", storage.hooks)
|
|
146126
146394
|
};
|
|
146127
146395
|
}
|
|
146128
|
-
const
|
|
146396
|
+
const MAX_CHUNKS_PER_STREAM_WRITE = 1e3;
|
|
146397
|
+
function normalizeStreamChunks(chunks) {
|
|
146398
|
+
const encoder2 = new TextEncoder();
|
|
146399
|
+
return chunks.map((chunk) => typeof chunk === "string" ? encoder2.encode(chunk) : chunk);
|
|
146400
|
+
}
|
|
146401
|
+
function encodeMultiChunks(chunks) {
|
|
146402
|
+
return encodeNormalizedMultiChunks(normalizeStreamChunks(chunks));
|
|
146403
|
+
}
|
|
146404
|
+
function encodeNormalizedMultiChunks(binaryChunks) {
|
|
146405
|
+
let totalSize = 0;
|
|
146406
|
+
for (const binary of binaryChunks) {
|
|
146407
|
+
totalSize += 4 + binary.length;
|
|
146408
|
+
if (totalSize > 4294967295) {
|
|
146409
|
+
throw new RangeError(`encoded stream chunks exceed the u32 body-length limit: ${totalSize} bytes`);
|
|
146410
|
+
}
|
|
146411
|
+
}
|
|
146412
|
+
const result = new Uint8Array(totalSize);
|
|
146413
|
+
const view = new DataView(result.buffer);
|
|
146414
|
+
let offset2 = 0;
|
|
146415
|
+
for (const binary of binaryChunks) {
|
|
146416
|
+
view.setUint32(offset2, binary.length, false);
|
|
146417
|
+
offset2 += 4;
|
|
146418
|
+
result.set(binary, offset2);
|
|
146419
|
+
offset2 += binary.length;
|
|
146420
|
+
}
|
|
146421
|
+
return result;
|
|
146422
|
+
}
|
|
146423
|
+
const MAX_CHUNKS_PER_REQUEST = MAX_CHUNKS_PER_STREAM_WRITE;
|
|
146129
146424
|
const getMaxChunksPerRequest = () => envNumber("WORKFLOW_MAX_CHUNKS_PER_REQUEST", MAX_CHUNKS_PER_REQUEST, {
|
|
146130
146425
|
integer: true,
|
|
146131
146426
|
min: 1
|
|
@@ -146169,26 +146464,6 @@ function createStreamRequestError(operation, url2, response2, text2) {
|
|
|
146169
146464
|
];
|
|
146170
146465
|
return new StreamError(`Stream ${operation} failed: HTTP ${response2.status} (${context.join("; ")}): ${text2}`, { url: url2.toString(), status: response2.status });
|
|
146171
146466
|
}
|
|
146172
|
-
function encodeMultiChunks(chunks) {
|
|
146173
|
-
const encoder2 = new TextEncoder();
|
|
146174
|
-
const binaryChunks = [];
|
|
146175
|
-
let totalSize = 0;
|
|
146176
|
-
for (const chunk of chunks) {
|
|
146177
|
-
const binary = typeof chunk === "string" ? encoder2.encode(chunk) : chunk;
|
|
146178
|
-
binaryChunks.push(binary);
|
|
146179
|
-
totalSize += 4 + binary.length;
|
|
146180
|
-
}
|
|
146181
|
-
const result = new Uint8Array(totalSize);
|
|
146182
|
-
const view = new DataView(result.buffer);
|
|
146183
|
-
let offset2 = 0;
|
|
146184
|
-
for (const binary of binaryChunks) {
|
|
146185
|
-
view.setUint32(offset2, binary.length, false);
|
|
146186
|
-
offset2 += 4;
|
|
146187
|
-
result.set(binary, offset2);
|
|
146188
|
-
offset2 += binary.length;
|
|
146189
|
-
}
|
|
146190
|
-
return result;
|
|
146191
|
-
}
|
|
146192
146467
|
const StreamInfoResponseSchema = object$1({
|
|
146193
146468
|
tailIndex: number$3(),
|
|
146194
146469
|
done: boolean$3()
|
|
@@ -146555,7 +146830,7 @@ globalSingleton("@workflow/core//devServerPort", 1, () => ({
|
|
|
146555
146830
|
inFlight: void 0
|
|
146556
146831
|
}));
|
|
146557
146832
|
function waitUntil(promise2) {
|
|
146558
|
-
void import("./index-
|
|
146833
|
+
void import("./index-EldBi9Vs.js").then((n) => n.i).then(({ waitUntil: waitUntil2 }) => {
|
|
146559
146834
|
waitUntil2(promise2);
|
|
146560
146835
|
});
|
|
146561
146836
|
}
|
|
@@ -149567,6 +149842,7 @@ function normalizeAttributeChanges(attrs, options = {}) {
|
|
|
149567
149842
|
return changes;
|
|
149568
149843
|
}
|
|
149569
149844
|
const CROSS_DEPLOYMENT_CAPABILITY_PROBE_TIMEOUT_MS = 2e3;
|
|
149845
|
+
const RETENTION_ZERO_ATTRIBUTE_VALUE = "0";
|
|
149570
149846
|
const ulid = monotonicFactory();
|
|
149571
149847
|
function resolveLineageAttributes() {
|
|
149572
149848
|
var _a3;
|
|
@@ -149665,11 +149941,23 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
149665
149941
|
});
|
|
149666
149942
|
attributes = Object.fromEntries(changes.map(({ key, value }) => [key, value]));
|
|
149667
149943
|
}
|
|
149944
|
+
let retentionAttribute;
|
|
149945
|
+
if (opts.experimental_retention !== void 0 && opts.experimental_retention !== "default") {
|
|
149946
|
+
if (opts.experimental_retention !== 0) {
|
|
149947
|
+
throw new WorkflowRuntimeError(`start({ experimental_retention }) must be 0 or 'default'; received ${JSON.stringify(opts.experimental_retention)}.`);
|
|
149948
|
+
}
|
|
149949
|
+
if (specVersion < SPEC_VERSION_SUPPORTS_ATTRIBUTES) {
|
|
149950
|
+
throw new WorkflowRuntimeError("start({ experimental_retention }) requires a World that supports spec version 4 or later.");
|
|
149951
|
+
}
|
|
149952
|
+
retentionAttribute = {
|
|
149953
|
+
[RETENTION_ATTRIBUTE]: RETENTION_ZERO_ATTRIBUTE_VALUE
|
|
149954
|
+
};
|
|
149955
|
+
}
|
|
149668
149956
|
const lineage = specVersion >= SPEC_VERSION_SUPPORTS_ATTRIBUTES ? resolveLineageAttributes() : void 0;
|
|
149669
|
-
const runAttributes = lineage ? { ...lineage, ...attributes } : attributes;
|
|
149957
|
+
const runAttributes = lineage || retentionAttribute ? { ...lineage, ...attributes, ...retentionAttribute } : attributes;
|
|
149670
149958
|
const attributeSeed = runAttributes ? {
|
|
149671
149959
|
attributes: runAttributes,
|
|
149672
|
-
...allowReservedAttributes || lineage != null ? { allowReservedAttributes: true } : {}
|
|
149960
|
+
...allowReservedAttributes || lineage != null || retentionAttribute != null ? { allowReservedAttributes: true } : {}
|
|
149673
149961
|
} : {};
|
|
149674
149962
|
if (opts.replayedFromRunId !== void 0 && !workflowRunIdSchema.safeParse(opts.replayedFromRunId).success) {
|
|
149675
149963
|
throw new WorkflowRuntimeError(`replayedFromRunId must be a run ID (wrun_<ulid>); received ${JSON.stringify(String(opts.replayedFromRunId).slice(0, 64))}.`);
|
|
@@ -149975,6 +150263,7 @@ const PAYLOAD_TERMINAL_RUN_STATUSES = /* @__PURE__ */ new Set([
|
|
|
149975
150263
|
"completed",
|
|
149976
150264
|
"failed"
|
|
149977
150265
|
]);
|
|
150266
|
+
const NOT_FOUND_RETRY_DELAYS = [1e3, 3e3, 6e3];
|
|
149978
150267
|
function getReturnValuePollIntervalMs() {
|
|
149979
150268
|
return envNumber("WORKFLOW_RETURN_VALUE_POLL_INTERVAL_MS", RETURN_VALUE_POLL_INTERVAL_MS, { integer: true, min: 1 });
|
|
149980
150269
|
}
|
|
@@ -150145,6 +150434,50 @@ const _Run = class _Run {
|
|
|
150145
150434
|
}
|
|
150146
150435
|
});
|
|
150147
150436
|
}
|
|
150437
|
+
/** The writable stream of the workflow run. */
|
|
150438
|
+
get writable() {
|
|
150439
|
+
return this.getWritable();
|
|
150440
|
+
}
|
|
150441
|
+
/**
|
|
150442
|
+
* Returns a writable that appends to this run's stream.
|
|
150443
|
+
*
|
|
150444
|
+
* Initialization is deferred until the first write. The run must already
|
|
150445
|
+
* exist. The writable may be forwarded through `start()` and into steps, but
|
|
150446
|
+
* grants no read access or additional authorization.
|
|
150447
|
+
*
|
|
150448
|
+
* @remarks
|
|
150449
|
+
* `writer.close()` closes the shared stream. Contributors should call
|
|
150450
|
+
* `releaseLock()`, which also drains pending writes.
|
|
150451
|
+
*
|
|
150452
|
+
* @param options - The writable stream options.
|
|
150453
|
+
*/
|
|
150454
|
+
getWritable(options = {}) {
|
|
150455
|
+
"use step";
|
|
150456
|
+
const { ops = [], global: global2 = globalThis, namespace: namespace2 } = options;
|
|
150457
|
+
const name2 = getWorkflowRunStreamId(this.runId, namespace2);
|
|
150458
|
+
let targetPromise;
|
|
150459
|
+
let writable;
|
|
150460
|
+
const resolveTarget = () => {
|
|
150461
|
+
targetPromise ?? (targetPromise = __privateMethod(this, _Run_instances, getMetadata_fn).call(this).then(async (run2) => {
|
|
150462
|
+
const target2 = {
|
|
150463
|
+
key: await getForwardedWritableEncryptionKey(this.runId, run2.deploymentId, run2.encryptionPublicKey),
|
|
150464
|
+
deploymentId: run2.deploymentId,
|
|
150465
|
+
encryptionPublicKey: run2.encryptionPublicKey
|
|
150466
|
+
};
|
|
150467
|
+
tagForwardedWritableTarget(writable, target2);
|
|
150468
|
+
return target2;
|
|
150469
|
+
}));
|
|
150470
|
+
return targetPromise;
|
|
150471
|
+
};
|
|
150472
|
+
writable = createForwardedWritable({
|
|
150473
|
+
global: global2,
|
|
150474
|
+
ops,
|
|
150475
|
+
runId: this.runId,
|
|
150476
|
+
name: name2,
|
|
150477
|
+
key: () => resolveTarget().then(({ key }) => key)
|
|
150478
|
+
});
|
|
150479
|
+
return writable;
|
|
150480
|
+
}
|
|
150148
150481
|
};
|
|
150149
150482
|
_worldPromise = new WeakMap();
|
|
150150
150483
|
_Run_instances = new WeakSet();
|
|
@@ -150182,7 +150515,28 @@ getEncryptionKey_fn = function(run2) {
|
|
|
150182
150515
|
getEncryptionKeyLazily_fn = function() {
|
|
150183
150516
|
return () => __privateMethod(this, _Run_instances, getEncryptionKey_fn).call(this);
|
|
150184
150517
|
};
|
|
150518
|
+
getMetadata_fn = async function() {
|
|
150519
|
+
const world = await __privateGet(this, _Run_instances, lazyWorldPromise_get);
|
|
150520
|
+
const maxRetries = __privateGet(this, _resilientStart) ? NOT_FOUND_RETRY_DELAYS.length : 0;
|
|
150521
|
+
let attempt = 0;
|
|
150522
|
+
while (true) {
|
|
150523
|
+
try {
|
|
150524
|
+
return await world.runs.get(this.runId, { resolveData: "none" });
|
|
150525
|
+
} catch (error2) {
|
|
150526
|
+
if (!WorkflowRunNotFoundError.is(error2) || attempt >= maxRetries) {
|
|
150527
|
+
throw error2;
|
|
150528
|
+
}
|
|
150529
|
+
const delay = NOT_FOUND_RETRY_DELAYS[attempt];
|
|
150530
|
+
attempt++;
|
|
150531
|
+
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
150532
|
+
}
|
|
150533
|
+
}
|
|
150534
|
+
};
|
|
150185
150535
|
resolveTerminalReturnValue_fn = async function(run2) {
|
|
150536
|
+
const expiredAt = run2.expiredAt;
|
|
150537
|
+
if (expiredAt != null && expiredAt <= /* @__PURE__ */ new Date()) {
|
|
150538
|
+
throw new RunExpiredError(`Run "${this.runId}" ${run2.status === "completed" ? "completed" : `is ${run2.status}`}, but its data expired at ${expiredAt.toISOString()} and is no longer readable.`, this.runId, run2.status, expiredAt);
|
|
150539
|
+
}
|
|
150186
150540
|
if (run2.status === "completed") {
|
|
150187
150541
|
const encryptionKey = await __privateMethod(this, _Run_instances, getEncryptionKey_fn).call(this, run2);
|
|
150188
150542
|
return await hydrateWorkflowReturnValue(run2.output, this.runId, encryptionKey);
|
|
@@ -150208,8 +150562,7 @@ pollReturnValue_fn = async function() {
|
|
|
150208
150562
|
var _a3;
|
|
150209
150563
|
const world = await __privateGet(this, _Run_instances, lazyWorldPromise_get);
|
|
150210
150564
|
let notFoundRetries = 0;
|
|
150211
|
-
const NOT_FOUND_MAX_RETRIES = __privateGet(this, _resilientStart) ?
|
|
150212
|
-
const NOT_FOUND_DELAYS = [1e3, 3e3, 6e3];
|
|
150565
|
+
const NOT_FOUND_MAX_RETRIES = __privateGet(this, _resilientStart) ? NOT_FOUND_RETRY_DELAYS.length : 0;
|
|
150213
150566
|
const waitForTerminalStatus = isReturnValueLongPollEnabled() ? (_a3 = world.runs.waitForTerminalStatus) == null ? void 0 : _a3.bind(world.runs) : void 0;
|
|
150214
150567
|
let longPolls = 0;
|
|
150215
150568
|
const maxLongPolls = getReturnValueMaxLongPolls();
|
|
@@ -150244,7 +150597,7 @@ pollReturnValue_fn = async function() {
|
|
|
150244
150597
|
continue;
|
|
150245
150598
|
}
|
|
150246
150599
|
if (WorkflowRunNotFoundError.is(error2) && notFoundRetries < NOT_FOUND_MAX_RETRIES) {
|
|
150247
|
-
const delay =
|
|
150600
|
+
const delay = NOT_FOUND_RETRY_DELAYS[notFoundRetries];
|
|
150248
150601
|
notFoundRetries++;
|
|
150249
150602
|
await new Promise((resolve2) => setTimeout(resolve2, delay));
|
|
150250
150603
|
continue;
|
|
@@ -173601,7 +173954,7 @@ function createFetchHandler(basename2 = "/") {
|
|
|
173601
173954
|
return (request2) => handler(request2, loadContext);
|
|
173602
173955
|
}
|
|
173603
173956
|
export {
|
|
173604
|
-
|
|
173957
|
+
RUN_ENTITY_KEY as $,
|
|
173605
173958
|
ANALYTICS_EVENTS_GET_MANY_LIMIT as A,
|
|
173606
173959
|
BULK_CANCEL_MAX_RUN_IDS as B,
|
|
173607
173960
|
CHILD_ENTITY_CREATION_EVENT_TYPES as C,
|
|
@@ -173625,104 +173978,108 @@ export {
|
|
|
173625
173978
|
QueuePayloadSchema as U,
|
|
173626
173979
|
QueuePrefix as V,
|
|
173627
173980
|
RESERVED_ATTRIBUTE_KEY_PREFIX as W,
|
|
173628
|
-
|
|
173629
|
-
|
|
173630
|
-
|
|
173631
|
-
|
|
173981
|
+
RETENTION_ATTRIBUTE as X,
|
|
173982
|
+
RETENTION_DEFAULT as Y,
|
|
173983
|
+
RETENTION_ZERO as Z,
|
|
173984
|
+
ROOT_RUN_ID_ATTRIBUTE as _,
|
|
173632
173985
|
ANALYTICS_MAX_ATTRIBUTE_FILTERS as a,
|
|
173633
|
-
|
|
173634
|
-
|
|
173635
|
-
|
|
173636
|
-
|
|
173637
|
-
|
|
173638
|
-
|
|
173639
|
-
|
|
173640
|
-
|
|
173641
|
-
|
|
173642
|
-
|
|
173643
|
-
|
|
173644
|
-
|
|
173645
|
-
|
|
173646
|
-
|
|
173647
|
-
|
|
173648
|
-
|
|
173649
|
-
|
|
173650
|
-
|
|
173651
|
-
|
|
173652
|
-
|
|
173653
|
-
|
|
173654
|
-
|
|
173655
|
-
|
|
173656
|
-
|
|
173657
|
-
|
|
173658
|
-
|
|
173659
|
-
|
|
173660
|
-
|
|
173661
|
-
|
|
173662
|
-
|
|
173663
|
-
|
|
173664
|
-
|
|
173665
|
-
|
|
173666
|
-
|
|
173667
|
-
|
|
173668
|
-
|
|
173669
|
-
|
|
173670
|
-
|
|
173671
|
-
|
|
173672
|
-
|
|
173673
|
-
|
|
173674
|
-
|
|
173675
|
-
|
|
173676
|
-
|
|
173677
|
-
|
|
173678
|
-
|
|
173679
|
-
|
|
173680
|
-
|
|
173681
|
-
|
|
173682
|
-
|
|
173683
|
-
|
|
173684
|
-
|
|
173685
|
-
|
|
173686
|
-
|
|
173687
|
-
|
|
173688
|
-
|
|
173689
|
-
|
|
173690
|
-
|
|
173691
|
-
|
|
173692
|
-
|
|
173693
|
-
|
|
173694
|
-
|
|
173695
|
-
|
|
173696
|
-
|
|
173986
|
+
stripEventDataRefs as a$,
|
|
173987
|
+
RunInputSchema as a0,
|
|
173988
|
+
SEALED_LOG_ENV_VAR as a1,
|
|
173989
|
+
SPEC_VERSION_CURRENT as a2,
|
|
173990
|
+
SPEC_VERSION_LEGACY as a3,
|
|
173991
|
+
SPEC_VERSION_MAX_SUPPORTED as a4,
|
|
173992
|
+
SPEC_VERSION_SUPPORTS_ATTRIBUTES as a5,
|
|
173993
|
+
SPEC_VERSION_SUPPORTS_CBOR_QUEUE_TRANSPORT as a6,
|
|
173994
|
+
SPEC_VERSION_SUPPORTS_COMPRESSION as a7,
|
|
173995
|
+
SPEC_VERSION_SUPPORTS_SEALED_LOG as a8,
|
|
173996
|
+
SPEC_VERSION_SUPPORTS_SLOT_IDENTITY as a9,
|
|
173997
|
+
eventIdToSlot as aA,
|
|
173998
|
+
getEventDataPayloadField as aB,
|
|
173999
|
+
getEventDataRefFields as aC,
|
|
174000
|
+
getMaxEventsPerRun as aD,
|
|
174001
|
+
getQueueTopicPrefix as aE,
|
|
174002
|
+
isChildEntityCreationEvent as aF,
|
|
174003
|
+
isChildEntityCreationEventType as aG,
|
|
174004
|
+
isHookEventRequiringExistence as aH,
|
|
174005
|
+
isHookLifecycleEventType as aI,
|
|
174006
|
+
isLegacySpecVersion as aJ,
|
|
174007
|
+
isNodeHttpEnabled as aK,
|
|
174008
|
+
isSealedNoopEvent$1 as aL,
|
|
174009
|
+
isSlotBody as aM,
|
|
174010
|
+
isSlotEventId as aN,
|
|
174011
|
+
isStepEventType as aO,
|
|
174012
|
+
isTerminalRunEventType as aP,
|
|
174013
|
+
isTerminalStepEventType as aQ,
|
|
174014
|
+
isTerminalStepStatus as aR,
|
|
174015
|
+
isTerminalWorkflowRunStatus as aS,
|
|
174016
|
+
isWaitEventType as aT,
|
|
174017
|
+
mintedSpecVersion as aU,
|
|
174018
|
+
parseQueueName as aV,
|
|
174019
|
+
readRunRetention as aW,
|
|
174020
|
+
reenqueueActiveRuns as aX,
|
|
174021
|
+
requiresNewerWorld as aY,
|
|
174022
|
+
resolveQueueNamespace as aZ,
|
|
174023
|
+
slotToEventId as a_,
|
|
174024
|
+
STEP_EVENT_TYPES as aa,
|
|
174025
|
+
SerializedDataSchema as ab,
|
|
174026
|
+
StepSchema as ac,
|
|
174027
|
+
StepStatusSchema as ad,
|
|
174028
|
+
StructuredErrorSchema as ae,
|
|
174029
|
+
TERMINAL_EVENT_CLASSES as af,
|
|
174030
|
+
TERMINAL_RUN_EVENT_TYPES as ag,
|
|
174031
|
+
TERMINAL_STEP_EVENT_TYPES as ah,
|
|
174032
|
+
TERMINAL_STEP_STATUSES as ai,
|
|
174033
|
+
TERMINAL_WORKFLOW_RUN_STATUSES as aj,
|
|
174034
|
+
TerminalRunEventTypeSchema as ak,
|
|
174035
|
+
TerminalStepStatusSchema as al,
|
|
174036
|
+
TerminalWorkflowRunStatusSchema as am,
|
|
174037
|
+
ValidQueueName as an,
|
|
174038
|
+
WAIT_EVENT_TYPES as ao,
|
|
174039
|
+
WaitSchema as ap,
|
|
174040
|
+
WaitStatusSchema as aq,
|
|
174041
|
+
WorkflowInvokePayloadSchema as ar,
|
|
174042
|
+
WorkflowRunBaseSchema as as,
|
|
174043
|
+
WorkflowRunSchema as at,
|
|
174044
|
+
WorkflowRunStatusSchema as au,
|
|
174045
|
+
applyAttributeChanges as av,
|
|
174046
|
+
classifyEntityEvent as aw,
|
|
174047
|
+
entityEventClass as ax,
|
|
174048
|
+
envFlag as ay,
|
|
174049
|
+
envNumber as az,
|
|
173697
174050
|
ANALYTICS_PAGE_LIMIT as b,
|
|
173698
|
-
|
|
173699
|
-
|
|
173700
|
-
|
|
173701
|
-
|
|
173702
|
-
|
|
173703
|
-
|
|
173704
|
-
|
|
173705
|
-
|
|
173706
|
-
|
|
173707
|
-
|
|
173708
|
-
|
|
173709
|
-
|
|
173710
|
-
|
|
173711
|
-
|
|
173712
|
-
|
|
173713
|
-
|
|
173714
|
-
|
|
173715
|
-
|
|
173716
|
-
|
|
173717
|
-
|
|
173718
|
-
|
|
173719
|
-
|
|
173720
|
-
|
|
173721
|
-
|
|
173722
|
-
|
|
173723
|
-
|
|
173724
|
-
|
|
173725
|
-
|
|
174051
|
+
ulidToDate as b0,
|
|
174052
|
+
validateAttributeChanges as b1,
|
|
174053
|
+
validateUlidTimestamp as b2,
|
|
174054
|
+
workflowRunIdSchema as b3,
|
|
174055
|
+
reactExports as b4,
|
|
174056
|
+
R as b5,
|
|
174057
|
+
Ks as b6,
|
|
174058
|
+
jsxRuntimeExports as b7,
|
|
174059
|
+
Qe as b8,
|
|
174060
|
+
registerZstdDecoder as b9,
|
|
174061
|
+
isWsEventsTransportEnabled as ba,
|
|
174062
|
+
debugLog as bb,
|
|
174063
|
+
getHttpUrl as bc,
|
|
174064
|
+
globalSingleton as bd,
|
|
174065
|
+
version as be,
|
|
174066
|
+
getHttpConfig as bf,
|
|
174067
|
+
headersToRecord as bg,
|
|
174068
|
+
getRequestTimeoutMs as bh,
|
|
174069
|
+
injectTraceContextIntoHeaders as bi,
|
|
174070
|
+
withHttpClientSpan as bj,
|
|
174071
|
+
ErrorType as bk,
|
|
174072
|
+
WorkflowWsReconnectAttempt as bl,
|
|
174073
|
+
NetworkProtocolName as bm,
|
|
174074
|
+
WorkflowEventsTransport as bn,
|
|
174075
|
+
distExports as bo,
|
|
174076
|
+
decodeFrames as bp,
|
|
174077
|
+
getDefaultExportFromCjs as bq,
|
|
174078
|
+
requireTokenUtil as br,
|
|
174079
|
+
requireTokenError as bs,
|
|
174080
|
+
getAugmentedNamespace as bt,
|
|
174081
|
+
app as bu,
|
|
174082
|
+
createFetchHandler as bv,
|
|
173726
174083
|
ANALYTICS_RUN_SCOPED_PAGE_LIMIT as c,
|
|
173727
174084
|
ATTRIBUTE_KEY_MAX_LENGTH as d,
|
|
173728
174085
|
ATTRIBUTE_MAX_PER_RUN as e,
|