@blade-hq/agent-react 2612.0.0-beta.67 → 2612.0.0-beta.69
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 +2 -0
- package/dist/{chunk-MAFNMG2O.js → chunk-2DPLLZOU.js} +18 -13
- package/dist/{chunk-MAFNMG2O.js.map → chunk-2DPLLZOU.js.map} +1 -1
- package/dist/{chunk-N576N2XO.js → chunk-7MCGQH34.js} +12 -9
- package/dist/chunk-7MCGQH34.js.map +1 -0
- package/dist/{chunk-UC7SY3G5.js → chunk-HCW7SI5Q.js} +333 -269
- package/dist/chunk-HCW7SI5Q.js.map +1 -0
- package/dist/{chunk-X66C66OQ.js → chunk-J72ZLILV.js} +287 -67
- package/dist/chunk-J72ZLILV.js.map +1 -0
- package/dist/{chunk-HS5G33FO.js → chunk-QIR73CES.js} +1031 -8
- package/dist/chunk-QIR73CES.js.map +1 -0
- package/dist/{chunk-VSIUEXGV.js → chunk-WRIMPZPN.js} +12 -962
- package/dist/chunk-WRIMPZPN.js.map +1 -0
- package/dist/{chunk-XV6AO37F.js → chunk-XJ6ZA6LN.js} +9 -9
- package/dist/{chunk-U3RHQHI6.js → chunk-XP6T6SHZ.js} +48 -48
- package/dist/components/AccountConnectors.d.ts +1 -1
- package/dist/components/ManagedConnection.d.ts +0 -1
- package/dist/components/McpAppFrame.d.ts +17 -0
- package/dist/components/SessionPluginIcon.d.ts +1 -0
- package/dist/connectors.js +2 -2
- package/dist/index.js +7 -7
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +10 -8
- package/dist/internal.js.map +1 -1
- package/dist/questions.js +4 -5
- package/dist/questions.js.map +1 -1
- package/dist/rich-input.js +20 -20
- package/dist/style.full.css +1 -1
- package/dist/tool-details.js +4 -4
- package/node_modules/@modelcontextprotocol/ext-apps/LICENSE +216 -0
- package/node_modules/@modelcontextprotocol/ext-apps/README.md +284 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/docs/patterns.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.d.ts +1348 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.js +39 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-bridge.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app-with-deps.js +82 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.d.ts +1214 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.js +39 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/app.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/constants.d.ts +65 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/events.d.ts +47 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/events.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.d.ts +1047 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.json +6170 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/generated/schema.test.d.ts +41 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/interop-v1.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/legacy-handlers.d.ts +66 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/legacy-handlers.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.d.ts +126 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/message-transport.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.d.ts +37 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/index.js +39 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/react-with-deps.js +82 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useApp.d.ts +115 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useApp.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useAutoResize.d.ts +54 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useAutoResize.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useDocumentTheme.d.ts +44 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useDocumentTheme.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useHostStyles.d.ts +113 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/react/useHostStyles.examples.d.ts +6 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.d.ts +381 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.js +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/server/index.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/spec.types.d.ts +698 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/standard-schema.d.ts +23 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/styles.d.ts +184 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/styles.examples.d.ts +9 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/types.d.ts +33 -0
- package/node_modules/@modelcontextprotocol/ext-apps/dist/src/wire-compat.test.d.ts +1 -0
- package/node_modules/@modelcontextprotocol/ext-apps/package.json +144 -0
- package/node_modules/@standard-schema/spec/LICENSE +21 -0
- package/node_modules/@standard-schema/spec/README.md +198 -0
- package/node_modules/@standard-schema/spec/dist/index.cjs +18 -0
- package/node_modules/@standard-schema/spec/dist/index.d.cts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.d.ts +119 -0
- package/node_modules/@standard-schema/spec/dist/index.js +0 -0
- package/node_modules/@standard-schema/spec/package.json +52 -0
- package/package.json +6 -2
- package/dist/chunk-HS5G33FO.js.map +0 -1
- package/dist/chunk-N576N2XO.js.map +0 -1
- package/dist/chunk-UC7SY3G5.js.map +0 -1
- package/dist/chunk-VSIUEXGV.js.map +0 -1
- package/dist/chunk-X66C66OQ.js.map +0 -1
- /package/dist/{chunk-XV6AO37F.js.map → chunk-XJ6ZA6LN.js.map} +0 -0
- /package/dist/{chunk-U3RHQHI6.js.map → chunk-XP6T6SHZ.js.map} +0 -0
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MarkdownContent
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XJ6ZA6LN.js";
|
|
4
|
+
import {
|
|
5
|
+
cn,
|
|
6
|
+
extractToolFilePath,
|
|
7
|
+
formatToolFileName,
|
|
8
|
+
formatToolName,
|
|
9
|
+
useBladeClient,
|
|
10
|
+
useHighlightedCode,
|
|
11
|
+
useOptionalBladeClient
|
|
12
|
+
} from "./chunk-WRIMPZPN.js";
|
|
4
13
|
import {
|
|
5
14
|
ChevronLeft,
|
|
6
15
|
ChevronRight,
|
|
@@ -17,24 +26,12 @@ import {
|
|
|
17
26
|
Plus,
|
|
18
27
|
RotateCcw,
|
|
19
28
|
X,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
formatToolFileName,
|
|
23
|
-
formatToolName,
|
|
24
|
-
useBladeClient,
|
|
25
|
-
useHighlightedCode,
|
|
26
|
-
useOptionalBladeClient
|
|
27
|
-
} from "./chunk-VSIUEXGV.js";
|
|
28
|
-
import {
|
|
29
|
-
dist_exports2 as dist_exports
|
|
30
|
-
} from "./chunk-HS5G33FO.js";
|
|
29
|
+
dist_exports3 as dist_exports
|
|
30
|
+
} from "./chunk-QIR73CES.js";
|
|
31
31
|
import {
|
|
32
32
|
__export
|
|
33
33
|
} from "./chunk-PR4QN5HX.js";
|
|
34
34
|
|
|
35
|
-
// src/components/McpAppCard.tsx
|
|
36
|
-
import { BladeApiError } from "@blade-hq/agent-client";
|
|
37
|
-
|
|
38
35
|
// ../../node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
39
36
|
var __create = Object.create;
|
|
40
37
|
var __defProp = Object.defineProperty;
|
|
@@ -25732,28 +25729,9 @@ function SF(G, Q) {
|
|
|
25732
25729
|
return JSON.stringify(G) === JSON.stringify(Q);
|
|
25733
25730
|
}
|
|
25734
25731
|
|
|
25735
|
-
// src/components/
|
|
25736
|
-
import {
|
|
25737
|
-
|
|
25738
|
-
// src/lib/random-id.ts
|
|
25739
|
-
function randomId() {
|
|
25740
|
-
const webCrypto = typeof globalThis !== "undefined" ? globalThis.crypto : void 0;
|
|
25741
|
-
if (webCrypto && typeof webCrypto.randomUUID === "function") {
|
|
25742
|
-
return webCrypto.randomUUID();
|
|
25743
|
-
}
|
|
25744
|
-
if (webCrypto && typeof webCrypto.getRandomValues === "function") {
|
|
25745
|
-
const bytes = webCrypto.getRandomValues(new Uint8Array(16));
|
|
25746
|
-
bytes[6] = bytes[6] & 15 | 64;
|
|
25747
|
-
bytes[8] = bytes[8] & 63 | 128;
|
|
25748
|
-
const hex3 = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
25749
|
-
return `${hex3.slice(0, 8)}-${hex3.slice(8, 12)}-${hex3.slice(12, 16)}-${hex3.slice(16, 20)}-${hex3.slice(20)}`;
|
|
25750
|
-
}
|
|
25751
|
-
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
25752
|
-
}
|
|
25753
|
-
|
|
25754
|
-
// src/components/McpAppCard.tsx
|
|
25732
|
+
// src/components/McpAppFrame.tsx
|
|
25733
|
+
import { useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
25755
25734
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
25756
|
-
var McpAppMessageContext = createContext(null);
|
|
25757
25735
|
function securedHtml(archive) {
|
|
25758
25736
|
const ui = archive.resourceMeta.ui;
|
|
25759
25737
|
const csp = ui?.csp ?? {};
|
|
@@ -25788,19 +25766,16 @@ function securedHtml(archive) {
|
|
|
25788
25766
|
doc.head.prepend(meta3);
|
|
25789
25767
|
return `<!doctype html>${doc.documentElement.outerHTML}`;
|
|
25790
25768
|
}
|
|
25791
|
-
function
|
|
25792
|
-
const
|
|
25793
|
-
const
|
|
25794
|
-
|
|
25795
|
-
const onMessage = suppliedOnMessage ?? contextMessage;
|
|
25796
|
-
const onMessageRef = useRef(onMessage);
|
|
25797
|
-
onMessageRef.current = onMessage;
|
|
25769
|
+
function McpAppFrame(props) {
|
|
25770
|
+
const { html: sourceHtml, resourceMeta, title = "\u5DE5\u5177\u754C\u9762" } = props;
|
|
25771
|
+
const callbacks = useRef(props);
|
|
25772
|
+
callbacks.current = props;
|
|
25798
25773
|
const frame = useRef(null);
|
|
25799
25774
|
const panel = useRef(null);
|
|
25800
25775
|
const bridgeRef = useRef(null);
|
|
25801
25776
|
const [html, setHtml] = useState();
|
|
25802
|
-
const [
|
|
25803
|
-
const
|
|
25777
|
+
const [failure2, setError] = useState(null);
|
|
25778
|
+
const error62 = props.error ?? failure2;
|
|
25804
25779
|
const [ready, setReady] = useState(false);
|
|
25805
25780
|
const [expanded, setExpanded] = useState(false);
|
|
25806
25781
|
const [height, setHeight] = useState(360);
|
|
@@ -25812,33 +25787,193 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
25812
25787
|
else dialog.show();
|
|
25813
25788
|
}, [expanded]);
|
|
25814
25789
|
useEffect(() => {
|
|
25815
|
-
const controller = new AbortController();
|
|
25816
|
-
let bridge;
|
|
25817
|
-
let disposed = false;
|
|
25818
|
-
let offChanged;
|
|
25819
|
-
let refreshRevision = 0;
|
|
25820
25790
|
setError(null);
|
|
25821
25791
|
setReady(false);
|
|
25822
25792
|
setHtml(void 0);
|
|
25823
25793
|
setExpanded(false);
|
|
25824
25794
|
setHeight(360);
|
|
25795
|
+
if (sourceHtml === void 0) return;
|
|
25796
|
+
let disposed = false;
|
|
25797
|
+
let bridge;
|
|
25798
|
+
const timer = window.setTimeout(() => {
|
|
25799
|
+
if (!disposed && !bridge?.getAppCapabilities()) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
|
|
25800
|
+
}, 2e4);
|
|
25825
25801
|
const start = async () => {
|
|
25826
|
-
if (!
|
|
25827
|
-
const
|
|
25828
|
-
if (disposed) return;
|
|
25829
|
-
const secured = securedHtml(archive);
|
|
25830
|
-
setTitle(archive.plugin);
|
|
25802
|
+
if (!frame.current?.contentWindow) throw new Error("\u5E94\u7528\u4F1A\u8BDD\u4E0D\u53EF\u7528");
|
|
25803
|
+
const secured = securedHtml({ html: sourceHtml, resourceMeta });
|
|
25831
25804
|
bridge = new MF(null, { name: "Blade Agent", version: "1.0.0" }, {
|
|
25832
25805
|
serverTools: {},
|
|
25833
25806
|
openLinks: {}
|
|
25834
25807
|
}, { hostContext: { platform: "web", displayMode: "inline", availableDisplayModes: ["inline", "fullscreen"] } });
|
|
25835
25808
|
bridgeRef.current = bridge;
|
|
25836
25809
|
bridge.oninitialized = () => {
|
|
25837
|
-
if (disposed) return;
|
|
25838
|
-
offChanged?.();
|
|
25810
|
+
if (disposed || !bridge) return;
|
|
25839
25811
|
window.clearTimeout(timer);
|
|
25840
25812
|
setError(null);
|
|
25841
25813
|
setReady(true);
|
|
25814
|
+
callbacks.current.onReady?.(bridge);
|
|
25815
|
+
};
|
|
25816
|
+
bridge.oncalltool = (params, extra) => {
|
|
25817
|
+
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
25818
|
+
if (!callbacks.current.callTool) throw new Error("\u5F53\u524D\u4F4D\u7F6E\u4E0D\u652F\u6301");
|
|
25819
|
+
return callbacks.current.callTool(params, extra);
|
|
25820
|
+
};
|
|
25821
|
+
bridge.onmessage = (params, extra) => {
|
|
25822
|
+
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
25823
|
+
if (!callbacks.current.sendMessage) throw new Error("\u5F53\u524D\u4F1A\u8BDD\u4E0D\u80FD\u63A5\u6536\u5E94\u7528\u6D88\u606F");
|
|
25824
|
+
return callbacks.current.sendMessage(params, extra);
|
|
25825
|
+
};
|
|
25826
|
+
bridge.onupdatemodelcontext = (params, extra) => {
|
|
25827
|
+
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
25828
|
+
if (!callbacks.current.updateModelContext) throw new Error("\u5F53\u524D\u4F4D\u7F6E\u4E0D\u652F\u6301");
|
|
25829
|
+
return callbacks.current.updateModelContext(params, extra);
|
|
25830
|
+
};
|
|
25831
|
+
bridge.onrequestdisplaymode = async (params, extra) => {
|
|
25832
|
+
if (callbacks.current.requestDisplayMode) return callbacks.current.requestDisplayMode(params, extra);
|
|
25833
|
+
const next = params.mode === "fullscreen" ? "fullscreen" : "inline";
|
|
25834
|
+
setExpanded(next === "fullscreen");
|
|
25835
|
+
bridge?.setHostContext({ displayMode: next });
|
|
25836
|
+
return { mode: next };
|
|
25837
|
+
};
|
|
25838
|
+
bridge.onsizechange = (params) => {
|
|
25839
|
+
if (callbacks.current.sizeChange) return callbacks.current.sizeChange(params);
|
|
25840
|
+
if (params.height && Number.isFinite(params.height)) setHeight(Math.max(120, Math.min(1200, params.height)));
|
|
25841
|
+
};
|
|
25842
|
+
bridge.onopenlink = async (params, extra) => {
|
|
25843
|
+
if (callbacks.current.openLink) return callbacks.current.openLink(params, extra);
|
|
25844
|
+
const target = new URL(params.url);
|
|
25845
|
+
if (!["https:", "http:"].includes(target.protocol) || target.username || target.password) throw new Error("\u94FE\u63A5\u65E0\u6548");
|
|
25846
|
+
window.open(target.href, "_blank", "noopener,noreferrer");
|
|
25847
|
+
return {};
|
|
25848
|
+
};
|
|
25849
|
+
await bridge.connect(new c(frame.current.contentWindow, frame.current.contentWindow));
|
|
25850
|
+
if (!disposed) setHtml(secured);
|
|
25851
|
+
};
|
|
25852
|
+
void start().catch((error63) => {
|
|
25853
|
+
window.clearTimeout(timer);
|
|
25854
|
+
if (!disposed) setError(error63 instanceof Error ? error63.message : "\u5E94\u7528\u52A0\u8F7D\u5931\u8D25");
|
|
25855
|
+
});
|
|
25856
|
+
return () => {
|
|
25857
|
+
disposed = true;
|
|
25858
|
+
window.clearTimeout(timer);
|
|
25859
|
+
bridgeRef.current = null;
|
|
25860
|
+
void bridge?.close();
|
|
25861
|
+
};
|
|
25862
|
+
}, [sourceHtml, resourceMeta]);
|
|
25863
|
+
useEffect(() => {
|
|
25864
|
+
let disposed = false;
|
|
25865
|
+
if (ready && props.toolInput) void bridgeRef.current?.sendToolInput(props.toolInput).catch((error63) => {
|
|
25866
|
+
if (!disposed) setError(error63 instanceof Error ? error63.message : "\u5E94\u7528\u7ED3\u679C\u5237\u65B0\u5931\u8D25");
|
|
25867
|
+
});
|
|
25868
|
+
return () => {
|
|
25869
|
+
disposed = true;
|
|
25870
|
+
};
|
|
25871
|
+
}, [props.toolInput, ready]);
|
|
25872
|
+
const toggle = () => {
|
|
25873
|
+
setExpanded(!expanded);
|
|
25874
|
+
bridgeRef.current?.setHostContext({ displayMode: expanded ? "inline" : "fullscreen" });
|
|
25875
|
+
};
|
|
25876
|
+
return /* @__PURE__ */ jsxs(
|
|
25877
|
+
"dialog",
|
|
25878
|
+
{
|
|
25879
|
+
ref: panel,
|
|
25880
|
+
onCancel: () => {
|
|
25881
|
+
setExpanded(false);
|
|
25882
|
+
bridgeRef.current?.setHostContext({ displayMode: "inline" });
|
|
25883
|
+
},
|
|
25884
|
+
className: "blade-chat-mcp-app blade-mcp-app",
|
|
25885
|
+
part: "mcp-app",
|
|
25886
|
+
style: expanded ? {
|
|
25887
|
+
position: "fixed",
|
|
25888
|
+
top: 0,
|
|
25889
|
+
right: 0,
|
|
25890
|
+
bottom: 0,
|
|
25891
|
+
left: "auto",
|
|
25892
|
+
margin: 0,
|
|
25893
|
+
padding: 0,
|
|
25894
|
+
border: 0,
|
|
25895
|
+
width: "min(100vw, 760px)",
|
|
25896
|
+
height: "100%",
|
|
25897
|
+
maxWidth: "none",
|
|
25898
|
+
maxHeight: "none",
|
|
25899
|
+
zIndex: 80,
|
|
25900
|
+
background: "white",
|
|
25901
|
+
boxShadow: "-4px 0 20px #0002",
|
|
25902
|
+
display: "flex",
|
|
25903
|
+
flexDirection: "column"
|
|
25904
|
+
} : { position: "relative", margin: 0, padding: 0, width: "100%", maxWidth: "none", maxHeight: "none", border: "1px solid #d4d4d8", borderRadius: 6, overflow: "hidden", background: "white" },
|
|
25905
|
+
children: [
|
|
25906
|
+
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "8px 12px", color: "#27272a" }, children: [
|
|
25907
|
+
/* @__PURE__ */ jsx("span", { children: title }),
|
|
25908
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: toggle, title: expanded ? "\u6536\u8D77" : "\u5C55\u5F00", "aria-label": expanded ? "\u6536\u8D77" : "\u5C55\u5F00", style: { width: 32, height: 32, display: "grid", placeItems: "center", background: "transparent", border: 0, padding: 0 }, children: expanded ? /* @__PURE__ */ jsx(Minimize2, { size: 16 }) : /* @__PURE__ */ jsx(Maximize2, { size: 16 }) })
|
|
25909
|
+
] }),
|
|
25910
|
+
error62 ? /* @__PURE__ */ jsx("p", { role: "alert", style: { padding: 12, color: "#b91c1c" }, children: error62 }) : !ready ? /* @__PURE__ */ jsx("output", { style: { padding: 12 }, children: "\u6B63\u5728\u52A0\u8F7D" }) : null,
|
|
25911
|
+
/* @__PURE__ */ jsx(
|
|
25912
|
+
"iframe",
|
|
25913
|
+
{
|
|
25914
|
+
ref: frame,
|
|
25915
|
+
title,
|
|
25916
|
+
srcDoc: html,
|
|
25917
|
+
sandbox: "allow-scripts allow-forms",
|
|
25918
|
+
referrerPolicy: "no-referrer",
|
|
25919
|
+
style: { width: "100%", height: expanded ? "100%" : height, flex: expanded ? 1 : void 0, border: 0 }
|
|
25920
|
+
}
|
|
25921
|
+
)
|
|
25922
|
+
]
|
|
25923
|
+
}
|
|
25924
|
+
);
|
|
25925
|
+
}
|
|
25926
|
+
|
|
25927
|
+
// src/components/McpAppCard.tsx
|
|
25928
|
+
import { BladeApiError } from "@blade-hq/agent-client";
|
|
25929
|
+
import { createContext, useContext, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
25930
|
+
|
|
25931
|
+
// src/lib/random-id.ts
|
|
25932
|
+
function randomId() {
|
|
25933
|
+
const webCrypto = typeof globalThis !== "undefined" ? globalThis.crypto : void 0;
|
|
25934
|
+
if (webCrypto && typeof webCrypto.randomUUID === "function") {
|
|
25935
|
+
return webCrypto.randomUUID();
|
|
25936
|
+
}
|
|
25937
|
+
if (webCrypto && typeof webCrypto.getRandomValues === "function") {
|
|
25938
|
+
const bytes = webCrypto.getRandomValues(new Uint8Array(16));
|
|
25939
|
+
bytes[6] = bytes[6] & 15 | 64;
|
|
25940
|
+
bytes[8] = bytes[8] & 63 | 128;
|
|
25941
|
+
const hex3 = Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
|
|
25942
|
+
return `${hex3.slice(0, 8)}-${hex3.slice(8, 12)}-${hex3.slice(12, 16)}-${hex3.slice(16, 20)}-${hex3.slice(20)}`;
|
|
25943
|
+
}
|
|
25944
|
+
return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 10)}`;
|
|
25945
|
+
}
|
|
25946
|
+
|
|
25947
|
+
// src/components/McpAppCard.tsx
|
|
25948
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
25949
|
+
var McpAppMessageContext = createContext(null);
|
|
25950
|
+
function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: suppliedOnMessage }) {
|
|
25951
|
+
const contextClient = useOptionalBladeClient();
|
|
25952
|
+
const contextMessage = useContext(McpAppMessageContext);
|
|
25953
|
+
const client = suppliedClient ?? contextClient;
|
|
25954
|
+
const onMessage = suppliedOnMessage ?? contextMessage;
|
|
25955
|
+
const onMessageRef = useRef2(onMessage);
|
|
25956
|
+
onMessageRef.current = onMessage;
|
|
25957
|
+
const [surface, setSurface] = useState2({ resourceMeta: {} });
|
|
25958
|
+
const [error62, setError] = useState2(null);
|
|
25959
|
+
useEffect2(() => {
|
|
25960
|
+
const controller = new AbortController();
|
|
25961
|
+
let disposed = false;
|
|
25962
|
+
let offChanged;
|
|
25963
|
+
let refreshRevision = 0;
|
|
25964
|
+
setError(null);
|
|
25965
|
+
setSurface({ resourceMeta: {} });
|
|
25966
|
+
const timer = window.setTimeout(() => {
|
|
25967
|
+
if (!disposed) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
|
|
25968
|
+
}, 2e4);
|
|
25969
|
+
const start = async () => {
|
|
25970
|
+
if (!client) throw new Error("\u5E94\u7528\u4F1A\u8BDD\u4E0D\u53EF\u7528");
|
|
25971
|
+
const archive = await client.sessions.getMcpApp(sessionId, sourceId, { signal: controller.signal });
|
|
25972
|
+
if (disposed) return;
|
|
25973
|
+
const handlers = { html: archive.html, resourceMeta: archive.resourceMeta, title: archive.plugin };
|
|
25974
|
+
handlers.onReady = (bridge) => {
|
|
25975
|
+
offChanged?.();
|
|
25976
|
+
setError(null);
|
|
25842
25977
|
const refresh = (restoreView = false) => {
|
|
25843
25978
|
const revision = ++refreshRevision;
|
|
25844
25979
|
void client.sessions.getMcpApp(sessionId, sourceId, { signal: controller.signal }).then(async (latest) => {
|
|
@@ -25860,7 +25995,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
25860
25995
|
};
|
|
25861
25996
|
const instance = randomId();
|
|
25862
25997
|
const deliveredMessages = /* @__PURE__ */ new Set();
|
|
25863
|
-
|
|
25998
|
+
handlers.callTool = async (params, extra) => {
|
|
25864
25999
|
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
25865
26000
|
const requestId = `${instance}:${String(extra.mcpReq.id)}`;
|
|
25866
26001
|
const callController = new AbortController();
|
|
@@ -25881,7 +26016,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
25881
26016
|
for (const signal of signals) signal.removeEventListener("abort", abort);
|
|
25882
26017
|
}
|
|
25883
26018
|
};
|
|
25884
|
-
|
|
26019
|
+
handlers.sendMessage = async ({ content }, extra) => {
|
|
25885
26020
|
if (disposed || !onMessageRef.current) throw new Error("\u5F53\u524D\u4F1A\u8BDD\u4E0D\u80FD\u63A5\u6536\u5E94\u7528\u6D88\u606F");
|
|
25886
26021
|
const requestId = String(extra.mcpReq.id);
|
|
25887
26022
|
if (deliveredMessages.has(requestId)) return {};
|
|
@@ -25896,7 +26031,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
25896
26031
|
};
|
|
25897
26032
|
const deliveredContextUpdates = /* @__PURE__ */ new Set();
|
|
25898
26033
|
let contextUpdates = Promise.resolve();
|
|
25899
|
-
|
|
26034
|
+
handlers.updateModelContext = async ({ content, structuredContent }, extra) => {
|
|
25900
26035
|
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
25901
26036
|
const requestId = `${instance}:${String(extra.mcpReq.id)}`;
|
|
25902
26037
|
if (deliveredContextUpdates.has(requestId)) return {};
|
|
@@ -25929,113 +26064,41 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
25929
26064
|
contextUpdates = update.catch(() => void 0);
|
|
25930
26065
|
return update;
|
|
25931
26066
|
};
|
|
25932
|
-
|
|
25933
|
-
|
|
25934
|
-
setExpanded(next === "fullscreen");
|
|
25935
|
-
bridge?.setHostContext({ displayMode: next });
|
|
25936
|
-
return { mode: next };
|
|
25937
|
-
};
|
|
25938
|
-
bridge.onsizechange = ({ height: next }) => {
|
|
25939
|
-
if (next && Number.isFinite(next)) setHeight(Math.max(120, Math.min(1200, next)));
|
|
25940
|
-
};
|
|
25941
|
-
bridge.onopenlink = async ({ url: url2 }) => {
|
|
25942
|
-
const target = new URL(url2);
|
|
25943
|
-
if (!["https:", "http:"].includes(target.protocol) || target.username || target.password) throw new Error("\u94FE\u63A5\u65E0\u6548");
|
|
25944
|
-
window.open(target.href, "_blank", "noopener,noreferrer");
|
|
25945
|
-
return {};
|
|
25946
|
-
};
|
|
25947
|
-
await bridge.connect(new c(frame.current.contentWindow, frame.current.contentWindow));
|
|
25948
|
-
if (!disposed) setHtml(secured);
|
|
26067
|
+
window.clearTimeout(timer);
|
|
26068
|
+
setSurface(handlers);
|
|
25949
26069
|
};
|
|
25950
26070
|
void start().catch((failure2) => {
|
|
25951
26071
|
window.clearTimeout(timer);
|
|
25952
26072
|
if (!disposed) setError(failure2 instanceof Error ? failure2.message : "\u5E94\u7528\u52A0\u8F7D\u5931\u8D25");
|
|
25953
26073
|
});
|
|
25954
|
-
const timer = window.setTimeout(() => {
|
|
25955
|
-
if (!disposed && !bridge?.getAppCapabilities()) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
|
|
25956
|
-
}, 2e4);
|
|
25957
26074
|
return () => {
|
|
25958
26075
|
disposed = true;
|
|
26076
|
+
window.clearTimeout(timer);
|
|
25959
26077
|
controller.abort();
|
|
25960
26078
|
offChanged?.();
|
|
25961
|
-
window.clearTimeout(timer);
|
|
25962
|
-
bridgeRef.current = null;
|
|
25963
|
-
void bridge?.close();
|
|
25964
26079
|
};
|
|
25965
26080
|
}, [client, sessionId, sourceId]);
|
|
25966
|
-
|
|
25967
|
-
setExpanded(!expanded);
|
|
25968
|
-
bridgeRef.current?.setHostContext({ displayMode: expanded ? "inline" : "fullscreen" });
|
|
25969
|
-
};
|
|
25970
|
-
return /* @__PURE__ */ jsxs(
|
|
25971
|
-
"dialog",
|
|
25972
|
-
{
|
|
25973
|
-
ref: panel,
|
|
25974
|
-
onCancel: () => {
|
|
25975
|
-
setExpanded(false);
|
|
25976
|
-
bridgeRef.current?.setHostContext({ displayMode: "inline" });
|
|
25977
|
-
},
|
|
25978
|
-
className: "blade-chat-mcp-app blade-mcp-app",
|
|
25979
|
-
part: "mcp-app",
|
|
25980
|
-
style: expanded ? {
|
|
25981
|
-
position: "fixed",
|
|
25982
|
-
top: 0,
|
|
25983
|
-
right: 0,
|
|
25984
|
-
bottom: 0,
|
|
25985
|
-
left: "auto",
|
|
25986
|
-
margin: 0,
|
|
25987
|
-
padding: 0,
|
|
25988
|
-
border: 0,
|
|
25989
|
-
width: "min(100vw, 760px)",
|
|
25990
|
-
height: "100%",
|
|
25991
|
-
maxWidth: "none",
|
|
25992
|
-
maxHeight: "none",
|
|
25993
|
-
zIndex: 80,
|
|
25994
|
-
background: "white",
|
|
25995
|
-
boxShadow: "-4px 0 20px #0002",
|
|
25996
|
-
display: "flex",
|
|
25997
|
-
flexDirection: "column"
|
|
25998
|
-
} : { position: "relative", margin: 0, padding: 0, width: "100%", maxWidth: "none", maxHeight: "none", border: "1px solid #d4d4d8", borderRadius: 6, overflow: "hidden", background: "white" },
|
|
25999
|
-
children: [
|
|
26000
|
-
/* @__PURE__ */ jsxs("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "8px 12px", color: "#27272a" }, children: [
|
|
26001
|
-
/* @__PURE__ */ jsx("span", { children: title }),
|
|
26002
|
-
/* @__PURE__ */ jsx("button", { type: "button", onClick: toggle, title: expanded ? "\u6536\u8D77" : "\u5C55\u5F00", "aria-label": expanded ? "\u6536\u8D77" : "\u5C55\u5F00", style: { width: 32, height: 32, display: "grid", placeItems: "center", background: "transparent", border: 0, padding: 0 }, children: expanded ? /* @__PURE__ */ jsx(Minimize2, { size: 16 }) : /* @__PURE__ */ jsx(Maximize2, { size: 16 }) })
|
|
26003
|
-
] }),
|
|
26004
|
-
error62 ? /* @__PURE__ */ jsx("p", { role: "alert", style: { padding: 12, color: "#b91c1c" }, children: error62 }) : !ready ? /* @__PURE__ */ jsx("output", { style: { padding: 12 }, children: "\u6B63\u5728\u52A0\u8F7D" }) : null,
|
|
26005
|
-
/* @__PURE__ */ jsx(
|
|
26006
|
-
"iframe",
|
|
26007
|
-
{
|
|
26008
|
-
ref: frame,
|
|
26009
|
-
title,
|
|
26010
|
-
srcDoc: html,
|
|
26011
|
-
sandbox: "allow-scripts allow-forms",
|
|
26012
|
-
referrerPolicy: "no-referrer",
|
|
26013
|
-
style: { width: "100%", height: expanded ? "100%" : height, flex: expanded ? 1 : void 0, border: 0 }
|
|
26014
|
-
}
|
|
26015
|
-
)
|
|
26016
|
-
]
|
|
26017
|
-
}
|
|
26018
|
-
);
|
|
26081
|
+
return /* @__PURE__ */ jsx2(McpAppFrame, { ...surface, error: error62 });
|
|
26019
26082
|
}
|
|
26020
26083
|
|
|
26021
26084
|
// src/components/MessageImage.tsx
|
|
26022
|
-
import { forwardRef, useEffect as
|
|
26023
|
-
import { jsx as
|
|
26085
|
+
import { forwardRef, useEffect as useEffect3, useImperativeHandle, useRef as useRef3, useState as useState3 } from "react";
|
|
26086
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
26024
26087
|
var assetPattern = /^\/api\/(sessions|share)\/([^/]+)\/media\/([a-f0-9]{64})$/;
|
|
26025
26088
|
var MessageImage = forwardRef(function MessageImage2({ client: suppliedClient, src, original = false, alt, style, ...props }, ref) {
|
|
26026
26089
|
const contextClient = useOptionalBladeClient();
|
|
26027
26090
|
const client = suppliedClient ?? contextClient;
|
|
26028
|
-
const element =
|
|
26091
|
+
const element = useRef3(null);
|
|
26029
26092
|
useImperativeHandle(ref, () => element.current);
|
|
26030
|
-
const [visible, setVisible] =
|
|
26031
|
-
const [result, setResult] =
|
|
26093
|
+
const [visible, setVisible] = useState3(false);
|
|
26094
|
+
const [result, setResult] = useState3(null);
|
|
26032
26095
|
const match = src?.match(assetPattern);
|
|
26033
26096
|
const scope = match?.[1];
|
|
26034
26097
|
const sessionId = match?.[2];
|
|
26035
26098
|
const assetId = match?.[3];
|
|
26036
26099
|
const identity = assetId && client ? client.buildAuthedUrl(src) : "";
|
|
26037
26100
|
const source = `${src}:${original}:${identity}`;
|
|
26038
|
-
|
|
26101
|
+
useEffect3(() => {
|
|
26039
26102
|
const node2 = element.current;
|
|
26040
26103
|
if (!node2 || !assetId) return;
|
|
26041
26104
|
if (original || typeof IntersectionObserver === "undefined") {
|
|
@@ -26051,7 +26114,7 @@ var MessageImage = forwardRef(function MessageImage2({ client: suppliedClient, s
|
|
|
26051
26114
|
observer.observe(node2);
|
|
26052
26115
|
return () => observer.disconnect();
|
|
26053
26116
|
}, [assetId, original]);
|
|
26054
|
-
|
|
26117
|
+
useEffect3(() => {
|
|
26055
26118
|
if (!visible || !client || !sessionId || !assetId) return;
|
|
26056
26119
|
let alive = true;
|
|
26057
26120
|
let objectUrl = null;
|
|
@@ -26070,7 +26133,7 @@ var MessageImage = forwardRef(function MessageImage2({ client: suppliedClient, s
|
|
|
26070
26133
|
}, [visible, client, scope, sessionId, assetId, original, source]);
|
|
26071
26134
|
const current = result?.source === source && result.client === client ? result : null;
|
|
26072
26135
|
const imageStyle = { aspectRatio: props.width && props.height ? `${props.width}/${props.height}` : void 0, ...style };
|
|
26073
|
-
return /* @__PURE__ */
|
|
26136
|
+
return /* @__PURE__ */ jsx3(
|
|
26074
26137
|
"img",
|
|
26075
26138
|
{
|
|
26076
26139
|
...props,
|
|
@@ -26085,17 +26148,17 @@ var MessageImage = forwardRef(function MessageImage2({ client: suppliedClient, s
|
|
|
26085
26148
|
|
|
26086
26149
|
// src/components/ToolUiCardView.tsx
|
|
26087
26150
|
import { resolveToolUiCardContent } from "@blade-hq/agent-client/internal";
|
|
26088
|
-
import { useEffect as
|
|
26089
|
-
import { jsx as
|
|
26151
|
+
import { useEffect as useEffect4, useState as useState4 } from "react";
|
|
26152
|
+
import { jsx as jsx4, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
26090
26153
|
function ToolUiCardView({ card, sessionId }) {
|
|
26091
|
-
if (card.mcpApp) return sessionId ? /* @__PURE__ */
|
|
26154
|
+
if (card.mcpApp) return sessionId ? /* @__PURE__ */ jsx4(McpAppCard, { sessionId, sourceId: card.mcpApp.sourceId }) : null;
|
|
26092
26155
|
const resolved = resolveToolUiCardContent(card);
|
|
26093
26156
|
if (!resolved) return null;
|
|
26094
26157
|
if (resolved.type === "resource-file") {
|
|
26095
|
-
return sessionId ? /* @__PURE__ */
|
|
26158
|
+
return sessionId ? /* @__PURE__ */ jsx4(FileCard, { card, sessionId, path: resolved.content }, `${sessionId}:${resolved.content}`) : null;
|
|
26096
26159
|
}
|
|
26097
26160
|
const sandbox = resolved.type === "resource-uri" ? "allow-scripts allow-same-origin" : "allow-scripts";
|
|
26098
|
-
return /* @__PURE__ */
|
|
26161
|
+
return /* @__PURE__ */ jsx4(
|
|
26099
26162
|
"iframe",
|
|
26100
26163
|
{
|
|
26101
26164
|
title: card.title ?? "\u5DE5\u5177\u754C\u9762",
|
|
@@ -26112,10 +26175,10 @@ function ToolUiCardView({ card, sessionId }) {
|
|
|
26112
26175
|
}
|
|
26113
26176
|
function FileCard({ card, sessionId, path }) {
|
|
26114
26177
|
const client = useBladeClient();
|
|
26115
|
-
const [html, setHtml] =
|
|
26116
|
-
const [failed, setFailed] =
|
|
26117
|
-
const [refreshVersion, setRefreshVersion] =
|
|
26118
|
-
|
|
26178
|
+
const [html, setHtml] = useState4(null);
|
|
26179
|
+
const [failed, setFailed] = useState4(false);
|
|
26180
|
+
const [refreshVersion, setRefreshVersion] = useState4(0);
|
|
26181
|
+
useEffect4(() => {
|
|
26119
26182
|
const abort = new AbortController();
|
|
26120
26183
|
setHtml(null);
|
|
26121
26184
|
setFailed(false);
|
|
@@ -26135,7 +26198,7 @@ function FileCard({ card, sessionId, path }) {
|
|
|
26135
26198
|
`${client.options.baseUrl.replace(/\/$/, "")}/`
|
|
26136
26199
|
).href;
|
|
26137
26200
|
return /* @__PURE__ */ jsxs2("div", { children: [
|
|
26138
|
-
/* @__PURE__ */
|
|
26201
|
+
/* @__PURE__ */ jsx4("div", { className: "flex justify-end py-2", children: /* @__PURE__ */ jsx4(
|
|
26139
26202
|
"button",
|
|
26140
26203
|
{
|
|
26141
26204
|
type: "button",
|
|
@@ -26145,7 +26208,7 @@ function FileCard({ card, sessionId, path }) {
|
|
|
26145
26208
|
children: "\u5237\u65B0"
|
|
26146
26209
|
}
|
|
26147
26210
|
) }),
|
|
26148
|
-
failed ? /* @__PURE__ */
|
|
26211
|
+
failed ? /* @__PURE__ */ jsx4("p", { role: "alert", children: "\u65E0\u6CD5\u6253\u5F00\u6587\u4EF6\uFF0C\u6587\u4EF6\u53EF\u80FD\u5DF2\u79FB\u52A8\u6216\u5220\u9664\u3002" }) : html === null ? /* @__PURE__ */ jsx4("p", { children: "\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u2026" }) : /* @__PURE__ */ jsx4(
|
|
26149
26212
|
"iframe",
|
|
26150
26213
|
{
|
|
26151
26214
|
title: card.title ?? "\u6587\u4EF6\u9884\u89C8",
|
|
@@ -26205,7 +26268,7 @@ function getCodeLanguageFromFilename(filePath) {
|
|
|
26205
26268
|
}
|
|
26206
26269
|
|
|
26207
26270
|
// src/chat/tool-renderers/shared.tsx
|
|
26208
|
-
import { jsx as
|
|
26271
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
26209
26272
|
function getResultText(result) {
|
|
26210
26273
|
if (typeof result === "string") return result;
|
|
26211
26274
|
if (Array.isArray(result)) {
|
|
@@ -26272,7 +26335,7 @@ function CodePreview({
|
|
|
26272
26335
|
}) {
|
|
26273
26336
|
const { highlightedHtml } = useHighlightedCode(content, getCodeLanguage(filePath));
|
|
26274
26337
|
if (!content.trim()) {
|
|
26275
|
-
return /* @__PURE__ */
|
|
26338
|
+
return /* @__PURE__ */ jsx5(
|
|
26276
26339
|
"pre",
|
|
26277
26340
|
{
|
|
26278
26341
|
className: cn(
|
|
@@ -26280,11 +26343,11 @@ function CodePreview({
|
|
|
26280
26343
|
"bg-[hsl(var(--muted))]/35 p-3 font-mono text-[11px] text-[hsl(var(--muted-foreground))]",
|
|
26281
26344
|
className
|
|
26282
26345
|
),
|
|
26283
|
-
children: /* @__PURE__ */
|
|
26346
|
+
children: /* @__PURE__ */ jsx5("code", { children: emptyLabel })
|
|
26284
26347
|
}
|
|
26285
26348
|
);
|
|
26286
26349
|
}
|
|
26287
|
-
return /* @__PURE__ */
|
|
26350
|
+
return /* @__PURE__ */ jsx5(
|
|
26288
26351
|
"pre",
|
|
26289
26352
|
{
|
|
26290
26353
|
className: cn(
|
|
@@ -26292,19 +26355,19 @@ function CodePreview({
|
|
|
26292
26355
|
"bg-[hsl(var(--muted))]/35 p-3 text-[11px]",
|
|
26293
26356
|
className
|
|
26294
26357
|
),
|
|
26295
|
-
children: highlightedHtml ? /* @__PURE__ */
|
|
26358
|
+
children: highlightedHtml ? /* @__PURE__ */ jsx5(
|
|
26296
26359
|
"code",
|
|
26297
26360
|
{
|
|
26298
26361
|
className: "font-mono",
|
|
26299
26362
|
dangerouslySetInnerHTML: { __html: highlightedHtml }
|
|
26300
26363
|
}
|
|
26301
|
-
) : /* @__PURE__ */
|
|
26364
|
+
) : /* @__PURE__ */ jsx5("code", { className: "whitespace-pre-wrap break-words font-mono text-[hsl(var(--foreground))]", children: content })
|
|
26302
26365
|
}
|
|
26303
26366
|
);
|
|
26304
26367
|
}
|
|
26305
26368
|
|
|
26306
26369
|
// src/chat/tool-renderers/BashRenderer.tsx
|
|
26307
|
-
import { jsx as
|
|
26370
|
+
import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
26308
26371
|
function pickOutputField(data) {
|
|
26309
26372
|
if (!data) return null;
|
|
26310
26373
|
for (const key of ["output", "stdout", "stderr"]) {
|
|
@@ -26314,7 +26377,7 @@ function pickOutputField(data) {
|
|
|
26314
26377
|
return null;
|
|
26315
26378
|
}
|
|
26316
26379
|
function MetaPill({ label }) {
|
|
26317
|
-
return /* @__PURE__ */
|
|
26380
|
+
return /* @__PURE__ */ jsx6("span", { className: "rounded-full border border-border bg-muted px-2 py-0.5 text-[10px] text-secondary-foreground", children: label });
|
|
26318
26381
|
}
|
|
26319
26382
|
function BashRenderer({ toolCall }) {
|
|
26320
26383
|
const argsValue = parseJsonValue(toolCall.arguments);
|
|
@@ -26337,8 +26400,8 @@ function BashRenderer({ toolCall }) {
|
|
|
26337
26400
|
const hasFailure = toolCall.status === "error" || timedOut || exitCode !== null && exitCode !== 0;
|
|
26338
26401
|
return /* @__PURE__ */ jsxs3("div", { className: "space-y-3", children: [
|
|
26339
26402
|
/* @__PURE__ */ jsxs3("div", { className: "overflow-hidden rounded-lg border border-border bg-card", children: [
|
|
26340
|
-
/* @__PURE__ */
|
|
26341
|
-
/* @__PURE__ */
|
|
26403
|
+
/* @__PURE__ */ jsx6("div", { className: "border-b border-border px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u547D\u4EE4" }),
|
|
26404
|
+
/* @__PURE__ */ jsx6("pre", { className: "overflow-x-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx6("code", { children: `$ ${command || "\uFF08\u672A\u63D0\u4F9B\u547D\u4EE4\uFF09"}` }) })
|
|
26342
26405
|
] }),
|
|
26343
26406
|
/* @__PURE__ */ jsxs3(
|
|
26344
26407
|
"div",
|
|
@@ -26349,25 +26412,25 @@ function BashRenderer({ toolCall }) {
|
|
|
26349
26412
|
),
|
|
26350
26413
|
children: [
|
|
26351
26414
|
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
|
|
26352
|
-
/* @__PURE__ */
|
|
26415
|
+
/* @__PURE__ */ jsx6("div", { className: "text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u8F93\u51FA" }),
|
|
26353
26416
|
/* @__PURE__ */ jsxs3("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
26354
|
-
taskId ? /* @__PURE__ */
|
|
26355
|
-
exitCode !== null ? /* @__PURE__ */
|
|
26356
|
-
timedOut ? /* @__PURE__ */
|
|
26357
|
-
truncated ? /* @__PURE__ */
|
|
26358
|
-
normalizedName === "BgBash" && !taskId ? /* @__PURE__ */
|
|
26417
|
+
taskId ? /* @__PURE__ */ jsx6(MetaPill, { label: `\u4EFB\u52A1 ${taskId}` }) : null,
|
|
26418
|
+
exitCode !== null ? /* @__PURE__ */ jsx6(MetaPill, { label: `\u9000\u51FA\u7801 ${exitCode}` }) : null,
|
|
26419
|
+
timedOut ? /* @__PURE__ */ jsx6(MetaPill, { label: "\u5DF2\u8D85\u65F6" }) : null,
|
|
26420
|
+
truncated ? /* @__PURE__ */ jsx6(MetaPill, { label: "\u8F93\u51FA\u5DF2\u622A\u65AD" }) : null,
|
|
26421
|
+
normalizedName === "BgBash" && !taskId ? /* @__PURE__ */ jsx6(MetaPill, { label: "\u540E\u53F0\u4EFB\u52A1" }) : null
|
|
26359
26422
|
] })
|
|
26360
26423
|
] }),
|
|
26361
|
-
/* @__PURE__ */
|
|
26424
|
+
/* @__PURE__ */ jsx6("pre", { className: "max-h-[280px] overflow-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx6("code", { className: "whitespace-pre-wrap break-words", children: output2 !== null && output2.trim().length > 0 ? output2 : normalizedName === "BgBash" ? "\u4EFB\u52A1\u5DF2\u8FDB\u5165\u540E\u53F0\u6267\u884C\uFF0C\u8F93\u51FA\u4F1A\u5728\u540E\u53F0\u4EFB\u52A1\u9762\u677F\u4E2D\u7EE7\u7EED\u66F4\u65B0\u3002" : output2 !== null && output2.trim().length === 0 && hasFailure ? "\u547D\u4EE4\u5DF2\u7ED3\u675F\uFF0C\u4F46\u672A\u6355\u83B7\u5230\u7EC8\u7AEF\u8F93\u51FA\uFF08\u8BF7\u67E5\u770B\u9000\u51FA\u7801\uFF09\u3002" : "\u547D\u4EE4\u672A\u8FD4\u56DE\u8F93\u51FA\u3002" }) })
|
|
26362
26425
|
]
|
|
26363
26426
|
}
|
|
26364
26427
|
),
|
|
26365
|
-
cwdResetNote ? /* @__PURE__ */
|
|
26428
|
+
cwdResetNote ? /* @__PURE__ */ jsx6("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: cwdResetNote }) : null
|
|
26366
26429
|
] });
|
|
26367
26430
|
}
|
|
26368
26431
|
|
|
26369
26432
|
// src/chat/tool-renderers/FileEditRenderer.tsx
|
|
26370
|
-
import { useLayoutEffect as useLayoutEffect2, useRef as
|
|
26433
|
+
import { useLayoutEffect as useLayoutEffect2, useRef as useRef4 } from "react";
|
|
26371
26434
|
|
|
26372
26435
|
// src/chat/tool-renderers/write-preview-scroll.ts
|
|
26373
26436
|
function shouldFollowWritePreview(toolName, status) {
|
|
@@ -26378,7 +26441,7 @@ function scrollWritePreviewToLatest(preview) {
|
|
|
26378
26441
|
}
|
|
26379
26442
|
|
|
26380
26443
|
// src/chat/tool-renderers/FileEditRenderer.tsx
|
|
26381
|
-
import { jsx as
|
|
26444
|
+
import { jsx as jsx7, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
26382
26445
|
var MAX_DIFF_LINES = 200;
|
|
26383
26446
|
var FILE_PATH_FIELDS = ["file_path", "path"];
|
|
26384
26447
|
function computeDiff(oldText, newText) {
|
|
@@ -26560,7 +26623,7 @@ function readJsonString(raw, start) {
|
|
|
26560
26623
|
return { value: chars.join(""), closed: false };
|
|
26561
26624
|
}
|
|
26562
26625
|
function FileEditRenderer({ toolCall }) {
|
|
26563
|
-
const previewRef =
|
|
26626
|
+
const previewRef = useRef4(null);
|
|
26564
26627
|
const rawArguments = toolCall.arguments ?? "";
|
|
26565
26628
|
const argsValue = parseJsonValue(toolCall.arguments);
|
|
26566
26629
|
const args = isPlainObject3(argsValue) ? argsValue : null;
|
|
@@ -26586,16 +26649,16 @@ function FileEditRenderer({ toolCall }) {
|
|
|
26586
26649
|
return /* @__PURE__ */ jsxs4("div", { className: "space-y-3", children: [
|
|
26587
26650
|
/* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-3", children: [
|
|
26588
26651
|
/* @__PURE__ */ jsxs4("div", { className: "min-w-0", children: [
|
|
26589
|
-
/* @__PURE__ */
|
|
26590
|
-
/* @__PURE__ */
|
|
26652
|
+
/* @__PURE__ */ jsx7("div", { className: "text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5199\u5165\u6587\u4EF6" : "\u7F16\u8F91\u6587\u4EF6" }),
|
|
26653
|
+
/* @__PURE__ */ jsx7("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: fileName })
|
|
26591
26654
|
] }),
|
|
26592
|
-
checksum ? /* @__PURE__ */
|
|
26655
|
+
checksum ? /* @__PURE__ */ jsx7("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
26593
26656
|
] }),
|
|
26594
|
-
description ? /* @__PURE__ */
|
|
26595
|
-
displayErrorMessage ? /* @__PURE__ */
|
|
26657
|
+
description ? /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
26658
|
+
displayErrorMessage ? /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: displayErrorMessage }) : null,
|
|
26596
26659
|
/* @__PURE__ */ jsxs4("div", { className: "file-edit-preview overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20", children: [
|
|
26597
|
-
/* @__PURE__ */
|
|
26598
|
-
/* @__PURE__ */
|
|
26660
|
+
/* @__PURE__ */ jsx7("div", { className: "border-b border-[hsl(var(--border))] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5185\u5BB9\u9884\u89C8" : "\u53D8\u66F4\u9884\u89C8" }),
|
|
26661
|
+
/* @__PURE__ */ jsx7(
|
|
26599
26662
|
"pre",
|
|
26600
26663
|
{
|
|
26601
26664
|
ref: previewRef,
|
|
@@ -26612,7 +26675,7 @@ function FileEditRenderer({ toolCall }) {
|
|
|
26612
26675
|
line.type === "unchanged" && "text-[hsl(var(--foreground))]"
|
|
26613
26676
|
),
|
|
26614
26677
|
children: [
|
|
26615
|
-
/* @__PURE__ */
|
|
26678
|
+
/* @__PURE__ */ jsx7("span", { className: "select-none py-0.5 text-right text-[10px] text-[hsl(var(--muted-foreground))]", children: line.line ?? "" }),
|
|
26616
26679
|
/* @__PURE__ */ jsxs4("span", { className: "min-w-0 whitespace-pre-wrap break-words py-0.5", children: [
|
|
26617
26680
|
prefix,
|
|
26618
26681
|
line.value
|
|
@@ -26621,29 +26684,29 @@ function FileEditRenderer({ toolCall }) {
|
|
|
26621
26684
|
},
|
|
26622
26685
|
`${line.type}-${line.line}-${index}`
|
|
26623
26686
|
);
|
|
26624
|
-
}) : /* @__PURE__ */
|
|
26687
|
+
}) : /* @__PURE__ */ jsx7("div", { className: "px-3 py-4 text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u672A\u68C0\u6D4B\u5230\u53EF\u9884\u89C8\u7684\u53D8\u66F4\u3002" })
|
|
26625
26688
|
}
|
|
26626
26689
|
)
|
|
26627
26690
|
] }),
|
|
26628
|
-
displaySummaryText ? /* @__PURE__ */
|
|
26691
|
+
displaySummaryText ? /* @__PURE__ */ jsx7("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: displaySummaryText }) : null
|
|
26629
26692
|
] });
|
|
26630
26693
|
}
|
|
26631
26694
|
|
|
26632
26695
|
// src/chat/tool-renderers/FileReadRenderer.tsx
|
|
26633
|
-
import { useState as
|
|
26696
|
+
import { useState as useState6 } from "react";
|
|
26634
26697
|
|
|
26635
26698
|
// src/chat/ImageLightbox.tsx
|
|
26636
|
-
import { useCallback, useEffect as
|
|
26637
|
-
import { Fragment, jsx as
|
|
26699
|
+
import { useCallback, useEffect as useEffect5, useRef as useRef5, useState as useState5 } from "react";
|
|
26700
|
+
import { Fragment, jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
26638
26701
|
function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 }) {
|
|
26639
|
-
const [currentIndex, setCurrentIndex] =
|
|
26640
|
-
const [scale, setScale] =
|
|
26641
|
-
const [translate, setTranslate] =
|
|
26642
|
-
const dragging =
|
|
26643
|
-
const dragStart =
|
|
26644
|
-
const translateStart =
|
|
26645
|
-
const imgRef =
|
|
26646
|
-
const [loadedSource, setLoadedSource] =
|
|
26702
|
+
const [currentIndex, setCurrentIndex] = useState5(initialIndex);
|
|
26703
|
+
const [scale, setScale] = useState5(1);
|
|
26704
|
+
const [translate, setTranslate] = useState5({ x: 0, y: 0 });
|
|
26705
|
+
const dragging = useRef5(false);
|
|
26706
|
+
const dragStart = useRef5({ x: 0, y: 0 });
|
|
26707
|
+
const translateStart = useRef5({ x: 0, y: 0 });
|
|
26708
|
+
const imgRef = useRef5(null);
|
|
26709
|
+
const [loadedSource, setLoadedSource] = useState5(null);
|
|
26647
26710
|
const reset = useCallback(() => {
|
|
26648
26711
|
setScale(1);
|
|
26649
26712
|
setTranslate({ x: 0, y: 0 });
|
|
@@ -26664,8 +26727,8 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26664
26727
|
setCurrentIndex((i2) => Math.min(images.length - 1, i2 + 1));
|
|
26665
26728
|
reset();
|
|
26666
26729
|
}, [images.length, reset]);
|
|
26667
|
-
const prevOpenRef =
|
|
26668
|
-
|
|
26730
|
+
const prevOpenRef = useRef5(false);
|
|
26731
|
+
useEffect5(() => {
|
|
26669
26732
|
if (open2 && !prevOpenRef.current) {
|
|
26670
26733
|
setLoadedSource(null);
|
|
26671
26734
|
setCurrentIndex(initialIndex);
|
|
@@ -26733,17 +26796,17 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26733
26796
|
className: "fixed inset-0 z-50 flex animate-in items-center justify-center bg-black/80 fade-in-0 duration-(--motion-duration-fast)",
|
|
26734
26797
|
onClick: close,
|
|
26735
26798
|
children: [
|
|
26736
|
-
/* @__PURE__ */
|
|
26799
|
+
/* @__PURE__ */ jsx8(
|
|
26737
26800
|
"button",
|
|
26738
26801
|
{
|
|
26739
26802
|
type: "button",
|
|
26740
26803
|
onClick: close,
|
|
26741
26804
|
"aria-label": "\u5173\u95ED\u56FE\u7247\u9884\u89C8",
|
|
26742
26805
|
className: "absolute right-4 top-4 z-10 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
26743
|
-
children: /* @__PURE__ */
|
|
26806
|
+
children: /* @__PURE__ */ jsx8(X, { size: 20 })
|
|
26744
26807
|
}
|
|
26745
26808
|
),
|
|
26746
|
-
/* @__PURE__ */
|
|
26809
|
+
/* @__PURE__ */ jsx8("span", { className: "text-sm text-white/60", children: "\u52A0\u8F7D\u4E2D..." })
|
|
26747
26810
|
]
|
|
26748
26811
|
}
|
|
26749
26812
|
);
|
|
@@ -26769,7 +26832,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26769
26832
|
className: "absolute right-4 top-4 z-10 flex items-center gap-1.5",
|
|
26770
26833
|
onClick: (e) => e.stopPropagation(),
|
|
26771
26834
|
children: [
|
|
26772
|
-
/* @__PURE__ */
|
|
26835
|
+
/* @__PURE__ */ jsx8(
|
|
26773
26836
|
"button",
|
|
26774
26837
|
{
|
|
26775
26838
|
type: "button",
|
|
@@ -26777,10 +26840,10 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26777
26840
|
disabled: loadedSource !== current.src,
|
|
26778
26841
|
title: loadedSource === current.src ? "\u4E0B\u8F7D\u56FE\u7247" : "\u539F\u56FE\u52A0\u8F7D\u4E2D",
|
|
26779
26842
|
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
26780
|
-
children: /* @__PURE__ */
|
|
26843
|
+
children: /* @__PURE__ */ jsx8(Download, { size: 18 })
|
|
26781
26844
|
}
|
|
26782
26845
|
),
|
|
26783
|
-
/* @__PURE__ */
|
|
26846
|
+
/* @__PURE__ */ jsx8(
|
|
26784
26847
|
"button",
|
|
26785
26848
|
{
|
|
26786
26849
|
type: "button",
|
|
@@ -26788,23 +26851,23 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26788
26851
|
disabled: loadedSource !== current.src,
|
|
26789
26852
|
title: loadedSource === current.src ? "\u65B0\u6807\u7B7E\u9875\u6253\u5F00" : "\u539F\u56FE\u52A0\u8F7D\u4E2D",
|
|
26790
26853
|
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
26791
|
-
children: /* @__PURE__ */
|
|
26854
|
+
children: /* @__PURE__ */ jsx8(ExternalLink, { size: 18 })
|
|
26792
26855
|
}
|
|
26793
26856
|
),
|
|
26794
|
-
/* @__PURE__ */
|
|
26857
|
+
/* @__PURE__ */ jsx8(
|
|
26795
26858
|
"button",
|
|
26796
26859
|
{
|
|
26797
26860
|
type: "button",
|
|
26798
26861
|
onClick: close,
|
|
26799
26862
|
"aria-label": "\u5173\u95ED\u56FE\u7247\u9884\u89C8",
|
|
26800
26863
|
className: "rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
26801
|
-
children: /* @__PURE__ */
|
|
26864
|
+
children: /* @__PURE__ */ jsx8(X, { size: 20 })
|
|
26802
26865
|
}
|
|
26803
26866
|
)
|
|
26804
26867
|
]
|
|
26805
26868
|
}
|
|
26806
26869
|
),
|
|
26807
|
-
showNav && currentIndex > 0 && /* @__PURE__ */
|
|
26870
|
+
showNav && currentIndex > 0 && /* @__PURE__ */ jsx8(
|
|
26808
26871
|
"button",
|
|
26809
26872
|
{
|
|
26810
26873
|
type: "button",
|
|
@@ -26813,10 +26876,10 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26813
26876
|
goPrev();
|
|
26814
26877
|
},
|
|
26815
26878
|
className: "absolute left-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
26816
|
-
children: /* @__PURE__ */
|
|
26879
|
+
children: /* @__PURE__ */ jsx8(ChevronLeft, { size: 24 })
|
|
26817
26880
|
}
|
|
26818
26881
|
),
|
|
26819
|
-
showNav && currentIndex < images.length - 1 && /* @__PURE__ */
|
|
26882
|
+
showNav && currentIndex < images.length - 1 && /* @__PURE__ */ jsx8(
|
|
26820
26883
|
"button",
|
|
26821
26884
|
{
|
|
26822
26885
|
type: "button",
|
|
@@ -26825,46 +26888,46 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26825
26888
|
goNext();
|
|
26826
26889
|
},
|
|
26827
26890
|
className: "absolute right-4 top-1/2 z-10 -translate-y-1/2 rounded-full bg-black/50 p-2 text-white/80 transition-colors hover:bg-black/70 hover:text-white",
|
|
26828
|
-
children: /* @__PURE__ */
|
|
26891
|
+
children: /* @__PURE__ */ jsx8(ChevronRight, { size: 24 })
|
|
26829
26892
|
}
|
|
26830
26893
|
),
|
|
26831
26894
|
/* @__PURE__ */ jsxs5("div", { className: "absolute bottom-6 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-full bg-black/50 px-2 py-1", onClick: (event) => event.stopPropagation(), children: [
|
|
26832
|
-
/* @__PURE__ */
|
|
26895
|
+
/* @__PURE__ */ jsx8(
|
|
26833
26896
|
"button",
|
|
26834
26897
|
{
|
|
26835
26898
|
type: "button",
|
|
26836
26899
|
onClick: zoomOut,
|
|
26837
26900
|
"aria-label": "\u7F29\u5C0F\u56FE\u7247",
|
|
26838
26901
|
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
26839
|
-
children: /* @__PURE__ */
|
|
26902
|
+
children: /* @__PURE__ */ jsx8(Minus, { size: 16 })
|
|
26840
26903
|
}
|
|
26841
26904
|
),
|
|
26842
26905
|
/* @__PURE__ */ jsxs5("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
26843
26906
|
Math.round(scale * 100),
|
|
26844
26907
|
"%"
|
|
26845
26908
|
] }),
|
|
26846
|
-
/* @__PURE__ */
|
|
26909
|
+
/* @__PURE__ */ jsx8(
|
|
26847
26910
|
"button",
|
|
26848
26911
|
{
|
|
26849
26912
|
type: "button",
|
|
26850
26913
|
onClick: zoomIn,
|
|
26851
26914
|
"aria-label": "\u653E\u5927\u56FE\u7247",
|
|
26852
26915
|
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
26853
|
-
children: /* @__PURE__ */
|
|
26916
|
+
children: /* @__PURE__ */ jsx8(Plus, { size: 16 })
|
|
26854
26917
|
}
|
|
26855
26918
|
),
|
|
26856
|
-
/* @__PURE__ */
|
|
26919
|
+
/* @__PURE__ */ jsx8(
|
|
26857
26920
|
"button",
|
|
26858
26921
|
{
|
|
26859
26922
|
type: "button",
|
|
26860
26923
|
onClick: reset,
|
|
26861
26924
|
"aria-label": "\u6062\u590D\u56FE\u7247\u5927\u5C0F",
|
|
26862
26925
|
className: "rounded-full p-1.5 text-white/80 transition-colors hover:bg-white/10 hover:text-white",
|
|
26863
|
-
children: /* @__PURE__ */
|
|
26926
|
+
children: /* @__PURE__ */ jsx8(RotateCcw, { size: 16 })
|
|
26864
26927
|
}
|
|
26865
26928
|
),
|
|
26866
26929
|
showNav && /* @__PURE__ */ jsxs5(Fragment, { children: [
|
|
26867
|
-
/* @__PURE__ */
|
|
26930
|
+
/* @__PURE__ */ jsx8("div", { className: "mx-1 h-4 w-px bg-white/20" }),
|
|
26868
26931
|
/* @__PURE__ */ jsxs5("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
26869
26932
|
currentIndex + 1,
|
|
26870
26933
|
" / ",
|
|
@@ -26872,7 +26935,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26872
26935
|
] })
|
|
26873
26936
|
] })
|
|
26874
26937
|
] }),
|
|
26875
|
-
/* @__PURE__ */
|
|
26938
|
+
/* @__PURE__ */ jsx8(
|
|
26876
26939
|
"div",
|
|
26877
26940
|
{
|
|
26878
26941
|
className: "flex h-full w-full items-center justify-center overflow-hidden p-12",
|
|
@@ -26883,7 +26946,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26883
26946
|
onMouseUp: handleMouseUp,
|
|
26884
26947
|
onMouseLeave: handleMouseUp,
|
|
26885
26948
|
onDoubleClick: handleDoubleClick,
|
|
26886
|
-
children: /* @__PURE__ */
|
|
26949
|
+
children: /* @__PURE__ */ jsx8(
|
|
26887
26950
|
MessageImage,
|
|
26888
26951
|
{
|
|
26889
26952
|
original: true,
|
|
@@ -26906,11 +26969,11 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
26906
26969
|
);
|
|
26907
26970
|
}
|
|
26908
26971
|
function LightboxDialog({ children, className, onClose, onClick, onKeyDown }) {
|
|
26909
|
-
const [opener] =
|
|
26910
|
-
return /* @__PURE__ */
|
|
26972
|
+
const [opener] = useState5(() => document.activeElement);
|
|
26973
|
+
return /* @__PURE__ */ jsx8(dist_exports.Root, { open: true, onOpenChange: (open2) => {
|
|
26911
26974
|
if (!open2) onClose();
|
|
26912
26975
|
}, children: /* @__PURE__ */ jsxs5(dist_exports.Portal, { children: [
|
|
26913
|
-
/* @__PURE__ */
|
|
26976
|
+
/* @__PURE__ */ jsx8(dist_exports.Overlay, { className: "fixed inset-0 z-50" }),
|
|
26914
26977
|
/* @__PURE__ */ jsxs5(
|
|
26915
26978
|
dist_exports.Content,
|
|
26916
26979
|
{
|
|
@@ -26923,7 +26986,7 @@ function LightboxDialog({ children, className, onClose, onClick, onKeyDown }) {
|
|
|
26923
26986
|
if (opener?.isConnected) opener.focus({ preventScroll: true });
|
|
26924
26987
|
},
|
|
26925
26988
|
children: [
|
|
26926
|
-
/* @__PURE__ */
|
|
26989
|
+
/* @__PURE__ */ jsx8(dist_exports.Title, { className: "sr-only", children: "\u56FE\u7247\u9884\u89C8" }),
|
|
26927
26990
|
children
|
|
26928
26991
|
]
|
|
26929
26992
|
}
|
|
@@ -26932,7 +26995,7 @@ function LightboxDialog({ children, className, onClose, onClick, onKeyDown }) {
|
|
|
26932
26995
|
}
|
|
26933
26996
|
|
|
26934
26997
|
// src/chat/tool-renderers/FileReadRenderer.tsx
|
|
26935
|
-
import { jsx as
|
|
26998
|
+
import { jsx as jsx9, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
26936
26999
|
var NUMBERED_LINE_RE = /^(\s*\d+)\t([\s\S]*)$/;
|
|
26937
27000
|
function parseReadResult(result) {
|
|
26938
27001
|
if (!result) {
|
|
@@ -26976,7 +27039,7 @@ function formatLineRange(startLine, endLine) {
|
|
|
26976
27039
|
return startLine === endLine ? `\u7B2C ${startLine} \u884C` : `\u7B2C ${startLine}-${endLine} \u884C`;
|
|
26977
27040
|
}
|
|
26978
27041
|
function FileReadRenderer({ toolCall }) {
|
|
26979
|
-
const [lightboxIndex, setLightboxIndex] =
|
|
27042
|
+
const [lightboxIndex, setLightboxIndex] = useState6(null);
|
|
26980
27043
|
const argsValue = parseJsonValue(toolCall.arguments);
|
|
26981
27044
|
const args = isPlainObject3(argsValue) ? argsValue : null;
|
|
26982
27045
|
const filePath = extractToolFilePath(toolCall);
|
|
@@ -26997,25 +27060,25 @@ function FileReadRenderer({ toolCall }) {
|
|
|
26997
27060
|
return /* @__PURE__ */ jsxs6("div", { className: "space-y-3", children: [
|
|
26998
27061
|
/* @__PURE__ */ jsxs6("div", { className: "flex items-start justify-between gap-3", children: [
|
|
26999
27062
|
/* @__PURE__ */ jsxs6("div", { className: "min-w-0", children: [
|
|
27000
|
-
/* @__PURE__ */
|
|
27001
|
-
filePath ? /* @__PURE__ */
|
|
27063
|
+
/* @__PURE__ */ jsx9("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: displayName }),
|
|
27064
|
+
filePath ? /* @__PURE__ */ jsx9("div", { className: "truncate text-[10px] text-[hsl(var(--muted-foreground))]", children: filePath }) : null
|
|
27002
27065
|
] }),
|
|
27003
27066
|
/* @__PURE__ */ jsxs6("div", { className: "flex flex-wrap items-center justify-end gap-1.5", children: [
|
|
27004
|
-
lineRange ? /* @__PURE__ */
|
|
27005
|
-
checksum ? /* @__PURE__ */
|
|
27067
|
+
lineRange ? /* @__PURE__ */ jsx9("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: lineRange }) : null,
|
|
27068
|
+
checksum ? /* @__PURE__ */ jsx9("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
27006
27069
|
] })
|
|
27007
27070
|
] }),
|
|
27008
|
-
description ? /* @__PURE__ */
|
|
27009
|
-
errorMessage ? /* @__PURE__ */
|
|
27071
|
+
description ? /* @__PURE__ */ jsx9("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
27072
|
+
errorMessage ? /* @__PURE__ */ jsx9("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: errorMessage }) : null,
|
|
27010
27073
|
isImageResult ? /* @__PURE__ */ jsxs6("div", { className: "grid gap-2", children: [
|
|
27011
|
-
imageUrls.map((url2, idx) => /* @__PURE__ */
|
|
27074
|
+
imageUrls.map((url2, idx) => /* @__PURE__ */ jsx9(
|
|
27012
27075
|
"button",
|
|
27013
27076
|
{
|
|
27014
27077
|
type: "button",
|
|
27015
27078
|
onClick: () => setLightboxIndex(idx),
|
|
27016
27079
|
className: "cursor-zoom-in",
|
|
27017
27080
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
27018
|
-
children: /* @__PURE__ */
|
|
27081
|
+
children: /* @__PURE__ */ jsx9(
|
|
27019
27082
|
MessageImage,
|
|
27020
27083
|
{
|
|
27021
27084
|
src: url2,
|
|
@@ -27028,7 +27091,7 @@ function FileReadRenderer({ toolCall }) {
|
|
|
27028
27091
|
},
|
|
27029
27092
|
url2.slice(0, 64)
|
|
27030
27093
|
)),
|
|
27031
|
-
/* @__PURE__ */
|
|
27094
|
+
/* @__PURE__ */ jsx9(
|
|
27032
27095
|
ImageLightbox,
|
|
27033
27096
|
{
|
|
27034
27097
|
open: lightboxIndex != null,
|
|
@@ -27039,14 +27102,14 @@ function FileReadRenderer({ toolCall }) {
|
|
|
27039
27102
|
initialIndex: lightboxIndex ?? 0
|
|
27040
27103
|
}
|
|
27041
27104
|
),
|
|
27042
|
-
content ? /* @__PURE__ */
|
|
27043
|
-
] }) : !errorMessage ? /* @__PURE__ */
|
|
27044
|
-
note ? /* @__PURE__ */
|
|
27105
|
+
content ? /* @__PURE__ */ jsx9("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: content }) : null
|
|
27106
|
+
] }) : !errorMessage ? /* @__PURE__ */ jsx9(CodePreview, { content, filePath, className: "max-h-[360px]" }) : null,
|
|
27107
|
+
note ? /* @__PURE__ */ jsx9("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: note }) : null
|
|
27045
27108
|
] });
|
|
27046
27109
|
}
|
|
27047
27110
|
|
|
27048
27111
|
// src/chat/tool-renderers/SearchRenderer.tsx
|
|
27049
|
-
import { jsx as
|
|
27112
|
+
import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
27050
27113
|
function toRecordArray(value) {
|
|
27051
27114
|
return Array.isArray(value) ? value.filter(isPlainObject3) : [];
|
|
27052
27115
|
}
|
|
@@ -27097,7 +27160,7 @@ function parseWebResults(result) {
|
|
|
27097
27160
|
}));
|
|
27098
27161
|
}
|
|
27099
27162
|
function renderEmptyState(label) {
|
|
27100
|
-
return /* @__PURE__ */
|
|
27163
|
+
return /* @__PURE__ */ jsx10("div", { className: "rounded-lg border border-dashed border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-4 text-[11px] text-[hsl(var(--muted-foreground))]", children: label });
|
|
27101
27164
|
}
|
|
27102
27165
|
function SearchRenderer({ toolCall }) {
|
|
27103
27166
|
const normalizedName = formatToolName(toolCall.name);
|
|
@@ -27106,7 +27169,7 @@ function SearchRenderer({ toolCall }) {
|
|
|
27106
27169
|
const resultStr = getResultText(toolCall.result);
|
|
27107
27170
|
const errorMessage = extractErrorMessage(resultStr);
|
|
27108
27171
|
if (errorMessage) {
|
|
27109
|
-
return /* @__PURE__ */
|
|
27172
|
+
return /* @__PURE__ */ jsx10("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: errorMessage });
|
|
27110
27173
|
}
|
|
27111
27174
|
if (normalizedName === "Ls" || normalizedName === "Glob") {
|
|
27112
27175
|
const items = parseDirectoryItems(resultStr);
|
|
@@ -27116,16 +27179,16 @@ function SearchRenderer({ toolCall }) {
|
|
|
27116
27179
|
"\u76EE\u5F55\uFF1A",
|
|
27117
27180
|
path
|
|
27118
27181
|
] }) : null,
|
|
27119
|
-
items.length > 0 ? /* @__PURE__ */
|
|
27182
|
+
items.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "grid gap-2", children: items.map((item) => /* @__PURE__ */ jsxs7(
|
|
27120
27183
|
"div",
|
|
27121
27184
|
{
|
|
27122
27185
|
className: "flex items-center justify-between gap-3 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
27123
27186
|
children: [
|
|
27124
27187
|
/* @__PURE__ */ jsxs7("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
27125
|
-
item.isDir ? /* @__PURE__ */
|
|
27126
|
-
/* @__PURE__ */
|
|
27188
|
+
item.isDir ? /* @__PURE__ */ jsx10(Folder, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }) : /* @__PURE__ */ jsx10(FileText, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
27189
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: item.name })
|
|
27127
27190
|
] }),
|
|
27128
|
-
/* @__PURE__ */
|
|
27191
|
+
/* @__PURE__ */ jsx10("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: item.isDir ? "\u76EE\u5F55" : formatBytes(item.size) ?? "\u6587\u4EF6" })
|
|
27129
27192
|
]
|
|
27130
27193
|
},
|
|
27131
27194
|
`${item.name}-${item.size}-${item.isDir}`
|
|
@@ -27137,26 +27200,26 @@ function SearchRenderer({ toolCall }) {
|
|
|
27137
27200
|
const pattern = getStringValue(args, "pattern");
|
|
27138
27201
|
return /* @__PURE__ */ jsxs7("div", { className: "space-y-3", children: [
|
|
27139
27202
|
/* @__PURE__ */ jsxs7("div", { className: "flex flex-wrap items-center gap-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
27140
|
-
pattern ? /* @__PURE__ */
|
|
27203
|
+
pattern ? /* @__PURE__ */ jsx10("span", { className: "rounded-full bg-[hsl(var(--muted))] px-2 py-0.5 font-mono", children: pattern }) : null,
|
|
27141
27204
|
searchPath ? /* @__PURE__ */ jsxs7("span", { children: [
|
|
27142
27205
|
"\u8303\u56F4\uFF1A",
|
|
27143
27206
|
searchPath
|
|
27144
27207
|
] }) : null
|
|
27145
27208
|
] }),
|
|
27146
|
-
matches.length > 0 ? /* @__PURE__ */
|
|
27209
|
+
matches.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "grid gap-2", children: matches.map((match) => /* @__PURE__ */ jsxs7(
|
|
27147
27210
|
"div",
|
|
27148
27211
|
{
|
|
27149
27212
|
className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
27150
27213
|
children: [
|
|
27151
27214
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-center justify-between gap-3", children: [
|
|
27152
|
-
/* @__PURE__ */
|
|
27215
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: match.path }),
|
|
27153
27216
|
match.lineNumber !== null ? /* @__PURE__ */ jsxs7("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
27154
27217
|
"\u7B2C ",
|
|
27155
27218
|
match.lineNumber,
|
|
27156
27219
|
" \u884C"
|
|
27157
27220
|
] }) : null
|
|
27158
27221
|
] }),
|
|
27159
|
-
/* @__PURE__ */
|
|
27222
|
+
/* @__PURE__ */ jsx10("pre", { className: "mt-2 overflow-x-auto whitespace-pre-wrap font-mono text-[11px] text-[hsl(var(--muted-foreground))]", children: /* @__PURE__ */ jsx10("code", { children: match.line }) })
|
|
27160
27223
|
]
|
|
27161
27224
|
},
|
|
27162
27225
|
`${match.path}-${match.lineNumber}-${match.line}`
|
|
@@ -27175,13 +27238,13 @@ function SearchRenderer({ toolCall }) {
|
|
|
27175
27238
|
rel: "noreferrer",
|
|
27176
27239
|
className: "flex items-center gap-2 truncate font-mono text-[10px] text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))]",
|
|
27177
27240
|
children: [
|
|
27178
|
-
/* @__PURE__ */
|
|
27179
|
-
/* @__PURE__ */
|
|
27180
|
-
/* @__PURE__ */
|
|
27241
|
+
/* @__PURE__ */ jsx10(Earth, { size: 12, className: "shrink-0" }),
|
|
27242
|
+
/* @__PURE__ */ jsx10("span", { className: "truncate", children: url2 }),
|
|
27243
|
+
/* @__PURE__ */ jsx10(ExternalLink, { size: 11, className: "shrink-0" })
|
|
27181
27244
|
]
|
|
27182
27245
|
}
|
|
27183
27246
|
) : null,
|
|
27184
|
-
text ? /* @__PURE__ */
|
|
27247
|
+
text ? /* @__PURE__ */ jsx10("div", { className: "max-h-80 overflow-y-auto rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-3", children: /* @__PURE__ */ jsx10("p", { className: "whitespace-pre-wrap text-[11px] leading-5 text-[hsl(var(--foreground))]", children: text }) }) : renderEmptyState("\u8FD9\u4E2A\u7F51\u9875\u6CA1\u6709\u53EF\u5C55\u793A\u7684\u6B63\u6587\u3002")
|
|
27185
27248
|
] });
|
|
27186
27249
|
}
|
|
27187
27250
|
const results = parseWebResults(resultStr);
|
|
@@ -27191,7 +27254,7 @@ function SearchRenderer({ toolCall }) {
|
|
|
27191
27254
|
"\u67E5\u8BE2\uFF1A",
|
|
27192
27255
|
query
|
|
27193
27256
|
] }) : null,
|
|
27194
|
-
results.length > 0 ? /* @__PURE__ */
|
|
27257
|
+
results.length > 0 ? /* @__PURE__ */ jsx10("div", { className: "grid gap-2", children: results.map((item, index) => /* @__PURE__ */ jsx10(
|
|
27195
27258
|
"a",
|
|
27196
27259
|
{
|
|
27197
27260
|
href: item.url ?? void 0,
|
|
@@ -27202,11 +27265,11 @@ function SearchRenderer({ toolCall }) {
|
|
|
27202
27265
|
item.url && "hover:border-[hsl(var(--ring))] hover:bg-[hsl(var(--muted))]/35"
|
|
27203
27266
|
),
|
|
27204
27267
|
children: /* @__PURE__ */ jsxs7("div", { className: "flex items-start gap-3", children: [
|
|
27205
|
-
/* @__PURE__ */
|
|
27268
|
+
/* @__PURE__ */ jsx10(Earth, { size: 16, className: "mt-0.5 shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
27206
27269
|
/* @__PURE__ */ jsxs7("div", { className: "min-w-0 flex-1", children: [
|
|
27207
27270
|
/* @__PURE__ */ jsxs7("div", { className: "flex items-start justify-between gap-3", children: [
|
|
27208
|
-
/* @__PURE__ */
|
|
27209
|
-
item.url ? /* @__PURE__ */
|
|
27271
|
+
/* @__PURE__ */ jsx10("span", { className: "line-clamp-2 text-[11px] font-medium text-[hsl(var(--foreground))]", children: item.title ?? item.url ?? "\u672A\u547D\u540D\u7ED3\u679C" }),
|
|
27272
|
+
item.url ? /* @__PURE__ */ jsx10(
|
|
27210
27273
|
ExternalLink,
|
|
27211
27274
|
{
|
|
27212
27275
|
size: 12,
|
|
@@ -27214,12 +27277,12 @@ function SearchRenderer({ toolCall }) {
|
|
|
27214
27277
|
}
|
|
27215
27278
|
) : null
|
|
27216
27279
|
] }),
|
|
27217
|
-
item.url ? /* @__PURE__ */
|
|
27280
|
+
item.url ? /* @__PURE__ */ jsx10("div", { className: "mt-1 truncate font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.url }) : null,
|
|
27218
27281
|
item.publishedDate ? /* @__PURE__ */ jsxs7("div", { className: "mt-1 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
27219
27282
|
"\u53D1\u5E03\u4E8E ",
|
|
27220
27283
|
item.publishedDate.slice(0, 10)
|
|
27221
27284
|
] }) : null,
|
|
27222
|
-
item.description ? /* @__PURE__ */
|
|
27285
|
+
item.description ? /* @__PURE__ */ jsx10("p", { className: "mt-2 line-clamp-3 text-[11px] leading-5 text-[hsl(var(--muted-foreground))]", children: item.description }) : null
|
|
27223
27286
|
] })
|
|
27224
27287
|
] })
|
|
27225
27288
|
},
|
|
@@ -27229,7 +27292,7 @@ function SearchRenderer({ toolCall }) {
|
|
|
27229
27292
|
}
|
|
27230
27293
|
|
|
27231
27294
|
// src/chat/tool-renderers/SubmitResultRenderer.tsx
|
|
27232
|
-
import { jsx as
|
|
27295
|
+
import { jsx as jsx11, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
27233
27296
|
function extractText(value, key) {
|
|
27234
27297
|
if (!isPlainObject3(value)) return null;
|
|
27235
27298
|
const field = value[key];
|
|
@@ -27252,10 +27315,10 @@ function SubmitResultRenderer({ toolCall }) {
|
|
|
27252
27315
|
const Icon = isError ? CircleAlert : CircleCheck;
|
|
27253
27316
|
return /* @__PURE__ */ jsxs8("div", { className: "overflow-hidden rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]", children: [
|
|
27254
27317
|
/* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-3 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/25 px-4 py-3", children: [
|
|
27255
|
-
/* @__PURE__ */
|
|
27318
|
+
/* @__PURE__ */ jsx11("div", { className: isError ? "text-[hsl(var(--swf-danger))]" : "text-[hsl(var(--swf-success))]", children: /* @__PURE__ */ jsx11(Icon, { size: 18 }) }),
|
|
27256
27319
|
/* @__PURE__ */ jsxs8("div", { className: "min-w-0 flex-1", children: [
|
|
27257
|
-
/* @__PURE__ */
|
|
27258
|
-
description ? /* @__PURE__ */
|
|
27320
|
+
/* @__PURE__ */ jsx11("div", { className: "font-medium text-[hsl(var(--foreground))]", children: description || (isError ? "\u4EFB\u52A1\u672A\u5B8C\u6210" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4") }),
|
|
27321
|
+
description ? /* @__PURE__ */ jsx11("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: isError ? "\u4EFB\u52A1\u672A\u5B8C\u6210" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4" }) : null,
|
|
27259
27322
|
status ? /* @__PURE__ */ jsxs8("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
27260
27323
|
"\u72B6\u6001\uFF1A",
|
|
27261
27324
|
status
|
|
@@ -27263,12 +27326,12 @@ function SubmitResultRenderer({ toolCall }) {
|
|
|
27263
27326
|
] })
|
|
27264
27327
|
] }),
|
|
27265
27328
|
/* @__PURE__ */ jsxs8("div", { className: "space-y-3 px-4 py-4 text-sm leading-6 text-[hsl(var(--foreground))]", children: [
|
|
27266
|
-
result ? /* @__PURE__ */
|
|
27329
|
+
result ? /* @__PURE__ */ jsx11(MarkdownContent, { mode: "static", children: result }) : null,
|
|
27267
27330
|
error62 ? /* @__PURE__ */ jsxs8("div", { className: "rounded-xl border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-sm text-[hsl(var(--swf-danger))]", children: [
|
|
27268
|
-
/* @__PURE__ */
|
|
27269
|
-
/* @__PURE__ */
|
|
27331
|
+
/* @__PURE__ */ jsx11("div", { className: "mb-1 font-medium", children: "\u672A\u5B8C\u6210\u539F\u56E0" }),
|
|
27332
|
+
/* @__PURE__ */ jsx11("div", { className: "whitespace-pre-wrap", children: error62 })
|
|
27270
27333
|
] }) : null,
|
|
27271
|
-
!result && !error62 ? /* @__PURE__ */
|
|
27334
|
+
!result && !error62 ? /* @__PURE__ */ jsx11("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u667A\u80FD\u4F53\u5DF2\u7ED3\u675F\u672C\u8F6E\u4EFB\u52A1\u3002" }) : null
|
|
27272
27335
|
] })
|
|
27273
27336
|
] });
|
|
27274
27337
|
}
|
|
@@ -27293,6 +27356,7 @@ function getRenderer(toolName) {
|
|
|
27293
27356
|
}
|
|
27294
27357
|
|
|
27295
27358
|
export {
|
|
27359
|
+
McpAppFrame,
|
|
27296
27360
|
McpAppMessageContext,
|
|
27297
27361
|
McpAppCard,
|
|
27298
27362
|
MessageImage,
|
|
@@ -27309,4 +27373,4 @@ export {
|
|
|
27309
27373
|
* MIT Licensed
|
|
27310
27374
|
*)
|
|
27311
27375
|
*/
|
|
27312
|
-
//# sourceMappingURL=chunk-
|
|
27376
|
+
//# sourceMappingURL=chunk-HCW7SI5Q.js.map
|