@workflow/web 4.1.0-beta.37 → 4.1.0-beta.38

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (20) hide show
  1. package/build/client/assets/{highlighted-body-B3W2YXNL-BO6bNJzI.js → highlighted-body-B3W2YXNL-Rt-vkvmE.js} +1 -1
  2. package/build/client/assets/{home-bWDrLREI.js → home-Cpz2_ZDM.js} +1 -1
  3. package/build/client/assets/manifest-069935e6.js +1 -0
  4. package/build/client/assets/{mermaid-3ZIDBTTL-CJ6mkUFN.js → mermaid-3ZIDBTTL-DcdZu9sS.js} +3 -3
  5. package/build/client/assets/{root-Ckv-c9_b.js → root-DZgYUaDo.js} +1 -1
  6. package/build/client/assets/run-detail-xcvWVR2B.js +41 -0
  7. package/build/client/assets/{use-workflow-graph-JKiMb5g6.js → use-workflow-graph-CF7nLapT.js} +1 -1
  8. package/build/server/assets/{app-CatvtWxS.js → app-B9Eg2ZwJ.js} +1 -1
  9. package/build/server/assets/{highlighted-body-B3W2YXNL-DoOhy3wX.js → highlighted-body-B3W2YXNL-CppXFHRG.js} +3 -3
  10. package/build/server/assets/{mermaid-3ZIDBTTL-uuxw6-ur.js → mermaid-3ZIDBTTL-DB0PiTjt.js} +3 -3
  11. package/build/server/assets/{server-build-XXW48t5z.js → server-build-HMYt9inG.js} +314 -278
  12. package/build/server/assets/{token-CLFHo1Az.js → token-CBxSSoxh.js} +2 -2
  13. package/build/server/assets/{token-C58qysN7.js → token-COnBvzNW.js} +3 -3
  14. package/build/server/assets/{token-util-CcopqG1U.js → token-util-7Q4_oN66.js} +2 -2
  15. package/build/server/assets/{token-util-C6iVpF77.js → token-util-CagM_XOH.js} +2 -2
  16. package/build/server/assets/{token-util-CbxhzlWz.js → token-util-QvbM3ECv.js} +1 -1
  17. package/build/server/index.js +1 -1
  18. package/package.json +6 -6
  19. package/build/client/assets/manifest-daa82ff1.js +0 -1
  20. package/build/client/assets/run-detail-EcdnCjQk.js +0 -41
@@ -14,7 +14,7 @@ var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "
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
16
  var _a2, _reader;
17
- import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, M as Meta, L as Links, d as ScrollRestoration, e as Scripts, O as Outlet, u as useNavigate, f as useSearchParams, h as Link$1, i as useLocation, j as useParams } from "./app-CatvtWxS.js";
17
+ import { a as requireReact, S as ServerRouter, c as createReadableStreamFromReadable, r as reactExports, g as getDefaultExportFromCjs, R as React, b as ReactExports, w as withComponentProps, M as Meta, L as Links, d as ScrollRestoration, e as Scripts, O as Outlet, u as useNavigate, f as useSearchParams, h as Link$1, i as useLocation, j as useParams } from "./app-B9Eg2ZwJ.js";
18
18
  import require$$0$4, { PassThrough } from "node:stream";
19
19
  import require$$0 from "util";
20
20
  import require$$1$1 from "crypto";
@@ -24,10 +24,10 @@ import minproc from "node:process";
24
24
  import path$2, { join as join$1, resolve, dirname, isAbsolute, sep } from "node:path";
25
25
  import { fileURLToPath } from "node:url";
26
26
  import { createRequire } from "module";
27
- import require$$0$8, { readdir, readlink, readFile, mkdir, access, constants as constants$5, writeFile, unlink } from "node:fs/promises";
27
+ import require$$0$8, { readdir, readlink, readFile, mkdir, access, constants as constants$5, writeFile, unlink, rm } from "node:fs/promises";
28
+ import crypto, { webcrypto } from "node:crypto";
28
29
  import require$$1$2 from "tty";
29
30
  import require$$0$1 from "os";
30
- import crypto, { webcrypto } from "node:crypto";
31
31
  import { createRequire as createRequire$1 } from "node:module";
32
32
  import { execFile } from "node:child_process";
33
33
  import require$$3, { promisify, inspect, types as types$2 } from "node:util";
@@ -64424,7 +64424,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
64424
64424
  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 });
64425
64425
  var Se = reactExports.createContext({ code: "" }), de$1 = () => reactExports.useContext(Se);
64426
64426
  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 }) });
64427
- var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-DoOhy3wX.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
64427
+ var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-CppXFHRG.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
64428
64428
  let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
64429
64429
  `).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
64430
64430
  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 }) })] }) });
@@ -64746,7 +64746,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
64746
64746
  }, []), 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] });
64747
64747
  };
64748
64748
  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 }) })] });
64749
- var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-uuxw6-ur.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
64749
+ var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-DB0PiTjt.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
64750
64750
  function ke(e, t) {
64751
64751
  if (!(e != null && e.position || t != null && t.position)) return true;
64752
64752
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -87334,6 +87334,174 @@ const WaitSchema = object$1({
87334
87334
  updatedAt: date$2(),
87335
87335
  specVersion: number$1().optional()
87336
87336
  });
87337
+ const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
87338
+ const ENCODING_LEN = 32;
87339
+ const RANDOM_LEN = 16;
87340
+ const TIME_LEN = 10;
87341
+ const TIME_MAX = 281474976710655;
87342
+ var ULIDErrorCode;
87343
+ (function(ULIDErrorCode2) {
87344
+ ULIDErrorCode2["Base32IncorrectEncoding"] = "B32_ENC_INVALID";
87345
+ ULIDErrorCode2["DecodeTimeInvalidCharacter"] = "DEC_TIME_CHAR";
87346
+ ULIDErrorCode2["DecodeTimeValueMalformed"] = "DEC_TIME_MALFORMED";
87347
+ ULIDErrorCode2["EncodeTimeNegative"] = "ENC_TIME_NEG";
87348
+ ULIDErrorCode2["EncodeTimeSizeExceeded"] = "ENC_TIME_SIZE_EXCEED";
87349
+ ULIDErrorCode2["EncodeTimeValueMalformed"] = "ENC_TIME_MALFORMED";
87350
+ ULIDErrorCode2["PRNGDetectFailure"] = "PRNG_DETECT";
87351
+ ULIDErrorCode2["ULIDInvalid"] = "ULID_INVALID";
87352
+ ULIDErrorCode2["Unexpected"] = "UNEXPECTED";
87353
+ ULIDErrorCode2["UUIDInvalid"] = "UUID_INVALID";
87354
+ })(ULIDErrorCode || (ULIDErrorCode = {}));
87355
+ class ULIDError extends Error {
87356
+ constructor(errorCode, message2) {
87357
+ super(`${message2} (${errorCode})`);
87358
+ this.name = "ULIDError";
87359
+ this.code = errorCode;
87360
+ }
87361
+ }
87362
+ function randomChar(prng) {
87363
+ const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
87364
+ return ENCODING.charAt(randomPosition);
87365
+ }
87366
+ function replaceCharAt(str, index2, char) {
87367
+ if (index2 > str.length - 1) {
87368
+ return str;
87369
+ }
87370
+ return str.substr(0, index2) + char + str.substr(index2 + 1);
87371
+ }
87372
+ function incrementBase32(str) {
87373
+ let done = void 0, index2 = str.length, char, charIndex, output = str;
87374
+ const maxCharIndex = ENCODING_LEN - 1;
87375
+ while (!done && index2-- >= 0) {
87376
+ char = output[index2];
87377
+ charIndex = ENCODING.indexOf(char);
87378
+ if (charIndex === -1) {
87379
+ throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Incorrectly encoded string");
87380
+ }
87381
+ if (charIndex === maxCharIndex) {
87382
+ output = replaceCharAt(output, index2, ENCODING[0]);
87383
+ continue;
87384
+ }
87385
+ done = replaceCharAt(output, index2, ENCODING[charIndex + 1]);
87386
+ }
87387
+ if (typeof done === "string") {
87388
+ return done;
87389
+ }
87390
+ throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Failed incrementing string");
87391
+ }
87392
+ function decodeTime(id2) {
87393
+ if (id2.length !== TIME_LEN + RANDOM_LEN) {
87394
+ throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, "Malformed ULID");
87395
+ }
87396
+ const time2 = id2.substr(0, TIME_LEN).toUpperCase().split("").reverse().reduce((carry, char, index2) => {
87397
+ const encodingIndex = ENCODING.indexOf(char);
87398
+ if (encodingIndex === -1) {
87399
+ throw new ULIDError(ULIDErrorCode.DecodeTimeInvalidCharacter, `Time decode error: Invalid character: ${char}`);
87400
+ }
87401
+ return carry += encodingIndex * Math.pow(ENCODING_LEN, index2);
87402
+ }, 0);
87403
+ if (time2 > TIME_MAX) {
87404
+ throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, `Malformed ULID: timestamp too large: ${time2}`);
87405
+ }
87406
+ return time2;
87407
+ }
87408
+ function detectPRNG(root2) {
87409
+ var _a3;
87410
+ const rootLookup = detectRoot();
87411
+ const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || (typeof crypto !== "undefined" ? crypto : null);
87412
+ if (typeof (globalCrypto == null ? void 0 : globalCrypto.getRandomValues) === "function") {
87413
+ return () => {
87414
+ const buffer = new Uint8Array(1);
87415
+ globalCrypto.getRandomValues(buffer);
87416
+ return buffer[0] / 255;
87417
+ };
87418
+ } else if (typeof (globalCrypto == null ? void 0 : globalCrypto.randomBytes) === "function") {
87419
+ return () => globalCrypto.randomBytes(1).readUInt8() / 255;
87420
+ } else if ((_a3 = crypto) == null ? void 0 : _a3.randomBytes) {
87421
+ return () => crypto.randomBytes(1).readUInt8() / 255;
87422
+ }
87423
+ throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
87424
+ }
87425
+ function detectRoot() {
87426
+ if (inWebWorker())
87427
+ return self;
87428
+ if (typeof window !== "undefined") {
87429
+ return window;
87430
+ }
87431
+ if (typeof global !== "undefined") {
87432
+ return global;
87433
+ }
87434
+ if (typeof globalThis !== "undefined") {
87435
+ return globalThis;
87436
+ }
87437
+ return null;
87438
+ }
87439
+ function encodeRandom(len, prng) {
87440
+ let str = "";
87441
+ for (; len > 0; len--) {
87442
+ str = randomChar(prng) + str;
87443
+ }
87444
+ return str;
87445
+ }
87446
+ function encodeTime(now2, len = TIME_LEN) {
87447
+ if (isNaN(now2)) {
87448
+ throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be a number: ${now2}`);
87449
+ } else if (now2 > TIME_MAX) {
87450
+ throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${TIME_MAX}: ${now2}`);
87451
+ } else if (now2 < 0) {
87452
+ throw new ULIDError(ULIDErrorCode.EncodeTimeNegative, `Time must be positive: ${now2}`);
87453
+ } else if (Number.isInteger(now2) === false) {
87454
+ throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be an integer: ${now2}`);
87455
+ }
87456
+ let mod, str = "";
87457
+ for (let currentLen = len; currentLen > 0; currentLen--) {
87458
+ mod = now2 % ENCODING_LEN;
87459
+ str = ENCODING.charAt(mod) + str;
87460
+ now2 = (now2 - mod) / ENCODING_LEN;
87461
+ }
87462
+ return str;
87463
+ }
87464
+ function inWebWorker() {
87465
+ return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
87466
+ }
87467
+ function monotonicFactory(prng) {
87468
+ const currentPRNG = prng || detectPRNG();
87469
+ let lastTime = 0, lastRandom;
87470
+ return function _ulid2(seedTime) {
87471
+ const seed = !seedTime || isNaN(seedTime) ? Date.now() : seedTime;
87472
+ if (seed <= lastTime) {
87473
+ const incrementedRandom = lastRandom = incrementBase32(lastRandom);
87474
+ return encodeTime(lastTime, TIME_LEN) + incrementedRandom;
87475
+ }
87476
+ lastTime = seed;
87477
+ const newRandom = lastRandom = encodeRandom(RANDOM_LEN, currentPRNG);
87478
+ return encodeTime(seed, TIME_LEN) + newRandom;
87479
+ };
87480
+ }
87481
+ const UlidSchema = string$1().ulid();
87482
+ const DEFAULT_TIMESTAMP_THRESHOLD_MS = 5 * 60 * 1e3;
87483
+ function ulidToDate(maybeUlid) {
87484
+ const ulid2 = UlidSchema.safeParse(maybeUlid);
87485
+ if (!ulid2.success) {
87486
+ return null;
87487
+ }
87488
+ return new Date(decodeTime(ulid2.data));
87489
+ }
87490
+ function validateUlidTimestamp(prefixedUlid, prefix, thresholdMs = DEFAULT_TIMESTAMP_THRESHOLD_MS) {
87491
+ const raw2 = prefixedUlid.startsWith(prefix) ? prefixedUlid.slice(prefix.length) : prefixedUlid;
87492
+ const ulidTimestamp = ulidToDate(raw2);
87493
+ if (!ulidTimestamp) {
87494
+ return `Invalid runId: "${prefixedUlid}" is not a valid ULID`;
87495
+ }
87496
+ const serverTimestamp = /* @__PURE__ */ new Date();
87497
+ const driftMs = Math.abs(serverTimestamp.getTime() - ulidTimestamp.getTime());
87498
+ if (driftMs <= thresholdMs) {
87499
+ return null;
87500
+ }
87501
+ const driftSeconds = Math.round(driftMs / 1e3);
87502
+ const thresholdSeconds = Math.round(thresholdMs / 1e3);
87503
+ return `Invalid runId timestamp: embedded timestamp differs from server time by ${driftSeconds}s (threshold: ${thresholdSeconds}s)`;
87504
+ }
87337
87505
  const NONCE_LENGTH = 12;
87338
87506
  const TAG_LENGTH = 128;
87339
87507
  const KEY_LENGTH = 32;
@@ -88293,150 +88461,6 @@ const runtimeLogger = createLogger("runtime");
88293
88461
  createLogger("webhook");
88294
88462
  createLogger("events");
88295
88463
  createLogger("adapter");
88296
- const ENCODING = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
88297
- const ENCODING_LEN = 32;
88298
- const RANDOM_LEN = 16;
88299
- const TIME_LEN = 10;
88300
- const TIME_MAX = 281474976710655;
88301
- var ULIDErrorCode;
88302
- (function(ULIDErrorCode2) {
88303
- ULIDErrorCode2["Base32IncorrectEncoding"] = "B32_ENC_INVALID";
88304
- ULIDErrorCode2["DecodeTimeInvalidCharacter"] = "DEC_TIME_CHAR";
88305
- ULIDErrorCode2["DecodeTimeValueMalformed"] = "DEC_TIME_MALFORMED";
88306
- ULIDErrorCode2["EncodeTimeNegative"] = "ENC_TIME_NEG";
88307
- ULIDErrorCode2["EncodeTimeSizeExceeded"] = "ENC_TIME_SIZE_EXCEED";
88308
- ULIDErrorCode2["EncodeTimeValueMalformed"] = "ENC_TIME_MALFORMED";
88309
- ULIDErrorCode2["PRNGDetectFailure"] = "PRNG_DETECT";
88310
- ULIDErrorCode2["ULIDInvalid"] = "ULID_INVALID";
88311
- ULIDErrorCode2["Unexpected"] = "UNEXPECTED";
88312
- ULIDErrorCode2["UUIDInvalid"] = "UUID_INVALID";
88313
- })(ULIDErrorCode || (ULIDErrorCode = {}));
88314
- class ULIDError extends Error {
88315
- constructor(errorCode, message2) {
88316
- super(`${message2} (${errorCode})`);
88317
- this.name = "ULIDError";
88318
- this.code = errorCode;
88319
- }
88320
- }
88321
- function randomChar(prng) {
88322
- const randomPosition = Math.floor(prng() * ENCODING_LEN) % ENCODING_LEN;
88323
- return ENCODING.charAt(randomPosition);
88324
- }
88325
- function replaceCharAt(str, index2, char) {
88326
- if (index2 > str.length - 1) {
88327
- return str;
88328
- }
88329
- return str.substr(0, index2) + char + str.substr(index2 + 1);
88330
- }
88331
- function incrementBase32(str) {
88332
- let done = void 0, index2 = str.length, char, charIndex, output = str;
88333
- const maxCharIndex = ENCODING_LEN - 1;
88334
- while (!done && index2-- >= 0) {
88335
- char = output[index2];
88336
- charIndex = ENCODING.indexOf(char);
88337
- if (charIndex === -1) {
88338
- throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Incorrectly encoded string");
88339
- }
88340
- if (charIndex === maxCharIndex) {
88341
- output = replaceCharAt(output, index2, ENCODING[0]);
88342
- continue;
88343
- }
88344
- done = replaceCharAt(output, index2, ENCODING[charIndex + 1]);
88345
- }
88346
- if (typeof done === "string") {
88347
- return done;
88348
- }
88349
- throw new ULIDError(ULIDErrorCode.Base32IncorrectEncoding, "Failed incrementing string");
88350
- }
88351
- function decodeTime(id2) {
88352
- if (id2.length !== TIME_LEN + RANDOM_LEN) {
88353
- throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, "Malformed ULID");
88354
- }
88355
- const time2 = id2.substr(0, TIME_LEN).toUpperCase().split("").reverse().reduce((carry, char, index2) => {
88356
- const encodingIndex = ENCODING.indexOf(char);
88357
- if (encodingIndex === -1) {
88358
- throw new ULIDError(ULIDErrorCode.DecodeTimeInvalidCharacter, `Time decode error: Invalid character: ${char}`);
88359
- }
88360
- return carry += encodingIndex * Math.pow(ENCODING_LEN, index2);
88361
- }, 0);
88362
- if (time2 > TIME_MAX) {
88363
- throw new ULIDError(ULIDErrorCode.DecodeTimeValueMalformed, `Malformed ULID: timestamp too large: ${time2}`);
88364
- }
88365
- return time2;
88366
- }
88367
- function detectPRNG(root2) {
88368
- var _a3;
88369
- const rootLookup = detectRoot();
88370
- const globalCrypto = rootLookup && (rootLookup.crypto || rootLookup.msCrypto) || (typeof crypto !== "undefined" ? crypto : null);
88371
- if (typeof (globalCrypto == null ? void 0 : globalCrypto.getRandomValues) === "function") {
88372
- return () => {
88373
- const buffer = new Uint8Array(1);
88374
- globalCrypto.getRandomValues(buffer);
88375
- return buffer[0] / 255;
88376
- };
88377
- } else if (typeof (globalCrypto == null ? void 0 : globalCrypto.randomBytes) === "function") {
88378
- return () => globalCrypto.randomBytes(1).readUInt8() / 255;
88379
- } else if ((_a3 = crypto) == null ? void 0 : _a3.randomBytes) {
88380
- return () => crypto.randomBytes(1).readUInt8() / 255;
88381
- }
88382
- throw new ULIDError(ULIDErrorCode.PRNGDetectFailure, "Failed to find a reliable PRNG");
88383
- }
88384
- function detectRoot() {
88385
- if (inWebWorker())
88386
- return self;
88387
- if (typeof window !== "undefined") {
88388
- return window;
88389
- }
88390
- if (typeof global !== "undefined") {
88391
- return global;
88392
- }
88393
- if (typeof globalThis !== "undefined") {
88394
- return globalThis;
88395
- }
88396
- return null;
88397
- }
88398
- function encodeRandom(len, prng) {
88399
- let str = "";
88400
- for (; len > 0; len--) {
88401
- str = randomChar(prng) + str;
88402
- }
88403
- return str;
88404
- }
88405
- function encodeTime(now2, len = TIME_LEN) {
88406
- if (isNaN(now2)) {
88407
- throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be a number: ${now2}`);
88408
- } else if (now2 > TIME_MAX) {
88409
- throw new ULIDError(ULIDErrorCode.EncodeTimeSizeExceeded, `Cannot encode a time larger than ${TIME_MAX}: ${now2}`);
88410
- } else if (now2 < 0) {
88411
- throw new ULIDError(ULIDErrorCode.EncodeTimeNegative, `Time must be positive: ${now2}`);
88412
- } else if (Number.isInteger(now2) === false) {
88413
- throw new ULIDError(ULIDErrorCode.EncodeTimeValueMalformed, `Time must be an integer: ${now2}`);
88414
- }
88415
- let mod, str = "";
88416
- for (let currentLen = len; currentLen > 0; currentLen--) {
88417
- mod = now2 % ENCODING_LEN;
88418
- str = ENCODING.charAt(mod) + str;
88419
- now2 = (now2 - mod) / ENCODING_LEN;
88420
- }
88421
- return str;
88422
- }
88423
- function inWebWorker() {
88424
- return typeof WorkerGlobalScope !== "undefined" && self instanceof WorkerGlobalScope;
88425
- }
88426
- function monotonicFactory(prng) {
88427
- const currentPRNG = prng || detectPRNG();
88428
- let lastTime = 0, lastRandom;
88429
- return function _ulid2(seedTime) {
88430
- const seed = !seedTime || isNaN(seedTime) ? Date.now() : seedTime;
88431
- if (seed <= lastTime) {
88432
- const incrementedRandom = lastRandom = incrementBase32(lastRandom);
88433
- return encodeTime(lastTime, TIME_LEN) + incrementedRandom;
88434
- }
88435
- lastTime = seed;
88436
- const newRandom = lastRandom = encodeRandom(RANDOM_LEN, currentPRNG);
88437
- return encodeTime(seed, TIME_LEN) + newRandom;
88438
- };
88439
- }
88440
88464
  const execFileAsync = promisify(execFile);
88441
88465
  function parsePort$1(value, radix = 10) {
88442
88466
  const port = parseInt(value, radix);
@@ -89400,8 +89424,8 @@ function requireGetVercelOidcToken$1() {
89400
89424
  }
89401
89425
  try {
89402
89426
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
89403
- await import("./token-util-C6iVpF77.js").then((n) => n.t),
89404
- await import("./token-C58qysN7.js").then((n) => n.t)
89427
+ await import("./token-util-CagM_XOH.js").then((n) => n.t),
89428
+ await import("./token-COnBvzNW.js").then((n) => n.t)
89405
89429
  ]);
89406
89430
  if (!token || isExpired(getTokenPayload(token))) {
89407
89431
  await refreshToken();
@@ -115521,6 +115545,7 @@ function createQueue$2(config2) {
115521
115545
  const generateId2 = monotonicFactory();
115522
115546
  const semaphore = new libExports.Sema(WORKFLOW_LOCAL_QUEUE_CONCURRENCY);
115523
115547
  const inflightMessages = /* @__PURE__ */ new Map();
115548
+ const directHandlers = /* @__PURE__ */ new Map();
115524
115549
  const queue = async (queueName, message2, opts) => {
115525
115550
  const cleanup = [];
115526
115551
  if (opts == null ? void 0 : opts.idempotencyKey) {
@@ -115531,10 +115556,13 @@ function createQueue$2(config2) {
115531
115556
  }
115532
115557
  const body2 = transport.serialize(message2);
115533
115558
  let pathname;
115559
+ let prefix;
115534
115560
  if (queueName.startsWith("__wkf_step_")) {
115535
115561
  pathname = `step`;
115562
+ prefix = "__wkf_step_";
115536
115563
  } else if (queueName.startsWith("__wkf_workflow_")) {
115537
115564
  pathname = `flow`;
115565
+ prefix = "__wkf_workflow_";
115538
115566
  } else {
115539
115567
  throw new Error("Unknown queue name prefix");
115540
115568
  }
@@ -115554,22 +115582,34 @@ function createQueue$2(config2) {
115554
115582
  }
115555
115583
  try {
115556
115584
  let defaultRetriesLeft = 3;
115557
- const baseUrl = await resolveBaseUrl$1(config2);
115585
+ const directHandler = directHandlers.get(prefix);
115558
115586
  for (let attempt = 0; defaultRetriesLeft > 0; attempt++) {
115559
115587
  defaultRetriesLeft--;
115560
- const response2 = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
115561
- method: "POST",
115562
- duplex: "half",
115563
- dispatcher: httpAgent,
115564
- headers: {
115565
- ...opts == null ? void 0 : opts.headers,
115566
- "content-type": "application/json",
115567
- "x-vqs-queue-name": queueName,
115568
- "x-vqs-message-id": messageId,
115569
- "x-vqs-message-attempt": String(attempt + 1)
115570
- },
115571
- body: body2
115572
- });
115588
+ let response2;
115589
+ const headers2 = {
115590
+ ...opts == null ? void 0 : opts.headers,
115591
+ "content-type": "application/json",
115592
+ "x-vqs-queue-name": queueName,
115593
+ "x-vqs-message-id": messageId,
115594
+ "x-vqs-message-attempt": String(attempt + 1)
115595
+ };
115596
+ if (directHandler) {
115597
+ const req = new Request("http://localhost/.well-known/workflow/v1/" + pathname, {
115598
+ method: "POST",
115599
+ headers: headers2,
115600
+ body: body2
115601
+ });
115602
+ response2 = await directHandler(req);
115603
+ } else {
115604
+ const baseUrl = await resolveBaseUrl$1(config2);
115605
+ response2 = await fetch(`${baseUrl}/.well-known/workflow/v1/${pathname}`, {
115606
+ method: "POST",
115607
+ duplex: "half",
115608
+ dispatcher: httpAgent,
115609
+ headers: headers2,
115610
+ body: body2
115611
+ });
115612
+ }
115573
115613
  if (response2.ok) {
115574
115614
  return;
115575
115615
  }
@@ -115651,6 +115691,9 @@ function createQueue$2(config2) {
115651
115691
  queue,
115652
115692
  createQueueHandler,
115653
115693
  getDeploymentId,
115694
+ registerHandler(prefix, handler) {
115695
+ directHandlers.set(prefix, handler);
115696
+ },
115654
115697
  async close() {
115655
115698
  await httpAgent.close();
115656
115699
  }
@@ -115752,7 +115795,6 @@ function instrumentObject$1(prefix, o) {
115752
115795
  return handlers2;
115753
115796
  }
115754
115797
  const ulid$1 = monotonicFactory(() => Math.random());
115755
- const Ulid = string$1().ulid();
115756
115798
  const isWindows = process.platform === "win32";
115757
115799
  async function withWindowsRetry(fn2, maxRetries = 5) {
115758
115800
  if (!isWindows)
@@ -115773,13 +115815,6 @@ async function withWindowsRetry(fn2, maxRetries = 5) {
115773
115815
  throw new Error("Retry loop exited unexpectedly");
115774
115816
  }
115775
115817
  const createdFilesCache = /* @__PURE__ */ new Set();
115776
- function ulidToDate(maybeUlid) {
115777
- const ulid2 = Ulid.safeParse(maybeUlid);
115778
- if (!ulid2.success) {
115779
- return null;
115780
- }
115781
- return new Date(decodeTime(ulid2.data));
115782
- }
115783
115818
  async function ensureDir(dirPath) {
115784
115819
  try {
115785
115820
  await promises.mkdir(dirPath, { recursive: true });
@@ -116155,6 +116190,12 @@ function createEventsStorage(basedir) {
116155
116190
  } else {
116156
116191
  effectiveRunId = runId;
116157
116192
  }
116193
+ if (data.eventType === "run_created" && runId && runId !== "") {
116194
+ const validationError = validateUlidTimestamp(effectiveRunId, "wrun_");
116195
+ if (validationError) {
116196
+ throw new WorkflowAPIError(validationError, { status: 400 });
116197
+ }
116198
+ }
116158
116199
  const effectiveSpecVersion = data.specVersion ?? SPEC_VERSION_CURRENT;
116159
116200
  const isRunTerminal = (status) => ["completed", "failed", "cancelled"].includes(status);
116160
116201
  const isStepTerminal = (status) => ["completed", "failed"].includes(status);
@@ -116950,6 +116991,10 @@ function createLocalWorld(args) {
116950
116991
  },
116951
116992
  async close() {
116952
116993
  await queue.close();
116994
+ },
116995
+ async clear() {
116996
+ await rm(mergedConfig.dataDir, { recursive: true, force: true });
116997
+ await initDataDir(mergedConfig.dataDir);
116953
116998
  }
116954
116999
  };
116955
117000
  }
@@ -117071,8 +117116,8 @@ function requireGetVercelOidcToken() {
117071
117116
  }
117072
117117
  try {
117073
117118
  const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
117074
- await import("./token-util-CcopqG1U.js").then((n) => n.t),
117075
- await import("./token-CLFHo1Az.js").then((n) => n.t)
117119
+ await import("./token-util-7Q4_oN66.js").then((n) => n.t),
117120
+ await import("./token-CBxSSoxh.js").then((n) => n.t)
117076
117121
  ]);
117077
117122
  if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
117078
117123
  await refreshToken(options);
@@ -117791,7 +117836,7 @@ const PeerService = SemanticConvention("peer.service");
117791
117836
  const RpcSystem = SemanticConvention("rpc.system");
117792
117837
  const RpcService = SemanticConvention("rpc.service");
117793
117838
  const RpcMethod = SemanticConvention("rpc.method");
117794
- const version$1 = "4.1.0-beta.38";
117839
+ const version$1 = "4.1.0-beta.39";
117795
117840
  const DEFAULT_RESOLVE_DATA_OPTION = "all";
117796
117841
  function deserializeError(obj) {
117797
117842
  const { error: error2, ...rest } = obj;
@@ -118614,6 +118659,12 @@ async function createWorkflowRunEvent(id2, data, params, config2) {
118614
118659
  });
118615
118660
  return { event: wireResult2 };
118616
118661
  }
118662
+ if (data.eventType === "run_created" && id2) {
118663
+ const validationError = validateUlidTimestamp(id2, "wrun_");
118664
+ if (validationError) {
118665
+ throw new WorkflowAPIError(validationError, { status: 400 });
118666
+ }
118667
+ }
118617
118668
  const runIdPath = id2 === null ? "null" : id2;
118618
118669
  const remoteRefBehavior = eventsNeedingResolve.has(data.eventType) ? "resolve" : "lazy";
118619
118670
  if (remoteRefBehavior === "resolve") {
@@ -120473,7 +120524,7 @@ function getStreamType(stream) {
120473
120524
  } catch {
120474
120525
  }
120475
120526
  }
120476
- const FRAME_HEADER_SIZE = 4;
120527
+ const FRAME_HEADER_SIZE$1 = 4;
120477
120528
  function getSerializeStream(reducers, cryptoKey) {
120478
120529
  const encoder = new TextEncoder();
120479
120530
  const keyState = { resolved: false, key: void 0 };
@@ -120491,9 +120542,9 @@ function getSerializeStream(reducers, cryptoKey) {
120491
120542
  const encrypted = await encrypt(keyState.key, prefixed);
120492
120543
  prefixed = encodeWithFormatPrefix(SerializationFormat.ENCRYPTED, encrypted);
120493
120544
  }
120494
- const frame2 = new Uint8Array(FRAME_HEADER_SIZE + prefixed.length);
120545
+ const frame2 = new Uint8Array(FRAME_HEADER_SIZE$1 + prefixed.length);
120495
120546
  new DataView(frame2.buffer).setUint32(0, prefixed.length, false);
120496
- frame2.set(prefixed, FRAME_HEADER_SIZE);
120547
+ frame2.set(prefixed, FRAME_HEADER_SIZE$1);
120497
120548
  controller.enqueue(frame2);
120498
120549
  } catch (error2) {
120499
120550
  controller.error(new WorkflowRuntimeError(formatSerializationError("stream chunk", error2), { slug: "serialization-failed", cause: error2 }));
@@ -120517,13 +120568,13 @@ function getDeserializeStream(revivers, cryptoKey) {
120517
120568
  keyState.key = await cryptoKey;
120518
120569
  keyState.resolved = true;
120519
120570
  }
120520
- while (buffer.length >= FRAME_HEADER_SIZE) {
120571
+ while (buffer.length >= FRAME_HEADER_SIZE$1) {
120521
120572
  const frameLength = new DataView(buffer.buffer, buffer.byteOffset, buffer.byteLength).getUint32(0, false);
120522
- if (buffer.length < FRAME_HEADER_SIZE + frameLength) {
120573
+ if (buffer.length < FRAME_HEADER_SIZE$1 + frameLength) {
120523
120574
  break;
120524
120575
  }
120525
- const frameData = buffer.slice(FRAME_HEADER_SIZE, FRAME_HEADER_SIZE + frameLength);
120526
- buffer = buffer.slice(FRAME_HEADER_SIZE + frameLength);
120576
+ const frameData = buffer.slice(FRAME_HEADER_SIZE$1, FRAME_HEADER_SIZE$1 + frameLength);
120577
+ buffer = buffer.slice(FRAME_HEADER_SIZE$1 + frameLength);
120527
120578
  let { format: format2, payload } = decodeFormatPrefix(frameData);
120528
120579
  if (format2 === SerializationFormat.ENCRYPTED) {
120529
120580
  if (!keyState.key) {
@@ -120541,7 +120592,7 @@ function getDeserializeStream(revivers, cryptoKey) {
120541
120592
  }
120542
120593
  const stream = new TransformStream({
120543
120594
  async transform(chunk, controller) {
120544
- if (buffer.length === 0 && chunk.length >= FRAME_HEADER_SIZE) {
120595
+ if (buffer.length === 0 && chunk.length >= FRAME_HEADER_SIZE$1) {
120545
120596
  const possibleLength = new DataView(chunk.buffer, chunk.byteOffset, chunk.byteLength).getUint32(0, false);
120546
120597
  if (possibleLength > 0 && possibleLength < 1e8) {
120547
120598
  appendToBuffer(chunk);
@@ -122131,7 +122182,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
122131
122182
  });
122132
122183
  });
122133
122184
  }
122134
- const version = "4.2.0-beta.64";
122185
+ const version = "4.2.0-beta.65";
122135
122186
  const ulid = monotonicFactory();
122136
122187
  async function start$1(workflow, argsOrOptions, options) {
122137
122188
  return await waitedUntil(() => {
@@ -123533,10 +123584,7 @@ async function resumeHook$1(worldEnv, token, payload) {
123533
123584
  async function readStreamServerAction(env2, streamId, startIndex) {
123534
123585
  try {
123535
123586
  const world = await getWorldFromEnv(env2);
123536
- const stream = await world.readFromStream(streamId, startIndex);
123537
- const revivers = getExternalRevivers(globalThis, [], "", void 0);
123538
- const transform2 = getDeserializeStream(revivers, void 0);
123539
- return stream.pipeThrough(transform2);
123587
+ return await world.readFromStream(streamId, startIndex);
123540
123588
  } catch (error2) {
123541
123589
  const actionError = createServerActionError(error2, "world.readFromStream", {
123542
123590
  streamId,
@@ -129614,7 +129662,7 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129614
129662
  setAuxiliaryDataLoading(true);
129615
129663
  setError(null);
129616
129664
  const [runResult, stepsResult, hooksResult, eventsResult] = await Promise.all([
129617
- unwrapServerActionResult(fetchRun$1(env2, runId)),
129665
+ unwrapServerActionResult(fetchRun$1(env2, runId, "none")),
129618
129666
  unwrapServerActionResult(
129619
129667
  fetchSteps$1(env2, runId, {
129620
129668
  sortOrder: "asc",
@@ -129789,12 +129837,13 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
129789
129837
  return false;
129790
129838
  }
129791
129839
  const { error: error22, result } = await unwrapServerActionResult(
129792
- fetchRun$1(env2, runId)
129840
+ fetchRun$1(env2, runId, "none")
129793
129841
  );
129794
129842
  if (error22) {
129795
129843
  setError(error22);
129796
129844
  return false;
129797
129845
  }
129846
+ setError(null);
129798
129847
  setRun(hydrateResourceIO(result));
129799
129848
  return true;
129800
129849
  }, [env2, runId, run == null ? void 0 : run.completedAt]);
@@ -145837,7 +145886,8 @@ function mapRunToExecution(run, steps, events2, graph) {
145837
145886
  });
145838
145887
  return result;
145839
145888
  }
145840
- function useStreamReader(env2, streamId) {
145889
+ const FRAME_HEADER_SIZE = 4;
145890
+ function useStreamReader(env2, streamId, runId, encryptionKey) {
145841
145891
  const [chunks, setChunks] = reactExports.useState([]);
145842
145892
  const [isLive, setIsLive] = reactExports.useState(false);
145843
145893
  const [error2, setError] = reactExports.useState(null);
@@ -145856,83 +145906,82 @@ function useStreamReader(env2, streamId) {
145856
145906
  abortControllerRef.current = abortController;
145857
145907
  setIsLive(true);
145858
145908
  const revivers = getWebRevivers();
145859
- const handleStreamEnd = () => {
145860
- if (mounted) {
145861
- setIsLive(false);
145862
- }
145863
- };
145864
- const handleStreamError = (err) => {
145865
- if (mounted) {
145866
- setError(err instanceof Error ? err.message : String(err));
145867
- setIsLive(false);
145868
- }
145869
- };
145870
- const addChunk = (value) => {
145871
- if (mounted && value !== void 0 && value !== null) {
145872
- const chunkId = chunkIdRef.current++;
145873
- let hydrated;
145874
- try {
145875
- hydrated = hydrateData(value, revivers);
145876
- } catch {
145877
- hydrated = value;
145878
- }
145879
- const text2 = typeof hydrated === "string" ? hydrated : JSON.stringify(hydrated, null, 2);
145880
- setChunks((prev) => [...prev, { id: chunkId, text: text2 }]);
145881
- }
145882
- };
145883
- const processFramedStream = async (reader) => {
145884
- var _a3;
145885
- let buffer = new Uint8Array(0);
145886
- const appendToBuffer = (data) => {
145887
- const newBuffer = new Uint8Array(buffer.length + data.length);
145888
- newBuffer.set(buffer, 0);
145889
- newBuffer.set(data, buffer.length);
145890
- buffer = newBuffer;
145891
- };
145892
- for (; ; ) {
145893
- if ((_a3 = abortControllerRef.current) == null ? void 0 : _a3.signal.aborted) break;
145894
- const { value, done } = await reader.read();
145895
- if (done) {
145896
- handleStreamEnd();
145897
- break;
145898
- }
145899
- appendToBuffer(value);
145900
- while (buffer.length >= 4) {
145901
- const view = new DataView(
145902
- buffer.buffer,
145903
- buffer.byteOffset,
145904
- buffer.byteLength
145905
- );
145906
- const frameLength = view.getUint32(0, false);
145907
- if (buffer.length < 4 + frameLength) {
145908
- break;
145909
- }
145910
- const frameData = buffer.slice(4, 4 + frameLength);
145911
- buffer = buffer.slice(4 + frameLength);
145912
- try {
145913
- const rawChunk = decode$2(frameData);
145914
- addChunk(rawChunk);
145915
- } catch (err) {
145916
- console.error("Failed to decode stream chunk:", err);
145917
- }
145918
- }
145919
- }
145920
- };
145921
145909
  const readStreamData = async () => {
145922
145910
  try {
145923
- const stream = await readStream(
145911
+ const rawStream = await readStream(
145924
145912
  env2,
145925
145913
  streamId,
145926
145914
  void 0,
145927
145915
  abortController.signal
145928
145916
  );
145929
- const reader = stream.getReader();
145930
- await processFramedStream(reader);
145917
+ const cryptoKey = encryptionKey ? await importKey(encryptionKey) : void 0;
145918
+ const reader = rawStream.getReader();
145919
+ let buffer = new Uint8Array(0);
145920
+ const appendToBuffer = (data) => {
145921
+ const newBuffer = new Uint8Array(buffer.length + data.length);
145922
+ newBuffer.set(buffer, 0);
145923
+ newBuffer.set(data, buffer.length);
145924
+ buffer = newBuffer;
145925
+ };
145926
+ for (; ; ) {
145927
+ if (abortController.signal.aborted) break;
145928
+ const { value, done } = await reader.read();
145929
+ if (done) {
145930
+ if (mounted) setIsLive(false);
145931
+ break;
145932
+ }
145933
+ appendToBuffer(value);
145934
+ while (buffer.length >= FRAME_HEADER_SIZE) {
145935
+ const view = new DataView(
145936
+ buffer.buffer,
145937
+ buffer.byteOffset,
145938
+ buffer.byteLength
145939
+ );
145940
+ const frameLength = view.getUint32(0, false);
145941
+ if (buffer.length < FRAME_HEADER_SIZE + frameLength) {
145942
+ break;
145943
+ }
145944
+ const frameData = buffer.slice(
145945
+ FRAME_HEADER_SIZE,
145946
+ FRAME_HEADER_SIZE + frameLength
145947
+ );
145948
+ buffer = buffer.slice(FRAME_HEADER_SIZE + frameLength);
145949
+ try {
145950
+ const { format: format2, payload } = decodeFormatPrefix$1(frameData);
145951
+ let dataToHydrate;
145952
+ if (format2 === SerializationFormat$1.ENCRYPTED) {
145953
+ if (!cryptoKey) {
145954
+ if (mounted) {
145955
+ setError(
145956
+ "This stream is encrypted. Click Decrypt to view."
145957
+ );
145958
+ setIsLive(false);
145959
+ }
145960
+ reader.cancel().catch(() => {
145961
+ });
145962
+ return;
145963
+ }
145964
+ dataToHydrate = await decrypt(cryptoKey, payload);
145965
+ } else {
145966
+ dataToHydrate = frameData;
145967
+ }
145968
+ const hydrated = hydrateData(dataToHydrate, revivers);
145969
+ if (mounted && hydrated !== void 0 && hydrated !== null) {
145970
+ const chunkId = chunkIdRef.current++;
145971
+ const text2 = typeof hydrated === "string" ? hydrated : JSON.stringify(hydrated, null, 2);
145972
+ setChunks((prev) => [...prev, { id: chunkId, text: text2 }]);
145973
+ }
145974
+ } catch (err) {
145975
+ console.error("Failed to process stream frame:", err);
145976
+ }
145977
+ }
145978
+ }
145931
145979
  } catch (err) {
145932
- if (abortController.signal.aborted) {
145933
- return;
145980
+ if (abortController.signal.aborted) return;
145981
+ if (mounted) {
145982
+ setError(err instanceof Error ? err.message : String(err));
145983
+ setIsLive(false);
145934
145984
  }
145935
- handleStreamError(err);
145936
145985
  }
145937
145986
  };
145938
145987
  void readStreamData();
@@ -145942,12 +145991,8 @@ function useStreamReader(env2, streamId) {
145942
145991
  abortControllerRef.current.abort();
145943
145992
  }
145944
145993
  };
145945
- }, [env2, streamId]);
145946
- return {
145947
- chunks,
145948
- isLive,
145949
- error: error2
145950
- };
145994
+ }, [env2, streamId, runId, encryptionKey]);
145995
+ return { chunks, isLive, error: error2 };
145951
145996
  }
145952
145997
  function LiveStatus({ hasError, errorMessage }) {
145953
145998
  return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex items-center gap-2", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
@@ -147066,7 +147111,7 @@ function RunDetailView({
147066
147111
  chunks: streamChunks,
147067
147112
  isLive: streamIsLive,
147068
147113
  error: streamError
147069
- } = useStreamReader(env2, selectedStreamId);
147114
+ } = useStreamReader(env2, selectedStreamId, runId, encryptionKey);
147070
147115
  const handleCancelClick = () => {
147071
147116
  setShowCancelDialog(true);
147072
147117
  };
@@ -147550,16 +147595,7 @@ async function loader({
147550
147595
  status: 500
147551
147596
  });
147552
147597
  }
147553
- const cborStream = stream.pipeThrough(new TransformStream({
147554
- transform(chunk, controller) {
147555
- const encoded = encode$2(chunk);
147556
- const length = new DataView(new ArrayBuffer(4));
147557
- length.setUint32(0, encoded.byteLength, false);
147558
- controller.enqueue(new Uint8Array(length.buffer));
147559
- controller.enqueue(new Uint8Array(encoded));
147560
- }
147561
- }));
147562
- return new Response(cborStream, {
147598
+ return new Response(stream, {
147563
147599
  headers: {
147564
147600
  "Content-Type": "application/octet-stream"
147565
147601
  }
@@ -147578,7 +147614,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
147578
147614
  __proto__: null,
147579
147615
  loader
147580
147616
  }, Symbol.toStringTag, { value: "Module" }));
147581
- const serverManifest = { "entry": { "module": "/assets/entry.client-BjpmGyLC.js", "imports": ["/assets/index-DklpUtP3.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/root-Ckv-c9_b.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-CJ6mkUFN.js"], "css": ["/assets/root-Dr_TuMgh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-bWDrLREI.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-JKiMb5g6.js", "/assets/mermaid-3ZIDBTTL-CJ6mkUFN.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-EcdnCjQk.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-JKiMb5g6.js", "/assets/mermaid-3ZIDBTTL-CJ6mkUFN.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-daa82ff1.js", "version": "daa82ff1", "sri": void 0 };
147617
+ const serverManifest = { "entry": { "module": "/assets/entry.client-BjpmGyLC.js", "imports": ["/assets/index-DklpUtP3.js"], "css": [] }, "routes": { "root": { "id": "root", "parentId": void 0, "path": "", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/root-DZgYUaDo.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-DcdZu9sS.js"], "css": ["/assets/root-Dr_TuMgh.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/home": { "id": "routes/home", "parentId": "root", "path": void 0, "index": true, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/home-Cpz2_ZDM.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-CF7nLapT.js", "/assets/mermaid-3ZIDBTTL-DcdZu9sS.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/run-detail": { "id": "routes/run-detail", "parentId": "root", "path": "run/:runId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": false, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": true, "hasErrorBoundary": false, "module": "/assets/run-detail-xcvWVR2B.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-CF7nLapT.js", "/assets/mermaid-3ZIDBTTL-DcdZu9sS.js", "/assets/encryption-8OvC6eoJ.js"], "css": ["/assets/use-workflow-graph-yls6qlc0.css", "/assets/mermaid-3ZIDBTTL-DKxHcEOp.css"], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.rpc": { "id": "routes/api.rpc", "parentId": "root", "path": "api/rpc", "index": void 0, "caseSensitive": void 0, "hasAction": true, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.rpc-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 }, "routes/api.stream.$streamId": { "id": "routes/api.stream.$streamId", "parentId": "root", "path": "api/stream/:streamId", "index": void 0, "caseSensitive": void 0, "hasAction": false, "hasLoader": true, "hasClientAction": false, "hasClientLoader": false, "hasClientMiddleware": false, "hasDefaultExport": false, "hasErrorBoundary": false, "module": "/assets/api.stream._streamId-l0sNRNKZ.js", "imports": [], "css": [], "clientActionModule": void 0, "clientLoaderModule": void 0, "clientMiddlewareModule": void 0, "hydrateFallbackModule": void 0 } }, "url": "/assets/manifest-069935e6.js", "version": "069935e6", "sri": void 0 };
147582
147618
  const assetsBuildDirectory = "build/client";
147583
147619
  const basename = "/";
147584
147620
  const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };