@qredence/fleet 0.5.0 → 0.5.5
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 +21 -0
- package/README.md +8 -1
- package/bin/fleet-prime.mjs +6 -0
- package/dist/web/client/assets/action-swap-roll-DX5o_33Q.js +1 -0
- package/dist/web/client/assets/artifacts-panel-C3yewUBP.js +1 -0
- package/dist/web/client/assets/artifacts-utils-N_kUFbz2.js +1 -0
- package/dist/web/client/assets/bot-Bs7QWJ2q.js +1 -0
- package/dist/web/client/assets/{chat-C64Sv6V-.js → chat-W-yOMyG_.js} +5 -5
- package/dist/web/client/assets/chat-command-palette-D0xDK1j4.js +1 -0
- package/dist/web/client/assets/command-CQzrtjyj.js +2 -0
- package/dist/web/client/assets/ease-vFBiNFNK.js +9 -0
- package/dist/web/client/assets/{fleet-pi-tool-renderer-ZKiX6Ob_.js → fleet-pi-tool-renderer-B0Y7ou0U.js} +28 -30
- package/dist/web/client/assets/generative-text-renderer-SS9c1kNX.js +6 -0
- package/dist/web/client/assets/globals-D_Hy9bT1.css +2 -0
- package/dist/web/client/assets/horizontal-resize-C1TpRLNC.js +1 -0
- package/dist/web/client/assets/index-C9FloFgj.js +12 -0
- package/dist/web/client/assets/{input-Clyn18XG.js → input-CqC82Agz.js} +1 -1
- package/dist/web/client/assets/{input-group-MxDAWX3j.js → input-group-H0TG-mkU.js} +1 -1
- package/dist/web/client/assets/ipython-tool-BrMePqD-.js +3 -0
- package/dist/web/client/assets/markdown-DG7pUdsX.js +2 -0
- package/dist/web/client/assets/{markdown-code-pIaEVDUU.js → markdown-code-BgMzpy7O.js} +1 -1
- package/dist/web/client/assets/notify-Duj26eeZ.js +1 -0
- package/dist/web/client/assets/{openui-renderer-NLUpAS3h.js → openui-renderer-CCfQqUfE.js} +5 -5
- package/dist/web/client/assets/openui-utils-DawGoQNp.js +1 -0
- package/dist/web/client/assets/prime-agent-artifacts-C-g1VPiW.js +5 -0
- package/dist/web/client/assets/{provider-catalog-Gx9qaHBM.js → provider-catalog-BZhZuKSz.js} +1 -1
- package/dist/web/client/assets/provider-label-jKm8v18u.js +1 -0
- package/dist/web/client/assets/range-65lubOFp.js +2 -0
- package/dist/web/client/assets/repl-panel-CCh4ly7J.js +1 -0
- package/dist/web/client/assets/resource-helpers-ULlyU8qK.js +2 -0
- package/dist/web/client/assets/resources-panel-DSU7VGX2.js +1 -0
- package/dist/web/client/assets/routes-DSTyx_J0.js +16 -0
- package/dist/web/client/assets/session-insights-panel-CQdT90Op.js +1 -0
- package/dist/web/client/assets/settings-dialog-CkfpTKfM.js +1 -0
- package/dist/web/client/assets/skeleton-loaders-fStjEeRP.js +1 -0
- package/dist/web/client/assets/square-terminal-BYTN_I86.js +1 -0
- package/dist/web/client/assets/subagent-chat-panel-D-qw4uWb.js +1 -0
- package/dist/web/client/assets/subagent-transcript-C7oRwEEP.js +1 -0
- package/dist/web/client/assets/subagents-panel-aSMWZP9p.js +1 -0
- package/dist/web/client/assets/{switch-ojzdMno9.js → switch-BFEBpUEU.js} +1 -1
- package/dist/web/client/assets/{tool-result-QvhjpNGX.js → tool-result-C2NvnN32.js} +3 -3
- package/dist/web/client/assets/ui-preferences-DUEFuJFj.js +1 -0
- package/dist/web/client/assets/workspace-panel-CjdXlEvd.js +1 -0
- package/dist/web/client/assets/workspace-path-nav-C0AQNZyy.js +1 -0
- package/dist/web/server/{_tanstack-start-manifest_v-uZddQetG-MNZGQOSA.js → _tanstack-start-manifest_v-DZc7dwm7-6ZQLGXB7.js} +23 -16
- package/dist/web/server/{artifacts-panel-knpQvJ-q-WJLZ76QB.js → artifacts-panel-Bt7YUzm4-NCBMXJ25.js} +39 -72
- package/dist/web/server/{chat-command-palette-CPv5GmGJ-22J32S6P.js → chat-command-palette-Co1L3rUY-RQLNME4T.js} +43 -20
- package/dist/web/server/{chunk-5277VI3D.js → chunk-2V6B62OF.js} +213 -275
- package/dist/web/server/{chunk-W7LNJCRJ.js → chunk-3HUI75QM.js} +75 -67
- package/dist/web/server/{chunk-I3FDTJFO.js → chunk-46VQY7SG.js} +6 -87
- package/dist/web/server/{chunk-PRT4QYOB.js → chunk-4UBOIY2S.js} +2 -35
- package/dist/web/server/{chunk-WTYNN6EV.js → chunk-54II5QXQ.js} +23 -1
- package/dist/web/server/chunk-56HSKUBD.js +1805 -0
- package/dist/web/server/{chunk-RPROZ2JC.js → chunk-5RQ6QAZX.js} +133 -133
- package/dist/web/server/{chunk-APN3LVRT.js → chunk-6D524OCJ.js} +201 -204
- package/dist/web/server/chunk-6GMKRR3C.js +161 -0
- package/dist/web/server/chunk-74QOI457.js +45 -0
- package/dist/web/server/{chunk-UBUXV2TW.js → chunk-AECEK3K7.js} +8 -8
- package/dist/web/server/chunk-AQ66E5OW.js +33 -0
- package/dist/web/server/{chunk-JD6EWZCU.js → chunk-AWFOBHH4.js} +50 -50
- package/dist/web/server/{chunk-MK3P3OBZ.js → chunk-BEMDNODD.js} +5 -5
- package/dist/web/server/{chunk-X2TUFLTP.js → chunk-BLVCDQ7E.js} +438 -438
- package/dist/web/server/chunk-FZRBAPUM.js +48 -0
- package/dist/web/server/chunk-G5BCQQ5N.js +34 -0
- package/dist/web/server/chunk-KOIPYBJF.js +3773 -0
- package/dist/web/server/{chunk-XYYNYFFD.js → chunk-LSIHVSUT.js} +2 -2
- package/dist/web/server/{chunk-KVHPE5XH.js → chunk-MDYA4NXK.js} +22 -8
- package/dist/web/server/chunk-NFRJDPB3.js +52 -0
- package/dist/web/server/chunk-P66QQWUM.js +67 -0
- package/dist/web/server/{chunk-4KFMONRT.js → chunk-PDRD2X5G.js} +9 -9
- package/dist/web/server/{chunk-XXNFEXDU.js → chunk-QJBEWT4E.js} +2 -70
- package/dist/web/server/{chunk-AQWTGP35.js → chunk-RX62LUDV.js} +8 -8
- package/dist/web/server/chunk-SR65ARVS.js +192 -0
- package/dist/web/server/{chunk-WK7CQS2N.js → chunk-SZ65K4CO.js} +48 -48
- package/dist/web/server/{chunk-C7EKOPZU.js → chunk-TO3YPLNZ.js} +89 -89
- package/dist/web/server/{chunk-IFV5M33X.js → chunk-UKINNXJY.js} +12 -26
- package/dist/web/server/chunk-VGDP4YDU.js +401 -0
- package/dist/web/server/{fleet-pi-tool-renderer-5vYFNeZS-IHKMLT7W.js → chunk-VRLTWOVJ.js} +46 -393
- package/dist/web/server/{chunk-KDSISV4P.js → chunk-WN77JNYY.js} +2 -50
- package/dist/web/server/{chunk-OADQILSQ.js → chunk-WZNZQNI4.js} +267 -3667
- package/dist/web/server/{chunk-KAWYGHDN.js → chunk-XFVL5ITL.js} +2354 -2314
- package/dist/web/server/{chunk-ZX3XOSYO.js → chunk-XLCTCC4W.js} +3 -3
- package/dist/web/server/{chunk-TTQ75CXC.js → chunk-Y4MHIA7B.js} +97 -40
- package/dist/web/server/fleet-pi-tool-renderer-CE45vM6T-2UQN6RJM.js +37 -0
- package/dist/web/server/{fork-picker-dialog-BZzfxdQd-C6SPHFAW.js → fork-picker-dialog-DCzuGelH-TN2Q5OXI.js} +5 -5
- package/dist/web/server/{markdown-Ct_q4D-z-VFWZRBTY.js → markdown-Boni3lHk-AZGKDNAR.js} +1 -1
- package/dist/web/server/{markdown-code-C_ih1bX1-5CIWT3CH.js → markdown-code-BrWukbg3-D2GN4Y77.js} +2 -2
- package/dist/web/server/{openui-renderer-BT5jL0Yf-XYLLN5U6.js → openui-renderer-c36_GYes-HX46N4M5.js} +14 -13
- package/dist/web/server/repl-panel-D9E8nkQy-L45ZNG2V.js +118 -0
- package/dist/web/server/{resources-panel-DNCVHTIg-PJYMXVGE.js → resources-panel-CwKh4U9f-D3VDEMDW.js} +6 -6
- package/dist/web/server/{router-DDxOMz3K-HRBXILHM.js → router-_ZpegqiQ-QIE44PIB.js} +1811 -1334
- package/dist/web/server/{routes-BX4Tv-6R-FHIZYUWW.js → routes-Ct81-8Tq-LHRMOS7R.js} +3958 -4534
- package/dist/web/server/server.js +3 -3
- package/dist/web/server/{session-insights-panel-gYkkAE8H-W4O74Z7H.js → session-insights-panel-BHZyKDTo-LRMAMA3O.js} +5 -3
- package/dist/web/server/{settings-dialog-BTBFLQ1P-ZENQ4KWK.js → settings-dialog-B4uUS6f--AZ4I4ZOT.js} +179 -193
- package/dist/web/server/{start-CLAD7RcD-56S4BWMM.js → start-BYVnok_H-IA6TWGA3.js} +1 -1
- package/dist/web/server/subagent-chat-panel-C97S3WID-DLOAD5TG.js +63 -0
- package/dist/web/server/subagents-panel-iHpvMIZy-LI6XK66M.js +181 -0
- package/dist/web/server/{chunk-5SZXUN3Y.js → workspace-panel-CHPoiXEo-YB4WS3MK.js} +29 -16
- package/package.json +15 -7
- package/dist/web/client/assets/artifacts-panel-8TyrNBM_.js +0 -1
- package/dist/web/client/assets/chat-command-palette-HpsmKfLO.js +0 -1
- package/dist/web/client/assets/collapsible-WCSnxhr2.js +0 -1
- package/dist/web/client/assets/command-DgfiCKcY.js +0 -2
- package/dist/web/client/assets/globals-BmxtUHFx.css +0 -2
- package/dist/web/client/assets/horizontal-resize-B76jjn5v.js +0 -1
- package/dist/web/client/assets/index-0pBr_bKy.js +0 -12
- package/dist/web/client/assets/markdown-BXWmNJo7.js +0 -2
- package/dist/web/client/assets/prime-agent-artifacts-k9JiTDZM.js +0 -5
- package/dist/web/client/assets/provider-brand-icon-VCebsuTD.js +0 -1
- package/dist/web/client/assets/range-KAaLzImH.js +0 -2
- package/dist/web/client/assets/resources-panel-BWuKeyrb.js +0 -1
- package/dist/web/client/assets/routes-BPRw0UzV.js +0 -20
- package/dist/web/client/assets/session-insights-panel-CPymkzZT.js +0 -1
- package/dist/web/client/assets/settings-dialog-6p8mjg8t.js +0 -1
- package/dist/web/client/assets/shared-DAI9OAw0.js +0 -2
- package/dist/web/client/assets/skeleton-loaders-qxIkJKCA.js +0 -1
- package/dist/web/client/assets/workspace-panel-C67-fqw4.js +0 -1
- package/dist/web/client/assets/workspace-path-nav-BrQHo6es.js +0 -9
- package/dist/web/server/chunk-KJ4UUAEU.js +0 -83
- package/dist/web/server/chunk-NGI44XRR.js +0 -334
- package/dist/web/server/workspace-panel-BNAXF57q-EQCBPEG4.js +0 -28
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Eye
|
|
3
|
-
} from "./chunk-DBXYBYBP.js";
|
|
4
1
|
import {
|
|
5
2
|
Citations,
|
|
6
3
|
LazyMarkdown,
|
|
@@ -8,11 +5,18 @@ import {
|
|
|
8
5
|
LogOut,
|
|
9
6
|
MessageCircleQuestionMark,
|
|
10
7
|
PI_TOOL_RENDERERS,
|
|
8
|
+
Terminal,
|
|
11
9
|
mono,
|
|
12
10
|
pct,
|
|
13
11
|
progressOf,
|
|
14
12
|
useHoverCapable
|
|
15
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-3HUI75QM.js";
|
|
14
|
+
import {
|
|
15
|
+
stripSandboxPrefixes
|
|
16
|
+
} from "./chunk-P66QQWUM.js";
|
|
17
|
+
import {
|
|
18
|
+
Eye
|
|
19
|
+
} from "./chunk-DBXYBYBP.js";
|
|
16
20
|
import {
|
|
17
21
|
GitBranch,
|
|
18
22
|
Globe,
|
|
@@ -31,21 +35,31 @@ import {
|
|
|
31
35
|
toHtml
|
|
32
36
|
} from "./chunk-YRWVQ7BW.js";
|
|
33
37
|
import {
|
|
34
|
-
CircleX,
|
|
35
38
|
CodeBlock,
|
|
36
39
|
FileDiff,
|
|
37
40
|
ToolResult,
|
|
38
41
|
ToolResultOutput
|
|
39
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-UKINNXJY.js";
|
|
40
43
|
import {
|
|
41
44
|
ActionSwapRollText,
|
|
42
45
|
AgentDisclosure,
|
|
46
|
+
CircleX,
|
|
43
47
|
Collapsible,
|
|
44
48
|
CollapsibleContent,
|
|
45
49
|
CollapsibleTrigger,
|
|
46
50
|
FileCodeCorner,
|
|
47
51
|
Wrench
|
|
48
|
-
} from "./chunk-
|
|
52
|
+
} from "./chunk-6D524OCJ.js";
|
|
53
|
+
import {
|
|
54
|
+
AnimatePresence,
|
|
55
|
+
EASE_IN_OUT,
|
|
56
|
+
EASE_OUT,
|
|
57
|
+
SPRING_LAYOUT,
|
|
58
|
+
SPRING_PRESS,
|
|
59
|
+
SPRING_SWAP,
|
|
60
|
+
m,
|
|
61
|
+
useReducedMotion
|
|
62
|
+
} from "./chunk-QJBEWT4E.js";
|
|
49
63
|
import {
|
|
50
64
|
RotateCcw
|
|
51
65
|
} from "./chunk-6RJYXDSD.js";
|
|
@@ -53,6 +67,9 @@ import {
|
|
|
53
67
|
CircleCheck,
|
|
54
68
|
LoaderCircle
|
|
55
69
|
} from "./chunk-PKCTG7EW.js";
|
|
70
|
+
import {
|
|
71
|
+
ChevronRight
|
|
72
|
+
} from "./chunk-7QCDOBZ3.js";
|
|
56
73
|
import {
|
|
57
74
|
ChevronUp,
|
|
58
75
|
isSafeExternalUrl
|
|
@@ -63,43 +80,31 @@ import {
|
|
|
63
80
|
import {
|
|
64
81
|
Check
|
|
65
82
|
} from "./chunk-NLIUTTKL.js";
|
|
66
|
-
import "./chunk-XYYNYFFD.js";
|
|
67
83
|
import {
|
|
68
84
|
X
|
|
69
|
-
} from "./chunk-
|
|
70
|
-
import "./chunk-ST5I2PLN.js";
|
|
71
|
-
import {
|
|
72
|
-
AnimatePresence,
|
|
73
|
-
EASE_IN_OUT,
|
|
74
|
-
EASE_OUT,
|
|
75
|
-
SPRING_LAYOUT,
|
|
76
|
-
SPRING_PRESS,
|
|
77
|
-
SPRING_SWAP,
|
|
78
|
-
m,
|
|
79
|
-
stripSandboxPrefixes,
|
|
80
|
-
useReducedMotion
|
|
81
|
-
} from "./chunk-XXNFEXDU.js";
|
|
82
|
-
import {
|
|
83
|
-
ChevronRight
|
|
84
|
-
} from "./chunk-7QCDOBZ3.js";
|
|
85
|
-
import "./chunk-FAGDMGLK.js";
|
|
86
|
-
import "./chunk-BYXBJQAS.js";
|
|
85
|
+
} from "./chunk-BLVCDQ7E.js";
|
|
87
86
|
import {
|
|
88
87
|
CircleAlert,
|
|
89
88
|
FileText
|
|
90
89
|
} from "./chunk-7APYEQIO.js";
|
|
90
|
+
import {
|
|
91
|
+
IpythonTool,
|
|
92
|
+
ToolApprovalFooter,
|
|
93
|
+
ToolTextShimmer,
|
|
94
|
+
adaptToolPart,
|
|
95
|
+
useToolComplete
|
|
96
|
+
} from "./chunk-VGDP4YDU.js";
|
|
91
97
|
import {
|
|
92
98
|
createLucideIcon
|
|
93
99
|
} from "./chunk-E26EAQIM.js";
|
|
94
100
|
import {
|
|
95
101
|
cn
|
|
96
102
|
} from "./chunk-DJMHPJBP.js";
|
|
97
|
-
import
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
import "./chunk-MLKGABMK.js";
|
|
103
|
+
import {
|
|
104
|
+
__exportAll
|
|
105
|
+
} from "./chunk-L547YHC4.js";
|
|
101
106
|
|
|
102
|
-
// web/app/dist/server/assets/fleet-pi-tool-renderer-
|
|
107
|
+
// web/app/dist/server/assets/fleet-pi-tool-renderer-CE45vM6T.js
|
|
103
108
|
import React, { createContext, memo, useCallback, useContext, useEffect, useId, useInsertionEffect, useLayoutEffect, useMemo, useRef, useState } from "react";
|
|
104
109
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
105
110
|
var ChevronsDown = createLucideIcon("chevrons-down", [["path", {
|
|
@@ -116,20 +121,6 @@ var ChevronsUp = createLucideIcon("chevrons-up", [["path", {
|
|
|
116
121
|
d: "m17 18-5-5-5 5",
|
|
117
122
|
key: "2avn1x"
|
|
118
123
|
}]]);
|
|
119
|
-
var CodeXml = createLucideIcon("code-xml", [
|
|
120
|
-
["path", {
|
|
121
|
-
d: "m18 16 4-4-4-4",
|
|
122
|
-
key: "1inbqp"
|
|
123
|
-
}],
|
|
124
|
-
["path", {
|
|
125
|
-
d: "m6 8-4 4 4 4",
|
|
126
|
-
key: "15zrgr"
|
|
127
|
-
}],
|
|
128
|
-
["path", {
|
|
129
|
-
d: "m14.5 4-5 16",
|
|
130
|
-
key: "e7oirm"
|
|
131
|
-
}]
|
|
132
|
-
]);
|
|
133
124
|
var FilePlus = createLucideIcon("file-plus", [
|
|
134
125
|
["path", {
|
|
135
126
|
d: "M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",
|
|
@@ -164,13 +155,6 @@ var FolderSearch = createLucideIcon("folder-search", [
|
|
|
164
155
|
key: "18b49y"
|
|
165
156
|
}]
|
|
166
157
|
]);
|
|
167
|
-
var Terminal = createLucideIcon("terminal", [["path", {
|
|
168
|
-
d: "M12 19h8",
|
|
169
|
-
key: "baeox8"
|
|
170
|
-
}], ["path", {
|
|
171
|
-
d: "m4 17 6-6-6-6",
|
|
172
|
-
key: "1yngyt"
|
|
173
|
-
}]]);
|
|
174
158
|
var toolStateCache = /* @__PURE__ */ new Map();
|
|
175
159
|
function getToolStateSnapshot(part) {
|
|
176
160
|
return {
|
|
@@ -880,22 +864,6 @@ function parseMcpToolType(partType) {
|
|
|
880
864
|
category: "other"
|
|
881
865
|
};
|
|
882
866
|
}
|
|
883
|
-
function ToolTextShimmerComponent({ children, as: Component = "p", className, duration = 2, spread = 100, delay = 0 }) {
|
|
884
|
-
const style = {
|
|
885
|
-
"--an-shimmer-duration": `${duration}s`,
|
|
886
|
-
"--an-shimmer-spread": `${spread}px`,
|
|
887
|
-
animationDelay: delay > 0 ? `${delay}s` : void 0,
|
|
888
|
-
animationDuration: `${duration}s`,
|
|
889
|
-
animationIterationCount: "infinite",
|
|
890
|
-
animationTimingFunction: "linear"
|
|
891
|
-
};
|
|
892
|
-
return /* @__PURE__ */ jsx(Component, {
|
|
893
|
-
className: cn("an-text-shimmer", "an-text-shimmer--active", className),
|
|
894
|
-
style,
|
|
895
|
-
children
|
|
896
|
-
});
|
|
897
|
-
}
|
|
898
|
-
var ToolTextShimmer = React.memo(ToolTextShimmerComponent);
|
|
899
867
|
function ToolRowBase({ icon, shimmerLabel, completeLabel, isAnimating, detail, onDetailClick, trailingContent, expandable = false, expanded, defaultOpen = false, onToggleExpand, children }) {
|
|
900
868
|
const isComplete = !isAnimating;
|
|
901
869
|
const isExpanded = expanded ?? false;
|
|
@@ -963,221 +931,6 @@ var GenericTool = memo(function GenericTool2({ icon, title, subtitle, isPending,
|
|
|
963
931
|
onDetailClick: onSubtitleClick
|
|
964
932
|
});
|
|
965
933
|
});
|
|
966
|
-
function useToolComplete(isAnimating, duration, onComplete) {
|
|
967
|
-
const onCompleteRef = useRef(onComplete);
|
|
968
|
-
useEffect(() => {
|
|
969
|
-
onCompleteRef.current = onComplete;
|
|
970
|
-
}, [onComplete]);
|
|
971
|
-
useEffect(() => {
|
|
972
|
-
if (!isAnimating) return;
|
|
973
|
-
const t = setTimeout(() => onCompleteRef.current(), duration);
|
|
974
|
-
return () => clearTimeout(t);
|
|
975
|
-
}, [isAnimating, duration]);
|
|
976
|
-
}
|
|
977
|
-
function calculateDiffStatsFromPatch(patches) {
|
|
978
|
-
let addedLines = 0;
|
|
979
|
-
let removedLines = 0;
|
|
980
|
-
for (const patch of patches) {
|
|
981
|
-
if (!patch.lines) continue;
|
|
982
|
-
for (const line of patch.lines) if (line.startsWith("+")) addedLines++;
|
|
983
|
-
else if (line.startsWith("-")) removedLines++;
|
|
984
|
-
}
|
|
985
|
-
if (addedLines === 0 && removedLines === 0) return void 0;
|
|
986
|
-
const parts = [];
|
|
987
|
-
if (addedLines > 0) parts.push(`+${addedLines}`);
|
|
988
|
-
if (removedLines > 0) parts.push(`-${removedLines}`);
|
|
989
|
-
return parts.join(" ");
|
|
990
|
-
}
|
|
991
|
-
function getDiffLinesFromPatch(patches) {
|
|
992
|
-
const result = [];
|
|
993
|
-
for (const patch of patches) {
|
|
994
|
-
if (!patch.lines) continue;
|
|
995
|
-
for (const line of patch.lines) if (line.startsWith("+")) result.push({
|
|
996
|
-
type: "add",
|
|
997
|
-
content: line.slice(1)
|
|
998
|
-
});
|
|
999
|
-
else if (line.startsWith("-")) result.push({
|
|
1000
|
-
type: "remove",
|
|
1001
|
-
content: line.slice(1)
|
|
1002
|
-
});
|
|
1003
|
-
else if (line.startsWith(" ")) result.push({
|
|
1004
|
-
type: "context",
|
|
1005
|
-
content: line.slice(1)
|
|
1006
|
-
});
|
|
1007
|
-
}
|
|
1008
|
-
return result;
|
|
1009
|
-
}
|
|
1010
|
-
function mapToolStateToStepState(aiState) {
|
|
1011
|
-
return aiState === "result" ? "complete" : "animating";
|
|
1012
|
-
}
|
|
1013
|
-
function mapToolNameToVariant(toolName2) {
|
|
1014
|
-
const lower = toolName2.toLowerCase();
|
|
1015
|
-
if (lower === "thinking" || lower === "reasoning") return "thinking";
|
|
1016
|
-
if (lower === "websearch" || lower === "web_search" || lower === "grep" || lower === "glob" || lower === "webfetch" || lower === "web_fetch") return "search";
|
|
1017
|
-
}
|
|
1018
|
-
function extractToolDetail(toolName2, args) {
|
|
1019
|
-
switch (toolName2) {
|
|
1020
|
-
case "Bash":
|
|
1021
|
-
return args?.command ? String(args.command).slice(0, 80) : "";
|
|
1022
|
-
case "Edit":
|
|
1023
|
-
case "Write":
|
|
1024
|
-
case "Read":
|
|
1025
|
-
return args?.file_path ? String(args.file_path).split("/").pop() ?? "" : "";
|
|
1026
|
-
case "Grep":
|
|
1027
|
-
return args?.pattern ? String(args.pattern) : "";
|
|
1028
|
-
case "Glob":
|
|
1029
|
-
return args?.pattern ? String(args.pattern) : "";
|
|
1030
|
-
case "WebSearch":
|
|
1031
|
-
case "web_search":
|
|
1032
|
-
return args?.query ? String(args.query) : "";
|
|
1033
|
-
case "WebFetch":
|
|
1034
|
-
case "web_fetch":
|
|
1035
|
-
return args?.url ? String(args.url).slice(0, 60) : "";
|
|
1036
|
-
default:
|
|
1037
|
-
return "";
|
|
1038
|
-
}
|
|
1039
|
-
}
|
|
1040
|
-
function mapToolInvocationToStep(toolCallId, toolInvocation) {
|
|
1041
|
-
const { toolName: toolName2, args = {}, result } = toolInvocation;
|
|
1042
|
-
const step = {
|
|
1043
|
-
id: toolCallId,
|
|
1044
|
-
type: "tool-call",
|
|
1045
|
-
toolName: toolName2 === "PlanWrite" ? "Plan" : toolName2 === "TodoWrite" ? "Todo" : toolName2,
|
|
1046
|
-
toolDetail: extractToolDetail(toolName2, args),
|
|
1047
|
-
duration: Number.MAX_SAFE_INTEGER,
|
|
1048
|
-
toolVariant: mapToolNameToVariant(toolName2)
|
|
1049
|
-
};
|
|
1050
|
-
if (toolName2 === "Bash") {
|
|
1051
|
-
step.bashCommand = args?.command ? String(args.command) : void 0;
|
|
1052
|
-
if (toolInvocation.state === "result" && result) {
|
|
1053
|
-
if (typeof result === "string") {
|
|
1054
|
-
step.bashOutput = result;
|
|
1055
|
-
step.bashSuccess = true;
|
|
1056
|
-
} else if (typeof result === "object") {
|
|
1057
|
-
const stdout = typeof result?.stdout === "string" ? result.stdout : typeof result?.output === "string" ? result.output : "";
|
|
1058
|
-
const stderr = typeof result?.stderr === "string" ? result.stderr : "";
|
|
1059
|
-
step.bashOutput = [stdout, stderr].filter(Boolean).join(stdout && stderr ? "\n" : "");
|
|
1060
|
-
const exitCode = result?.exitCode ?? result?.exit_code;
|
|
1061
|
-
step.bashSuccess = exitCode === void 0 ? true : exitCode === 0;
|
|
1062
|
-
} else {
|
|
1063
|
-
step.bashOutput = JSON.stringify(result);
|
|
1064
|
-
step.bashSuccess = true;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
}
|
|
1068
|
-
if (toolName2 === "Edit" || toolName2 === "Write" || toolName2 === "Read") step.filePath = args?.file_path ? String(args.file_path) : void 0;
|
|
1069
|
-
if (toolName2 === "Write") {
|
|
1070
|
-
const content = typeof result?.content === "string" ? result.content : typeof args?.content === "string" ? args.content : "";
|
|
1071
|
-
if (content) {
|
|
1072
|
-
const lines = content.split("\n");
|
|
1073
|
-
step.diffStats = `+${lines.length}`;
|
|
1074
|
-
step.diffLines = lines.map((line) => ({
|
|
1075
|
-
type: "add",
|
|
1076
|
-
content: line
|
|
1077
|
-
}));
|
|
1078
|
-
}
|
|
1079
|
-
}
|
|
1080
|
-
if (toolName2 === "Edit" && Array.isArray(result?.structuredPatch)) {
|
|
1081
|
-
step.diffStats = calculateDiffStatsFromPatch(result.structuredPatch);
|
|
1082
|
-
step.diffLines = getDiffLinesFromPatch(result.structuredPatch);
|
|
1083
|
-
}
|
|
1084
|
-
if (toolName2 === "WebSearch" || toolName2 === "web_search" || toolName2 === "Grep" || toolName2 === "Glob") {
|
|
1085
|
-
step.searchQuery = args?.query ?? args?.pattern ? String(args?.query ?? args?.pattern) : void 0;
|
|
1086
|
-
step.searchSource = toolName2 === "WebSearch" || toolName2 === "web_search" ? "web" : "code";
|
|
1087
|
-
}
|
|
1088
|
-
if (toolName2.toLowerCase() === "thinking" || toolName2.toLowerCase() === "reasoning") {
|
|
1089
|
-
const fromArgs = typeof args?.thought === "string" ? args.thought : typeof args?.text === "string" ? args.text : void 0;
|
|
1090
|
-
const fromResult = typeof result === "string" ? result : result && typeof result === "object" && typeof result.text === "string" ? result.text : typeof result === "object" && result && typeof result.thought === "string" ? result.thought : void 0;
|
|
1091
|
-
step.thoughtContent = fromArgs ?? fromResult;
|
|
1092
|
-
}
|
|
1093
|
-
return step;
|
|
1094
|
-
}
|
|
1095
|
-
function resolveToolPartState(partState) {
|
|
1096
|
-
if (partState === "output-available") return "result";
|
|
1097
|
-
if (partState === "input-streaming") return "partial-call";
|
|
1098
|
-
return "call";
|
|
1099
|
-
}
|
|
1100
|
-
function adaptToolPart(part, toolName2) {
|
|
1101
|
-
const state = resolveToolPartState(part.state);
|
|
1102
|
-
return {
|
|
1103
|
-
step: mapToolInvocationToStep(part.toolCallId ?? part.id ?? toolName2.toLowerCase(), {
|
|
1104
|
-
toolName: toolName2,
|
|
1105
|
-
args: part.input ?? part.args ?? {},
|
|
1106
|
-
state,
|
|
1107
|
-
result: part.output ?? part.result
|
|
1108
|
-
}),
|
|
1109
|
-
stepState: mapToolStateToStepState(state)
|
|
1110
|
-
};
|
|
1111
|
-
}
|
|
1112
|
-
var ToolApprovalFooter = memo(function ToolApprovalFooter2({ isPending, approveLabel, rejectLabel, onApprove, onReject }) {
|
|
1113
|
-
const [decision, setDecision] = useState(null);
|
|
1114
|
-
const approveText = decision === "approved" ? "Approved" : approveLabel ?? "Next";
|
|
1115
|
-
const rejectText = decision === "rejected" ? "Skipped" : rejectLabel ?? "Skip";
|
|
1116
|
-
const handleApprove = () => {
|
|
1117
|
-
if (decision) return;
|
|
1118
|
-
setDecision("approved");
|
|
1119
|
-
onApprove?.();
|
|
1120
|
-
};
|
|
1121
|
-
const handleReject = () => {
|
|
1122
|
-
if (decision) return;
|
|
1123
|
-
setDecision("rejected");
|
|
1124
|
-
onReject?.();
|
|
1125
|
-
};
|
|
1126
|
-
const statusConfig = useMemo(() => {
|
|
1127
|
-
if (decision === "approved") return {
|
|
1128
|
-
label: "Waiting",
|
|
1129
|
-
dots: true
|
|
1130
|
-
};
|
|
1131
|
-
if (decision === "rejected") return {
|
|
1132
|
-
label: "Canceled",
|
|
1133
|
-
dots: false
|
|
1134
|
-
};
|
|
1135
|
-
if (isPending) return {
|
|
1136
|
-
label: "Starting",
|
|
1137
|
-
dots: true
|
|
1138
|
-
};
|
|
1139
|
-
return null;
|
|
1140
|
-
}, [decision, isPending]);
|
|
1141
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1142
|
-
className: "flex items-center justify-between border-t border-border bg-an-tool-background py-1 pr-2 pl-3",
|
|
1143
|
-
children: [statusConfig ? /* @__PURE__ */ jsxs("span", {
|
|
1144
|
-
className: "text-xs text-an-tool-color-muted",
|
|
1145
|
-
children: [statusConfig.label, statusConfig.dots && /* @__PURE__ */ jsxs("span", {
|
|
1146
|
-
className: "inline-flex",
|
|
1147
|
-
"aria-hidden": "true",
|
|
1148
|
-
children: [
|
|
1149
|
-
/* @__PURE__ */ jsx("span", {
|
|
1150
|
-
className: "animate-[loading-dots_1.4s_infinite_0.2s] text-an-tool-color-muted",
|
|
1151
|
-
children: "."
|
|
1152
|
-
}),
|
|
1153
|
-
/* @__PURE__ */ jsx("span", {
|
|
1154
|
-
className: "animate-[loading-dots_1.4s_infinite_0.4s] text-an-tool-color-muted",
|
|
1155
|
-
children: "."
|
|
1156
|
-
}),
|
|
1157
|
-
/* @__PURE__ */ jsx("span", {
|
|
1158
|
-
className: "animate-[loading-dots_1.4s_infinite_0.6s] text-an-tool-color-muted",
|
|
1159
|
-
children: "."
|
|
1160
|
-
})
|
|
1161
|
-
]
|
|
1162
|
-
})]
|
|
1163
|
-
}) : /* @__PURE__ */ jsx("span", { "aria-hidden": "true" }), /* @__PURE__ */ jsxs("div", {
|
|
1164
|
-
className: "flex gap-1",
|
|
1165
|
-
children: [/* @__PURE__ */ jsx("button", {
|
|
1166
|
-
type: "button",
|
|
1167
|
-
onClick: handleReject,
|
|
1168
|
-
disabled: Boolean(decision),
|
|
1169
|
-
className: "h-5 rounded-[4px] px-1.5 text-xs text-muted-foreground transition-[background-color,color,transform] duration-150 hover:bg-muted/50 hover:text-an-tool-color active:scale-[0.98] disabled:opacity-60 disabled:hover:bg-transparent disabled:active:scale-100",
|
|
1170
|
-
children: rejectText
|
|
1171
|
-
}), /* @__PURE__ */ jsx("button", {
|
|
1172
|
-
type: "button",
|
|
1173
|
-
onClick: handleApprove,
|
|
1174
|
-
disabled: Boolean(decision),
|
|
1175
|
-
className: "h-5 rounded-[4px] bg-an-primary-color px-1.5 text-xs font-medium text-an-send-button-color transition-[background-color,transform] duration-150 hover:bg-an-primary-color/90 active:scale-[0.98] disabled:opacity-60 disabled:hover:bg-an-primary-color disabled:active:scale-100",
|
|
1176
|
-
children: approveText
|
|
1177
|
-
})]
|
|
1178
|
-
})]
|
|
1179
|
-
});
|
|
1180
|
-
});
|
|
1181
934
|
function extractCommandSummary(cmd) {
|
|
1182
935
|
return cmd.split("|").map((s) => s.trim().split(/\s+/)[0] ?? "").filter(Boolean).slice(0, 4).join(", ");
|
|
1183
936
|
}
|
|
@@ -12217,7 +11970,8 @@ function EditToolDiffCard({ step, state, onComplete, input, output, isCollapsibl
|
|
|
12217
11970
|
}
|
|
12218
11971
|
var EditTool = memo(function EditTool2({ part, isCollapsible = false, onFilePathClick }) {
|
|
12219
11972
|
const approval = part.input?.approval ?? part.args?.approval;
|
|
12220
|
-
const
|
|
11973
|
+
const toolName2 = part.type?.replace("tool-", "") || "Edit";
|
|
11974
|
+
const { step, stepState } = adaptToolPart(part, toolName2);
|
|
12221
11975
|
const noop = () => {
|
|
12222
11976
|
};
|
|
12223
11977
|
return /* @__PURE__ */ jsx(EditToolDiffCard, {
|
|
@@ -12231,112 +11985,6 @@ var EditTool = memo(function EditTool2({ part, isCollapsible = false, onFilePath
|
|
|
12231
11985
|
onFilePathClick
|
|
12232
11986
|
});
|
|
12233
11987
|
});
|
|
12234
|
-
function getInputCode(part) {
|
|
12235
|
-
const input = part.input ?? part.args ?? {};
|
|
12236
|
-
if (typeof input.code === "string") return input.code;
|
|
12237
|
-
return "";
|
|
12238
|
-
}
|
|
12239
|
-
function getOutputDetails(part) {
|
|
12240
|
-
const out = part.output ?? part.result;
|
|
12241
|
-
if (!out || typeof out !== "object") return void 0;
|
|
12242
|
-
return out;
|
|
12243
|
-
}
|
|
12244
|
-
function firstNonEmpty(...candidates) {
|
|
12245
|
-
for (const c of candidates) if (c && c.trim()) return c;
|
|
12246
|
-
return "";
|
|
12247
|
-
}
|
|
12248
|
-
function IpythonCellCard({ step, state, onComplete, approval, cellIndex, part }) {
|
|
12249
|
-
useToolComplete(state === "animating", step.duration, onComplete);
|
|
12250
|
-
const isPending = state === "animating";
|
|
12251
|
-
const code = getInputCode(part);
|
|
12252
|
-
const details = getOutputDetails(part);
|
|
12253
|
-
const isBashCell = code.trimStart().startsWith("%%bash");
|
|
12254
|
-
const cellLabel = cellIndex !== void 0 ? `In [${cellIndex}]` : "IPython";
|
|
12255
|
-
const displayOutput = firstNonEmpty(details?.result, details?.stdout, details?.stderr, details?.error?.evalue);
|
|
12256
|
-
const hasError = Boolean(details?.error) || Boolean(details?.errorEname) || details?.status === "error";
|
|
12257
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
12258
|
-
className: "overflow-hidden rounded-an-tool-border-radius border border-border bg-an-tool-background",
|
|
12259
|
-
children: [
|
|
12260
|
-
/* @__PURE__ */ jsxs("div", {
|
|
12261
|
-
className: "flex h-7 items-center justify-between pr-2 pl-2.5",
|
|
12262
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
12263
|
-
className: "flex min-w-0 items-center gap-1.5 overflow-hidden",
|
|
12264
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
12265
|
-
className: "inline-flex items-center gap-1 rounded-sm bg-muted px-1.5 py-0.5 font-mono text-[10px] leading-none text-muted-foreground uppercase",
|
|
12266
|
-
children: [/* @__PURE__ */ jsx(CodeXml, { className: "h-3 w-3" }), isBashCell ? "shell" : "python"]
|
|
12267
|
-
}), isPending ? /* @__PURE__ */ jsx(ToolTextShimmer, {
|
|
12268
|
-
as: "span",
|
|
12269
|
-
duration: 1.2,
|
|
12270
|
-
className: "m-0 inline-flex h-full items-center truncate text-xs leading-none",
|
|
12271
|
-
children: "Running cell"
|
|
12272
|
-
}) : /* @__PURE__ */ jsxs("span", {
|
|
12273
|
-
className: "truncate text-xs text-muted-foreground",
|
|
12274
|
-
children: [hasError ? "Cell failed" : "Ran cell", details?.kernelRestarted && " \xB7 kernel restarted"]
|
|
12275
|
-
})]
|
|
12276
|
-
}), isPending && /* @__PURE__ */ jsx("svg", {
|
|
12277
|
-
className: "h-3 w-3 shrink-0 animate-spin text-muted-foreground",
|
|
12278
|
-
viewBox: "0 0 16 16",
|
|
12279
|
-
fill: "none",
|
|
12280
|
-
children: /* @__PURE__ */ jsx("circle", {
|
|
12281
|
-
cx: "8",
|
|
12282
|
-
cy: "8",
|
|
12283
|
-
r: "6",
|
|
12284
|
-
stroke: "currentColor",
|
|
12285
|
-
strokeWidth: "1.5",
|
|
12286
|
-
strokeDasharray: "28",
|
|
12287
|
-
strokeDashoffset: "7",
|
|
12288
|
-
strokeLinecap: "round"
|
|
12289
|
-
})
|
|
12290
|
-
})]
|
|
12291
|
-
}),
|
|
12292
|
-
/* @__PURE__ */ jsxs("div", {
|
|
12293
|
-
className: "overflow-hidden border-t border-border bg-background px-2.5 py-1.5 font-mono text-[12px] leading-[16px]",
|
|
12294
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
12295
|
-
className: "break-all whitespace-pre-wrap",
|
|
12296
|
-
children: [/* @__PURE__ */ jsxs("span", {
|
|
12297
|
-
className: "mr-2 text-cyan-600 select-none dark:text-cyan-400",
|
|
12298
|
-
children: [cellLabel, ":"]
|
|
12299
|
-
}), /* @__PURE__ */ jsx("span", {
|
|
12300
|
-
className: "text-foreground",
|
|
12301
|
-
children: code
|
|
12302
|
-
})]
|
|
12303
|
-
}), !isPending && displayOutput && /* @__PURE__ */ jsx("div", {
|
|
12304
|
-
className: `mt-1 max-h-[160px] overflow-hidden whitespace-pre-line ${hasError ? "text-red-600 dark:text-red-400" : "text-muted-foreground"}`,
|
|
12305
|
-
children: displayOutput
|
|
12306
|
-
})]
|
|
12307
|
-
}),
|
|
12308
|
-
approval && /* @__PURE__ */ jsx(ToolApprovalFooter, {
|
|
12309
|
-
isPending,
|
|
12310
|
-
...approval
|
|
12311
|
-
})
|
|
12312
|
-
]
|
|
12313
|
-
});
|
|
12314
|
-
}
|
|
12315
|
-
var cellCounterByToolCallId = /* @__PURE__ */ new Map();
|
|
12316
|
-
var lastCellIndex = 0;
|
|
12317
|
-
function nextCellIndex(toolCallId) {
|
|
12318
|
-
if (!toolCallId) return ++lastCellIndex;
|
|
12319
|
-
const existing = cellCounterByToolCallId.get(toolCallId);
|
|
12320
|
-
if (existing) return existing;
|
|
12321
|
-
const next = ++lastCellIndex;
|
|
12322
|
-
cellCounterByToolCallId.set(toolCallId, next);
|
|
12323
|
-
return next;
|
|
12324
|
-
}
|
|
12325
|
-
var IpythonTool = memo(function IpythonTool2({ part }) {
|
|
12326
|
-
const approval = part.input?.approval ?? part.args?.approval;
|
|
12327
|
-
const { step, stepState } = adaptToolPart(part, "IPython");
|
|
12328
|
-
const cellIndex = nextCellIndex(part.toolCallId);
|
|
12329
|
-
const noop = () => {
|
|
12330
|
-
};
|
|
12331
|
-
return /* @__PURE__ */ jsx(IpythonCellCard, {
|
|
12332
|
-
step,
|
|
12333
|
-
state: stepState,
|
|
12334
|
-
onComplete: noop,
|
|
12335
|
-
approval,
|
|
12336
|
-
cellIndex,
|
|
12337
|
-
part
|
|
12338
|
-
});
|
|
12339
|
-
});
|
|
12340
11988
|
function IconSpinner({ className, ...rest }) {
|
|
12341
11989
|
return /* @__PURE__ */ jsxs("svg", {
|
|
12342
11990
|
viewBox: "0 0 24 24",
|
|
@@ -13168,7 +12816,8 @@ function normalizeResults(value) {
|
|
|
13168
12816
|
return parsed.length > 0 ? parsed : void 0;
|
|
13169
12817
|
}
|
|
13170
12818
|
var SearchTool = memo(function SearchTool2({ part, results, defaultOpen }) {
|
|
13171
|
-
const
|
|
12819
|
+
const toolName2 = part.type?.replace("tool-", "") || "WebSearch";
|
|
12820
|
+
const { step, stepState } = adaptToolPart(part, toolName2);
|
|
13172
12821
|
const stepStates = { [step.id]: stepState };
|
|
13173
12822
|
const noop = () => {
|
|
13174
12823
|
};
|
|
@@ -14520,7 +14169,8 @@ var BeuiToolRenderer = memo(function BeuiToolRenderer2({ part, chatStatus, fallb
|
|
|
14520
14169
|
status: status === "running" ? "streaming" : "complete",
|
|
14521
14170
|
language: "diff",
|
|
14522
14171
|
maxHeight: 240,
|
|
14523
|
-
copyText: detail.copyText
|
|
14172
|
+
copyText: detail.copyText,
|
|
14173
|
+
defaultOpen: status === "running"
|
|
14524
14174
|
});
|
|
14525
14175
|
const content = detail.content || "No output.";
|
|
14526
14176
|
return /* @__PURE__ */ jsxs(ToolResult, {
|
|
@@ -14530,7 +14180,7 @@ var BeuiToolRenderer = memo(function BeuiToolRenderer2({ part, chatStatus, fallb
|
|
|
14530
14180
|
kind: normalized.lowerName.includes("bash") || normalized.lowerName.includes("shell") || normalized.lowerName.includes("python") ? "terminal" : "custom",
|
|
14531
14181
|
meta: normalized.metadata.length > 0 ? normalized.metadata.join(" \xB7 ") : void 0,
|
|
14532
14182
|
icon: statusIcon(status, normalized.name),
|
|
14533
|
-
defaultOpen:
|
|
14183
|
+
defaultOpen: status === "running",
|
|
14534
14184
|
collapseOnComplete: false,
|
|
14535
14185
|
maxHeight: 240,
|
|
14536
14186
|
copyText: content,
|
|
@@ -14554,6 +14204,7 @@ var BeuiToolRenderer = memo(function BeuiToolRenderer2({ part, chatStatus, fallb
|
|
|
14554
14204
|
]
|
|
14555
14205
|
});
|
|
14556
14206
|
});
|
|
14207
|
+
var fleet_pi_tool_renderer_exports = /* @__PURE__ */ __exportAll({ FleetPiToolRenderer: () => FleetPiToolRenderer });
|
|
14557
14208
|
var FleetPiToolRenderer = memo(function FleetPiToolRenderer2(props) {
|
|
14558
14209
|
const partType = props.part.type;
|
|
14559
14210
|
if (partType === "tool-Thinking" || partType === "tool-FleetReasoning") return null;
|
|
@@ -14567,7 +14218,9 @@ var FleetPiToolRenderer = memo(function FleetPiToolRenderer2(props) {
|
|
|
14567
14218
|
});
|
|
14568
14219
|
return fallback;
|
|
14569
14220
|
});
|
|
14221
|
+
|
|
14570
14222
|
export {
|
|
14223
|
+
fleet_pi_tool_renderer_exports,
|
|
14571
14224
|
FleetPiToolRenderer
|
|
14572
14225
|
};
|
|
14573
14226
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
OpenPanelActionSchema
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XFVL5ITL.js";
|
|
4
4
|
|
|
5
|
-
// web/app/dist/server/assets/open-panel-action-message-
|
|
5
|
+
// web/app/dist/server/assets/open-panel-action-message-CdlnT0gB.js
|
|
6
6
|
import { Component, createContext, createElement } from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
var h = createContext(null);
|
|
@@ -91,53 +91,6 @@ function UiErrorBoundary({ children, fallback, onReset, resetKeys }) {
|
|
|
91
91
|
children
|
|
92
92
|
});
|
|
93
93
|
}
|
|
94
|
-
var OPENUI_FENCE_PATTERN = /```(?:openui|openui-lang)(?:[ \t]*\r?\n|[ \t]+)([\s\S]*?)```/gi;
|
|
95
|
-
function appendSegment(segments, ordinals, type, content) {
|
|
96
|
-
const ordinal = ordinals[type];
|
|
97
|
-
ordinals[type] += 1;
|
|
98
|
-
segments.push({
|
|
99
|
-
content,
|
|
100
|
-
id: `${type}-${ordinal}`,
|
|
101
|
-
type
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
function stripOpenUIWrapper(content) {
|
|
105
|
-
const cleaned = content.trim();
|
|
106
|
-
const fences = Array.from(cleaned.matchAll(OPENUI_FENCE_PATTERN));
|
|
107
|
-
const onlyFence = fences[0];
|
|
108
|
-
if (fences.length === 1 && onlyFence?.index === 0 && onlyFence[0].length === cleaned.length) return onlyFence[1].trim();
|
|
109
|
-
return cleaned;
|
|
110
|
-
}
|
|
111
|
-
function isOpenUIProgram(content) {
|
|
112
|
-
return stripOpenUIWrapper(content).startsWith("root =");
|
|
113
|
-
}
|
|
114
|
-
function segmentOpenUIContent(content) {
|
|
115
|
-
const segments = [];
|
|
116
|
-
const ordinals = {
|
|
117
|
-
markdown: 0,
|
|
118
|
-
openui: 0
|
|
119
|
-
};
|
|
120
|
-
const stripped = stripOpenUIWrapper(content);
|
|
121
|
-
if (stripped.startsWith("root =")) {
|
|
122
|
-
appendSegment(segments, ordinals, "openui", stripped);
|
|
123
|
-
return segments;
|
|
124
|
-
}
|
|
125
|
-
let lastIndex = 0;
|
|
126
|
-
for (const match of content.matchAll(OPENUI_FENCE_PATTERN)) {
|
|
127
|
-
const index = match.index;
|
|
128
|
-
const markdown = content.slice(lastIndex, index);
|
|
129
|
-
if (markdown.trim()) appendSegment(segments, ordinals, "markdown", markdown);
|
|
130
|
-
const openUI = match[1].trim();
|
|
131
|
-
const isOpenUI = isOpenUIProgram(openUI);
|
|
132
|
-
appendSegment(segments, ordinals, isOpenUI ? "openui" : "markdown", isOpenUI ? openUI : match[0]);
|
|
133
|
-
lastIndex = index + match[0].length;
|
|
134
|
-
}
|
|
135
|
-
const trailingMarkdown = content.slice(lastIndex);
|
|
136
|
-
if (trailingMarkdown.trim()) appendSegment(segments, ordinals, "markdown", trailingMarkdown);
|
|
137
|
-
if (segments.length > 0) return segments;
|
|
138
|
-
appendSegment(segments, ordinals, "markdown", content);
|
|
139
|
-
return segments;
|
|
140
|
-
}
|
|
141
94
|
var OPEN_PANEL_ACTION_PREFIX = "fleet-prime:open-panel:";
|
|
142
95
|
function encodeOpenPanelActionMessage(action) {
|
|
143
96
|
return `${OPEN_PANEL_ACTION_PREFIX}${JSON.stringify(action)}`;
|
|
@@ -153,7 +106,6 @@ function decodeOpenPanelActionMessage(message) {
|
|
|
153
106
|
|
|
154
107
|
export {
|
|
155
108
|
UiErrorBoundary,
|
|
156
|
-
segmentOpenUIContent,
|
|
157
109
|
encodeOpenPanelActionMessage,
|
|
158
110
|
decodeOpenPanelActionMessage
|
|
159
111
|
};
|