@brickkit/cli 0.10.0 → 0.12.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/README.md +1 -1
- 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-B-bZRtNV.js +265 -0
- package/dashboard-dist/app.css +2 -2
- package/dashboard-dist/app.js +13 -13
- package/dashboard-dist/ccount-CcG1m-Yh.js +1 -0
- package/dashboard-dist/client-BJJtVSVr.js +1 -0
- package/dashboard-dist/core-Z7NJFk0K.js +1 -0
- package/dashboard-dist/docs-Dpfc0wJb.js +4 -0
- package/dashboard-dist/docs.css +1 -1
- package/dashboard-dist/kit.js +1 -0
- package/dashboard-dist/popover-BzejBolB.js +1 -0
- package/dashboard-dist/react-dom-client.js +3 -0
- package/dashboard-dist/react-dom.js +3 -0
- package/dashboard-dist/react-jsx-runtime.js +1 -1
- package/dashboard-dist/react.js +3 -3
- package/dashboard-dist/theme.css +123 -0
- package/dist/app-entry2.js +2 -3
- package/dist/bin.d.ts +0 -2
- package/dist/bin.js +606 -49
- package/dist/bin.js.map +1 -1
- package/dist/client-contract-file2.js +2 -3
- package/dist/client-contract2.js +18 -10
- package/dist/client-contract2.js.map +1 -1
- package/dist/compiler.d.ts +1 -2
- package/dist/compiler.js +1 -1
- package/dist/compiler2.js +3 -4
- package/dist/config.js +250 -0
- package/dist/config.js.map +1 -0
- package/dist/dashboard-extension.d.ts +25 -0
- package/dist/dashboard.d.ts +2997 -0
- package/dist/dev-reporter.d.ts +0 -2
- package/dist/dev-reporter.js +1 -2
- package/dist/dev-telemetry-store.js +1411 -966
- package/dist/dev-telemetry-store.js.map +1 -1
- package/dist/dev-telemetry.js +3 -4
- package/dist/dev-telemetry.js.map +1 -1
- package/dist/dev-worker.js +3 -4
- package/dist/emit.d.ts +0 -2
- package/dist/index.d.ts +96 -17
- package/dist/index.js +4 -5
- package/dist/lint/eslint.d.ts +2 -0
- package/dist/lint/eslint.js +1 -0
- package/dist/lint/oxlint.d.ts +17 -0
- package/dist/lint/oxlint.js +18 -0
- package/dist/lint/oxlint.js.map +1 -0
- package/dist/plugin.d.ts +70 -0
- package/dist/plugin.js +64 -0
- package/dist/plugin.js.map +1 -0
- package/dist/presets.js +1066 -0
- package/dist/presets.js.map +1 -0
- package/dist/runner.js +114 -32
- package/dist/runner.js.map +1 -1
- package/dist/vite.d.ts +6 -5
- package/dist/vite.js +13 -9
- package/dist/vite.js.map +1 -1
- package/dist/workflows.d.ts +0 -2
- package/dist/workflows2.js +3 -4
- 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-CCzpuUz_.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-DYVdwGy2.js +34 -0
- package/inspector-dist/client/assets/home-CyjkvtII.js +2883 -0
- package/inspector-dist/client/assets/jsx-runtime-CPEah4WQ.js +7084 -0
- package/inspector-dist/client/assets/manifest-ba30b52d.js +1 -0
- package/inspector-dist/client/assets/mermaid-3ZIDBTTL-Dy6IVqPy.js +1 -0
- package/inspector-dist/client/assets/root-8BMab1lL.css +2 -0
- package/inspector-dist/client/assets/root-DX9wtogx.js +332 -0
- package/inspector-dist/client/assets/run-detail-C69EJGql.js +1549 -0
- package/inspector-dist/client/assets/tabs-B6B88IjT.js +75692 -0
- package/inspector-dist/client/assets/tabs-L5XKzOpP.css +1 -0
- package/inspector-dist/client/assets/world-config-context-C3BqXPIv.js +30 -0
- package/inspector-dist/client/assets/zstd-browser-decoder-ByUgcY9H.js +41 -0
- package/inspector-dist/server/assets/app-WoDoT62X.js +100155 -0
- package/inspector-dist/server/assets/chunk-RLXIAIE6-CbvDIAEa.js +42977 -0
- package/inspector-dist/server/assets/dist-BRxZSWUN.js +1140 -0
- package/inspector-dist/server/assets/dist-CQnQcIJg.js +199 -0
- package/inspector-dist/server/assets/dist-DqRd9pyS.js +1644 -0
- package/inspector-dist/server/assets/dist-qR-969AD.js +10327 -0
- package/inspector-dist/server/assets/encryption-_PuklZNX.js +888 -0
- package/inspector-dist/server/assets/event-metadata-BVakQJ_y.js +147 -0
- package/inspector-dist/server/assets/functions-CImcpqNl.js +1172 -0
- package/inspector-dist/server/assets/global-singleton-CPirHxFh.js +82 -0
- package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-fPMB_t7F.js +36 -0
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-bADXySE3.js +3 -0
- package/inspector-dist/server/assets/parse-D9Vvgzt9.js +471 -0
- package/inspector-dist/server/assets/rolldown-runtime-CLg409Sh.js +44 -0
- package/inspector-dist/server/assets/serialization-format-DDtsVTU1.js +478 -0
- package/inspector-dist/server/assets/token-BW4GdQZh.js +62 -0
- package/inspector-dist/server/assets/token-D6FXdkJT.js +57 -0
- package/inspector-dist/server/assets/token-util-BoNmi-wE.js +457 -0
- package/inspector-dist/server/assets/wrapper-wiqsGXcE.js +3626 -0
- package/inspector-dist/server/assets/ws-transport-DV7oG4mL.js +29478 -0
- package/inspector-dist/server/assets/zstd-browser-decoder-Cswf0KO6.js +40 -0
- package/inspector-dist/server/index.js +2 -57
- package/package.json +57 -32
- package/vite-client.d.ts +1 -1
- package/dashboard-dist/CollapsiblePanel-a54TwMKb.js +0 -2
- package/dashboard-dist/PopoverPopup-BLzjTqsi.js +0 -1
- package/dashboard-dist/api-reference-r893F8zi.js +0 -260
- package/dashboard-dist/core-BWAwhSFf.js +0 -1
- package/dashboard-dist/docs-CkMy3Y5i.js +0 -4
- package/dashboard-dist/preload-helper-CjQDFR0M.js +0 -1
- package/dist/bin.d.ts.map +0 -1
- package/dist/build.js +0 -119
- package/dist/build.js.map +0 -1
- package/dist/dev-reporter.d.ts.map +0 -1
- package/dist/emit.d.ts.map +0 -1
- package/dist/index.d.ts.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-CY7CQBRo.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-4baa7c6f.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-Bmn5n3jF.js +0 -305
- package/inspector-dist/client/assets/root-CfCr265_.css +0 -1
- 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-C-ZVJtic.js +0 -174880
- package/inspector-dist/server/assets/highlighted-body-B3W2YXNL-C8sq8F_D.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-CWJr34WJ.js +0 -1296
- package/inspector-dist/server/assets/index-CYlmUaKx.js +0 -191
- package/inspector-dist/server/assets/mermaid-3ZIDBTTL-Dv5rjfMN.js +0 -58
- package/inspector-dist/server/assets/token-DnLp3wBO.js +0 -95
- package/inspector-dist/server/assets/token-util-Bpfp-B0w.js +0 -33
- package/inspector-dist/server/assets/wrapper-D5LIcZ_u.js +0 -67
- package/inspector-dist/server/assets/zstd-browser-decoder-BM8GpVB8.js +0 -77
|
@@ -0,0 +1,1549 @@
|
|
|
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 { $t as parseWorkflowName, A as fetchEventsByCorrelationId, At as buttonVariants, B as Portal, Bt as ErrorBoundary, D as unwrapServerActionResult, Dt as TooltipTrigger, E as getErrorTitle, Et as TooltipContent, Ft as isEncryptedData, J as FocusScopeBranchProvider, K as useId, L as ReactRemoveScroll, M as getEncryptionKeyForRun, Mt as getWebRevivers, Nt as hydrateResourceIOAsync, O as fetchEvent, Ot as DecryptButton, Pt as hydrateData, Q as useDismissableLayerSurface, Qt as createLucideIcon, R as hideOthers, Rt as decrypt, T as getErrorMessage, Tt as Tooltip, Ut as Lock, X as useFocusGuards, Y as useFocusScopeBranchRegistry, Yt as ChevronRight, Z as DismissableLayer, _ as wakeUpRun, a as RunActionsButtons, at as useLayoutEffect2, b as useWorkflowTraceViewerData, c as Skeleton, ct as composeEventHandlers, dt as AlertTitle, f as cancelRun, ft as LIVE_UPDATE_INTERVAL_MS, g as resumeHook, gt as StreamViewerSkeleton, ht as StreamViewer, i as TabsTrigger, it as useControllableState, jt as Slot$1, k as fetchEvents, l as RelativeTime, lt as Alert, m as recreateRun, mt as TraceViewer, n as TabsContent, nt as Primitive, ot as createContextScope, pt as cn, q as FocusScope, qt as CircleAlert, r as TabsList, rt as createSlot, s as StatusBadge, st as useComposedRefs, t as Tabs, u as CopyableText, ut as AlertDescription, v as useWorkflowStreams, wt as EventListView, x as fetchSpanDetailResource, y as readStream, z as Presence, zt as deriveRunPayloadKeys } from "./tabs-B6B88IjT.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(env, 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(fetchEvents(env, runId, {
|
|
578
|
+
sortOrder: "desc",
|
|
579
|
+
limit: 1,
|
|
580
|
+
withData: false
|
|
581
|
+
})).then(({ error, result }) => {
|
|
582
|
+
if (!ignore && !error) setTerminalReason(getCancellationReason(result.data));
|
|
583
|
+
});
|
|
584
|
+
return () => {
|
|
585
|
+
ignore = true;
|
|
586
|
+
};
|
|
587
|
+
}, [
|
|
588
|
+
env,
|
|
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 = 100;
|
|
597
|
+
var LOAD_MORE_PAGE_SIZE = 100;
|
|
598
|
+
/**
|
|
599
|
+
* Max pages when fetching correlation ID search results (100 events/page).
|
|
600
|
+
*
|
|
601
|
+
* Kept low for the storage read path, which filters server-side and so can
|
|
602
|
+
* cost considerably more to produce a page than the page returns. The
|
|
603
|
+
* previous 30 was sized for the analytics path, where the same scan was
|
|
604
|
+
* much cheaper.
|
|
605
|
+
*/
|
|
606
|
+
var MAX_CORRELATION_SEARCH_PAGES = 5;
|
|
607
|
+
/**
|
|
608
|
+
* Independent event fetching for the Events tab.
|
|
609
|
+
* Separate from the trace viewer's events so sort order changes
|
|
610
|
+
* don't affect the trace viewer.
|
|
611
|
+
*/
|
|
612
|
+
function useEventsListData(env, runId, options = {}) {
|
|
613
|
+
const { sortOrder = "asc", encryptionKey, enabled = true } = options;
|
|
614
|
+
const [events, setEvents] = (0, import_react.useState)([]);
|
|
615
|
+
const [loading, setLoading] = (0, import_react.useState)(true);
|
|
616
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
617
|
+
const [cursor, setCursor] = (0, import_react.useState)();
|
|
618
|
+
const [hasMore, setHasMore] = (0, import_react.useState)(false);
|
|
619
|
+
const [loadingMore, setLoadingMore] = (0, import_react.useState)(false);
|
|
620
|
+
const isFetchingRef = (0, import_react.useRef)(false);
|
|
621
|
+
const encryptionKeyRef = (0, import_react.useRef)(encryptionKey);
|
|
622
|
+
encryptionKeyRef.current = encryptionKey;
|
|
623
|
+
const hydrateEvents = (0, import_react.useCallback)(async (rawEvents) => {
|
|
624
|
+
const key = encryptionKeyRef.current;
|
|
625
|
+
return Promise.all(rawEvents.map((ev) => hydrateResourceIOAsync(ev, key)));
|
|
626
|
+
}, []);
|
|
627
|
+
const fetchInitial = (0, import_react.useCallback)(async () => {
|
|
628
|
+
if (isFetchingRef.current) return;
|
|
629
|
+
isFetchingRef.current = true;
|
|
630
|
+
setLoading(true);
|
|
631
|
+
setError(null);
|
|
632
|
+
setEvents([]);
|
|
633
|
+
setCursor(void 0);
|
|
634
|
+
setHasMore(false);
|
|
635
|
+
try {
|
|
636
|
+
const { error: fetchError, result } = await unwrapServerActionResult(fetchEvents(env, runId, {
|
|
637
|
+
sortOrder,
|
|
638
|
+
limit: INITIAL_PAGE_SIZE,
|
|
639
|
+
withData: false
|
|
640
|
+
}));
|
|
641
|
+
if (fetchError) setError(fetchError);
|
|
642
|
+
else {
|
|
643
|
+
setEvents(await hydrateEvents(result.data));
|
|
644
|
+
setCursor(result.hasMore ? result.cursor : void 0);
|
|
645
|
+
setHasMore(Boolean(result.hasMore));
|
|
646
|
+
}
|
|
647
|
+
} catch (err) {
|
|
648
|
+
setError(err);
|
|
649
|
+
} finally {
|
|
650
|
+
setLoading(false);
|
|
651
|
+
isFetchingRef.current = false;
|
|
652
|
+
}
|
|
653
|
+
}, [
|
|
654
|
+
env,
|
|
655
|
+
runId,
|
|
656
|
+
sortOrder,
|
|
657
|
+
hydrateEvents
|
|
658
|
+
]);
|
|
659
|
+
(0, import_react.useEffect)(() => {
|
|
660
|
+
if (enabled) fetchInitial();
|
|
661
|
+
}, [fetchInitial, enabled]);
|
|
662
|
+
(0, import_react.useEffect)(() => {
|
|
663
|
+
if (!encryptionKey || events.length === 0) return;
|
|
664
|
+
let cancelled = false;
|
|
665
|
+
Promise.all(events.map((ev) => hydrateResourceIOAsync(ev, encryptionKey))).then((decrypted) => {
|
|
666
|
+
if (!cancelled) setEvents(decrypted);
|
|
667
|
+
}).catch(() => {});
|
|
668
|
+
return () => {
|
|
669
|
+
cancelled = true;
|
|
670
|
+
};
|
|
671
|
+
}, [encryptionKey]);
|
|
672
|
+
return {
|
|
673
|
+
events,
|
|
674
|
+
loading,
|
|
675
|
+
error,
|
|
676
|
+
hasMore,
|
|
677
|
+
loadingMore,
|
|
678
|
+
loadMore: (0, import_react.useCallback)(async () => {
|
|
679
|
+
if (loadingMore || !cursor) return;
|
|
680
|
+
setLoadingMore(true);
|
|
681
|
+
try {
|
|
682
|
+
const { error: fetchError, result } = await unwrapServerActionResult(fetchEvents(env, runId, {
|
|
683
|
+
cursor,
|
|
684
|
+
sortOrder,
|
|
685
|
+
limit: LOAD_MORE_PAGE_SIZE,
|
|
686
|
+
withData: false
|
|
687
|
+
}));
|
|
688
|
+
if (fetchError) setError(fetchError);
|
|
689
|
+
else {
|
|
690
|
+
if (result.data.length > 0) {
|
|
691
|
+
const hydrated = await hydrateEvents(result.data);
|
|
692
|
+
setEvents((prev) => [...prev, ...hydrated]);
|
|
693
|
+
}
|
|
694
|
+
setCursor(result.hasMore ? result.cursor : void 0);
|
|
695
|
+
setHasMore(Boolean(result.hasMore));
|
|
696
|
+
}
|
|
697
|
+
} catch (err) {
|
|
698
|
+
setError(err);
|
|
699
|
+
} finally {
|
|
700
|
+
setLoadingMore(false);
|
|
701
|
+
}
|
|
702
|
+
}, [
|
|
703
|
+
env,
|
|
704
|
+
runId,
|
|
705
|
+
sortOrder,
|
|
706
|
+
cursor,
|
|
707
|
+
loadingMore,
|
|
708
|
+
hydrateEvents
|
|
709
|
+
]),
|
|
710
|
+
searchByExactId: (0, import_react.useCallback)(async (id, kind, signal) => {
|
|
711
|
+
if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
712
|
+
if (kind === "event") {
|
|
713
|
+
const { error: fetchError, result } = await unwrapServerActionResult(fetchEvent(env, runId, id, "none"));
|
|
714
|
+
if (fetchError || signal?.aborted) return fetchError ? {
|
|
715
|
+
status: "error",
|
|
716
|
+
message: fetchError.message
|
|
717
|
+
} : (() => {
|
|
718
|
+
throw new DOMException("Aborted", "AbortError");
|
|
719
|
+
})();
|
|
720
|
+
const [event] = await hydrateEvents([result]);
|
|
721
|
+
return event?.runId === runId ? {
|
|
722
|
+
status: "ok",
|
|
723
|
+
events: [event]
|
|
724
|
+
} : { status: "not_found" };
|
|
725
|
+
}
|
|
726
|
+
const matched = [];
|
|
727
|
+
let nextCursor;
|
|
728
|
+
let pagesFetched = 0;
|
|
729
|
+
let truncated = false;
|
|
730
|
+
do {
|
|
731
|
+
if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
732
|
+
const { error: fetchError, result } = await unwrapServerActionResult(fetchEventsByCorrelationId(env, id, {
|
|
733
|
+
cursor: nextCursor,
|
|
734
|
+
sortOrder,
|
|
735
|
+
limit: 100,
|
|
736
|
+
withData: false,
|
|
737
|
+
runId
|
|
738
|
+
}));
|
|
739
|
+
if (fetchError) return {
|
|
740
|
+
status: "error",
|
|
741
|
+
message: fetchError.message
|
|
742
|
+
};
|
|
743
|
+
if (signal?.aborted) throw new DOMException("Aborted", "AbortError");
|
|
744
|
+
pagesFetched += 1;
|
|
745
|
+
const hydrated = await hydrateEvents(result.data);
|
|
746
|
+
matched.push(...hydrated.filter((event) => event.runId === runId));
|
|
747
|
+
const hitPageCap = pagesFetched >= MAX_CORRELATION_SEARCH_PAGES;
|
|
748
|
+
truncated = truncated || hitPageCap && Boolean(result.hasMore && result.cursor);
|
|
749
|
+
nextCursor = !hitPageCap && result.hasMore && result.cursor ? result.cursor : void 0;
|
|
750
|
+
} while (nextCursor);
|
|
751
|
+
return matched.length > 0 ? {
|
|
752
|
+
status: "ok",
|
|
753
|
+
events: matched,
|
|
754
|
+
truncated: truncated || void 0
|
|
755
|
+
} : { status: "not_found" };
|
|
756
|
+
}, [
|
|
757
|
+
env,
|
|
758
|
+
runId,
|
|
759
|
+
sortOrder,
|
|
760
|
+
hydrateEvents
|
|
761
|
+
])
|
|
762
|
+
};
|
|
763
|
+
}
|
|
764
|
+
// app/lib/hooks/use-stream-reader.ts
|
|
765
|
+
var FRAME_HEADER_SIZE = 4;
|
|
766
|
+
var ENCRYPTED_PLACEHOLDER = "[Encrypted]";
|
|
767
|
+
var POLL_INTERVAL_MS = 3e3;
|
|
768
|
+
function isRunActive(status) {
|
|
769
|
+
return status === "pending" || status === "running";
|
|
770
|
+
}
|
|
771
|
+
var yieldToMain = () => new Promise((resolve) => setTimeout(resolve, 0));
|
|
772
|
+
var YIELD_EVERY_N_FRAMES = 64;
|
|
773
|
+
function detectEncoding(data) {
|
|
774
|
+
if (data.length < FRAME_HEADER_SIZE) return "framed";
|
|
775
|
+
const len = new DataView(data.buffer, data.byteOffset, data.byteLength).getUint32(0, false);
|
|
776
|
+
if (len > 0 && len <= 10485760) return "framed";
|
|
777
|
+
return "legacy";
|
|
778
|
+
}
|
|
779
|
+
function useStreamReader(env, streamId, runId, encryptionKey, runStatus) {
|
|
780
|
+
const [chunks, setChunks] = (0, import_react.useState)([]);
|
|
781
|
+
const [isLive, setIsLive] = (0, import_react.useState)(false);
|
|
782
|
+
const [isInitialLoading, setIsInitialLoading] = (0, import_react.useState)(Boolean(streamId && runId));
|
|
783
|
+
const [error, setError] = (0, import_react.useState)(null);
|
|
784
|
+
const abortControllerRef = (0, import_react.useRef)(null);
|
|
785
|
+
const chunkIdRef = (0, import_react.useRef)(0);
|
|
786
|
+
const frameCountRef = (0, import_react.useRef)(0);
|
|
787
|
+
const pollTimerRef = (0, import_react.useRef)(null);
|
|
788
|
+
const runStatusRef = (0, import_react.useRef)(runStatus);
|
|
789
|
+
runStatusRef.current = runStatus;
|
|
790
|
+
const serverCursorRef = (0, import_react.useRef)(null);
|
|
791
|
+
const processFrame = (0, import_react.useCallback)(async (rawFrame, cryptoKey, revivers) => {
|
|
792
|
+
let frameData = rawFrame;
|
|
793
|
+
if (frameData.length >= 8 && !isEncryptedData(frameData)) {
|
|
794
|
+
const innerLen = new DataView(frameData.buffer, frameData.byteOffset, frameData.byteLength).getUint32(0, false);
|
|
795
|
+
if (innerLen > 0 && innerLen <= 10485760 && innerLen === frameData.length - FRAME_HEADER_SIZE) frameData = frameData.slice(FRAME_HEADER_SIZE);
|
|
796
|
+
}
|
|
797
|
+
let hydrated;
|
|
798
|
+
try {
|
|
799
|
+
if (isEncryptedData(frameData)) {
|
|
800
|
+
if (!cryptoKey) return { encrypted: true };
|
|
801
|
+
hydrated = hydrateData(await decrypt(frameData, cryptoKey), revivers);
|
|
802
|
+
} else hydrated = hydrateData(frameData, revivers);
|
|
803
|
+
} catch {
|
|
804
|
+
hydrated = ENCRYPTED_PLACEHOLDER;
|
|
805
|
+
}
|
|
806
|
+
return {
|
|
807
|
+
encrypted: false,
|
|
808
|
+
chunk: {
|
|
809
|
+
id: chunkIdRef.current++,
|
|
810
|
+
value: hydrated
|
|
811
|
+
}
|
|
812
|
+
};
|
|
813
|
+
}, []);
|
|
814
|
+
(0, import_react.useEffect)(() => {
|
|
815
|
+
setChunks([]);
|
|
816
|
+
setError(null);
|
|
817
|
+
setIsLive(false);
|
|
818
|
+
setIsInitialLoading(Boolean(streamId && runId));
|
|
819
|
+
chunkIdRef.current = 0;
|
|
820
|
+
frameCountRef.current = 0;
|
|
821
|
+
serverCursorRef.current = null;
|
|
822
|
+
if (pollTimerRef.current) {
|
|
823
|
+
clearTimeout(pollTimerRef.current);
|
|
824
|
+
pollTimerRef.current = null;
|
|
825
|
+
}
|
|
826
|
+
if (!streamId || !runId) {
|
|
827
|
+
setIsInitialLoading(false);
|
|
828
|
+
return;
|
|
829
|
+
}
|
|
830
|
+
let mounted = true;
|
|
831
|
+
const abortController = new AbortController();
|
|
832
|
+
abortControllerRef.current = abortController;
|
|
833
|
+
const revivers = getWebRevivers();
|
|
834
|
+
const parseLegacyLine = (line) => {
|
|
835
|
+
const chunkId = chunkIdRef.current++;
|
|
836
|
+
let value;
|
|
837
|
+
try {
|
|
838
|
+
value = JSON.parse(line);
|
|
839
|
+
} catch {
|
|
840
|
+
value = line;
|
|
841
|
+
}
|
|
842
|
+
return {
|
|
843
|
+
id: chunkId,
|
|
844
|
+
value
|
|
845
|
+
};
|
|
846
|
+
};
|
|
847
|
+
/**
|
|
848
|
+
* Fetch stream data and parse frames.
|
|
849
|
+
*
|
|
850
|
+
* When `cursor` is provided, the server only returns chunks after that
|
|
851
|
+
* position (incremental fetch). `skipFrames` skips N frames from the
|
|
852
|
+
* response to handle the overlap from cursor-based pagination.
|
|
853
|
+
*/
|
|
854
|
+
const fetchAndParse = async (targetBuffer, cryptoKey, options) => {
|
|
855
|
+
const streamResponse = await readStream(env, streamId, runId, abortController.signal, options?.cursor);
|
|
856
|
+
const skipFrames = options?.skipFrames ?? 0;
|
|
857
|
+
const reader = streamResponse.body.getReader();
|
|
858
|
+
const decoder = new TextDecoder();
|
|
859
|
+
let buffer = /* @__PURE__ */ new Uint8Array(0);
|
|
860
|
+
let encoding = null;
|
|
861
|
+
let textRemainder = "";
|
|
862
|
+
let frameIndex = 0;
|
|
863
|
+
const appendToBuffer = (data) => {
|
|
864
|
+
const newBuffer = new Uint8Array(buffer.length + data.length);
|
|
865
|
+
newBuffer.set(buffer, 0);
|
|
866
|
+
newBuffer.set(data, buffer.length);
|
|
867
|
+
buffer = newBuffer;
|
|
868
|
+
};
|
|
869
|
+
for (;;) {
|
|
870
|
+
if (abortController.signal.aborted) break;
|
|
871
|
+
const { value, done } = await reader.read();
|
|
872
|
+
if (done) {
|
|
873
|
+
if (encoding === "legacy" && textRemainder.trim()) {
|
|
874
|
+
frameIndex++;
|
|
875
|
+
if (frameIndex > skipFrames) targetBuffer.push(parseLegacyLine(textRemainder.trim()));
|
|
876
|
+
textRemainder = "";
|
|
877
|
+
}
|
|
878
|
+
break;
|
|
879
|
+
}
|
|
880
|
+
if (encoding === null) {
|
|
881
|
+
appendToBuffer(value);
|
|
882
|
+
if (buffer.length >= FRAME_HEADER_SIZE) encoding = detectEncoding(buffer);
|
|
883
|
+
if (encoding === "legacy") {
|
|
884
|
+
textRemainder = decoder.decode(buffer, { stream: true });
|
|
885
|
+
buffer = /* @__PURE__ */ new Uint8Array(0);
|
|
886
|
+
}
|
|
887
|
+
} else if (encoding === "legacy") textRemainder += decoder.decode(value, { stream: true });
|
|
888
|
+
else appendToBuffer(value);
|
|
889
|
+
if (encoding === "legacy") {
|
|
890
|
+
const lines = textRemainder.split("\n");
|
|
891
|
+
textRemainder = lines.pop() ?? "";
|
|
892
|
+
for (const line of lines) {
|
|
893
|
+
const trimmed = line.trim();
|
|
894
|
+
if (trimmed) {
|
|
895
|
+
frameIndex++;
|
|
896
|
+
if (frameIndex > skipFrames) targetBuffer.push(parseLegacyLine(trimmed));
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
continue;
|
|
900
|
+
}
|
|
901
|
+
let offset = 0;
|
|
902
|
+
let framesInBatch = 0;
|
|
903
|
+
while (offset + FRAME_HEADER_SIZE <= buffer.length) {
|
|
904
|
+
const frameLength = new DataView(buffer.buffer, buffer.byteOffset + offset, buffer.byteLength - offset).getUint32(0, false);
|
|
905
|
+
if (frameLength === 0 || frameLength > 10485760) break;
|
|
906
|
+
if (offset + FRAME_HEADER_SIZE + frameLength > buffer.length) break;
|
|
907
|
+
const frameData = buffer.slice(offset + FRAME_HEADER_SIZE, offset + FRAME_HEADER_SIZE + frameLength);
|
|
908
|
+
offset += FRAME_HEADER_SIZE + frameLength;
|
|
909
|
+
frameIndex++;
|
|
910
|
+
if (frameIndex <= skipFrames) continue;
|
|
911
|
+
const result = await processFrame(frameData, cryptoKey, revivers);
|
|
912
|
+
if (result.encrypted) {
|
|
913
|
+
reader.cancel().catch(() => {});
|
|
914
|
+
return { encrypted: true };
|
|
915
|
+
}
|
|
916
|
+
targetBuffer.push(result.chunk);
|
|
917
|
+
framesInBatch++;
|
|
918
|
+
if (framesInBatch % YIELD_EVERY_N_FRAMES === 0) {
|
|
919
|
+
await yieldToMain();
|
|
920
|
+
if (abortController.signal.aborted || !mounted) break;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
buffer = buffer.slice(offset);
|
|
924
|
+
}
|
|
925
|
+
return {
|
|
926
|
+
encrypted: false,
|
|
927
|
+
frameCount: frameIndex,
|
|
928
|
+
cursor: streamResponse.cursor,
|
|
929
|
+
done: streamResponse.done
|
|
930
|
+
};
|
|
931
|
+
};
|
|
932
|
+
const readStreamData = async () => {
|
|
933
|
+
try {
|
|
934
|
+
const cryptoKey = encryptionKey ? await deriveRunPayloadKeys(encryptionKey) : void 0;
|
|
935
|
+
const initialChunks = [];
|
|
936
|
+
const result = await fetchAndParse(initialChunks, cryptoKey);
|
|
937
|
+
if (result.encrypted) {
|
|
938
|
+
if (mounted) {
|
|
939
|
+
setError("This stream is encrypted. Click Decrypt to view.");
|
|
940
|
+
setIsLive(false);
|
|
941
|
+
setIsInitialLoading(false);
|
|
942
|
+
}
|
|
943
|
+
return;
|
|
944
|
+
}
|
|
945
|
+
frameCountRef.current = result.frameCount;
|
|
946
|
+
serverCursorRef.current = result.cursor;
|
|
947
|
+
if (!mounted || abortController.signal.aborted) return;
|
|
948
|
+
setChunks(initialChunks);
|
|
949
|
+
setIsInitialLoading(false);
|
|
950
|
+
if (result.done) {
|
|
951
|
+
setIsLive(false);
|
|
952
|
+
return;
|
|
953
|
+
}
|
|
954
|
+
if (isRunActive(runStatusRef.current)) {
|
|
955
|
+
setIsLive(true);
|
|
956
|
+
const poll = async () => {
|
|
957
|
+
if (!mounted || abortController.signal.aborted) return;
|
|
958
|
+
try {
|
|
959
|
+
const newChunks = [];
|
|
960
|
+
const pollResult = await fetchAndParse(newChunks, cryptoKey, {
|
|
961
|
+
cursor: serverCursorRef.current,
|
|
962
|
+
skipFrames: frameCountRef.current
|
|
963
|
+
});
|
|
964
|
+
if (!pollResult.encrypted) {
|
|
965
|
+
frameCountRef.current = pollResult.frameCount;
|
|
966
|
+
if (pollResult.cursor) serverCursorRef.current = pollResult.cursor;
|
|
967
|
+
if (newChunks.length > 0 && mounted) setChunks((prev) => [...prev, ...newChunks]);
|
|
968
|
+
if (pollResult.done) {
|
|
969
|
+
setIsLive(false);
|
|
970
|
+
return;
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
} catch (err) {
|
|
974
|
+
console.warn("Stream poll error:", err);
|
|
975
|
+
}
|
|
976
|
+
if (mounted && !abortController.signal.aborted) pollTimerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
977
|
+
};
|
|
978
|
+
pollTimerRef.current = setTimeout(poll, POLL_INTERVAL_MS);
|
|
979
|
+
} else setIsLive(false);
|
|
980
|
+
} catch (err) {
|
|
981
|
+
if (abortController.signal.aborted) return;
|
|
982
|
+
if (mounted) {
|
|
983
|
+
setError(err instanceof Error ? err.message : String(err));
|
|
984
|
+
setIsLive(false);
|
|
985
|
+
setIsInitialLoading(false);
|
|
986
|
+
}
|
|
987
|
+
}
|
|
988
|
+
};
|
|
989
|
+
readStreamData();
|
|
990
|
+
return () => {
|
|
991
|
+
mounted = false;
|
|
992
|
+
abortController.abort();
|
|
993
|
+
if (pollTimerRef.current) {
|
|
994
|
+
clearTimeout(pollTimerRef.current);
|
|
995
|
+
pollTimerRef.current = null;
|
|
996
|
+
}
|
|
997
|
+
};
|
|
998
|
+
}, [
|
|
999
|
+
env,
|
|
1000
|
+
streamId,
|
|
1001
|
+
runId,
|
|
1002
|
+
encryptionKey,
|
|
1003
|
+
processFrame
|
|
1004
|
+
]);
|
|
1005
|
+
(0, import_react.useEffect)(() => {
|
|
1006
|
+
if (!isRunActive(runStatus) && pollTimerRef.current) {
|
|
1007
|
+
clearTimeout(pollTimerRef.current);
|
|
1008
|
+
pollTimerRef.current = null;
|
|
1009
|
+
setIsLive(false);
|
|
1010
|
+
}
|
|
1011
|
+
}, [runStatus]);
|
|
1012
|
+
return {
|
|
1013
|
+
chunks,
|
|
1014
|
+
isLive,
|
|
1015
|
+
isInitialLoading,
|
|
1016
|
+
error
|
|
1017
|
+
};
|
|
1018
|
+
}
|
|
1019
|
+
// app/components/display-utils/live-status.tsx
|
|
1020
|
+
function LiveStatus({ hasError, errorMessage }) {
|
|
1021
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1022
|
+
className: "flex items-center gap-2",
|
|
1023
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
1024
|
+
asChild: true,
|
|
1025
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1026
|
+
className: "flex items-center gap-1.5",
|
|
1027
|
+
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", {
|
|
1028
|
+
className: `text-xs $
|
|
1029
|
+
hasError
|
|
1030
|
+
? 'text-red-600 dark:text-red-400'
|
|
1031
|
+
: 'text-muted-foreground'`,
|
|
1032
|
+
children: hasError ? "Error" : "Live"
|
|
1033
|
+
})]
|
|
1034
|
+
})
|
|
1035
|
+
}), /* @__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 / 1e3} seconds` }) })] })
|
|
1036
|
+
});
|
|
1037
|
+
}
|
|
1038
|
+
// app/components/run-detail-view.tsx
|
|
1039
|
+
var TABS = [
|
|
1040
|
+
"trace",
|
|
1041
|
+
"events",
|
|
1042
|
+
"streams"
|
|
1043
|
+
];
|
|
1044
|
+
function RunDetailView({ runId, selectedId: _selectedId }) {
|
|
1045
|
+
const navigate = useNavigate();
|
|
1046
|
+
const [searchParams] = useSearchParams();
|
|
1047
|
+
const [cancelling, setCancelling] = (0, import_react.useState)(false);
|
|
1048
|
+
const [rerunning, setRerunning] = (0, import_react.useState)(false);
|
|
1049
|
+
const [showCancelDialog, setShowCancelDialog] = (0, import_react.useState)(false);
|
|
1050
|
+
const [showRerunDialog, setShowRerunDialog] = (0, import_react.useState)(false);
|
|
1051
|
+
const env = (0, import_react.useMemo)(() => ({}), []);
|
|
1052
|
+
const activeTab = TABS.find((tab) => tab === searchParams.get("tab")) ?? "trace";
|
|
1053
|
+
const selectedStreamId = searchParams.get("streamId");
|
|
1054
|
+
const updateSearchParams = (0, import_react.useCallback)((updates) => {
|
|
1055
|
+
const params = new URLSearchParams(searchParams.toString());
|
|
1056
|
+
for (const [key, value] of Object.entries(updates)) if (value === null) params.delete(key);
|
|
1057
|
+
else params.set(key, value);
|
|
1058
|
+
navigate(`?${params.toString()}`, { preventScrollReset: true });
|
|
1059
|
+
}, [navigate, searchParams]);
|
|
1060
|
+
const setActiveTab = (0, import_react.useCallback)((tab) => {
|
|
1061
|
+
if (tab !== "streams") updateSearchParams({
|
|
1062
|
+
tab,
|
|
1063
|
+
streamId: null
|
|
1064
|
+
});
|
|
1065
|
+
else updateSearchParams({ tab });
|
|
1066
|
+
}, [updateSearchParams]);
|
|
1067
|
+
const setSelectedStreamId = (0, import_react.useCallback)((streamId) => {
|
|
1068
|
+
updateSearchParams({ streamId });
|
|
1069
|
+
}, [updateSearchParams]);
|
|
1070
|
+
const handleStreamClick = (0, import_react.useCallback)((streamId) => {
|
|
1071
|
+
updateSearchParams({
|
|
1072
|
+
tab: "streams",
|
|
1073
|
+
streamId
|
|
1074
|
+
});
|
|
1075
|
+
}, [updateSearchParams]);
|
|
1076
|
+
const handleRunRefClick = (0, import_react.useCallback)((targetRunId) => {
|
|
1077
|
+
navigate(`/run/${encodeURIComponent(targetRunId)}`);
|
|
1078
|
+
}, [navigate]);
|
|
1079
|
+
const handleWakeUpSleep = (0, import_react.useCallback)(async (runId, correlationId) => {
|
|
1080
|
+
return wakeUpRun(env, runId, { correlationIds: [correlationId] });
|
|
1081
|
+
}, [env]);
|
|
1082
|
+
const encryptionKeyRef = (0, import_react.useRef)(null);
|
|
1083
|
+
const handleResolveHook = (0, import_react.useCallback)(async (hookToken, payload) => {
|
|
1084
|
+
await resumeHook(env, hookToken, payload);
|
|
1085
|
+
}, [env]);
|
|
1086
|
+
const handleLoadEventData = (0, import_react.useCallback)(async (event) => {
|
|
1087
|
+
const { error, result } = await unwrapServerActionResult(fetchEvent(env, event.runId, event.eventId, "all"));
|
|
1088
|
+
if (error) throw error;
|
|
1089
|
+
const fullEvent = await hydrateResourceIOAsync(result, encryptionKeyRef.current ?? void 0);
|
|
1090
|
+
if ("eventData" in fullEvent) return fullEvent.eventData;
|
|
1091
|
+
return null;
|
|
1092
|
+
}, [env]);
|
|
1093
|
+
const { run: runData, events: allEvents, loading, error, update, hasEncryptedData, loadMoreTraceData, hasMoreTraceData, isLoadingMoreTraceData } = useWorkflowTraceViewerData(env, runId, { live: true });
|
|
1094
|
+
const run = runData ?? {};
|
|
1095
|
+
const cancelReason = useCancellationReason(env, runId, run.status, allEvents);
|
|
1096
|
+
const [encryptionKey, setEncryptionKey] = (0, import_react.useState)(null);
|
|
1097
|
+
encryptionKeyRef.current = encryptionKey;
|
|
1098
|
+
const [eventsSortOrder, setEventsSortOrder] = (0, import_react.useState)("asc");
|
|
1099
|
+
const { events: eventsListData, loading: eventsListLoading, hasMore: hasMoreEventsTab, loadingMore: loadingMoreEventsTab, loadMore: loadMoreEventsTab, searchByExactId } = useEventsListData(env, runId, {
|
|
1100
|
+
sortOrder: eventsSortOrder,
|
|
1101
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
1102
|
+
enabled: activeTab === "events"
|
|
1103
|
+
});
|
|
1104
|
+
const fetchSpanDetail = (0, import_react.useCallback)((selection) => fetchSpanDetailResource(env, selection, { encryptionKey: encryptionKey ?? void 0 }), [env, encryptionKey]);
|
|
1105
|
+
const [isDecrypting, setIsDecrypting] = (0, import_react.useState)(false);
|
|
1106
|
+
const handleDecrypt = (0, import_react.useCallback)(async () => {
|
|
1107
|
+
if (encryptionKey) return;
|
|
1108
|
+
setIsDecrypting(true);
|
|
1109
|
+
try {
|
|
1110
|
+
const { error: keyError, result: keyResult } = await unwrapServerActionResult(getEncryptionKeyForRun(env, runId));
|
|
1111
|
+
if (keyError) {
|
|
1112
|
+
toast.error(`Failed to fetch encryption key: ${keyError.message}`);
|
|
1113
|
+
return;
|
|
1114
|
+
}
|
|
1115
|
+
if (!keyResult) {
|
|
1116
|
+
toast.error("Encryption is not configured for this deployment.");
|
|
1117
|
+
return;
|
|
1118
|
+
}
|
|
1119
|
+
setEncryptionKey(keyResult);
|
|
1120
|
+
} finally {
|
|
1121
|
+
setIsDecrypting(false);
|
|
1122
|
+
}
|
|
1123
|
+
}, [
|
|
1124
|
+
encryptionKey,
|
|
1125
|
+
env,
|
|
1126
|
+
runId
|
|
1127
|
+
]);
|
|
1128
|
+
const sidebarData = (0, import_react.useMemo)(() => ({
|
|
1129
|
+
run,
|
|
1130
|
+
events: allEvents ?? [],
|
|
1131
|
+
fetchSpanDetail,
|
|
1132
|
+
onStreamClick: handleStreamClick,
|
|
1133
|
+
onRunClick: handleRunRefClick,
|
|
1134
|
+
onWakeUpSleep: handleWakeUpSleep,
|
|
1135
|
+
onLoadEventData: handleLoadEventData,
|
|
1136
|
+
onResolveHook: handleResolveHook,
|
|
1137
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
1138
|
+
onDecrypt: handleDecrypt,
|
|
1139
|
+
isDecrypting,
|
|
1140
|
+
hasEncryptedData
|
|
1141
|
+
}), [
|
|
1142
|
+
run,
|
|
1143
|
+
allEvents,
|
|
1144
|
+
fetchSpanDetail,
|
|
1145
|
+
handleStreamClick,
|
|
1146
|
+
handleRunRefClick,
|
|
1147
|
+
handleWakeUpSleep,
|
|
1148
|
+
handleLoadEventData,
|
|
1149
|
+
handleResolveHook,
|
|
1150
|
+
encryptionKey,
|
|
1151
|
+
handleDecrypt,
|
|
1152
|
+
isDecrypting,
|
|
1153
|
+
hasEncryptedData
|
|
1154
|
+
]);
|
|
1155
|
+
const { streams, loading: streamsLoading, error: streamsError } = useWorkflowStreams(env, runId);
|
|
1156
|
+
const { chunks: streamChunks, isLive: streamIsLive, isInitialLoading: streamIsInitialLoading, error: streamError } = useStreamReader(env, selectedStreamId, runId, encryptionKey, run.status);
|
|
1157
|
+
const handleCancelClick = () => {
|
|
1158
|
+
setShowCancelDialog(true);
|
|
1159
|
+
};
|
|
1160
|
+
const handleConfirmCancel = async () => {
|
|
1161
|
+
if (cancelling) return;
|
|
1162
|
+
try {
|
|
1163
|
+
setCancelling(true);
|
|
1164
|
+
setShowCancelDialog(false);
|
|
1165
|
+
await cancelRun(env, runId);
|
|
1166
|
+
await update();
|
|
1167
|
+
toast.success("Run cancelled");
|
|
1168
|
+
} catch (err) {
|
|
1169
|
+
console.error("Failed to cancel run:", err);
|
|
1170
|
+
toast.error("Failed to cancel run", { description: err instanceof Error ? err.message : "An unknown error occurred" });
|
|
1171
|
+
} finally {
|
|
1172
|
+
setCancelling(false);
|
|
1173
|
+
}
|
|
1174
|
+
};
|
|
1175
|
+
const isDynamicRun = Boolean(run.executionContext?.dynamicWorkflow);
|
|
1176
|
+
const handleRerunClick = () => {
|
|
1177
|
+
if (isDynamicRun) return;
|
|
1178
|
+
setShowRerunDialog(true);
|
|
1179
|
+
};
|
|
1180
|
+
const handleConfirmRerun = async () => {
|
|
1181
|
+
if (rerunning || isDynamicRun) return;
|
|
1182
|
+
try {
|
|
1183
|
+
setRerunning(true);
|
|
1184
|
+
setShowRerunDialog(false);
|
|
1185
|
+
const newRunId = await recreateRun(env, run.runId);
|
|
1186
|
+
toast.success("New run started", { description: `Run ID: ${newRunId}` });
|
|
1187
|
+
navigate(`/run/${newRunId}`);
|
|
1188
|
+
} catch (err) {
|
|
1189
|
+
console.error("Failed to re-run workflow:", err);
|
|
1190
|
+
toast.error("Failed to start new run", { description: err instanceof Error ? err.message : "An unknown error occurred" });
|
|
1191
|
+
} finally {
|
|
1192
|
+
setRerunning(false);
|
|
1193
|
+
setShowRerunDialog(false);
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
if (error && !runData) return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Alert, {
|
|
1197
|
+
variant: "destructive",
|
|
1198
|
+
className: "m-4",
|
|
1199
|
+
children: [
|
|
1200
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleAlert, { className: "h-4 w-4" }),
|
|
1201
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertTitle, { children: getErrorTitle(error, "Error loading workflow run") }),
|
|
1202
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDescription, { children: getErrorMessage(error) })
|
|
1203
|
+
]
|
|
1204
|
+
});
|
|
1205
|
+
const workflowName = parseWorkflowName(run.workflowName)?.shortName;
|
|
1206
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
1207
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, {
|
|
1208
|
+
open: showCancelDialog,
|
|
1209
|
+
onOpenChange: setShowCancelDialog,
|
|
1210
|
+
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, {
|
|
1211
|
+
onClick: handleConfirmCancel,
|
|
1212
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
1213
|
+
children: "Cancel Run"
|
|
1214
|
+
})] })] })
|
|
1215
|
+
}),
|
|
1216
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(AlertDialog, {
|
|
1217
|
+
open: showRerunDialog,
|
|
1218
|
+
onOpenChange: setShowRerunDialog,
|
|
1219
|
+
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, {
|
|
1220
|
+
onClick: handleConfirmRerun,
|
|
1221
|
+
children: "Replay Run"
|
|
1222
|
+
})] })] })
|
|
1223
|
+
}),
|
|
1224
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1225
|
+
className: "flex flex-col h-[calc(100vh-97px)]",
|
|
1226
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1227
|
+
className: "flex-none space-y-4",
|
|
1228
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Breadcrumb, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(BreadcrumbList, { children: [
|
|
1229
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbLink, {
|
|
1230
|
+
asChild: true,
|
|
1231
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Link, {
|
|
1232
|
+
to: "/",
|
|
1233
|
+
children: "Runs"
|
|
1234
|
+
})
|
|
1235
|
+
}) }),
|
|
1236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbSeparator, {}),
|
|
1237
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(BreadcrumbPage, {
|
|
1238
|
+
className: "font-mono text-xs",
|
|
1239
|
+
children: runId
|
|
1240
|
+
}) })
|
|
1241
|
+
] }) }), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1242
|
+
className: "space-y-4 p-6 border rounded-lg",
|
|
1243
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1244
|
+
className: "flex items-start justify-between",
|
|
1245
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1246
|
+
className: "mb-4",
|
|
1247
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", {
|
|
1248
|
+
className: "text-xl font-semibold",
|
|
1249
|
+
children: workflowName ? workflowName : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[260px] h-[28px]" })
|
|
1250
|
+
})
|
|
1251
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1252
|
+
className: "flex items-center justify-between gap-2",
|
|
1253
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(LiveStatus, {
|
|
1254
|
+
hasError: false,
|
|
1255
|
+
errorMessage: ""
|
|
1256
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunActionsButtons, {
|
|
1257
|
+
env,
|
|
1258
|
+
runId,
|
|
1259
|
+
runStatus: run.status,
|
|
1260
|
+
events: allEvents,
|
|
1261
|
+
eventsLoading: loading,
|
|
1262
|
+
loading,
|
|
1263
|
+
replayDisabledReason: isDynamicRun ? "Dynamic runs cannot be replayed as a new run." : void 0,
|
|
1264
|
+
onRerunClick: handleRerunClick,
|
|
1265
|
+
onCancelClick: handleCancelClick,
|
|
1266
|
+
callbacks: { onSuccess: update }
|
|
1267
|
+
})]
|
|
1268
|
+
})]
|
|
1269
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1270
|
+
className: "flex items-start gap-8",
|
|
1271
|
+
children: [
|
|
1272
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1273
|
+
className: "flex flex-col gap-1",
|
|
1274
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1275
|
+
className: "text-xs text-muted-foreground",
|
|
1276
|
+
children: "Status"
|
|
1277
|
+
}), run.status ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatusBadge, {
|
|
1278
|
+
status: run.status,
|
|
1279
|
+
context: {
|
|
1280
|
+
error: run.error,
|
|
1281
|
+
cancelReason
|
|
1282
|
+
}
|
|
1283
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[55px] h-[24px]" })]
|
|
1284
|
+
}),
|
|
1285
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1286
|
+
className: "flex flex-col gap-1",
|
|
1287
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1288
|
+
className: "text-xs text-muted-foreground",
|
|
1289
|
+
children: "Duration"
|
|
1290
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1291
|
+
className: "text-xs",
|
|
1292
|
+
children: run.runId ? run.startedAt ? (() => {
|
|
1293
|
+
const ms = (run.completedAt ? new Date(run.completedAt).getTime() : Date.now()) - new Date(run.startedAt).getTime();
|
|
1294
|
+
const seconds = Math.floor(ms / 1e3);
|
|
1295
|
+
if (seconds < 60) return `${seconds}s`;
|
|
1296
|
+
const minutes = Math.floor(seconds / 60);
|
|
1297
|
+
const remainingSeconds = seconds % 60;
|
|
1298
|
+
if (minutes < 60) return remainingSeconds > 0 ? `${minutes}m ${remainingSeconds}s` : `${minutes}m`;
|
|
1299
|
+
const hours = Math.floor(minutes / 60);
|
|
1300
|
+
const remainingMinutes = minutes % 60;
|
|
1301
|
+
return remainingMinutes > 0 ? `${hours}h ${remainingMinutes}m` : `${hours}h`;
|
|
1302
|
+
})() : "-" : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[60px] h-[20px]" })
|
|
1303
|
+
})]
|
|
1304
|
+
}),
|
|
1305
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1306
|
+
className: "flex flex-col gap-1",
|
|
1307
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1308
|
+
className: "text-xs text-muted-foreground",
|
|
1309
|
+
children: "Run ID"
|
|
1310
|
+
}), run.runId ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CopyableText, {
|
|
1311
|
+
text: run.runId,
|
|
1312
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1313
|
+
className: "text-xs mt-0.5 font-mono",
|
|
1314
|
+
children: run.runId
|
|
1315
|
+
})
|
|
1316
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[280px] h-[20px]" })]
|
|
1317
|
+
}),
|
|
1318
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1319
|
+
className: "flex flex-col gap-1",
|
|
1320
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1321
|
+
className: "text-xs text-muted-foreground",
|
|
1322
|
+
children: "Queued"
|
|
1323
|
+
}), run.createdAt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1324
|
+
className: "text-xs",
|
|
1325
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.createdAt })
|
|
1326
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "w-[110px] h-[20px]" })]
|
|
1327
|
+
}),
|
|
1328
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1329
|
+
className: "flex flex-col gap-1",
|
|
1330
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1331
|
+
className: "text-xs text-muted-foreground",
|
|
1332
|
+
children: "Started"
|
|
1333
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1334
|
+
className: "text-xs",
|
|
1335
|
+
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]" })
|
|
1336
|
+
})]
|
|
1337
|
+
}),
|
|
1338
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1339
|
+
className: "flex flex-col gap-1",
|
|
1340
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1341
|
+
className: "text-xs text-muted-foreground",
|
|
1342
|
+
children: "Completed"
|
|
1343
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1344
|
+
className: "text-xs",
|
|
1345
|
+
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]" })
|
|
1346
|
+
})]
|
|
1347
|
+
}),
|
|
1348
|
+
run.expiredAt != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1349
|
+
className: "flex flex-col gap-1",
|
|
1350
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tooltip, { children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TooltipTrigger, {
|
|
1351
|
+
asChild: true,
|
|
1352
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1353
|
+
className: "text-xs text-muted-foreground cursor-help flex items-center gap-1",
|
|
1354
|
+
children: ["Expired", /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CircleQuestionMark, { className: "w-3 h-3" })]
|
|
1355
|
+
})
|
|
1356
|
+
}), /* @__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", {
|
|
1357
|
+
className: "text-xs",
|
|
1358
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RelativeTime, { date: run.expiredAt })
|
|
1359
|
+
})]
|
|
1360
|
+
})
|
|
1361
|
+
]
|
|
1362
|
+
})]
|
|
1363
|
+
})]
|
|
1364
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1365
|
+
className: "mt-4 flex-1 flex flex-col min-h-0",
|
|
1366
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(Tabs, {
|
|
1367
|
+
value: activeTab,
|
|
1368
|
+
onValueChange: (v) => setActiveTab(v),
|
|
1369
|
+
className: "flex-1 flex flex-col min-h-0",
|
|
1370
|
+
children: [
|
|
1371
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsList, {
|
|
1372
|
+
className: "mb-4 flex-none",
|
|
1373
|
+
children: [
|
|
1374
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
|
|
1375
|
+
value: "trace",
|
|
1376
|
+
className: "gap-2",
|
|
1377
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { className: "h-4 w-4" }), "Trace"]
|
|
1378
|
+
}),
|
|
1379
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
|
|
1380
|
+
value: "events",
|
|
1381
|
+
className: "gap-2",
|
|
1382
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { className: "h-4 w-4" }), "Events"]
|
|
1383
|
+
}),
|
|
1384
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(TabsTrigger, {
|
|
1385
|
+
value: "streams",
|
|
1386
|
+
className: "gap-2",
|
|
1387
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)(List, { className: "h-4 w-4" }), "Streams"]
|
|
1388
|
+
})
|
|
1389
|
+
]
|
|
1390
|
+
}),
|
|
1391
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
1392
|
+
value: "trace",
|
|
1393
|
+
className: "mt-0 flex-1 min-h-0",
|
|
1394
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1395
|
+
title: "Failed to load trace viewer",
|
|
1396
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1397
|
+
className: "relative h-full -mx-6 bg-background-100 border-t border-gray-alpha-400 overflow-hidden",
|
|
1398
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(TraceViewer, {
|
|
1399
|
+
run,
|
|
1400
|
+
events: allEvents ?? [],
|
|
1401
|
+
loading,
|
|
1402
|
+
sidebarData,
|
|
1403
|
+
onLoadMore: loadMoreTraceData,
|
|
1404
|
+
hasMore: hasMoreTraceData,
|
|
1405
|
+
isLoadingMore: isLoadingMoreTraceData
|
|
1406
|
+
})
|
|
1407
|
+
})
|
|
1408
|
+
})
|
|
1409
|
+
}),
|
|
1410
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
1411
|
+
value: "events",
|
|
1412
|
+
className: "mt-0 flex-1 min-h-0",
|
|
1413
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1414
|
+
title: "Failed to load events list",
|
|
1415
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1416
|
+
className: "h-full",
|
|
1417
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(EventListView, {
|
|
1418
|
+
events: eventsListData,
|
|
1419
|
+
run,
|
|
1420
|
+
onLoadEventData: handleLoadEventData,
|
|
1421
|
+
hasMoreEvents: hasMoreEventsTab,
|
|
1422
|
+
isLoadingMoreEvents: loadingMoreEventsTab,
|
|
1423
|
+
onLoadMoreEvents: loadMoreEventsTab,
|
|
1424
|
+
encryptionKey: encryptionKey ?? void 0,
|
|
1425
|
+
isLoading: eventsListLoading,
|
|
1426
|
+
sortOrder: eventsSortOrder,
|
|
1427
|
+
onSortOrderChange: setEventsSortOrder,
|
|
1428
|
+
onDecrypt: handleDecrypt,
|
|
1429
|
+
isDecrypting,
|
|
1430
|
+
hasEncryptedData,
|
|
1431
|
+
onExactIdSearch: searchByExactId
|
|
1432
|
+
})
|
|
1433
|
+
})
|
|
1434
|
+
})
|
|
1435
|
+
}),
|
|
1436
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(TabsContent, {
|
|
1437
|
+
value: "streams",
|
|
1438
|
+
className: "mt-0 flex-1 min-h-0",
|
|
1439
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1440
|
+
title: "Failed to load stream data",
|
|
1441
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1442
|
+
className: "relative -mx-6 flex h-full min-h-0 overflow-hidden border-t border-gray-alpha-400 bg-background-100",
|
|
1443
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1444
|
+
className: "flex w-[340px] shrink-0 flex-col border-r border-gray-alpha-400 bg-background-100",
|
|
1445
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1446
|
+
"aria-hidden": "true",
|
|
1447
|
+
className: "h-10 min-h-10 border-b border-gray-alpha-400"
|
|
1448
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1449
|
+
className: "min-h-0 flex-1 divide-y divide-gray-400 overflow-y-auto",
|
|
1450
|
+
children: streamsLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1451
|
+
className: "flex flex-col divide-y divide-gray-400",
|
|
1452
|
+
children: [
|
|
1453
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1454
|
+
className: "flex h-10 items-center pl-4 pr-2",
|
|
1455
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-24" })
|
|
1456
|
+
}),
|
|
1457
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1458
|
+
className: "flex h-10 items-center pl-4 pr-2",
|
|
1459
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-32" })
|
|
1460
|
+
}),
|
|
1461
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1462
|
+
className: "flex h-10 items-center pl-4 pr-2",
|
|
1463
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Skeleton, { className: "h-3.5 w-20" })
|
|
1464
|
+
})
|
|
1465
|
+
]
|
|
1466
|
+
}) : streamsError ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1467
|
+
className: "px-4 py-2 text-label-12 text-red-900",
|
|
1468
|
+
children: streamsError.message
|
|
1469
|
+
}) : streams.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1470
|
+
className: "flex h-10 items-center px-4 text-label-12 text-gray-900",
|
|
1471
|
+
children: "No streams found for this run"
|
|
1472
|
+
}) : streams.map((streamId) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", {
|
|
1473
|
+
type: "button",
|
|
1474
|
+
onClick: () => setSelectedStreamId(streamId),
|
|
1475
|
+
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"}`,
|
|
1476
|
+
title: streamId,
|
|
1477
|
+
children: streamId
|
|
1478
|
+
}, streamId))
|
|
1479
|
+
})]
|
|
1480
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1481
|
+
className: "flex min-w-0 flex-1 flex-col overflow-hidden bg-background-100",
|
|
1482
|
+
children: streamsLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1483
|
+
className: "min-h-0 flex-1",
|
|
1484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StreamViewerSkeleton, {})
|
|
1485
|
+
}) : selectedStreamId ? streamError?.includes("encrypted") && !encryptionKey ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1486
|
+
className: "flex h-full items-center justify-center p-4",
|
|
1487
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1488
|
+
className: "flex flex-col items-center gap-3 text-center",
|
|
1489
|
+
children: [
|
|
1490
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Lock, { className: "h-8 w-8 text-gray-700" }),
|
|
1491
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", {
|
|
1492
|
+
className: "space-y-1",
|
|
1493
|
+
children: [/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1494
|
+
className: "text-label-14 font-medium text-gray-1000",
|
|
1495
|
+
children: "Encrypted Stream"
|
|
1496
|
+
}), /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1497
|
+
className: "text-label-12 text-gray-900",
|
|
1498
|
+
children: "Decrypt this stream to view its chunks."
|
|
1499
|
+
})]
|
|
1500
|
+
}),
|
|
1501
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DecryptButton, {
|
|
1502
|
+
onClick: handleDecrypt,
|
|
1503
|
+
loading: isDecrypting
|
|
1504
|
+
})
|
|
1505
|
+
]
|
|
1506
|
+
})
|
|
1507
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1508
|
+
className: "min-h-0 flex-1",
|
|
1509
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StreamViewer, {
|
|
1510
|
+
streamId: selectedStreamId,
|
|
1511
|
+
chunks: streamChunks,
|
|
1512
|
+
isLive: streamIsLive,
|
|
1513
|
+
isLoading: streamIsInitialLoading,
|
|
1514
|
+
error: streamError?.includes("encrypted") ? null : streamError
|
|
1515
|
+
})
|
|
1516
|
+
}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1517
|
+
className: "flex h-full items-center justify-center",
|
|
1518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", {
|
|
1519
|
+
className: "text-label-14 text-gray-600",
|
|
1520
|
+
children: streams.length > 0 ? "Select a stream to view its data" : "No streams available"
|
|
1521
|
+
})
|
|
1522
|
+
})
|
|
1523
|
+
})]
|
|
1524
|
+
})
|
|
1525
|
+
})
|
|
1526
|
+
})
|
|
1527
|
+
]
|
|
1528
|
+
})
|
|
1529
|
+
})]
|
|
1530
|
+
})
|
|
1531
|
+
] });
|
|
1532
|
+
}
|
|
1533
|
+
// app/routes/run-detail.tsx
|
|
1534
|
+
var run_detail_default = withComponentProps(function RunDetailPage() {
|
|
1535
|
+
const params = useParams();
|
|
1536
|
+
const [searchParams] = useSearchParams();
|
|
1537
|
+
const runId = params.runId;
|
|
1538
|
+
const stepId = searchParams.get("stepId");
|
|
1539
|
+
const eventId = searchParams.get("eventId");
|
|
1540
|
+
const hookId = searchParams.get("hookId");
|
|
1541
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ErrorBoundary, {
|
|
1542
|
+
title: "Failed to load run details",
|
|
1543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(RunDetailView, {
|
|
1544
|
+
runId,
|
|
1545
|
+
selectedId: stepId || eventId || hookId || void 0
|
|
1546
|
+
})
|
|
1547
|
+
});
|
|
1548
|
+
});
|
|
1549
|
+
export { run_detail_default as default };
|