@workflow/web 4.1.0-beta.38 → 4.1.0-beta.40
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/client/assets/{highlighted-body-B3W2YXNL-Rt-vkvmE.js → highlighted-body-B3W2YXNL-BlfdcYh0.js} +1 -1
- package/build/client/assets/home-Xl3EX8M3.js +35 -0
- package/build/client/assets/{manifest-069935e6.js → manifest-0e172cba.js} +1 -1
- package/build/client/assets/{mermaid-3ZIDBTTL-DcdZu9sS.js → mermaid-3ZIDBTTL-RlQIshou.js} +11 -11
- package/build/client/assets/root-9gRDb_Jz.css +1 -0
- package/build/client/assets/{root-DZgYUaDo.js → root-D-041AAq.js} +1 -1
- package/build/client/assets/run-detail-BPOihWwO.js +41 -0
- package/build/client/assets/server-build-Dj97HEP4.css +1 -0
- package/build/client/assets/{use-workflow-graph-CF7nLapT.js → use-workflow-graph-C-GqGBPl.js} +1 -1
- package/build/server/assets/{app-B9Eg2ZwJ.js → app-DLRJr3zg.js} +1 -1
- package/build/server/assets/{highlighted-body-B3W2YXNL-CppXFHRG.js → highlighted-body-B3W2YXNL-7BMdhIzo.js} +2 -2
- package/build/server/assets/{mermaid-3ZIDBTTL-DB0PiTjt.js → mermaid-3ZIDBTTL-C-mhM4Cx.js} +2 -2
- package/build/server/assets/{server-build-HMYt9inG.js → server-build-B-uZ5KmC.js} +661 -797
- package/build/server/assets/{token-CBxSSoxh.js → token-BRJJ012D.js} +2 -2
- package/build/server/assets/{token-COnBvzNW.js → token-mzBpVePm.js} +3 -3
- package/build/server/assets/{token-util-QvbM3ECv.js → token-util-C29I-on4.js} +1 -1
- package/build/server/assets/{token-util-7Q4_oN66.js → token-util-D7WmNSMO.js} +2 -2
- package/build/server/assets/{token-util-CagM_XOH.js → token-util-YAVqVR6-.js} +2 -2
- package/build/server/index.js +1 -1
- package/package.json +6 -8
- package/build/client/assets/home-Cpz2_ZDM.js +0 -35
- package/build/client/assets/root-Dr_TuMgh.css +0 -1
- package/build/client/assets/run-detail-xcvWVR2B.js +0 -41
- package/build/client/assets/server-build-CgcbAXmU.css +0 -1
|
@@ -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-
|
|
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-DLRJr3zg.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";
|
|
@@ -23352,8 +23352,8 @@ function handleRequest(request2, responseStatusCode, responseHeaders, routerCont
|
|
|
23352
23352
|
}
|
|
23353
23353
|
return new Promise((resolve2, reject) => {
|
|
23354
23354
|
let shellRendered = false;
|
|
23355
|
-
|
|
23356
|
-
|
|
23355
|
+
const userAgent = request2.headers.get("user-agent");
|
|
23356
|
+
const readyOption = userAgent && isbot(userAgent) || routerContext.isSpaMode ? "onAllReady" : "onShellReady";
|
|
23357
23357
|
let timeoutId = setTimeout(
|
|
23358
23358
|
() => abort(),
|
|
23359
23359
|
streamTimeout + 1e3
|
|
@@ -37101,16 +37101,19 @@ function getStatusDotColor(eventType) {
|
|
|
37101
37101
|
}
|
|
37102
37102
|
return "var(--ds-gray-600)";
|
|
37103
37103
|
}
|
|
37104
|
-
function buildNameMaps(
|
|
37105
|
-
var _a3;
|
|
37104
|
+
function buildNameMaps(events2, run) {
|
|
37105
|
+
var _a3, _b;
|
|
37106
37106
|
const correlationNameMap = /* @__PURE__ */ new Map();
|
|
37107
|
-
if (
|
|
37108
|
-
for (const
|
|
37109
|
-
|
|
37110
|
-
|
|
37107
|
+
if (events2) {
|
|
37108
|
+
for (const event of events2) {
|
|
37109
|
+
if (event.eventType === "step_created" && event.correlationId) {
|
|
37110
|
+
const stepName = ((_a3 = event.eventData) == null ? void 0 : _a3.stepName) ?? "";
|
|
37111
|
+
const parsed = parseStepName(String(stepName));
|
|
37112
|
+
correlationNameMap.set(event.correlationId, (parsed == null ? void 0 : parsed.shortName) ?? stepName);
|
|
37113
|
+
}
|
|
37111
37114
|
}
|
|
37112
37115
|
}
|
|
37113
|
-
const workflowName = (run == null ? void 0 : run.workflowName) ? ((
|
|
37116
|
+
const workflowName = (run == null ? void 0 : run.workflowName) ? ((_b = parseWorkflowName(run.workflowName)) == null ? void 0 : _b.shortName) ?? run.workflowName : null;
|
|
37114
37117
|
return { correlationNameMap, workflowName };
|
|
37115
37118
|
}
|
|
37116
37119
|
function buildDurationMap(events2) {
|
|
@@ -37436,13 +37439,13 @@ function EventRow({ event, index: index2, isFirst, isLast, activeGroupKey, selec
|
|
|
37436
37439
|
color: "var(--ds-red-900)"
|
|
37437
37440
|
}, children: loadError }) : isLoading || !hasExistingEventData && !hasAttemptedLoad && event.correlationId ? jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2 p-3", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "75%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "50%" } }), jsxRuntimeExports.jsx(Skeleton$2, { className: "h-3", style: { width: "60%" } })] }) : jsxRuntimeExports.jsx("div", { className: "p-2 text-xs", style: { color: "var(--ds-gray-900)" }, children: "No data" })] })] })] });
|
|
37438
37441
|
}
|
|
37439
|
-
function EventListView({ events: events2,
|
|
37442
|
+
function EventListView({ events: events2, run, onLoadEventData, hasMoreEvents = false, isLoadingMoreEvents = false, onLoadMoreEvents, encryptionKey }) {
|
|
37440
37443
|
const sortedEvents2 = reactExports.useMemo(() => {
|
|
37441
37444
|
if (!events2 || events2.length === 0)
|
|
37442
37445
|
return [];
|
|
37443
37446
|
return [...events2].sort((a2, b2) => new Date(a2.createdAt).getTime() - new Date(b2.createdAt).getTime());
|
|
37444
37447
|
}, [events2]);
|
|
37445
|
-
const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(
|
|
37448
|
+
const { correlationNameMap, workflowName } = reactExports.useMemo(() => buildNameMaps(events2 ?? null, run ?? null), [events2, run]);
|
|
37446
37449
|
const durationMap = reactExports.useMemo(() => buildDurationMap(sortedEvents2), [sortedEvents2]);
|
|
37447
37450
|
const [selectedGroupKey, setSelectedGroupKey] = reactExports.useState(void 0);
|
|
37448
37451
|
const [hoveredGroupKey, setHoveredGroupKey] = reactExports.useState(void 0);
|
|
@@ -64424,7 +64427,7 @@ var tn = f("block", "before:content-[counter(line)]", "before:inline-block", "be
|
|
|
64424
64427
|
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
64428
|
var Se = reactExports.createContext({ code: "" }), de$1 = () => reactExports.useContext(Se);
|
|
64426
64429
|
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-
|
|
64430
|
+
var cn$1 = /\n+$/, dn = reactExports.lazy(() => import("./highlighted-body-B3W2YXNL-7BMdhIzo.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), rt = ({ code: e, language: t, className: o, children: n, isIncomplete: s2 = false, ...r2 }) => {
|
|
64428
64431
|
let i = reactExports.useMemo(() => e.replace(cn$1, ""), [e]), c = reactExports.useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: i.split(`
|
|
64429
64432
|
`).map((a2) => [{ content: a2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [i]);
|
|
64430
64433
|
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 +64749,7 @@ var Dt = ({ children: e, className: t, onDownload: o, onError: n }) => {
|
|
|
64746
64749
|
}, []), 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
64750
|
};
|
|
64748
64751
|
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-
|
|
64752
|
+
var Jn = reactExports.lazy(() => import("./mermaid-3ZIDBTTL-C-mhM4Cx.js").then((e) => ({ default: e.Mermaid }))), Kn = /language-([^\s]+)/;
|
|
64750
64753
|
function ke(e, t) {
|
|
64751
64754
|
if (!(e != null && e.position || t != null && t.position)) return true;
|
|
64752
64755
|
if (!(e != null && e.position && (t != null && t.position))) return false;
|
|
@@ -65325,11 +65328,12 @@ function DetailCard({ summary, children: children2, onToggle, disabled = false,
|
|
|
65325
65328
|
opacity: 0.8
|
|
65326
65329
|
}, children: summary });
|
|
65327
65330
|
}
|
|
65328
|
-
return jsxRuntimeExports.jsxs("details", { className: "group", onToggle: (e) => onToggle == null ? void 0 : onToggle(e.target.open), children: [jsxRuntimeExports.jsx("summary", { className: `cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 ${summaryClassName ?? ""}`, style: {
|
|
65331
|
+
return jsxRuntimeExports.jsxs("details", { className: "group", onToggle: (e) => onToggle == null ? void 0 : onToggle(e.target.open), children: [jsxRuntimeExports.jsx("summary", { className: `cursor-pointer rounded-md border px-2.5 py-1.5 text-xs hover:brightness-95 [&::-webkit-details-marker]:hidden ${summaryClassName ?? ""}`, style: {
|
|
65329
65332
|
borderColor: "var(--ds-gray-300)",
|
|
65330
65333
|
backgroundColor: "var(--ds-gray-100)",
|
|
65331
|
-
color: "var(--ds-gray-900)"
|
|
65332
|
-
|
|
65334
|
+
color: "var(--ds-gray-900)",
|
|
65335
|
+
listStyle: "none"
|
|
65336
|
+
}, children: jsxRuntimeExports.jsxs("span", { className: "flex items-center gap-1.5", children: [jsxRuntimeExports.jsx(ChevronRight, { size: 14, className: "shrink-0 transition-transform group-open:rotate-90" }), summary] }) }), jsxRuntimeExports.jsxs("div", { className: `relative pl-6 mt-3 ${contentClassName ?? ""}`, children: [jsxRuntimeExports.jsx("div", { className: "absolute left-3 -top-3 w-px h-3", style: { backgroundColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { className: "absolute left-3 top-0 w-3 h-3 border-l border-b rounded-bl-lg", style: { borderColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { className: "absolute left-6 top-3 w-0 h-px -translate-y-px", style: { backgroundColor: "var(--ds-gray-400)" } }), jsxRuntimeExports.jsx("div", { children: children2 })] })] });
|
|
65333
65337
|
}
|
|
65334
65338
|
function TabButton({ active, onClick, children: children2 }) {
|
|
65335
65339
|
return jsxRuntimeExports.jsx("button", { type: "button", role: "tab", "aria-selected": active, tabIndex: active ? 0 : -1, onClick, className: "px-3 py-1.5 text-[11px] font-medium transition-colors -mb-px", style: {
|
|
@@ -65404,6 +65408,9 @@ const attributeOrder = [
|
|
|
65404
65408
|
"runId",
|
|
65405
65409
|
"attempt",
|
|
65406
65410
|
"token",
|
|
65411
|
+
"receivedCount",
|
|
65412
|
+
"lastReceivedAt",
|
|
65413
|
+
"disposedAt",
|
|
65407
65414
|
"correlationId",
|
|
65408
65415
|
"eventType",
|
|
65409
65416
|
"deploymentId",
|
|
@@ -65432,7 +65439,8 @@ const sortByAttributeOrder = (a2, b2) => {
|
|
|
65432
65439
|
return aIndex - bIndex;
|
|
65433
65440
|
};
|
|
65434
65441
|
const attributeDisplayNames = {
|
|
65435
|
-
workflowCoreVersion: "@workflow/core version"
|
|
65442
|
+
workflowCoreVersion: "@workflow/core version",
|
|
65443
|
+
receivedCount: "times resolved"
|
|
65436
65444
|
};
|
|
65437
65445
|
const getAttributeDisplayName = (attribute) => {
|
|
65438
65446
|
return attributeDisplayNames[attribute] ?? attribute;
|
|
@@ -65507,6 +65515,9 @@ const attributeToDisplayFn = {
|
|
|
65507
65515
|
// Hook details
|
|
65508
65516
|
token: (value) => String(value),
|
|
65509
65517
|
isWebhook: (value) => String(value),
|
|
65518
|
+
receivedCount: (value) => String(value),
|
|
65519
|
+
lastReceivedAt: localMillisecondTimeOrNull,
|
|
65520
|
+
disposedAt: localMillisecondTimeOrNull,
|
|
65510
65521
|
// Event details
|
|
65511
65522
|
eventType: (value) => String(value),
|
|
65512
65523
|
correlationId: (value) => String(value),
|
|
@@ -65683,8 +65694,9 @@ const AttributePanel = ({ data, moduleSpecifier, isLoading, error: error2, expir
|
|
|
65683
65694
|
const displayValue = (_a3 = attributeToDisplayFn[attribute]) == null ? void 0 : _a3.call(attributeToDisplayFn, displayData[attribute]);
|
|
65684
65695
|
const isModuleSpecifier = attribute === "moduleSpecifier";
|
|
65685
65696
|
const moduleSpecifierValue = typeof displayValue === "string" ? displayValue : String(displayValue ?? displayData.moduleSpecifier ?? "");
|
|
65697
|
+
const shouldCapitalizeLabel = attribute !== "workflowCoreVersion";
|
|
65686
65698
|
const showDivider = index2 < orderedBasicAttributes.length - 1;
|
|
65687
|
-
return jsxRuntimeExports.jsxs("div", { className: "py-1", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1", children: [jsxRuntimeExports.jsx("span", { className: "text-[14px] first-letter:uppercase", style: { color: "var(--ds-gray-700)" }, children: getAttributeDisplayName(attribute) }), isModuleSpecifier ? jsxRuntimeExports.jsx("button", { type: "button", className: "min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono", style: {
|
|
65699
|
+
return jsxRuntimeExports.jsxs("div", { className: "py-1", children: [jsxRuntimeExports.jsxs("div", { className: "flex min-h-[32px] items-center justify-between gap-4 rounded-sm px-2.5 py-1", children: [jsxRuntimeExports.jsx("span", { className: shouldCapitalizeLabel ? "text-[14px] first-letter:uppercase" : "text-[14px]", style: { color: "var(--ds-gray-700)" }, children: getAttributeDisplayName(attribute) }), isModuleSpecifier ? jsxRuntimeExports.jsx("button", { type: "button", className: "min-w-0 max-w-[70%] truncate text-right text-[13px] font-mono", style: {
|
|
65688
65700
|
color: "var(--ds-gray-1000)",
|
|
65689
65701
|
background: "transparent",
|
|
65690
65702
|
border: "none",
|
|
@@ -65775,7 +65787,7 @@ function isWorkflowRun(data) {
|
|
|
65775
65787
|
function isHook(data) {
|
|
65776
65788
|
return data !== null && typeof data === "object" && "hookId" in data;
|
|
65777
65789
|
}
|
|
65778
|
-
function EntityDetailPanel({ run,
|
|
65790
|
+
function EntityDetailPanel({ run, onStreamClick, spanDetailData, spanDetailError, spanDetailLoading, onSpanSelect, onWakeUpSleep, onLoadEventData, onResolveHook, encryptionKey, onDecrypt, selectedSpan }) {
|
|
65779
65791
|
const [stoppingSleep, setStoppingSleep] = reactExports.useState(false);
|
|
65780
65792
|
const [showResolveHookModal, setShowResolveHookModal] = reactExports.useState(false);
|
|
65781
65793
|
const [resolvingHook, setResolvingHook] = reactExports.useState(false);
|
|
@@ -65798,10 +65810,11 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
|
|
|
65798
65810
|
return { resource: "hook", resourceId: data.hookId, runId: void 0 };
|
|
65799
65811
|
}
|
|
65800
65812
|
if (res === "sleep") {
|
|
65813
|
+
const waitData = data;
|
|
65801
65814
|
return {
|
|
65802
65815
|
resource: "sleep",
|
|
65803
65816
|
resourceId: selectedSpan.spanId,
|
|
65804
|
-
runId: void 0
|
|
65817
|
+
runId: waitData == null ? void 0 : waitData.runId
|
|
65805
65818
|
};
|
|
65806
65819
|
}
|
|
65807
65820
|
return { resource: void 0, resourceId: void 0, runId: void 0 };
|
|
@@ -65849,21 +65862,23 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
|
|
|
65849
65862
|
]);
|
|
65850
65863
|
const error2 = spanDetailError ?? void 0;
|
|
65851
65864
|
const loading = spanDetailLoading ?? false;
|
|
65865
|
+
const hasEncryptedFields = reactExports.useMemo(() => {
|
|
65866
|
+
if (!spanDetailData)
|
|
65867
|
+
return false;
|
|
65868
|
+
const d2 = spanDetailData;
|
|
65869
|
+
return isEncryptedMarker(d2.input) || isEncryptedMarker(d2.output) || isEncryptedMarker(d2.error) || isEncryptedMarker(d2.metadata);
|
|
65870
|
+
}, [spanDetailData]);
|
|
65852
65871
|
const hookToken = reactExports.useMemo(() => {
|
|
65853
65872
|
if (resource !== "hook" || !resourceId)
|
|
65854
65873
|
return void 0;
|
|
65855
65874
|
if (isHook(spanDetailData) && spanDetailData.token) {
|
|
65856
65875
|
return spanDetailData.token;
|
|
65857
65876
|
}
|
|
65858
|
-
const hookFromArray = hooks == null ? void 0 : hooks.find((h2) => h2.hookId === resourceId);
|
|
65859
|
-
if (hookFromArray == null ? void 0 : hookFromArray.token) {
|
|
65860
|
-
return hookFromArray.token;
|
|
65861
|
-
}
|
|
65862
65877
|
if (isHook(data) && data.token) {
|
|
65863
65878
|
return data.token;
|
|
65864
65879
|
}
|
|
65865
65880
|
return void 0;
|
|
65866
|
-
}, [resource, resourceId, spanDetailData, data
|
|
65881
|
+
}, [resource, resourceId, spanDetailData, data]);
|
|
65867
65882
|
reactExports.useEffect(() => {
|
|
65868
65883
|
if (error2 && selectedSpan && resource) {
|
|
65869
65884
|
toast.error(`Failed to load ${resource} details`, {
|
|
@@ -65937,10 +65952,7 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
|
|
|
65937
65952
|
setResolvingHook(false);
|
|
65938
65953
|
}
|
|
65939
65954
|
}, [onResolveHook, hookToken, resolvingHook, spanDetailData, data]);
|
|
65940
|
-
|
|
65941
|
-
return null;
|
|
65942
|
-
}
|
|
65943
|
-
const displayData = resource === "sleep" ? data : spanDetailData ?? data;
|
|
65955
|
+
const displayData = spanDetailData ?? data;
|
|
65944
65956
|
const moduleSpecifier = reactExports.useMemo(() => {
|
|
65945
65957
|
const displayRecord = displayData;
|
|
65946
65958
|
const displayStepName = displayRecord.stepName;
|
|
@@ -65956,16 +65968,24 @@ function EntityDetailPanel({ run, hooks, onStreamClick, spanDetailData, spanDeta
|
|
|
65956
65968
|
}
|
|
65957
65969
|
return void 0;
|
|
65958
65970
|
}, [displayData, run.workflowName]);
|
|
65971
|
+
if (!selectedSpan || !resource || !resourceId) {
|
|
65972
|
+
return null;
|
|
65973
|
+
}
|
|
65959
65974
|
const resourceLabel = resource.charAt(0).toUpperCase() + resource.slice(1);
|
|
65960
65975
|
const hasPendingActions = resource === "sleep" && canWakeUp || resource === "hook" && canResolveHook;
|
|
65961
65976
|
const runStateLabel = run.completedAt ? "Completed" : "Live";
|
|
65962
|
-
return jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [jsxRuntimeExports.jsx("div", { className: "border-b px-3 py-3", style: { borderColor: "var(--ds-gray-200)" }, children: jsxRuntimeExports.
|
|
65977
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex h-full flex-col", children: [jsxRuntimeExports.jsx("div", { className: "border-b px-3 py-3", style: { borderColor: "var(--ds-gray-200)" }, children: jsxRuntimeExports.jsxs("div", { className: "flex items-start justify-between gap-2", children: [jsxRuntimeExports.jsxs("div", { className: "min-w-0", children: [jsxRuntimeExports.jsxs("div", { className: "flex items-center gap-2", children: [jsxRuntimeExports.jsx("span", { className: "inline-flex items-center rounded-full border px-2 py-0.5 text-[13px] font-medium", style: {
|
|
65963
65978
|
borderColor: "var(--ds-gray-300)",
|
|
65964
65979
|
color: "var(--ds-gray-900)",
|
|
65965
65980
|
backgroundColor: "var(--ds-background-100)"
|
|
65966
65981
|
}, children: resourceLabel }), jsxRuntimeExports.jsx("span", { className: "text-[13px]", style: {
|
|
65967
65982
|
color: run.completedAt ? "var(--ds-gray-700)" : "var(--ds-green-800)"
|
|
65968
|
-
}, children: runStateLabel })] }), jsxRuntimeExports.jsx("p", { className: "mt-1 truncate font-mono text-[13px]", style: { color: "var(--ds-gray-700)" }, title: resourceId, children: resourceId })] })
|
|
65983
|
+
}, children: runStateLabel })] }), jsxRuntimeExports.jsx("p", { className: "mt-1 truncate font-mono text-[13px]", style: { color: "var(--ds-gray-700)" }, title: resourceId, children: resourceId })] }), (hasEncryptedFields || encryptionKey) && onDecrypt && jsxRuntimeExports.jsxs("button", { type: "button", onClick: onDecrypt, disabled: !!encryptionKey, className: "inline-flex items-center gap-1 rounded-md border px-2 py-1 text-xs font-medium transition-colors flex-shrink-0", style: {
|
|
65984
|
+
borderColor: encryptionKey ? "var(--ds-green-400)" : "var(--ds-gray-300)",
|
|
65985
|
+
color: encryptionKey ? "var(--ds-green-900)" : "var(--ds-gray-900)",
|
|
65986
|
+
backgroundColor: encryptionKey ? "var(--ds-green-100)" : "var(--ds-background-100)",
|
|
65987
|
+
cursor: encryptionKey ? "default" : "pointer"
|
|
65988
|
+
}, children: [encryptionKey ? jsxRuntimeExports.jsx(LockOpen, { className: "h-3 w-3" }) : jsxRuntimeExports.jsx(Lock, { className: "h-3 w-3" }), encryptionKey ? "Decrypted" : "Decrypt"] })] }) }), jsxRuntimeExports.jsxs("div", { className: "flex-1 overflow-y-auto px-3 pt-3 pb-8", children: [hasPendingActions && jsxRuntimeExports.jsxs("div", { className: "mb-4 rounded-lg border p-2", style: {
|
|
65969
65989
|
borderColor: "var(--ds-gray-300)",
|
|
65970
65990
|
backgroundColor: "var(--ds-gray-100)"
|
|
65971
65991
|
}, children: [jsxRuntimeExports.jsx("p", { className: "mb-2 px-1 text-[13px] font-medium uppercase tracking-wide", style: { color: "var(--ds-gray-700)" }, children: "Actions" }), jsxRuntimeExports.jsxs("div", { className: "flex flex-col gap-2", children: [resource === "sleep" && canWakeUp && jsxRuntimeExports.jsxs("button", { type: "button", onClick: handleWakeUp, disabled: stoppingSleep, className: clsx("flex items-center justify-center gap-2 rounded-md px-3 py-2 text-sm font-medium", "disabled:opacity-50 disabled:cursor-not-allowed transition-colors", stoppingSleep ? "opacity-50 cursor-not-allowed" : "cursor-pointer"), style: {
|
|
@@ -68719,7 +68739,7 @@ const skeletonTrace = {
|
|
|
68719
68739
|
],
|
|
68720
68740
|
rootSpanId: "root"
|
|
68721
68741
|
};
|
|
68722
|
-
function TraceViewerTimeline({ trace: trace2 = skeletonTrace, className = "", scrollLock = false, height, withPanel = false, highlightedSpans, eagerRender = false, isLive = false }) {
|
|
68742
|
+
function TraceViewerTimeline({ trace: trace2 = skeletonTrace, className = "", scrollLock = false, height, withPanel = false, highlightedSpans, eagerRender = false, isLive = false, footer: footer2, knownDurationMs, hasMoreData = false }) {
|
|
68723
68743
|
const isSkeleton = trace2 === skeletonTrace;
|
|
68724
68744
|
const { state, dispatch: dispatch2 } = useTraceViewer();
|
|
68725
68745
|
const { timelineRef, scrollSnapshotRef } = state;
|
|
@@ -68954,16 +68974,35 @@ function TraceViewerTimeline({ trace: trace2 = skeletonTrace, className = "", sc
|
|
|
68954
68974
|
"--scrollbar-width": `${state.scrollbarWidth}px`,
|
|
68955
68975
|
"--marker-height": `${MARKER_HEIGHT}px`,
|
|
68956
68976
|
"--marker-notch-height": `${MARKER_NOTCH_HEIGHT}px`
|
|
68957
|
-
}, children: [!hideSearchBar ? jsxRuntimeExports.jsx(SearchBar, {}) : null, jsxRuntimeExports.jsx(MiniMap, { rows, scale, timelineRef }), jsxRuntimeExports.jsxs("div", { className: clsx(styles.traceViewerContent, inert2 && styles.inert), children: [jsxRuntimeExports.
|
|
68977
|
+
}, children: [!hideSearchBar ? jsxRuntimeExports.jsx(SearchBar, {}) : null, jsxRuntimeExports.jsx(MiniMap, { rows, scale, timelineRef }), jsxRuntimeExports.jsxs("div", { className: clsx(styles.traceViewerContent, inert2 && styles.inert), children: [jsxRuntimeExports.jsxs("div", { className: styles.timeline, ref: timelineRef, children: [jsxRuntimeExports.jsx("div", { style: {
|
|
68958
68978
|
position: "relative",
|
|
68959
68979
|
width: state.timelineWidth,
|
|
68960
|
-
|
|
68980
|
+
minHeight: state.timelineHeight - TIMELINE_PADDING * 2,
|
|
68961
68981
|
padding: TIMELINE_PADDING,
|
|
68962
68982
|
paddingBottom: 0
|
|
68963
68983
|
}, children: jsxRuntimeExports.jsxs("div", { className: styles.traceNode, style: {
|
|
68964
68984
|
width: state.root.duration * scale || void 0,
|
|
68965
68985
|
height: timelineHeight - TIMELINE_PADDING * 2
|
|
68966
|
-
}, children: [jsxRuntimeExports.jsx(Markers, { scale, isLive }), jsxRuntimeExports.jsx(EventMarkers, { events: events2, root: state.root, scale }), jsxRuntimeExports.jsx(CursorMarker, { dispatch: dispatch2, events: events2, memoCacheRef: state.memoCacheRef, root: state.root, scale, scrollSnapshotRef, spans, timelineRef }), jsxRuntimeExports.jsx(SpanNodes, { cacheKey: memoCache.get(""), cache: memoCache, customSpanClassNameFunc: state.customSpanClassNameFunc, customSpanEventClassNameFunc: state.customSpanEventClassNameFunc, isLive, root: state.root, scale, scrollSnapshotRef, spans })
|
|
68986
|
+
}, children: [jsxRuntimeExports.jsx(Markers, { scale, isLive }), jsxRuntimeExports.jsx(EventMarkers, { events: events2, root: state.root, scale }), jsxRuntimeExports.jsx(CursorMarker, { dispatch: dispatch2, events: events2, memoCacheRef: state.memoCacheRef, root: state.root, scale, scrollSnapshotRef, spans, timelineRef }), jsxRuntimeExports.jsx(SpanNodes, { cacheKey: memoCache.get(""), cache: memoCache, customSpanClassNameFunc: state.customSpanClassNameFunc, customSpanEventClassNameFunc: state.customSpanEventClassNameFunc, isLive, root: state.root, scale, scrollSnapshotRef, spans }), knownDurationMs != null && knownDurationMs > 0 && (hasMoreData || isLive) && state.root.duration > 0 && (() => {
|
|
68987
|
+
const knownPx = knownDurationMs * scale;
|
|
68988
|
+
const totalPx = state.root.duration * scale;
|
|
68989
|
+
const unknownWidth = totalPx - knownPx;
|
|
68990
|
+
if (unknownWidth < 4)
|
|
68991
|
+
return null;
|
|
68992
|
+
const insetPx = Math.min(unknownWidth * 0.05, 20);
|
|
68993
|
+
return jsxRuntimeExports.jsx("div", { style: {
|
|
68994
|
+
position: "absolute",
|
|
68995
|
+
top: 0,
|
|
68996
|
+
left: knownPx + insetPx,
|
|
68997
|
+
width: unknownWidth - insetPx,
|
|
68998
|
+
height: "100%",
|
|
68999
|
+
pointerEvents: "none",
|
|
69000
|
+
zIndex: 1,
|
|
69001
|
+
maskImage: "linear-gradient(to right, transparent 1%, black 3%)",
|
|
69002
|
+
WebkitMaskImage: "linear-gradient(to right, transparent 1%, black 3%)",
|
|
69003
|
+
background: "repeating-linear-gradient(-45deg, var(--ds-background-200) 0, var(--ds-background-200) 11px, var(--ds-gray-200) 11px, var(--ds-gray-200) 12px)"
|
|
69004
|
+
} });
|
|
69005
|
+
})()] }) }), footer2] }), jsxRuntimeExports.jsx("div", { className: styles.zoomButtonTraceViewer, children: jsxRuntimeExports.jsx(ZoomButton, {}) })] }), withPanel ? jsxRuntimeExports.jsx("div", { className: clsx(styles.spanDetailPanelTraceViewer, !state.selected && styles.hidden, state.isMobile && styles.mobile), children: jsxRuntimeExports.jsx(SpanDetailPanel, { attached: true }) }) : null] });
|
|
68967
69006
|
}
|
|
68968
69007
|
function getStatusClassName(status, isStripped = false) {
|
|
68969
69008
|
if (isStripped && status === "pending") {
|
|
@@ -69106,14 +69145,13 @@ const waitEventsToWaitEntity = (events2) => {
|
|
|
69106
69145
|
completedAt: completedEvent == null ? void 0 : completedEvent.createdAt
|
|
69107
69146
|
};
|
|
69108
69147
|
};
|
|
69109
|
-
function waitToSpan(events2,
|
|
69148
|
+
function waitToSpan(events2, maxEndTime) {
|
|
69110
69149
|
const wait = waitEventsToWaitEntity(events2);
|
|
69111
69150
|
if (!wait) {
|
|
69112
69151
|
return null;
|
|
69113
69152
|
}
|
|
69114
|
-
const
|
|
69115
|
-
const
|
|
69116
|
-
const endTime = (wait == null ? void 0 : wait.completedAt) ?? viewerEndTime;
|
|
69153
|
+
const startTime = wait.createdAt;
|
|
69154
|
+
const endTime = wait.completedAt ?? maxEndTime;
|
|
69117
69155
|
const start2 = dateToOtelTime(startTime);
|
|
69118
69156
|
const end = dateToOtelTime(endTime);
|
|
69119
69157
|
const duration2 = calculateDuration(startTime, endTime);
|
|
@@ -69139,16 +69177,67 @@ function waitToSpan(events2, run, nowTime) {
|
|
|
69139
69177
|
endTime: end
|
|
69140
69178
|
};
|
|
69141
69179
|
}
|
|
69142
|
-
|
|
69143
|
-
|
|
69180
|
+
const stepEventsToStepEntity = (events2) => {
|
|
69181
|
+
var _a3;
|
|
69182
|
+
const createdEvent = events2.find((event) => event.eventType === "step_created");
|
|
69183
|
+
if (!createdEvent) {
|
|
69184
|
+
return null;
|
|
69185
|
+
}
|
|
69186
|
+
let status = "pending";
|
|
69187
|
+
let attempt = 0;
|
|
69188
|
+
let startedAt;
|
|
69189
|
+
let completedAt;
|
|
69190
|
+
for (const e of events2) {
|
|
69191
|
+
switch (e.eventType) {
|
|
69192
|
+
case "step_started":
|
|
69193
|
+
status = "running";
|
|
69194
|
+
attempt += 1;
|
|
69195
|
+
if (!startedAt)
|
|
69196
|
+
startedAt = e.createdAt;
|
|
69197
|
+
completedAt = void 0;
|
|
69198
|
+
break;
|
|
69199
|
+
case "step_completed":
|
|
69200
|
+
status = "completed";
|
|
69201
|
+
completedAt = e.createdAt;
|
|
69202
|
+
break;
|
|
69203
|
+
case "step_failed":
|
|
69204
|
+
status = "failed";
|
|
69205
|
+
completedAt = e.createdAt;
|
|
69206
|
+
break;
|
|
69207
|
+
case "step_retrying":
|
|
69208
|
+
status = "pending";
|
|
69209
|
+
completedAt = void 0;
|
|
69210
|
+
break;
|
|
69211
|
+
}
|
|
69212
|
+
}
|
|
69213
|
+
if (attempt === 0)
|
|
69214
|
+
attempt = 1;
|
|
69215
|
+
const lastEvent = events2[events2.length - 1];
|
|
69216
|
+
return {
|
|
69217
|
+
stepId: createdEvent.correlationId,
|
|
69218
|
+
runId: createdEvent.runId,
|
|
69219
|
+
stepName: ((_a3 = createdEvent.eventData) == null ? void 0 : _a3.stepName) ?? "",
|
|
69220
|
+
status,
|
|
69221
|
+
attempt,
|
|
69222
|
+
createdAt: createdEvent.createdAt,
|
|
69223
|
+
updatedAt: (lastEvent == null ? void 0 : lastEvent.createdAt) ?? createdEvent.createdAt,
|
|
69224
|
+
startedAt,
|
|
69225
|
+
completedAt,
|
|
69226
|
+
specVersion: createdEvent.specVersion
|
|
69227
|
+
};
|
|
69228
|
+
};
|
|
69229
|
+
function stepToSpan(stepEvents, maxEndTime) {
|
|
69230
|
+
const step = stepEventsToStepEntity(stepEvents);
|
|
69231
|
+
if (!step) {
|
|
69232
|
+
return null;
|
|
69233
|
+
}
|
|
69144
69234
|
const parsedName = parseStepName(String(step.stepName));
|
|
69145
|
-
const { input: _i, output: _o2, error: _e2, ...stepIdentity } = step;
|
|
69146
69235
|
const attributes = {
|
|
69147
69236
|
resource: "step",
|
|
69148
|
-
data:
|
|
69237
|
+
data: step
|
|
69149
69238
|
};
|
|
69150
69239
|
const resource = "step";
|
|
69151
|
-
const endTime = new Date(step.completedAt ?? maxEndTime
|
|
69240
|
+
const endTime = new Date(step.completedAt ?? maxEndTime);
|
|
69152
69241
|
const events2 = convertEventsToSpanEvents(stepEvents, false);
|
|
69153
69242
|
const spanStartTime = new Date(step.createdAt);
|
|
69154
69243
|
let activeStartTime = step.startedAt ? new Date(step.startedAt) : void 0;
|
|
@@ -69176,7 +69265,7 @@ function stepToSpan(step, stepEvents, nowTime, maxEndTime) {
|
|
|
69176
69265
|
};
|
|
69177
69266
|
}
|
|
69178
69267
|
const hookEventsToHookEntity = (events2) => {
|
|
69179
|
-
var _a3;
|
|
69268
|
+
var _a3, _b;
|
|
69180
69269
|
const createdEvent = events2.find((event) => event.eventType === "hook_created");
|
|
69181
69270
|
if (!createdEvent) {
|
|
69182
69271
|
return null;
|
|
@@ -69187,20 +69276,20 @@ const hookEventsToHookEntity = (events2) => {
|
|
|
69187
69276
|
return {
|
|
69188
69277
|
hookId: createdEvent.correlationId,
|
|
69189
69278
|
runId: createdEvent.runId,
|
|
69279
|
+
token: (_a3 = createdEvent.eventData) == null ? void 0 : _a3.token,
|
|
69190
69280
|
createdAt: createdEvent.createdAt,
|
|
69191
69281
|
receivedCount: receivedEvents.length,
|
|
69192
69282
|
lastReceivedAt: (lastReceivedEvent == null ? void 0 : lastReceivedEvent.createdAt) || void 0,
|
|
69193
|
-
disposedAt: ((
|
|
69283
|
+
disposedAt: ((_b = disposedEvents.at(-1)) == null ? void 0 : _b.createdAt) || void 0
|
|
69194
69284
|
};
|
|
69195
69285
|
};
|
|
69196
|
-
function hookToSpan(hookEvents,
|
|
69286
|
+
function hookToSpan(hookEvents, maxEndTime) {
|
|
69197
69287
|
const hook = hookEventsToHookEntity(hookEvents);
|
|
69198
69288
|
if (!hook) {
|
|
69199
69289
|
return null;
|
|
69200
69290
|
}
|
|
69201
69291
|
const events2 = convertEventsToSpanEvents(hookEvents, false);
|
|
69202
|
-
const
|
|
69203
|
-
const endTime = hook.disposedAt || viewerEndTime;
|
|
69292
|
+
const endTime = hook.disposedAt || maxEndTime;
|
|
69204
69293
|
return {
|
|
69205
69294
|
spanId: String(hook.hookId),
|
|
69206
69295
|
name: String(hook.hookId),
|
|
@@ -69252,6 +69341,102 @@ function runToSpan(run, runEvents, nowTime) {
|
|
|
69252
69341
|
activeStartTime: activeStartTime && activeStartTime.getTime() > spanStartTime.getTime() ? dateToOtelTime(activeStartTime) : void 0
|
|
69253
69342
|
};
|
|
69254
69343
|
}
|
|
69344
|
+
const isStepEvent = (eventType) => eventType.startsWith("step_");
|
|
69345
|
+
const isTimerEvent = (eventType) => eventType === "wait_created" || eventType === "wait_completed";
|
|
69346
|
+
const isHookLifecycleEvent = (eventType) => eventType === "hook_received" || eventType === "hook_created" || eventType === "hook_disposed";
|
|
69347
|
+
function pushEvent(map2, correlationId, event) {
|
|
69348
|
+
const existing = map2.get(correlationId);
|
|
69349
|
+
if (existing) {
|
|
69350
|
+
existing.push(event);
|
|
69351
|
+
return;
|
|
69352
|
+
}
|
|
69353
|
+
map2.set(correlationId, [event]);
|
|
69354
|
+
}
|
|
69355
|
+
function groupEventsByCorrelation(events2) {
|
|
69356
|
+
const eventsByStepId = /* @__PURE__ */ new Map();
|
|
69357
|
+
const runLevelEvents = [];
|
|
69358
|
+
const timerEvents = /* @__PURE__ */ new Map();
|
|
69359
|
+
const hookEvents = /* @__PURE__ */ new Map();
|
|
69360
|
+
for (const event of events2) {
|
|
69361
|
+
const correlationId = event.correlationId;
|
|
69362
|
+
if (!correlationId) {
|
|
69363
|
+
runLevelEvents.push(event);
|
|
69364
|
+
continue;
|
|
69365
|
+
}
|
|
69366
|
+
if (isTimerEvent(event.eventType)) {
|
|
69367
|
+
pushEvent(timerEvents, correlationId, event);
|
|
69368
|
+
continue;
|
|
69369
|
+
}
|
|
69370
|
+
if (isHookLifecycleEvent(event.eventType)) {
|
|
69371
|
+
pushEvent(hookEvents, correlationId, event);
|
|
69372
|
+
continue;
|
|
69373
|
+
}
|
|
69374
|
+
if (isStepEvent(event.eventType)) {
|
|
69375
|
+
pushEvent(eventsByStepId, correlationId, event);
|
|
69376
|
+
continue;
|
|
69377
|
+
}
|
|
69378
|
+
runLevelEvents.push(event);
|
|
69379
|
+
}
|
|
69380
|
+
return { eventsByStepId, runLevelEvents, timerEvents, hookEvents };
|
|
69381
|
+
}
|
|
69382
|
+
function computeLatestKnownTime(events2, run) {
|
|
69383
|
+
let latest = new Date(run.createdAt).getTime();
|
|
69384
|
+
for (const event of events2) {
|
|
69385
|
+
const t = new Date(event.createdAt).getTime();
|
|
69386
|
+
if (t > latest)
|
|
69387
|
+
latest = t;
|
|
69388
|
+
}
|
|
69389
|
+
return new Date(latest);
|
|
69390
|
+
}
|
|
69391
|
+
function buildSpans(run, groupedEvents, now2, latestKnownTime) {
|
|
69392
|
+
const childMaxEnd = latestKnownTime;
|
|
69393
|
+
const stepSpans = Array.from(groupedEvents.eventsByStepId.values()).map((events2) => stepToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
69394
|
+
const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
69395
|
+
const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, childMaxEnd)).filter((span) => span !== null);
|
|
69396
|
+
return {
|
|
69397
|
+
runSpan: runToSpan(run, groupedEvents.runLevelEvents, now2),
|
|
69398
|
+
spans: [...stepSpans, ...hookSpans, ...waitSpans]
|
|
69399
|
+
};
|
|
69400
|
+
}
|
|
69401
|
+
function cascadeSpans(runSpan, spans) {
|
|
69402
|
+
const sortedSpans = [
|
|
69403
|
+
runSpan,
|
|
69404
|
+
...spans.slice().sort((a2, b2) => {
|
|
69405
|
+
const aStart = otelTimeToMs(a2.startTime);
|
|
69406
|
+
const bStart = otelTimeToMs(b2.startTime);
|
|
69407
|
+
return aStart - bStart;
|
|
69408
|
+
})
|
|
69409
|
+
];
|
|
69410
|
+
return sortedSpans.map((span, index2) => {
|
|
69411
|
+
const parentSpanId = index2 === 0 ? void 0 : String(sortedSpans[index2 - 1].spanId);
|
|
69412
|
+
return {
|
|
69413
|
+
...span,
|
|
69414
|
+
parentSpanId
|
|
69415
|
+
};
|
|
69416
|
+
});
|
|
69417
|
+
}
|
|
69418
|
+
function buildTrace(run, events2, now2) {
|
|
69419
|
+
const groupedEvents = groupEventsByCorrelation(events2);
|
|
69420
|
+
const latestKnownTime = computeLatestKnownTime(events2, run);
|
|
69421
|
+
const { runSpan, spans } = buildSpans(run, groupedEvents, now2, latestKnownTime);
|
|
69422
|
+
const sortedCascadingSpans = cascadeSpans(runSpan, spans);
|
|
69423
|
+
const traceStartMs = otelTimeToMs(runSpan.startTime);
|
|
69424
|
+
const knownDurationMs = latestKnownTime.getTime() - traceStartMs;
|
|
69425
|
+
return {
|
|
69426
|
+
traceId: run.runId,
|
|
69427
|
+
rootSpanId: run.runId,
|
|
69428
|
+
spans: sortedCascadingSpans,
|
|
69429
|
+
resources: [
|
|
69430
|
+
{
|
|
69431
|
+
name: "workflow",
|
|
69432
|
+
attributes: {
|
|
69433
|
+
"service.name": WORKFLOW_LIBRARY.name
|
|
69434
|
+
}
|
|
69435
|
+
}
|
|
69436
|
+
],
|
|
69437
|
+
knownDurationMs: Math.max(0, knownDurationMs)
|
|
69438
|
+
};
|
|
69439
|
+
}
|
|
69255
69440
|
function useLiveTick(isLive) {
|
|
69256
69441
|
const { state, dispatch: dispatch2 } = useTraceViewer();
|
|
69257
69442
|
const stateRef = reactExports.useRef(state);
|
|
@@ -69394,7 +69579,7 @@ function SpanContextMenu({ menu, items, onClose }) {
|
|
|
69394
69579
|
onClose();
|
|
69395
69580
|
}, children: [item.icon ?? null, item.label] }, item.label))] }), document.body);
|
|
69396
69581
|
}
|
|
69397
|
-
function TraceViewerWithContextMenu({ trace: trace2, run,
|
|
69582
|
+
function TraceViewerWithContextMenu({ trace: trace2, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans = false, isLoadingMoreSpans = false, children: children2 }) {
|
|
69398
69583
|
const { state, dispatch: dispatch2 } = useTraceViewer();
|
|
69399
69584
|
useLiveTick(isLive);
|
|
69400
69585
|
const [contextMenu, setContextMenu] = reactExports.useState(null);
|
|
@@ -69408,13 +69593,6 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
|
|
|
69408
69593
|
}
|
|
69409
69594
|
return map2;
|
|
69410
69595
|
}, [trace2.spans]);
|
|
69411
|
-
const hookLookup = reactExports.useMemo(() => {
|
|
69412
|
-
const map2 = /* @__PURE__ */ new Map();
|
|
69413
|
-
for (const hook of hooks) {
|
|
69414
|
-
map2.set(hook.hookId, hook);
|
|
69415
|
-
}
|
|
69416
|
-
return map2;
|
|
69417
|
-
}, [hooks]);
|
|
69418
69596
|
const handleResolveHook = reactExports.useCallback(async (payload) => {
|
|
69419
69597
|
if (resolvingHook || !resolveHookTarget || !onResolveHook)
|
|
69420
69598
|
return;
|
|
@@ -69426,7 +69604,7 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
|
|
|
69426
69604
|
}
|
|
69427
69605
|
try {
|
|
69428
69606
|
setResolvingHook(true);
|
|
69429
|
-
await onResolveHook(resolveHookTarget.token, payload
|
|
69607
|
+
await onResolveHook(resolveHookTarget.token, payload);
|
|
69430
69608
|
toast.success("Hook resolved", {
|
|
69431
69609
|
description: "The payload has been sent and the hook resolved."
|
|
69432
69610
|
});
|
|
@@ -69536,16 +69714,18 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
|
|
|
69536
69714
|
});
|
|
69537
69715
|
}
|
|
69538
69716
|
if (menu.resourceType === "hook" && isRunActive && onResolveHook) {
|
|
69539
|
-
const hook = hookLookup.get(menu.spanId);
|
|
69540
69717
|
const span = spanLookup.get(menu.spanId);
|
|
69541
69718
|
const hookData = (_a3 = span == null ? void 0 : span.attributes) == null ? void 0 : _a3.data;
|
|
69542
69719
|
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);
|
|
69543
|
-
if ((
|
|
69720
|
+
if ((hookData == null ? void 0 : hookData.token) && !isDisposed) {
|
|
69544
69721
|
items.push({
|
|
69545
69722
|
label: "Resolve Hook",
|
|
69546
69723
|
icon: jsxRuntimeExports.jsx(Send, { className: "h-3.5 w-3.5" }),
|
|
69547
69724
|
action: () => {
|
|
69548
|
-
setResolveHookTarget(
|
|
69725
|
+
setResolveHookTarget({
|
|
69726
|
+
hookId: menu.spanId,
|
|
69727
|
+
token: hookData.token
|
|
69728
|
+
});
|
|
69549
69729
|
}
|
|
69550
69730
|
});
|
|
69551
69731
|
}
|
|
@@ -69599,7 +69779,6 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
|
|
|
69599
69779
|
onWakeUpSleep,
|
|
69600
69780
|
onCancelRun,
|
|
69601
69781
|
onResolveHook,
|
|
69602
|
-
hookLookup,
|
|
69603
69782
|
spanLookup,
|
|
69604
69783
|
resolvedHookIds,
|
|
69605
69784
|
run.runId,
|
|
@@ -69607,104 +69786,6 @@ function TraceViewerWithContextMenu({ trace: trace2, run, hooks, isLive, onWakeU
|
|
|
69607
69786
|
]);
|
|
69608
69787
|
return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full", ref: containerRef, children: [children2, contextMenu ? jsxRuntimeExports.jsx(SpanContextMenu, { menu: contextMenu, items: getMenuItems(contextMenu), onClose: closeMenu }) : null, jsxRuntimeExports.jsx(ResolveHookModal, { isOpen: resolveHookTarget !== null, onClose: () => setResolveHookTarget(null), onSubmit: handleResolveHook, isSubmitting: resolvingHook })] });
|
|
69609
69788
|
}
|
|
69610
|
-
const isTimerEvent = (eventType) => eventType === "wait_created" || eventType === "wait_completed";
|
|
69611
|
-
const isHookLifecycleEvent = (eventType) => eventType === "hook_received" || eventType === "hook_created" || eventType === "hook_disposed";
|
|
69612
|
-
const pushEvent = (map2, correlationId, event) => {
|
|
69613
|
-
const existing = map2.get(correlationId);
|
|
69614
|
-
if (existing) {
|
|
69615
|
-
existing.push(event);
|
|
69616
|
-
return;
|
|
69617
|
-
}
|
|
69618
|
-
map2.set(correlationId, [event]);
|
|
69619
|
-
};
|
|
69620
|
-
const groupEventsByCorrelation = (events2, steps, hooks) => {
|
|
69621
|
-
const eventsByStepId = /* @__PURE__ */ new Map();
|
|
69622
|
-
const eventsByHookId = /* @__PURE__ */ new Map();
|
|
69623
|
-
const runLevelEvents = [];
|
|
69624
|
-
const timerEvents = /* @__PURE__ */ new Map();
|
|
69625
|
-
const hookEvents = /* @__PURE__ */ new Map();
|
|
69626
|
-
const stepIds = new Set(steps.map((step) => step.stepId));
|
|
69627
|
-
const hookIds = new Set(hooks.map((hook) => hook.hookId));
|
|
69628
|
-
for (const event of events2) {
|
|
69629
|
-
const correlationId = event.correlationId;
|
|
69630
|
-
if (!correlationId) {
|
|
69631
|
-
runLevelEvents.push(event);
|
|
69632
|
-
continue;
|
|
69633
|
-
}
|
|
69634
|
-
if (isTimerEvent(event.eventType)) {
|
|
69635
|
-
pushEvent(timerEvents, correlationId, event);
|
|
69636
|
-
continue;
|
|
69637
|
-
}
|
|
69638
|
-
if (isHookLifecycleEvent(event.eventType)) {
|
|
69639
|
-
pushEvent(hookEvents, correlationId, event);
|
|
69640
|
-
continue;
|
|
69641
|
-
}
|
|
69642
|
-
if (stepIds.has(correlationId)) {
|
|
69643
|
-
pushEvent(eventsByStepId, correlationId, event);
|
|
69644
|
-
continue;
|
|
69645
|
-
}
|
|
69646
|
-
if (hookIds.has(correlationId)) {
|
|
69647
|
-
pushEvent(eventsByHookId, correlationId, event);
|
|
69648
|
-
continue;
|
|
69649
|
-
}
|
|
69650
|
-
runLevelEvents.push(event);
|
|
69651
|
-
}
|
|
69652
|
-
return {
|
|
69653
|
-
eventsByStepId,
|
|
69654
|
-
eventsByHookId,
|
|
69655
|
-
runLevelEvents,
|
|
69656
|
-
timerEvents,
|
|
69657
|
-
hookEvents
|
|
69658
|
-
};
|
|
69659
|
-
};
|
|
69660
|
-
const buildSpans = (run, steps, groupedEvents, now2) => {
|
|
69661
|
-
const viewerEndTime = new Date(run.completedAt || now2);
|
|
69662
|
-
const stepSpans = steps.map((step) => {
|
|
69663
|
-
const stepEvents = groupedEvents.eventsByStepId.get(step.stepId) || [];
|
|
69664
|
-
return stepToSpan(step, stepEvents, now2, viewerEndTime);
|
|
69665
|
-
});
|
|
69666
|
-
const hookSpans = Array.from(groupedEvents.hookEvents.values()).map((events2) => hookToSpan(events2, run, now2)).filter((span) => span !== null);
|
|
69667
|
-
const waitSpans = Array.from(groupedEvents.timerEvents.values()).map((events2) => waitToSpan(events2, run, now2)).filter((span) => span !== null);
|
|
69668
|
-
return {
|
|
69669
|
-
runSpan: runToSpan(run, groupedEvents.runLevelEvents, now2),
|
|
69670
|
-
spans: [...stepSpans, ...hookSpans, ...waitSpans]
|
|
69671
|
-
};
|
|
69672
|
-
};
|
|
69673
|
-
const cascadeSpans = (runSpan, spans) => {
|
|
69674
|
-
const sortedSpans = [
|
|
69675
|
-
runSpan,
|
|
69676
|
-
...spans.slice().sort((a2, b2) => {
|
|
69677
|
-
const aStart = otelTimeToMs(a2.startTime);
|
|
69678
|
-
const bStart = otelTimeToMs(b2.startTime);
|
|
69679
|
-
return aStart - bStart;
|
|
69680
|
-
})
|
|
69681
|
-
];
|
|
69682
|
-
return sortedSpans.map((span, index2) => {
|
|
69683
|
-
const parentSpanId = index2 === 0 ? void 0 : String(sortedSpans[index2 - 1].spanId);
|
|
69684
|
-
return {
|
|
69685
|
-
...span,
|
|
69686
|
-
parentSpanId
|
|
69687
|
-
};
|
|
69688
|
-
});
|
|
69689
|
-
};
|
|
69690
|
-
const buildTrace = (run, steps, hooks, events2, now2) => {
|
|
69691
|
-
const groupedEvents = groupEventsByCorrelation(events2, steps, hooks);
|
|
69692
|
-
const { runSpan, spans } = buildSpans(run, steps, groupedEvents, now2);
|
|
69693
|
-
const sortedCascadingSpans = cascadeSpans(runSpan, spans);
|
|
69694
|
-
return {
|
|
69695
|
-
traceId: run.runId,
|
|
69696
|
-
rootSpanId: run.runId,
|
|
69697
|
-
spans: sortedCascadingSpans,
|
|
69698
|
-
resources: [
|
|
69699
|
-
{
|
|
69700
|
-
name: "workflow",
|
|
69701
|
-
attributes: {
|
|
69702
|
-
"service.name": WORKFLOW_LIBRARY.name
|
|
69703
|
-
}
|
|
69704
|
-
}
|
|
69705
|
-
]
|
|
69706
|
-
};
|
|
69707
|
-
};
|
|
69708
69789
|
function SelectionBridge({ onSelectionChange }) {
|
|
69709
69790
|
const { state } = useTraceViewer();
|
|
69710
69791
|
const { selected: selected2 } = state;
|
|
@@ -69760,18 +69841,29 @@ function PanelResizeHandle({ onResize }) {
|
|
|
69760
69841
|
}, [onResize]);
|
|
69761
69842
|
return jsxRuntimeExports.jsx("div", { className: "absolute left-0 top-0 bottom-0 w-1 cursor-col-resize hover:bg-blue-400/50 z-10", onPointerDown: handlePointerDown });
|
|
69762
69843
|
}
|
|
69763
|
-
|
|
69844
|
+
function TraceViewerFooter({ hasMore, isLive }) {
|
|
69845
|
+
const style2 = { color: "var(--ds-gray-900)" };
|
|
69846
|
+
if (hasMore) {
|
|
69847
|
+
return jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center gap-2 py-3 text-xs", style: style2, children: [jsxRuntimeExports.jsxs("svg", { className: "h-3.5 w-3.5 animate-spin", viewBox: "0 0 24 24", fill: "none", children: [jsxRuntimeExports.jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), jsxRuntimeExports.jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z" })] }), "Loading more events…"] });
|
|
69848
|
+
}
|
|
69849
|
+
if (isLive) {
|
|
69850
|
+
return jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-3 text-xs", style: style2, children: "Waiting for more events…" });
|
|
69851
|
+
}
|
|
69852
|
+
return jsxRuntimeExports.jsx("div", { className: "flex items-center justify-center py-3 text-xs", style: style2, children: "End of run" });
|
|
69853
|
+
}
|
|
69854
|
+
const WorkflowTraceViewer = ({ run, events: events2, isLoading, error: error2, spanDetailData, spanDetailLoading, spanDetailError, onWakeUpSleep, onResolveHook, onCancelRun, onStreamClick, onSpanSelect, onLoadEventData, onLoadMoreSpans, hasMoreSpans = false, isLoadingMoreSpans = false, encryptionKey, onDecrypt }) => {
|
|
69764
69855
|
const [selectedSpan, setSelectedSpan] = reactExports.useState(null);
|
|
69765
69856
|
const [panelWidth, setPanelWidth] = reactExports.useState(DEFAULT_PANEL_WIDTH);
|
|
69766
69857
|
const [deselectTrigger, setDeselectTrigger] = reactExports.useState(0);
|
|
69767
69858
|
const [selectRequest, setSelectRequest] = reactExports.useState(null);
|
|
69768
69859
|
const isLive = Boolean(run && !run.completedAt);
|
|
69769
|
-
const
|
|
69770
|
-
if (!run) {
|
|
69860
|
+
const traceWithMeta = reactExports.useMemo(() => {
|
|
69861
|
+
if (!(run == null ? void 0 : run.runId)) {
|
|
69771
69862
|
return void 0;
|
|
69772
69863
|
}
|
|
69773
|
-
return buildTrace(run,
|
|
69774
|
-
}, [run,
|
|
69864
|
+
return buildTrace(run, events2, /* @__PURE__ */ new Date());
|
|
69865
|
+
}, [run, events2]);
|
|
69866
|
+
const trace2 = traceWithMeta;
|
|
69775
69867
|
reactExports.useEffect(() => {
|
|
69776
69868
|
if (error2 && !isLoading) {
|
|
69777
69869
|
console.error(error2);
|
|
@@ -69856,10 +69948,10 @@ const WorkflowTraceViewer = ({ run, steps, hooks, events: events2, isLoading, er
|
|
|
69856
69948
|
const workflowName = data.workflowName;
|
|
69857
69949
|
return (stepName ? (_a3 = parseStepName(stepName)) == null ? void 0 : _a3.shortName : void 0) ?? (workflowName ? (_b = parseWorkflowName(workflowName)) == null ? void 0 : _b.shortName : void 0) ?? stepName ?? workflowName ?? data.hookId ?? "Details";
|
|
69858
69950
|
}, [selectedSpan == null ? void 0 : selectedSpan.data]);
|
|
69859
|
-
if (
|
|
69951
|
+
if (!trace2) {
|
|
69860
69952
|
return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full", children: [jsxRuntimeExports.jsx("div", { className: "border-b border-gray-alpha-400 w-full" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-full ml-2 mt-1 mb-1 h-[56px]" }), jsxRuntimeExports.jsxs("div", { className: "p-2 relative w-full", children: [jsxRuntimeExports.jsx(Skeleton$2, { className: "w-full mt-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[10%] mt-2 ml-6 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[10%] mt-2 ml-12 h-[20px]" }), jsxRuntimeExports.jsx(Skeleton$2, { className: "w-[20%] mt-2 ml-16 h-[20px]" })] })] });
|
|
69861
69953
|
}
|
|
69862
|
-
return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace: trace2, run,
|
|
69954
|
+
return jsxRuntimeExports.jsxs("div", { className: "relative w-full h-full flex", children: [jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0 relative", children: jsxRuntimeExports.jsxs(TraceViewerContextProvider, { customSpanClassNameFunc: getCustomSpanClassName, customSpanEventClassNameFunc: getCustomSpanEventClassName, children: [jsxRuntimeExports.jsx(SelectionBridge, { onSelectionChange: handleSelectionChange }), jsxRuntimeExports.jsx(DeselectBridge, { triggerDeselect: deselectTrigger }), jsxRuntimeExports.jsx(SelectBridge, { selectRequest }), jsxRuntimeExports.jsx(TraceViewerWithContextMenu, { trace: trace2, run, isLive, onWakeUpSleep, onCancelRun, onResolveHook, onLoadMoreSpans, hasMoreSpans, isLoadingMoreSpans, children: jsxRuntimeExports.jsx(TraceViewerTimeline, { eagerRender: true, height: "100%", isLive, trace: trace2, knownDurationMs: traceWithMeta == null ? void 0 : traceWithMeta.knownDurationMs, hasMoreData: hasMoreSpans, footer: jsxRuntimeExports.jsx(TraceViewerFooter, { hasMore: hasMoreSpans, isLive }) }) })] }) }), selectedSpan && jsxRuntimeExports.jsxs("div", { className: "relative border-l flex-shrink-0 flex flex-col", style: {
|
|
69863
69955
|
width: panelWidth,
|
|
69864
69956
|
borderColor: "var(--ds-gray-200)",
|
|
69865
69957
|
backgroundColor: "var(--ds-background-100)"
|
|
@@ -69929,7 +70021,7 @@ const WorkflowTraceViewer = ({ run, steps, hooks, events: events2, isLoading, er
|
|
|
69929
70021
|
e.currentTarget.style.background = "var(--ds-gray-alpha-100)";
|
|
69930
70022
|
}, onMouseLeave: (e) => {
|
|
69931
70023
|
e.currentTarget.style.background = "transparent";
|
|
69932
|
-
}, children: jsxRuntimeExports.jsx(X$3, { size: 16 }) }) })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children: jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load entity details", children: jsxRuntimeExports.jsx(EntityDetailPanel, { run,
|
|
70024
|
+
}, children: jsxRuntimeExports.jsx(X$3, { size: 16 }) }) })] }), jsxRuntimeExports.jsx("div", { className: "flex-1 overflow-y-auto", children: jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load entity details", children: jsxRuntimeExports.jsx(EntityDetailPanel, { run, onStreamClick, spanDetailData: spanDetailData ?? null, spanDetailError, spanDetailLoading, onSpanSelect: handleSpanSelect, onWakeUpSleep, onLoadEventData, onResolveHook, encryptionKey, onDecrypt, selectedSpan }) }) })] })] });
|
|
69933
70025
|
};
|
|
69934
70026
|
function deserializeChunkText(text2) {
|
|
69935
70027
|
try {
|
|
@@ -72703,17 +72795,14 @@ async function fetchRuns$1(worldEnv, params) {
|
|
|
72703
72795
|
async function fetchRun$1(worldEnv, runId, resolveData = "all") {
|
|
72704
72796
|
return rpc("fetchRun", { worldEnv, runId, resolveData });
|
|
72705
72797
|
}
|
|
72706
|
-
async function fetchSteps$1(worldEnv, runId, params) {
|
|
72707
|
-
return rpc("fetchSteps", { worldEnv, runId, params });
|
|
72708
|
-
}
|
|
72709
72798
|
async function fetchStep$1(worldEnv, runId, stepId, resolveData = "all") {
|
|
72710
72799
|
return rpc("fetchStep", { worldEnv, runId, stepId, resolveData });
|
|
72711
72800
|
}
|
|
72712
72801
|
async function fetchEvents$1(worldEnv, runId, params) {
|
|
72713
72802
|
return rpc("fetchEvents", { worldEnv, runId, params });
|
|
72714
72803
|
}
|
|
72715
|
-
async function
|
|
72716
|
-
return rpc("
|
|
72804
|
+
async function fetchEvent$1(worldEnv, runId, eventId, resolveData = "all") {
|
|
72805
|
+
return rpc("fetchEvent", { worldEnv, runId, eventId, resolveData });
|
|
72717
72806
|
}
|
|
72718
72807
|
async function fetchHooks$1(worldEnv, params) {
|
|
72719
72808
|
return rpc("fetchHooks", { worldEnv, params });
|
|
@@ -73158,6 +73247,16 @@ function parseDurationToDate(param) {
|
|
|
73158
73247
|
throw new Error(`Invalid duration parameter. Expected a duration string, number (milliseconds), or Date object.`);
|
|
73159
73248
|
}
|
|
73160
73249
|
}
|
|
73250
|
+
function resolveWorkflowTargetWorld(env2 = process.env) {
|
|
73251
|
+
const configuredWorld = env2.WORKFLOW_TARGET_WORLD;
|
|
73252
|
+
if (configuredWorld) {
|
|
73253
|
+
return configuredWorld;
|
|
73254
|
+
}
|
|
73255
|
+
return env2.VERCEL_DEPLOYMENT_ID ? "vercel" : "local";
|
|
73256
|
+
}
|
|
73257
|
+
function isVercelWorldTarget(targetWorld) {
|
|
73258
|
+
return targetWorld === "vercel" || targetWorld === "@workflow/world-vercel";
|
|
73259
|
+
}
|
|
73161
73260
|
const BASE_URL = "https://useworkflow.dev/err";
|
|
73162
73261
|
function isError(value) {
|
|
73163
73262
|
return typeof value === "object" && value !== null && "name" in value && "message" in value;
|
|
@@ -89424,8 +89523,8 @@ function requireGetVercelOidcToken$1() {
|
|
|
89424
89523
|
}
|
|
89425
89524
|
try {
|
|
89426
89525
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
89427
|
-
await import("./token-util-
|
|
89428
|
-
await import("./token-
|
|
89526
|
+
await import("./token-util-YAVqVR6-.js").then((n) => n.t),
|
|
89527
|
+
await import("./token-mzBpVePm.js").then((n) => n.t)
|
|
89429
89528
|
]);
|
|
89430
89529
|
if (!token || isExpired(getTokenPayload(token))) {
|
|
89431
89530
|
await refreshToken();
|
|
@@ -115610,19 +115709,21 @@ function createQueue$2(config2) {
|
|
|
115610
115709
|
body: body2
|
|
115611
115710
|
});
|
|
115612
115711
|
}
|
|
115613
|
-
if (response2.ok) {
|
|
115614
|
-
return;
|
|
115615
|
-
}
|
|
115616
115712
|
const text2 = await response2.text();
|
|
115617
|
-
if (response2.
|
|
115713
|
+
if (response2.ok) {
|
|
115618
115714
|
try {
|
|
115619
115715
|
const timeoutSeconds = Number(JSON.parse(text2).timeoutSeconds);
|
|
115620
|
-
|
|
115621
|
-
|
|
115622
|
-
|
|
115623
|
-
|
|
115716
|
+
if (Number.isFinite(timeoutSeconds) && timeoutSeconds >= 0) {
|
|
115717
|
+
if (timeoutSeconds > 0) {
|
|
115718
|
+
const timeoutMs = Math.min(timeoutSeconds * 1e3, MAX_SAFE_TIMEOUT_MS);
|
|
115719
|
+
await setTimeout$1(timeoutMs);
|
|
115720
|
+
}
|
|
115721
|
+
defaultRetriesLeft++;
|
|
115722
|
+
continue;
|
|
115723
|
+
}
|
|
115624
115724
|
} catch {
|
|
115625
115725
|
}
|
|
115726
|
+
return;
|
|
115626
115727
|
}
|
|
115627
115728
|
console.error(`[local world] Failed to queue message`, {
|
|
115628
115729
|
queueName,
|
|
@@ -115674,8 +115775,8 @@ function createQueue$2(config2) {
|
|
|
115674
115775
|
if (typeof (result == null ? void 0 : result.timeoutSeconds) === "number") {
|
|
115675
115776
|
timeoutSeconds = Math.min(result.timeoutSeconds, LOCAL_QUEUE_MAX_VISIBILITY);
|
|
115676
115777
|
}
|
|
115677
|
-
if (timeoutSeconds) {
|
|
115678
|
-
return Response.json({ timeoutSeconds }
|
|
115778
|
+
if (timeoutSeconds != null) {
|
|
115779
|
+
return Response.json({ timeoutSeconds });
|
|
115679
115780
|
}
|
|
115680
115781
|
return Response.json({ ok: true });
|
|
115681
115782
|
} catch (error2) {
|
|
@@ -116619,6 +116720,16 @@ function createEventsStorage(basedir) {
|
|
|
116619
116720
|
wait
|
|
116620
116721
|
};
|
|
116621
116722
|
},
|
|
116723
|
+
async get(runId, eventId, params) {
|
|
116724
|
+
const compositeKey = `${runId}-${eventId}`;
|
|
116725
|
+
const eventPath = path$2.join(basedir, "events", `${compositeKey}.json`);
|
|
116726
|
+
const event = await readJSON(eventPath, EventSchema);
|
|
116727
|
+
if (!event) {
|
|
116728
|
+
throw new Error(`Event ${eventId} in run ${runId} not found`);
|
|
116729
|
+
}
|
|
116730
|
+
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION$1;
|
|
116731
|
+
return filterEventData$1(event, resolveData);
|
|
116732
|
+
},
|
|
116622
116733
|
async list(params) {
|
|
116623
116734
|
var _a3, _b, _c;
|
|
116624
116735
|
const { runId } = params;
|
|
@@ -117116,8 +117227,8 @@ function requireGetVercelOidcToken() {
|
|
|
117116
117227
|
}
|
|
117117
117228
|
try {
|
|
117118
117229
|
const [{ getTokenPayload, isExpired }, { refreshToken }] = await Promise.all([
|
|
117119
|
-
await import("./token-util-
|
|
117120
|
-
await import("./token-
|
|
117230
|
+
await import("./token-util-D7WmNSMO.js").then((n) => n.t),
|
|
117231
|
+
await import("./token-BRJJ012D.js").then((n) => n.t)
|
|
117121
117232
|
]);
|
|
117122
117233
|
if (!token || isExpired(getTokenPayload(token), options == null ? void 0 : options.expirationBufferMs)) {
|
|
117123
117234
|
await refreshToken(options);
|
|
@@ -117736,11 +117847,17 @@ async function fetchRunKey(deploymentId, projectId, runId, options) {
|
|
|
117736
117847
|
headers: {
|
|
117737
117848
|
authorization: `Bearer ${token}`
|
|
117738
117849
|
},
|
|
117850
|
+
// @ts-expect-error -- undici dispatcher is accepted by Node.js fetch but not in @types/node's RequestInit
|
|
117739
117851
|
dispatcher: getDispatcher()
|
|
117740
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- undici v7 dispatcher types don't match @types/node's RequestInit
|
|
117741
117852
|
});
|
|
117742
117853
|
if (!response2.ok) {
|
|
117743
|
-
|
|
117854
|
+
let body2;
|
|
117855
|
+
try {
|
|
117856
|
+
body2 = await response2.text();
|
|
117857
|
+
} catch {
|
|
117858
|
+
body2 = "<unable to read response body>";
|
|
117859
|
+
}
|
|
117860
|
+
throw new Error(`Failed to fetch run key for ${runId} (deployment ${deploymentId}): HTTP ${response2.status} ${response2.statusText}${body2 ? ` — ${body2}` : ""}`);
|
|
117744
117861
|
}
|
|
117745
117862
|
const data = await response2.json();
|
|
117746
117863
|
const result = object$1({ key: string$1().nullable() }).safeParse(data);
|
|
@@ -117755,7 +117872,7 @@ async function fetchRunKey(deploymentId, projectId, runId, options) {
|
|
|
117755
117872
|
function createGetEncryptionKeyForRun(projectId, teamId, token) {
|
|
117756
117873
|
if (!projectId)
|
|
117757
117874
|
return void 0;
|
|
117758
|
-
const
|
|
117875
|
+
const isServerlessRuntime = process.env.VERCEL === "1";
|
|
117759
117876
|
let localDeploymentKey;
|
|
117760
117877
|
function getLocalDeploymentKey() {
|
|
117761
117878
|
if (localDeploymentKey)
|
|
@@ -117769,12 +117886,16 @@ function createGetEncryptionKeyForRun(projectId, teamId, token) {
|
|
|
117769
117886
|
return async function getEncryptionKeyForRun2(run, context) {
|
|
117770
117887
|
const runId = typeof run === "string" ? run : run.runId;
|
|
117771
117888
|
const deploymentId = typeof run === "string" ? context == null ? void 0 : context.deploymentId : run.deploymentId;
|
|
117772
|
-
if (
|
|
117773
|
-
|
|
117774
|
-
|
|
117775
|
-
|
|
117776
|
-
|
|
117889
|
+
if (isServerlessRuntime) {
|
|
117890
|
+
if (!deploymentId || deploymentId === process.env.VERCEL_DEPLOYMENT_ID) {
|
|
117891
|
+
const localKey = getLocalDeploymentKey();
|
|
117892
|
+
if (!localKey)
|
|
117893
|
+
return void 0;
|
|
117894
|
+
return deriveRunKey(localKey, projectId, runId);
|
|
117895
|
+
}
|
|
117777
117896
|
}
|
|
117897
|
+
if (!deploymentId)
|
|
117898
|
+
return void 0;
|
|
117778
117899
|
return fetchRunKey(deploymentId, projectId, runId, { token, teamId });
|
|
117779
117900
|
};
|
|
117780
117901
|
}
|
|
@@ -117836,7 +117957,7 @@ const PeerService = SemanticConvention("peer.service");
|
|
|
117836
117957
|
const RpcSystem = SemanticConvention("rpc.system");
|
|
117837
117958
|
const RpcService = SemanticConvention("rpc.service");
|
|
117838
117959
|
const RpcMethod = SemanticConvention("rpc.method");
|
|
117839
|
-
const version$1 = "4.1.0-beta.
|
|
117960
|
+
const version$1 = "4.1.0-beta.42";
|
|
117840
117961
|
const DEFAULT_RESOLVE_DATA_OPTION = "all";
|
|
117841
117962
|
function deserializeError(obj) {
|
|
117842
117963
|
const { error: error2, ...rest } = obj;
|
|
@@ -118135,7 +118256,7 @@ function createQueue$1(config2) {
|
|
|
118135
118256
|
attempt: metadata.deliveryCount
|
|
118136
118257
|
});
|
|
118137
118258
|
if (typeof (result == null ? void 0 : result.timeoutSeconds) === "number") {
|
|
118138
|
-
const delaySeconds = Math.min(result.timeoutSeconds, MAX_DELAY_SECONDS);
|
|
118259
|
+
const delaySeconds = result.timeoutSeconds > 0 ? Math.min(result.timeoutSeconds, MAX_DELAY_SECONDS) : void 0;
|
|
118139
118260
|
await queue(queueName, payload, { deploymentId, delaySeconds });
|
|
118140
118261
|
}
|
|
118141
118262
|
});
|
|
@@ -118576,6 +118697,21 @@ async function hydrateEventRefs(events2, config2, refResolveConcurrency) {
|
|
|
118576
118697
|
return result;
|
|
118577
118698
|
});
|
|
118578
118699
|
}
|
|
118700
|
+
async function getEvent(runId, eventId, params, config2) {
|
|
118701
|
+
const resolveData = (params == null ? void 0 : params.resolveData) ?? DEFAULT_RESOLVE_DATA_OPTION;
|
|
118702
|
+
const remoteRefBehavior = resolveData === "none" ? "lazy" : "resolve";
|
|
118703
|
+
const searchParams = new URLSearchParams();
|
|
118704
|
+
searchParams.set("remoteRefBehavior", remoteRefBehavior);
|
|
118705
|
+
const queryString = searchParams.toString();
|
|
118706
|
+
const endpoint = `/v2/runs/${runId}/events/${eventId}${queryString ? `?${queryString}` : ""}`;
|
|
118707
|
+
const event = await makeRequest({
|
|
118708
|
+
endpoint,
|
|
118709
|
+
options: { method: "GET" },
|
|
118710
|
+
config: config2,
|
|
118711
|
+
schema: resolveData === "none" ? EventWithRefsSchema : EventSchema
|
|
118712
|
+
});
|
|
118713
|
+
return filterEventData(event, resolveData);
|
|
118714
|
+
}
|
|
118579
118715
|
async function getWorkflowRunEvents(params, config2) {
|
|
118580
118716
|
const searchParams = new URLSearchParams();
|
|
118581
118717
|
const { pagination, resolveData = DEFAULT_RESOLVE_DATA_OPTION } = params;
|
|
@@ -118819,6 +118955,7 @@ function createStorage(config2) {
|
|
|
118819
118955
|
},
|
|
118820
118956
|
events: {
|
|
118821
118957
|
create: (runId, data, params) => createWorkflowRunEvent(runId, data, params, config2),
|
|
118958
|
+
get: (runId, eventId, params) => getEvent(runId, eventId, params, config2),
|
|
118822
118959
|
list: (params) => getWorkflowRunEvents(params, config2),
|
|
118823
118960
|
listByCorrelationId: (params) => getWorkflowRunEvents(params, config2)
|
|
118824
118961
|
},
|
|
@@ -118941,26 +119078,19 @@ const require$1 = createRequire$1(join$1(process.cwd(), "index.js"));
|
|
|
118941
119078
|
const WorldCache = Symbol.for("@workflow/world//cache");
|
|
118942
119079
|
const StubbedWorldCache = Symbol.for("@workflow/world//stubbedCache");
|
|
118943
119080
|
const globalSymbols = globalThis;
|
|
118944
|
-
function defaultWorld() {
|
|
118945
|
-
if (process.env.VERCEL_DEPLOYMENT_ID) {
|
|
118946
|
-
return "vercel";
|
|
118947
|
-
}
|
|
118948
|
-
return "local";
|
|
118949
|
-
}
|
|
118950
119081
|
const createWorld = () => {
|
|
118951
|
-
const targetWorld =
|
|
118952
|
-
if (targetWorld
|
|
118953
|
-
|
|
118954
|
-
|
|
118955
|
-
|
|
118956
|
-
|
|
118957
|
-
|
|
118958
|
-
|
|
118959
|
-
|
|
118960
|
-
|
|
118961
|
-
|
|
118962
|
-
|
|
118963
|
-
});
|
|
119082
|
+
const targetWorld = resolveWorkflowTargetWorld();
|
|
119083
|
+
if (isVercelWorldTarget(targetWorld)) {
|
|
119084
|
+
const staleEnvVars = [
|
|
119085
|
+
"WORKFLOW_VERCEL_PROJECT",
|
|
119086
|
+
"WORKFLOW_VERCEL_TEAM",
|
|
119087
|
+
"WORKFLOW_VERCEL_AUTH_TOKEN",
|
|
119088
|
+
"WORKFLOW_VERCEL_ENV"
|
|
119089
|
+
].filter((key) => process.env[key]);
|
|
119090
|
+
if (staleEnvVars.length > 0) {
|
|
119091
|
+
console.warn(`[workflow] Warning: ${staleEnvVars.join(", ")} env var(s) are set but have no effect at runtime. These are only used by the Workflow CLI. Remove them from your Vercel project environment variables.`);
|
|
119092
|
+
}
|
|
119093
|
+
return createVercelWorld();
|
|
118964
119094
|
}
|
|
118965
119095
|
if (targetWorld === "local") {
|
|
118966
119096
|
return createLocalWorld({
|
|
@@ -122182,7 +122312,7 @@ async function resumeHook$2(tokenOrHook, payload, encryptionKeyOverride) {
|
|
|
122182
122312
|
});
|
|
122183
122313
|
});
|
|
122184
122314
|
}
|
|
122185
|
-
const version = "4.2.0-beta.
|
|
122315
|
+
const version = "4.2.0-beta.68";
|
|
122186
122316
|
const ulid = monotonicFactory();
|
|
122187
122317
|
async function start$1(workflow, argsOrOptions, options) {
|
|
122188
122318
|
return await waitedUntil(() => {
|
|
@@ -122213,7 +122343,10 @@ async function start$1(workflow, argsOrOptions, options) {
|
|
|
122213
122343
|
const traceCarrier = await serializeTraceCarrier();
|
|
122214
122344
|
const specVersion = opts.specVersion ?? SPEC_VERSION_CURRENT;
|
|
122215
122345
|
const v1Compat = isLegacySpecVersion(specVersion);
|
|
122216
|
-
const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, runId, {
|
|
122346
|
+
const rawKey = await ((_a3 = world.getEncryptionKeyForRun) == null ? void 0 : _a3.call(world, runId, {
|
|
122347
|
+
...opts,
|
|
122348
|
+
deploymentId
|
|
122349
|
+
}));
|
|
122217
122350
|
const encryptionKey = rawKey ? await importKey(rawKey) : void 0;
|
|
122218
122351
|
const workflowArguments = await dehydrateWorkflowArguments(args, runId, encryptionKey, ops, globalThis, v1Compat);
|
|
122219
122352
|
const result = await world.events.create(runId, {
|
|
@@ -122523,8 +122656,9 @@ getWorldHandlers().createQueueHandler("__wkf_step_", async (message_, metadata)
|
|
|
122523
122656
|
return await withTraceContext(traceContext, async () => {
|
|
122524
122657
|
const stepName = metadata.queueName.slice("__wkf_step_".length);
|
|
122525
122658
|
const world = getWorld();
|
|
122659
|
+
const isVercel = process.env.VERCEL_URL !== void 0;
|
|
122526
122660
|
const [port, spanKind] = await Promise.all([
|
|
122527
|
-
getPort(),
|
|
122661
|
+
isVercel ? void 0 : getPort(),
|
|
122528
122662
|
getSpanKind$2("CONSUMER")
|
|
122529
122663
|
]);
|
|
122530
122664
|
return trace$2(`STEP ${stepName}`, { kind: spanKind, links: spanLinks }, async (span) => {
|
|
@@ -122701,16 +122835,18 @@ getWorldHandlers().createQueueHandler("__wkf_step_", async (message_, metadata)
|
|
|
122701
122835
|
result = await trace$2("step.execute", {}, async () => {
|
|
122702
122836
|
return await contextStorage.run({
|
|
122703
122837
|
stepMetadata: {
|
|
122838
|
+
stepName,
|
|
122704
122839
|
stepId,
|
|
122705
122840
|
stepStartedAt: /* @__PURE__ */ new Date(+stepStartedAt),
|
|
122706
122841
|
attempt
|
|
122707
122842
|
},
|
|
122708
122843
|
workflowMetadata: {
|
|
122844
|
+
workflowName,
|
|
122709
122845
|
workflowRunId,
|
|
122710
122846
|
workflowStartedAt: /* @__PURE__ */ new Date(+workflowStartedAt),
|
|
122711
122847
|
// TODO: there should be a getUrl method on the world interface itself. This
|
|
122712
122848
|
// solution only works for vercel + local worlds.
|
|
122713
|
-
url:
|
|
122849
|
+
url: isVercel ? `https://${process.env.VERCEL_URL}` : `http://localhost:${port ?? 3e3}`
|
|
122714
122850
|
},
|
|
122715
122851
|
ops,
|
|
122716
122852
|
closureVars: hydratedInput.closureVars,
|
|
@@ -123461,29 +123597,17 @@ async function fetchEvents(worldEnv, runId, params) {
|
|
|
123461
123597
|
);
|
|
123462
123598
|
}
|
|
123463
123599
|
}
|
|
123464
|
-
async function
|
|
123465
|
-
const { cursor, sortOrder = "asc", limit = 1e3, withData = false } = params;
|
|
123600
|
+
async function fetchEvent(worldEnv, runId, eventId, resolveData = "all") {
|
|
123466
123601
|
try {
|
|
123467
123602
|
const world = await getWorldFromEnv(worldEnv);
|
|
123468
|
-
const
|
|
123469
|
-
|
|
123470
|
-
pagination: { cursor, limit, sortOrder },
|
|
123471
|
-
resolveData: withData ? "all" : "none"
|
|
123472
|
-
});
|
|
123473
|
-
return createResponse({
|
|
123474
|
-
data: result.data,
|
|
123475
|
-
cursor: result.cursor ?? void 0,
|
|
123476
|
-
hasMore: result.hasMore
|
|
123477
|
-
});
|
|
123603
|
+
const event = await world.events.get(runId, eventId, { resolveData });
|
|
123604
|
+
return createResponse(event);
|
|
123478
123605
|
} catch (error2) {
|
|
123479
|
-
return createServerActionError(
|
|
123480
|
-
|
|
123481
|
-
|
|
123482
|
-
|
|
123483
|
-
|
|
123484
|
-
...params
|
|
123485
|
-
}
|
|
123486
|
-
);
|
|
123606
|
+
return createServerActionError(error2, "world.events.get", {
|
|
123607
|
+
runId,
|
|
123608
|
+
eventId,
|
|
123609
|
+
resolveData
|
|
123610
|
+
});
|
|
123487
123611
|
}
|
|
123488
123612
|
}
|
|
123489
123613
|
async function fetchHooks(worldEnv, params) {
|
|
@@ -129476,57 +129600,72 @@ function useWorkflowResourceData(env2, resource, resourceId, options = {}) {
|
|
|
129476
129600
|
}
|
|
129477
129601
|
setData(null);
|
|
129478
129602
|
setError(null);
|
|
129603
|
+
setLoading(true);
|
|
129479
129604
|
if (resource === "hook") {
|
|
129480
|
-
const { error: error22, result } = await unwrapServerActionResult(
|
|
129481
|
-
fetchHook$1(env2, resourceId, "all")
|
|
129482
|
-
);
|
|
129483
|
-
if (error22) {
|
|
129484
|
-
setError(error22);
|
|
129485
|
-
return;
|
|
129486
|
-
}
|
|
129487
129605
|
try {
|
|
129488
|
-
|
|
129489
|
-
|
|
129490
|
-
setError(
|
|
129491
|
-
hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
|
|
129606
|
+
const { error: error22, result } = await unwrapServerActionResult(
|
|
129607
|
+
fetchHook$1(env2, resourceId, "all")
|
|
129492
129608
|
);
|
|
129609
|
+
if (error22) {
|
|
129610
|
+
setError(error22);
|
|
129611
|
+
return;
|
|
129612
|
+
}
|
|
129613
|
+
try {
|
|
129614
|
+
setData(await hydrate(result));
|
|
129615
|
+
} catch (hydrateError) {
|
|
129616
|
+
setError(
|
|
129617
|
+
hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
|
|
129618
|
+
);
|
|
129619
|
+
}
|
|
129620
|
+
} finally {
|
|
129621
|
+
setLoading(false);
|
|
129493
129622
|
}
|
|
129494
129623
|
return;
|
|
129495
129624
|
}
|
|
129496
129625
|
if (resource === "sleep") {
|
|
129497
|
-
const { error: error22, result } = await unwrapServerActionResult(
|
|
129498
|
-
fetchEventsByCorrelationId$1(env2, resourceId, {
|
|
129499
|
-
sortOrder: "asc",
|
|
129500
|
-
limit: 100,
|
|
129501
|
-
withData: true
|
|
129502
|
-
})
|
|
129503
|
-
);
|
|
129504
|
-
if (error22) {
|
|
129505
|
-
setError(error22);
|
|
129506
|
-
return;
|
|
129507
|
-
}
|
|
129508
129626
|
try {
|
|
129509
|
-
|
|
129510
|
-
|
|
129627
|
+
if (!runId) {
|
|
129628
|
+
setError(new Error("runId is required for loading sleep details"));
|
|
129629
|
+
return;
|
|
129630
|
+
}
|
|
129631
|
+
const { error: error22, result } = await unwrapServerActionResult(
|
|
129632
|
+
fetchEvents$1(env2, runId, {
|
|
129633
|
+
sortOrder: "asc",
|
|
129634
|
+
limit: 1e3,
|
|
129635
|
+
withData: true
|
|
129636
|
+
})
|
|
129511
129637
|
);
|
|
129512
|
-
|
|
129513
|
-
|
|
129638
|
+
if (error22) {
|
|
129639
|
+
setError(error22);
|
|
129640
|
+
return;
|
|
129641
|
+
}
|
|
129642
|
+
try {
|
|
129643
|
+
const allEvents = result.data.map(
|
|
129644
|
+
hydrateResourceIO
|
|
129645
|
+
);
|
|
129646
|
+
const waitEvents = await Promise.all(
|
|
129647
|
+
allEvents.filter((e) => e.correlationId === resourceId).map(hydrate)
|
|
129648
|
+
);
|
|
129649
|
+
const data2 = waitEventsToWaitEntity(waitEvents);
|
|
129650
|
+
if (data2 === null) {
|
|
129651
|
+
setError(
|
|
129652
|
+
new Error(
|
|
129653
|
+
`Failed to load ${resource} details: missing required event data`
|
|
129654
|
+
)
|
|
129655
|
+
);
|
|
129656
|
+
return;
|
|
129657
|
+
}
|
|
129658
|
+
setData(data2);
|
|
129659
|
+
} catch (hydrateError) {
|
|
129514
129660
|
setError(
|
|
129515
|
-
new Error(
|
|
129516
|
-
`Failed to load ${resource} details: missing required event data`
|
|
129517
|
-
)
|
|
129661
|
+
hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
|
|
129518
129662
|
);
|
|
129519
|
-
return;
|
|
129520
129663
|
}
|
|
129521
|
-
|
|
129522
|
-
|
|
129523
|
-
setError(
|
|
129524
|
-
hydrateError instanceof Error ? hydrateError : new Error(String(hydrateError))
|
|
129525
|
-
);
|
|
129664
|
+
} finally {
|
|
129665
|
+
setLoading(false);
|
|
129526
129666
|
}
|
|
129527
129667
|
return;
|
|
129528
129668
|
}
|
|
129529
|
-
setLoading(true);
|
|
129530
129669
|
try {
|
|
129531
129670
|
const { data: resourceData } = await fetchResourceWithCorrelationId(
|
|
129532
129671
|
env2,
|
|
@@ -129563,7 +129702,6 @@ function useWorkflowResourceData(env2, resource, resourceId, options = {}) {
|
|
|
129563
129702
|
refresh: fetchData
|
|
129564
129703
|
};
|
|
129565
129704
|
}
|
|
129566
|
-
const MAX_ITEMS = 1e3;
|
|
129567
129705
|
function mergeById(prev, next2, idKey) {
|
|
129568
129706
|
const combined = [...prev, ...next2];
|
|
129569
129707
|
const uniqueById = new Map(
|
|
@@ -129597,89 +129735,35 @@ async function pollResource(opts) {
|
|
|
129597
129735
|
}
|
|
129598
129736
|
return false;
|
|
129599
129737
|
}
|
|
129600
|
-
const LIVE_POLL_LIMIT =
|
|
129601
|
-
const
|
|
129602
|
-
const
|
|
129738
|
+
const LIVE_POLL_LIMIT = 100;
|
|
129739
|
+
const INITIAL_PAGE_SIZE = 500;
|
|
129740
|
+
const LOAD_MORE_PAGE_SIZE = 100;
|
|
129603
129741
|
const LIVE_UPDATE_INTERVAL_MS = 5e3;
|
|
129604
|
-
async function fetchAllEventsForCorrelationId(env2, correlationId) {
|
|
129605
|
-
let eventsData = [];
|
|
129606
|
-
let cursor;
|
|
129607
|
-
while (true) {
|
|
129608
|
-
const { error: error2, result } = await unwrapServerActionResult(
|
|
129609
|
-
fetchEventsByCorrelationId$1(env2, correlationId, {
|
|
129610
|
-
cursor,
|
|
129611
|
-
sortOrder: "asc",
|
|
129612
|
-
limit: 1e3
|
|
129613
|
-
})
|
|
129614
|
-
);
|
|
129615
|
-
if (error2) {
|
|
129616
|
-
break;
|
|
129617
|
-
}
|
|
129618
|
-
eventsData = [...eventsData, ...result.data];
|
|
129619
|
-
if (!result.hasMore || !result.cursor || eventsData.length >= MAX_ITEMS) {
|
|
129620
|
-
break;
|
|
129621
|
-
}
|
|
129622
|
-
cursor = result.cursor;
|
|
129623
|
-
}
|
|
129624
|
-
return eventsData;
|
|
129625
|
-
}
|
|
129626
|
-
async function fetchEventsForCorrelationIds(env2, correlationIds) {
|
|
129627
|
-
if (correlationIds.length === 0) {
|
|
129628
|
-
return [];
|
|
129629
|
-
}
|
|
129630
|
-
const results = await Promise.all(
|
|
129631
|
-
correlationIds.map(
|
|
129632
|
-
(correlationId) => fetchAllEventsForCorrelationId(env2, correlationId)
|
|
129633
|
-
)
|
|
129634
|
-
);
|
|
129635
|
-
return results.flat();
|
|
129636
|
-
}
|
|
129637
129742
|
function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
129638
129743
|
const { live = false } = options;
|
|
129639
129744
|
const [run, setRun] = reactExports.useState(null);
|
|
129640
|
-
const [steps, setSteps] = reactExports.useState([]);
|
|
129641
|
-
const [hooks, setHooks] = reactExports.useState([]);
|
|
129642
129745
|
const [events2, setEvents] = reactExports.useState([]);
|
|
129643
129746
|
const [loading, setLoading] = reactExports.useState(true);
|
|
129644
|
-
const [auxiliaryDataLoading, setAuxiliaryDataLoading] = reactExports.useState(false);
|
|
129645
129747
|
const [error2, setError] = reactExports.useState(null);
|
|
129646
|
-
const [stepsCursor, setStepsCursor] = reactExports.useState();
|
|
129647
|
-
const [hooksCursor, setHooksCursor] = reactExports.useState();
|
|
129648
129748
|
const [eventsCursor, setEventsCursor] = reactExports.useState();
|
|
129649
|
-
const [stepsHasMore, setStepsHasMore] = reactExports.useState(false);
|
|
129650
|
-
const [hooksHasMore, setHooksHasMore] = reactExports.useState(false);
|
|
129651
129749
|
const [eventsHasMore, setEventsHasMore] = reactExports.useState(false);
|
|
129652
129750
|
const [isLoadingMoreTraceData, setIsLoadingMoreTraceData] = reactExports.useState(false);
|
|
129653
129751
|
const isFetchingRef = reactExports.useRef(false);
|
|
129654
129752
|
const [initialLoadCompleted, setInitialLoadCompleted] = reactExports.useState(false);
|
|
129655
129753
|
const fetchAllData = reactExports.useCallback(async () => {
|
|
129656
|
-
var _a3;
|
|
129657
129754
|
if (isFetchingRef.current) {
|
|
129658
129755
|
return;
|
|
129659
129756
|
}
|
|
129660
129757
|
isFetchingRef.current = true;
|
|
129661
129758
|
setLoading(true);
|
|
129662
|
-
setAuxiliaryDataLoading(true);
|
|
129663
129759
|
setError(null);
|
|
129664
|
-
const [runResult,
|
|
129760
|
+
const [runResult, eventsResult] = await Promise.all([
|
|
129665
129761
|
unwrapServerActionResult(fetchRun$1(env2, runId, "none")),
|
|
129666
|
-
unwrapServerActionResult(
|
|
129667
|
-
fetchSteps$1(env2, runId, {
|
|
129668
|
-
sortOrder: "asc",
|
|
129669
|
-
limit: TRACE_VIEWER_BATCH_SIZE
|
|
129670
|
-
})
|
|
129671
|
-
),
|
|
129672
|
-
unwrapServerActionResult(
|
|
129673
|
-
fetchHooks$1(env2, {
|
|
129674
|
-
runId,
|
|
129675
|
-
sortOrder: "asc",
|
|
129676
|
-
limit: TRACE_VIEWER_BATCH_SIZE
|
|
129677
|
-
})
|
|
129678
|
-
),
|
|
129679
129762
|
unwrapServerActionResult(
|
|
129680
129763
|
fetchEvents$1(env2, runId, {
|
|
129681
129764
|
sortOrder: "asc",
|
|
129682
|
-
limit:
|
|
129765
|
+
limit: INITIAL_PAGE_SIZE,
|
|
129766
|
+
withData: true
|
|
129683
129767
|
})
|
|
129684
129768
|
)
|
|
129685
129769
|
]);
|
|
@@ -129688,133 +129772,45 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
|
129688
129772
|
} else {
|
|
129689
129773
|
setRun(hydrateResourceIO(runResult.result));
|
|
129690
129774
|
}
|
|
129691
|
-
const nextSteps = stepsResult.error ? [] : stepsResult.result.data.map(hydrateResourceIO);
|
|
129692
|
-
const nextHooks = hooksResult.error ? [] : hooksResult.result.data.map(hydrateResourceIO);
|
|
129693
129775
|
const initialEvents = eventsResult.error ? [] : eventsResult.result.data.map(hydrateResourceIO);
|
|
129694
|
-
|
|
129695
|
-
...nextSteps.map((step) => step.stepId),
|
|
129696
|
-
...nextHooks.map((hook) => hook.hookId)
|
|
129697
|
-
];
|
|
129698
|
-
const correlationEventsRaw = await fetchEventsForCorrelationIds(
|
|
129699
|
-
env2,
|
|
129700
|
-
correlationIds
|
|
129701
|
-
);
|
|
129702
|
-
const correlationEvents = correlationEventsRaw.map(hydrateResourceIO);
|
|
129703
|
-
setSteps(nextSteps);
|
|
129704
|
-
setHooks(nextHooks);
|
|
129705
|
-
setEvents(
|
|
129706
|
-
mergeById([], [...initialEvents, ...correlationEvents], "eventId")
|
|
129707
|
-
);
|
|
129708
|
-
setStepsCursor(
|
|
129709
|
-
stepsResult.error || !stepsResult.result.hasMore ? void 0 : stepsResult.result.cursor
|
|
129710
|
-
);
|
|
129711
|
-
setHooksCursor(
|
|
129712
|
-
hooksResult.error || !hooksResult.result.hasMore ? void 0 : hooksResult.result.cursor
|
|
129713
|
-
);
|
|
129776
|
+
setEvents(mergeById([], initialEvents, "eventId"));
|
|
129714
129777
|
setEventsCursor(
|
|
129715
129778
|
eventsResult.error || !eventsResult.result.hasMore ? void 0 : eventsResult.result.cursor
|
|
129716
129779
|
);
|
|
129717
|
-
setStepsHasMore(Boolean(!stepsResult.error && stepsResult.result.hasMore));
|
|
129718
|
-
setHooksHasMore(Boolean(!hooksResult.error && hooksResult.result.hasMore));
|
|
129719
129780
|
setEventsHasMore(
|
|
129720
129781
|
Boolean(!eventsResult.error && eventsResult.result.hasMore)
|
|
129721
129782
|
);
|
|
129722
|
-
const settledResults = [runResult, stepsResult, hooksResult, eventsResult];
|
|
129723
129783
|
setLoading(false);
|
|
129724
|
-
setAuxiliaryDataLoading(false);
|
|
129725
129784
|
setInitialLoadCompleted(true);
|
|
129726
129785
|
isFetchingRef.current = false;
|
|
129727
|
-
if (!runResult.error) {
|
|
129728
|
-
|
|
129729
|
-
if (firstError) {
|
|
129730
|
-
setError(firstError);
|
|
129731
|
-
}
|
|
129786
|
+
if (!runResult.error && eventsResult.error) {
|
|
129787
|
+
setError(eventsResult.error);
|
|
129732
129788
|
}
|
|
129733
129789
|
}, [env2, runId]);
|
|
129734
129790
|
const loadMoreTraceData = reactExports.useCallback(async () => {
|
|
129735
|
-
|
|
129736
|
-
if (isFetchingRef.current || !initialLoadCompleted || isLoadingMoreTraceData) {
|
|
129737
|
-
return;
|
|
129738
|
-
}
|
|
129739
|
-
if (!stepsHasMore && !hooksHasMore && !eventsHasMore) {
|
|
129791
|
+
if (isFetchingRef.current || !initialLoadCompleted || isLoadingMoreTraceData || !eventsHasMore) {
|
|
129740
129792
|
return;
|
|
129741
129793
|
}
|
|
129742
129794
|
setIsLoadingMoreTraceData(true);
|
|
129743
129795
|
try {
|
|
129744
|
-
const
|
|
129745
|
-
|
|
129746
|
-
|
|
129747
|
-
|
|
129748
|
-
|
|
129749
|
-
|
|
129750
|
-
|
|
129751
|
-
|
|
129752
|
-
hooksHasMore ? unwrapServerActionResult(
|
|
129753
|
-
fetchHooks$1(env2, {
|
|
129754
|
-
runId,
|
|
129755
|
-
cursor: hooksCursor,
|
|
129756
|
-
sortOrder: "asc",
|
|
129757
|
-
limit: TRACE_VIEWER_BATCH_SIZE
|
|
129758
|
-
})
|
|
129759
|
-
) : Promise.resolve({ error: null, result: null }),
|
|
129760
|
-
eventsHasMore ? unwrapServerActionResult(
|
|
129761
|
-
fetchEvents$1(env2, runId, {
|
|
129762
|
-
cursor: eventsCursor,
|
|
129763
|
-
sortOrder: "asc",
|
|
129764
|
-
limit: TRACE_VIEWER_BATCH_SIZE
|
|
129765
|
-
})
|
|
129766
|
-
) : Promise.resolve({ error: null, result: null })
|
|
129767
|
-
]);
|
|
129768
|
-
if (nextStepsResult.error) {
|
|
129769
|
-
setError(nextStepsResult.error);
|
|
129770
|
-
}
|
|
129771
|
-
if (nextHooksResult.error) {
|
|
129772
|
-
setError(nextHooksResult.error);
|
|
129773
|
-
}
|
|
129796
|
+
const nextEventsResult = await unwrapServerActionResult(
|
|
129797
|
+
fetchEvents$1(env2, runId, {
|
|
129798
|
+
cursor: eventsCursor,
|
|
129799
|
+
sortOrder: "asc",
|
|
129800
|
+
limit: LOAD_MORE_PAGE_SIZE,
|
|
129801
|
+
withData: true
|
|
129802
|
+
})
|
|
129803
|
+
);
|
|
129774
129804
|
if (nextEventsResult.error) {
|
|
129775
129805
|
setError(nextEventsResult.error);
|
|
129776
|
-
}
|
|
129777
|
-
|
|
129778
|
-
|
|
129779
|
-
|
|
129780
|
-
|
|
129781
|
-
|
|
129782
|
-
}
|
|
129783
|
-
if (nextHooks.length > 0) {
|
|
129784
|
-
setHooks((prev) => mergeById(prev, nextHooks, "hookId"));
|
|
129785
|
-
}
|
|
129786
|
-
const newCorrelationIds = [
|
|
129787
|
-
...nextSteps.map((step) => step.stepId),
|
|
129788
|
-
...nextHooks.map((hook) => hook.hookId)
|
|
129789
|
-
];
|
|
129790
|
-
const correlationEventsRaw = await fetchEventsForCorrelationIds(
|
|
129791
|
-
env2,
|
|
129792
|
-
newCorrelationIds
|
|
129793
|
-
);
|
|
129794
|
-
const correlationEvents = correlationEventsRaw.map(hydrateResourceIO);
|
|
129795
|
-
const allNewEvents = [...nextEvents, ...correlationEvents];
|
|
129796
|
-
if (allNewEvents.length > 0) {
|
|
129797
|
-
setEvents((prev) => mergeById(prev, allNewEvents, "eventId"));
|
|
129798
|
-
}
|
|
129799
|
-
const nextStepsHasMore = nextStepsResult.error ? stepsHasMore : Boolean(nextStepsResult.result && nextStepsResult.result.hasMore);
|
|
129800
|
-
const nextHooksHasMore = nextHooksResult.error ? hooksHasMore : Boolean(nextHooksResult.result && nextHooksResult.result.hasMore);
|
|
129801
|
-
const nextEventsHasMore = nextEventsResult.error ? eventsHasMore : Boolean(nextEventsResult.result && nextEventsResult.result.hasMore);
|
|
129802
|
-
setStepsHasMore(nextStepsHasMore);
|
|
129803
|
-
setHooksHasMore(nextHooksHasMore);
|
|
129804
|
-
setEventsHasMore(nextEventsHasMore);
|
|
129805
|
-
if (!nextStepsResult.error) {
|
|
129806
|
-
setStepsCursor(
|
|
129807
|
-
((_d = nextStepsResult.result) == null ? void 0 : _d.hasMore) ? nextStepsResult.result.cursor : void 0
|
|
129808
|
-
);
|
|
129809
|
-
}
|
|
129810
|
-
if (!nextHooksResult.error) {
|
|
129811
|
-
setHooksCursor(
|
|
129812
|
-
((_e2 = nextHooksResult.result) == null ? void 0 : _e2.hasMore) ? nextHooksResult.result.cursor : void 0
|
|
129813
|
-
);
|
|
129814
|
-
}
|
|
129815
|
-
if (!nextEventsResult.error) {
|
|
129806
|
+
} else {
|
|
129807
|
+
const nextEvents = nextEventsResult.result.data.map(hydrateResourceIO);
|
|
129808
|
+
if (nextEvents.length > 0) {
|
|
129809
|
+
setEvents((prev) => mergeById(prev, nextEvents, "eventId"));
|
|
129810
|
+
}
|
|
129811
|
+
setEventsHasMore(Boolean(nextEventsResult.result.hasMore));
|
|
129816
129812
|
setEventsCursor(
|
|
129817
|
-
|
|
129813
|
+
nextEventsResult.result.hasMore ? nextEventsResult.result.cursor : void 0
|
|
129818
129814
|
);
|
|
129819
129815
|
}
|
|
129820
129816
|
} finally {
|
|
@@ -129825,11 +129821,7 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
|
129825
129821
|
runId,
|
|
129826
129822
|
initialLoadCompleted,
|
|
129827
129823
|
isLoadingMoreTraceData,
|
|
129828
|
-
stepsHasMore,
|
|
129829
|
-
hooksHasMore,
|
|
129830
129824
|
eventsHasMore,
|
|
129831
|
-
stepsCursor,
|
|
129832
|
-
hooksCursor,
|
|
129833
129825
|
eventsCursor
|
|
129834
129826
|
]);
|
|
129835
129827
|
const pollRun = reactExports.useCallback(async () => {
|
|
@@ -129847,49 +129839,14 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
|
129847
129839
|
setRun(hydrateResourceIO(result));
|
|
129848
129840
|
return true;
|
|
129849
129841
|
}, [env2, runId, run == null ? void 0 : run.completedAt]);
|
|
129850
|
-
const pollSteps = reactExports.useCallback(
|
|
129851
|
-
() => pollResource({
|
|
129852
|
-
fetchFn: () => unwrapServerActionResult(
|
|
129853
|
-
fetchSteps$1(env2, runId, {
|
|
129854
|
-
cursor: stepsCursor,
|
|
129855
|
-
sortOrder: "asc",
|
|
129856
|
-
limit: LIVE_POLL_LIMIT
|
|
129857
|
-
})
|
|
129858
|
-
),
|
|
129859
|
-
setItems: setSteps,
|
|
129860
|
-
setCursor: setStepsCursor,
|
|
129861
|
-
setError,
|
|
129862
|
-
idKey: "stepId",
|
|
129863
|
-
cursorStrategy: "onHasMore",
|
|
129864
|
-
transform: hydrateResourceIO
|
|
129865
|
-
}),
|
|
129866
|
-
[env2, runId, stepsCursor]
|
|
129867
|
-
);
|
|
129868
|
-
const pollHooks = reactExports.useCallback(
|
|
129869
|
-
() => pollResource({
|
|
129870
|
-
fetchFn: () => unwrapServerActionResult(
|
|
129871
|
-
fetchHooks$1(env2, {
|
|
129872
|
-
runId,
|
|
129873
|
-
cursor: hooksCursor,
|
|
129874
|
-
sortOrder: "asc",
|
|
129875
|
-
limit: LIVE_POLL_LIMIT
|
|
129876
|
-
})
|
|
129877
|
-
),
|
|
129878
|
-
setItems: setHooks,
|
|
129879
|
-
setCursor: setHooksCursor,
|
|
129880
|
-
setError,
|
|
129881
|
-
idKey: "hookId",
|
|
129882
|
-
transform: hydrateResourceIO
|
|
129883
|
-
}),
|
|
129884
|
-
[env2, runId, hooksCursor]
|
|
129885
|
-
);
|
|
129886
129842
|
const pollEvents = reactExports.useCallback(
|
|
129887
129843
|
() => pollResource({
|
|
129888
129844
|
fetchFn: () => unwrapServerActionResult(
|
|
129889
129845
|
fetchEvents$1(env2, runId, {
|
|
129890
129846
|
cursor: eventsCursor,
|
|
129891
129847
|
sortOrder: "asc",
|
|
129892
|
-
limit: LIVE_POLL_LIMIT
|
|
129848
|
+
limit: LIVE_POLL_LIMIT,
|
|
129849
|
+
withData: true
|
|
129893
129850
|
})
|
|
129894
129851
|
),
|
|
129895
129852
|
setItems: setEvents,
|
|
@@ -129900,27 +129857,19 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
|
129900
129857
|
}),
|
|
129901
129858
|
[env2, runId, eventsCursor]
|
|
129902
129859
|
);
|
|
129903
|
-
const update = reactExports.useCallback(
|
|
129904
|
-
|
|
129905
|
-
|
|
129906
|
-
|
|
129907
|
-
|
|
129908
|
-
|
|
129909
|
-
|
|
129910
|
-
|
|
129911
|
-
|
|
129912
|
-
|
|
129913
|
-
|
|
129914
|
-
|
|
129915
|
-
|
|
129916
|
-
foundNewItems = stepsUpdated || hooksUpdated || eventsUpdated;
|
|
129917
|
-
} catch (err) {
|
|
129918
|
-
console.error("Update error:", err);
|
|
129919
|
-
}
|
|
129920
|
-
return { foundNewItems };
|
|
129921
|
-
},
|
|
129922
|
-
[pollSteps, pollHooks, pollEvents, initialLoadCompleted, pollRun]
|
|
129923
|
-
);
|
|
129860
|
+
const update = reactExports.useCallback(async () => {
|
|
129861
|
+
if (isFetchingRef.current || !initialLoadCompleted) {
|
|
129862
|
+
return { foundNewItems: false };
|
|
129863
|
+
}
|
|
129864
|
+
let foundNewItems = false;
|
|
129865
|
+
try {
|
|
129866
|
+
const [_2, eventsUpdated] = await Promise.all([pollRun(), pollEvents()]);
|
|
129867
|
+
foundNewItems = eventsUpdated;
|
|
129868
|
+
} catch (err) {
|
|
129869
|
+
console.error("Update error:", err);
|
|
129870
|
+
}
|
|
129871
|
+
return { foundNewItems };
|
|
129872
|
+
}, [pollEvents, initialLoadCompleted, pollRun]);
|
|
129924
129873
|
reactExports.useEffect(() => {
|
|
129925
129874
|
fetchAllData();
|
|
129926
129875
|
}, [fetchAllData]);
|
|
@@ -129931,25 +129880,18 @@ function useWorkflowTraceViewerData(env2, runId, options = {}) {
|
|
|
129931
129880
|
const interval2 = setInterval(() => {
|
|
129932
129881
|
update();
|
|
129933
129882
|
}, LIVE_UPDATE_INTERVAL_MS);
|
|
129934
|
-
const stepInterval = setInterval(() => {
|
|
129935
|
-
update(true);
|
|
129936
|
-
}, LIVE_STEP_UPDATE_INTERVAL_MS);
|
|
129937
129883
|
return () => {
|
|
129938
129884
|
clearInterval(interval2);
|
|
129939
|
-
clearInterval(stepInterval);
|
|
129940
129885
|
};
|
|
129941
129886
|
}, [live, initialLoadCompleted, update, run == null ? void 0 : run.completedAt]);
|
|
129942
129887
|
return {
|
|
129943
129888
|
run: run ?? {},
|
|
129944
|
-
steps,
|
|
129945
|
-
hooks,
|
|
129946
129889
|
events: events2,
|
|
129947
129890
|
loading,
|
|
129948
|
-
auxiliaryDataLoading,
|
|
129949
129891
|
error: error2,
|
|
129950
129892
|
update,
|
|
129951
129893
|
loadMoreTraceData,
|
|
129952
|
-
hasMoreTraceData:
|
|
129894
|
+
hasMoreTraceData: eventsHasMore,
|
|
129953
129895
|
isLoadingMoreTraceData
|
|
129954
129896
|
};
|
|
129955
129897
|
}
|
|
@@ -130082,7 +130024,7 @@ function HooksTable({
|
|
|
130082
130024
|
};
|
|
130083
130025
|
const [invocationData, setInvocationData] = reactExports.useState(/* @__PURE__ */ new Map());
|
|
130084
130026
|
reactExports.useEffect(() => {
|
|
130085
|
-
if (!hooks.length) return;
|
|
130027
|
+
if (!hooks.length || !runId) return;
|
|
130086
130028
|
const fetchInvocations = async () => {
|
|
130087
130029
|
const initialData = /* @__PURE__ */ new Map();
|
|
130088
130030
|
for (const hook of hooks) {
|
|
@@ -130093,65 +130035,55 @@ function HooksTable({
|
|
|
130093
130035
|
});
|
|
130094
130036
|
}
|
|
130095
130037
|
setInvocationData(initialData);
|
|
130096
|
-
|
|
130097
|
-
|
|
130098
|
-
|
|
130099
|
-
|
|
130100
|
-
|
|
130101
|
-
|
|
130102
|
-
|
|
130103
|
-
|
|
130104
|
-
|
|
130105
|
-
|
|
130106
|
-
}
|
|
130107
|
-
);
|
|
130108
|
-
if (!serverResult.success) {
|
|
130109
|
-
return {
|
|
130110
|
-
hookId: hook.hookId,
|
|
130111
|
-
count: new Error(
|
|
130112
|
-
((_a3 = serverResult.error) == null ? void 0 : _a3.message) || "Failed to fetch events"
|
|
130113
|
-
),
|
|
130114
|
-
hasMore: false
|
|
130115
|
-
};
|
|
130038
|
+
try {
|
|
130039
|
+
const serverResult = await fetchEvents$1(env2, runId, {
|
|
130040
|
+
sortOrder: "asc",
|
|
130041
|
+
limit: 1e3
|
|
130042
|
+
});
|
|
130043
|
+
if (!serverResult.success) {
|
|
130044
|
+
setInvocationData((prev) => {
|
|
130045
|
+
const updated = new Map(prev);
|
|
130046
|
+
for (const hook of hooks) {
|
|
130047
|
+
updated.set(hook.hookId, { count: 0, hasMore: false, loading: false });
|
|
130116
130048
|
}
|
|
130117
|
-
|
|
130118
|
-
|
|
130119
|
-
|
|
130120
|
-
|
|
130121
|
-
|
|
130122
|
-
|
|
130123
|
-
|
|
130124
|
-
|
|
130125
|
-
|
|
130126
|
-
|
|
130127
|
-
|
|
130128
|
-
|
|
130129
|
-
|
|
130130
|
-
hasMore: false
|
|
130131
|
-
};
|
|
130049
|
+
return updated;
|
|
130050
|
+
});
|
|
130051
|
+
return;
|
|
130052
|
+
}
|
|
130053
|
+
const allEvents = serverResult.data.data;
|
|
130054
|
+
const hookIds = new Set(hooks.map((h2) => h2.hookId));
|
|
130055
|
+
const counts = /* @__PURE__ */ new Map();
|
|
130056
|
+
for (const event of allEvents) {
|
|
130057
|
+
if (event.eventType === "hook_received" && event.correlationId && hookIds.has(event.correlationId)) {
|
|
130058
|
+
counts.set(
|
|
130059
|
+
event.correlationId,
|
|
130060
|
+
(counts.get(event.correlationId) ?? 0) + 1
|
|
130061
|
+
);
|
|
130132
130062
|
}
|
|
130133
|
-
}
|
|
130134
|
-
|
|
130135
|
-
|
|
130136
|
-
|
|
130137
|
-
|
|
130138
|
-
|
|
130139
|
-
|
|
130140
|
-
if (result.status === "fulfilled") {
|
|
130141
|
-
updated.set(result.value.hookId, {
|
|
130142
|
-
count: result.value.count,
|
|
130143
|
-
hasMore: result.value.hasMore,
|
|
130063
|
+
}
|
|
130064
|
+
setInvocationData((prev) => {
|
|
130065
|
+
const updated = new Map(prev);
|
|
130066
|
+
for (const hook of hooks) {
|
|
130067
|
+
updated.set(hook.hookId, {
|
|
130068
|
+
count: counts.get(hook.hookId) ?? 0,
|
|
130069
|
+
hasMore: serverResult.data.hasMore,
|
|
130144
130070
|
loading: false
|
|
130145
130071
|
});
|
|
130146
|
-
} else {
|
|
130147
|
-
updated.set(hookId, { count: 0, hasMore: false, loading: false });
|
|
130148
130072
|
}
|
|
130149
|
-
|
|
130150
|
-
|
|
130151
|
-
}
|
|
130073
|
+
return updated;
|
|
130074
|
+
});
|
|
130075
|
+
} catch {
|
|
130076
|
+
setInvocationData((prev) => {
|
|
130077
|
+
const updated = new Map(prev);
|
|
130078
|
+
for (const hook of hooks) {
|
|
130079
|
+
updated.set(hook.hookId, { count: 0, hasMore: false, loading: false });
|
|
130080
|
+
}
|
|
130081
|
+
return updated;
|
|
130082
|
+
});
|
|
130083
|
+
}
|
|
130152
130084
|
};
|
|
130153
130085
|
fetchInvocations();
|
|
130154
|
-
}, [hooks, env2]);
|
|
130086
|
+
}, [hooks, env2, runId]);
|
|
130155
130087
|
const renderInvocationCount = (hook) => {
|
|
130156
130088
|
const data2 = invocationData.get(hook.hookId);
|
|
130157
130089
|
if (!data2 || data2.loading) {
|
|
@@ -146834,7 +146766,6 @@ function WorkflowGraphExecutionViewer({
|
|
|
146834
146766
|
}
|
|
146835
146767
|
function GraphTabContent({
|
|
146836
146768
|
run,
|
|
146837
|
-
allSteps,
|
|
146838
146769
|
allEvents,
|
|
146839
146770
|
env: env2
|
|
146840
146771
|
}) {
|
|
@@ -146859,15 +146790,30 @@ function GraphTabContent({
|
|
|
146859
146790
|
return ((_a4 = parseWorkflowName(wf.workflowName)) == null ? void 0 : _a4.shortName) === runShortName;
|
|
146860
146791
|
}) ?? null;
|
|
146861
146792
|
}, [graphManifest, run.workflowName]);
|
|
146793
|
+
const stepsFromEvents = reactExports.useMemo(() => {
|
|
146794
|
+
if (!allEvents) return [];
|
|
146795
|
+
const stepEventsMap = /* @__PURE__ */ new Map();
|
|
146796
|
+
for (const event of allEvents) {
|
|
146797
|
+
if (event.eventType.startsWith("step_") && event.correlationId) {
|
|
146798
|
+
const existing = stepEventsMap.get(event.correlationId);
|
|
146799
|
+
if (existing) {
|
|
146800
|
+
existing.push(event);
|
|
146801
|
+
} else {
|
|
146802
|
+
stepEventsMap.set(event.correlationId, [event]);
|
|
146803
|
+
}
|
|
146804
|
+
}
|
|
146805
|
+
}
|
|
146806
|
+
return Array.from(stepEventsMap.values()).map(stepEventsToStepEntity).filter((s2) => s2 !== null);
|
|
146807
|
+
}, [allEvents]);
|
|
146862
146808
|
const execution = reactExports.useMemo(() => {
|
|
146863
146809
|
if (!workflowGraph || !run.runId) return null;
|
|
146864
146810
|
return mapRunToExecution(
|
|
146865
146811
|
run,
|
|
146866
|
-
|
|
146812
|
+
stepsFromEvents,
|
|
146867
146813
|
allEvents || [],
|
|
146868
146814
|
workflowGraph
|
|
146869
146815
|
);
|
|
146870
|
-
}, [workflowGraph, run,
|
|
146816
|
+
}, [workflowGraph, run, stepsFromEvents, allEvents]);
|
|
146871
146817
|
if (graphLoading) {
|
|
146872
146818
|
return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-center w-full h-full", children: [
|
|
146873
146819
|
/* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-8 w-8 animate-spin text-muted-foreground" }),
|
|
@@ -146897,13 +146843,6 @@ function GraphTabContent({
|
|
|
146897
146843
|
}
|
|
146898
146844
|
);
|
|
146899
146845
|
}
|
|
146900
|
-
const RUN_LEVEL_EVENT_TYPES = /* @__PURE__ */ new Set([
|
|
146901
|
-
"run_created",
|
|
146902
|
-
"run_started",
|
|
146903
|
-
"run_completed",
|
|
146904
|
-
"run_failed",
|
|
146905
|
-
"run_cancelled"
|
|
146906
|
-
]);
|
|
146907
146846
|
function RunDetailView({
|
|
146908
146847
|
runId,
|
|
146909
146848
|
// TODO: This should open the right sidebar within the trace viewer
|
|
@@ -146971,52 +146910,13 @@ function RunDetailView({
|
|
|
146971
146910
|
);
|
|
146972
146911
|
const handleLoadEventData = reactExports.useCallback(
|
|
146973
146912
|
async (event) => {
|
|
146974
|
-
const isRunLevelEvent = RUN_LEVEL_EVENT_TYPES.has(event.eventType);
|
|
146975
|
-
if (!isRunLevelEvent && event.correlationId) {
|
|
146976
|
-
const { error: error3, result: result2 } = await unwrapServerActionResult(
|
|
146977
|
-
fetchEventsByCorrelationId$1(env2, event.correlationId, {
|
|
146978
|
-
sortOrder: "asc",
|
|
146979
|
-
limit: 100,
|
|
146980
|
-
withData: true
|
|
146981
|
-
})
|
|
146982
|
-
);
|
|
146983
|
-
if (error3) {
|
|
146984
|
-
throw error3;
|
|
146985
|
-
}
|
|
146986
|
-
const rawEvent2 = result2.data.find((e) => e.eventId === event.eventId);
|
|
146987
|
-
if (!rawEvent2) return null;
|
|
146988
|
-
const fullEvent2 = encryptionKeyRef.current ? await hydrateResourceIOWithKey(rawEvent2, encryptionKeyRef.current) : hydrateResourceIO(rawEvent2);
|
|
146989
|
-
if ("eventData" in fullEvent2) {
|
|
146990
|
-
return fullEvent2.eventData;
|
|
146991
|
-
}
|
|
146992
|
-
return null;
|
|
146993
|
-
}
|
|
146994
146913
|
const { error: error22, result } = await unwrapServerActionResult(
|
|
146995
|
-
|
|
146996
|
-
sortOrder: "desc",
|
|
146997
|
-
limit: 1e3,
|
|
146998
|
-
withData: true
|
|
146999
|
-
})
|
|
146914
|
+
fetchEvent$1(env2, event.runId, event.eventId, "all")
|
|
147000
146915
|
);
|
|
147001
146916
|
if (error22) {
|
|
147002
146917
|
throw error22;
|
|
147003
146918
|
}
|
|
147004
|
-
|
|
147005
|
-
if (!rawEvent) {
|
|
147006
|
-
const { error: ascError, result: ascResult } = await unwrapServerActionResult(
|
|
147007
|
-
fetchEvents$1(env2, event.runId, {
|
|
147008
|
-
sortOrder: "asc",
|
|
147009
|
-
limit: 1e3,
|
|
147010
|
-
withData: true
|
|
147011
|
-
})
|
|
147012
|
-
);
|
|
147013
|
-
if (ascError) {
|
|
147014
|
-
throw ascError;
|
|
147015
|
-
}
|
|
147016
|
-
rawEvent = ascResult.data.find((e) => e.eventId === event.eventId);
|
|
147017
|
-
}
|
|
147018
|
-
if (!rawEvent) return null;
|
|
147019
|
-
const fullEvent = encryptionKeyRef.current ? await hydrateResourceIOWithKey(rawEvent, encryptionKeyRef.current) : hydrateResourceIO(rawEvent);
|
|
146919
|
+
const fullEvent = encryptionKeyRef.current ? await hydrateResourceIOWithKey(result, encryptionKeyRef.current) : hydrateResourceIO(result);
|
|
147020
146920
|
if ("eventData" in fullEvent) {
|
|
147021
146921
|
return fullEvent.eventData;
|
|
147022
146922
|
}
|
|
@@ -147025,35 +146925,26 @@ function RunDetailView({
|
|
|
147025
146925
|
[env2]
|
|
147026
146926
|
);
|
|
147027
146927
|
const handleLoadSidebarEventData = reactExports.useCallback(
|
|
147028
|
-
async (
|
|
146928
|
+
async (_correlationId, eventId) => {
|
|
147029
146929
|
const { error: error22, result } = await unwrapServerActionResult(
|
|
147030
|
-
|
|
147031
|
-
sortOrder: "asc",
|
|
147032
|
-
limit: 100,
|
|
147033
|
-
withData: true
|
|
147034
|
-
})
|
|
146930
|
+
fetchEvent$1(env2, runId, eventId, "all")
|
|
147035
146931
|
);
|
|
147036
146932
|
if (error22) {
|
|
147037
146933
|
throw error22;
|
|
147038
146934
|
}
|
|
147039
|
-
const
|
|
147040
|
-
if (!rawEvent) return null;
|
|
147041
|
-
const fullEvent = encryptionKeyRef.current ? await hydrateResourceIOWithKey(rawEvent, encryptionKeyRef.current) : hydrateResourceIO(rawEvent);
|
|
146935
|
+
const fullEvent = encryptionKeyRef.current ? await hydrateResourceIOWithKey(result, encryptionKeyRef.current) : hydrateResourceIO(result);
|
|
147042
146936
|
if ("eventData" in fullEvent) {
|
|
147043
146937
|
return fullEvent.eventData;
|
|
147044
146938
|
}
|
|
147045
146939
|
return null;
|
|
147046
146940
|
},
|
|
147047
|
-
[env2]
|
|
146941
|
+
[env2, runId]
|
|
147048
146942
|
);
|
|
147049
146943
|
const isLocalBackend = serverConfig.backendId === "local" || serverConfig.backendId === "@workflow/world-local";
|
|
147050
146944
|
const {
|
|
147051
146945
|
run: runData,
|
|
147052
|
-
steps: allSteps,
|
|
147053
|
-
hooks: allHooks,
|
|
147054
146946
|
events: allEvents,
|
|
147055
146947
|
loading,
|
|
147056
|
-
auxiliaryDataLoading,
|
|
147057
146948
|
error: error2,
|
|
147058
146949
|
update,
|
|
147059
146950
|
loadMoreTraceData,
|
|
@@ -147205,24 +147096,6 @@ function RunDetailView({
|
|
|
147205
147096
|
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mb-4", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { className: "text-xl font-semibold", children: workflowName ? workflowName : /* @__PURE__ */ jsxRuntimeExports.jsx(Skeleton, { className: "w-[260px] h-[28px]" }) }) }),
|
|
147206
147097
|
/* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex items-center justify-between gap-2", children: [
|
|
147207
147098
|
/* @__PURE__ */ jsxRuntimeExports.jsx(LiveStatus, { hasError, errorMessage }),
|
|
147208
|
-
(isEncryptedMarker(run.input) || isEncryptedMarker(run.output) || isEncryptedMarker(run.error) || allSteps.some(
|
|
147209
|
-
(s2) => isEncryptedMarker(s2.input) || isEncryptedMarker(s2.output)
|
|
147210
|
-
)) && /* @__PURE__ */ jsxRuntimeExports.jsxs(Tooltip, { children: [
|
|
147211
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
147212
|
-
Button,
|
|
147213
|
-
{
|
|
147214
|
-
variant: "outline",
|
|
147215
|
-
size: "sm",
|
|
147216
|
-
onClick: handleDecrypt,
|
|
147217
|
-
disabled: !!encryptionKey,
|
|
147218
|
-
children: [
|
|
147219
|
-
encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx(LockOpen, { className: "h-4 w-4" }) : /* @__PURE__ */ jsxRuntimeExports.jsx(Lock, { className: "h-4 w-4" }),
|
|
147220
|
-
encryptionKey ? "Decrypted" : "Decrypt"
|
|
147221
|
-
]
|
|
147222
|
-
}
|
|
147223
|
-
) }) }),
|
|
147224
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(TooltipContent, { children: encryptionKey ? /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "Data has been decrypted for this workflow run. All encrypted input, output, and event data is now visible across all tabs." }) : /* @__PURE__ */ jsxRuntimeExports.jsx("p", { children: "This run's data is end-to-end encrypted. Decrypt to reveal input, output, and event data across all tabs for this workflow run." }) })
|
|
147225
|
-
] }),
|
|
147226
147099
|
/* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147227
147100
|
RunActionsButtons,
|
|
147228
147101
|
{
|
|
@@ -147230,7 +147103,7 @@ function RunDetailView({
|
|
|
147230
147103
|
runId,
|
|
147231
147104
|
runStatus: run.status,
|
|
147232
147105
|
events: allEvents,
|
|
147233
|
-
eventsLoading:
|
|
147106
|
+
eventsLoading: loading,
|
|
147234
147107
|
loading,
|
|
147235
147108
|
onRerunClick: handleRerunClick,
|
|
147236
147109
|
onCancelClick: handleCancelClick,
|
|
@@ -147289,159 +147162,150 @@ function RunDetailView({
|
|
|
147289
147162
|
] })
|
|
147290
147163
|
] })
|
|
147291
147164
|
] }),
|
|
147292
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
147293
|
-
|
|
147294
|
-
|
|
147295
|
-
|
|
147296
|
-
|
|
147297
|
-
|
|
147298
|
-
|
|
147299
|
-
children: [
|
|
147300
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
147301
|
-
/* @__PURE__ */ jsxRuntimeExports.
|
|
147302
|
-
|
|
147303
|
-
"Trace"
|
|
147304
|
-
] }),
|
|
147305
|
-
isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "graph", className: "gap-2", children: [
|
|
147306
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(GitBranch, { className: "h-4 w-4" }),
|
|
147307
|
-
"Graph"
|
|
147308
|
-
] }),
|
|
147309
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "events", className: "gap-2", children: [
|
|
147310
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
|
|
147311
|
-
"Events"
|
|
147312
|
-
] }),
|
|
147313
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "streams", className: "gap-2", children: [
|
|
147314
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
|
|
147315
|
-
"Streams"
|
|
147316
|
-
] })
|
|
147165
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "mt-4 flex-1 flex flex-col min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
147166
|
+
Tabs,
|
|
147167
|
+
{
|
|
147168
|
+
value: activeTab,
|
|
147169
|
+
onValueChange: (v2) => setActiveTab(v2),
|
|
147170
|
+
className: "flex-1 flex flex-col min-h-0",
|
|
147171
|
+
children: [
|
|
147172
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsList, { className: "mb-4 flex-none", children: [
|
|
147173
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "trace", className: "gap-2", children: [
|
|
147174
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
|
|
147175
|
+
"Trace"
|
|
147317
147176
|
] }),
|
|
147318
|
-
|
|
147319
|
-
|
|
147320
|
-
|
|
147321
|
-
|
|
147322
|
-
|
|
147323
|
-
|
|
147324
|
-
|
|
147325
|
-
|
|
147326
|
-
|
|
147327
|
-
|
|
147328
|
-
|
|
147329
|
-
|
|
147330
|
-
|
|
147331
|
-
|
|
147332
|
-
|
|
147333
|
-
|
|
147334
|
-
|
|
147335
|
-
|
|
147336
|
-
|
|
147337
|
-
|
|
147338
|
-
|
|
147339
|
-
|
|
147340
|
-
|
|
147341
|
-
|
|
147342
|
-
|
|
147177
|
+
isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "graph", className: "gap-2", children: [
|
|
147178
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(GitBranch, { className: "h-4 w-4" }),
|
|
147179
|
+
"Graph"
|
|
147180
|
+
] }),
|
|
147181
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "events", className: "gap-2", children: [
|
|
147182
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
|
|
147183
|
+
"Events"
|
|
147184
|
+
] }),
|
|
147185
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(TabsTrigger, { value: "streams", className: "gap-2", children: [
|
|
147186
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(List$1, { className: "h-4 w-4" }),
|
|
147187
|
+
"Streams"
|
|
147188
|
+
] })
|
|
147189
|
+
] }),
|
|
147190
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "trace", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load trace viewer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147191
|
+
WorkflowTraceViewer,
|
|
147192
|
+
{
|
|
147193
|
+
error: error2,
|
|
147194
|
+
events: allEvents,
|
|
147195
|
+
run,
|
|
147196
|
+
isLoading: loading,
|
|
147197
|
+
spanDetailData,
|
|
147198
|
+
spanDetailLoading,
|
|
147199
|
+
spanDetailError,
|
|
147200
|
+
onSpanSelect: handleSpanSelect,
|
|
147201
|
+
onStreamClick: handleStreamClick,
|
|
147202
|
+
onWakeUpSleep: handleWakeUpSleep,
|
|
147203
|
+
onResolveHook: handleResolveHook,
|
|
147204
|
+
onLoadEventData: handleLoadSidebarEventData,
|
|
147205
|
+
onLoadMoreSpans: loadMoreTraceData,
|
|
147206
|
+
hasMoreSpans: hasMoreTraceData,
|
|
147207
|
+
isLoadingMoreSpans: isLoadingMoreTraceData,
|
|
147208
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
147209
|
+
onDecrypt: handleDecrypt
|
|
147210
|
+
}
|
|
147211
|
+
) }) }) }),
|
|
147212
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "events", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load events list", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147213
|
+
EventListView,
|
|
147214
|
+
{
|
|
147215
|
+
events: allEvents,
|
|
147216
|
+
run,
|
|
147217
|
+
onLoadEventData: handleLoadEventData,
|
|
147218
|
+
encryptionKey: encryptionKey ?? void 0
|
|
147219
|
+
}
|
|
147220
|
+
) }) }) }),
|
|
147221
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "streams", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load stream data", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "h-full flex gap-4", children: [
|
|
147222
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
147223
|
+
"div",
|
|
147343
147224
|
{
|
|
147344
|
-
|
|
147345
|
-
|
|
147346
|
-
|
|
147347
|
-
|
|
147348
|
-
|
|
147349
|
-
|
|
147350
|
-
|
|
147351
|
-
|
|
147352
|
-
|
|
147353
|
-
|
|
147354
|
-
|
|
147355
|
-
|
|
147356
|
-
|
|
147357
|
-
borderColor: "var(--ds-gray-300)",
|
|
147358
|
-
backgroundColor: "var(--ds-background-100)"
|
|
147359
|
-
},
|
|
147360
|
-
children: [
|
|
147361
|
-
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
147362
|
-
"div",
|
|
147363
|
-
{
|
|
147364
|
-
className: "px-3 py-2 border-b text-xs font-medium",
|
|
147365
|
-
style: {
|
|
147366
|
-
borderColor: "var(--ds-gray-300)",
|
|
147367
|
-
color: "var(--ds-gray-900)"
|
|
147368
|
-
},
|
|
147369
|
-
children: [
|
|
147370
|
-
"Streams (",
|
|
147371
|
-
streams.length,
|
|
147372
|
-
")"
|
|
147373
|
-
]
|
|
147374
|
-
}
|
|
147375
|
-
),
|
|
147376
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-auto max-h-[calc(100vh-400px)]", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-xs text-destructive", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147377
|
-
"div",
|
|
147378
|
-
{
|
|
147379
|
-
className: "p-4 text-xs",
|
|
147380
|
-
style: { color: "var(--ds-gray-600)" },
|
|
147381
|
-
children: "No streams found for this run"
|
|
147382
|
-
}
|
|
147383
|
-
) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147384
|
-
"button",
|
|
147385
|
-
{
|
|
147386
|
-
type: "button",
|
|
147387
|
-
onClick: () => setSelectedStreamId(streamId),
|
|
147388
|
-
className: "w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",
|
|
147389
|
-
style: {
|
|
147390
|
-
backgroundColor: selectedStreamId === streamId ? "var(--ds-gray-200)" : "transparent",
|
|
147391
|
-
color: "var(--ds-gray-1000)"
|
|
147392
|
-
},
|
|
147393
|
-
title: streamId,
|
|
147394
|
-
children: streamId
|
|
147225
|
+
className: "w-64 flex-shrink-0 border rounded-lg overflow-hidden",
|
|
147226
|
+
style: {
|
|
147227
|
+
borderColor: "var(--ds-gray-300)",
|
|
147228
|
+
backgroundColor: "var(--ds-background-100)"
|
|
147229
|
+
},
|
|
147230
|
+
children: [
|
|
147231
|
+
/* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
147232
|
+
"div",
|
|
147233
|
+
{
|
|
147234
|
+
className: "px-3 py-2 border-b text-xs font-medium",
|
|
147235
|
+
style: {
|
|
147236
|
+
borderColor: "var(--ds-gray-300)",
|
|
147237
|
+
color: "var(--ds-gray-900)"
|
|
147395
147238
|
},
|
|
147396
|
-
|
|
147397
|
-
|
|
147398
|
-
|
|
147399
|
-
|
|
147400
|
-
|
|
147401
|
-
|
|
147402
|
-
|
|
147403
|
-
|
|
147404
|
-
streamId: selectedStreamId,
|
|
147405
|
-
chunks: streamChunks,
|
|
147406
|
-
isLive: streamIsLive,
|
|
147407
|
-
error: streamError
|
|
147408
|
-
}
|
|
147409
|
-
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147410
|
-
"div",
|
|
147411
|
-
{
|
|
147412
|
-
className: "h-full flex items-center justify-center rounded-lg border",
|
|
147413
|
-
style: {
|
|
147414
|
-
borderColor: "var(--ds-gray-300)",
|
|
147415
|
-
backgroundColor: "var(--ds-gray-100)"
|
|
147416
|
-
},
|
|
147417
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147239
|
+
children: [
|
|
147240
|
+
"Streams (",
|
|
147241
|
+
streams.length,
|
|
147242
|
+
")"
|
|
147243
|
+
]
|
|
147244
|
+
}
|
|
147245
|
+
),
|
|
147246
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "overflow-auto max-h-[calc(100vh-400px)]", children: streamsLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 flex items-center justify-center", children: /* @__PURE__ */ jsxRuntimeExports.jsx(LoaderCircle, { className: "h-4 w-4 animate-spin text-muted-foreground" }) }) : streamsError ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "p-4 text-xs text-destructive", children: streamsError.message }) : streams.length === 0 ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147418
147247
|
"div",
|
|
147419
147248
|
{
|
|
147420
|
-
className: "text-
|
|
147249
|
+
className: "p-4 text-xs",
|
|
147421
147250
|
style: { color: "var(--ds-gray-600)" },
|
|
147422
|
-
children:
|
|
147251
|
+
children: "No streams found for this run"
|
|
147423
147252
|
}
|
|
147424
|
-
)
|
|
147425
|
-
|
|
147426
|
-
|
|
147427
|
-
|
|
147428
|
-
|
|
147429
|
-
|
|
147253
|
+
) : streams.map((streamId) => /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147254
|
+
"button",
|
|
147255
|
+
{
|
|
147256
|
+
type: "button",
|
|
147257
|
+
onClick: () => setSelectedStreamId(streamId),
|
|
147258
|
+
className: "w-full text-left px-3 py-2 text-xs font-mono truncate hover:bg-accent transition-colors",
|
|
147259
|
+
style: {
|
|
147260
|
+
backgroundColor: selectedStreamId === streamId ? "var(--ds-gray-200)" : "transparent",
|
|
147261
|
+
color: "var(--ds-gray-1000)"
|
|
147262
|
+
},
|
|
147263
|
+
title: streamId,
|
|
147264
|
+
children: streamId
|
|
147265
|
+
},
|
|
147266
|
+
streamId
|
|
147267
|
+
)) })
|
|
147268
|
+
]
|
|
147269
|
+
}
|
|
147270
|
+
),
|
|
147271
|
+
/* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "flex-1 min-w-0", children: selectedStreamId ? /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147272
|
+
StreamViewer,
|
|
147430
147273
|
{
|
|
147431
|
-
|
|
147432
|
-
|
|
147433
|
-
|
|
147434
|
-
|
|
147274
|
+
streamId: selectedStreamId,
|
|
147275
|
+
chunks: streamChunks,
|
|
147276
|
+
isLive: streamIsLive,
|
|
147277
|
+
error: streamError
|
|
147435
147278
|
}
|
|
147436
|
-
)
|
|
147437
|
-
|
|
147438
|
-
|
|
147439
|
-
|
|
147440
|
-
|
|
147441
|
-
|
|
147442
|
-
|
|
147443
|
-
|
|
147444
|
-
|
|
147279
|
+
) : /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147280
|
+
"div",
|
|
147281
|
+
{
|
|
147282
|
+
className: "h-full flex items-center justify-center rounded-lg border",
|
|
147283
|
+
style: {
|
|
147284
|
+
borderColor: "var(--ds-gray-300)",
|
|
147285
|
+
backgroundColor: "var(--ds-gray-100)"
|
|
147286
|
+
},
|
|
147287
|
+
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147288
|
+
"div",
|
|
147289
|
+
{
|
|
147290
|
+
className: "text-sm",
|
|
147291
|
+
style: { color: "var(--ds-gray-600)" },
|
|
147292
|
+
children: streams.length > 0 ? "Select a stream to view its data" : "No streams available"
|
|
147293
|
+
}
|
|
147294
|
+
)
|
|
147295
|
+
}
|
|
147296
|
+
) })
|
|
147297
|
+
] }) }) }),
|
|
147298
|
+
isLocalBackend && /* @__PURE__ */ jsxRuntimeExports.jsx(TabsContent, { value: "graph", className: "mt-0 flex-1 min-h-0", children: /* @__PURE__ */ jsxRuntimeExports.jsx(ErrorBoundary, { title: "Failed to load execution graph", children: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "h-full min-h-[500px]", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
147299
|
+
GraphTabContent,
|
|
147300
|
+
{
|
|
147301
|
+
run,
|
|
147302
|
+
allEvents,
|
|
147303
|
+
env: env2
|
|
147304
|
+
}
|
|
147305
|
+
) }) }) })
|
|
147306
|
+
]
|
|
147307
|
+
}
|
|
147308
|
+
) })
|
|
147445
147309
|
] })
|
|
147446
147310
|
] });
|
|
147447
147311
|
}
|
|
@@ -147471,7 +147335,7 @@ const handlers = {
|
|
|
147471
147335
|
fetchSteps: (p2) => fetchSteps(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
|
|
147472
147336
|
fetchStep: (p2) => fetchStep(p2.worldEnv ?? {}, p2.runId, p2.stepId, p2.resolveData),
|
|
147473
147337
|
fetchEvents: (p2) => fetchEvents(p2.worldEnv ?? {}, p2.runId, p2.params ?? {}),
|
|
147474
|
-
|
|
147338
|
+
fetchEvent: (p2) => fetchEvent(p2.worldEnv ?? {}, p2.runId, p2.eventId, p2.resolveData),
|
|
147475
147339
|
fetchHooks: (p2) => fetchHooks(p2.worldEnv ?? {}, p2.params ?? {}),
|
|
147476
147340
|
fetchHook: (p2) => fetchHook(p2.worldEnv ?? {}, p2.hookId, p2.resolveData),
|
|
147477
147341
|
cancelRun: (p2) => cancelRun$1(p2.worldEnv ?? {}, p2.runId),
|
|
@@ -147614,7 +147478,7 @@ const route4 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProper
|
|
|
147614
147478
|
__proto__: null,
|
|
147615
147479
|
loader
|
|
147616
147480
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
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-
|
|
147481
|
+
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-D-041AAq.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/mermaid-3ZIDBTTL-RlQIshou.js"], "css": ["/assets/root-9gRDb_Jz.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-Xl3EX8M3.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-C-GqGBPl.js", "/assets/mermaid-3ZIDBTTL-RlQIshou.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-BPOihWwO.js", "imports": ["/assets/index-DklpUtP3.js", "/assets/use-workflow-graph-C-GqGBPl.js", "/assets/mermaid-3ZIDBTTL-RlQIshou.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-0e172cba.js", "version": "0e172cba", "sri": void 0 };
|
|
147618
147482
|
const assetsBuildDirectory = "build/client";
|
|
147619
147483
|
const basename = "/";
|
|
147620
147484
|
const future = { "unstable_optimizeDeps": false, "unstable_subResourceIntegrity": false, "unstable_trailingSlashAwareDataRequests": false, "unstable_previewServerPrerendering": false, "v8_middleware": false, "v8_splitRouteModules": false, "v8_viteEnvironmentApi": false };
|