@workflow/web 4.1.0-beta.45 → 4.1.0-beta.46
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/README.md +1 -1
- package/build/client/assets/{highlighted-body-B3W2YXNL-DmGJDYCd.js → highlighted-body-B3W2YXNL-CCnn-bn-.js} +1 -1
- package/build/client/assets/{home-Bg63MGns.js → home-ClC-EMyL.js} +1 -1
- package/build/client/assets/{manifest-f52831b8.js → manifest-7a6ad03e.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-ClWSYlBT.js → mermaid-3ZIDBTTL-D95wSBpg.js} +3 -3
- package/build/client/assets/{root-CADywoAy.js → root-Dae_xV-y.js} +1 -1
- package/build/client/assets/run-detail-Brs1Rm25.js +37 -0
- package/build/client/assets/{workflow-graph-viewer-RUyTSlHH.js → workflow-graph-viewer-BZlGoIt2.js} +1 -1
- package/build/server/assets/{app-DMT28sgS.js → app-oogZ8ZwV.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-CKl1xXgz.js → highlighted-body-B3W2YXNL-z6TbPMtP.js} +2 -2
- package/build/server/assets/{index-BHIV6JOr.js → index-BL4Kw0eA.js} +2 -2
- package/build/server/assets/{mermaid-3ZIDBTTL-uTah_BkY.js → mermaid-3ZIDBTTL-XSKOerl0.js} +2 -2
- package/build/server/assets/{server-build-DiN0zpXF.js → server-build-BnrnOzxz.js} +358 -227
- package/build/server/assets/{token-fvUEOQRa.js → token-Ct_osLcf.js} +2 -2
- package/build/server/assets/{token-util-1mDJoKQG.js → token-util-DQ6afx9q.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +3 -3
- package/build/client/assets/run-detail-CX8hD4AT.js +0 -37
|
@@ -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, _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, _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-
|
|
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-oogZ8ZwV.js";
|
|
18
18
|
import require$$0$4, { PassThrough } from "node:stream";
|
|
19
19
|
import require$$0 from "util";
|
|
20
20
|
import require$$1 from "crypto";
|
|
@@ -64899,7 +64899,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
64899
64899
|
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 });
|
|
64900
64900
|
var Se = reactExports.createContext({ code: "" }), de$1 = () => reactExports.useContext(Se);
|
|
64901
64901
|
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 }) });
|
|
64902
|
-
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-
|
|
64902
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-z6TbPMtP.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
64903
64903
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
64904
64904
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
64905
64905
|
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 }) })] }) });
|
|
@@ -65221,7 +65221,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
65221
65221
|
}, []), 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] });
|
|
65222
65222
|
};
|
|
65223
65223
|
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 }) })] });
|
|
65224
|
-
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-
|
|
65224
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-XSKOerl0.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
65225
65225
|
function ke(e, t) {
|
|
65226
65226
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
65227
65227
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -70254,8 +70254,8 @@ function TraceViewerWithContextMenu({ trace: trace2, run, isLive, onWakeUpSleep,
|
|
|
70254
70254
|
const getMenuItems = reactExports.useCallback((menu) => {
|
|
70255
70255
|
var _a3, _b;
|
|
70256
70256
|
const items = [];
|
|
70257
|
-
const
|
|
70258
|
-
if (menu.resourceType === "sleep" && menu.isActive &&
|
|
70257
|
+
const isRunActive2 = !run.completedAt;
|
|
70258
|
+
if (menu.resourceType === "sleep" && menu.isActive && isRunActive2 && onWakeUpSleep) {
|
|
70259
70259
|
items.push({
|
|
70260
70260
|
label: "Wake Up Sleep",
|
|
70261
70261
|
icon: jsxRuntimeExports.jsx(Clock, { className: "h-3.5 w-3.5" }),
|
|
@@ -70278,7 +70278,7 @@ function TraceViewerWithContextMenu({ trace: trace2, run, isLive, onWakeUpSleep,
|
|
|
70278
70278
|
}
|
|
70279
70279
|
});
|
|
70280
70280
|
}
|
|
70281
|
-
if (menu.resourceType === "hook" &&
|
|
70281
|
+
if (menu.resourceType === "hook" && isRunActive2 && onResolveHook) {
|
|
70282
70282
|
const span = spanLookup.get(menu.spanId);
|
|
70283
70283
|
const hookData = (_a3 = span == null ? void 0 : span.attributes) == null ? void 0 : _a3.data;
|
|
70284
70284
|
const isDisposed = Boolean(hookData == null ? void 0 : hookData.disposedAt) || Boolean((_b = span == null ? void 0 : span.events) == null ? void 0 : _b.some((e) => e.name === "hook_disposed")) || resolvedHookIds.has(menu.spanId);
|
|
@@ -70295,7 +70295,7 @@ function TraceViewerWithContextMenu({ trace: trace2, run, isLive, onWakeUpSleep,
|
|
|
70295
70295
|
});
|
|
70296
70296
|
}
|
|
70297
70297
|
}
|
|
70298
|
-
if (menu.resourceType === "run" &&
|
|
70298
|
+
if (menu.resourceType === "run" && isRunActive2 && onCancelRun) {
|
|
70299
70299
|
items.push({
|
|
70300
70300
|
label: "Cancel Run",
|
|
70301
70301
|
icon: jsxRuntimeExports.jsx(CircleX, { className: "h-3.5 w-3.5" }),
|
|
@@ -92369,8 +92369,8 @@ function requireGetVercelOidcToken() {
|
|
|
92369
92369
|
}
|
|
92370
92370
|
try {
|
|
92371
92371
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
92372
|
-
await import("./token-util-
|
|
92373
|
-
await import("./token-
|
|
92372
|
+
await import("./token-util-DQ6afx9q.js").then((n) => n.t),
|
|
92373
|
+
await import("./token-Ct_osLcf.js").then((n) => n.t)
|
|
92374
92374
|
]);
|
|
92375
92375
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
92376
92376
|
await refreshToken(options);
|
|
@@ -120251,6 +120251,30 @@ function deserializeChunk(serialized) {
|
|
|
120251
120251
|
const chunk = Buffer.from(serialized.subarray(1));
|
|
120252
120252
|
return { eof, chunk };
|
|
120253
120253
|
}
|
|
120254
|
+
async function listChunkFilesForStream(chunksDir, name2, tag) {
|
|
120255
|
+
const listPromises = [
|
|
120256
|
+
listFilesByExtension(chunksDir, ".bin"),
|
|
120257
|
+
listFilesByExtension(chunksDir, ".json")
|
|
120258
|
+
];
|
|
120259
|
+
if (tag) {
|
|
120260
|
+
listPromises.push(listFilesByExtension(chunksDir, `.${tag}.bin`));
|
|
120261
|
+
}
|
|
120262
|
+
const [binFiles, jsonFiles, ...taggedResults] = await Promise.all(listPromises);
|
|
120263
|
+
const taggedBinFiles = taggedResults[0] ?? [];
|
|
120264
|
+
const extMap = /* @__PURE__ */ new Map();
|
|
120265
|
+
for (const f2 of jsonFiles)
|
|
120266
|
+
extMap.set(f2, ".json");
|
|
120267
|
+
const tagSfx = tag ? `.${tag}` : "";
|
|
120268
|
+
for (const f2 of binFiles) {
|
|
120269
|
+
if (tag && f2.endsWith(tagSfx))
|
|
120270
|
+
continue;
|
|
120271
|
+
extMap.set(f2, ".bin");
|
|
120272
|
+
}
|
|
120273
|
+
for (const f2 of taggedBinFiles)
|
|
120274
|
+
extMap.set(f2, `.${tag}.bin`);
|
|
120275
|
+
const files = [...extMap.keys()].filter((file2) => file2.startsWith(`${name2}-`)).sort();
|
|
120276
|
+
return { files, extMap };
|
|
120277
|
+
}
|
|
120254
120278
|
function createStreamer$1(basedir, tag) {
|
|
120255
120279
|
const tagSuffix = tag ? `.${tag}` : "";
|
|
120256
120280
|
const streamEmitter = new EventEmitter();
|
|
@@ -120341,27 +120365,7 @@ function createStreamer$1(basedir, tag) {
|
|
|
120341
120365
|
async getStreamChunks(name2, _runId, options) {
|
|
120342
120366
|
const limit = (options == null ? void 0 : options.limit) ?? 100;
|
|
120343
120367
|
const chunksDir = path$3.join(basedir, "streams", "chunks");
|
|
120344
|
-
const
|
|
120345
|
-
listFilesByExtension(chunksDir, ".bin"),
|
|
120346
|
-
listFilesByExtension(chunksDir, ".json")
|
|
120347
|
-
];
|
|
120348
|
-
if (tag) {
|
|
120349
|
-
listPromises.push(listFilesByExtension(chunksDir, `.${tag}.bin`));
|
|
120350
|
-
}
|
|
120351
|
-
const [binFiles, jsonFiles, ...taggedResults] = await Promise.all(listPromises);
|
|
120352
|
-
const taggedBinFiles = taggedResults[0] ?? [];
|
|
120353
|
-
const fileExtMap = /* @__PURE__ */ new Map();
|
|
120354
|
-
for (const f2 of jsonFiles)
|
|
120355
|
-
fileExtMap.set(f2, ".json");
|
|
120356
|
-
const tagSfx = tag ? `.${tag}` : "";
|
|
120357
|
-
for (const f2 of binFiles) {
|
|
120358
|
-
if (tag && f2.endsWith(tagSfx))
|
|
120359
|
-
continue;
|
|
120360
|
-
fileExtMap.set(f2, ".bin");
|
|
120361
|
-
}
|
|
120362
|
-
for (const f2 of taggedBinFiles)
|
|
120363
|
-
fileExtMap.set(f2, `.${tag}.bin`);
|
|
120364
|
-
const chunkFiles = [...fileExtMap.keys()].filter((file2) => file2.startsWith(`${name2}-`)).sort();
|
|
120368
|
+
const { files: chunkFiles, extMap: fileExtMap } = await listChunkFilesForStream(chunksDir, name2, tag);
|
|
120365
120369
|
let startIndex = 0;
|
|
120366
120370
|
if (options == null ? void 0 : options.cursor) {
|
|
120367
120371
|
try {
|
|
@@ -120416,27 +120420,7 @@ function createStreamer$1(basedir, tag) {
|
|
|
120416
120420
|
},
|
|
120417
120421
|
async getStreamInfo(name2, _runId) {
|
|
120418
120422
|
const chunksDir = path$3.join(basedir, "streams", "chunks");
|
|
120419
|
-
const
|
|
120420
|
-
listFilesByExtension(chunksDir, ".bin"),
|
|
120421
|
-
listFilesByExtension(chunksDir, ".json")
|
|
120422
|
-
];
|
|
120423
|
-
if (tag) {
|
|
120424
|
-
listPromises.push(listFilesByExtension(chunksDir, `.${tag}.bin`));
|
|
120425
|
-
}
|
|
120426
|
-
const [binFiles, jsonFiles, ...taggedResults] = await Promise.all(listPromises);
|
|
120427
|
-
const taggedBinFiles = taggedResults[0] ?? [];
|
|
120428
|
-
const fileExtMap = /* @__PURE__ */ new Map();
|
|
120429
|
-
for (const f2 of jsonFiles)
|
|
120430
|
-
fileExtMap.set(f2, ".json");
|
|
120431
|
-
const tagSfx = tag ? `.${tag}` : "";
|
|
120432
|
-
for (const f2 of binFiles) {
|
|
120433
|
-
if (tag && f2.endsWith(tagSfx))
|
|
120434
|
-
continue;
|
|
120435
|
-
fileExtMap.set(f2, ".bin");
|
|
120436
|
-
}
|
|
120437
|
-
for (const f2 of taggedBinFiles)
|
|
120438
|
-
fileExtMap.set(f2, `.${tag}.bin`);
|
|
120439
|
-
const chunkFiles = [...fileExtMap.keys()].filter((file2) => file2.startsWith(`${name2}-`)).sort();
|
|
120423
|
+
const { files: chunkFiles, extMap: fileExtMap } = await listChunkFilesForStream(chunksDir, name2, tag);
|
|
120440
120424
|
let streamDone = false;
|
|
120441
120425
|
let dataCount = 0;
|
|
120442
120426
|
for (const file2 of chunkFiles) {
|
|
@@ -120488,27 +120472,7 @@ function createStreamer$1(basedir, tag) {
|
|
|
120488
120472
|
removeListeners = closeListener;
|
|
120489
120473
|
streamEmitter.on(`chunk:${name2}`, chunkListener);
|
|
120490
120474
|
streamEmitter.on(`close:${name2}`, closeListener);
|
|
120491
|
-
const
|
|
120492
|
-
listFilesByExtension(chunksDir, ".bin"),
|
|
120493
|
-
listFilesByExtension(chunksDir, ".json")
|
|
120494
|
-
];
|
|
120495
|
-
if (tag) {
|
|
120496
|
-
listPromises.push(listFilesByExtension(chunksDir, `.${tag}.bin`));
|
|
120497
|
-
}
|
|
120498
|
-
const [binFiles, jsonFiles, ...taggedResults] = await Promise.all(listPromises);
|
|
120499
|
-
const taggedBinFiles = taggedResults[0] ?? [];
|
|
120500
|
-
const fileExtMap = /* @__PURE__ */ new Map();
|
|
120501
|
-
for (const f2 of jsonFiles)
|
|
120502
|
-
fileExtMap.set(f2, ".json");
|
|
120503
|
-
const tagSuffix2 = tag ? `.${tag}` : "";
|
|
120504
|
-
for (const f2 of binFiles) {
|
|
120505
|
-
if (tag && f2.endsWith(tagSuffix2))
|
|
120506
|
-
continue;
|
|
120507
|
-
fileExtMap.set(f2, ".bin");
|
|
120508
|
-
}
|
|
120509
|
-
for (const f2 of taggedBinFiles)
|
|
120510
|
-
fileExtMap.set(f2, `.${tag}.bin`);
|
|
120511
|
-
const chunkFiles = [...fileExtMap.keys()].filter((file2) => file2.startsWith(`${name2}-`)).sort();
|
|
120475
|
+
const { files: chunkFiles, extMap: fileExtMap } = await listChunkFilesForStream(chunksDir, name2, tag);
|
|
120512
120476
|
let dataChunkCount = chunkFiles.length;
|
|
120513
120477
|
if (typeof startIndex === "number" && startIndex < 0 && chunkFiles.length > 0) {
|
|
120514
120478
|
const lastFile = chunkFiles[chunkFiles.length - 1];
|
|
@@ -120586,7 +120550,7 @@ function createLocalWorld(args) {
|
|
|
120586
120550
|
const basedir = mergedConfig.dataDir;
|
|
120587
120551
|
const hooksDir = path$3.join(basedir, "hooks");
|
|
120588
120552
|
const taggedHookFiles = await listTaggedFiles(hooksDir, tag);
|
|
120589
|
-
const { HookSchema: HookSchema2 } = await import("./index-
|
|
120553
|
+
const { HookSchema: HookSchema2 } = await import("./index-BL4Kw0eA.js");
|
|
120590
120554
|
await Promise.all(taggedHookFiles.map(async (hookFile) => {
|
|
120591
120555
|
const hook = await readJSON(path$3.join(hooksDir, hookFile), HookSchema2);
|
|
120592
120556
|
if (hook == null ? void 0 : hook.token) {
|
|
@@ -125218,6 +125182,11 @@ function requireSeedrandom() {
|
|
|
125218
125182
|
return seedrandom;
|
|
125219
125183
|
}
|
|
125220
125184
|
requireSeedrandom();
|
|
125185
|
+
const BASE64_CHARS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
125186
|
+
const BASE64_LOOKUP = new Uint8Array(128).fill(255);
|
|
125187
|
+
for (let i = 0; i < BASE64_CHARS.length; i++) {
|
|
125188
|
+
BASE64_LOOKUP[BASE64_CHARS.charCodeAt(i)] = i;
|
|
125189
|
+
}
|
|
125221
125190
|
async function getHookByTokenWithKey(token) {
|
|
125222
125191
|
var _a3;
|
|
125223
125192
|
const world = getWorld();
|
|
@@ -125301,7 +125270,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
125301
125270
|
});
|
|
125302
125271
|
});
|
|
125303
125272
|
}
|
|
125304
|
-
const version = "4.2.0-beta.
|
|
125273
|
+
const version = "4.2.0-beta.74";
|
|
125305
125274
|
const ulid = monotonicFactory();
|
|
125306
125275
|
async function start$1(workflow, argsOrOptions, options) {
|
|
125307
125276
|
return await waitedUntil(() => {
|
|
@@ -126818,15 +126787,45 @@ async function resumeHook$1(worldEnv, token, payload) {
|
|
|
126818
126787
|
});
|
|
126819
126788
|
}
|
|
126820
126789
|
}
|
|
126821
|
-
|
|
126790
|
+
const CHUNKS_PAGE_SIZE = 500;
|
|
126791
|
+
async function readStreamChunksServerAction(env2, streamId, runId, startCursor) {
|
|
126822
126792
|
try {
|
|
126823
126793
|
const world = await getWorldFromEnv(env2);
|
|
126824
|
-
|
|
126794
|
+
const allChunks = [];
|
|
126795
|
+
let pageCursor = startCursor;
|
|
126796
|
+
let streamDone = false;
|
|
126797
|
+
let resumeCursor = startCursor ?? null;
|
|
126798
|
+
do {
|
|
126799
|
+
const result = await world.getStreamChunks(streamId, runId, {
|
|
126800
|
+
limit: CHUNKS_PAGE_SIZE,
|
|
126801
|
+
cursor: pageCursor
|
|
126802
|
+
});
|
|
126803
|
+
for (const chunk of result.data) {
|
|
126804
|
+
allChunks.push(chunk.data);
|
|
126805
|
+
}
|
|
126806
|
+
streamDone = result.done;
|
|
126807
|
+
if (result.cursor) {
|
|
126808
|
+
resumeCursor = result.cursor;
|
|
126809
|
+
}
|
|
126810
|
+
pageCursor = result.cursor ?? void 0;
|
|
126811
|
+
} while (pageCursor);
|
|
126812
|
+
let totalSize = 0;
|
|
126813
|
+
for (const chunk of allChunks) {
|
|
126814
|
+
totalSize += chunk.length;
|
|
126815
|
+
}
|
|
126816
|
+
const body2 = new Uint8Array(totalSize);
|
|
126817
|
+
let offset2 = 0;
|
|
126818
|
+
for (const chunk of allChunks) {
|
|
126819
|
+
body2.set(chunk, offset2);
|
|
126820
|
+
offset2 += chunk.length;
|
|
126821
|
+
}
|
|
126822
|
+
return { buffer: body2, cursor: resumeCursor, done: streamDone };
|
|
126825
126823
|
} catch (error2) {
|
|
126826
|
-
const actionError = createServerActionError(
|
|
126827
|
-
|
|
126828
|
-
|
|
126829
|
-
|
|
126824
|
+
const actionError = createServerActionError(
|
|
126825
|
+
error2,
|
|
126826
|
+
"world.getStreamChunks",
|
|
126827
|
+
{ streamId, runId }
|
|
126828
|
+
);
|
|
126830
126829
|
if (!actionError.success) {
|
|
126831
126830
|
return actionError.error;
|
|
126832
126831
|
}
|
|
@@ -133016,9 +133015,13 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
|
133016
133015
|
function isServerActionError(value) {
|
|
133017
133016
|
return typeof value === "object" && value !== null && "message" in value && "layer" in value && "cause" in value && "request" in value;
|
|
133018
133017
|
}
|
|
133019
|
-
async function readStream(_env, streamId,
|
|
133018
|
+
async function readStream(_env, streamId, runId, signal, cursor) {
|
|
133020
133019
|
try {
|
|
133021
|
-
const
|
|
133020
|
+
const params = new URLSearchParams({ runId });
|
|
133021
|
+
if (cursor) {
|
|
133022
|
+
params.set("cursor", cursor);
|
|
133023
|
+
}
|
|
133024
|
+
const url2 = `/api/stream/${encodeURIComponent(streamId)}?${params.toString()}`;
|
|
133022
133025
|
const response2 = await fetch(url2, { signal });
|
|
133023
133026
|
if (!response2.ok) {
|
|
133024
133027
|
const errorData = await response2.json().catch(() => null);
|
|
@@ -133041,7 +133044,13 @@ async function readStream(_env, streamId, startIndex, signal) {
|
|
|
133041
133044
|
layer: "client"
|
|
133042
133045
|
});
|
|
133043
133046
|
}
|
|
133044
|
-
|
|
133047
|
+
const responseCursor = response2.headers.get("X-Stream-Cursor");
|
|
133048
|
+
const streamDone = response2.headers.get("X-Stream-Done") === "true";
|
|
133049
|
+
return {
|
|
133050
|
+
body: response2.body,
|
|
133051
|
+
cursor: responseCursor,
|
|
133052
|
+
done: streamDone
|
|
133053
|
+
};
|
|
133045
133054
|
} catch (error2) {
|
|
133046
133055
|
if (error2 instanceof WorkflowWebAPIError) {
|
|
133047
133056
|
throw error2;
|
|
@@ -133060,8 +133069,11 @@ function useWorkflowStreams(env2, runId, refreshInterval = STREAMS_REFRESH_INTER
|
|
|
133060
133069
|
const [streams, setStreams] = reactExports.useState([]);
|
|
133061
133070
|
const [loading, setLoading] = reactExports.useState(true);
|
|
133062
133071
|
const [error2, setError] = reactExports.useState(null);
|
|
133072
|
+
const hasFetchedRef = reactExports.useRef(false);
|
|
133063
133073
|
const fetchData = reactExports.useCallback(async () => {
|
|
133064
|
-
|
|
133074
|
+
if (!hasFetchedRef.current) {
|
|
133075
|
+
setLoading(true);
|
|
133076
|
+
}
|
|
133065
133077
|
setError(null);
|
|
133066
133078
|
try {
|
|
133067
133079
|
const result = await listStreams(env2, runId);
|
|
@@ -133069,10 +133081,12 @@ function useWorkflowStreams(env2, runId, refreshInterval = STREAMS_REFRESH_INTER
|
|
|
133069
133081
|
} catch (err) {
|
|
133070
133082
|
setError(err instanceof Error ? err : new Error(String(err)));
|
|
133071
133083
|
} finally {
|
|
133084
|
+
hasFetchedRef.current = true;
|
|
133072
133085
|
setLoading(false);
|
|
133073
133086
|
}
|
|
133074
133087
|
}, [env2, runId]);
|
|
133075
133088
|
reactExports.useEffect(() => {
|
|
133089
|
+
hasFetchedRef.current = false;
|
|
133076
133090
|
fetchData();
|
|
133077
133091
|
}, [fetchData]);
|
|
133078
133092
|
reactExports.useEffect(() => {
|
|
@@ -135207,8 +135221,8 @@ function useRunActions({
|
|
|
135207
135221
|
const handleCancel = reactExports.useCallback(async () => {
|
|
135208
135222
|
var _a3;
|
|
135209
135223
|
if (cancelling) return;
|
|
135210
|
-
const
|
|
135211
|
-
if (!
|
|
135224
|
+
const isRunActive2 = runStatus === "pending" || runStatus === "running";
|
|
135225
|
+
if (!isRunActive2) {
|
|
135212
135226
|
toast.error("Cannot cancel", {
|
|
135213
135227
|
description: "Only active runs can be cancelled"
|
|
135214
135228
|
});
|
|
@@ -135292,7 +135306,7 @@ function RunActionsDropdownItems({
|
|
|
135292
135306
|
if (stopPropagation) e.stopPropagation();
|
|
135293
135307
|
handleCancel();
|
|
135294
135308
|
};
|
|
135295
|
-
const
|
|
135309
|
+
const isRunActive2 = runStatus === "pending" || runStatus === "running";
|
|
135296
135310
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
135297
135311
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(DropdownMenuItem, { onClick: onReplay, disabled: rerunning, children: [
|
|
135298
135312
|
/* @__PURE__ */ jsxRuntimeExports.jsx(RotateCw, { className: "h-4 w-4 mr-2" }),
|
|
@@ -135330,7 +135344,7 @@ function RunActionsDropdownItems({
|
|
|
135330
135344
|
DropdownMenuItem,
|
|
135331
135345
|
{
|
|
135332
135346
|
onClick: onCancel,
|
|
135333
|
-
disabled: !
|
|
135347
|
+
disabled: !isRunActive2 || cancelling,
|
|
135334
135348
|
children: [
|
|
135335
135349
|
/* @__PURE__ */ jsxRuntimeExports.jsx(CircleX, { className: "h-4 w-4 mr-2" }),
|
|
135336
135350
|
cancelling ? "Cancelling..." : "Cancel"
|
|
@@ -135357,10 +135371,10 @@ function RunActionsButtons({
|
|
|
135357
135371
|
handleReenqueue,
|
|
135358
135372
|
handleWakeUp
|
|
135359
135373
|
} = useRunActions({ env: env2, runId, runStatus, events: events2, callbacks });
|
|
135360
|
-
const
|
|
135361
|
-
const canCancel =
|
|
135362
|
-
const canRerun = !loading && !
|
|
135363
|
-
const rerunDisabledReason = loading ? "Loading run data..." :
|
|
135374
|
+
const isRunActive2 = runStatus === "pending" || runStatus === "running";
|
|
135375
|
+
const canCancel = isRunActive2;
|
|
135376
|
+
const canRerun = !loading && !isRunActive2;
|
|
135377
|
+
const rerunDisabledReason = loading ? "Loading run data..." : isRunActive2 ? "Cannot re-run while workflow is still running" : "";
|
|
135364
135378
|
const cancelDisabledReason = runStatus === "completed" ? "Run has already completed" : runStatus === "failed" ? "Run has already failed" : runStatus === "cancelled" ? "Run has already been cancelled" : "";
|
|
135365
135379
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
|
|
135366
135380
|
/* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
@@ -148208,6 +148222,11 @@ function BreadcrumbSeparator({
|
|
|
148208
148222
|
);
|
|
148209
148223
|
}
|
|
148210
148224
|
const FRAME_HEADER_SIZE = 4;
|
|
148225
|
+
const ENCRYPTED_PLACEHOLDER = "[Encrypted]";
|
|
148226
|
+
const POLL_INTERVAL_MS = 3e3;
|
|
148227
|
+
function isRunActive(status) {
|
|
148228
|
+
return status === "pending" || status === "running";
|
|
148229
|
+
}
|
|
148211
148230
|
const MAX_DISPLAY_ENTRIES = 200;
|
|
148212
148231
|
const MAX_DISPLAY_DEPTH = 6;
|
|
148213
148232
|
function sanitizeForDisplay(value, depth = 0) {
|
|
@@ -148264,17 +148283,75 @@ function detectEncoding(data) {
|
|
|
148264
148283
|
if (len > 0 && len <= 10 * 1024 * 1024) return "framed";
|
|
148265
148284
|
return "legacy";
|
|
148266
148285
|
}
|
|
148267
|
-
function useStreamReader(env2, streamId, runId, encryptionKey) {
|
|
148286
|
+
function useStreamReader(env2, streamId, runId, encryptionKey, runStatus) {
|
|
148268
148287
|
const [chunks, setChunks] = reactExports.useState([]);
|
|
148269
148288
|
const [isLive, setIsLive] = reactExports.useState(false);
|
|
148270
148289
|
const [error2, setError] = reactExports.useState(null);
|
|
148271
148290
|
const abortControllerRef = reactExports.useRef(null);
|
|
148272
148291
|
const chunkIdRef = reactExports.useRef(0);
|
|
148292
|
+
const frameCountRef = reactExports.useRef(0);
|
|
148293
|
+
const pollTimerRef = reactExports.useRef(null);
|
|
148294
|
+
const runStatusRef = reactExports.useRef(runStatus);
|
|
148295
|
+
runStatusRef.current = runStatus;
|
|
148296
|
+
const serverCursorRef = reactExports.useRef(null);
|
|
148297
|
+
const processFrame = reactExports.useCallback(
|
|
148298
|
+
async (rawFrame, cryptoKey, revivers) => {
|
|
148299
|
+
let frameData = rawFrame;
|
|
148300
|
+
if (frameData.length >= FRAME_HEADER_SIZE + 4 && !isEncryptedData(frameData)) {
|
|
148301
|
+
const innerView = new DataView(
|
|
148302
|
+
frameData.buffer,
|
|
148303
|
+
frameData.byteOffset,
|
|
148304
|
+
frameData.byteLength
|
|
148305
|
+
);
|
|
148306
|
+
const innerLen = innerView.getUint32(0, false);
|
|
148307
|
+
if (innerLen > 0 && innerLen <= 10 * 1024 * 1024 && innerLen === frameData.length - FRAME_HEADER_SIZE) {
|
|
148308
|
+
frameData = frameData.slice(FRAME_HEADER_SIZE);
|
|
148309
|
+
}
|
|
148310
|
+
}
|
|
148311
|
+
let hydrated;
|
|
148312
|
+
try {
|
|
148313
|
+
if (isEncryptedData(frameData)) {
|
|
148314
|
+
if (!cryptoKey) {
|
|
148315
|
+
return { encrypted: true };
|
|
148316
|
+
}
|
|
148317
|
+
const payload = frameData.slice(4);
|
|
148318
|
+
hydrated = hydrateData(
|
|
148319
|
+
await decrypt(cryptoKey, payload),
|
|
148320
|
+
revivers
|
|
148321
|
+
);
|
|
148322
|
+
} else {
|
|
148323
|
+
hydrated = hydrateData(frameData, revivers);
|
|
148324
|
+
}
|
|
148325
|
+
} catch {
|
|
148326
|
+
hydrated = ENCRYPTED_PLACEHOLDER;
|
|
148327
|
+
}
|
|
148328
|
+
let text2;
|
|
148329
|
+
try {
|
|
148330
|
+
if (typeof hydrated === "string") {
|
|
148331
|
+
text2 = hydrated;
|
|
148332
|
+
} else {
|
|
148333
|
+
const safe = sanitizeForDisplay(hydrated);
|
|
148334
|
+
text2 = JSON.stringify(safe, null, 2);
|
|
148335
|
+
}
|
|
148336
|
+
} catch {
|
|
148337
|
+
text2 = "[Serialization Error]";
|
|
148338
|
+
}
|
|
148339
|
+
const chunkId = chunkIdRef.current++;
|
|
148340
|
+
return { encrypted: false, chunk: { id: chunkId, text: text2 } };
|
|
148341
|
+
},
|
|
148342
|
+
[]
|
|
148343
|
+
);
|
|
148273
148344
|
reactExports.useEffect(() => {
|
|
148274
148345
|
setChunks([]);
|
|
148275
148346
|
setError(null);
|
|
148276
148347
|
chunkIdRef.current = 0;
|
|
148277
|
-
|
|
148348
|
+
frameCountRef.current = 0;
|
|
148349
|
+
serverCursorRef.current = null;
|
|
148350
|
+
if (pollTimerRef.current) {
|
|
148351
|
+
clearTimeout(pollTimerRef.current);
|
|
148352
|
+
pollTimerRef.current = null;
|
|
148353
|
+
}
|
|
148354
|
+
if (!streamId || !runId) {
|
|
148278
148355
|
setIsLive(false);
|
|
148279
148356
|
return;
|
|
148280
148357
|
}
|
|
@@ -148283,137 +148360,177 @@ function useStreamReader(env2, streamId, runId, encryptionKey) {
|
|
|
148283
148360
|
abortControllerRef.current = abortController;
|
|
148284
148361
|
setIsLive(true);
|
|
148285
148362
|
const revivers = getWebRevivers();
|
|
148286
|
-
const
|
|
148363
|
+
const parseLegacyLine = (line) => {
|
|
148364
|
+
const chunkId = chunkIdRef.current++;
|
|
148365
|
+
let text2;
|
|
148287
148366
|
try {
|
|
148288
|
-
const
|
|
148289
|
-
|
|
148290
|
-
|
|
148291
|
-
|
|
148292
|
-
|
|
148293
|
-
|
|
148294
|
-
|
|
148295
|
-
|
|
148296
|
-
|
|
148297
|
-
|
|
148298
|
-
|
|
148299
|
-
|
|
148300
|
-
|
|
148301
|
-
|
|
148302
|
-
|
|
148303
|
-
|
|
148304
|
-
|
|
148305
|
-
|
|
148306
|
-
|
|
148307
|
-
|
|
148308
|
-
|
|
148309
|
-
|
|
148310
|
-
|
|
148311
|
-
|
|
148312
|
-
|
|
148313
|
-
|
|
148314
|
-
|
|
148315
|
-
|
|
148316
|
-
|
|
148317
|
-
|
|
148318
|
-
|
|
148319
|
-
|
|
148320
|
-
|
|
148321
|
-
|
|
148322
|
-
if (
|
|
148323
|
-
|
|
148324
|
-
textRemainder = "";
|
|
148367
|
+
const parsed = JSON.parse(line);
|
|
148368
|
+
text2 = JSON.stringify(parsed, null, 2);
|
|
148369
|
+
} catch {
|
|
148370
|
+
text2 = line;
|
|
148371
|
+
}
|
|
148372
|
+
return { id: chunkId, text: text2 };
|
|
148373
|
+
};
|
|
148374
|
+
const fetchAndParse = async (targetBuffer, cryptoKey, options) => {
|
|
148375
|
+
const streamResponse = await readStream(
|
|
148376
|
+
env2,
|
|
148377
|
+
streamId,
|
|
148378
|
+
runId,
|
|
148379
|
+
abortController.signal,
|
|
148380
|
+
options == null ? void 0 : options.cursor
|
|
148381
|
+
);
|
|
148382
|
+
const skipFrames = (options == null ? void 0 : options.skipFrames) ?? 0;
|
|
148383
|
+
const reader = streamResponse.body.getReader();
|
|
148384
|
+
const decoder2 = new TextDecoder();
|
|
148385
|
+
let buffer = new Uint8Array(0);
|
|
148386
|
+
let encoding2 = null;
|
|
148387
|
+
let textRemainder = "";
|
|
148388
|
+
let frameIndex = 0;
|
|
148389
|
+
const appendToBuffer = (data) => {
|
|
148390
|
+
const newBuffer = new Uint8Array(buffer.length + data.length);
|
|
148391
|
+
newBuffer.set(buffer, 0);
|
|
148392
|
+
newBuffer.set(data, buffer.length);
|
|
148393
|
+
buffer = newBuffer;
|
|
148394
|
+
};
|
|
148395
|
+
for (; ; ) {
|
|
148396
|
+
if (abortController.signal.aborted) break;
|
|
148397
|
+
const { value, done } = await reader.read();
|
|
148398
|
+
if (done) {
|
|
148399
|
+
if (encoding2 === "legacy" && textRemainder.trim()) {
|
|
148400
|
+
frameIndex++;
|
|
148401
|
+
if (frameIndex > skipFrames) {
|
|
148402
|
+
targetBuffer.push(parseLegacyLine(textRemainder.trim()));
|
|
148325
148403
|
}
|
|
148326
|
-
|
|
148327
|
-
break;
|
|
148404
|
+
textRemainder = "";
|
|
148328
148405
|
}
|
|
148329
|
-
|
|
148330
|
-
|
|
148331
|
-
|
|
148332
|
-
|
|
148333
|
-
|
|
148334
|
-
|
|
148335
|
-
textRemainder = decoder2.decode(buffer, { stream: true });
|
|
148336
|
-
buffer = new Uint8Array(0);
|
|
148337
|
-
}
|
|
148338
|
-
} else if (encoding2 === "legacy") {
|
|
148339
|
-
textRemainder += decoder2.decode(value, { stream: true });
|
|
148340
|
-
} else {
|
|
148341
|
-
appendToBuffer(value);
|
|
148406
|
+
break;
|
|
148407
|
+
}
|
|
148408
|
+
if (encoding2 === null) {
|
|
148409
|
+
appendToBuffer(value);
|
|
148410
|
+
if (buffer.length >= FRAME_HEADER_SIZE) {
|
|
148411
|
+
encoding2 = detectEncoding(buffer);
|
|
148342
148412
|
}
|
|
148343
148413
|
if (encoding2 === "legacy") {
|
|
148344
|
-
|
|
148345
|
-
|
|
148346
|
-
|
|
148347
|
-
|
|
148348
|
-
|
|
148414
|
+
textRemainder = decoder2.decode(buffer, { stream: true });
|
|
148415
|
+
buffer = new Uint8Array(0);
|
|
148416
|
+
}
|
|
148417
|
+
} else if (encoding2 === "legacy") {
|
|
148418
|
+
textRemainder += decoder2.decode(value, { stream: true });
|
|
148419
|
+
} else {
|
|
148420
|
+
appendToBuffer(value);
|
|
148421
|
+
}
|
|
148422
|
+
if (encoding2 === "legacy") {
|
|
148423
|
+
const lines = textRemainder.split("\n");
|
|
148424
|
+
textRemainder = lines.pop() ?? "";
|
|
148425
|
+
for (const line of lines) {
|
|
148426
|
+
const trimmed = line.trim();
|
|
148427
|
+
if (trimmed) {
|
|
148428
|
+
frameIndex++;
|
|
148429
|
+
if (frameIndex > skipFrames) {
|
|
148430
|
+
targetBuffer.push(parseLegacyLine(trimmed));
|
|
148431
|
+
}
|
|
148349
148432
|
}
|
|
148433
|
+
}
|
|
148434
|
+
continue;
|
|
148435
|
+
}
|
|
148436
|
+
let offset2 = 0;
|
|
148437
|
+
let framesInBatch = 0;
|
|
148438
|
+
while (offset2 + FRAME_HEADER_SIZE <= buffer.length) {
|
|
148439
|
+
const view = new DataView(
|
|
148440
|
+
buffer.buffer,
|
|
148441
|
+
buffer.byteOffset + offset2,
|
|
148442
|
+
buffer.byteLength - offset2
|
|
148443
|
+
);
|
|
148444
|
+
const frameLength = view.getUint32(0, false);
|
|
148445
|
+
if (frameLength === 0 || frameLength > 10 * 1024 * 1024) {
|
|
148446
|
+
break;
|
|
148447
|
+
}
|
|
148448
|
+
if (offset2 + FRAME_HEADER_SIZE + frameLength > buffer.length) {
|
|
148449
|
+
break;
|
|
148450
|
+
}
|
|
148451
|
+
const frameData = buffer.slice(
|
|
148452
|
+
offset2 + FRAME_HEADER_SIZE,
|
|
148453
|
+
offset2 + FRAME_HEADER_SIZE + frameLength
|
|
148454
|
+
);
|
|
148455
|
+
offset2 += FRAME_HEADER_SIZE + frameLength;
|
|
148456
|
+
frameIndex++;
|
|
148457
|
+
if (frameIndex <= skipFrames) {
|
|
148350
148458
|
continue;
|
|
148351
148459
|
}
|
|
148352
|
-
|
|
148353
|
-
|
|
148354
|
-
|
|
148355
|
-
|
|
148356
|
-
|
|
148357
|
-
|
|
148358
|
-
|
|
148359
|
-
|
|
148360
|
-
|
|
148361
|
-
|
|
148362
|
-
|
|
148363
|
-
|
|
148364
|
-
|
|
148365
|
-
|
|
148366
|
-
|
|
148367
|
-
|
|
148368
|
-
|
|
148369
|
-
|
|
148370
|
-
|
|
148371
|
-
|
|
148460
|
+
const result = await processFrame(frameData, cryptoKey, revivers);
|
|
148461
|
+
if (result.encrypted) {
|
|
148462
|
+
reader.cancel().catch(() => {
|
|
148463
|
+
});
|
|
148464
|
+
return { encrypted: true };
|
|
148465
|
+
}
|
|
148466
|
+
targetBuffer.push(result.chunk);
|
|
148467
|
+
framesInBatch++;
|
|
148468
|
+
if (framesInBatch % YIELD_EVERY_N_FRAMES === 0) {
|
|
148469
|
+
await yieldToMain();
|
|
148470
|
+
if (abortController.signal.aborted || !mounted) break;
|
|
148471
|
+
}
|
|
148472
|
+
}
|
|
148473
|
+
buffer = buffer.slice(offset2);
|
|
148474
|
+
}
|
|
148475
|
+
return {
|
|
148476
|
+
encrypted: false,
|
|
148477
|
+
frameCount: frameIndex,
|
|
148478
|
+
cursor: streamResponse.cursor,
|
|
148479
|
+
done: streamResponse.done
|
|
148480
|
+
};
|
|
148481
|
+
};
|
|
148482
|
+
const readStreamData = async () => {
|
|
148483
|
+
try {
|
|
148484
|
+
const cryptoKey = encryptionKey ? await importKey(encryptionKey) : void 0;
|
|
148485
|
+
const initialChunks = [];
|
|
148486
|
+
const result = await fetchAndParse(initialChunks, cryptoKey);
|
|
148487
|
+
if (result.encrypted) {
|
|
148488
|
+
if (mounted) {
|
|
148489
|
+
setError("This stream is encrypted. Click Decrypt to view.");
|
|
148490
|
+
setIsLive(false);
|
|
148491
|
+
}
|
|
148492
|
+
return;
|
|
148493
|
+
}
|
|
148494
|
+
frameCountRef.current = result.frameCount;
|
|
148495
|
+
serverCursorRef.current = result.cursor;
|
|
148496
|
+
if (!mounted || abortController.signal.aborted) return;
|
|
148497
|
+
setChunks(initialChunks);
|
|
148498
|
+
if (result.done) {
|
|
148499
|
+
setIsLive(false);
|
|
148500
|
+
return;
|
|
148501
|
+
}
|
|
148502
|
+
if (isRunActive(runStatusRef.current)) {
|
|
148503
|
+
const poll = async () => {
|
|
148504
|
+
if (!mounted || abortController.signal.aborted) return;
|
|
148372
148505
|
try {
|
|
148373
|
-
const
|
|
148374
|
-
|
|
148375
|
-
|
|
148376
|
-
|
|
148377
|
-
|
|
148378
|
-
|
|
148379
|
-
|
|
148380
|
-
|
|
148381
|
-
|
|
148382
|
-
}
|
|
148383
|
-
reader.cancel().catch(() => {
|
|
148384
|
-
});
|
|
148385
|
-
return;
|
|
148506
|
+
const newChunks = [];
|
|
148507
|
+
const pollResult = await fetchAndParse(newChunks, cryptoKey, {
|
|
148508
|
+
cursor: serverCursorRef.current,
|
|
148509
|
+
skipFrames: frameCountRef.current
|
|
148510
|
+
});
|
|
148511
|
+
if (!pollResult.encrypted) {
|
|
148512
|
+
frameCountRef.current = pollResult.frameCount;
|
|
148513
|
+
if (pollResult.cursor) {
|
|
148514
|
+
serverCursorRef.current = pollResult.cursor;
|
|
148386
148515
|
}
|
|
148387
|
-
|
|
148388
|
-
|
|
148389
|
-
|
|
148390
|
-
|
|
148391
|
-
|
|
148392
|
-
|
|
148393
|
-
const chunkId = chunkIdRef.current++;
|
|
148394
|
-
let text2;
|
|
148395
|
-
try {
|
|
148396
|
-
if (typeof hydrated === "string") {
|
|
148397
|
-
text2 = hydrated;
|
|
148398
|
-
} else {
|
|
148399
|
-
const safe = sanitizeForDisplay(hydrated);
|
|
148400
|
-
text2 = JSON.stringify(safe, null, 2);
|
|
148401
|
-
}
|
|
148402
|
-
} catch {
|
|
148403
|
-
text2 = "[Serialization Error]";
|
|
148516
|
+
if (newChunks.length > 0 && mounted) {
|
|
148517
|
+
setChunks((prev) => [...prev, ...newChunks]);
|
|
148518
|
+
}
|
|
148519
|
+
if (pollResult.done) {
|
|
148520
|
+
setIsLive(false);
|
|
148521
|
+
return;
|
|
148404
148522
|
}
|
|
148405
|
-
setChunks((prev) => [...prev, { id: chunkId, text: text2 }]);
|
|
148406
148523
|
}
|
|
148407
148524
|
} catch (err) {
|
|
148408
|
-
console.
|
|
148525
|
+
console.warn("Stream poll error:", err);
|
|
148409
148526
|
}
|
|
148410
|
-
|
|
148411
|
-
|
|
148412
|
-
await yieldToMain();
|
|
148413
|
-
if (abortController.signal.aborted || !mounted) break;
|
|
148527
|
+
if (mounted && !abortController.signal.aborted) {
|
|
148528
|
+
pollTimerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
148414
148529
|
}
|
|
148415
|
-
}
|
|
148416
|
-
|
|
148530
|
+
};
|
|
148531
|
+
pollTimerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
148532
|
+
} else {
|
|
148533
|
+
setIsLive(false);
|
|
148417
148534
|
}
|
|
148418
148535
|
} catch (err) {
|
|
148419
148536
|
if (abortController.signal.aborted) return;
|
|
@@ -148426,11 +148543,20 @@ function useStreamReader(env2, streamId, runId, encryptionKey) {
|
|
|
148426
148543
|
void readStreamData();
|
|
148427
148544
|
return () => {
|
|
148428
148545
|
mounted = false;
|
|
148429
|
-
|
|
148430
|
-
|
|
148546
|
+
abortController.abort();
|
|
148547
|
+
if (pollTimerRef.current) {
|
|
148548
|
+
clearTimeout(pollTimerRef.current);
|
|
148549
|
+
pollTimerRef.current = null;
|
|
148431
148550
|
}
|
|
148432
148551
|
};
|
|
148433
|
-
}, [env2, streamId, runId, encryptionKey]);
|
|
148552
|
+
}, [env2, streamId, runId, encryptionKey, processFrame]);
|
|
148553
|
+
reactExports.useEffect(() => {
|
|
148554
|
+
if (!isRunActive(runStatus) && pollTimerRef.current) {
|
|
148555
|
+
clearTimeout(pollTimerRef.current);
|
|
148556
|
+
pollTimerRef.current = null;
|
|
148557
|
+
setIsLive(false);
|
|
148558
|
+
}
|
|
148559
|
+
}, [runStatus]);
|
|
148434
148560
|
return { chunks, isLive, error: error2 };
|
|
148435
148561
|
}
|
|
148436
148562
|
const INITIAL_PAGE_SIZE = 100;
|
|
@@ -148603,7 +148729,7 @@ function RunDetailView({
|
|
|
148603
148729
|
);
|
|
148604
148730
|
const setActiveTab = reactExports.useCallback(
|
|
148605
148731
|
(tab2) => {
|
|
148606
|
-
if (tab2
|
|
148732
|
+
if (tab2 !== "streams") {
|
|
148607
148733
|
updateSearchParams({ tab: tab2, streamId: null });
|
|
148608
148734
|
} else {
|
|
148609
148735
|
updateSearchParams({ tab: tab2 });
|
|
@@ -148749,7 +148875,7 @@ function RunDetailView({
|
|
|
148749
148875
|
chunks: streamChunks,
|
|
148750
148876
|
isLive: streamIsLive,
|
|
148751
148877
|
error: streamError
|
|
148752
|
-
} = useStreamReader(env2, selectedStreamId, runId, encryptionKey);
|
|
148878
|
+
} = useStreamReader(env2, selectedStreamId, runId, encryptionKey, run.status);
|
|
148753
148879
|
const handleCancelClick = () => {
|
|
148754
148880
|
setShowCancelDialog(true);
|
|
148755
148881
|
};
|
|
@@ -149221,27 +149347,32 @@ async function loader({
|
|
|
149221
149347
|
});
|
|
149222
149348
|
}
|
|
149223
149349
|
const url2 = new URL(request2.url);
|
|
149224
|
-
const
|
|
149225
|
-
|
|
149226
|
-
if (startIndex !== void 0 && Number.isNaN(startIndex)) {
|
|
149350
|
+
const runId = url2.searchParams.get("runId");
|
|
149351
|
+
if (!runId) {
|
|
149227
149352
|
return Response.json({
|
|
149228
|
-
message: "
|
|
149353
|
+
message: "Missing runId parameter",
|
|
149229
149354
|
layer: "server"
|
|
149230
149355
|
}, {
|
|
149231
149356
|
status: 400
|
|
149232
149357
|
});
|
|
149233
149358
|
}
|
|
149359
|
+
const cursor = url2.searchParams.get("cursor") ?? void 0;
|
|
149234
149360
|
try {
|
|
149235
|
-
const
|
|
149236
|
-
if (!
|
|
149237
|
-
return Response.json(
|
|
149361
|
+
const result = await readStreamChunksServerAction({}, streamId, runId, cursor);
|
|
149362
|
+
if (!("buffer" in result)) {
|
|
149363
|
+
return Response.json(result, {
|
|
149238
149364
|
status: 500
|
|
149239
149365
|
});
|
|
149240
149366
|
}
|
|
149241
|
-
|
|
149242
|
-
|
|
149243
|
-
|
|
149244
|
-
|
|
149367
|
+
const headers2 = {
|
|
149368
|
+
"Content-Type": "application/octet-stream",
|
|
149369
|
+
"X-Stream-Done": String(result.done)
|
|
149370
|
+
};
|
|
149371
|
+
if (result.cursor) {
|
|
149372
|
+
headers2["X-Stream-Cursor"] = result.cursor;
|
|
149373
|
+
}
|
|
149374
|
+
return new Response(result.buffer, {
|
|
149375
|
+
headers: headers2
|
|
149245
149376
|
});
|
|
149246
149377
|
} catch (error2) {
|
|
149247
149378
|
const message2 = error2 instanceof Error ? error2.message : String(error2);
|
|
@@ -149257,7 +149388,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
149257
149388
|
__proto__: null,
|
|
149258
149389
|
loader
|
|
149259
149390
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
149260
|
-
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-
|
|
149391
|
+
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-Dae_xV-y.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-D95wSBpg.js"], "css": ["/assets/root-DtrAdcW8.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-ClC-EMyL.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/workflow-graph-viewer-BZlGoIt2.js", "/assets/mermaid-3ZIDBTTL-D95wSBpg.js"], "css": ["/assets/workflow-graph-viewer-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-Brs1Rm25.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/workflow-graph-viewer-BZlGoIt2.js", "/assets/mermaid-3ZIDBTTL-D95wSBpg.js", "/assets/encryption-8OvC6eoJ.js"], "css": ["/assets/workflow-graph-viewer-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-7a6ad03e.js", "version": "7a6ad03e", "sri": void 0 };
|
|
149261
149392
|
const assetsBuildDirectory = "build/client";
|
|
149262
149393
|
const basename = "/";
|
|
149263
149394
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|