@brickkit/cli 0.11.0 → 0.13.0
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/dashboard-dist/CollapsiblePanel-CbUysOp5.js +2 -0
- package/dashboard-dist/CompositeRoot-D4sRkYq3.js +1 -0
- package/dashboard-dist/Geist-Variable.woff2 +0 -0
- package/dashboard-dist/GeistMono-Variable.woff2 +0 -0
- package/dashboard-dist/PopoverPopup-CiI2avT_.js +1 -0
- package/dashboard-dist/api-reference-mT9VNcPb.js +265 -0
- package/dashboard-dist/app.css +2 -2
- package/dashboard-dist/app.js +12 -13
- package/dashboard-dist/ccount-CcG1m-Yh.js +1 -0
- package/dashboard-dist/client-CwATkLJa.js +1 -0
- package/dashboard-dist/core-BEUWp6B5.js +1 -0
- package/dashboard-dist/docs-BRrtyxDB.js +4 -0
- package/dashboard-dist/docs.css +1 -1
- package/dashboard-dist/kit.js +1 -1
- package/dashboard-dist/popover-Bj9x-88h.js +1 -0
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +309 -211
- package/dist/bin.js.map +1 -1
- package/dist/build.js +463 -0
- package/dist/build.js.map +1 -0
- package/dist/client-contract-file.js +356 -1
- package/dist/client-contract-file.js.map +1 -0
- package/dist/compiler.d.ts +12 -3
- package/dist/compiler.js +1 -1
- package/dist/compiler2.js +13 -7
- package/dist/compiler2.js.map +1 -1
- package/dist/config.d.ts +3 -0
- package/dist/config.js +1 -252
- package/dist/config2.d.ts +122 -0
- package/dist/config2.js +207 -0
- package/dist/config2.js.map +1 -0
- package/dist/dashboard-extension.d.ts +3 -2
- package/dist/{dev-telemetry-store.js → dashboard-host.js} +1381 -1432
- package/dist/dashboard-host.js.map +1 -0
- package/dist/dashboard-protocol.js +189 -0
- package/dist/dashboard-protocol.js.map +1 -0
- package/dist/dashboard.d.ts +8 -135
- package/dist/definitions.js +33 -0
- package/dist/definitions.js.map +1 -0
- package/dist/dev-application.js +34 -0
- package/dist/dev-application.js.map +1 -0
- package/dist/dev-protocol.js +21 -0
- package/dist/dev-protocol.js.map +1 -0
- package/dist/dev-reporter.d.ts +0 -2
- package/dist/dev-reporter.js +3 -3
- package/dist/dev-reporter.js.map +1 -1
- package/dist/dev-telemetry.js +8 -24
- package/dist/dev-telemetry.js.map +1 -1
- package/dist/dev-worker.js +80 -21
- package/dist/dev-worker.js.map +1 -1
- package/dist/index.d.ts +18 -87
- package/dist/index.js +12 -6
- package/dist/index.js.map +1 -0
- package/dist/lint/oxlint.d.ts +0 -2
- package/dist/lint/oxlint.js +6 -5
- package/dist/lint/oxlint.js.map +1 -1
- package/dist/own-module.js +7 -0
- package/dist/own-module.js.map +1 -0
- package/dist/plugin.d.ts +6 -11
- package/dist/plugin.js +6 -42
- package/dist/plugin.js.map +1 -1
- package/dist/production-dashboard.d.ts +2 -0
- package/dist/production-dashboard.js +51 -0
- package/dist/production-dashboard.js.map +1 -0
- package/dist/production-dashboard2.d.ts +34 -0
- package/dist/{presets.js → project.js} +107 -113
- package/dist/project.js.map +1 -0
- package/dist/serve.d.ts +24 -0
- package/dist/serve.js +1 -0
- package/dist/serve2.js +49 -0
- package/dist/serve2.js.map +1 -0
- package/dist/vite.d.ts +0 -2
- package/dist/vite.js +28 -51
- package/dist/vite.js.map +1 -1
- package/dist/workflows.d.ts +2 -4
- package/dist/workflows2.js +60 -39
- package/dist/workflows2.js.map +1 -1
- package/inspector-dist/client/assets/api.rpc-BvRk9kiK.js +0 -0
- package/inspector-dist/client/assets/api.stream._streamId-BvRk9kiK.js +0 -0
- package/inspector-dist/client/assets/app-CeSwVsRm.css +2 -0
- package/inspector-dist/client/assets/dist-BK8w6xOr.js +3930 -0
- package/inspector-dist/client/assets/dist-CG2aVufI.js +197 -0
- package/inspector-dist/client/assets/entry.client-D9jbgmTR.js +9391 -0
- package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-CfRnuITN.js +34 -0
- package/inspector-dist/client/assets/home-hwPlkNhv.js +4034 -0
- package/inspector-dist/client/assets/jsx-runtime-CPEah4WQ.js +7084 -0
- package/inspector-dist/client/assets/manifest-0e76e9ac.js +1 -0
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-ZDR2PNY_.js +1 -0
- package/inspector-dist/client/assets/root-ChBNTZd2.css +2 -0
- package/inspector-dist/client/assets/root-SLeEf-sT.js +320 -0
- package/inspector-dist/client/assets/run-detail-DYbVkIFH.js +1871 -0
- package/inspector-dist/client/assets/tabs-CaJisoyb.js +73751 -0
- package/inspector-dist/client/assets/tabs-L5XKzOpP.css +1 -0
- package/inspector-dist/client/assets/zstd-browser-decoder-D94wmfAU.js +41 -0
- package/inspector-dist/server/assets/app-DGlfWVUI.js +99330 -0
- package/inspector-dist/server/assets/chunk-RLXIAIE6-F0SJZlei.js +42975 -0
- package/inspector-dist/server/assets/dist-BCbwm6jl.js +10325 -0
- package/inspector-dist/server/assets/dist-CG2aVufI.js +197 -0
- package/inspector-dist/server/assets/dist-Ce0I2PUv.js +1137 -0
- package/inspector-dist/server/assets/dist-DY0UlahA.js +1642 -0
- package/inspector-dist/server/assets/encryption-DdQgC8Rk.js +886 -0
- package/inspector-dist/server/assets/event-metadata-n7E4zEmT.js +145 -0
- package/inspector-dist/server/assets/functions-CNVQtbgg.js +1170 -0
- package/inspector-dist/server/assets/global-singleton-D8sIN5du.js +80 -0
- package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-CWRzMxYD.js +34 -0
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-D0v0ngVr.js +1 -0
- package/inspector-dist/server/assets/parse-Begau9cA.js +469 -0
- package/inspector-dist/server/assets/rolldown-runtime-C1I3wEg2.js +43 -0
- package/inspector-dist/server/assets/serialization-format-BbuGfHog.js +476 -0
- package/inspector-dist/server/assets/token-BgMmJNP5.js +60 -0
- package/inspector-dist/server/assets/token-BrUX0bxz.js +55 -0
- package/inspector-dist/server/assets/token-util-DZN32qmT.js +455 -0
- package/inspector-dist/server/assets/wrapper-CIC3w0oC.js +3624 -0
- package/inspector-dist/server/assets/ws-transport-CxTYB11n.js +29476 -0
- package/inspector-dist/server/assets/zstd-browser-decoder-D7bCXbGg.js +38 -0
- package/inspector-dist/server/index.js +1 -58
- package/package.json +39 -28
- package/vite-client.d.ts +1 -1
- package/dashboard-dist/CollapsiblePanel-BX79_W-b.js +0 -2
- package/dashboard-dist/CompositeRoot-xzybXjnx.js +0 -1
- package/dashboard-dist/PopoverPopup-CvlmC7EL.js +0 -1
- package/dashboard-dist/api-reference-BcAYVYwJ.js +0 -260
- package/dashboard-dist/core-BGO9JZ1r.js +0 -1
- package/dashboard-dist/docs-DHikPD2v.js +0 -4
- package/dashboard-dist/popover-DG498XHH.js +0 -1
- package/dist/app-entry.js +0 -1
- package/dist/app-entry2.js +0 -19
- package/dist/app-entry2.js.map +0 -1
- package/dist/bin.d.ts.map +0 -1
- package/dist/client-contract-file2.js +0 -34
- package/dist/client-contract-file2.js.map +0 -1
- package/dist/client-contract.js +0 -1
- package/dist/client-contract2.js +0 -294
- package/dist/client-contract2.js.map +0 -1
- package/dist/config.js.map +0 -1
- package/dist/dashboard-extension.d.ts.map +0 -1
- package/dist/dev-reporter.d.ts.map +0 -1
- package/dist/dev-telemetry-store.js.map +0 -1
- package/dist/emit.d.ts +0 -7
- package/dist/emit.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lint/oxlint.d.ts.map +0 -1
- package/dist/plugin.d.ts.map +0 -1
- package/dist/presets.js.map +0 -1
- package/dist/runner.js +0 -523
- package/dist/runner.js.map +0 -1
- package/dist/vite.d.ts.map +0 -1
- package/dist/workflows.d.ts.map +0 -1
- package/inspector-dist/client/assets/api.rpc-l0sNRNKZ.js +0 -1
- package/inspector-dist/client/assets/api.stream._streamId-l0sNRNKZ.js +0 -1
- package/inspector-dist/client/assets/app-CvoGgWcV.css +0 -1
- package/inspector-dist/client/assets/entry.client-BJ6G3n5t.js +0 -11697
- package/inspector-dist/client/assets/highlighted-body-B3W2YXNL-C-3wZnxf.js +0 -19
- package/inspector-dist/client/assets/home-CSKAS4P2.js +0 -4979
- package/inspector-dist/client/assets/index-DECCyMR0.js +0 -4482
- package/inspector-dist/client/assets/index-Dot7CgrA.js +0 -9837
- package/inspector-dist/client/assets/index-HqNj_XIX.js +0 -200
- package/inspector-dist/client/assets/manifest-139c9319.js +0 -1
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-DC0K8uTy.js +0 -58626
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-F88p7PFX.css +0 -1
- package/inspector-dist/client/assets/root-BMHd_XHz.css +0 -1
- package/inspector-dist/client/assets/root-cbi6iYwg.js +0 -305
- package/inspector-dist/client/assets/run-detail-CWoGxu_0.css +0 -1
- package/inspector-dist/client/assets/run-detail-Cc7tSGNq.js +0 -6237
- package/inspector-dist/client/assets/world-config-context-BAD1QCrR.js +0 -26
- package/inspector-dist/client/assets/zstd-browser-decoder-BQoRpP7L.js +0 -28
- package/inspector-dist/server/assets/app-DUP5RybL.js +0 -174880
- package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-D2g4hL2-.js +0 -71
- package/inspector-dist/server/assets/index-BfLBLRRi.js +0 -204
- package/inspector-dist/server/assets/index-BzrGWk7J.js +0 -1164
- package/inspector-dist/server/assets/index-D71yP6AL.js +0 -191
- package/inspector-dist/server/assets/index-wGSWRns3.js +0 -1296
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-DsvuKoEV.js +0 -58
- package/inspector-dist/server/assets/token-ClUZZwXl.js +0 -95
- package/inspector-dist/server/assets/token-util-DSxMZ6nI.js +0 -33
- package/inspector-dist/server/assets/wrapper-B3vstpCO.js +0 -67
- package/inspector-dist/server/assets/zstd-browser-decoder-Dn82m2BU.js +0 -77
|
@@ -0,0 +1,1871 @@
|
|
|
1
|
+
import { F as require_react, M as withComponentProps, O as useNavigate, R as __toESM, j as useSearchParams, k as useParams, r as Link, t as require_jsx_runtime } from "./jsx-runtime-CPEah4WQ.js";
|
|
2
|
+
import { $ as LIVE_UPDATE_INTERVAL_MS$1, At as deriveRunPayloadKeys, Bt as ChevronRight, Ct as hydrateResourceIO, D as Portal, E as Presence, Et as isEncryptedData, F as FocusScopeBranchProvider, G as useControllableState, I as useFocusScopeBranchRegistry, J as useComposedRefs, K as useLayoutEffect2, L as useFocusGuards, N as useId, P as FocusScope, Pt as Lock, Q as AlertTitle, R as DismissableLayer, Rt as CircleAlert, St as hasEncryptedFields, T as hideOthers, Tt as hydrateData, U as Primitive, Ut as createLucideIcon, W as createSlot, Wt as parseWorkflowName, X as Alert, Y as composeEventHandlers, Z as AlertDescription, _ as unwrapOrThrow, _t as DecryptButton, a as RunActionsButtons, at as StreamViewerSkeleton, bt as Slot$1, d as rpc, et as cn, f as API_PATHS, g as getErrorMessage, gt as TooltipTrigger, h as WorkflowWebAPIError, ht as TooltipContent, i as TabsTrigger, it as StreamViewer, jt as ErrorBoundary, kt as decrypt, l as Skeleton, m as STREAM_DONE_HEADER, mt as Tooltip, n as TabsContent, nt as TraceViewer, p as STREAM_CURSOR_HEADER, pt as EventListView, q as createContextScope, r as TabsList, rt as waitEventsToWaitEntity, s as StatusBadge, t as Tabs, u as RelativeTime, v as unwrapServerActionResult, w as ReactRemoveScroll, wt as hydrateResourceIOAsync, xt as getWebRevivers, y as CopyableText, yt as buttonVariants, z as useDismissableLayerSurface } from "./tabs-CaJisoyb.js";
|
|
3
|
+
import { n as toast } from "./dist-BK8w6xOr.js";
|
|
4
|
+
/**
|
|
5
|
+
* @license lucide-react v0.575.0 - ISC
|
|
6
|
+
*
|
|
7
|
+
* This source code is licensed under the ISC license.
|
|
8
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
9
|
+
*/
|
|
10
|
+
var CircleQuestionMark = createLucideIcon("circle-question-mark", [
|
|
11
|
+
["circle", {
|
|
12
|
+
cx: "12",
|
|
13
|
+
cy: "12",
|
|
14
|
+
r: "10",
|
|
15
|
+
key: "1mglay"
|
|
16
|
+
}],
|
|
17
|
+
["path", {
|
|
18
|
+
d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3",
|
|
19
|
+
key: "1u773s"
|
|
20
|
+
}],
|
|
21
|
+
["path", {
|
|
22
|
+
d: "M12 17h.01",
|
|
23
|
+
key: "p32p05"
|
|
24
|
+
}]
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* @license lucide-react v0.575.0 - ISC
|
|
28
|
+
*
|
|
29
|
+
* This source code is licensed under the ISC license.
|
|
30
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
31
|
+
*/
|
|
32
|
+
var List = createLucideIcon("list", [
|
|
33
|
+
["path", {
|
|
34
|
+
d: "M3 5h.01",
|
|
35
|
+
key: "18ugdj"
|
|
36
|
+
}],
|
|
37
|
+
["path", {
|
|
38
|
+
d: "M3 12h.01",
|
|
39
|
+
key: "nlz23k"
|
|
40
|
+
}],
|
|
41
|
+
["path", {
|
|
42
|
+
d: "M3 19h.01",
|
|
43
|
+
key: "noohij"
|
|
44
|
+
}],
|
|
45
|
+
["path", {
|
|
46
|
+
d: "M8 5h13",
|
|
47
|
+
key: "1pao27"
|
|
48
|
+
}],
|
|
49
|
+
["path", {
|
|
50
|
+
d: "M8 12h13",
|
|
51
|
+
key: "1za7za"
|
|
52
|
+
}],
|
|
53
|
+
["path", {
|
|
54
|
+
d: "M8 19h13",
|
|
55
|
+
key: "m83p4d"
|
|
56
|
+
}]
|
|
57
|
+
]);
|
|
58
|
+
// ../../node_modules/.bun/@radix-ui+react-dialog@1.3.1+a68cb332b68cb125/node_modules/@radix-ui/react-dialog/dist/index.mjs
|
|
59
|
+
var import_react = /* @__PURE__ */ __toESM(require_react(), 1);
|
|
60
|
+
var import_jsx_runtime = require_jsx_runtime();
|
|
61
|
+
var __defProp$1 = Object.defineProperty;
|
|
62
|
+
var __name$1 = (target, value) => __defProp$1(target, "name", {
|
|
63
|
+
value,
|
|
64
|
+
configurable: true
|
|
65
|
+
});
|
|
66
|
+
var DIALOG_NAME = "Dialog";
|
|
67
|
+
var [createDialogContext, createDialogScope] = createContextScope(DIALOG_NAME);
|
|
68
|
+
var [DialogProvider, useDialogContext] = createDialogContext(DIALOG_NAME);
|
|
69
|
+
var Dialog = /* @__PURE__ */ __name$1((props) => {
|
|
70
|
+
const { __scopeDialog, children, open: openProp, defaultOpen, onOpenChange, modal = true } = props;
|
|
71
|
+
const triggerRef = import_react.useRef(null);
|
|
72
|
+
const contentRef = import_react.useRef(null);
|
|
73
|
+
const { nodes: branchNodes, registry: branchRegistry } = useFocusScopeBranchRegistry();
|
|
74
|
+
const [open, setOpen] = useControllableState({
|
|
75
|
+
prop: openProp,
|
|
76
|
+
defaultProp: defaultOpen ?? false,
|
|
77
|
+
onChange: onOpenChange,
|
|
78
|
+
caller: DIALOG_NAME
|
|
79
|
+
});
|
|
80
|
+
const [titleCount, setTitleCount] = import_react.useState(0);
|
|
81
|
+
const [descriptionCount, setDescriptionCount] = import_react.useState(0);
|
|
82
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogProvider, {
|
|
83
|
+
scope: __scopeDialog,
|
|
84
|
+
triggerRef,
|
|
85
|
+
contentRef,
|
|
86
|
+
contentId: useId(),
|
|
87
|
+
titleId: useId(),
|
|
88
|
+
descriptionId: useId(),
|
|
89
|
+
titlePresent: titleCount > 0,
|
|
90
|
+
descriptionPresent: descriptionCount > 0,
|
|
91
|
+
setTitleCount,
|
|
92
|
+
setDescriptionCount,
|
|
93
|
+
open,
|
|
94
|
+
onOpenChange: setOpen,
|
|
95
|
+
onOpenToggle: import_react.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
96
|
+
modal,
|
|
97
|
+
branchNodes,
|
|
98
|
+
branchRegistry,
|
|
99
|
+
children
|
|
100
|
+
});
|
|
101
|
+
}, "Dialog");
|
|
102
|
+
var TRIGGER_NAME = "DialogTrigger";
|
|
103
|
+
var DialogTrigger = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogTrigger2(props, forwardedRef) {
|
|
104
|
+
const { __scopeDialog, ...triggerProps } = props;
|
|
105
|
+
const context = useDialogContext(TRIGGER_NAME, __scopeDialog);
|
|
106
|
+
const composedTriggerRef = useComposedRefs(forwardedRef, context.triggerRef);
|
|
107
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.button, {
|
|
108
|
+
type: "button",
|
|
109
|
+
"aria-haspopup": "dialog",
|
|
110
|
+
"aria-expanded": context.open,
|
|
111
|
+
"aria-controls": context.open ? context.contentId : void 0,
|
|
112
|
+
"data-state": getState(context.open),
|
|
113
|
+
...triggerProps,
|
|
114
|
+
ref: composedTriggerRef,
|
|
115
|
+
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
116
|
+
});
|
|
117
|
+
}, "DialogTrigger"));
|
|
118
|
+
var PORTAL_NAME = "DialogPortal";
|
|
119
|
+
var [PortalProvider, usePortalContext] = createDialogContext(PORTAL_NAME, { forceMount: void 0 });
|
|
120
|
+
var DialogPortal = /* @__PURE__ */ __name$1((props) => {
|
|
121
|
+
const { __scopeDialog, forceMount, children, container } = props;
|
|
122
|
+
const context = useDialogContext(PORTAL_NAME, __scopeDialog);
|
|
123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PortalProvider, {
|
|
124
|
+
scope: __scopeDialog,
|
|
125
|
+
forceMount,
|
|
126
|
+
children: import_react.Children.map(children, (child) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Presence, {
|
|
127
|
+
present: forceMount || context.open,
|
|
128
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Portal, {
|
|
129
|
+
asChild: true,
|
|
130
|
+
container,
|
|
131
|
+
children: child
|
|
132
|
+
})
|
|
133
|
+
}))
|
|
134
|
+
});
|
|
135
|
+
}, "DialogPortal");
|
|
136
|
+
var OVERLAY_NAME = "DialogOverlay";
|
|
137
|
+
var DialogOverlay = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogOverlay2(props, forwardedRef) {
|
|
138
|
+
const portalContext = usePortalContext(OVERLAY_NAME, props.__scopeDialog);
|
|
139
|
+
const { forceMount = portalContext.forceMount, ...overlayProps } = props;
|
|
140
|
+
const context = useDialogContext(OVERLAY_NAME, props.__scopeDialog);
|
|
141
|
+
return context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Presence, {
|
|
142
|
+
present: forceMount || context.open,
|
|
143
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlayImpl, {
|
|
144
|
+
...overlayProps,
|
|
145
|
+
ref: forwardedRef
|
|
146
|
+
})
|
|
147
|
+
}) : null;
|
|
148
|
+
}, "DialogOverlay"));
|
|
149
|
+
var Slot = createSlot("DialogOverlay.RemoveScroll");
|
|
150
|
+
var DialogOverlayImpl = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogOverlayImpl2(props, forwardedRef) {
|
|
151
|
+
const { __scopeDialog, ...overlayProps } = props;
|
|
152
|
+
const context = useDialogContext(OVERLAY_NAME, __scopeDialog);
|
|
153
|
+
const registerDismissableSurface = useDismissableLayerSurface();
|
|
154
|
+
const composedRefs = useComposedRefs(forwardedRef, registerDismissableSurface);
|
|
155
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ReactRemoveScroll, {
|
|
156
|
+
as: Slot,
|
|
157
|
+
allowPinchZoom: true,
|
|
158
|
+
shards: import_react.useMemo(() => [context.contentRef, ...context.branchNodes.map((node) => ({ current: node }))], [context.contentRef, context.branchNodes]),
|
|
159
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.div, {
|
|
160
|
+
"data-state": getState(context.open),
|
|
161
|
+
...overlayProps,
|
|
162
|
+
ref: composedRefs,
|
|
163
|
+
style: {
|
|
164
|
+
pointerEvents: "auto",
|
|
165
|
+
...overlayProps.style
|
|
166
|
+
}
|
|
167
|
+
})
|
|
168
|
+
});
|
|
169
|
+
}, "DialogOverlayImpl"));
|
|
170
|
+
var CONTENT_NAME = "DialogContent";
|
|
171
|
+
var DialogContent = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogContent2(props, forwardedRef) {
|
|
172
|
+
const portalContext = usePortalContext(CONTENT_NAME, props.__scopeDialog);
|
|
173
|
+
const { forceMount = portalContext.forceMount, ...contentProps } = props;
|
|
174
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
175
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Presence, {
|
|
176
|
+
present: forceMount || context.open,
|
|
177
|
+
children: context.modal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentModal, {
|
|
178
|
+
...contentProps,
|
|
179
|
+
ref: forwardedRef
|
|
180
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentNonModal, {
|
|
181
|
+
...contentProps,
|
|
182
|
+
ref: forwardedRef
|
|
183
|
+
})
|
|
184
|
+
});
|
|
185
|
+
}, "DialogContent"));
|
|
186
|
+
var DialogContentModal = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogContentModal2(props, forwardedRef) {
|
|
187
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
188
|
+
const contentRef = import_react.useRef(null);
|
|
189
|
+
const composedRefs = useComposedRefs(forwardedRef, context.contentRef, contentRef);
|
|
190
|
+
import_react.useEffect(() => {
|
|
191
|
+
const content = contentRef.current;
|
|
192
|
+
if (content) return hideOthers(content);
|
|
193
|
+
}, []);
|
|
194
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentImpl, {
|
|
195
|
+
...props,
|
|
196
|
+
ref: composedRefs,
|
|
197
|
+
trapFocus: context.open,
|
|
198
|
+
disableOutsidePointerEvents: context.open,
|
|
199
|
+
onCloseAutoFocus: composeEventHandlers(props.onCloseAutoFocus, (event) => {
|
|
200
|
+
event.preventDefault();
|
|
201
|
+
context.triggerRef.current?.focus();
|
|
202
|
+
}),
|
|
203
|
+
onPointerDownOutside: composeEventHandlers(props.onPointerDownOutside, (event) => {
|
|
204
|
+
const originalEvent = event.detail.originalEvent;
|
|
205
|
+
const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
|
|
206
|
+
if (originalEvent.button === 2 || ctrlLeftClick) event.preventDefault();
|
|
207
|
+
}),
|
|
208
|
+
onFocusOutside: composeEventHandlers(props.onFocusOutside, (event) => event.preventDefault())
|
|
209
|
+
});
|
|
210
|
+
}, "DialogContentModal"));
|
|
211
|
+
var DialogContentNonModal = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogContentNonModal2(props, forwardedRef) {
|
|
212
|
+
const context = useDialogContext(CONTENT_NAME, props.__scopeDialog);
|
|
213
|
+
const hasInteractedOutsideRef = import_react.useRef(false);
|
|
214
|
+
const hasPointerDownOutsideRef = import_react.useRef(false);
|
|
215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContentImpl, {
|
|
216
|
+
...props,
|
|
217
|
+
ref: forwardedRef,
|
|
218
|
+
trapFocus: false,
|
|
219
|
+
disableOutsidePointerEvents: false,
|
|
220
|
+
onCloseAutoFocus: (event) => {
|
|
221
|
+
props.onCloseAutoFocus?.(event);
|
|
222
|
+
if (!event.defaultPrevented) {
|
|
223
|
+
if (!hasInteractedOutsideRef.current) context.triggerRef.current?.focus();
|
|
224
|
+
event.preventDefault();
|
|
225
|
+
}
|
|
226
|
+
hasInteractedOutsideRef.current = false;
|
|
227
|
+
hasPointerDownOutsideRef.current = false;
|
|
228
|
+
},
|
|
229
|
+
onInteractOutside: (event) => {
|
|
230
|
+
props.onInteractOutside?.(event);
|
|
231
|
+
if (!event.defaultPrevented) {
|
|
232
|
+
hasInteractedOutsideRef.current = true;
|
|
233
|
+
if (event.detail.originalEvent.type === "pointerdown") hasPointerDownOutsideRef.current = true;
|
|
234
|
+
}
|
|
235
|
+
const target = event.target;
|
|
236
|
+
if (context.triggerRef.current?.contains(target)) event.preventDefault();
|
|
237
|
+
if (event.detail.originalEvent.type === "focusin" && hasPointerDownOutsideRef.current) event.preventDefault();
|
|
238
|
+
}
|
|
239
|
+
});
|
|
240
|
+
}, "DialogContentNonModal"));
|
|
241
|
+
var DialogContentImpl = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogContentImpl2(props, forwardedRef) {
|
|
242
|
+
const { __scopeDialog, trapFocus, onOpenAutoFocus, onCloseAutoFocus, "aria-describedby": ariaDescribedby, children, ...contentProps } = props;
|
|
243
|
+
const context = useDialogContext(CONTENT_NAME, __scopeDialog);
|
|
244
|
+
useFocusGuards();
|
|
245
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FocusScopeBranchProvider, {
|
|
246
|
+
registry: context.branchRegistry,
|
|
247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(FocusScope, {
|
|
248
|
+
asChild: true,
|
|
249
|
+
loop: true,
|
|
250
|
+
trapped: trapFocus,
|
|
251
|
+
branches: context.branchNodes,
|
|
252
|
+
onMountAutoFocus: onOpenAutoFocus,
|
|
253
|
+
onUnmountAutoFocus: onCloseAutoFocus,
|
|
254
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DismissableLayer, {
|
|
255
|
+
role: "dialog",
|
|
256
|
+
id: context.contentId,
|
|
257
|
+
"aria-labelledby": context.titlePresent ? context.titleId : void 0,
|
|
258
|
+
"aria-describedby": context.descriptionPresent ? concatAriaDescribedby(ariaDescribedby, context.descriptionId) : ariaDescribedby,
|
|
259
|
+
"data-state": getState(context.open),
|
|
260
|
+
...contentProps,
|
|
261
|
+
ref: forwardedRef,
|
|
262
|
+
deferPointerDownOutside: true,
|
|
263
|
+
onDismiss: () => context.onOpenChange(false),
|
|
264
|
+
children
|
|
265
|
+
})
|
|
266
|
+
})
|
|
267
|
+
});
|
|
268
|
+
}, "DialogContentImpl"));
|
|
269
|
+
var DialogTitle = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogTitle2(props, forwardedRef) {
|
|
270
|
+
const { __scopeDialog, ...titleProps } = props;
|
|
271
|
+
const context = useDialogContext("DialogTitle", __scopeDialog);
|
|
272
|
+
const { setTitleCount } = context;
|
|
273
|
+
useLayoutEffect2(() => {
|
|
274
|
+
setTitleCount((count) => count + 1);
|
|
275
|
+
return () => setTitleCount((count) => count - 1);
|
|
276
|
+
}, [setTitleCount]);
|
|
277
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.h2, {
|
|
278
|
+
id: context.titleId,
|
|
279
|
+
...titleProps,
|
|
280
|
+
ref: forwardedRef
|
|
281
|
+
});
|
|
282
|
+
}, "DialogTitle"));
|
|
283
|
+
var DialogDescription = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogDescription2(props, forwardedRef) {
|
|
284
|
+
const { __scopeDialog, ...descriptionProps } = props;
|
|
285
|
+
const context = useDialogContext("DialogDescription", __scopeDialog);
|
|
286
|
+
const { setDescriptionCount } = context;
|
|
287
|
+
useLayoutEffect2(() => {
|
|
288
|
+
setDescriptionCount((count) => count + 1);
|
|
289
|
+
return () => setDescriptionCount((count) => count - 1);
|
|
290
|
+
}, [setDescriptionCount]);
|
|
291
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.p, {
|
|
292
|
+
id: context.descriptionId,
|
|
293
|
+
...descriptionProps,
|
|
294
|
+
ref: forwardedRef
|
|
295
|
+
});
|
|
296
|
+
}, "DialogDescription"));
|
|
297
|
+
var CLOSE_NAME = "DialogClose";
|
|
298
|
+
var DialogClose = /* @__PURE__ */ import_react.forwardRef(/* @__PURE__ */ __name$1(function DialogClose2(props, forwardedRef) {
|
|
299
|
+
const { __scopeDialog, ...closeProps } = props;
|
|
300
|
+
const context = useDialogContext(CLOSE_NAME, __scopeDialog);
|
|
301
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Primitive.button, {
|
|
302
|
+
type: "button",
|
|
303
|
+
...closeProps,
|
|
304
|
+
ref: forwardedRef,
|
|
305
|
+
onClick: composeEventHandlers(props.onClick, () => context.onOpenChange(false))
|
|
306
|
+
});
|
|
307
|
+
}, "DialogClose"));
|
|
308
|
+
function concatAriaDescribedby(...values) {
|
|
309
|
+
const ids = /* @__PURE__ */ new Set();
|
|
310
|
+
for (const value of values) {
|
|
311
|
+
if (typeof value !== "string") continue;
|
|
312
|
+
for (const id of String(value).trim().split(/\s+/)) if (id) ids.add(id);
|
|
313
|
+
}
|
|
314
|
+
return ids.size > 0 ? Array.from(ids).join(" ") : void 0;
|
|
315
|
+
}
|
|
316
|
+
__name$1(concatAriaDescribedby, "concatAriaDescribedby");
|
|
317
|
+
function getState(open) {
|
|
318
|
+
return open ? "open" : "closed";
|
|
319
|
+
}
|
|
320
|
+
__name$1(getState, "getState");
|
|
321
|
+
// ../../node_modules/.bun/@radix-ui+react-alert-dialog@1.2.1+a68cb332b68cb125/node_modules/@radix-ui/react-alert-dialog/dist/index.mjs
|
|
322
|
+
var __defProp = Object.defineProperty;
|
|
323
|
+
var __name = (target, value) => __defProp(target, "name", {
|
|
324
|
+
value,
|
|
325
|
+
configurable: true
|
|
326
|
+
});
|
|
327
|
+
var [createAlertDialogContext, createAlertDialogScope] = createContextScope("AlertDialog", [createDialogScope]);
|
|
328
|
+
var useDialogScope = createDialogScope();
|
|
329
|
+
var AlertDialog$1 = /* @__PURE__ */ __name((props) => {
|
|
330
|
+
const { __scopeAlertDialog, ...alertDialogProps } = props;
|
|
331
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
332
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Dialog, {
|
|
333
|
+
...dialogScope,
|
|
334
|
+
...alertDialogProps,
|
|
335
|
+
modal: true
|
|
336
|
+
});
|
|
337
|
+
}, "AlertDialog");
|
|
338
|
+
import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogTrigger2(props, forwardedRef) {
|
|
339
|
+
const { __scopeAlertDialog, ...triggerProps } = props;
|
|
340
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
341
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTrigger, {
|
|
342
|
+
...dialogScope,
|
|
343
|
+
...triggerProps,
|
|
344
|
+
ref: forwardedRef
|
|
345
|
+
});
|
|
346
|
+
}, "AlertDialogTrigger"));
|
|
347
|
+
var AlertDialogPortal$1 = /* @__PURE__ */ __name((props) => {
|
|
348
|
+
const { __scopeAlertDialog, ...portalProps } = props;
|
|
349
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogPortal, {
|
|
351
|
+
...dialogScope,
|
|
352
|
+
...portalProps
|
|
353
|
+
});
|
|
354
|
+
}, "AlertDialogPortal");
|
|
355
|
+
var AlertDialogOverlay$1 = import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogOverlay2(props, forwardedRef) {
|
|
356
|
+
const { __scopeAlertDialog, ...overlayProps } = props;
|
|
357
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
358
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogOverlay, {
|
|
359
|
+
...dialogScope,
|
|
360
|
+
...overlayProps,
|
|
361
|
+
ref: forwardedRef
|
|
362
|
+
});
|
|
363
|
+
}, "AlertDialogOverlay"));
|
|
364
|
+
var [AlertDialogContentProvider, useAlertDialogContentContext] = createAlertDialogContext("AlertDialogContent");
|
|
365
|
+
var AlertDialogContent$1 = import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogContent2(props, forwardedRef) {
|
|
366
|
+
const { __scopeAlertDialog, children, ...contentProps } = props;
|
|
367
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
368
|
+
const contentRef = import_react.useRef(null);
|
|
369
|
+
const composedRefs = useComposedRefs(forwardedRef, contentRef);
|
|
370
|
+
const cancelRef = import_react.useRef(null);
|
|
371
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContentProvider, {
|
|
372
|
+
scope: __scopeAlertDialog,
|
|
373
|
+
cancelRef,
|
|
374
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogContent, {
|
|
375
|
+
role: "alertdialog",
|
|
376
|
+
...dialogScope,
|
|
377
|
+
...contentProps,
|
|
378
|
+
ref: composedRefs,
|
|
379
|
+
onOpenAutoFocus: composeEventHandlers(contentProps.onOpenAutoFocus, (event) => {
|
|
380
|
+
event.preventDefault();
|
|
381
|
+
cancelRef.current?.focus({ preventScroll: true });
|
|
382
|
+
}),
|
|
383
|
+
onPointerDownOutside: (event) => event.preventDefault(),
|
|
384
|
+
onInteractOutside: (event) => event.preventDefault(),
|
|
385
|
+
children
|
|
386
|
+
})
|
|
387
|
+
});
|
|
388
|
+
}, "AlertDialogContent"));
|
|
389
|
+
var AlertDialogTitle$1 = import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogTitle2(props, forwardedRef) {
|
|
390
|
+
const { __scopeAlertDialog, ...titleProps } = props;
|
|
391
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
392
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogTitle, {
|
|
393
|
+
...dialogScope,
|
|
394
|
+
...titleProps,
|
|
395
|
+
ref: forwardedRef
|
|
396
|
+
});
|
|
397
|
+
}, "AlertDialogTitle"));
|
|
398
|
+
var AlertDialogDescription$1 = import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogDescription2(props, forwardedRef) {
|
|
399
|
+
const { __scopeAlertDialog, ...descriptionProps } = props;
|
|
400
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
401
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogDescription, {
|
|
402
|
+
...dialogScope,
|
|
403
|
+
...descriptionProps,
|
|
404
|
+
ref: forwardedRef
|
|
405
|
+
});
|
|
406
|
+
}, "AlertDialogDescription"));
|
|
407
|
+
var AlertDialogAction$1 = import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogAction2(props, forwardedRef) {
|
|
408
|
+
const { __scopeAlertDialog, ...actionProps } = props;
|
|
409
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
410
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogClose, {
|
|
411
|
+
...dialogScope,
|
|
412
|
+
...actionProps,
|
|
413
|
+
ref: forwardedRef
|
|
414
|
+
});
|
|
415
|
+
}, "AlertDialogAction"));
|
|
416
|
+
var CANCEL_NAME = "AlertDialogCancel";
|
|
417
|
+
var AlertDialogCancel$1 = import_react.forwardRef(/* @__PURE__ */ __name(function AlertDialogCancel2(props, forwardedRef) {
|
|
418
|
+
const { __scopeAlertDialog, ...cancelProps } = props;
|
|
419
|
+
const { cancelRef } = useAlertDialogContentContext(CANCEL_NAME, __scopeAlertDialog);
|
|
420
|
+
const dialogScope = useDialogScope(__scopeAlertDialog);
|
|
421
|
+
const ref = useComposedRefs(forwardedRef, cancelRef);
|
|
422
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DialogClose, {
|
|
423
|
+
...dialogScope,
|
|
424
|
+
...cancelProps,
|
|
425
|
+
ref
|
|
426
|
+
});
|
|
427
|
+
}, "AlertDialogCancel"));
|
|
428
|
+
// app/components/ui/alert-dialog.tsx
|
|
429
|
+
function AlertDialog({ ...props }) {
|
|
430
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog$1, {
|
|
431
|
+
"data-slot": "alert-dialog",
|
|
432
|
+
...props
|
|
433
|
+
});
|
|
434
|
+
}
|
|
435
|
+
function AlertDialogPortal({ ...props }) {
|
|
436
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogPortal$1, {
|
|
437
|
+
"data-slot": "alert-dialog-portal",
|
|
438
|
+
...props
|
|
439
|
+
});
|
|
440
|
+
}
|
|
441
|
+
function AlertDialogOverlay({ className, ...props }) {
|
|
442
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogOverlay$1, {
|
|
443
|
+
"data-slot": "alert-dialog-overlay",
|
|
444
|
+
className: cn("data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50", className),
|
|
445
|
+
...props
|
|
446
|
+
});
|
|
447
|
+
}
|
|
448
|
+
function AlertDialogContent({ className, onSubmit, ...props }) {
|
|
449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogPortal, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogOverlay, {}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogContent$1, {
|
|
450
|
+
"data-slot": "alert-dialog-content",
|
|
451
|
+
className: cn("bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 sm:max-w-lg", className),
|
|
452
|
+
/**
|
|
453
|
+
* Radix AlertDialog renders an internal <form method="dialog">.
|
|
454
|
+
* Outside of a native <dialog> element, the browser treats this as
|
|
455
|
+
* a POST to the current URL — which React Router interprets as a
|
|
456
|
+
* route action. Prevent the default form submission to avoid this.
|
|
457
|
+
*/
|
|
458
|
+
onSubmit: (e) => {
|
|
459
|
+
e.preventDefault();
|
|
460
|
+
onSubmit?.(e);
|
|
461
|
+
},
|
|
462
|
+
...props
|
|
463
|
+
})] });
|
|
464
|
+
}
|
|
465
|
+
function AlertDialogHeader({ className, ...props }) {
|
|
466
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
467
|
+
"data-slot": "alert-dialog-header",
|
|
468
|
+
className: cn("flex flex-col gap-2 text-center sm:text-left", className),
|
|
469
|
+
...props
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
function AlertDialogFooter({ className, ...props }) {
|
|
473
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
474
|
+
"data-slot": "alert-dialog-footer",
|
|
475
|
+
className: cn("flex flex-col-reverse gap-2 sm:flex-row sm:justify-end", className),
|
|
476
|
+
...props
|
|
477
|
+
});
|
|
478
|
+
}
|
|
479
|
+
function AlertDialogTitle({ className, ...props }) {
|
|
480
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle$1, {
|
|
481
|
+
"data-slot": "alert-dialog-title",
|
|
482
|
+
className: cn("text-lg font-semibold", className),
|
|
483
|
+
...props
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
function AlertDialogDescription({ className, ...props }) {
|
|
487
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription$1, {
|
|
488
|
+
"data-slot": "alert-dialog-description",
|
|
489
|
+
className: cn("text-muted-foreground text-sm", className),
|
|
490
|
+
...props
|
|
491
|
+
});
|
|
492
|
+
}
|
|
493
|
+
function AlertDialogAction({ className, ...props }) {
|
|
494
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction$1, {
|
|
495
|
+
className: cn(buttonVariants(), className),
|
|
496
|
+
...props
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function AlertDialogCancel({ className, ...props }) {
|
|
500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel$1, {
|
|
501
|
+
className: cn(buttonVariants({ variant: "secondary" }), className),
|
|
502
|
+
...props
|
|
503
|
+
});
|
|
504
|
+
}
|
|
505
|
+
// app/components/ui/breadcrumb.tsx
|
|
506
|
+
function Breadcrumb({ ...props }) {
|
|
507
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", {
|
|
508
|
+
"aria-label": "breadcrumb",
|
|
509
|
+
"data-slot": "breadcrumb",
|
|
510
|
+
...props
|
|
511
|
+
});
|
|
512
|
+
}
|
|
513
|
+
function BreadcrumbList({ className, ...props }) {
|
|
514
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", {
|
|
515
|
+
"data-slot": "breadcrumb-list",
|
|
516
|
+
className: cn("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5", className),
|
|
517
|
+
...props
|
|
518
|
+
});
|
|
519
|
+
}
|
|
520
|
+
function BreadcrumbItem({ className, ...props }) {
|
|
521
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
|
|
522
|
+
"data-slot": "breadcrumb-item",
|
|
523
|
+
className: cn("inline-flex items-center gap-1.5", className),
|
|
524
|
+
...props
|
|
525
|
+
});
|
|
526
|
+
}
|
|
527
|
+
function BreadcrumbLink({ asChild, className, ...props }) {
|
|
528
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(asChild ? Slot$1 : "a", {
|
|
529
|
+
"data-slot": "breadcrumb-link",
|
|
530
|
+
className: cn("hover:text-foreground transition-colors", className),
|
|
531
|
+
...props
|
|
532
|
+
});
|
|
533
|
+
}
|
|
534
|
+
function BreadcrumbPage({ className, ...props }) {
|
|
535
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
536
|
+
"data-slot": "breadcrumb-page",
|
|
537
|
+
role: "link",
|
|
538
|
+
"aria-disabled": "true",
|
|
539
|
+
"aria-current": "page",
|
|
540
|
+
className: cn("text-foreground font-normal", className),
|
|
541
|
+
...props
|
|
542
|
+
});
|
|
543
|
+
}
|
|
544
|
+
function BreadcrumbSeparator({ children, className, ...props }) {
|
|
545
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("li", {
|
|
546
|
+
"data-slot": "breadcrumb-separator",
|
|
547
|
+
role: "presentation",
|
|
548
|
+
"aria-hidden": "true",
|
|
549
|
+
className: cn("[&>svg]:size-3.5", className),
|
|
550
|
+
...props,
|
|
551
|
+
children: children ?? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ChevronRight, {})
|
|
552
|
+
});
|
|
553
|
+
}
|
|
554
|
+
// app/lib/cancellation-reason.ts
|
|
555
|
+
/** Returns the most recent non-empty reason recorded on a run cancellation. */
|
|
556
|
+
function getCancellationReason(events) {
|
|
557
|
+
if (!events) return void 0;
|
|
558
|
+
for (let index = events.length - 1; index >= 0; index -= 1) {
|
|
559
|
+
const event = events[index];
|
|
560
|
+
if (event.eventType !== "run_cancelled") continue;
|
|
561
|
+
const reason = event.eventData?.cancelReason?.trim();
|
|
562
|
+
if (reason) return reason;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
// app/lib/client/hooks/use-cancellation-reason.ts
|
|
566
|
+
/**
|
|
567
|
+
* Reads the cancellation reason from loaded trace events, falling back to the
|
|
568
|
+
* terminal event for long runs whose initial trace page does not include it.
|
|
569
|
+
*/
|
|
570
|
+
function useCancellationReason(runId, status, events) {
|
|
571
|
+
const loadedReason = (0, import_react.useMemo)(() => getCancellationReason(events), [events]);
|
|
572
|
+
const [terminalReason, setTerminalReason] = (0, import_react.useState)();
|
|
573
|
+
(0, import_react.useEffect)(() => {
|
|
574
|
+
setTerminalReason(void 0);
|
|
575
|
+
if (status !== "cancelled" || loadedReason) return;
|
|
576
|
+
let ignore = false;
|
|
577
|
+
unwrapServerActionResult(rpc("fetchEvents", {
|
|
578
|
+
runId,
|
|
579
|
+
sortOrder: "desc",
|
|
580
|
+
limit: 1,
|
|
581
|
+
withData: false
|
|
582
|
+
})).then(({ error, result }) => {
|
|
583
|
+
if (!ignore && !error) setTerminalReason(getCancellationReason(result.data));
|
|
584
|
+
});
|
|
585
|
+
return () => {
|
|
586
|
+
ignore = true;
|
|
587
|
+
};
|
|
588
|
+
}, [
|
|
589
|
+
runId,
|
|
590
|
+
status,
|
|
591
|
+
loadedReason
|
|
592
|
+
]);
|
|
593
|
+
return loadedReason ?? terminalReason;
|
|
594
|
+
}
|
|
595
|
+
// app/lib/client/hooks/use-events-list-data.ts
|
|
596
|
+
var INITIAL_PAGE_SIZE$1 = 100;
|
|
597
|
+
var LOAD_MORE_PAGE_SIZE$1 = 100;
|
|
598
|
+
/**
|
|
599
|
+
* Max pages when fetching correlation ID search results (100 events/page).
|
|
600
|
+
*
|
|
601
|
+
* Kept low: the world filters server-side, so a page can cost considerably
|
|
602
|
+
* more to produce than it returns.
|
|
603
|
+
*/
|
|
604
|
+
var MAX_CORRELATION_SEARCH_PAGES = 5;
|
|
605
|
+
/**
|
|
606
|
+
* Independent event fetching for the Events tab.
|
|
607
|
+
* Separate from the trace viewer's events so sort order changes
|
|
608
|
+
* don't affect the trace viewer.
|
|
609
|
+
*/
|
|
610
|
+
function useEventsListData(runId, options = {}) {
|
|
611
|
+
const { sortOrder = "asc", encryptionKey, enabled = true } = options;
|
|
612
|
+
const [events, setEvents] = (0, import_react.useState)([]);
|
|
613
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
614
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
615
|
+
const [cursor, setCursor] = (0, import_react.useState)();
|
|
616
|
+
const [hasMore, setHasMore] = (0, import_react.useState)(false);
|
|
617
|
+
const [loadingMore, setLoadingMore] = (0, import_react.useState)(false);
|
|
618
|
+
const isFetchingRef = (0, import_react.useRef)(false);
|
|
619
|
+
const encryptionKeyRef = (0, import_react.useRef)(encryptionKey);
|
|
620
|
+
encryptionKeyRef.current = encryptionKey;
|
|
621
|
+
const hydrateEvents = (0, import_react.useCallback)(async (rawEvents) => {
|
|
622
|
+
const key = encryptionKeyRef.current;
|
|
623
|
+
return Promise.all(rawEvents.map((ev) => hydrateResourceIOAsync(ev, key)));
|
|
624
|
+
}, []);
|
|
625
|
+
const fetchInitial = (0, import_react.useCallback)(async () => {
|
|
626
|
+
if (isFetchingRef.current) return;
|
|
627
|
+
isFetchingRef.current = true;
|
|
628
|
+
setLoading(true);
|
|
629
|
+
setError(null);
|
|
630
|
+
setEvents([]);
|
|
631
|
+
setCursor(void 0);
|
|
632
|
+
setHasMore(false);
|
|
633
|
+
try {
|
|
634
|
+
const { error: fetchError, result } = await unwrapServerActionResult(rpc("fetchEvents", {
|
|
635
|
+
runId,
|
|
636
|
+
sortOrder,
|
|
637
|
+
limit: INITIAL_PAGE_SIZE$1,
|
|
638
|
+
withData: false
|
|
639
|
+
}));
|
|
640
|
+
if (fetchError) setError(fetchError);
|
|
641
|
+
else {
|
|
642
|
+
setEvents(await hydrateEvents(result.data));
|
|
643
|
+
setCursor(result.hasMore ? result.cursor : void 0);
|
|
644
|
+
setHasMore(Boolean(result.hasMore));
|
|
645
|
+
}
|
|
646
|
+
} catch (err) {
|
|
647
|
+
setError(err);
|
|
648
|
+
} finally {
|
|
649
|
+
setLoading(false);
|
|
650
|
+
isFetchingRef.current = false;
|
|
651
|
+
}
|
|
652
|
+
}, [
|
|
653
|
+
runId,
|
|
654
|
+
sortOrder,
|
|
655
|
+
hydrateEvents
|
|
656
|
+
]);
|
|
657
|
+
(0, import_react.useEffect)(() => {
|
|
658
|
+
if (enabled) fetchInitial();
|
|
659
|
+
}, [fetchInitial, enabled]);
|
|
660
|
+
(0, import_react.useEffect)(() => {
|
|
661
|
+
if (!encryptionKey || events.length === 0) return;
|
|
662
|
+
let cancelled = false;
|
|
663
|
+
Promise.all(events.map((ev) => hydrateResourceIOAsync(ev, encryptionKey))).then((decrypted) => {
|
|
664
|
+
if (!cancelled) setEvents(decrypted);
|
|
665
|
+
}).catch(() => {});
|
|
666
|
+
return () => {
|
|
667
|
+
cancelled = true;
|
|
668
|
+
};
|
|
669
|
+
}, [encryptionKey]);
|
|
670
|
+
return {
|
|
671
|
+
events,
|
|
672
|
+
loading,
|
|
673
|
+
error,
|
|
674
|
+
hasMore,
|
|
675
|
+
loadingMore,
|
|
676
|
+
loadMore: (0, import_react.useCallback)(async () => {
|
|
677
|
+
if (loadingMore || !cursor) return;
|
|
678
|
+
setLoadingMore(true);
|
|
679
|
+
try {
|
|
680
|
+
const { error: fetchError, result } = await unwrapServerActionResult(rpc("fetchEvents", {
|
|
681
|
+
runId,
|
|
682
|
+
cursor,
|
|
683
|
+
sortOrder,
|
|
684
|
+
limit: LOAD_MORE_PAGE_SIZE$1,
|
|
685
|
+
withData: false
|
|
686
|
+
}));
|
|
687
|
+
if (fetchError) setError(fetchError);
|
|
688
|
+
else {
|
|
689
|
+
if (result.data.length > 0) {
|
|
690
|
+
const hydrated = await hydrateEvents(result.data);
|
|
691
|
+
setEvents((prev) => [...prev, ...hydrated]);
|
|
692
|
+
}
|
|
693
|
+
setCursor(result.hasMore ? result.cursor : void 0);
|
|
694
|
+
setHasMore(Boolean(result.hasMore));
|
|
695
|
+
}
|
|
696
|
+
} catch (err) {
|
|
697
|
+
setError(err);
|
|
698
|
+
} finally {
|
|
699
|
+
setLoadingMore(false);
|
|
700
|
+
}
|
|
701
|
+
}, [
|
|
702
|
+
runId,
|
|
703
|
+
sortOrder,
|
|
704
|
+
cursor,
|
|
705
|
+
loadingMore,
|
|
706
|
+
hydrateEvents
|
|
707
|
+
]),
|
|
708
|
+
searchByExactId: (0, import_react.useCallback)(async (id, kind, signal) => {
|
|
709
|
+
if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
710
|
+
if (kind === "event") {
|
|
711
|
+
const { error: fetchError, result } = await unwrapServerActionResult(rpc("fetchEvent", {
|
|
712
|
+
runId,
|
|
713
|
+
eventId: id,
|
|
714
|
+
resolveData: "none"
|
|
715
|
+
}));
|
|
716
|
+
if (fetchError || signal?.aborted) return fetchError ? {
|
|
717
|
+
status: "error",
|
|
718
|
+
message: fetchError.message
|
|
719
|
+
} : (() => {
|
|
720
|
+
throw new DOMException("Aborted", "AbortError");
|
|
721
|
+
})();
|
|
722
|
+
const [event] = await hydrateEvents([result]);
|
|
723
|
+
return event?.runId === runId ? {
|
|
724
|
+
status: "ok",
|
|
725
|
+
events: [event]
|
|
726
|
+
} : { status: "not_found" };
|
|
727
|
+
}
|
|
728
|
+
const matched = [];
|
|
729
|
+
let nextCursor;
|
|
730
|
+
let pagesFetched = 0;
|
|
731
|
+
let truncated = false;
|
|
732
|
+
do {
|
|
733
|
+
if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
734
|
+
const { error: fetchError, result } = await unwrapServerActionResult(rpc("fetchEventsByCorrelationId", {
|
|
735
|
+
correlationId: id,
|
|
736
|
+
cursor: nextCursor,
|
|
737
|
+
sortOrder,
|
|
738
|
+
limit: 100,
|
|
739
|
+
withData: false,
|
|
740
|
+
runId
|
|
741
|
+
}));
|
|
742
|
+
if (fetchError) return {
|
|
743
|
+
status: "error",
|
|
744
|
+
message: fetchError.message
|
|
745
|
+
};
|
|
746
|
+
if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
747
|
+
pagesFetched += 1;
|
|
748
|
+
const hydrated = await hydrateEvents(result.data);
|
|
749
|
+
matched.push(...hydrated.filter((event) => event.runId === runId));
|
|
750
|
+
const hitPageCap = pagesFetched >= MAX_CORRELATION_SEARCH_PAGES;
|
|
751
|
+
truncated = truncated || hitPageCap && Boolean(result.hasMore && result.cursor);
|
|
752
|
+
nextCursor = !hitPageCap && result.hasMore && result.cursor ? result.cursor : void 0;
|
|
753
|
+
} while (nextCursor);
|
|
754
|
+
return matched.length > 0 ? {
|
|
755
|
+
status: "ok",
|
|
756
|
+
events: matched,
|
|
757
|
+
truncated: truncated || void 0
|
|
758
|
+
} : { status: "not_found" };
|
|
759
|
+
}, [
|
|
760
|
+
runId,
|
|
761
|
+
sortOrder,
|
|
762
|
+
hydrateEvents
|
|
763
|
+
])
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
// app/lib/client/workflow-streams.ts
|
|
767
|
+
function isServerActionError(value) {
|
|
768
|
+
return typeof value === "object" && value !== null && "message" in value && "layer" in value;
|
|
769
|
+
}
|
|
770
|
+
async function readStream(streamId, runId, signal, cursor) {
|
|
771
|
+
try {
|
|
772
|
+
const params = new URLSearchParams({ runId });
|
|
773
|
+
if (cursor) params.set("cursor", cursor);
|
|
774
|
+
const url = `/workflows/${API_PATHS.stream}${encodeURIComponent(streamId)}?${params.toString()}`;
|
|
775
|
+
const response = await fetch(url, { signal });
|
|
776
|
+
if (!response.ok) {
|
|
777
|
+
const errorData = await response.json().catch(() => null);
|
|
778
|
+
if (errorData && isServerActionError(errorData)) throw new WorkflowWebAPIError(errorData.message, {
|
|
779
|
+
layer: "client",
|
|
780
|
+
cause: errorData.cause,
|
|
781
|
+
request: errorData.request
|
|
782
|
+
});
|
|
783
|
+
throw new WorkflowWebAPIError(`Failed to read stream: ${response.status}`, { layer: "client" });
|
|
784
|
+
}
|
|
785
|
+
if (!response.body) throw new WorkflowWebAPIError("Failed to read stream: no body", { layer: "client" });
|
|
786
|
+
const responseCursor = response.headers.get(STREAM_CURSOR_HEADER);
|
|
787
|
+
const streamDone = response.headers.get(STREAM_DONE_HEADER) === "true";
|
|
788
|
+
return {
|
|
789
|
+
body: response.body,
|
|
790
|
+
cursor: responseCursor,
|
|
791
|
+
done: streamDone
|
|
792
|
+
};
|
|
793
|
+
} catch (error) {
|
|
794
|
+
if (error instanceof WorkflowWebAPIError) throw error;
|
|
795
|
+
throw new WorkflowWebAPIError("Failed to read stream", {
|
|
796
|
+
layer: "client",
|
|
797
|
+
cause: error
|
|
798
|
+
});
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
/** List all stream IDs for a run */
|
|
802
|
+
async function listStreams(runId) {
|
|
803
|
+
return unwrapOrThrow(rpc("fetchStreams", { runId }));
|
|
804
|
+
}
|
|
805
|
+
// app/lib/hooks/use-stream-reader.ts
|
|
806
|
+
var FRAME_HEADER_SIZE = 4;
|
|
807
|
+
var ENCRYPTED_PLACEHOLDER = "[Encrypted]";
|
|
808
|
+
var POLL_INTERVAL_MS = 3e3;
|
|
809
|
+
function isRunActive(status) {
|
|
810
|
+
return status === "pending" || status === "running";
|
|
811
|
+
}
|
|
812
|
+
var yieldToMain = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
813
|
+
var YIELD_EVERY_N_FRAMES = 64;
|
|
814
|
+
function detectEncoding(data) {
|
|
815
|
+
if (data.length < FRAME_HEADER_SIZE) return "framed";
|
|
816
|
+
const len = new DataView(data.buffer, data.byteOffset, data.byteLength).getUint32(0, false);
|
|
817
|
+
if (len > 0 && len <= 10485760) return "framed";
|
|
818
|
+
return "legacy";
|
|
819
|
+
}
|
|
820
|
+
function useStreamReader(streamId, runId, encryptionKey, runStatus) {
|
|
821
|
+
const [chunks, setChunks] = (0, import_react.useState)([]);
|
|
822
|
+
const [isLive, setIsLive] = (0, import_react.useState)(false);
|
|
823
|
+
const [isInitialLoading, setIsInitialLoading] = (0, import_react.useState)(Boolean(streamId && runId));
|
|
824
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
825
|
+
const abortControllerRef = (0, import_react.useRef)(null);
|
|
826
|
+
const chunkIdRef = (0, import_react.useRef)(0);
|
|
827
|
+
const pollTimerRef = (0, import_react.useRef)(null);
|
|
828
|
+
const runStatusRef = (0, import_react.useRef)(runStatus);
|
|
829
|
+
runStatusRef.current = runStatus;
|
|
830
|
+
const serverCursorRef = (0, import_react.useRef)(null);
|
|
831
|
+
const processFrame = (0, import_react.useCallback)(async (rawFrame, cryptoKey, revivers) => {
|
|
832
|
+
let frameData = rawFrame;
|
|
833
|
+
if (frameData.length >= 8 && !isEncryptedData(frameData)) {
|
|
834
|
+
const innerLen = new DataView(frameData.buffer, frameData.byteOffset, frameData.byteLength).getUint32(0, false);
|
|
835
|
+
if (innerLen > 0 && innerLen <= 10485760 && innerLen === frameData.length - FRAME_HEADER_SIZE) frameData = frameData.slice(FRAME_HEADER_SIZE);
|
|
836
|
+
}
|
|
837
|
+
let hydrated;
|
|
838
|
+
try {
|
|
839
|
+
if (isEncryptedData(frameData)) {
|
|
840
|
+
if (!cryptoKey) return { encrypted: true };
|
|
841
|
+
hydrated = hydrateData(await decrypt(frameData, cryptoKey), revivers);
|
|
842
|
+
} else hydrated = hydrateData(frameData, revivers);
|
|
843
|
+
} catch {
|
|
844
|
+
hydrated = ENCRYPTED_PLACEHOLDER;
|
|
845
|
+
}
|
|
846
|
+
return {
|
|
847
|
+
encrypted: false,
|
|
848
|
+
chunk: {
|
|
849
|
+
id: chunkIdRef.current++,
|
|
850
|
+
value: hydrated
|
|
851
|
+
}
|
|
852
|
+
};
|
|
853
|
+
}, []);
|
|
854
|
+
(0, import_react.useEffect)(() => {
|
|
855
|
+
setChunks([]);
|
|
856
|
+
setError(null);
|
|
857
|
+
setIsLive(false);
|
|
858
|
+
setIsInitialLoading(Boolean(streamId && runId));
|
|
859
|
+
chunkIdRef.current = 0;
|
|
860
|
+
serverCursorRef.current = null;
|
|
861
|
+
if (pollTimerRef.current) {
|
|
862
|
+
clearTimeout(pollTimerRef.current);
|
|
863
|
+
pollTimerRef.current = null;
|
|
864
|
+
}
|
|
865
|
+
if (!streamId || !runId) {
|
|
866
|
+
setIsInitialLoading(false);
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
let mounted = true;
|
|
870
|
+
const abortController = new AbortController();
|
|
871
|
+
abortControllerRef.current = abortController;
|
|
872
|
+
const revivers = getWebRevivers();
|
|
873
|
+
const parseLegacyLine = (line) => {
|
|
874
|
+
const chunkId = chunkIdRef.current++;
|
|
875
|
+
let value;
|
|
876
|
+
try {
|
|
877
|
+
value = JSON.parse(line);
|
|
878
|
+
} catch {
|
|
879
|
+
value = line;
|
|
880
|
+
}
|
|
881
|
+
return {
|
|
882
|
+
id: chunkId,
|
|
883
|
+
value
|
|
884
|
+
};
|
|
885
|
+
};
|
|
886
|
+
/**
|
|
887
|
+
* Fetch stream data and parse frames.
|
|
888
|
+
*
|
|
889
|
+
* When `cursor` is provided, the server only returns chunks written after
|
|
890
|
+
* the response that gave it (incremental fetch).
|
|
891
|
+
*/
|
|
892
|
+
const fetchAndParse = async (targetBuffer, cryptoKey, cursor) => {
|
|
893
|
+
const streamResponse = await readStream(streamId, runId, abortController.signal, cursor);
|
|
894
|
+
const reader = streamResponse.body.getReader();
|
|
895
|
+
const decoder = new TextDecoder();
|
|
896
|
+
let buffer = /* @__PURE__ */ new Uint8Array(0);
|
|
897
|
+
let encoding = null;
|
|
898
|
+
let textRemainder = "";
|
|
899
|
+
const appendToBuffer = (data) => {
|
|
900
|
+
const newBuffer = new Uint8Array(buffer.length + data.length);
|
|
901
|
+
newBuffer.set(buffer, 0);
|
|
902
|
+
newBuffer.set(data, buffer.length);
|
|
903
|
+
buffer = newBuffer;
|
|
904
|
+
};
|
|
905
|
+
for (;;) {
|
|
906
|
+
if (abortController.signal.aborted) break;
|
|
907
|
+
const { value, done } = await reader.read();
|
|
908
|
+
if (done) {
|
|
909
|
+
if (encoding === "legacy" && textRemainder.trim()) {
|
|
910
|
+
targetBuffer.push(parseLegacyLine(textRemainder.trim()));
|
|
911
|
+
textRemainder = "";
|
|
912
|
+
}
|
|
913
|
+
break;
|
|
914
|
+
}
|
|
915
|
+
if (encoding === null) {
|
|
916
|
+
appendToBuffer(value);
|
|
917
|
+
if (buffer.length >= FRAME_HEADER_SIZE) encoding = detectEncoding(buffer);
|
|
918
|
+
if (encoding === "legacy") {
|
|
919
|
+
textRemainder = decoder.decode(buffer, { stream: true });
|
|
920
|
+
buffer = /* @__PURE__ */ new Uint8Array(0);
|
|
921
|
+
}
|
|
922
|
+
} else if (encoding === "legacy") textRemainder += decoder.decode(value, { stream: true });
|
|
923
|
+
else appendToBuffer(value);
|
|
924
|
+
if (encoding === "legacy") {
|
|
925
|
+
const lines = textRemainder.split("\n");
|
|
926
|
+
textRemainder = lines.pop() ?? "";
|
|
927
|
+
for (const line of lines) {
|
|
928
|
+
const trimmed = line.trim();
|
|
929
|
+
if (trimmed) targetBuffer.push(parseLegacyLine(trimmed));
|
|
930
|
+
}
|
|
931
|
+
continue;
|
|
932
|
+
}
|
|
933
|
+
let offset = 0;
|
|
934
|
+
let framesInBatch = 0;
|
|
935
|
+
while (offset + FRAME_HEADER_SIZE <= buffer.length) {
|
|
936
|
+
const frameLength = new DataView(buffer.buffer, buffer.byteOffset + offset, buffer.byteLength - offset).getUint32(0, false);
|
|
937
|
+
if (frameLength === 0 || frameLength > 10485760) break;
|
|
938
|
+
if (offset + FRAME_HEADER_SIZE + frameLength > buffer.length) break;
|
|
939
|
+
const frameData = buffer.slice(offset + FRAME_HEADER_SIZE, offset + FRAME_HEADER_SIZE + frameLength);
|
|
940
|
+
offset += FRAME_HEADER_SIZE + frameLength;
|
|
941
|
+
const result = await processFrame(frameData, cryptoKey, revivers);
|
|
942
|
+
if (result.encrypted) {
|
|
943
|
+
reader.cancel().catch(() => {});
|
|
944
|
+
return { encrypted: true };
|
|
945
|
+
}
|
|
946
|
+
targetBuffer.push(result.chunk);
|
|
947
|
+
framesInBatch++;
|
|
948
|
+
if (framesInBatch % YIELD_EVERY_N_FRAMES === 0) {
|
|
949
|
+
await yieldToMain();
|
|
950
|
+
if (abortController.signal.aborted || !mounted) break;
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
buffer = buffer.slice(offset);
|
|
954
|
+
}
|
|
955
|
+
return {
|
|
956
|
+
encrypted: false,
|
|
957
|
+
cursor: streamResponse.cursor,
|
|
958
|
+
done: streamResponse.done
|
|
959
|
+
};
|
|
960
|
+
};
|
|
961
|
+
const readStreamData = async () => {
|
|
962
|
+
try {
|
|
963
|
+
const cryptoKey = encryptionKey ? await deriveRunPayloadKeys(encryptionKey) : void 0;
|
|
964
|
+
const initialChunks = [];
|
|
965
|
+
const result = await fetchAndParse(initialChunks, cryptoKey);
|
|
966
|
+
if (result.encrypted) {
|
|
967
|
+
if (mounted) {
|
|
968
|
+
setError("This stream is encrypted. Click Decrypt to view.");
|
|
969
|
+
setIsLive(false);
|
|
970
|
+
setIsInitialLoading(false);
|
|
971
|
+
}
|
|
972
|
+
return;
|
|
973
|
+
}
|
|
974
|
+
serverCursorRef.current = result.cursor;
|
|
975
|
+
if (!mounted || abortController.signal.aborted) return;
|
|
976
|
+
setChunks(initialChunks);
|
|
977
|
+
setIsInitialLoading(false);
|
|
978
|
+
if (result.done) {
|
|
979
|
+
setIsLive(false);
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
if (isRunActive(runStatusRef.current)) {
|
|
983
|
+
setIsLive(true);
|
|
984
|
+
const poll = async () => {
|
|
985
|
+
if (!mounted || abortController.signal.aborted) return;
|
|
986
|
+
try {
|
|
987
|
+
const newChunks = [];
|
|
988
|
+
const pollResult = await fetchAndParse(newChunks, cryptoKey, serverCursorRef.current);
|
|
989
|
+
if (!pollResult.encrypted) {
|
|
990
|
+
if (pollResult.cursor) serverCursorRef.current = pollResult.cursor;
|
|
991
|
+
if (newChunks.length > 0 && mounted) setChunks((prev) => [...prev, ...newChunks]);
|
|
992
|
+
if (pollResult.done) {
|
|
993
|
+
setIsLive(false);
|
|
994
|
+
return;
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
} catch (err) {
|
|
998
|
+
console.warn("Stream poll error:", err);
|
|
999
|
+
}
|
|
1000
|
+
if (mounted && !abortController.signal.aborted) pollTimerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1001
|
+
};
|
|
1002
|
+
pollTimerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
1003
|
+
} else setIsLive(false);
|
|
1004
|
+
} catch (err) {
|
|
1005
|
+
if (abortController.signal.aborted) return;
|
|
1006
|
+
if (mounted) {
|
|
1007
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
1008
|
+
setIsLive(false);
|
|
1009
|
+
setIsInitialLoading(false);
|
|
1010
|
+
}
|
|
1011
|
+
}
|
|
1012
|
+
};
|
|
1013
|
+
readStreamData();
|
|
1014
|
+
return () => {
|
|
1015
|
+
mounted = false;
|
|
1016
|
+
abortController.abort();
|
|
1017
|
+
if (pollTimerRef.current) {
|
|
1018
|
+
clearTimeout(pollTimerRef.current);
|
|
1019
|
+
pollTimerRef.current = null;
|
|
1020
|
+
}
|
|
1021
|
+
};
|
|
1022
|
+
}, [
|
|
1023
|
+
streamId,
|
|
1024
|
+
runId,
|
|
1025
|
+
encryptionKey,
|
|
1026
|
+
processFrame
|
|
1027
|
+
]);
|
|
1028
|
+
(0, import_react.useEffect)(() => {
|
|
1029
|
+
if (!isRunActive(runStatus) && pollTimerRef.current) {
|
|
1030
|
+
clearTimeout(pollTimerRef.current);
|
|
1031
|
+
pollTimerRef.current = null;
|
|
1032
|
+
setIsLive(false);
|
|
1033
|
+
}
|
|
1034
|
+
}, [runStatus]);
|
|
1035
|
+
return {
|
|
1036
|
+
chunks,
|
|
1037
|
+
isLive,
|
|
1038
|
+
isInitialLoading,
|
|
1039
|
+
error
|
|
1040
|
+
};
|
|
1041
|
+
}
|
|
1042
|
+
// app/components/display-utils/live-status.tsx
|
|
1043
|
+
function LiveStatus({ hasError, errorMessage }) {
|
|
1044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1045
|
+
className: "flex items-center gap-2",
|
|
1046
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
1047
|
+
asChild: true,
|
|
1048
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1049
|
+
className: "flex items-center gap-1.5",
|
|
1050
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: `w-2 h-2 rounded-full ${hasError ? "bg-red-500" : "bg-green-500 animate-pulse"}` }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
|
|
1051
|
+
className: `text-xs ${hasError ? "text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
1052
|
+
children: hasError ? "Error" : "Live"
|
|
1053
|
+
})]
|
|
1054
|
+
})
|
|
1055
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: hasError ? `Error updating data: ${errorMessage}` : `Content updates every ${LIVE_UPDATE_INTERVAL_MS$1 / 1e3} seconds` }) })] })
|
|
1056
|
+
});
|
|
1057
|
+
}
|
|
1058
|
+
// app/lib/client/hooks/use-resource-data.ts
|
|
1059
|
+
async function fetchResourceWithCorrelationId(resource, resourceId, options = {}) {
|
|
1060
|
+
const resolveData = options.resolveData ?? "all";
|
|
1061
|
+
let resourceData;
|
|
1062
|
+
let correlationId;
|
|
1063
|
+
if (resource === "run") {
|
|
1064
|
+
resourceData = await unwrapOrThrow(rpc("fetchRun", {
|
|
1065
|
+
runId: resourceId,
|
|
1066
|
+
resolveData
|
|
1067
|
+
}));
|
|
1068
|
+
correlationId = resourceData.runId;
|
|
1069
|
+
} else if (resource === "step") {
|
|
1070
|
+
const { runId } = options;
|
|
1071
|
+
if (!runId) throw new WorkflowWebAPIError("runId is required for step resource", { layer: "client" });
|
|
1072
|
+
resourceData = await unwrapOrThrow(rpc("fetchStep", {
|
|
1073
|
+
runId,
|
|
1074
|
+
stepId: resourceId,
|
|
1075
|
+
resolveData
|
|
1076
|
+
}));
|
|
1077
|
+
correlationId = resourceData.stepId;
|
|
1078
|
+
} else if (resource === "hook") {
|
|
1079
|
+
resourceData = await unwrapOrThrow(rpc("fetchHook", {
|
|
1080
|
+
hookId: resourceId,
|
|
1081
|
+
resolveData
|
|
1082
|
+
}));
|
|
1083
|
+
correlationId = resourceData.hookId;
|
|
1084
|
+
} else throw new WorkflowWebAPIError(`Unknown resource type: ${resource}`, { layer: "client" });
|
|
1085
|
+
return {
|
|
1086
|
+
data: resourceData,
|
|
1087
|
+
correlationId
|
|
1088
|
+
};
|
|
1089
|
+
}
|
|
1090
|
+
async function fetchSpanDetailResource(selection, options = {}) {
|
|
1091
|
+
const { resource, resourceId, runId } = selection;
|
|
1092
|
+
const { encryptionKey } = options;
|
|
1093
|
+
const hydrate = async (value) => hydrateResourceIOAsync(value, encryptionKey);
|
|
1094
|
+
if (resource === "hook") return hydrate(await unwrapOrThrow(rpc("fetchHook", {
|
|
1095
|
+
hookId: resourceId,
|
|
1096
|
+
resolveData: "all"
|
|
1097
|
+
})));
|
|
1098
|
+
if (resource === "sleep") {
|
|
1099
|
+
if (!runId) throw new WorkflowWebAPIError("runId is required for loading sleep details", { layer: "client" });
|
|
1100
|
+
const result = await unwrapOrThrow(rpc("fetchEvents", {
|
|
1101
|
+
runId,
|
|
1102
|
+
sortOrder: "asc",
|
|
1103
|
+
limit: 1e3,
|
|
1104
|
+
withData: true
|
|
1105
|
+
}));
|
|
1106
|
+
const waitEvents = await Promise.all(result.data.filter((e) => e.correlationId === resourceId).map(hydrate));
|
|
1107
|
+
const data = waitEventsToWaitEntity(waitEvents);
|
|
1108
|
+
if (data === null) throw new WorkflowWebAPIError(`Failed to load ${resource} details: missing required event data`, { layer: "client" });
|
|
1109
|
+
return data;
|
|
1110
|
+
}
|
|
1111
|
+
const { data } = await fetchResourceWithCorrelationId(resource, resourceId, { runId });
|
|
1112
|
+
return hydrate(data);
|
|
1113
|
+
}
|
|
1114
|
+
// app/lib/client/workflow-primitives.ts
|
|
1115
|
+
/**
|
|
1116
|
+
* Merges two arrays by a unique ID key, with later items overriding earlier ones.
|
|
1117
|
+
*/
|
|
1118
|
+
function mergeById(prev, next, idKey) {
|
|
1119
|
+
const combined = [...prev, ...next];
|
|
1120
|
+
const uniqueById = new Map(combined.map((item) => [item[idKey], item]));
|
|
1121
|
+
return Array.from(uniqueById.values());
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Polls a paginated resource for new items, merging them into existing state.
|
|
1125
|
+
* Returns true if new items were found.
|
|
1126
|
+
*
|
|
1127
|
+
* @param cursorStrategy - 'always': advance cursor whenever one is returned.
|
|
1128
|
+
* 'onHasMore': only advance when hasMore is true (re-fetches existing items to catch status updates).
|
|
1129
|
+
* @param transform - Optional transform applied to each new item before merging (e.g. hydrateResourceIO).
|
|
1130
|
+
*/
|
|
1131
|
+
async function pollResource(opts) {
|
|
1132
|
+
const { fetchFn, setItems, setCursor, setError, idKey, cursorStrategy = "always", transform } = opts;
|
|
1133
|
+
const { error, result } = await fetchFn();
|
|
1134
|
+
if (error) {
|
|
1135
|
+
setError(error);
|
|
1136
|
+
return false;
|
|
1137
|
+
}
|
|
1138
|
+
if (result.data.length > 0) {
|
|
1139
|
+
const newData = transform ? result.data.map(transform) : result.data;
|
|
1140
|
+
setItems((prev) => mergeById(prev, newData, idKey));
|
|
1141
|
+
if (cursorStrategy === "onHasMore" ? !!(result.cursor && result.hasMore) : !!result.cursor) setCursor(result.cursor);
|
|
1142
|
+
return true;
|
|
1143
|
+
}
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
// app/lib/client/hooks/use-trace-viewer.ts
|
|
1147
|
+
var LIVE_POLL_LIMIT = 100;
|
|
1148
|
+
var INITIAL_PAGE_SIZE = 500;
|
|
1149
|
+
var LOAD_MORE_PAGE_SIZE = 100;
|
|
1150
|
+
var LIVE_UPDATE_INTERVAL_MS = 5e3;
|
|
1151
|
+
var AUTO_LOAD_MAX_EVENTS = 500;
|
|
1152
|
+
/**
|
|
1153
|
+
* Returns (and keeps up-to-date) the Run and Events for a workflow run.
|
|
1154
|
+
* The trace viewer builds spans entirely from events — Steps and Hooks
|
|
1155
|
+
* are fetched on-demand by the detail sidebar, not here.
|
|
1156
|
+
*/
|
|
1157
|
+
function useWorkflowTraceViewerData(runId, options = {}) {
|
|
1158
|
+
const { live = false } = options;
|
|
1159
|
+
const [run, setRun] = (0, import_react.useState)(null);
|
|
1160
|
+
const [events, setEvents] = (0, import_react.useState)([]);
|
|
1161
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
1162
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
1163
|
+
const [eventsCursor, setEventsCursor] = (0, import_react.useState)();
|
|
1164
|
+
const [eventsHasMore, setEventsHasMore] = (0, import_react.useState)(false);
|
|
1165
|
+
const [isLoadingMoreTraceData, setIsLoadingMoreTraceData] = (0, import_react.useState)(false);
|
|
1166
|
+
const [hasEncryptedData, setHasEncryptedData] = (0, import_react.useState)(false);
|
|
1167
|
+
const isFetchingRef = (0, import_react.useRef)(false);
|
|
1168
|
+
const mountedRef = (0, import_react.useRef)(true);
|
|
1169
|
+
const [initialLoadCompleted, setInitialLoadCompleted] = (0, import_react.useState)(false);
|
|
1170
|
+
const fetchAllData = (0, import_react.useCallback)(async () => {
|
|
1171
|
+
if (isFetchingRef.current) return;
|
|
1172
|
+
isFetchingRef.current = true;
|
|
1173
|
+
setLoading(true);
|
|
1174
|
+
setError(null);
|
|
1175
|
+
const [runResult, eventsResult] = await Promise.all([unwrapServerActionResult(rpc("fetchRun", {
|
|
1176
|
+
runId,
|
|
1177
|
+
resolveData: "none"
|
|
1178
|
+
})), unwrapServerActionResult(rpc("fetchEvents", {
|
|
1179
|
+
runId,
|
|
1180
|
+
sortOrder: "asc",
|
|
1181
|
+
limit: INITIAL_PAGE_SIZE,
|
|
1182
|
+
withData: false
|
|
1183
|
+
}))]);
|
|
1184
|
+
if (runResult.error) setError(runResult.error);
|
|
1185
|
+
else setRun(hydrateResourceIO(runResult.result));
|
|
1186
|
+
const initialEvents = eventsResult.error ? [] : eventsResult.result.data.map(hydrateResourceIO);
|
|
1187
|
+
setEvents(mergeById([], initialEvents, "eventId"));
|
|
1188
|
+
setEventsCursor(eventsResult.error || !eventsResult.result.hasMore ? void 0 : eventsResult.result.cursor);
|
|
1189
|
+
setEventsHasMore(Boolean(!eventsResult.error && eventsResult.result.hasMore));
|
|
1190
|
+
setLoading(false);
|
|
1191
|
+
setInitialLoadCompleted(true);
|
|
1192
|
+
isFetchingRef.current = false;
|
|
1193
|
+
if (!runResult.error && eventsResult.error) setError(eventsResult.error);
|
|
1194
|
+
if (!runResult.error) {
|
|
1195
|
+
const ctx = runResult.result.executionContext;
|
|
1196
|
+
if (ctx?.features && ctx.features.encryption) setHasEncryptedData(true);
|
|
1197
|
+
else unwrapServerActionResult(rpc("fetchEvents", {
|
|
1198
|
+
runId,
|
|
1199
|
+
sortOrder: "asc",
|
|
1200
|
+
limit: 1,
|
|
1201
|
+
withData: true
|
|
1202
|
+
})).then((probeResult) => {
|
|
1203
|
+
if (mountedRef.current && !probeResult.error && probeResult.result.data.some((e) => hasEncryptedFields(hydrateResourceIO(e)))) setHasEncryptedData(true);
|
|
1204
|
+
}).catch(() => {});
|
|
1205
|
+
}
|
|
1206
|
+
}, [runId]);
|
|
1207
|
+
const loadMoreTraceData = (0, import_react.useCallback)(async () => {
|
|
1208
|
+
if (isFetchingRef.current || !initialLoadCompleted || isLoadingMoreTraceData || !eventsHasMore) return;
|
|
1209
|
+
setIsLoadingMoreTraceData(true);
|
|
1210
|
+
try {
|
|
1211
|
+
const nextEventsResult = await unwrapServerActionResult(rpc("fetchEvents", {
|
|
1212
|
+
runId,
|
|
1213
|
+
cursor: eventsCursor,
|
|
1214
|
+
sortOrder: "asc",
|
|
1215
|
+
limit: LOAD_MORE_PAGE_SIZE,
|
|
1216
|
+
withData: false
|
|
1217
|
+
}));
|
|
1218
|
+
if (nextEventsResult.error) setError(nextEventsResult.error);
|
|
1219
|
+
else {
|
|
1220
|
+
const nextEvents = nextEventsResult.result.data.map(hydrateResourceIO);
|
|
1221
|
+
if (nextEvents.length > 0) setEvents((prev) => mergeById(prev, nextEvents, "eventId"));
|
|
1222
|
+
setEventsHasMore(Boolean(nextEventsResult.result.hasMore));
|
|
1223
|
+
setEventsCursor(nextEventsResult.result.hasMore ? nextEventsResult.result.cursor : void 0);
|
|
1224
|
+
}
|
|
1225
|
+
} finally {
|
|
1226
|
+
setIsLoadingMoreTraceData(false);
|
|
1227
|
+
}
|
|
1228
|
+
}, [
|
|
1229
|
+
runId,
|
|
1230
|
+
initialLoadCompleted,
|
|
1231
|
+
isLoadingMoreTraceData,
|
|
1232
|
+
eventsHasMore,
|
|
1233
|
+
eventsCursor
|
|
1234
|
+
]);
|
|
1235
|
+
(0, import_react.useEffect)(() => {
|
|
1236
|
+
if (events.length >= AUTO_LOAD_MAX_EVENTS) return;
|
|
1237
|
+
loadMoreTraceData();
|
|
1238
|
+
}, [events.length, loadMoreTraceData]);
|
|
1239
|
+
const pollRun = (0, import_react.useCallback)(async () => {
|
|
1240
|
+
if (run?.completedAt) return false;
|
|
1241
|
+
const { error, result } = await unwrapServerActionResult(rpc("fetchRun", {
|
|
1242
|
+
runId,
|
|
1243
|
+
resolveData: "none"
|
|
1244
|
+
}));
|
|
1245
|
+
if (error) {
|
|
1246
|
+
setError(error);
|
|
1247
|
+
return false;
|
|
1248
|
+
}
|
|
1249
|
+
setError(null);
|
|
1250
|
+
setRun(hydrateResourceIO(result));
|
|
1251
|
+
return true;
|
|
1252
|
+
}, [runId, run?.completedAt]);
|
|
1253
|
+
const pollEvents = (0, import_react.useCallback)(() => pollResource({
|
|
1254
|
+
fetchFn: () => unwrapServerActionResult(rpc("fetchEvents", {
|
|
1255
|
+
runId,
|
|
1256
|
+
cursor: eventsCursor,
|
|
1257
|
+
sortOrder: "asc",
|
|
1258
|
+
limit: LIVE_POLL_LIMIT,
|
|
1259
|
+
withData: false
|
|
1260
|
+
})),
|
|
1261
|
+
setItems: setEvents,
|
|
1262
|
+
setCursor: setEventsCursor,
|
|
1263
|
+
setError,
|
|
1264
|
+
idKey: "eventId",
|
|
1265
|
+
transform: hydrateResourceIO
|
|
1266
|
+
}), [runId, eventsCursor]);
|
|
1267
|
+
const update = (0, import_react.useCallback)(async () => {
|
|
1268
|
+
if (isFetchingRef.current || !initialLoadCompleted) return { foundNewItems: false };
|
|
1269
|
+
let foundNewItems = false;
|
|
1270
|
+
try {
|
|
1271
|
+
const [_, eventsUpdated] = await Promise.all([pollRun(), pollEvents()]);
|
|
1272
|
+
foundNewItems = eventsUpdated;
|
|
1273
|
+
} catch (err) {
|
|
1274
|
+
console.error("Update error:", err);
|
|
1275
|
+
}
|
|
1276
|
+
return { foundNewItems };
|
|
1277
|
+
}, [
|
|
1278
|
+
pollEvents,
|
|
1279
|
+
initialLoadCompleted,
|
|
1280
|
+
pollRun
|
|
1281
|
+
]);
|
|
1282
|
+
(0, import_react.useEffect)(() => {
|
|
1283
|
+
fetchAllData();
|
|
1284
|
+
}, [fetchAllData]);
|
|
1285
|
+
(0, import_react.useEffect)(() => {
|
|
1286
|
+
mountedRef.current = true;
|
|
1287
|
+
return () => {
|
|
1288
|
+
mountedRef.current = false;
|
|
1289
|
+
};
|
|
1290
|
+
}, []);
|
|
1291
|
+
(0, import_react.useEffect)(() => {
|
|
1292
|
+
if (!live || !initialLoadCompleted || run?.completedAt) return;
|
|
1293
|
+
const interval = setInterval(() => {
|
|
1294
|
+
update();
|
|
1295
|
+
}, LIVE_UPDATE_INTERVAL_MS);
|
|
1296
|
+
return () => {
|
|
1297
|
+
clearInterval(interval);
|
|
1298
|
+
};
|
|
1299
|
+
}, [
|
|
1300
|
+
live,
|
|
1301
|
+
initialLoadCompleted,
|
|
1302
|
+
update,
|
|
1303
|
+
run?.completedAt
|
|
1304
|
+
]);
|
|
1305
|
+
return {
|
|
1306
|
+
run,
|
|
1307
|
+
events,
|
|
1308
|
+
loading,
|
|
1309
|
+
error,
|
|
1310
|
+
update,
|
|
1311
|
+
loadMoreTraceData,
|
|
1312
|
+
hasMoreTraceData: eventsHasMore,
|
|
1313
|
+
isLoadingMoreTraceData,
|
|
1314
|
+
hasEncryptedData
|
|
1315
|
+
};
|
|
1316
|
+
}
|
|
1317
|
+
// app/lib/client/hooks/use-workflow-streams.ts
|
|
1318
|
+
var STREAMS_REFRESH_INTERVAL_MS = 1e4;
|
|
1319
|
+
/**
|
|
1320
|
+
* Hook to fetch and manage stream list for a run
|
|
1321
|
+
*/
|
|
1322
|
+
function useWorkflowStreams(runId, refreshInterval = STREAMS_REFRESH_INTERVAL_MS) {
|
|
1323
|
+
const [streams, setStreams] = (0, import_react.useState)([]);
|
|
1324
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
1325
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
1326
|
+
const hasFetchedRef = (0, import_react.useRef)(false);
|
|
1327
|
+
const fetchData = (0, import_react.useCallback)(async () => {
|
|
1328
|
+
if (!hasFetchedRef.current) setLoading(true);
|
|
1329
|
+
setError(null);
|
|
1330
|
+
try {
|
|
1331
|
+
const result = await listStreams(runId);
|
|
1332
|
+
setStreams(result);
|
|
1333
|
+
} catch (err) {
|
|
1334
|
+
setError(err instanceof Error ? err : new Error(String(err)));
|
|
1335
|
+
} finally {
|
|
1336
|
+
hasFetchedRef.current = true;
|
|
1337
|
+
setLoading(false);
|
|
1338
|
+
}
|
|
1339
|
+
}, [runId]);
|
|
1340
|
+
(0, import_react.useEffect)(() => {
|
|
1341
|
+
hasFetchedRef.current = false;
|
|
1342
|
+
fetchData();
|
|
1343
|
+
}, [fetchData]);
|
|
1344
|
+
(0, import_react.useEffect)(() => {
|
|
1345
|
+
if (!refreshInterval || refreshInterval <= 0) return;
|
|
1346
|
+
const interval = setInterval(fetchData, refreshInterval);
|
|
1347
|
+
return () => clearInterval(interval);
|
|
1348
|
+
}, [refreshInterval, fetchData]);
|
|
1349
|
+
return {
|
|
1350
|
+
streams,
|
|
1351
|
+
loading,
|
|
1352
|
+
error,
|
|
1353
|
+
refresh: fetchData
|
|
1354
|
+
};
|
|
1355
|
+
}
|
|
1356
|
+
// app/components/run-detail-view.tsx
|
|
1357
|
+
var TABS = [
|
|
1358
|
+
"trace",
|
|
1359
|
+
"events",
|
|
1360
|
+
"streams"
|
|
1361
|
+
];
|
|
1362
|
+
function RunDetailView({ runId, selectedId: _selectedId }) {
|
|
1363
|
+
const navigate = useNavigate();
|
|
1364
|
+
const [searchParams] = useSearchParams();
|
|
1365
|
+
const [cancelling, setCancelling] = (0, import_react.useState)(false);
|
|
1366
|
+
const [rerunning, setRerunning] = (0, import_react.useState)(false);
|
|
1367
|
+
const [showCancelDialog, setShowCancelDialog] = (0, import_react.useState)(false);
|
|
1368
|
+
const [showRerunDialog, setShowRerunDialog] = (0, import_react.useState)(false);
|
|
1369
|
+
const activeTab = TABS.find((tab) => tab === searchParams.get("tab")) ?? "trace";
|
|
1370
|
+
const selectedStreamId = searchParams.get("streamId");
|
|
1371
|
+
const updateSearchParams = (0, import_react.useCallback)((updates) => {
|
|
1372
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
1373
|
+
for (const [key, value] of Object.entries(updates)) if (value === null) params.delete(key);
|
|
1374
|
+
else params.set(key, value);
|
|
1375
|
+
navigate(`?${params.toString()}`, { preventScrollReset: true });
|
|
1376
|
+
}, [navigate, searchParams]);
|
|
1377
|
+
const setActiveTab = (0, import_react.useCallback)((tab) => {
|
|
1378
|
+
if (tab !== "streams") updateSearchParams({
|
|
1379
|
+
tab,
|
|
1380
|
+
streamId: null
|
|
1381
|
+
});
|
|
1382
|
+
else updateSearchParams({ tab });
|
|
1383
|
+
}, [updateSearchParams]);
|
|
1384
|
+
const setSelectedStreamId = (0, import_react.useCallback)((streamId) => {
|
|
1385
|
+
updateSearchParams({ streamId });
|
|
1386
|
+
}, [updateSearchParams]);
|
|
1387
|
+
const handleStreamClick = (0, import_react.useCallback)((streamId) => {
|
|
1388
|
+
updateSearchParams({
|
|
1389
|
+
tab: "streams",
|
|
1390
|
+
streamId
|
|
1391
|
+
});
|
|
1392
|
+
}, [updateSearchParams]);
|
|
1393
|
+
const handleRunRefClick = (0, import_react.useCallback)((targetRunId) => {
|
|
1394
|
+
navigate(`/run/${encodeURIComponent(targetRunId)}`);
|
|
1395
|
+
}, [navigate]);
|
|
1396
|
+
const handleWakeUpSleep = (0, import_react.useCallback)(async (runId, correlationId) => {
|
|
1397
|
+
return unwrapOrThrow(rpc("wakeUpRun", {
|
|
1398
|
+
runId,
|
|
1399
|
+
correlationIds: [correlationId]
|
|
1400
|
+
}));
|
|
1401
|
+
}, []);
|
|
1402
|
+
const encryptionKeyRef = (0, import_react.useRef)(null);
|
|
1403
|
+
const handleResolveHook = (0, import_react.useCallback)(async (hookToken, payload) => {
|
|
1404
|
+
await unwrapOrThrow(rpc("resumeHook", {
|
|
1405
|
+
token: hookToken,
|
|
1406
|
+
payload
|
|
1407
|
+
}));
|
|
1408
|
+
}, []);
|
|
1409
|
+
const handleLoadEventData = (0, import_react.useCallback)(async (event) => {
|
|
1410
|
+
const { error, result } = await unwrapServerActionResult(rpc("fetchEvent", {
|
|
1411
|
+
runId: event.runId,
|
|
1412
|
+
eventId: event.eventId,
|
|
1413
|
+
resolveData: "all"
|
|
1414
|
+
}));
|
|
1415
|
+
if (error) throw error;
|
|
1416
|
+
const fullEvent = await hydrateResourceIOAsync(result, encryptionKeyRef.current ?? void 0);
|
|
1417
|
+
if ("eventData" in fullEvent) return fullEvent.eventData;
|
|
1418
|
+
return null;
|
|
1419
|
+
}, []);
|
|
1420
|
+
const { run: runData, events: allEvents, loading, error, update, hasEncryptedData, loadMoreTraceData, hasMoreTraceData, isLoadingMoreTraceData } = useWorkflowTraceViewerData(runId, { live: true });
|
|
1421
|
+
const run = runData ?? {};
|
|
1422
|
+
const cancelReason = useCancellationReason(runId, run.status, allEvents);
|
|
1423
|
+
const [encryptionKey, setEncryptionKey] = (0, import_react.useState)(null);
|
|
1424
|
+
encryptionKeyRef.current = encryptionKey;
|
|
1425
|
+
const [eventsSortOrder, setEventsSortOrder] = (0, import_react.useState)("asc");
|
|
1426
|
+
const { events: eventsListData, loading: eventsListLoading, hasMore: hasMoreEventsTab, loadingMore: loadingMoreEventsTab, loadMore: loadMoreEventsTab, searchByExactId } = useEventsListData(runId, {
|
|
1427
|
+
sortOrder: eventsSortOrder,
|
|
1428
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
1429
|
+
enabled: activeTab === "events"
|
|
1430
|
+
});
|
|
1431
|
+
const fetchSpanDetail = (0, import_react.useCallback)((selection) => fetchSpanDetailResource(selection, { encryptionKey: encryptionKey ?? void 0 }), [encryptionKey]);
|
|
1432
|
+
const [isDecrypting, setIsDecrypting] = (0, import_react.useState)(false);
|
|
1433
|
+
const handleDecrypt = (0, import_react.useCallback)(async () => {
|
|
1434
|
+
if (encryptionKey) return;
|
|
1435
|
+
setIsDecrypting(true);
|
|
1436
|
+
try {
|
|
1437
|
+
const { error: keyError, result: keyResult } = await unwrapServerActionResult(rpc("getEncryptionKeyForRun", { runId }));
|
|
1438
|
+
if (keyError) {
|
|
1439
|
+
toast.error(`Failed to fetch encryption key: ${keyError.message}`);
|
|
1440
|
+
return;
|
|
1441
|
+
}
|
|
1442
|
+
if (!keyResult) {
|
|
1443
|
+
toast.error("Encryption is not configured for this deployment.");
|
|
1444
|
+
return;
|
|
1445
|
+
}
|
|
1446
|
+
setEncryptionKey(keyResult);
|
|
1447
|
+
} finally {
|
|
1448
|
+
setIsDecrypting(false);
|
|
1449
|
+
}
|
|
1450
|
+
}, [encryptionKey, runId]);
|
|
1451
|
+
const sidebarData = (0, import_react.useMemo)(() => ({
|
|
1452
|
+
run,
|
|
1453
|
+
events: allEvents ?? [],
|
|
1454
|
+
fetchSpanDetail,
|
|
1455
|
+
onStreamClick: handleStreamClick,
|
|
1456
|
+
onRunClick: handleRunRefClick,
|
|
1457
|
+
onWakeUpSleep: handleWakeUpSleep,
|
|
1458
|
+
onLoadEventData: handleLoadEventData,
|
|
1459
|
+
onResolveHook: handleResolveHook,
|
|
1460
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
1461
|
+
onDecrypt: handleDecrypt,
|
|
1462
|
+
isDecrypting,
|
|
1463
|
+
hasEncryptedData
|
|
1464
|
+
}), [
|
|
1465
|
+
run,
|
|
1466
|
+
allEvents,
|
|
1467
|
+
fetchSpanDetail,
|
|
1468
|
+
handleStreamClick,
|
|
1469
|
+
handleRunRefClick,
|
|
1470
|
+
handleWakeUpSleep,
|
|
1471
|
+
handleLoadEventData,
|
|
1472
|
+
handleResolveHook,
|
|
1473
|
+
encryptionKey,
|
|
1474
|
+
handleDecrypt,
|
|
1475
|
+
isDecrypting,
|
|
1476
|
+
hasEncryptedData
|
|
1477
|
+
]);
|
|
1478
|
+
const { streams, loading: streamsLoading, error: streamsError } = useWorkflowStreams(runId);
|
|
1479
|
+
const { chunks: streamChunks, isLive: streamIsLive, isInitialLoading: streamIsInitialLoading, error: streamError } = useStreamReader(selectedStreamId, runId, encryptionKey, run.status);
|
|
1480
|
+
const handleCancelClick = () => {
|
|
1481
|
+
setShowCancelDialog(true);
|
|
1482
|
+
};
|
|
1483
|
+
const handleConfirmCancel = async () => {
|
|
1484
|
+
if (cancelling) return;
|
|
1485
|
+
try {
|
|
1486
|
+
setCancelling(true);
|
|
1487
|
+
setShowCancelDialog(false);
|
|
1488
|
+
await unwrapOrThrow(rpc("cancelRun", { runId }));
|
|
1489
|
+
await update();
|
|
1490
|
+
toast.success("Run cancelled");
|
|
1491
|
+
} catch (err) {
|
|
1492
|
+
console.error("Failed to cancel run:", err);
|
|
1493
|
+
toast.error("Failed to cancel run", { description: err instanceof Error ? err.message : "An unknown error occurred" });
|
|
1494
|
+
} finally {
|
|
1495
|
+
setCancelling(false);
|
|
1496
|
+
}
|
|
1497
|
+
};
|
|
1498
|
+
const isDynamicRun = Boolean(run.executionContext?.dynamicWorkflow);
|
|
1499
|
+
const handleRerunClick = () => {
|
|
1500
|
+
if (isDynamicRun) return;
|
|
1501
|
+
setShowRerunDialog(true);
|
|
1502
|
+
};
|
|
1503
|
+
const handleConfirmRerun = async () => {
|
|
1504
|
+
if (rerunning || isDynamicRun) return;
|
|
1505
|
+
try {
|
|
1506
|
+
setRerunning(true);
|
|
1507
|
+
setShowRerunDialog(false);
|
|
1508
|
+
const newRunId = await unwrapOrThrow(rpc("recreateRun", { runId: run.runId }));
|
|
1509
|
+
toast.success("New run started", { description: `Run ID: ${newRunId}` });
|
|
1510
|
+
navigate(`/run/${newRunId}`);
|
|
1511
|
+
} catch (err) {
|
|
1512
|
+
console.error("Failed to re-run workflow:", err);
|
|
1513
|
+
toast.error("Failed to start new run", { description: err instanceof Error ? err.message : "An unknown error occurred" });
|
|
1514
|
+
} finally {
|
|
1515
|
+
setRerunning(false);
|
|
1516
|
+
setShowRerunDialog(false);
|
|
1517
|
+
}
|
|
1518
|
+
};
|
|
1519
|
+
if (error && !runData) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
|
|
1520
|
+
variant: "destructive",
|
|
1521
|
+
className: "m-4",
|
|
1522
|
+
children: [
|
|
1523
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "h-4 w-4" }),
|
|
1524
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: "Error loading workflow run" }),
|
|
1525
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, { children: getErrorMessage(error) })
|
|
1526
|
+
]
|
|
1527
|
+
});
|
|
1528
|
+
const workflowName = parseWorkflowName(run.workflowName)?.shortName;
|
|
1529
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1530
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, {
|
|
1531
|
+
open: showCancelDialog,
|
|
1532
|
+
onOpenChange: setShowCancelDialog,
|
|
1533
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Cancel Workflow Run?" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "This will stop the workflow execution immediately, and no further steps will be executed. Partial workflow execution may occur. Are you sure you want to cancel the run?" })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { children: "Keep Running" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, {
|
|
1534
|
+
onClick: handleConfirmCancel,
|
|
1535
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1536
|
+
children: "Cancel Run"
|
|
1537
|
+
})] })] })
|
|
1538
|
+
}),
|
|
1539
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, {
|
|
1540
|
+
open: showRerunDialog,
|
|
1541
|
+
onOpenChange: setShowRerunDialog,
|
|
1542
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogContent, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogHeader, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogTitle, { children: "Replay Run?" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogDescription, { children: "This can potentially re-run code that is meant to only execute once. Are you sure you want to replay the workflow run?" })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(AlertDialogFooter, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogCancel, { children: "Cancel" }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialogAction, {
|
|
1543
|
+
onClick: handleConfirmRerun,
|
|
1544
|
+
children: "Replay Run"
|
|
1545
|
+
})] })] })
|
|
1546
|
+
}),
|
|
1547
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1548
|
+
className: "flex flex-col h-[calc(100vh-97px)]",
|
|
1549
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1550
|
+
className: "flex-none space-y-4",
|
|
1551
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Breadcrumb, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(BreadcrumbList, { children: [
|
|
1552
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbLink, {
|
|
1553
|
+
asChild: true,
|
|
1554
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
1555
|
+
to: "/",
|
|
1556
|
+
children: "Runs"
|
|
1557
|
+
})
|
|
1558
|
+
}) }),
|
|
1559
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbSeparator, {}),
|
|
1560
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbPage, {
|
|
1561
|
+
className: "font-mono text-xs",
|
|
1562
|
+
children: runId
|
|
1563
|
+
}) })
|
|
1564
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1565
|
+
className: "space-y-4 p-6 border rounded-lg",
|
|
1566
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1567
|
+
className: "flex items-start justify-between",
|
|
1568
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1569
|
+
className: "mb-4",
|
|
1570
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
1571
|
+
className: "text-xl font-semibold",
|
|
1572
|
+
children: workflowName ? workflowName : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[260px] h-[28px]" })
|
|
1573
|
+
})
|
|
1574
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1575
|
+
className: "flex items-center justify-between gap-2",
|
|
1576
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveStatus, {
|
|
1577
|
+
hasError: error !== null,
|
|
1578
|
+
errorMessage: error ? getErrorMessage(error) : ""
|
|
1579
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunActionsButtons, {
|
|
1580
|
+
runId,
|
|
1581
|
+
runStatus: run.status,
|
|
1582
|
+
events: allEvents,
|
|
1583
|
+
eventsLoading: loading,
|
|
1584
|
+
loading,
|
|
1585
|
+
replayDisabledReason: isDynamicRun ? "Dynamic runs cannot be replayed as a new run." : void 0,
|
|
1586
|
+
onRerunClick: handleRerunClick,
|
|
1587
|
+
onCancelClick: handleCancelClick,
|
|
1588
|
+
callbacks: { onSuccess: update }
|
|
1589
|
+
})]
|
|
1590
|
+
})]
|
|
1591
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1592
|
+
className: "flex items-start gap-8",
|
|
1593
|
+
children: [
|
|
1594
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1595
|
+
className: "flex flex-col gap-1",
|
|
1596
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1597
|
+
className: "text-xs text-muted-foreground",
|
|
1598
|
+
children: "Status"
|
|
1599
|
+
}), run.status ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBadge, {
|
|
1600
|
+
status: run.status,
|
|
1601
|
+
context: {
|
|
1602
|
+
error: run.error,
|
|
1603
|
+
cancelReason
|
|
1604
|
+
}
|
|
1605
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[55px] h-[24px]" })]
|
|
1606
|
+
}),
|
|
1607
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1608
|
+
className: "flex flex-col gap-1",
|
|
1609
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1610
|
+
className: "text-xs text-muted-foreground",
|
|
1611
|
+
children: "Duration"
|
|
1612
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1613
|
+
className: "text-xs",
|
|
1614
|
+
children: run.runId ? run.startedAt ? (() => {
|
|
1615
|
+
const ms = (run.completedAt ? new Date(run.completedAt).getTime() : Date.now()) - new Date(run.startedAt).getTime();
|
|
1616
|
+
const seconds = Math.floor(ms / 1e3);
|
|
1617
|
+
if (seconds < 60) return `${seconds}s`;
|
|
1618
|
+
const minutes = Math.floor(seconds / 60);
|
|
1619
|
+
const remainingSeconds = seconds % 60;
|
|
1620
|
+
if (minutes < 60) return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
1621
|
+
const hours = Math.floor(minutes / 60);
|
|
1622
|
+
const remainingMinutes = minutes % 60;
|
|
1623
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
1624
|
+
})() : "-" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[60px] h-[20px]" })
|
|
1625
|
+
})]
|
|
1626
|
+
}),
|
|
1627
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1628
|
+
className: "flex flex-col gap-1",
|
|
1629
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1630
|
+
className: "text-xs text-muted-foreground",
|
|
1631
|
+
children: "Run ID"
|
|
1632
|
+
}), run.runId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyableText, {
|
|
1633
|
+
text: run.runId,
|
|
1634
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1635
|
+
className: "text-xs mt-0.5 font-mono",
|
|
1636
|
+
children: run.runId
|
|
1637
|
+
})
|
|
1638
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[280px] h-[20px]" })]
|
|
1639
|
+
}),
|
|
1640
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1641
|
+
className: "flex flex-col gap-1",
|
|
1642
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1643
|
+
className: "text-xs text-muted-foreground",
|
|
1644
|
+
children: "Queued"
|
|
1645
|
+
}), run.createdAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1646
|
+
className: "text-xs",
|
|
1647
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.createdAt })
|
|
1648
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[110px] h-[20px]" })]
|
|
1649
|
+
}),
|
|
1650
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1651
|
+
className: "flex flex-col gap-1",
|
|
1652
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1653
|
+
className: "text-xs text-muted-foreground",
|
|
1654
|
+
children: "Started"
|
|
1655
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1656
|
+
className: "text-xs",
|
|
1657
|
+
children: run.runId ? run.startedAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.startedAt }) : "-" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[110px] h-[20px]" })
|
|
1658
|
+
})]
|
|
1659
|
+
}),
|
|
1660
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1661
|
+
className: "flex flex-col gap-1",
|
|
1662
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1663
|
+
className: "text-xs text-muted-foreground",
|
|
1664
|
+
children: "Completed"
|
|
1665
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1666
|
+
className: "text-xs",
|
|
1667
|
+
children: run.runId ? run.completedAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.completedAt }) : "-" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[110px] h-[20px]" })
|
|
1668
|
+
})]
|
|
1669
|
+
}),
|
|
1670
|
+
run.expiredAt != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1671
|
+
className: "flex flex-col gap-1",
|
|
1672
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
1673
|
+
asChild: true,
|
|
1674
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1675
|
+
className: "text-xs text-muted-foreground cursor-help flex items-center gap-1",
|
|
1676
|
+
children: ["Expired", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleQuestionMark, { className: "w-3 h-3" })]
|
|
1677
|
+
})
|
|
1678
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipContent, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: "The storage data for this run has expired and is no longer available." }) })] }), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1679
|
+
className: "text-xs",
|
|
1680
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.expiredAt })
|
|
1681
|
+
})]
|
|
1682
|
+
})
|
|
1683
|
+
]
|
|
1684
|
+
})]
|
|
1685
|
+
})]
|
|
1686
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1687
|
+
className: "mt-4 flex-1 flex flex-col min-h-0",
|
|
1688
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, {
|
|
1689
|
+
value: activeTab,
|
|
1690
|
+
onValueChange: (v) => setActiveTab(v),
|
|
1691
|
+
className: "flex-1 flex flex-col min-h-0",
|
|
1692
|
+
children: [
|
|
1693
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsList, {
|
|
1694
|
+
className: "mb-4 flex-none",
|
|
1695
|
+
children: [
|
|
1696
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
|
|
1697
|
+
value: "trace",
|
|
1698
|
+
className: "gap-2",
|
|
1699
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { className: "h-4 w-4" }), "Trace"]
|
|
1700
|
+
}),
|
|
1701
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
|
|
1702
|
+
value: "events",
|
|
1703
|
+
className: "gap-2",
|
|
1704
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { className: "h-4 w-4" }), "Events"]
|
|
1705
|
+
}),
|
|
1706
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
|
|
1707
|
+
value: "streams",
|
|
1708
|
+
className: "gap-2",
|
|
1709
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { className: "h-4 w-4" }), "Streams"]
|
|
1710
|
+
})
|
|
1711
|
+
]
|
|
1712
|
+
}),
|
|
1713
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
1714
|
+
value: "trace",
|
|
1715
|
+
className: "mt-0 flex-1 min-h-0",
|
|
1716
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1717
|
+
title: "Failed to load trace viewer",
|
|
1718
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1719
|
+
className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden",
|
|
1720
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TraceViewer, {
|
|
1721
|
+
run,
|
|
1722
|
+
events: allEvents ?? [],
|
|
1723
|
+
loading,
|
|
1724
|
+
sidebarData,
|
|
1725
|
+
onLoadMore: loadMoreTraceData,
|
|
1726
|
+
hasMore: hasMoreTraceData,
|
|
1727
|
+
isLoadingMore: isLoadingMoreTraceData
|
|
1728
|
+
})
|
|
1729
|
+
})
|
|
1730
|
+
})
|
|
1731
|
+
}),
|
|
1732
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
1733
|
+
value: "events",
|
|
1734
|
+
className: "mt-0 flex-1 min-h-0",
|
|
1735
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1736
|
+
title: "Failed to load events list",
|
|
1737
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1738
|
+
className: "h-full",
|
|
1739
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EventListView, {
|
|
1740
|
+
events: eventsListData,
|
|
1741
|
+
run,
|
|
1742
|
+
onLoadEventData: handleLoadEventData,
|
|
1743
|
+
hasMoreEvents: hasMoreEventsTab,
|
|
1744
|
+
isLoadingMoreEvents: loadingMoreEventsTab,
|
|
1745
|
+
onLoadMoreEvents: loadMoreEventsTab,
|
|
1746
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
1747
|
+
isLoading: eventsListLoading,
|
|
1748
|
+
sortOrder: eventsSortOrder,
|
|
1749
|
+
onSortOrderChange: setEventsSortOrder,
|
|
1750
|
+
onDecrypt: handleDecrypt,
|
|
1751
|
+
isDecrypting,
|
|
1752
|
+
hasEncryptedData,
|
|
1753
|
+
onExactIdSearch: searchByExactId
|
|
1754
|
+
})
|
|
1755
|
+
})
|
|
1756
|
+
})
|
|
1757
|
+
}),
|
|
1758
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
1759
|
+
value: "streams",
|
|
1760
|
+
className: "mt-0 flex-1 min-h-0",
|
|
1761
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1762
|
+
title: "Failed to load stream data",
|
|
1763
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1764
|
+
className: "relative -mx-6 flex h-full min-h-0 overflow-hidden border-t border-gray-alpha-400 bg-background-100",
|
|
1765
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1766
|
+
className: "flex w-[340px] shrink-0 flex-col border-r border-gray-alpha-400 bg-background-100",
|
|
1767
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1768
|
+
"aria-hidden": "true",
|
|
1769
|
+
className: "h-10 min-h-10 border-b border-gray-alpha-400"
|
|
1770
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1771
|
+
className: "min-h-0 flex-1 divide-y divide-gray-400 overflow-y-auto",
|
|
1772
|
+
children: streamsLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1773
|
+
className: "flex flex-col divide-y divide-gray-400",
|
|
1774
|
+
children: [
|
|
1775
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1776
|
+
className: "flex h-10 items-center pl-4 pr-2",
|
|
1777
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-24" })
|
|
1778
|
+
}),
|
|
1779
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1780
|
+
className: "flex h-10 items-center pl-4 pr-2",
|
|
1781
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-32" })
|
|
1782
|
+
}),
|
|
1783
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1784
|
+
className: "flex h-10 items-center pl-4 pr-2",
|
|
1785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-20" })
|
|
1786
|
+
})
|
|
1787
|
+
]
|
|
1788
|
+
}) : streamsError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1789
|
+
className: "px-4 py-2 text-label-12 text-red-900",
|
|
1790
|
+
children: streamsError.message
|
|
1791
|
+
}) : streams.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1792
|
+
className: "flex h-10 items-center px-4 text-label-12 text-gray-900",
|
|
1793
|
+
children: "No streams found for this run"
|
|
1794
|
+
}) : streams.map((streamId) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1795
|
+
type: "button",
|
|
1796
|
+
onClick: () => setSelectedStreamId(streamId),
|
|
1797
|
+
className: `flex h-10 w-full min-w-0 items-center truncate pl-4 pr-2 text-left text-label-14 transition-colors ${selectedStreamId === streamId ? "bg-gray-100 text-gray-1000 hover:bg-gray-200 active:bg-gray-200" : "bg-transparent text-gray-900 hover:bg-gray-100 hover:text-gray-1000 focus-visible:bg-gray-100 focus-visible:text-gray-1000"}`,
|
|
1798
|
+
title: streamId,
|
|
1799
|
+
children: streamId
|
|
1800
|
+
}, streamId))
|
|
1801
|
+
})]
|
|
1802
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1803
|
+
className: "flex min-w-0 flex-1 flex-col overflow-hidden bg-background-100",
|
|
1804
|
+
children: streamsLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1805
|
+
className: "min-h-0 flex-1",
|
|
1806
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StreamViewerSkeleton, {})
|
|
1807
|
+
}) : selectedStreamId ? streamError?.includes("encrypted") && !encryptionKey ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1808
|
+
className: "flex h-full items-center justify-center p-4",
|
|
1809
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1810
|
+
className: "flex flex-col items-center gap-3 text-center",
|
|
1811
|
+
children: [
|
|
1812
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { className: "h-8 w-8 text-gray-700" }),
|
|
1813
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1814
|
+
className: "space-y-1",
|
|
1815
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1816
|
+
className: "text-label-14 font-medium text-gray-1000",
|
|
1817
|
+
children: "Encrypted Stream"
|
|
1818
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1819
|
+
className: "text-label-12 text-gray-900",
|
|
1820
|
+
children: "Decrypt this stream to view its chunks."
|
|
1821
|
+
})]
|
|
1822
|
+
}),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DecryptButton, {
|
|
1824
|
+
onClick: handleDecrypt,
|
|
1825
|
+
loading: isDecrypting
|
|
1826
|
+
})
|
|
1827
|
+
]
|
|
1828
|
+
})
|
|
1829
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1830
|
+
className: "min-h-0 flex-1",
|
|
1831
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StreamViewer, {
|
|
1832
|
+
streamId: selectedStreamId,
|
|
1833
|
+
chunks: streamChunks,
|
|
1834
|
+
isLive: streamIsLive,
|
|
1835
|
+
isLoading: streamIsInitialLoading,
|
|
1836
|
+
error: streamError?.includes("encrypted") ? null : streamError
|
|
1837
|
+
})
|
|
1838
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1839
|
+
className: "flex h-full items-center justify-center",
|
|
1840
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1841
|
+
className: "text-label-14 text-gray-600",
|
|
1842
|
+
children: streams.length > 0 ? "Select a stream to view its data" : "No streams available"
|
|
1843
|
+
})
|
|
1844
|
+
})
|
|
1845
|
+
})]
|
|
1846
|
+
})
|
|
1847
|
+
})
|
|
1848
|
+
})
|
|
1849
|
+
]
|
|
1850
|
+
})
|
|
1851
|
+
})]
|
|
1852
|
+
})
|
|
1853
|
+
] });
|
|
1854
|
+
}
|
|
1855
|
+
// app/routes/run-detail.tsx
|
|
1856
|
+
var run_detail_default = withComponentProps(function RunDetailPage() {
|
|
1857
|
+
const params = useParams();
|
|
1858
|
+
const [searchParams] = useSearchParams();
|
|
1859
|
+
const runId = params.runId;
|
|
1860
|
+
const stepId = searchParams.get("stepId");
|
|
1861
|
+
const eventId = searchParams.get("eventId");
|
|
1862
|
+
const hookId = searchParams.get("hookId");
|
|
1863
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1864
|
+
title: "Failed to load run details",
|
|
1865
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunDetailView, {
|
|
1866
|
+
runId,
|
|
1867
|
+
selectedId: stepId || eventId || hookId || void 0
|
|
1868
|
+
})
|
|
1869
|
+
});
|
|
1870
|
+
});
|
|
1871
|
+
export { run_detail_default as default };
|