@qredence/fleet 0.7.4 → 0.8.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/CHANGELOG.md +17 -0
- package/README.md +5 -4
- package/bin/fleet-prime.mjs +33 -6
- package/bin/prime-runtime.mjs +79 -0
- package/dist/runtime-manifest.json +32 -0
- package/dist/web/client/assets/DialogTitle-RY2UDuCY.js +1 -0
- package/dist/web/client/assets/FloatingPortal-XC0MCNnD.js +1 -0
- package/dist/web/client/assets/action-swap-BWRUNKQA.js +1 -0
- package/dist/web/client/assets/{alert-dialog-DtXvVhsF.js → alert-dialog-DGNvg0B1.js} +1 -1
- package/dist/web/client/assets/arrow-up-right-CG9RNk4p.js +1 -0
- package/dist/web/client/assets/{artifacts-panel-Bseg97yQ.js → artifacts-panel-BGXpKRJ7.js} +1 -1
- package/dist/web/client/assets/{badge-C--lf3bb.js → badge-DM06QVqB.js} +6 -6
- package/dist/web/client/assets/button-CWYjn8Zk.js +1 -0
- package/dist/web/client/assets/{card-Hngi3HGC.js → card-Dj1SnGUU.js} +1 -1
- package/dist/web/client/assets/{chat-command-palette-D_rm1r9d.js → chat-command-palette-PenyaZBw.js} +1 -1
- package/dist/web/client/assets/code-block-pKKmFZ5w.js +3 -0
- package/dist/web/client/assets/collapsible-Bk6zCsRX.js +1 -0
- package/dist/web/client/assets/{command-CmtCIDdH.js → command-imgUMV3r.js} +1 -1
- package/dist/web/client/assets/{create-project-dialog-m-9aoobN.js → create-project-dialog-C00d5yCq.js} +1 -1
- package/dist/web/client/assets/createBaseUIEventDetails-DIxvaz-Y.js +1 -0
- package/dist/web/client/assets/{dialog-Ddouieuu.js → dialog-zCNOQI63.js} +1 -1
- package/dist/web/client/assets/eye-iNSvs0UA.js +1 -0
- package/dist/web/client/assets/file-code-corner-BkDULqko.js +1 -0
- package/dist/web/client/assets/{fork-picker-dialog-DfGlB17w.js → fork-picker-dialog-Cgi48NnT.js} +1 -1
- package/dist/web/client/assets/globals-BuMuB_ea.css +2 -0
- package/dist/web/client/assets/{index-Bz5W4EOn.js → index-BqBdQGWs.js} +3 -3
- package/dist/web/client/assets/input-7g8_nw-Z.js +1 -0
- package/dist/web/client/assets/{input-group-EPMGh55u.js → input-group-Nq03Qums.js} +1 -1
- package/dist/web/client/assets/{ipython-tool-CMhnRVrC.js → ipython-tool-bieUhw9K.js} +1 -1
- package/dist/web/client/assets/markdown-CvBfbPCn.js +2 -0
- package/dist/web/client/assets/markdown-code-rFOkzN5N.js +4 -0
- package/dist/web/client/assets/{message-queue-Bg2MiJHM.js → message-queue-sSljtjYz.js} +1 -1
- package/dist/web/client/assets/{model-selector-list-BiU_7ivt.js → model-selector-list-Cp687pdm.js} +1 -1
- package/dist/web/client/assets/{notify-DhtmUPfE.js → notify-Cqdu6EV8.js} +1 -1
- package/dist/web/client/assets/{openui-renderer-MIB3JKYa.js → openui-renderer-BdYTcn-_.js} +50 -50
- package/dist/web/client/assets/{prompt-input-Dy-DSPqF.js → prompt-input-CoV1gTUQ.js} +1 -1
- package/dist/web/client/assets/{prompt-suggestions-CrpAiKeB.js → prompt-suggestions-CAY5JI-C.js} +1 -1
- package/dist/web/client/assets/provider-label-QrVOwKBO.js +1 -0
- package/dist/web/client/assets/reasoning-line-DGdPUMwT.js +1 -0
- package/dist/web/client/assets/rehype-katex-DITkIpVl.js +259 -0
- package/dist/web/client/assets/{repl-panel-DN5kZAcB.js → repl-panel-5xgkDXO5.js} +1 -1
- package/dist/web/client/assets/{resources-panel-DD6iWOF3.js → resources-panel-aJCKt9eF.js} +1 -1
- package/dist/web/client/assets/right-panel-registry-BaLZiKny.js +2 -0
- package/dist/web/client/assets/routes-BkFkhfO3.js +16 -0
- package/dist/web/client/assets/select-BhV4ikeN.js +1 -0
- package/dist/web/client/assets/session-activity-panel-Bc4-HSfb.js +1 -0
- package/dist/web/client/assets/session-reasoning-panel-CjJJK_bq.js +1 -0
- package/dist/web/client/assets/session-tool-renderer-C7mYeUOs.js +166 -0
- package/dist/web/client/assets/{session-tree-panel-BBwP_EK2.js → session-tree-panel-By9m9tGB.js} +1 -1
- package/dist/web/client/assets/settings-dialog-Dpt4Ha_m.js +2 -0
- package/dist/web/client/assets/shield-check-7HDd-2Fn.js +1 -0
- package/dist/web/client/assets/{skeleton-DNAr5ULI.js → skeleton-B_Lq2XFl.js} +1 -1
- package/dist/web/client/assets/{skeleton-loaders-B28mF4tJ.js → skeleton-loaders-DWc1eDL3.js} +1 -1
- package/dist/web/client/assets/sparkles-BwVa9zQJ.js +1 -0
- package/dist/web/client/assets/{spinner-CSBXk3Lo.js → spinner-B5TaKP7k.js} +1 -1
- package/dist/web/client/assets/{subagent-chat-panel-DhvBO4dQ.js → subagent-chat-panel-DsPmLZSf.js} +1 -1
- package/dist/web/client/assets/subagent-transcript-CNQ9wGk2.js +1 -0
- package/dist/web/client/assets/{subagents-panel-DRo8Xs6j.js → subagents-panel-gQ9BLfV3.js} +1 -1
- package/dist/web/client/assets/surfaces-BUjUJTyD.js +1 -0
- package/dist/web/client/assets/switch-C7Myu-Dt.js +1 -0
- package/dist/web/client/assets/toast-DlbKi6K-.js +1 -0
- package/dist/web/client/assets/tool-output-normalizer-CADgEiI4.js +4 -0
- package/dist/web/client/assets/tool-part-normalizer-CYK62WZM.js +4 -0
- package/dist/web/client/assets/tool-result-bjAGZ2qm.js +5 -0
- package/dist/web/client/assets/tool-timeline-eNqH1zj7.js +2 -0
- package/dist/web/client/assets/trace-IsV5RRvM.js +1 -0
- package/dist/web/client/assets/ui-preferences-B-PNDkyY.js +1 -0
- package/dist/web/client/assets/use-hover-capable-CLq8BADD.js +1 -0
- package/dist/web/client/assets/useBaseUiId-lKfDDIcw.js +1 -0
- package/dist/web/client/assets/useButton-CvcmqA2s.js +1 -0
- package/dist/web/client/assets/useRender-Bbk_fl72.js +1 -0
- package/dist/web/client/assets/{utils-CFDGLzf6.js → utils-oBThwhjm.js} +1 -1
- package/dist/web/client/assets/{workspace-panel-DdZutYnd.js → workspace-panel-Da5I4p_t.js} +1 -1
- package/dist/web/client/assets/workspace-path-nav-D-77sJ_A.js +2 -0
- package/dist/web/client/assets/wrench-BXX_Ah2s.js +1 -0
- package/dist/web/client/bundle-budget.json +6 -6
- package/dist/web/server/{_tanstack-start-manifest_v-YlngJGUa-YTWBGR7L.js → _tanstack-start-manifest_v-BiNPG4xt-BZTMSM2I.js} +33 -28
- package/dist/web/server/{artifacts-panel-COSC8o7j-GKW2HH2G.js → artifacts-panel-CqGBNU4q-UHNMC7PK.js} +23 -27
- package/dist/web/server/{chat-command-palette-CuOWdzkk-PKZQ5EZP.js → chat-command-palette-B94-zIEz-ES2ZB4ZF.js} +8 -10
- package/dist/web/server/{chunk-GLSR4ZI2.js → chunk-2FHYWKDN.js} +669 -833
- package/dist/web/server/{chunk-EBC7QORX.js → chunk-5GUEYYYO.js} +3680 -2098
- package/dist/web/server/{chunk-GLH2GWMG.js → chunk-7L5PCCYR.js} +411 -306
- package/dist/web/server/{chunk-KHHXJZK7.js → chunk-ABMGW6QH.js} +2784 -1662
- package/dist/web/server/{chunk-36CAMOVG.js → chunk-BAHZXA4D.js} +6 -6
- package/dist/web/server/{chunk-IN2ATSEG.js → chunk-CZLGB3NE.js} +2 -2
- package/dist/web/server/{chunk-WCKKN5BR.js → chunk-E6T36NM5.js} +347 -583
- package/dist/web/server/{chunk-ORCOCCER.js → chunk-EAKPTSWR.js} +4 -4
- package/dist/web/server/chunk-EL2JCDAM.js +270 -0
- package/dist/web/server/{chunk-6GTTTYSE.js → chunk-FB2QLQTN.js} +67 -73
- package/dist/web/server/{chunk-LLO4MNGE.js → chunk-K67IDUAI.js} +24 -26
- package/dist/web/server/{chunk-YU6RHHK6.js → chunk-LQM6QR7S.js} +10 -12
- package/dist/web/server/chunk-LTTBT3J7.js +129 -0
- package/dist/web/server/{chunk-TMQ3MT3D.js → chunk-OAYEN3JV.js} +2 -0
- package/dist/web/server/{chunk-ZUZPJNLY.js → chunk-OSPDNT7S.js} +829 -642
- package/dist/web/server/{chunk-XA7EOCHM.js → chunk-SGAQVAYL.js} +2 -2
- package/dist/web/server/chunk-SI5IQSG4.js +206 -0
- package/dist/web/server/{chunk-AKSDWYJY.js → chunk-SYS5FDNA.js} +5 -5
- package/dist/web/server/{chunk-QSM3BRMA.js → chunk-WSK55TKE.js} +169 -156
- package/dist/web/server/{chunk-BUKOEXE7.js → chunk-YQO36OP6.js} +2 -2
- package/dist/web/server/{create-project-dialog-0-arQpsX-ZELQKHS5.js → create-project-dialog-CFPX6Ihl-EO4XTINS.js} +12 -14
- package/dist/web/server/{dist-7G2NZPF4.js → dist-GQUZLXN5.js} +2 -2
- package/dist/web/server/{dist-E5637ZAY.js → dist-MN5NWCX6.js} +1 -1
- package/dist/web/server/{fork-picker-dialog-fj9p33Mq-I5SA3GLJ.js → fork-picker-dialog-B2RBFzoZ-R6GXPSPL.js} +6 -8
- package/dist/web/server/{markdown-CShfYRVO-RBTK7TRB.js → markdown-BvCfOB26-VDH4YOQD.js} +9 -6
- package/dist/web/server/{markdown-code-BDV_2b2T-6JYA5FWZ.js → markdown-code-SYc-BQvp-MR4FXT5C.js} +48 -9
- package/dist/web/server/{message-queue-BBC843IU-GY4ZIMM4.js → message-queue-D32rLiJo-HEBRGH5B.js} +6 -8
- package/dist/web/server/{model-selector-list-DE6aLNXt-LJZMCYOI.js → model-selector-list-DKzt_xEN-5ZPU6XDY.js} +8 -10
- package/dist/web/server/{openui-renderer-C3aqSKuS-PWLWJFYO.js → openui-renderer-CeVtOdYl-PY37PCJI.js} +12 -14
- package/dist/web/server/{prompt-suggestions-CpTK_fHV-UKJDTLVM.js → prompt-suggestions-CpTK_fHV-Q4ILLZKC.js} +1 -1
- package/dist/web/server/{rehype-katex-IDPYWU6M.js → rehype-katex-CYHGKI6Q.js} +490 -843
- package/dist/web/server/{repl-panel-1kSS1UGd-U64BPA7X.js → repl-panel-1kSS1UGd-DDM5ADGZ.js} +3 -3
- package/dist/web/server/{resources-panel-DWb0eGKa-K4EM3H7Y.js → resources-panel-S4NHlpz7-NF7WYYSR.js} +7 -9
- package/dist/web/server/{router-DZYr-9uT-AEXHEFXF.js → router-DVKxZik_-254GZAJW.js} +5 -6
- package/dist/web/server/{routes-vYxWRhis-AAZ73SNP.js → routes-BTxAklRp-UM7ZTLLP.js} +50 -30
- package/dist/web/server/server.js +2 -2
- package/dist/web/server/session-activity-panel-Bz2GrdMk-PCOXG46X.js +173 -0
- package/dist/web/server/session-reasoning-panel-CpiTdyQz-O3B5CDKS.js +62 -0
- package/dist/web/server/{session-tool-renderer-Dtt74Mts-7YYNSWRV.js → session-tool-renderer-BZiOxtt1-T3ZGAQKX.js} +10 -13
- package/dist/web/server/{session-tree-panel-HNl6R9VZ-4JUF34M7.js → session-tree-panel-CzkE0RFB-P4KWA7S2.js} +7 -9
- package/dist/web/server/{settings-dialog-DGZBA5Z_-6HYFMPNZ.js → settings-dialog-BUgVNpr1-THSYIOZL.js} +18 -21
- package/dist/web/server/{subagent-chat-panel-DuB4hqUk-LDCAJOCL.js → subagent-chat-panel-mw3kEFfK-CDYX7LST.js} +13 -16
- package/dist/web/server/{subagents-panel-wAvx3-Rs-L6UTDFUX.js → subagents-panel-2ZJfYrXG-NDJKHJHD.js} +15 -18
- package/dist/web/server/{workspace-panel-CPzJZwgv-YS7PTI5C.js → workspace-panel-xznrPDLt-QCJRZOF3.js} +7 -9
- package/package.json +2 -2
- package/dist/web/client/assets/DialogTitle-D-zqaHvF.js +0 -1
- package/dist/web/client/assets/FloatingPortal-73ZRZeD9.js +0 -1
- package/dist/web/client/assets/action-swap-BcFwS6is.js +0 -1
- package/dist/web/client/assets/button-BJZe4vNJ.js +0 -1
- package/dist/web/client/assets/chevron-up-CqeJYyZO.js +0 -1
- package/dist/web/client/assets/collapsible-DauSnbYp.js +0 -1
- package/dist/web/client/assets/createBaseUIEventDetails-DklXWq23.js +0 -1
- package/dist/web/client/assets/eye-Cs0lNChA.js +0 -1
- package/dist/web/client/assets/globals-C961mr-b.css +0 -2
- package/dist/web/client/assets/input-Def1xOZz.js +0 -1
- package/dist/web/client/assets/markdown-Big27m-v.js +0 -2
- package/dist/web/client/assets/markdown-code-7L4RiS50.js +0 -3
- package/dist/web/client/assets/provider-label-B_vy60P0.js +0 -1
- package/dist/web/client/assets/rehype-katex-A4PtQgTX.js +0 -259
- package/dist/web/client/assets/right-panel-registry-hKJN__3l.js +0 -2
- package/dist/web/client/assets/routes-C3h32Lj_.js +0 -16
- package/dist/web/client/assets/select-Buvv1tIo.js +0 -1
- package/dist/web/client/assets/session-reasoning-panel-DmEbXOrR.js +0 -1
- package/dist/web/client/assets/session-tool-renderer-Daol5fJw.js +0 -169
- package/dist/web/client/assets/settings-dialog-DYbx3xuq.js +0 -2
- package/dist/web/client/assets/sparkles-D_ANe-HY.js +0 -1
- package/dist/web/client/assets/subagent-transcript-Bx-rHni-.js +0 -1
- package/dist/web/client/assets/surfaces-B8xTOFeK.js +0 -1
- package/dist/web/client/assets/switch-CDfAwEvs.js +0 -1
- package/dist/web/client/assets/terminal-Ceucj7us.js +0 -1
- package/dist/web/client/assets/toast-9zXN-yVk.js +0 -1
- package/dist/web/client/assets/tool-part-normalizer-NbPs9kd1.js +0 -4
- package/dist/web/client/assets/tool-result-BccnO34D.js +0 -4
- package/dist/web/client/assets/tool-timeline-DlBZyd4j.js +0 -1
- package/dist/web/client/assets/ui-preferences-1YaENqef.js +0 -1
- package/dist/web/client/assets/use-hover-capable-MwFjBLZQ.js +0 -1
- package/dist/web/client/assets/workspace-path-nav-BRwuLsFl.js +0 -2
- package/dist/web/client/assets/wrench-BYnD147U.js +0 -1
- package/dist/web/server/chunk-CHSKEU3V.js +0 -166
- package/dist/web/server/chunk-OO7NBFQQ.js +0 -15
- package/dist/web/server/chunk-OXEAXEWD.js +0 -13
- package/dist/web/server/chunk-SIJVVYQT.js +0 -234
- package/dist/web/server/chunk-UQV2NU63.js +0 -163
- package/dist/web/server/chunk-VUBITQ5X.js +0 -653
- package/dist/web/server/session-reasoning-panel-XXU2yIOW-XXCKHISS.js +0 -192
- package/dist/web/server/tool-timeline-BKWsrZHK-3LGCOTPH.js +0 -12
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
Skeleton,
|
|
3
3
|
getResourceChipTitle,
|
|
4
4
|
resourceKey
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-5GUEYYYO.js";
|
|
6
6
|
|
|
7
|
-
// web/app/dist/server/assets/skeleton-loaders-
|
|
7
|
+
// web/app/dist/server/assets/skeleton-loaders-CzpLPfNw.js
|
|
8
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
function ResourceNotice({ description, icon: Icon, title }) {
|
|
10
10
|
return /* @__PURE__ */ jsxs("div", {
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Trace,
|
|
3
|
+
TraceCollapsible,
|
|
4
|
+
TraceCollapsibleContent,
|
|
5
|
+
TraceCollapsibleTrigger,
|
|
6
|
+
TraceDescription,
|
|
7
|
+
TraceIcon,
|
|
8
|
+
TraceLine,
|
|
9
|
+
TraceTitle,
|
|
10
|
+
normalizeToolPart$1,
|
|
11
|
+
toolActionIconForName
|
|
12
|
+
} from "./chunk-5GUEYYYO.js";
|
|
13
|
+
import {
|
|
14
|
+
cn
|
|
15
|
+
} from "./chunk-OAYEN3JV.js";
|
|
16
|
+
|
|
17
|
+
// web/app/dist/server/assets/tool-timeline-5q0Z8R6U.js
|
|
18
|
+
import { Suspense, lazy, useMemo, useState } from "react";
|
|
19
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
20
|
+
var LazySessionToolRenderer = lazy(() => import("./session-tool-renderer-BZiOxtt1-T3ZGAQKX.js").then((n) => n.n).then(({ SessionToolRenderer }) => ({ default: SessionToolRenderer })));
|
|
21
|
+
var NO_ARTIFACTS = [];
|
|
22
|
+
function artifactPanel(kind) {
|
|
23
|
+
return kind === "ipython" ? "repl" : "artifacts";
|
|
24
|
+
}
|
|
25
|
+
function withArtifact(step, artifact) {
|
|
26
|
+
if (!artifact) return step;
|
|
27
|
+
return {
|
|
28
|
+
...step,
|
|
29
|
+
artifactId: artifact.id,
|
|
30
|
+
artifactTitle: artifact.title,
|
|
31
|
+
artifactTarget: artifactPanel(artifact.kind)
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
function record(value) {
|
|
35
|
+
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : void 0;
|
|
36
|
+
}
|
|
37
|
+
function status(part, streaming) {
|
|
38
|
+
const state = part.state;
|
|
39
|
+
if (state === "output-error" || state === "error") return "error";
|
|
40
|
+
if (state === "cancelled" || state === "canceled" || state === "aborted" || state === "interrupted") return "cancelled";
|
|
41
|
+
if (state === "input-streaming" || state === "streaming") return streaming ? "running" : "cancelled";
|
|
42
|
+
if (state === "input-available" || state === "pending" || state === "queued") return "pending";
|
|
43
|
+
return streaming && part.output === void 0 && part.result === void 0 ? "running" : "complete";
|
|
44
|
+
}
|
|
45
|
+
function toolStep(part, fallbackId, streaming, nestedTools = [], isNestedTaskTool = false) {
|
|
46
|
+
const type = part.type;
|
|
47
|
+
if (typeof type !== "string" || !type.startsWith("tool-") || type === "tool-FleetReasoning" || type === "tool-Thinking" || isNestedTaskTool) return void 0;
|
|
48
|
+
const name = type.slice(5);
|
|
49
|
+
const lower = name.toLowerCase();
|
|
50
|
+
const verb = lower.includes("edit") || lower.includes("write") || lower.includes("patch") ? "Edited" : lower.includes("read") ? "Read" : lower.includes("search") || lower.includes("grep") || lower.includes("glob") ? "Searched" : lower.includes("bash") || lower.includes("shell") || lower.includes("python") || lower.includes("ipython") ? "Ran" : name;
|
|
51
|
+
const normalized = normalizeToolPart$1(part);
|
|
52
|
+
return {
|
|
53
|
+
id: typeof part.toolCallId === "string" ? part.toolCallId : fallbackId,
|
|
54
|
+
verb,
|
|
55
|
+
target: name,
|
|
56
|
+
status: status(part, streaming),
|
|
57
|
+
part,
|
|
58
|
+
nestedTools,
|
|
59
|
+
traceDescription: normalized?.traceDescription,
|
|
60
|
+
durationLabel: normalized?.durationLabel,
|
|
61
|
+
reportedError: normalized?.outputSummary.isError
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
function artifactStep(artifact) {
|
|
65
|
+
return {
|
|
66
|
+
id: `artifact:${artifact.id}`,
|
|
67
|
+
verb: artifact.kind === "compaction" ? "Compacted" : artifact.kind === "refinement" ? "Refined" : artifact.kind === "recap" ? "Recapped" : artifact.kind === "rlm" ? "Delegated" : artifact.kind === "diff" ? "Edited" : "Completed",
|
|
68
|
+
target: artifact.kind === "bash" ? "Bash output" : artifact.kind === "ipython" ? "IPython result" : artifact.kind === "diff" ? "File change" : artifact.kind === "rlm" ? "Child task" : artifact.kind === "recap" ? "Session recap" : artifact.kind === "refinement" ? "Refinement" : "Session activity",
|
|
69
|
+
status: artifact.status === "success" ? "complete" : artifact.status
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function TimelineStepRow({ step, onOpenArtifact, renderToolDetails }) {
|
|
73
|
+
const Icon = toolActionIconForName(step.part?.type.replace(/^tool-/, "") ?? step.target);
|
|
74
|
+
const artifactId = step.artifactId;
|
|
75
|
+
const openLabel = artifactId && step.artifactTitle ? step.artifactTarget === "repl" ? `Open ${step.artifactTitle} in REPL` : `Open ${step.artifactTitle} in artifacts` : void 0;
|
|
76
|
+
const detailLabel = `Details for ${step.target}${step.id ? ` (${step.id})` : ""}`;
|
|
77
|
+
const statusLabel = step.reportedError ? "reported error" : step.status === "error" ? "failed" : step.status === "running" ? "running" : step.status === "pending" ? "waiting" : step.status === "cancelled" ? "cancelled" : "done";
|
|
78
|
+
const line = /* @__PURE__ */ jsxs(TraceLine, {
|
|
79
|
+
status: step.status === "running" ? "running" : step.status === "error" ? "error" : step.status === "pending" ? "pending" : void 0,
|
|
80
|
+
children: [
|
|
81
|
+
/* @__PURE__ */ jsx(TraceIcon, { children: /* @__PURE__ */ jsx(Icon, { className: cn("size-3.5", step.status === "running" && "animate-pulse text-primary", step.status === "error" && "text-destructive") }) }),
|
|
82
|
+
/* @__PURE__ */ jsxs(TraceTitle, { children: [
|
|
83
|
+
step.verb,
|
|
84
|
+
" ",
|
|
85
|
+
step.target
|
|
86
|
+
] }),
|
|
87
|
+
/* @__PURE__ */ jsx(TraceDescription, {
|
|
88
|
+
className: step.reportedError ? "text-destructive" : void 0,
|
|
89
|
+
children: statusLabel
|
|
90
|
+
}),
|
|
91
|
+
step.traceDescription ? /* @__PURE__ */ jsx(TraceDescription, {
|
|
92
|
+
className: "max-w-48 truncate",
|
|
93
|
+
title: step.traceDescription,
|
|
94
|
+
children: step.traceDescription
|
|
95
|
+
}) : null,
|
|
96
|
+
step.durationLabel ? /* @__PURE__ */ jsx(TraceDescription, { children: step.durationLabel }) : null
|
|
97
|
+
]
|
|
98
|
+
});
|
|
99
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
+
className: "flex min-w-0 items-start gap-2",
|
|
101
|
+
children: [step.part ? /* @__PURE__ */ jsxs(TraceCollapsible, {
|
|
102
|
+
className: "min-w-0 flex-1",
|
|
103
|
+
children: [/* @__PURE__ */ jsx(TraceCollapsibleTrigger, {
|
|
104
|
+
"aria-label": detailLabel,
|
|
105
|
+
children: line
|
|
106
|
+
}), /* @__PURE__ */ jsx(TraceCollapsibleContent, { children: renderToolDetails ? renderToolDetails(step.part, step.status === "running", step.nestedTools) : /* @__PURE__ */ jsx(Suspense, {
|
|
107
|
+
fallback: null,
|
|
108
|
+
children: /* @__PURE__ */ jsx(LazySessionToolRenderer, {
|
|
109
|
+
part: step.part,
|
|
110
|
+
nestedTools: step.nestedTools,
|
|
111
|
+
chatStatus: step.status === "running" ? "streaming" : void 0,
|
|
112
|
+
insideTrace: true
|
|
113
|
+
})
|
|
114
|
+
}) })]
|
|
115
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
116
|
+
className: "min-w-0 flex-1",
|
|
117
|
+
children: line
|
|
118
|
+
}), openLabel && artifactId && onOpenArtifact ? /* @__PURE__ */ jsx("button", {
|
|
119
|
+
type: "button",
|
|
120
|
+
className: "shrink-0 text-micro underline",
|
|
121
|
+
"aria-label": openLabel,
|
|
122
|
+
onClick: () => onOpenArtifact(artifactId, step.artifactTarget),
|
|
123
|
+
children: "Open"
|
|
124
|
+
}) : null]
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function ToolTimeline({ messages, artifacts = NO_ARTIFACTS, streaming, className, onOpenArtifact, renderToolDetails }) {
|
|
128
|
+
const steps = useMemo(() => {
|
|
129
|
+
const seen = /* @__PURE__ */ new Set();
|
|
130
|
+
const artifactByToolCallId = new Map(artifacts.flatMap((artifact) => artifact.sourceToolCallId ? [[artifact.sourceToolCallId, artifact]] : []));
|
|
131
|
+
const fromMessages = messages.flatMap((message) => {
|
|
132
|
+
const taskPartIds = new Set(message.parts.flatMap((part) => {
|
|
133
|
+
const source = record(part);
|
|
134
|
+
return (source?.type === "tool-Task" || source?.type === "tool-Agent") && typeof source.toolCallId === "string" ? [source.toolCallId] : [];
|
|
135
|
+
}));
|
|
136
|
+
const nestedToolsByTask = /* @__PURE__ */ new Map();
|
|
137
|
+
const nestedToolIds = /* @__PURE__ */ new Set();
|
|
138
|
+
for (const part of message.parts) {
|
|
139
|
+
const source = record(part);
|
|
140
|
+
const toolCallId = typeof source?.toolCallId === "string" ? source.toolCallId : void 0;
|
|
141
|
+
const separator = toolCallId?.indexOf(":") ?? -1;
|
|
142
|
+
if (!toolCallId || separator <= 0) continue;
|
|
143
|
+
const parentId = toolCallId.slice(0, separator);
|
|
144
|
+
if (!taskPartIds.has(parentId)) continue;
|
|
145
|
+
nestedToolIds.add(toolCallId);
|
|
146
|
+
const children = nestedToolsByTask.get(parentId) ?? [];
|
|
147
|
+
children.push(source);
|
|
148
|
+
nestedToolsByTask.set(parentId, children);
|
|
149
|
+
}
|
|
150
|
+
return message.parts.flatMap((part, index) => {
|
|
151
|
+
const source = record(part) ?? {};
|
|
152
|
+
const toolCallId = typeof source.toolCallId === "string" ? source.toolCallId : void 0;
|
|
153
|
+
const step = toolStep(source, `${message.id}:${index}`, streaming, toolCallId ? nestedToolsByTask.get(toolCallId) ?? [] : [], toolCallId ? nestedToolIds.has(toolCallId) : false);
|
|
154
|
+
if (!step || seen.has(step.id)) return [];
|
|
155
|
+
seen.add(step.id);
|
|
156
|
+
return [withArtifact(step, artifactByToolCallId.get(step.id))];
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
const fromArtifacts = artifacts.flatMap((artifact) => {
|
|
160
|
+
if (artifact.sourceToolCallId && seen.has(artifact.sourceToolCallId)) return [];
|
|
161
|
+
const step = withArtifact(artifactStep(artifact), artifact);
|
|
162
|
+
if (seen.has(step.id)) return [];
|
|
163
|
+
seen.add(step.id);
|
|
164
|
+
return [step];
|
|
165
|
+
});
|
|
166
|
+
return [...fromMessages, ...fromArtifacts];
|
|
167
|
+
}, [
|
|
168
|
+
artifacts,
|
|
169
|
+
messages,
|
|
170
|
+
streaming
|
|
171
|
+
]);
|
|
172
|
+
const [open, setOpen] = useState(true);
|
|
173
|
+
if (steps.length === 0) return null;
|
|
174
|
+
const active = [...steps].reverse().find((step) => step.status === "running") ?? steps.at(-1);
|
|
175
|
+
const StatusIcon = toolActionIconForName(active?.part?.type.replace(/^tool-/, "") ?? active?.target ?? "activity");
|
|
176
|
+
return /* @__PURE__ */ jsx(Trace, {
|
|
177
|
+
className: cn("mb-2", className),
|
|
178
|
+
"data-testid": "tool-trace",
|
|
179
|
+
children: /* @__PURE__ */ jsxs(TraceCollapsible, {
|
|
180
|
+
open,
|
|
181
|
+
onOpenChange: setOpen,
|
|
182
|
+
children: [/* @__PURE__ */ jsx(TraceCollapsibleTrigger, {
|
|
183
|
+
"aria-label": `${steps.length} tool ${steps.length === 1 ? "action" : "actions"}`,
|
|
184
|
+
children: /* @__PURE__ */ jsxs(TraceLine, {
|
|
185
|
+
status: active?.status === "running" ? "running" : active?.status === "error" ? "error" : void 0,
|
|
186
|
+
children: [
|
|
187
|
+
/* @__PURE__ */ jsx(TraceIcon, { children: /* @__PURE__ */ jsx(StatusIcon, { className: cn("size-3.5", active?.status === "running" && "animate-spin") }) }),
|
|
188
|
+
/* @__PURE__ */ jsx(TraceTitle, { children: streaming && active ? `${active.verb} ${active.target}` : `${steps.length} tool ${steps.length === 1 ? "action" : "actions"}` }),
|
|
189
|
+
/* @__PURE__ */ jsx(TraceDescription, { children: steps.length })
|
|
190
|
+
]
|
|
191
|
+
})
|
|
192
|
+
}), /* @__PURE__ */ jsx(TraceCollapsibleContent, { children: /* @__PURE__ */ jsx(Trace, {
|
|
193
|
+
className: "gap-1",
|
|
194
|
+
children: steps.map((step) => /* @__PURE__ */ jsx(TimelineStepRow, {
|
|
195
|
+
step,
|
|
196
|
+
onOpenArtifact,
|
|
197
|
+
renderToolDetails
|
|
198
|
+
}, step.id))
|
|
199
|
+
}) })]
|
|
200
|
+
})
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export {
|
|
205
|
+
ToolTimeline
|
|
206
|
+
};
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
toJSONSchema
|
|
5
5
|
} from "./chunk-6JOAWERA.js";
|
|
6
6
|
|
|
7
|
-
// node_modules/.pnpm/@openuidev+lang-core@0.3.2_@modelcontextprotocol+sdk@1.
|
|
7
|
+
// node_modules/.pnpm/@openuidev+lang-core@0.3.2_@modelcontextprotocol+sdk@1.32.1_supports-color@8.1.1_zod@4.6.5__zod@4.6.5/node_modules/@openuidev/lang-core/dist/shared-Dzgc28Wo.mjs
|
|
8
8
|
var TELEMETRY_REQUEST_TIMEOUT_MS = 2e3;
|
|
9
9
|
function getPostHogConfig(env) {
|
|
10
10
|
const host = env?.["OPENUI_POSTHOG_HOST"] ?? "https://dgoeivjus9jfp.cloudfront.net";
|
|
@@ -46,7 +46,7 @@ function normalizeRepositoryPath(repositoryPath) {
|
|
|
46
46
|
return repositoryPath.trim().replace(/\\/g, "/").replace(/^\/+|\/+$/g, "").replace(/\.git$/i, "");
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
// node_modules/.pnpm/@openuidev+lang-core@0.3.2_@modelcontextprotocol+sdk@1.
|
|
49
|
+
// node_modules/.pnpm/@openuidev+lang-core@0.3.2_@modelcontextprotocol+sdk@1.32.1_supports-color@8.1.1_zod@4.6.5__zod@4.6.5/node_modules/@openuidev/lang-core/dist/index.mjs
|
|
50
50
|
var SYSTEM_PROMPT_EVENT_NAME = "lang_core_system_prompt_generation_used";
|
|
51
51
|
var PARSER_PARSE_EVENT_NAME = "lang_core_parser_parse_used";
|
|
52
52
|
var SYSTEM_PROMPT_SAMPLE_RATE = 0.1;
|
|
@@ -4137,7 +4137,7 @@ var BUS_KEY = /* @__PURE__ */ Symbol.for("openui.observability");
|
|
|
4137
4137
|
var store = globalThis;
|
|
4138
4138
|
var observability = store[BUS_KEY] ??= createObservability();
|
|
4139
4139
|
|
|
4140
|
-
// node_modules/.pnpm/@openuidev+react-lang@0.3.2_@modelcontextprotocol+sdk@1.
|
|
4140
|
+
// node_modules/.pnpm/@openuidev+react-lang@0.3.2_@modelcontextprotocol+sdk@1.32.1_supports-color@8.1.1_zod@4_1de775beb5d918be551c4d5e0aa840f9/node_modules/@openuidev/react-lang/dist/exports-Cab8UG5o.mjs
|
|
4141
4141
|
import { Component, Fragment, createContext, useCallback, useContext, useEffect, useInsertionEffect, useMemo, useRef, useState, useSyncExternalStore } from "react";
|
|
4142
4142
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4143
4143
|
var DEVTOOLS_LIBRARIES_KEY = /* @__PURE__ */ Symbol.for("openui.devtools.libraries");
|
|
@@ -4897,7 +4897,7 @@ function useCreateFormValidation() {
|
|
|
4897
4897
|
]);
|
|
4898
4898
|
}
|
|
4899
4899
|
|
|
4900
|
-
// node_modules/.pnpm/@openuidev+react-lang@0.3.2_@modelcontextprotocol+sdk@1.
|
|
4900
|
+
// node_modules/.pnpm/@openuidev+react-lang@0.3.2_@modelcontextprotocol+sdk@1.32.1_supports-color@8.1.1_zod@4_1de775beb5d918be551c4d5e0aa840f9/node_modules/@openuidev/react-lang/dist/index.mjs
|
|
4901
4901
|
if (process.env.NODE_ENV === "development") {
|
|
4902
4902
|
const AUTO_MOUNT_FLAG = /* @__PURE__ */ Symbol.for("openui.devtools.autoMount");
|
|
4903
4903
|
const flags = globalThis;
|
|
@@ -4906,7 +4906,7 @@ if (process.env.NODE_ENV === "development") {
|
|
|
4906
4906
|
Promise.resolve().then(() => {
|
|
4907
4907
|
if (typeof document === "undefined") return;
|
|
4908
4908
|
Promise.all([
|
|
4909
|
-
import("./dist-
|
|
4909
|
+
import("./dist-GQUZLXN5.js"),
|
|
4910
4910
|
import("react"),
|
|
4911
4911
|
import("react-dom/client")
|
|
4912
4912
|
]).then(([{ OpenUIDevtools }, React, ReactDOMClient]) => {
|
|
@@ -3,11 +3,19 @@ import {
|
|
|
3
3
|
AgentDisclosure,
|
|
4
4
|
SPRING_PRESS,
|
|
5
5
|
SPRING_SWAP
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-5GUEYYYO.js";
|
|
7
7
|
import {
|
|
8
8
|
m,
|
|
9
9
|
useReducedMotion
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OSPDNT7S.js";
|
|
11
|
+
import {
|
|
12
|
+
CodeBlock,
|
|
13
|
+
CodeBlockActions,
|
|
14
|
+
CodeBlockContent,
|
|
15
|
+
CodeBlockCopyButton,
|
|
16
|
+
CodeBlockHeader,
|
|
17
|
+
CodeBlockTitle
|
|
18
|
+
} from "./chunk-LTTBT3J7.js";
|
|
11
19
|
import {
|
|
12
20
|
Ban,
|
|
13
21
|
Braces,
|
|
@@ -20,12 +28,12 @@ import {
|
|
|
20
28
|
LoaderCircle,
|
|
21
29
|
SquareTerminal,
|
|
22
30
|
Wrench
|
|
23
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-7L5PCCYR.js";
|
|
24
32
|
import {
|
|
25
33
|
cn
|
|
26
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-OAYEN3JV.js";
|
|
27
35
|
|
|
28
|
-
// web/app/dist/server/assets/tool-result-
|
|
36
|
+
// web/app/dist/server/assets/tool-result-aTgYW1-y.js
|
|
29
37
|
import { useCallback, useEffect, useId, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
30
38
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
31
39
|
var LIGHT_THEME = "github-light-high-contrast";
|
|
@@ -113,127 +121,17 @@ function useAgentCodeTokens(code, language) {
|
|
|
113
121
|
if (result?.language === language && code.startsWith(result.code)) return result.lines;
|
|
114
122
|
return null;
|
|
115
123
|
}
|
|
116
|
-
function AgentCodeLine({ code, tokens, className }) {
|
|
117
|
-
return /* @__PURE__ */
|
|
124
|
+
function AgentCodeLine({ code, tokens, suffix, className }) {
|
|
125
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
118
126
|
className,
|
|
119
|
-
children: tokens ? tokens.map((token) => /* @__PURE__ */ jsx("span", {
|
|
127
|
+
children: [tokens ? tokens.map((token) => /* @__PURE__ */ jsx("span", {
|
|
120
128
|
style: {
|
|
121
129
|
"--agent-code-light": token.light ?? "currentColor",
|
|
122
130
|
"--agent-code-dark": token.dark ?? token.light ?? "currentColor"
|
|
123
131
|
},
|
|
124
132
|
className: "text-[var(--agent-code-light)] dark:text-[var(--agent-code-dark)]",
|
|
125
133
|
children: token.content
|
|
126
|
-
}, `${token.offset}-${token.content}`)) : code
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
var EMPTY_HIGHLIGHT_LINES = [];
|
|
130
|
-
function CodeBlock({ code, language = "typescript", languageLabel, filename, status = "complete", showStatus = true, showLineNumbers = true, highlightLines = EMPTY_HIGHLIGHT_LINES, maxHeight = 280, wrap = false, copyable = true, onCopy, className }) {
|
|
131
|
-
const reduce = useReducedMotion() ?? false;
|
|
132
|
-
const viewportRef = useRef(null);
|
|
133
|
-
const copyTimer = useRef(void 0);
|
|
134
|
-
const [copied, setCopied] = useState(false);
|
|
135
|
-
const streaming = status === "streaming";
|
|
136
|
-
const tokens = useAgentCodeTokens(code, language);
|
|
137
|
-
const highlighted = useMemo(() => new Set(highlightLines), [highlightLines]);
|
|
138
|
-
let offset = 0;
|
|
139
|
-
const lines = code.split("\n").map((content) => {
|
|
140
|
-
const line = {
|
|
141
|
-
content,
|
|
142
|
-
offset
|
|
143
|
-
};
|
|
144
|
-
offset += content.length + 1;
|
|
145
|
-
return line;
|
|
146
|
-
});
|
|
147
|
-
const resolvedLanguageLabel = languageLabel ?? {
|
|
148
|
-
bash: "Bash",
|
|
149
|
-
diff: "Diff",
|
|
150
|
-
json: "JSON",
|
|
151
|
-
python: "Python",
|
|
152
|
-
text: "Text",
|
|
153
|
-
tsx: "TSX",
|
|
154
|
-
typescript: "TypeScript"
|
|
155
|
-
}[language];
|
|
156
|
-
useEffect(() => () => {
|
|
157
|
-
if (copyTimer.current) window.clearTimeout(copyTimer.current);
|
|
158
|
-
}, []);
|
|
159
|
-
useLayoutEffect(() => {
|
|
160
|
-
const viewport = viewportRef.current;
|
|
161
|
-
if (!viewport || !streaming) return;
|
|
162
|
-
const frame = requestAnimationFrame(() => {
|
|
163
|
-
if (viewport.scrollHeight <= viewport.clientHeight) return;
|
|
164
|
-
if (typeof viewport.scrollTo === "function") viewport.scrollTo({
|
|
165
|
-
top: viewport.scrollHeight,
|
|
166
|
-
behavior: reduce ? "auto" : "smooth"
|
|
167
|
-
});
|
|
168
|
-
else viewport.scrollTop = viewport.scrollHeight;
|
|
169
|
-
});
|
|
170
|
-
return () => cancelAnimationFrame(frame);
|
|
171
|
-
});
|
|
172
|
-
const handleCopy = useCallback(async () => {
|
|
173
|
-
if (onCopy) await onCopy();
|
|
174
|
-
else await navigator.clipboard?.writeText(code);
|
|
175
|
-
setCopied(true);
|
|
176
|
-
if (copyTimer.current) window.clearTimeout(copyTimer.current);
|
|
177
|
-
copyTimer.current = window.setTimeout(() => setCopied(false), 1600);
|
|
178
|
-
}, [code, onCopy]);
|
|
179
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
180
|
-
"data-state": status,
|
|
181
|
-
"aria-busy": streaming,
|
|
182
|
-
className: cn("w-full overflow-hidden rounded-2xl bg-muted/80 text-sm", className),
|
|
183
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
184
|
-
className: "flex h-10 items-center gap-2.5 px-3",
|
|
185
|
-
children: [
|
|
186
|
-
/* @__PURE__ */ jsx(FileCodeCorner, {
|
|
187
|
-
"aria-hidden": "true",
|
|
188
|
-
className: "size-3.5 shrink-0 text-muted-foreground/70"
|
|
189
|
-
}),
|
|
190
|
-
filename ? /* @__PURE__ */ jsx("span", {
|
|
191
|
-
className: "min-w-0 truncate font-mono text-xs text-foreground/80",
|
|
192
|
-
children: filename
|
|
193
|
-
}) : null,
|
|
194
|
-
/* @__PURE__ */ jsx("span", {
|
|
195
|
-
className: "text-micro font-medium uppercase tracking-wide text-muted-foreground/55",
|
|
196
|
-
children: resolvedLanguageLabel
|
|
197
|
-
}),
|
|
198
|
-
showStatus ? /* @__PURE__ */ jsxs("span", {
|
|
199
|
-
className: cn("ml-auto inline-flex shrink-0 items-center gap-1 text-micro font-medium", streaming ? "text-info" : "text-success"),
|
|
200
|
-
children: [streaming ? /* @__PURE__ */ jsx(LoaderCircle, { className: cn("size-3", !reduce && "animate-spin") }) : /* @__PURE__ */ jsx(Check, { className: "size-3" }), streaming ? "Writing" : "Ready"]
|
|
201
|
-
}) : null,
|
|
202
|
-
copyable || onCopy ? /* @__PURE__ */ jsx(m.button, {
|
|
203
|
-
type: "button",
|
|
204
|
-
"aria-label": copied ? "Copied" : "Copy code",
|
|
205
|
-
title: copied ? "Copied" : "Copy code",
|
|
206
|
-
onClick: handleCopy,
|
|
207
|
-
whileTap: reduce ? void 0 : { scale: 0.96 },
|
|
208
|
-
transition: SPRING_PRESS,
|
|
209
|
-
className: cn("grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-background/70 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring", !showStatus && "ml-auto"),
|
|
210
|
-
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" })
|
|
211
|
-
}) : null
|
|
212
|
-
]
|
|
213
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
214
|
-
ref: viewportRef,
|
|
215
|
-
role: streaming ? "log" : void 0,
|
|
216
|
-
"aria-live": streaming ? "off" : void 0,
|
|
217
|
-
className: "overflow-auto border-t border-foreground/[0.06] py-2 [scrollbar-color:color-mix(in_oklab,var(--muted-foreground)_35%,transparent)_transparent] [scrollbar-width:thin]",
|
|
218
|
-
style: { maxHeight },
|
|
219
|
-
children: /* @__PURE__ */ jsx("pre", {
|
|
220
|
-
className: "m-0 min-w-max font-mono text-xs leading-5 text-foreground/85",
|
|
221
|
-
children: /* @__PURE__ */ jsx("code", { children: lines.map((line, index) => {
|
|
222
|
-
const lineNumber = index + 1;
|
|
223
|
-
return /* @__PURE__ */ jsxs("span", {
|
|
224
|
-
className: cn("grid min-h-5", showLineNumbers ? "grid-cols-[2.75rem_minmax(0,1fr)]" : "grid-cols-1", highlighted.has(lineNumber) && "bg-primary/[0.07]"),
|
|
225
|
-
children: [showLineNumbers ? /* @__PURE__ */ jsx("span", {
|
|
226
|
-
className: "select-none pr-3 text-right tabular-nums text-muted-foreground/35",
|
|
227
|
-
children: lineNumber
|
|
228
|
-
}) : null, /* @__PURE__ */ jsx(AgentCodeLine, {
|
|
229
|
-
code: line.content,
|
|
230
|
-
tokens: tokens?.[index],
|
|
231
|
-
className: cn("pr-4", showLineNumbers ? "pl-1" : "pl-4", wrap ? "whitespace-pre-wrap break-words" : "whitespace-pre")
|
|
232
|
-
})]
|
|
233
|
-
}, line.offset);
|
|
234
|
-
}) })
|
|
235
|
-
})
|
|
236
|
-
})]
|
|
134
|
+
}, `${token.offset}-${token.content}`)) : code, suffix]
|
|
237
135
|
});
|
|
238
136
|
}
|
|
239
137
|
function ChangeCount({ value, type }) {
|
|
@@ -413,6 +311,117 @@ function FileDiff({ file, lines, status = "streaming", open, defaultOpen = true,
|
|
|
413
311
|
})]
|
|
414
312
|
});
|
|
415
313
|
}
|
|
314
|
+
var EMPTY_HIGHLIGHT_LINES = [];
|
|
315
|
+
function CodeBlock2({ code, language = "typescript", languageLabel, filename, status = "complete", showStatus = true, showLineNumbers = true, highlightLines = EMPTY_HIGHLIGHT_LINES, maxHeight = 280, wrap = false, copyable = true, onCopy }) {
|
|
316
|
+
const reduce = useReducedMotion() ?? false;
|
|
317
|
+
const viewportRef = useRef(null);
|
|
318
|
+
const copyTimer = useRef(void 0);
|
|
319
|
+
const [copied, setCopied] = useState(false);
|
|
320
|
+
const streaming = status === "streaming";
|
|
321
|
+
const tokens = useAgentCodeTokens(code, language);
|
|
322
|
+
const highlighted = useMemo(() => new Set(highlightLines), [highlightLines]);
|
|
323
|
+
let offset = 0;
|
|
324
|
+
const lines = code.split("\n").map((content) => {
|
|
325
|
+
const line = {
|
|
326
|
+
content,
|
|
327
|
+
offset
|
|
328
|
+
};
|
|
329
|
+
offset += content.length + 1;
|
|
330
|
+
return line;
|
|
331
|
+
});
|
|
332
|
+
const resolvedLanguageLabel = languageLabel ?? {
|
|
333
|
+
bash: "Bash",
|
|
334
|
+
diff: "Diff",
|
|
335
|
+
json: "JSON",
|
|
336
|
+
python: "Python",
|
|
337
|
+
text: "Text",
|
|
338
|
+
tsx: "TSX",
|
|
339
|
+
typescript: "TypeScript"
|
|
340
|
+
}[language];
|
|
341
|
+
useEffect(() => () => {
|
|
342
|
+
if (copyTimer.current) window.clearTimeout(copyTimer.current);
|
|
343
|
+
}, []);
|
|
344
|
+
useLayoutEffect(() => {
|
|
345
|
+
const viewport = viewportRef.current;
|
|
346
|
+
if (!viewport || !streaming) return;
|
|
347
|
+
const frame = requestAnimationFrame(() => {
|
|
348
|
+
if (viewport.scrollHeight <= viewport.clientHeight) return;
|
|
349
|
+
if (typeof viewport.scrollTo === "function") viewport.scrollTo({
|
|
350
|
+
top: viewport.scrollHeight,
|
|
351
|
+
behavior: reduce ? "auto" : "smooth"
|
|
352
|
+
});
|
|
353
|
+
else viewport.scrollTop = viewport.scrollHeight;
|
|
354
|
+
});
|
|
355
|
+
return () => cancelAnimationFrame(frame);
|
|
356
|
+
});
|
|
357
|
+
const handleCopy = useCallback(async () => {
|
|
358
|
+
if (onCopy) await onCopy();
|
|
359
|
+
else await navigator.clipboard?.writeText(code);
|
|
360
|
+
setCopied(true);
|
|
361
|
+
if (copyTimer.current) window.clearTimeout(copyTimer.current);
|
|
362
|
+
copyTimer.current = window.setTimeout(() => setCopied(false), 1600);
|
|
363
|
+
}, [code, onCopy]);
|
|
364
|
+
return /* @__PURE__ */ jsxs(CodeBlock, {
|
|
365
|
+
"data-state": status,
|
|
366
|
+
"aria-busy": streaming,
|
|
367
|
+
size: "sm",
|
|
368
|
+
className: "bg-muted/80",
|
|
369
|
+
children: [/* @__PURE__ */ jsxs(CodeBlockHeader, {
|
|
370
|
+
className: "h-10 gap-2.5 px-3 pt-0",
|
|
371
|
+
children: [
|
|
372
|
+
/* @__PURE__ */ jsx(FileCodeCorner, {
|
|
373
|
+
"aria-hidden": "true",
|
|
374
|
+
className: "size-3.5 shrink-0 text-muted-foreground/70"
|
|
375
|
+
}),
|
|
376
|
+
filename ? /* @__PURE__ */ jsx(CodeBlockTitle, {
|
|
377
|
+
className: "font-mono text-xs text-foreground/80",
|
|
378
|
+
children: filename
|
|
379
|
+
}) : null,
|
|
380
|
+
/* @__PURE__ */ jsx("span", {
|
|
381
|
+
className: "text-micro font-medium uppercase tracking-wide text-muted-foreground/55",
|
|
382
|
+
children: resolvedLanguageLabel
|
|
383
|
+
}),
|
|
384
|
+
showStatus ? /* @__PURE__ */ jsxs("span", {
|
|
385
|
+
className: cn(!copyable && !onCopy && "ml-auto", "inline-flex shrink-0 items-center gap-1 text-micro font-medium", streaming ? "text-info" : "text-success"),
|
|
386
|
+
children: [streaming ? /* @__PURE__ */ jsx(LoaderCircle, { className: cn("size-3", !reduce && "animate-spin") }) : /* @__PURE__ */ jsx(Check, { className: "size-3" }), streaming ? "Writing" : "Ready"]
|
|
387
|
+
}) : null,
|
|
388
|
+
copyable || onCopy ? /* @__PURE__ */ jsx(CodeBlockActions, {
|
|
389
|
+
className: cn("-my-0 -me-0", showStatus ? "ms-0" : "ms-auto"),
|
|
390
|
+
children: /* @__PURE__ */ jsx(m.button, {
|
|
391
|
+
type: "button",
|
|
392
|
+
"aria-label": copied ? "Copied" : "Copy code",
|
|
393
|
+
title: copied ? "Copied" : "Copy code",
|
|
394
|
+
onClick: handleCopy,
|
|
395
|
+
whileTap: reduce ? void 0 : { scale: 0.96 },
|
|
396
|
+
transition: SPRING_PRESS,
|
|
397
|
+
className: "grid size-7 shrink-0 place-items-center rounded-full text-muted-foreground outline-none transition-colors hover:bg-background/70 hover:text-foreground focus-visible:ring-2 focus-visible:ring-ring",
|
|
398
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" })
|
|
399
|
+
})
|
|
400
|
+
}) : null
|
|
401
|
+
]
|
|
402
|
+
}), /* @__PURE__ */ jsx(CodeBlockContent, {
|
|
403
|
+
ref: viewportRef,
|
|
404
|
+
role: streaming ? "log" : void 0,
|
|
405
|
+
"aria-live": streaming ? "off" : void 0,
|
|
406
|
+
className: "max-w-full overflow-auto border-t border-foreground/[0.06] px-0 py-2 font-mono text-xs leading-5 text-foreground/85 [scrollbar-color:color-mix(in_oklab,var(--muted-foreground)_35%,transparent)_transparent] [scrollbar-width:thin]",
|
|
407
|
+
style: { maxHeight },
|
|
408
|
+
wrap,
|
|
409
|
+
children: lines.map((line, index) => {
|
|
410
|
+
const lineNumber = index + 1;
|
|
411
|
+
return /* @__PURE__ */ jsx("span", {
|
|
412
|
+
"data-line-number": showLineNumbers ? lineNumber : void 0,
|
|
413
|
+
className: cn("grid min-h-5", showLineNumbers ? "grid-cols-[2.75rem_minmax(0,1fr)] before:content-[attr(data-line-number)] before:select-none before:pr-3 before:text-right before:tabular-nums before:text-muted-foreground/35" : "grid-cols-1", highlighted.has(lineNumber) && "bg-primary/[0.07]"),
|
|
414
|
+
children: /* @__PURE__ */ jsx(AgentCodeLine, {
|
|
415
|
+
code: line.content,
|
|
416
|
+
tokens: tokens?.[index],
|
|
417
|
+
suffix: index < lines.length - 1 ? "\n" : void 0,
|
|
418
|
+
className: cn("pr-4", showLineNumbers ? "pl-1" : "pl-4", wrap ? "whitespace-pre-wrap break-words" : "whitespace-pre")
|
|
419
|
+
})
|
|
420
|
+
}, line.offset);
|
|
421
|
+
})
|
|
422
|
+
})]
|
|
423
|
+
});
|
|
424
|
+
}
|
|
416
425
|
function getStatusLabel(status) {
|
|
417
426
|
if (status === "running") return "Running";
|
|
418
427
|
if (status === "success") return "Completed";
|
|
@@ -449,15 +458,25 @@ function ToolResultAction({ label, onClick, children }) {
|
|
|
449
458
|
children
|
|
450
459
|
});
|
|
451
460
|
}
|
|
452
|
-
function ToolResultOutput({ children, language: _language = "bash", label, className }) {
|
|
453
|
-
return /* @__PURE__ */ jsxs(
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
className:
|
|
460
|
-
children: /* @__PURE__ */ jsx(
|
|
461
|
+
function ToolResultOutput({ children, language: _language = "bash", label, error = false, className }) {
|
|
462
|
+
return /* @__PURE__ */ jsxs(CodeBlock, {
|
|
463
|
+
"data-error": error || void 0,
|
|
464
|
+
variant: error ? "destructive" : "default",
|
|
465
|
+
size: "sm",
|
|
466
|
+
className,
|
|
467
|
+
children: [/* @__PURE__ */ jsxs(CodeBlockHeader, {
|
|
468
|
+
className: "py-1",
|
|
469
|
+
children: [label ? /* @__PURE__ */ jsx(CodeBlockTitle, {
|
|
470
|
+
className: cn("text-micro uppercase tracking-[0.12em]", error ? "text-destructive" : "text-muted-foreground/60"),
|
|
471
|
+
children: error ? "Reported error" : label
|
|
472
|
+
}) : null, /* @__PURE__ */ jsx(CodeBlockActions, { children: /* @__PURE__ */ jsx(CodeBlockCopyButton, {
|
|
473
|
+
value: children,
|
|
474
|
+
"aria-label": "Copy result"
|
|
475
|
+
}) })]
|
|
476
|
+
}), /* @__PURE__ */ jsx(CodeBlockContent, {
|
|
477
|
+
wrap: true,
|
|
478
|
+
className: cn("max-h-60 text-xs leading-5", error ? "text-destructive" : "text-foreground/80"),
|
|
479
|
+
children
|
|
461
480
|
})]
|
|
462
481
|
});
|
|
463
482
|
}
|
|
@@ -519,7 +538,7 @@ function ToolResult({ tool, title, children, status = "running", kind = "custom"
|
|
|
519
538
|
"aria-expanded": currentOpen,
|
|
520
539
|
"aria-controls": contentId,
|
|
521
540
|
onClick: () => setOpen(!currentOpen),
|
|
522
|
-
className: "group flex min-h-9 w-full items-center gap-2
|
|
541
|
+
className: "group flex min-h-9 w-full items-center gap-2 py-1 text-left outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background",
|
|
523
542
|
children: [
|
|
524
543
|
/* @__PURE__ */ jsx("span", {
|
|
525
544
|
"aria-hidden": "true",
|
|
@@ -568,41 +587,35 @@ function ToolResult({ tool, title, children, status = "running", kind = "custom"
|
|
|
568
587
|
open: currentOpen,
|
|
569
588
|
children: /* @__PURE__ */ jsx("div", {
|
|
570
589
|
className: "pl-6 pt-1.5",
|
|
571
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
590
|
+
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("div", {
|
|
591
|
+
ref: viewportRef,
|
|
592
|
+
role: "log",
|
|
593
|
+
"aria-live": "polite",
|
|
594
|
+
className: "scrollbar-hide overflow-y-auto overscroll-contain",
|
|
595
|
+
style: { maxHeight },
|
|
596
|
+
children
|
|
597
|
+
}), canCopy ? /* @__PURE__ */ jsxs("div", {
|
|
598
|
+
className: "flex items-center gap-0.5 px-2 pb-1.5",
|
|
599
|
+
children: [/* @__PURE__ */ jsx(ToolResultAction, {
|
|
600
|
+
label: copied ? "Copied" : "Copy result",
|
|
601
|
+
onClick: handleCopy,
|
|
602
|
+
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" })
|
|
603
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
604
|
+
className: "ml-auto text-caption text-muted-foreground/55",
|
|
605
|
+
children: /* @__PURE__ */ jsx(ActionSwapRollText, {
|
|
606
|
+
value: status,
|
|
607
|
+
children: statusLabel
|
|
582
608
|
})
|
|
583
|
-
})
|
|
584
|
-
|
|
585
|
-
children: [/* @__PURE__ */ jsx(ToolResultAction, {
|
|
586
|
-
label: copied ? "Copied" : "Copy result",
|
|
587
|
-
onClick: handleCopy,
|
|
588
|
-
children: copied ? /* @__PURE__ */ jsx(Check, { className: "size-3.5" }) : /* @__PURE__ */ jsx(Copy, { className: "size-3.5" })
|
|
589
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
590
|
-
className: "ml-auto text-caption text-muted-foreground/55",
|
|
591
|
-
children: /* @__PURE__ */ jsx(ActionSwapRollText, {
|
|
592
|
-
value: status,
|
|
593
|
-
children: statusLabel
|
|
594
|
-
})
|
|
595
|
-
})]
|
|
596
|
-
}) : null]
|
|
597
|
-
})
|
|
609
|
+
})]
|
|
610
|
+
}) : null] })
|
|
598
611
|
})
|
|
599
612
|
})]
|
|
600
613
|
});
|
|
601
614
|
}
|
|
602
615
|
|
|
603
616
|
export {
|
|
604
|
-
CodeBlock,
|
|
605
617
|
FileDiff,
|
|
618
|
+
CodeBlock2 as CodeBlock,
|
|
606
619
|
ToolResultOutput,
|
|
607
620
|
ToolResult
|
|
608
621
|
};
|