@blade-hq/agent-react 2610.0.4 → 2610.0.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/dist/components/McpAppFrame.d.ts +17 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +643 -565
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -3449,7 +3449,7 @@ var X = createLucideIcon("X", [
|
|
|
3449
3449
|
]);
|
|
3450
3450
|
|
|
3451
3451
|
// src/components/AgentChat.tsx
|
|
3452
|
-
import { useCallback as useCallback30, useEffect as
|
|
3452
|
+
import { useCallback as useCallback30, useEffect as useEffect28, useMemo as useMemo18, useRef as useRef30, useState as useState37 } from "react";
|
|
3453
3453
|
|
|
3454
3454
|
// src/components/SessionPluginSelector.tsx
|
|
3455
3455
|
import { useEffect as useEffect15, useState as useState20 } from "react";
|
|
@@ -21008,7 +21008,7 @@ function CurrentPlanPanel({
|
|
|
21008
21008
|
|
|
21009
21009
|
// src/components/ChatSurface.tsx
|
|
21010
21010
|
import { chatErrorForDisplay as chatErrorForDisplay2 } from "@blade-hq/agent-client";
|
|
21011
|
-
import { useMemo as useMemo17, useState as
|
|
21011
|
+
import { useMemo as useMemo17, useState as useState36 } from "react";
|
|
21012
21012
|
|
|
21013
21013
|
// src/lib/random-id.ts
|
|
21014
21014
|
function randomId() {
|
|
@@ -21028,6 +21028,7 @@ function randomId() {
|
|
|
21028
21028
|
|
|
21029
21029
|
// src/components/McpAppCard.tsx
|
|
21030
21030
|
import { BladeApiError } from "@blade-hq/agent-client";
|
|
21031
|
+
import { createContext as createContext4, useContext as useContext4, useEffect as useEffect18, useRef as useRef18, useState as useState24 } from "react";
|
|
21031
21032
|
|
|
21032
21033
|
// ../../node_modules/.pnpm/@modelcontextprotocol+client@2.0.0/node_modules/@modelcontextprotocol/client/dist/chunk-Br0eD_fh.mjs
|
|
21033
21034
|
var __create = Object.create;
|
|
@@ -45875,10 +45876,9 @@ function SF(G, Q) {
|
|
|
45875
45876
|
return JSON.stringify(G) === JSON.stringify(Q);
|
|
45876
45877
|
}
|
|
45877
45878
|
|
|
45878
|
-
// src/components/
|
|
45879
|
-
import {
|
|
45879
|
+
// src/components/McpAppFrame.tsx
|
|
45880
|
+
import { useEffect as useEffect17, useLayoutEffect as useLayoutEffect4, useRef as useRef17, useState as useState23 } from "react";
|
|
45880
45881
|
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
45881
|
-
var McpAppMessageContext = createContext4(null);
|
|
45882
45882
|
function securedHtml(archive) {
|
|
45883
45883
|
const ui = archive.resourceMeta.ui;
|
|
45884
45884
|
const csp = ui?.csp ?? {};
|
|
@@ -45913,57 +45913,206 @@ function securedHtml(archive) {
|
|
|
45913
45913
|
doc.head.prepend(meta3);
|
|
45914
45914
|
return `<!doctype html>${doc.documentElement.outerHTML}`;
|
|
45915
45915
|
}
|
|
45916
|
-
function
|
|
45917
|
-
const
|
|
45918
|
-
const
|
|
45919
|
-
|
|
45920
|
-
const onMessage = suppliedOnMessage ?? contextMessage;
|
|
45921
|
-
const onMessageRef = useRef17(onMessage);
|
|
45922
|
-
onMessageRef.current = onMessage;
|
|
45916
|
+
function McpAppFrame(props) {
|
|
45917
|
+
const { html: sourceHtml, resourceMeta, title = "\u5DE5\u5177\u754C\u9762" } = props;
|
|
45918
|
+
const callbacks = useRef17(props);
|
|
45919
|
+
callbacks.current = props;
|
|
45923
45920
|
const frame = useRef17(null);
|
|
45924
45921
|
const panel = useRef17(null);
|
|
45925
45922
|
const bridgeRef = useRef17(null);
|
|
45926
45923
|
const [html, setHtml] = useState23();
|
|
45927
|
-
const [
|
|
45928
|
-
const
|
|
45924
|
+
const [failure, setError] = useState23(null);
|
|
45925
|
+
const error61 = props.error ?? failure;
|
|
45929
45926
|
const [ready, setReady] = useState23(false);
|
|
45930
45927
|
const [expanded, setExpanded] = useState23(false);
|
|
45931
45928
|
const [height, setHeight] = useState23(360);
|
|
45932
45929
|
useLayoutEffect4(() => {
|
|
45933
45930
|
const dialog = panel.current;
|
|
45934
45931
|
if (!dialog) return;
|
|
45935
|
-
dialog.close();
|
|
45936
|
-
|
|
45937
|
-
|
|
45932
|
+
if (typeof dialog.close === "function") dialog.close();
|
|
45933
|
+
else dialog.removeAttribute("open");
|
|
45934
|
+
const show = expanded ? dialog.showModal : dialog.show;
|
|
45935
|
+
if (typeof show === "function") show.call(dialog);
|
|
45936
|
+
else dialog.setAttribute("open", "");
|
|
45938
45937
|
}, [expanded]);
|
|
45939
45938
|
useEffect17(() => {
|
|
45940
|
-
const controller = new AbortController();
|
|
45941
|
-
let bridge;
|
|
45942
|
-
let disposed = false;
|
|
45943
|
-
let offChanged;
|
|
45944
|
-
let refreshRevision = 0;
|
|
45945
45939
|
setError(null);
|
|
45946
45940
|
setReady(false);
|
|
45947
45941
|
setHtml(void 0);
|
|
45948
45942
|
setExpanded(false);
|
|
45949
45943
|
setHeight(360);
|
|
45944
|
+
if (sourceHtml === void 0) return;
|
|
45945
|
+
let disposed = false;
|
|
45946
|
+
let bridge;
|
|
45947
|
+
const timer = window.setTimeout(() => {
|
|
45948
|
+
if (!disposed && !bridge?.getAppCapabilities()) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
|
|
45949
|
+
}, 2e4);
|
|
45950
45950
|
const start = async () => {
|
|
45951
|
-
if (!
|
|
45952
|
-
const
|
|
45953
|
-
if (disposed) return;
|
|
45954
|
-
const secured = securedHtml(archive);
|
|
45955
|
-
setTitle(archive.plugin);
|
|
45951
|
+
if (!frame.current?.contentWindow) throw new Error("\u5E94\u7528\u4F1A\u8BDD\u4E0D\u53EF\u7528");
|
|
45952
|
+
const secured = securedHtml({ html: sourceHtml, resourceMeta });
|
|
45956
45953
|
bridge = new MF(null, { name: "Blade Agent", version: "1.0.0" }, {
|
|
45957
45954
|
serverTools: {},
|
|
45958
45955
|
openLinks: {}
|
|
45959
45956
|
}, { hostContext: { platform: "web", displayMode: "inline", availableDisplayModes: ["inline", "fullscreen"] } });
|
|
45960
45957
|
bridgeRef.current = bridge;
|
|
45961
45958
|
bridge.oninitialized = () => {
|
|
45962
|
-
if (disposed) return;
|
|
45963
|
-
offChanged?.();
|
|
45959
|
+
if (disposed || !bridge) return;
|
|
45964
45960
|
window.clearTimeout(timer);
|
|
45965
45961
|
setError(null);
|
|
45966
45962
|
setReady(true);
|
|
45963
|
+
callbacks.current.onReady?.(bridge);
|
|
45964
|
+
};
|
|
45965
|
+
bridge.oncalltool = (params, extra) => {
|
|
45966
|
+
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
45967
|
+
if (!callbacks.current.callTool) throw new Error("\u5F53\u524D\u4F4D\u7F6E\u4E0D\u652F\u6301");
|
|
45968
|
+
return callbacks.current.callTool(params, extra);
|
|
45969
|
+
};
|
|
45970
|
+
bridge.onmessage = (params, extra) => {
|
|
45971
|
+
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
45972
|
+
if (!callbacks.current.sendMessage) throw new Error("\u5F53\u524D\u4F1A\u8BDD\u4E0D\u80FD\u63A5\u6536\u5E94\u7528\u6D88\u606F");
|
|
45973
|
+
return callbacks.current.sendMessage(params, extra);
|
|
45974
|
+
};
|
|
45975
|
+
bridge.onupdatemodelcontext = (params, extra) => {
|
|
45976
|
+
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
45977
|
+
if (!callbacks.current.updateModelContext) throw new Error("\u5F53\u524D\u4F4D\u7F6E\u4E0D\u652F\u6301");
|
|
45978
|
+
return callbacks.current.updateModelContext(params, extra);
|
|
45979
|
+
};
|
|
45980
|
+
bridge.onrequestdisplaymode = async (params, extra) => {
|
|
45981
|
+
if (callbacks.current.requestDisplayMode) return callbacks.current.requestDisplayMode(params, extra);
|
|
45982
|
+
const next = params.mode === "fullscreen" ? "fullscreen" : "inline";
|
|
45983
|
+
setExpanded(next === "fullscreen");
|
|
45984
|
+
bridge?.setHostContext({ displayMode: next });
|
|
45985
|
+
return { mode: next };
|
|
45986
|
+
};
|
|
45987
|
+
bridge.onsizechange = (params) => {
|
|
45988
|
+
if (callbacks.current.sizeChange) return callbacks.current.sizeChange(params);
|
|
45989
|
+
if (params.height && Number.isFinite(params.height)) setHeight(Math.max(120, Math.min(1200, params.height)));
|
|
45990
|
+
};
|
|
45991
|
+
bridge.onopenlink = async (params, extra) => {
|
|
45992
|
+
if (callbacks.current.openLink) return callbacks.current.openLink(params, extra);
|
|
45993
|
+
const target = new URL(params.url);
|
|
45994
|
+
if (!["https:", "http:"].includes(target.protocol) || target.username || target.password) throw new Error("\u94FE\u63A5\u65E0\u6548");
|
|
45995
|
+
window.open(target.href, "_blank", "noopener,noreferrer");
|
|
45996
|
+
return {};
|
|
45997
|
+
};
|
|
45998
|
+
await bridge.connect(new c(frame.current.contentWindow, frame.current.contentWindow));
|
|
45999
|
+
if (!disposed) setHtml(secured);
|
|
46000
|
+
};
|
|
46001
|
+
void start().catch((error62) => {
|
|
46002
|
+
window.clearTimeout(timer);
|
|
46003
|
+
if (!disposed) setError(error62 instanceof Error ? error62.message : "\u5E94\u7528\u52A0\u8F7D\u5931\u8D25");
|
|
46004
|
+
});
|
|
46005
|
+
return () => {
|
|
46006
|
+
disposed = true;
|
|
46007
|
+
window.clearTimeout(timer);
|
|
46008
|
+
bridgeRef.current = null;
|
|
46009
|
+
void bridge?.close();
|
|
46010
|
+
};
|
|
46011
|
+
}, [sourceHtml, resourceMeta]);
|
|
46012
|
+
useEffect17(() => {
|
|
46013
|
+
let disposed = false;
|
|
46014
|
+
if (ready && props.toolInput) void bridgeRef.current?.sendToolInput(props.toolInput).catch((error62) => {
|
|
46015
|
+
if (!disposed) setError(error62 instanceof Error ? error62.message : "\u5E94\u7528\u7ED3\u679C\u5237\u65B0\u5931\u8D25");
|
|
46016
|
+
});
|
|
46017
|
+
return () => {
|
|
46018
|
+
disposed = true;
|
|
46019
|
+
};
|
|
46020
|
+
}, [props.toolInput, ready]);
|
|
46021
|
+
const nativeDialog = typeof HTMLDialogElement !== "undefined" && typeof HTMLDialogElement.prototype.showModal === "function";
|
|
46022
|
+
const toggle = () => {
|
|
46023
|
+
setExpanded(!expanded);
|
|
46024
|
+
bridgeRef.current?.setHostContext({ displayMode: expanded ? "inline" : "fullscreen" });
|
|
46025
|
+
};
|
|
46026
|
+
return /* @__PURE__ */ jsxs10(
|
|
46027
|
+
"dialog",
|
|
46028
|
+
{
|
|
46029
|
+
ref: panel,
|
|
46030
|
+
role: "dialog",
|
|
46031
|
+
"aria-modal": expanded || void 0,
|
|
46032
|
+
onKeyDown: (event) => {
|
|
46033
|
+
if (!nativeDialog && expanded && event.key === "Escape") {
|
|
46034
|
+
event.preventDefault();
|
|
46035
|
+
setExpanded(false);
|
|
46036
|
+
bridgeRef.current?.setHostContext({ displayMode: "inline" });
|
|
46037
|
+
}
|
|
46038
|
+
},
|
|
46039
|
+
onCancel: () => {
|
|
46040
|
+
setExpanded(false);
|
|
46041
|
+
bridgeRef.current?.setHostContext({ displayMode: "inline" });
|
|
46042
|
+
},
|
|
46043
|
+
className: "blade-chat-mcp-app blade-mcp-app",
|
|
46044
|
+
part: "mcp-app",
|
|
46045
|
+
style: expanded ? {
|
|
46046
|
+
position: "fixed",
|
|
46047
|
+
top: 0,
|
|
46048
|
+
right: 0,
|
|
46049
|
+
bottom: 0,
|
|
46050
|
+
left: "auto",
|
|
46051
|
+
margin: 0,
|
|
46052
|
+
padding: 0,
|
|
46053
|
+
border: 0,
|
|
46054
|
+
width: "min(100vw, 760px)",
|
|
46055
|
+
height: "100%",
|
|
46056
|
+
maxWidth: "none",
|
|
46057
|
+
maxHeight: "none",
|
|
46058
|
+
zIndex: 80,
|
|
46059
|
+
background: "white",
|
|
46060
|
+
boxShadow: "-4px 0 20px #0002",
|
|
46061
|
+
display: "flex",
|
|
46062
|
+
flexDirection: "column"
|
|
46063
|
+
} : { position: "relative", margin: 0, padding: 0, width: "100%", maxWidth: "none", maxHeight: "none", border: "1px solid #d4d4d8", borderRadius: 6, overflow: "hidden", background: "white", display: nativeDialog ? void 0 : "block" },
|
|
46064
|
+
children: [
|
|
46065
|
+
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "8px 12px", color: "#27272a" }, children: [
|
|
46066
|
+
/* @__PURE__ */ jsx12("span", { children: title }),
|
|
46067
|
+
/* @__PURE__ */ jsx12("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__ */ jsx12(Minimize2, { size: 16 }) : /* @__PURE__ */ jsx12(Maximize2, { size: 16 }) })
|
|
46068
|
+
] }),
|
|
46069
|
+
error61 ? /* @__PURE__ */ jsx12("p", { role: "alert", style: { padding: 12, color: "#b91c1c" }, children: error61 }) : !ready ? /* @__PURE__ */ jsx12("output", { style: { padding: 12 }, children: "\u6B63\u5728\u52A0\u8F7D" }) : null,
|
|
46070
|
+
/* @__PURE__ */ jsx12(
|
|
46071
|
+
"iframe",
|
|
46072
|
+
{
|
|
46073
|
+
ref: frame,
|
|
46074
|
+
title,
|
|
46075
|
+
srcDoc: html,
|
|
46076
|
+
sandbox: "allow-scripts allow-forms",
|
|
46077
|
+
referrerPolicy: "no-referrer",
|
|
46078
|
+
style: { width: "100%", height: expanded ? "100%" : height, flex: expanded ? 1 : void 0, border: 0 }
|
|
46079
|
+
}
|
|
46080
|
+
)
|
|
46081
|
+
]
|
|
46082
|
+
}
|
|
46083
|
+
);
|
|
46084
|
+
}
|
|
46085
|
+
|
|
46086
|
+
// src/components/McpAppCard.tsx
|
|
46087
|
+
import { jsx as jsx13 } from "react/jsx-runtime";
|
|
46088
|
+
var McpAppMessageContext = createContext4(null);
|
|
46089
|
+
function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: suppliedOnMessage }) {
|
|
46090
|
+
const contextClient = useOptionalBladeClient();
|
|
46091
|
+
const contextMessage = useContext4(McpAppMessageContext);
|
|
46092
|
+
const client = suppliedClient ?? contextClient;
|
|
46093
|
+
const onMessage = suppliedOnMessage ?? contextMessage;
|
|
46094
|
+
const onMessageRef = useRef18(onMessage);
|
|
46095
|
+
onMessageRef.current = onMessage;
|
|
46096
|
+
const [surface, setSurface] = useState24({ resourceMeta: {} });
|
|
46097
|
+
const [error61, setError] = useState24(null);
|
|
46098
|
+
useEffect18(() => {
|
|
46099
|
+
const controller = new AbortController();
|
|
46100
|
+
let disposed = false;
|
|
46101
|
+
let offChanged;
|
|
46102
|
+
let refreshRevision = 0;
|
|
46103
|
+
setError(null);
|
|
46104
|
+
setSurface({ resourceMeta: {} });
|
|
46105
|
+
const timer = window.setTimeout(() => {
|
|
46106
|
+
if (!disposed) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
|
|
46107
|
+
}, 2e4);
|
|
46108
|
+
const start = async () => {
|
|
46109
|
+
if (!client) throw new Error("\u5E94\u7528\u4F1A\u8BDD\u4E0D\u53EF\u7528");
|
|
46110
|
+
const archive = await client.sessions.getMcpApp(sessionId, sourceId, { signal: controller.signal });
|
|
46111
|
+
if (disposed) return;
|
|
46112
|
+
const handlers = { html: archive.html, resourceMeta: archive.resourceMeta, title: archive.plugin };
|
|
46113
|
+
handlers.onReady = (bridge) => {
|
|
46114
|
+
offChanged?.();
|
|
46115
|
+
setError(null);
|
|
45967
46116
|
const refresh = (restoreView = false) => {
|
|
45968
46117
|
const revision = ++refreshRevision;
|
|
45969
46118
|
void client.sessions.getMcpApp(sessionId, sourceId, { signal: controller.signal }).then(async (latest) => {
|
|
@@ -45985,7 +46134,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
45985
46134
|
};
|
|
45986
46135
|
const instance = randomId();
|
|
45987
46136
|
const deliveredMessages = /* @__PURE__ */ new Set();
|
|
45988
|
-
|
|
46137
|
+
handlers.callTool = async (params, extra) => {
|
|
45989
46138
|
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
45990
46139
|
const requestId = `${instance}:${String(extra.mcpReq.id)}`;
|
|
45991
46140
|
const callController = new AbortController();
|
|
@@ -46006,7 +46155,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
46006
46155
|
for (const signal of signals) signal.removeEventListener("abort", abort);
|
|
46007
46156
|
}
|
|
46008
46157
|
};
|
|
46009
|
-
|
|
46158
|
+
handlers.sendMessage = async ({ content: content3 }, extra) => {
|
|
46010
46159
|
if (disposed || !onMessageRef.current) throw new Error("\u5F53\u524D\u4F1A\u8BDD\u4E0D\u80FD\u63A5\u6536\u5E94\u7528\u6D88\u606F");
|
|
46011
46160
|
const requestId = String(extra.mcpReq.id);
|
|
46012
46161
|
if (deliveredMessages.has(requestId)) return {};
|
|
@@ -46021,7 +46170,7 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
46021
46170
|
};
|
|
46022
46171
|
const deliveredContextUpdates = /* @__PURE__ */ new Set();
|
|
46023
46172
|
let contextUpdates = Promise.resolve();
|
|
46024
|
-
|
|
46173
|
+
handlers.updateModelContext = async ({ content: content3, structuredContent }, extra) => {
|
|
46025
46174
|
if (disposed) throw new Error("\u5E94\u7528\u5DF2\u5173\u95ED");
|
|
46026
46175
|
const requestId = `${instance}:${String(extra.mcpReq.id)}`;
|
|
46027
46176
|
if (deliveredContextUpdates.has(requestId)) return {};
|
|
@@ -46054,98 +46203,26 @@ function McpAppCard({ sessionId, sourceId, client: suppliedClient, onMessage: su
|
|
|
46054
46203
|
contextUpdates = update.catch(() => void 0);
|
|
46055
46204
|
return update;
|
|
46056
46205
|
};
|
|
46057
|
-
|
|
46058
|
-
|
|
46059
|
-
setExpanded(next === "fullscreen");
|
|
46060
|
-
bridge?.setHostContext({ displayMode: next });
|
|
46061
|
-
return { mode: next };
|
|
46062
|
-
};
|
|
46063
|
-
bridge.onsizechange = ({ height: next }) => {
|
|
46064
|
-
if (next && Number.isFinite(next)) setHeight(Math.max(120, Math.min(1200, next)));
|
|
46065
|
-
};
|
|
46066
|
-
bridge.onopenlink = async ({ url: url2 }) => {
|
|
46067
|
-
const target = new URL(url2);
|
|
46068
|
-
if (!["https:", "http:"].includes(target.protocol) || target.username || target.password) throw new Error("\u94FE\u63A5\u65E0\u6548");
|
|
46069
|
-
window.open(target.href, "_blank", "noopener,noreferrer");
|
|
46070
|
-
return {};
|
|
46071
|
-
};
|
|
46072
|
-
await bridge.connect(new c(frame.current.contentWindow, frame.current.contentWindow));
|
|
46073
|
-
if (!disposed) setHtml(secured);
|
|
46206
|
+
window.clearTimeout(timer);
|
|
46207
|
+
setSurface(handlers);
|
|
46074
46208
|
};
|
|
46075
46209
|
void start().catch((failure) => {
|
|
46076
46210
|
window.clearTimeout(timer);
|
|
46077
46211
|
if (!disposed) setError(failure instanceof Error ? failure.message : "\u5E94\u7528\u52A0\u8F7D\u5931\u8D25");
|
|
46078
46212
|
});
|
|
46079
|
-
const timer = window.setTimeout(() => {
|
|
46080
|
-
if (!disposed && !bridge?.getAppCapabilities()) setError("\u5E94\u7528\u8FDE\u63A5\u8D85\u65F6");
|
|
46081
|
-
}, 2e4);
|
|
46082
46213
|
return () => {
|
|
46083
46214
|
disposed = true;
|
|
46215
|
+
window.clearTimeout(timer);
|
|
46084
46216
|
controller.abort();
|
|
46085
46217
|
offChanged?.();
|
|
46086
|
-
window.clearTimeout(timer);
|
|
46087
|
-
bridgeRef.current = null;
|
|
46088
|
-
void bridge?.close();
|
|
46089
46218
|
};
|
|
46090
46219
|
}, [client, sessionId, sourceId]);
|
|
46091
|
-
|
|
46092
|
-
setExpanded(!expanded);
|
|
46093
|
-
bridgeRef.current?.setHostContext({ displayMode: expanded ? "inline" : "fullscreen" });
|
|
46094
|
-
};
|
|
46095
|
-
return /* @__PURE__ */ jsxs10(
|
|
46096
|
-
"dialog",
|
|
46097
|
-
{
|
|
46098
|
-
ref: panel,
|
|
46099
|
-
onCancel: () => {
|
|
46100
|
-
setExpanded(false);
|
|
46101
|
-
bridgeRef.current?.setHostContext({ displayMode: "inline" });
|
|
46102
|
-
},
|
|
46103
|
-
className: "blade-chat-mcp-app blade-mcp-app",
|
|
46104
|
-
part: "mcp-app",
|
|
46105
|
-
style: expanded ? {
|
|
46106
|
-
position: "fixed",
|
|
46107
|
-
top: 0,
|
|
46108
|
-
right: 0,
|
|
46109
|
-
bottom: 0,
|
|
46110
|
-
left: "auto",
|
|
46111
|
-
margin: 0,
|
|
46112
|
-
padding: 0,
|
|
46113
|
-
border: 0,
|
|
46114
|
-
width: "min(100vw, 760px)",
|
|
46115
|
-
height: "100%",
|
|
46116
|
-
maxWidth: "none",
|
|
46117
|
-
maxHeight: "none",
|
|
46118
|
-
zIndex: 80,
|
|
46119
|
-
background: "white",
|
|
46120
|
-
boxShadow: "-4px 0 20px #0002",
|
|
46121
|
-
display: "flex",
|
|
46122
|
-
flexDirection: "column"
|
|
46123
|
-
} : { position: "relative", margin: 0, padding: 0, width: "100%", maxWidth: "none", maxHeight: "none", border: "1px solid #d4d4d8", borderRadius: 6, overflow: "hidden", background: "white" },
|
|
46124
|
-
children: [
|
|
46125
|
-
/* @__PURE__ */ jsxs10("div", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", padding: "8px 12px", color: "#27272a" }, children: [
|
|
46126
|
-
/* @__PURE__ */ jsx12("span", { children: title }),
|
|
46127
|
-
/* @__PURE__ */ jsx12("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__ */ jsx12(Minimize2, { size: 16 }) : /* @__PURE__ */ jsx12(Maximize2, { size: 16 }) })
|
|
46128
|
-
] }),
|
|
46129
|
-
error61 ? /* @__PURE__ */ jsx12("p", { role: "alert", style: { padding: 12, color: "#b91c1c" }, children: error61 }) : !ready ? /* @__PURE__ */ jsx12("output", { style: { padding: 12 }, children: "\u6B63\u5728\u52A0\u8F7D" }) : null,
|
|
46130
|
-
/* @__PURE__ */ jsx12(
|
|
46131
|
-
"iframe",
|
|
46132
|
-
{
|
|
46133
|
-
ref: frame,
|
|
46134
|
-
title,
|
|
46135
|
-
srcDoc: html,
|
|
46136
|
-
sandbox: "allow-scripts allow-forms",
|
|
46137
|
-
referrerPolicy: "no-referrer",
|
|
46138
|
-
style: { width: "100%", height: expanded ? "100%" : height, flex: expanded ? 1 : void 0, border: 0 }
|
|
46139
|
-
}
|
|
46140
|
-
)
|
|
46141
|
-
]
|
|
46142
|
-
}
|
|
46143
|
-
);
|
|
46220
|
+
return /* @__PURE__ */ jsx13(McpAppFrame, { ...surface, error: error61 });
|
|
46144
46221
|
}
|
|
46145
46222
|
|
|
46146
46223
|
// src/components/ChatInput.tsx
|
|
46147
|
-
import { useRef as
|
|
46148
|
-
import { Fragment as Fragment5, jsx as
|
|
46224
|
+
import { useRef as useRef19, useState as useState25 } from "react";
|
|
46225
|
+
import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
46149
46226
|
function isImeCompositionKey(event) {
|
|
46150
46227
|
return event.isComposing || event.keyCode === 229;
|
|
46151
46228
|
}
|
|
@@ -46170,10 +46247,10 @@ function ChatInput({
|
|
|
46170
46247
|
hasAttachments = false
|
|
46171
46248
|
}) {
|
|
46172
46249
|
const trimmed = value.trim();
|
|
46173
|
-
const latestValue =
|
|
46250
|
+
const latestValue = useRef19(value);
|
|
46174
46251
|
latestValue.current = value;
|
|
46175
|
-
const sending =
|
|
46176
|
-
const [isSending2, setIsSending] =
|
|
46252
|
+
const sending = useRef19(false);
|
|
46253
|
+
const [isSending2, setIsSending] = useState25(false);
|
|
46177
46254
|
void queueKey;
|
|
46178
46255
|
const canSend = !isSending2 && (trimmed.length > 0 || hasAttachments) && (!isStreaming || queueWhileRunning && !hasAttachments && !isStopping);
|
|
46179
46256
|
const handleSend = async () => {
|
|
@@ -46201,7 +46278,7 @@ function ChatInput({
|
|
|
46201
46278
|
void handleSend();
|
|
46202
46279
|
}
|
|
46203
46280
|
};
|
|
46204
|
-
return /* @__PURE__ */
|
|
46281
|
+
return /* @__PURE__ */ jsx14(
|
|
46205
46282
|
"div",
|
|
46206
46283
|
{
|
|
46207
46284
|
style: mergesWithPanelAbove ? { "--blade-chat-input-top-border": "0" } : void 0,
|
|
@@ -46223,7 +46300,7 @@ function ChatInput({
|
|
|
46223
46300
|
innerClassName
|
|
46224
46301
|
),
|
|
46225
46302
|
children: [
|
|
46226
|
-
/* @__PURE__ */
|
|
46303
|
+
/* @__PURE__ */ jsx14(
|
|
46227
46304
|
"textarea",
|
|
46228
46305
|
{
|
|
46229
46306
|
value,
|
|
@@ -46244,10 +46321,10 @@ function ChatInput({
|
|
|
46244
46321
|
)
|
|
46245
46322
|
}
|
|
46246
46323
|
),
|
|
46247
|
-
/* @__PURE__ */
|
|
46248
|
-
queueWhileRunning ? /* @__PURE__ */
|
|
46249
|
-
/* @__PURE__ */
|
|
46250
|
-
] }) : /* @__PURE__ */
|
|
46324
|
+
/* @__PURE__ */ jsx14("div", { part: "input-toolbar", className: cn("blade-chat-input-toolbar flex shrink-0 items-center gap-2", toolbarClassName), children: isStreaming ? /* @__PURE__ */ jsxs11(Fragment5, { children: [
|
|
46325
|
+
queueWhileRunning ? /* @__PURE__ */ jsx14("button", { type: "button", onClick: handleSend, disabled: !canSend, "aria-label": "\u52A0\u5165\u6392\u961F", title: "\u52A0\u5165\u6392\u961F", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] disabled:opacity-40", children: /* @__PURE__ */ jsx14(ArrowUp, { size: 15 }) }) : null,
|
|
46326
|
+
/* @__PURE__ */ jsx14("button", { type: "button", onClick: onStop, disabled: isStopping, "aria-label": isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u56DE\u590D", title: isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u56DE\u590D", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--muted))] text-[hsl(var(--foreground))] transition-opacity hover:opacity-90 disabled:opacity-60", children: isStopping ? /* @__PURE__ */ jsx14(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx14(Square, { size: 12, fill: "currentColor" }) })
|
|
46327
|
+
] }) : /* @__PURE__ */ jsx14(
|
|
46251
46328
|
"button",
|
|
46252
46329
|
{
|
|
46253
46330
|
type: "button",
|
|
@@ -46256,7 +46333,7 @@ function ChatInput({
|
|
|
46256
46333
|
"aria-label": "\u53D1\u9001\u6D88\u606F",
|
|
46257
46334
|
title: "\u53D1\u9001\u6D88\u606F",
|
|
46258
46335
|
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",
|
|
46259
|
-
children: /* @__PURE__ */
|
|
46336
|
+
children: /* @__PURE__ */ jsx14(ArrowUp, { size: 15 })
|
|
46260
46337
|
}
|
|
46261
46338
|
) })
|
|
46262
46339
|
]
|
|
@@ -46267,16 +46344,16 @@ function ChatInput({
|
|
|
46267
46344
|
}
|
|
46268
46345
|
|
|
46269
46346
|
// src/components/ConnectionBanner.tsx
|
|
46270
|
-
import { useEffect as
|
|
46271
|
-
import { jsx as
|
|
46347
|
+
import { useEffect as useEffect19, useRef as useRef20, useState as useState26 } from "react";
|
|
46348
|
+
import { jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
46272
46349
|
var CONNECTION_NOTICE_DELAY_MS = 3e3;
|
|
46273
46350
|
var CONNECTION_ERROR_DELAY_MS = 15e3;
|
|
46274
46351
|
function useConnectionNoticePhase(connected) {
|
|
46275
|
-
const [phase, setPhase] =
|
|
46276
|
-
const connectedRef =
|
|
46277
|
-
const timersRef =
|
|
46352
|
+
const [phase, setPhase] = useState26("hidden");
|
|
46353
|
+
const connectedRef = useRef20(connected);
|
|
46354
|
+
const timersRef = useRef20([]);
|
|
46278
46355
|
connectedRef.current = connected;
|
|
46279
|
-
|
|
46356
|
+
useEffect19(() => {
|
|
46280
46357
|
const clearTimers = () => {
|
|
46281
46358
|
for (const timer of timersRef.current) clearTimeout(timer);
|
|
46282
46359
|
timersRef.current = [];
|
|
@@ -46316,14 +46393,14 @@ function useConnectionNoticePhase(connected) {
|
|
|
46316
46393
|
return phase;
|
|
46317
46394
|
}
|
|
46318
46395
|
function ConnectionBanner({ connection, className }) {
|
|
46319
|
-
const hasConnectedRef =
|
|
46396
|
+
const hasConnectedRef = useRef20(connection === "connected" || connection === "reconnecting");
|
|
46320
46397
|
if (connection === "connected") hasConnectedRef.current = true;
|
|
46321
46398
|
const connected = connection === "connected";
|
|
46322
46399
|
const phase = useConnectionNoticePhase(connected);
|
|
46323
46400
|
if (connected || phase === "hidden") return null;
|
|
46324
46401
|
const recovering = phase === "recovering";
|
|
46325
46402
|
const firstConnection = !hasConnectedRef.current;
|
|
46326
|
-
return /* @__PURE__ */
|
|
46403
|
+
return /* @__PURE__ */ jsx15("div", { part: "banner", className: cn("blade-chat-banner bg-[hsl(var(--background))] px-5 pt-3", className), children: /* @__PURE__ */ jsxs12(
|
|
46327
46404
|
"div",
|
|
46328
46405
|
{
|
|
46329
46406
|
className: cn(
|
|
@@ -46331,10 +46408,10 @@ function ConnectionBanner({ connection, className }) {
|
|
|
46331
46408
|
recovering ? "border-amber-500/25 bg-amber-500/10 text-amber-100" : "border-rose-500/25 bg-rose-500/10 text-rose-100"
|
|
46332
46409
|
),
|
|
46333
46410
|
children: [
|
|
46334
|
-
/* @__PURE__ */
|
|
46411
|
+
/* @__PURE__ */ jsx15("span", { className: "mt-0.5 shrink-0", children: recovering ? /* @__PURE__ */ jsx15(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx15(TriangleAlert, { size: 14 }) }),
|
|
46335
46412
|
/* @__PURE__ */ jsxs12("div", { className: "min-w-0", children: [
|
|
46336
|
-
/* @__PURE__ */
|
|
46337
|
-
/* @__PURE__ */
|
|
46413
|
+
/* @__PURE__ */ jsx15("div", { className: "text-sm font-medium", children: recovering ? firstConnection ? "\u6B63\u5728\u8FDE\u63A5\u2026" : "\u6B63\u5728\u6062\u590D\u8FDE\u63A5\u2026" : "\u6682\u65F6\u65E0\u6CD5\u8FDE\u63A5" }),
|
|
46414
|
+
/* @__PURE__ */ jsx15("div", { className: "text-xs opacity-80", children: recovering ? "\u6062\u590D\u540E\u4F1A\u81EA\u52A8\u540C\u6B65\u6700\u65B0\u6D88\u606F\uFF0C\u8BF7\u7A0D\u5019" : "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u670D\u52A1\u72B6\u6001\uFF0C\u7CFB\u7EDF\u4F1A\u7EE7\u7EED\u81EA\u52A8\u91CD\u8BD5" })
|
|
46338
46415
|
] })
|
|
46339
46416
|
]
|
|
46340
46417
|
}
|
|
@@ -46342,7 +46419,7 @@ function ConnectionBanner({ connection, className }) {
|
|
|
46342
46419
|
}
|
|
46343
46420
|
|
|
46344
46421
|
// src/components/BackgroundWakeNotice.tsx
|
|
46345
|
-
import { jsx as
|
|
46422
|
+
import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
46346
46423
|
function BackgroundWakeNotice() {
|
|
46347
46424
|
return /* @__PURE__ */ jsxs13(
|
|
46348
46425
|
"div",
|
|
@@ -46350,10 +46427,10 @@ function BackgroundWakeNotice() {
|
|
|
46350
46427
|
"data-background-wakeup": true,
|
|
46351
46428
|
className: "my-3 flex items-start gap-2 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
46352
46429
|
children: [
|
|
46353
|
-
/* @__PURE__ */
|
|
46430
|
+
/* @__PURE__ */ jsx16(BellRing, { size: 14, className: "mt-0.5 shrink-0", "aria-hidden": "true" }),
|
|
46354
46431
|
/* @__PURE__ */ jsxs13("div", { children: [
|
|
46355
|
-
/* @__PURE__ */
|
|
46356
|
-
/* @__PURE__ */
|
|
46432
|
+
/* @__PURE__ */ jsx16("p", { className: "font-medium", children: "\u540E\u53F0\u4EFB\u52A1\u5DF2\u7ED3\u675F" }),
|
|
46433
|
+
/* @__PURE__ */ jsx16("p", { className: "mt-0.5", children: "\u52A9\u624B\u5DF2\u81EA\u52A8\u7EE7\u7EED\u5904\u7406\u7ED3\u679C" })
|
|
46357
46434
|
] })
|
|
46358
46435
|
]
|
|
46359
46436
|
}
|
|
@@ -46364,14 +46441,14 @@ function BackgroundWakeNotice() {
|
|
|
46364
46441
|
import { isBackgroundWakeMessage, isHiddenInternalMessage as isHiddenInternalMessage2 } from "@blade-hq/agent-client";
|
|
46365
46442
|
import {
|
|
46366
46443
|
useCallback as useCallback29,
|
|
46367
|
-
useEffect as
|
|
46444
|
+
useEffect as useEffect27,
|
|
46368
46445
|
useMemo as useMemo16,
|
|
46369
|
-
useRef as
|
|
46370
|
-
useState as
|
|
46446
|
+
useRef as useRef29,
|
|
46447
|
+
useState as useState35
|
|
46371
46448
|
} from "react";
|
|
46372
46449
|
|
|
46373
46450
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
|
|
46374
|
-
import { useCallback as useCallback26, useMemo as useMemo12, useRef as
|
|
46451
|
+
import { useCallback as useCallback26, useMemo as useMemo12, useRef as useRef21, useState as useState27 } from "react";
|
|
46375
46452
|
var DEFAULT_SPRING_ANIMATION = {
|
|
46376
46453
|
/**
|
|
46377
46454
|
* A value from 0 to 1, on how much to damp the animation.
|
|
@@ -46408,10 +46485,10 @@ globalThis.document?.addEventListener("click", () => {
|
|
|
46408
46485
|
mouseDown = false;
|
|
46409
46486
|
});
|
|
46410
46487
|
var useStickToBottom = (options = {}) => {
|
|
46411
|
-
const [escapedFromLock, updateEscapedFromLock] =
|
|
46412
|
-
const [isAtBottom, updateIsAtBottom] =
|
|
46413
|
-
const [isNearBottom, setIsNearBottom] =
|
|
46414
|
-
const optionsRef =
|
|
46488
|
+
const [escapedFromLock, updateEscapedFromLock] = useState27(false);
|
|
46489
|
+
const [isAtBottom, updateIsAtBottom] = useState27(options.initial !== false);
|
|
46490
|
+
const [isNearBottom, setIsNearBottom] = useState27(false);
|
|
46491
|
+
const optionsRef = useRef21(null);
|
|
46415
46492
|
optionsRef.current = options;
|
|
46416
46493
|
const isSelecting = useCallback26(() => {
|
|
46417
46494
|
if (!mouseDown) {
|
|
@@ -46715,11 +46792,11 @@ function mergeAnimations(...animations) {
|
|
|
46715
46792
|
|
|
46716
46793
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/StickToBottom.js
|
|
46717
46794
|
import * as React from "react";
|
|
46718
|
-
import { createContext as createContext5, useContext as useContext5, useEffect as
|
|
46795
|
+
import { createContext as createContext5, useContext as useContext5, useEffect as useEffect20, useImperativeHandle, useLayoutEffect as useLayoutEffect5, useMemo as useMemo13, useRef as useRef22 } from "react";
|
|
46719
46796
|
var StickToBottomContext = createContext5(null);
|
|
46720
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect5 :
|
|
46797
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect5 : useEffect20;
|
|
46721
46798
|
function StickToBottom({ instance, children, resize, initial, mass, damping, stiffness, targetScrollTop: currentTargetScrollTop, contextRef, ...props }) {
|
|
46722
|
-
const customTargetScrollTop =
|
|
46799
|
+
const customTargetScrollTop = useRef22(null);
|
|
46723
46800
|
const targetScrollTop = React.useCallback((target, elements) => {
|
|
46724
46801
|
const get = context?.targetScrollTop ?? currentTargetScrollTop;
|
|
46725
46802
|
return get?.(target, elements) ?? target;
|
|
@@ -46798,23 +46875,23 @@ function useStickToBottomContext() {
|
|
|
46798
46875
|
import { getServerTime } from "@blade-hq/agent-client/internal";
|
|
46799
46876
|
|
|
46800
46877
|
// src/components/MessageImage.tsx
|
|
46801
|
-
import { forwardRef as forwardRef3, useEffect as
|
|
46802
|
-
import { jsx as
|
|
46878
|
+
import { forwardRef as forwardRef3, useEffect as useEffect21, useImperativeHandle as useImperativeHandle2, useRef as useRef23, useState as useState28 } from "react";
|
|
46879
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
46803
46880
|
var assetPattern = /^\/api\/(sessions|share)\/([^/]+)\/media\/([a-f0-9]{64})$/;
|
|
46804
46881
|
var MessageImage = forwardRef3(function MessageImage2({ client: suppliedClient, src, original = false, alt, style, ...props }, ref) {
|
|
46805
46882
|
const contextClient = useOptionalBladeClient();
|
|
46806
46883
|
const client = suppliedClient ?? contextClient;
|
|
46807
|
-
const element2 =
|
|
46884
|
+
const element2 = useRef23(null);
|
|
46808
46885
|
useImperativeHandle2(ref, () => element2.current);
|
|
46809
|
-
const [visible, setVisible] =
|
|
46810
|
-
const [result, setResult] =
|
|
46886
|
+
const [visible, setVisible] = useState28(false);
|
|
46887
|
+
const [result, setResult] = useState28(null);
|
|
46811
46888
|
const match = src?.match(assetPattern);
|
|
46812
46889
|
const scope = match?.[1];
|
|
46813
46890
|
const sessionId = match?.[2];
|
|
46814
46891
|
const assetId = match?.[3];
|
|
46815
46892
|
const identity2 = assetId && client ? client.buildAuthedUrl(src) : "";
|
|
46816
46893
|
const source = `${src}:${original}:${identity2}`;
|
|
46817
|
-
|
|
46894
|
+
useEffect21(() => {
|
|
46818
46895
|
const node3 = element2.current;
|
|
46819
46896
|
if (!node3 || !assetId) return;
|
|
46820
46897
|
if (original || typeof IntersectionObserver === "undefined") {
|
|
@@ -46830,7 +46907,7 @@ var MessageImage = forwardRef3(function MessageImage2({ client: suppliedClient,
|
|
|
46830
46907
|
observer.observe(node3);
|
|
46831
46908
|
return () => observer.disconnect();
|
|
46832
46909
|
}, [assetId, original]);
|
|
46833
|
-
|
|
46910
|
+
useEffect21(() => {
|
|
46834
46911
|
if (!visible || !client || !sessionId || !assetId) return;
|
|
46835
46912
|
let alive = true;
|
|
46836
46913
|
let objectUrl = null;
|
|
@@ -46849,7 +46926,7 @@ var MessageImage = forwardRef3(function MessageImage2({ client: suppliedClient,
|
|
|
46849
46926
|
}, [visible, client, scope, sessionId, assetId, original, source]);
|
|
46850
46927
|
const current = result?.source === source && result.client === client ? result : null;
|
|
46851
46928
|
const imageStyle = { aspectRatio: props.width && props.height ? `${props.width}/${props.height}` : void 0, ...style };
|
|
46852
|
-
return /* @__PURE__ */
|
|
46929
|
+
return /* @__PURE__ */ jsx17(
|
|
46853
46930
|
"img",
|
|
46854
46931
|
{
|
|
46855
46932
|
...props,
|
|
@@ -46870,11 +46947,11 @@ import {
|
|
|
46870
46947
|
getTextContent as getTextContent2,
|
|
46871
46948
|
normalizeMessageContent as normalizeMessageContent2
|
|
46872
46949
|
} from "@blade-hq/agent-client";
|
|
46873
|
-
import { useEffect as
|
|
46950
|
+
import { useEffect as useEffect25, useRef as useRef27, useState as useState33 } from "react";
|
|
46874
46951
|
|
|
46875
46952
|
// src/components/AgentTaskCard.tsx
|
|
46876
|
-
import { useEffect as
|
|
46877
|
-
import { jsx as
|
|
46953
|
+
import { useEffect as useEffect22, useState as useState29 } from "react";
|
|
46954
|
+
import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
46878
46955
|
var STATUS_LABELS = {
|
|
46879
46956
|
running: "\u8FDB\u884C\u4E2D",
|
|
46880
46957
|
waiting_input: "\u7B49\u5F85\u56DE\u7B54",
|
|
@@ -46884,8 +46961,8 @@ var STATUS_LABELS = {
|
|
|
46884
46961
|
};
|
|
46885
46962
|
function AgentTaskCard({ title, status, activity, children, className, recordId }) {
|
|
46886
46963
|
const waiting = status === "waiting_input";
|
|
46887
|
-
const [open2, setOpen] =
|
|
46888
|
-
|
|
46964
|
+
const [open2, setOpen] = useState29(waiting);
|
|
46965
|
+
useEffect22(() => {
|
|
46889
46966
|
if (waiting) setOpen(true);
|
|
46890
46967
|
}, [waiting]);
|
|
46891
46968
|
return /* @__PURE__ */ jsxs14(
|
|
@@ -46903,28 +46980,28 @@ function AgentTaskCard({ title, status, activity, children, className, recordId
|
|
|
46903
46980
|
),
|
|
46904
46981
|
children: [
|
|
46905
46982
|
/* @__PURE__ */ jsxs14("summary", { className: "flex cursor-pointer list-none items-start gap-2.5 rounded-xl px-3 py-3 text-left outline-none focus-visible:ring-2 focus-visible:ring-[hsl(var(--ring))] [&::-webkit-details-marker]:hidden", children: [
|
|
46906
|
-
waiting ? /* @__PURE__ */
|
|
46983
|
+
waiting ? /* @__PURE__ */ jsx18(CircleHelp, { size: 18, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-amber-600 motion-safe:animate-pulse" }) : /* @__PURE__ */ jsx18(Bot, { size: 18, "aria-hidden": "true", className: "mt-0.5 shrink-0 text-[hsl(var(--primary))]" }),
|
|
46907
46984
|
/* @__PURE__ */ jsxs14("span", { className: "min-w-0 flex-1", children: [
|
|
46908
46985
|
/* @__PURE__ */ jsxs14("span", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
46909
|
-
/* @__PURE__ */
|
|
46986
|
+
/* @__PURE__ */ jsx18("span", { children: "\u5B50\u667A\u80FD\u4F53" }),
|
|
46910
46987
|
/* @__PURE__ */ jsxs14("span", { className: cn("inline-flex items-center gap-1", waiting && "font-semibold text-amber-600"), children: [
|
|
46911
|
-
status === "running" ? /* @__PURE__ */
|
|
46988
|
+
status === "running" ? /* @__PURE__ */ jsx18(LoaderCircle, { size: 12, "aria-hidden": "true", className: "motion-safe:animate-spin" }) : null,
|
|
46912
46989
|
STATUS_LABELS[status]
|
|
46913
46990
|
] })
|
|
46914
46991
|
] }),
|
|
46915
|
-
/* @__PURE__ */
|
|
46916
|
-
activity ? /* @__PURE__ */
|
|
46992
|
+
/* @__PURE__ */ jsx18("span", { className: "mt-1 block break-words text-sm font-medium text-[hsl(var(--foreground))]", children: title }),
|
|
46993
|
+
activity ? /* @__PURE__ */ jsx18("span", { className: "mt-1 block truncate text-xs text-[hsl(var(--muted-foreground))]", title: activity, children: activity }) : null
|
|
46917
46994
|
] }),
|
|
46918
|
-
/* @__PURE__ */
|
|
46995
|
+
/* @__PURE__ */ jsx18(ChevronRight, { size: 15, "aria-hidden": "true", className: cn("mt-1 shrink-0 text-[hsl(var(--muted-foreground))] transition-transform motion-reduce:transition-none", open2 && "rotate-90") })
|
|
46919
46996
|
] }),
|
|
46920
|
-
/* @__PURE__ */
|
|
46997
|
+
/* @__PURE__ */ jsx18("div", { className: "min-w-0 border-t border-[hsl(var(--border))] px-3 py-2", children })
|
|
46921
46998
|
]
|
|
46922
46999
|
}
|
|
46923
47000
|
);
|
|
46924
47001
|
}
|
|
46925
47002
|
|
|
46926
47003
|
// src/components/AgentLoopBlock.tsx
|
|
46927
|
-
import { jsx as
|
|
47004
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
46928
47005
|
function parseAgentDescription(argumentsJson) {
|
|
46929
47006
|
try {
|
|
46930
47007
|
const parsed = JSON.parse(argumentsJson);
|
|
@@ -46935,14 +47012,14 @@ function parseAgentDescription(argumentsJson) {
|
|
|
46935
47012
|
}
|
|
46936
47013
|
function AgentLoopBlock({ toolCall, className }) {
|
|
46937
47014
|
const status = toolCall.status === "awaiting_answer" ? "waiting_input" : toolCall.status === "pending" ? "running" : toolCall.status === "error" ? "failed" : toolCall.status === "cancelled" ? "cancelled" : "completed";
|
|
46938
|
-
return /* @__PURE__ */
|
|
47015
|
+
return /* @__PURE__ */ jsx19(AgentTaskCard, { title: parseAgentDescription(toolCall.arguments), status, className, children: toolCall.result != null ? /* @__PURE__ */ jsx19("div", { className: "max-h-[400px] overflow-auto whitespace-pre-wrap break-words text-xs text-[hsl(var(--muted-foreground))]", children: formatToolResult(toolCall.result) }) : /* @__PURE__ */ jsx19("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: status === "waiting_input" ? "\u8BF7\u56DE\u7B54\u5BF9\u8BDD\u4E2D\u7684\u95EE\u9898\uFF0C\u5B50\u667A\u80FD\u4F53\u4F1A\u7EE7\u7EED\u5904\u7406\u3002" : status === "running" ? "\u5B50\u667A\u80FD\u4F53\u6B63\u5728\u5904\u7406\u4EFB\u52A1\u3002" : "\u6682\u65E0\u6267\u884C\u7ED3\u679C\u3002" }) });
|
|
46939
47016
|
}
|
|
46940
47017
|
|
|
46941
47018
|
// src/components/MarkdownContent.tsx
|
|
46942
|
-
import { isValidElement as isValidElement2, useMemo as useMemo14, useRef as
|
|
47019
|
+
import { isValidElement as isValidElement2, useMemo as useMemo14, useRef as useRef25, useState as useState30 } from "react";
|
|
46943
47020
|
|
|
46944
47021
|
// src/components/markdown/index.ts
|
|
46945
|
-
import { createElement as createElement7, useRef as
|
|
47022
|
+
import { createElement as createElement7, useRef as useRef24 } from "react";
|
|
46946
47023
|
|
|
46947
47024
|
// ../../node_modules/.pnpm/mdast-util-to-string@4.0.0/node_modules/mdast-util-to-string/lib/index.js
|
|
46948
47025
|
var emptyOptions = {};
|
|
@@ -55820,10 +55897,10 @@ function MarkdownRenderer({
|
|
|
55820
55897
|
codeBlockOverrides
|
|
55821
55898
|
}) {
|
|
55822
55899
|
const isStreaming = mode === "streaming";
|
|
55823
|
-
const cacheRef =
|
|
55824
|
-
const blockCacheRef =
|
|
55825
|
-
const groupIdentityMapRef =
|
|
55826
|
-
const rendererConfigRef =
|
|
55900
|
+
const cacheRef = useRef24(createParseCache());
|
|
55901
|
+
const blockCacheRef = useRef24(/* @__PURE__ */ new WeakMap());
|
|
55902
|
+
const groupIdentityMapRef = useRef24(/* @__PURE__ */ new WeakMap());
|
|
55903
|
+
const rendererConfigRef = useRef24(null);
|
|
55827
55904
|
const previousConfig = rendererConfigRef.current;
|
|
55828
55905
|
if (!previousConfig || previousConfig.allowedTags !== allowedTags || previousConfig.components !== components || previousConfig.rawHtmlPlugins !== rawHtmlPlugins || previousConfig.codeBlockOverrides !== codeBlockOverrides) {
|
|
55829
55906
|
blockCacheRef.current = /* @__PURE__ */ new WeakMap();
|
|
@@ -55864,7 +55941,7 @@ function MarkdownRenderer({
|
|
|
55864
55941
|
}
|
|
55865
55942
|
|
|
55866
55943
|
// src/components/MarkdownContent.tsx
|
|
55867
|
-
import { jsx as
|
|
55944
|
+
import { jsx as jsx20, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
55868
55945
|
var SYSTEM_REMINDER_RE = /<system-reminder>[\s\S]*?<\/system-reminder>/gi;
|
|
55869
55946
|
var INCOMPLETE_SYSTEM_REMINDER_RE = /<system-reminder>[\s\S]*$/i;
|
|
55870
55947
|
function findCodeRanges(text4) {
|
|
@@ -55908,8 +55985,8 @@ function normalizeAdjacentUrlFormatting(value) {
|
|
|
55908
55985
|
return normalized.replace(/blade-url-protected-(\d+)-marker/g, (_2, index3) => protectedSegments[Number(index3)]);
|
|
55909
55986
|
}
|
|
55910
55987
|
function CodeBlockPre({ children, ...props }) {
|
|
55911
|
-
const preRef =
|
|
55912
|
-
const [copied, setCopied] =
|
|
55988
|
+
const preRef = useRef25(null);
|
|
55989
|
+
const [copied, setCopied] = useState30(false);
|
|
55913
55990
|
const codeChild = Array.isArray(children) ? children[0] : children;
|
|
55914
55991
|
const codeClassName = isValidElement2(codeChild) ? codeChild.props.className : void 0;
|
|
55915
55992
|
const language = codeClassName?.match(/language-(\S+)/)?.[1] ?? "";
|
|
@@ -55922,7 +55999,7 @@ function CodeBlockPre({ children, ...props }) {
|
|
|
55922
55999
|
};
|
|
55923
56000
|
return /* @__PURE__ */ jsxs15("div", { className: "blade-chat-codeblock not-prose my-3 overflow-hidden rounded-xl border border-[hsl(var(--border))]", children: [
|
|
55924
56001
|
/* @__PURE__ */ jsxs15("div", { className: "blade-chat-codeblock-header flex h-[34px] items-center justify-between border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))/0.5] pl-3.5 pr-1.5", children: [
|
|
55925
|
-
/* @__PURE__ */
|
|
56002
|
+
/* @__PURE__ */ jsx20("span", { className: "font-mono text-[12px] text-[hsl(var(--muted-foreground))]", children: language || "code" }),
|
|
55926
56003
|
/* @__PURE__ */ jsxs15(
|
|
55927
56004
|
"button",
|
|
55928
56005
|
{
|
|
@@ -55933,13 +56010,13 @@ function CodeBlockPre({ children, ...props }) {
|
|
|
55933
56010
|
copied ? "text-[hsl(var(--primary))]" : "text-[hsl(var(--muted-foreground))] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]"
|
|
55934
56011
|
),
|
|
55935
56012
|
children: [
|
|
55936
|
-
copied ? /* @__PURE__ */
|
|
55937
|
-
/* @__PURE__ */
|
|
56013
|
+
copied ? /* @__PURE__ */ jsx20(Check, { size: 12 }) : /* @__PURE__ */ jsx20(Copy, { size: 12 }),
|
|
56014
|
+
/* @__PURE__ */ jsx20("span", { children: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236" })
|
|
55938
56015
|
]
|
|
55939
56016
|
}
|
|
55940
56017
|
)
|
|
55941
56018
|
] }),
|
|
55942
|
-
/* @__PURE__ */
|
|
56019
|
+
/* @__PURE__ */ jsx20(
|
|
55943
56020
|
"pre",
|
|
55944
56021
|
{
|
|
55945
56022
|
ref: preRef,
|
|
@@ -55952,9 +56029,9 @@ function CodeBlockPre({ children, ...props }) {
|
|
|
55952
56029
|
}
|
|
55953
56030
|
function ExternalAnchor({ children, href, ...props }) {
|
|
55954
56031
|
if (typeof href === "string" && href.startsWith("#")) {
|
|
55955
|
-
return /* @__PURE__ */
|
|
56032
|
+
return /* @__PURE__ */ jsx20("a", { ...props, href, children });
|
|
55956
56033
|
}
|
|
55957
|
-
return /* @__PURE__ */
|
|
56034
|
+
return /* @__PURE__ */ jsx20("a", { ...props, href, target: "_blank", rel: "noopener noreferrer", children });
|
|
55958
56035
|
}
|
|
55959
56036
|
var MARKDOWN_COMPONENTS = {
|
|
55960
56037
|
pre: CodeBlockPre,
|
|
@@ -55964,7 +56041,7 @@ function MarkdownContent({ children, className, mode, sessionId }) {
|
|
|
55964
56041
|
const resolvedChildren = useMemo14(() => {
|
|
55965
56042
|
return normalizeAdjacentUrlFormatting(stripSystemReminders(children));
|
|
55966
56043
|
}, [children]);
|
|
55967
|
-
return /* @__PURE__ */
|
|
56044
|
+
return /* @__PURE__ */ jsx20(
|
|
55968
56045
|
MarkdownRenderer,
|
|
55969
56046
|
{
|
|
55970
56047
|
className: cn("blade-chat-markdown break-words", className),
|
|
@@ -55978,14 +56055,14 @@ function MarkdownContent({ children, className, mode, sessionId }) {
|
|
|
55978
56055
|
}
|
|
55979
56056
|
|
|
55980
56057
|
// src/components/Shimmer.tsx
|
|
55981
|
-
import { jsx as
|
|
56058
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
55982
56059
|
function Shimmer({ children = "\u6B63\u5728\u601D\u8003...", className }) {
|
|
55983
|
-
return /* @__PURE__ */
|
|
56060
|
+
return /* @__PURE__ */ jsx21("span", { className: cn("blade-shimmer-text text-sm font-medium", className), children });
|
|
55984
56061
|
}
|
|
55985
56062
|
|
|
55986
56063
|
// src/components/AskUserQuestionBlock.tsx
|
|
55987
|
-
import { useEffect as
|
|
55988
|
-
import { jsx as
|
|
56064
|
+
import { useEffect as useEffect23, useMemo as useMemo15, useRef as useRef26, useState as useState31 } from "react";
|
|
56065
|
+
import { jsx as jsx22, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
55989
56066
|
var CUSTOM_TEXTAREA_MAX_HEIGHT = 160;
|
|
55990
56067
|
function resizeCustomTextarea(textarea) {
|
|
55991
56068
|
textarea.style.height = "auto";
|
|
@@ -55993,12 +56070,12 @@ function resizeCustomTextarea(textarea) {
|
|
|
55993
56070
|
textarea.style.overflowY = textarea.scrollHeight > CUSTOM_TEXTAREA_MAX_HEIGHT ? "auto" : "hidden";
|
|
55994
56071
|
}
|
|
55995
56072
|
function useAutoResizeTextarea(value) {
|
|
55996
|
-
const textareaRef =
|
|
55997
|
-
|
|
56073
|
+
const textareaRef = useRef26(null);
|
|
56074
|
+
useEffect23(() => {
|
|
55998
56075
|
const textarea = textareaRef.current;
|
|
55999
56076
|
if (textarea?.value === value) resizeCustomTextarea(textarea);
|
|
56000
56077
|
}, [value]);
|
|
56001
|
-
|
|
56078
|
+
useEffect23(() => {
|
|
56002
56079
|
const textarea = textareaRef.current;
|
|
56003
56080
|
if (!textarea || typeof ResizeObserver === "undefined") return;
|
|
56004
56081
|
let previousWidth = textarea.clientWidth;
|
|
@@ -56025,12 +56102,12 @@ function AskUserQuestionBlock({
|
|
|
56025
56102
|
className,
|
|
56026
56103
|
optionClassName
|
|
56027
56104
|
}) {
|
|
56028
|
-
const [selections, setSelections] =
|
|
56029
|
-
const [customTexts, setCustomTexts] =
|
|
56030
|
-
const [usingCustom, setUsingCustom] =
|
|
56031
|
-
const [note, setNote] =
|
|
56032
|
-
const [submitted, setSubmitted] =
|
|
56033
|
-
|
|
56105
|
+
const [selections, setSelections] = useState31(/* @__PURE__ */ new Map());
|
|
56106
|
+
const [customTexts, setCustomTexts] = useState31(/* @__PURE__ */ new Map());
|
|
56107
|
+
const [usingCustom, setUsingCustom] = useState31(/* @__PURE__ */ new Set());
|
|
56108
|
+
const [note, setNote] = useState31("");
|
|
56109
|
+
const [submitted, setSubmitted] = useState31(false);
|
|
56110
|
+
useEffect23(() => {
|
|
56034
56111
|
if (sessionStatus === "failed" || sessionStatus === "interrupted") {
|
|
56035
56112
|
setSubmitted(false);
|
|
56036
56113
|
}
|
|
@@ -56143,7 +56220,7 @@ ${parts.join("\n")}`,
|
|
|
56143
56220
|
data.source_loop.description,
|
|
56144
56221
|
"\u300D\u5728\u7B49\u5F85\u4F60\u7684\u56DE\u7B54"
|
|
56145
56222
|
] }),
|
|
56146
|
-
data.questions.map((q2, qIdx) => /* @__PURE__ */
|
|
56223
|
+
data.questions.map((q2, qIdx) => /* @__PURE__ */ jsx22(
|
|
56147
56224
|
QuestionCard,
|
|
56148
56225
|
{
|
|
56149
56226
|
question: q2,
|
|
@@ -56159,7 +56236,7 @@ ${parts.join("\n")}`,
|
|
|
56159
56236
|
},
|
|
56160
56237
|
q2.question
|
|
56161
56238
|
)),
|
|
56162
|
-
/* @__PURE__ */
|
|
56239
|
+
/* @__PURE__ */ jsx22(
|
|
56163
56240
|
NoteField,
|
|
56164
56241
|
{
|
|
56165
56242
|
answered,
|
|
@@ -56168,7 +56245,7 @@ ${parts.join("\n")}`,
|
|
|
56168
56245
|
onChange: setNote
|
|
56169
56246
|
}
|
|
56170
56247
|
),
|
|
56171
|
-
!answered && !submitted && onAnswer && /* @__PURE__ */
|
|
56248
|
+
!answered && !submitted && onAnswer && /* @__PURE__ */ jsx22(
|
|
56172
56249
|
"button",
|
|
56173
56250
|
{
|
|
56174
56251
|
type: "button",
|
|
@@ -56185,7 +56262,7 @@ ${parts.join("\n")}`,
|
|
|
56185
56262
|
disabled: true,
|
|
56186
56263
|
className: "flex w-full items-center justify-center gap-2 rounded-lg bg-[hsl(var(--primary))] px-4 py-2 text-xs font-semibold text-[hsl(var(--primary-foreground))] opacity-80",
|
|
56187
56264
|
children: [
|
|
56188
|
-
/* @__PURE__ */
|
|
56265
|
+
/* @__PURE__ */ jsx22(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
56189
56266
|
"\u786E\u8BA4\u4E2D"
|
|
56190
56267
|
]
|
|
56191
56268
|
}
|
|
@@ -56210,21 +56287,21 @@ function QuestionCard({
|
|
|
56210
56287
|
const customTextareaRef = useAutoResizeTextarea(customText);
|
|
56211
56288
|
return /* @__PURE__ */ jsxs16("div", { children: [
|
|
56212
56289
|
/* @__PURE__ */ jsxs16("div", { className: cn("flex items-start gap-2", answered ? "mb-2" : "mb-3"), children: [
|
|
56213
|
-
/* @__PURE__ */
|
|
56290
|
+
/* @__PURE__ */ jsx22(
|
|
56214
56291
|
MessageSquareMore,
|
|
56215
56292
|
{
|
|
56216
56293
|
size: answered ? 12 : 13,
|
|
56217
56294
|
className: "mt-0.5 shrink-0 text-[hsl(var(--primary))]"
|
|
56218
56295
|
}
|
|
56219
56296
|
),
|
|
56220
|
-
/* @__PURE__ */
|
|
56297
|
+
/* @__PURE__ */ jsx22(
|
|
56221
56298
|
"div",
|
|
56222
56299
|
{
|
|
56223
56300
|
className: cn(
|
|
56224
56301
|
"min-w-0 flex-1 font-medium text-[hsl(var(--foreground))]",
|
|
56225
56302
|
answered ? "text-xs" : "text-sm"
|
|
56226
56303
|
),
|
|
56227
|
-
children: /* @__PURE__ */
|
|
56304
|
+
children: /* @__PURE__ */ jsx22(MarkdownContent, { className: "blade-chat-prose", children: question.question })
|
|
56228
56305
|
}
|
|
56229
56306
|
)
|
|
56230
56307
|
] }),
|
|
@@ -56247,14 +56324,14 @@ function QuestionCard({
|
|
|
56247
56324
|
optionClassName
|
|
56248
56325
|
),
|
|
56249
56326
|
children: [
|
|
56250
|
-
multi && /* @__PURE__ */
|
|
56327
|
+
multi && /* @__PURE__ */ jsx22(
|
|
56251
56328
|
"div",
|
|
56252
56329
|
{
|
|
56253
56330
|
className: cn(
|
|
56254
56331
|
"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",
|
|
56255
56332
|
isSel && !answered ? "border-[hsl(var(--primary-foreground)/0.6)] bg-[hsl(var(--primary-foreground)/0.2)]" : isSel ? "border-[hsl(var(--primary)/0.45)] bg-[hsl(var(--primary)/0.12)]" : "border-[hsl(var(--border))]"
|
|
56256
56333
|
),
|
|
56257
|
-
children: isSel && /* @__PURE__ */
|
|
56334
|
+
children: isSel && /* @__PURE__ */ jsx22(
|
|
56258
56335
|
Check,
|
|
56259
56336
|
{
|
|
56260
56337
|
size: 9,
|
|
@@ -56264,8 +56341,8 @@ function QuestionCard({
|
|
|
56264
56341
|
}
|
|
56265
56342
|
),
|
|
56266
56343
|
/* @__PURE__ */ jsxs16("div", { className: "min-w-0", children: [
|
|
56267
|
-
/* @__PURE__ */
|
|
56268
|
-
opt.description && /* @__PURE__ */
|
|
56344
|
+
/* @__PURE__ */ jsx22("div", { className: cn("font-medium", answered ? "text-xs" : "text-[13px]"), children: opt.label }),
|
|
56345
|
+
opt.description && /* @__PURE__ */ jsx22(
|
|
56269
56346
|
"div",
|
|
56270
56347
|
{
|
|
56271
56348
|
className: cn(
|
|
@@ -56292,8 +56369,8 @@ function QuestionCard({
|
|
|
56292
56369
|
answered && "cursor-default opacity-70"
|
|
56293
56370
|
),
|
|
56294
56371
|
children: [
|
|
56295
|
-
/* @__PURE__ */
|
|
56296
|
-
/* @__PURE__ */
|
|
56372
|
+
/* @__PURE__ */ jsx22("span", { className: "shrink-0 pt-1 text-xs text-[hsl(var(--muted-foreground))]", children: "\u5176\u4ED6\uFF1A" }),
|
|
56373
|
+
/* @__PURE__ */ jsx22(
|
|
56297
56374
|
"textarea",
|
|
56298
56375
|
{
|
|
56299
56376
|
ref: customTextareaRef,
|
|
@@ -56335,8 +56412,8 @@ function NoteField({
|
|
|
56335
56412
|
readOnly && "cursor-default opacity-70"
|
|
56336
56413
|
),
|
|
56337
56414
|
children: [
|
|
56338
|
-
/* @__PURE__ */
|
|
56339
|
-
/* @__PURE__ */
|
|
56415
|
+
/* @__PURE__ */ jsx22("span", { className: "mb-1.5 block text-xs text-[hsl(var(--muted-foreground))]", children: "\u8865\u5145\u8BF4\u660E\uFF08\u53EF\u9009\uFF09" }),
|
|
56416
|
+
/* @__PURE__ */ jsx22(
|
|
56340
56417
|
"textarea",
|
|
56341
56418
|
{
|
|
56342
56419
|
ref: textareaRef,
|
|
@@ -56425,7 +56502,7 @@ function normalizeOptionItem(value) {
|
|
|
56425
56502
|
}
|
|
56426
56503
|
|
|
56427
56504
|
// src/components/ToolCallBlock.tsx
|
|
56428
|
-
import { Fragment as Fragment7, jsx as
|
|
56505
|
+
import { Fragment as Fragment7, jsx as jsx23, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
56429
56506
|
function resolveAskQuestionState({
|
|
56430
56507
|
toolStatus,
|
|
56431
56508
|
hasAnswerData,
|
|
@@ -56452,7 +56529,7 @@ function ToolCallBlock({
|
|
|
56452
56529
|
const customQuestion = normalizedName === "AskUserQuestion" ? renderers?.askUserQuestion : void 0;
|
|
56453
56530
|
const customToolCall = normalizedName === "AskUserQuestion" && customQuestion ? null : renderers?.toolCall?.(toolCall);
|
|
56454
56531
|
if (customToolCall !== null && customToolCall !== void 0) {
|
|
56455
|
-
return /* @__PURE__ */
|
|
56532
|
+
return /* @__PURE__ */ jsx23(Fragment7, { children: customToolCall });
|
|
56456
56533
|
}
|
|
56457
56534
|
if (normalizedName === "AskUserQuestion") {
|
|
56458
56535
|
const askData = parseAskUserQuestion(typeof toolCall.result === "string" ? toolCall.result : null) ?? parseAskUserQuestion(buildAskUserPayload(toolCall.arguments));
|
|
@@ -56474,9 +56551,9 @@ function ToolCallBlock({
|
|
|
56474
56551
|
};
|
|
56475
56552
|
const customAsk = customQuestion?.(answerProps);
|
|
56476
56553
|
if (customAsk !== null && customAsk !== void 0) {
|
|
56477
|
-
return /* @__PURE__ */
|
|
56554
|
+
return /* @__PURE__ */ jsx23(Fragment7, { children: customAsk });
|
|
56478
56555
|
}
|
|
56479
|
-
return /* @__PURE__ */
|
|
56556
|
+
return /* @__PURE__ */ jsx23(
|
|
56480
56557
|
AskUserQuestionBlock,
|
|
56481
56558
|
{
|
|
56482
56559
|
...answerProps,
|
|
@@ -56495,8 +56572,8 @@ function ToolCallBlock({
|
|
|
56495
56572
|
classNames?.askCard
|
|
56496
56573
|
),
|
|
56497
56574
|
children: [
|
|
56498
|
-
/* @__PURE__ */
|
|
56499
|
-
/* @__PURE__ */
|
|
56575
|
+
/* @__PURE__ */ jsx23(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
56576
|
+
/* @__PURE__ */ jsx23("span", { children: "\u6B63\u5728\u51C6\u5907\u95EE\u9898\u2026" })
|
|
56500
56577
|
]
|
|
56501
56578
|
}
|
|
56502
56579
|
);
|
|
@@ -56513,11 +56590,11 @@ function ToolCallBlock({
|
|
|
56513
56590
|
classNames?.askCard
|
|
56514
56591
|
),
|
|
56515
56592
|
children: [
|
|
56516
|
-
/* @__PURE__ */
|
|
56517
|
-
/* @__PURE__ */
|
|
56593
|
+
/* @__PURE__ */ jsx23("div", { className: "font-semibold", children: "\u9009\u62E9\u9898\u5185\u5BB9\u6682\u65F6\u65E0\u6CD5\u663E\u793A" }),
|
|
56594
|
+
/* @__PURE__ */ jsx23("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: errorDetail?.message ?? "\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002" }),
|
|
56518
56595
|
errorDetail?.detail ? /* @__PURE__ */ jsxs17("details", { className: "mt-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
56519
|
-
/* @__PURE__ */
|
|
56520
|
-
/* @__PURE__ */
|
|
56596
|
+
/* @__PURE__ */ jsx23("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u5177\u4F53\u539F\u56E0" }),
|
|
56597
|
+
/* @__PURE__ */ jsx23("div", { className: "mt-1 break-words font-mono", children: errorDetail.detail })
|
|
56521
56598
|
] }) : null
|
|
56522
56599
|
]
|
|
56523
56600
|
}
|
|
@@ -56538,17 +56615,17 @@ function buildAskUserPayload(argumentsJson) {
|
|
|
56538
56615
|
|
|
56539
56616
|
// src/components/ToolUiCardView.tsx
|
|
56540
56617
|
import { resolveToolUiCardContent } from "@blade-hq/agent-client";
|
|
56541
|
-
import { useEffect as
|
|
56542
|
-
import { jsx as
|
|
56618
|
+
import { useEffect as useEffect24, useState as useState32 } from "react";
|
|
56619
|
+
import { jsx as jsx24, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
56543
56620
|
function ToolUiCardView({ card, sessionId }) {
|
|
56544
|
-
if (card.mcpApp) return sessionId ? /* @__PURE__ */
|
|
56621
|
+
if (card.mcpApp) return sessionId ? /* @__PURE__ */ jsx24(McpAppCard, { sessionId, sourceId: card.mcpApp.sourceId }) : null;
|
|
56545
56622
|
const resolved = resolveToolUiCardContent(card);
|
|
56546
56623
|
if (!resolved) return null;
|
|
56547
56624
|
if (resolved.type === "resource-file") {
|
|
56548
|
-
return sessionId ? /* @__PURE__ */
|
|
56625
|
+
return sessionId ? /* @__PURE__ */ jsx24(FileCard, { card, sessionId, path: resolved.content }, `${sessionId}:${resolved.content}`) : null;
|
|
56549
56626
|
}
|
|
56550
56627
|
const sandbox = resolved.type === "resource-uri" ? "allow-scripts allow-same-origin" : "allow-scripts";
|
|
56551
|
-
return /* @__PURE__ */
|
|
56628
|
+
return /* @__PURE__ */ jsx24(
|
|
56552
56629
|
"iframe",
|
|
56553
56630
|
{
|
|
56554
56631
|
title: card.title ?? "\u5DE5\u5177\u754C\u9762",
|
|
@@ -56565,10 +56642,10 @@ function ToolUiCardView({ card, sessionId }) {
|
|
|
56565
56642
|
}
|
|
56566
56643
|
function FileCard({ card, sessionId, path: path2 }) {
|
|
56567
56644
|
const client = useBladeClient();
|
|
56568
|
-
const [html, setHtml] =
|
|
56569
|
-
const [failed, setFailed] =
|
|
56570
|
-
const [refreshVersion, setRefreshVersion] =
|
|
56571
|
-
|
|
56645
|
+
const [html, setHtml] = useState32(null);
|
|
56646
|
+
const [failed, setFailed] = useState32(false);
|
|
56647
|
+
const [refreshVersion, setRefreshVersion] = useState32(0);
|
|
56648
|
+
useEffect24(() => {
|
|
56572
56649
|
const abort = new AbortController();
|
|
56573
56650
|
setHtml(null);
|
|
56574
56651
|
setFailed(false);
|
|
@@ -56588,7 +56665,7 @@ function FileCard({ card, sessionId, path: path2 }) {
|
|
|
56588
56665
|
`${client.options.baseUrl.replace(/\/$/, "")}/`
|
|
56589
56666
|
).href;
|
|
56590
56667
|
return /* @__PURE__ */ jsxs18("div", { children: [
|
|
56591
|
-
/* @__PURE__ */
|
|
56668
|
+
/* @__PURE__ */ jsx24("div", { className: "flex justify-end py-2", children: /* @__PURE__ */ jsx24(
|
|
56592
56669
|
"button",
|
|
56593
56670
|
{
|
|
56594
56671
|
type: "button",
|
|
@@ -56598,7 +56675,7 @@ function FileCard({ card, sessionId, path: path2 }) {
|
|
|
56598
56675
|
children: "\u5237\u65B0"
|
|
56599
56676
|
}
|
|
56600
56677
|
) }),
|
|
56601
|
-
failed ? /* @__PURE__ */
|
|
56678
|
+
failed ? /* @__PURE__ */ jsx24("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__ */ jsx24("p", { children: "\u6B63\u5728\u6253\u5F00\u6587\u4EF6\u2026" }) : /* @__PURE__ */ jsx24(
|
|
56602
56679
|
"iframe",
|
|
56603
56680
|
{
|
|
56604
56681
|
title: card.title ?? "\u6587\u4EF6\u9884\u89C8",
|
|
@@ -56628,13 +56705,13 @@ ${html}`;
|
|
|
56628
56705
|
}
|
|
56629
56706
|
|
|
56630
56707
|
// src/components/AssistantTurnBlock.tsx
|
|
56631
|
-
import { jsx as
|
|
56708
|
+
import { jsx as jsx25, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
56632
56709
|
function ThinkingBlock({
|
|
56633
56710
|
reasoning,
|
|
56634
56711
|
isStreaming,
|
|
56635
56712
|
className
|
|
56636
56713
|
}) {
|
|
56637
|
-
const [open2, setOpen] =
|
|
56714
|
+
const [open2, setOpen] = useState33(false);
|
|
56638
56715
|
if (!isStreaming) return null;
|
|
56639
56716
|
return /* @__PURE__ */ jsxs19("div", { part: "thinking", className: cn("blade-chat-thinking ml-4 text-xs", className), children: [
|
|
56640
56717
|
/* @__PURE__ */ jsxs19(
|
|
@@ -56645,8 +56722,8 @@ function ThinkingBlock({
|
|
|
56645
56722
|
"aria-expanded": open2,
|
|
56646
56723
|
className: "group/thinking inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
56647
56724
|
children: [
|
|
56648
|
-
/* @__PURE__ */
|
|
56649
|
-
/* @__PURE__ */
|
|
56725
|
+
/* @__PURE__ */ jsx25(Shimmer, { className: "text-xs", children: "\u6B63\u5728\u601D\u8003" }),
|
|
56726
|
+
/* @__PURE__ */ jsx25(
|
|
56650
56727
|
ChevronRight,
|
|
56651
56728
|
{
|
|
56652
56729
|
size: 14,
|
|
@@ -56659,7 +56736,7 @@ function ThinkingBlock({
|
|
|
56659
56736
|
]
|
|
56660
56737
|
}
|
|
56661
56738
|
),
|
|
56662
|
-
open2 ? /* @__PURE__ */
|
|
56739
|
+
open2 ? /* @__PURE__ */ jsx25("div", { className: "mt-1.5 whitespace-pre-wrap text-xs leading-[22px] text-[hsl(var(--muted-foreground))]", children: reasoning }) : null
|
|
56663
56740
|
] });
|
|
56664
56741
|
}
|
|
56665
56742
|
function getMessageText(message) {
|
|
@@ -56853,7 +56930,7 @@ function ExecutionToolRow({
|
|
|
56853
56930
|
"size-3.5 shrink-0",
|
|
56854
56931
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
56855
56932
|
);
|
|
56856
|
-
const icon = toolCall.status === "pending" ? /* @__PURE__ */
|
|
56933
|
+
const icon = toolCall.status === "pending" ? /* @__PURE__ */ jsx25(LoaderCircle, { className: cn(iconClass, "animate-spin"), "aria-hidden": "true" }) : toolCall.status === "error" ? /* @__PURE__ */ jsx25(CircleAlert, { className: iconClass, "aria-hidden": "true" }) : toolCall.status === "cancelled" ? /* @__PURE__ */ jsx25(X, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "WebSearch" || normalizedName === "WebFetch" ? /* @__PURE__ */ jsx25(Earth, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Bash" || normalizedName === "BgBash" ? /* @__PURE__ */ jsx25(Terminal, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Write" || normalizedName === "Edit" || normalizedName === "MultiEdit" ? /* @__PURE__ */ jsx25(FilePenLine, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Read" || normalizedName === "ReadSkill" || normalizedName === "get_skill_content" ? /* @__PURE__ */ jsx25(BookOpen, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Grep" || normalizedName === "Glob" || normalizedName === "search_skills" ? /* @__PURE__ */ jsx25(Search, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Agent" ? /* @__PURE__ */ jsx25(Bot, { className: iconClass, "aria-hidden": "true" }) : /* @__PURE__ */ jsx25(Wrench, { className: iconClass, "aria-hidden": "true" });
|
|
56857
56934
|
const rowClassName = cn(
|
|
56858
56935
|
"flex min-w-0 items-center gap-1 min-h-7 text-xs leading-5",
|
|
56859
56936
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
@@ -56867,7 +56944,7 @@ function ExecutionToolRow({
|
|
|
56867
56944
|
title: label,
|
|
56868
56945
|
children: [
|
|
56869
56946
|
icon,
|
|
56870
|
-
/* @__PURE__ */
|
|
56947
|
+
/* @__PURE__ */ jsx25("span", { className: "min-w-0 truncate", children: label })
|
|
56871
56948
|
]
|
|
56872
56949
|
}
|
|
56873
56950
|
);
|
|
@@ -56916,12 +56993,12 @@ function AssistantTurnBlock({
|
|
|
56916
56993
|
)
|
|
56917
56994
|
);
|
|
56918
56995
|
const activeQuestionId = questionToolCalls.filter((toolCall) => toolCall.status === "pending").at(-1)?.id;
|
|
56919
|
-
const [displayMode, setDisplayMode] =
|
|
56996
|
+
const [displayMode, setDisplayMode] = useState33(
|
|
56920
56997
|
() => isStreaming || hasActionableToolCall ? "detail" : "compact"
|
|
56921
56998
|
);
|
|
56922
|
-
const userSelectedDisplayModeRef =
|
|
56923
|
-
const wasStreamingRef =
|
|
56924
|
-
|
|
56999
|
+
const userSelectedDisplayModeRef = useRef27(false);
|
|
57000
|
+
const wasStreamingRef = useRef27(isStreaming);
|
|
57001
|
+
useEffect25(() => {
|
|
56925
57002
|
if (wasStreamingRef.current && !isStreaming && !userSelectedDisplayModeRef.current) {
|
|
56926
57003
|
setDisplayMode(hasActionableToolCall ? "detail" : "compact");
|
|
56927
57004
|
}
|
|
@@ -56956,15 +57033,15 @@ function AssistantTurnBlock({
|
|
|
56956
57033
|
part: "assistant-turn",
|
|
56957
57034
|
className: cn("blade-chat-assistant-turn flex flex-col gap-3", classNames?.assistantTurn),
|
|
56958
57035
|
children: [
|
|
56959
|
-
memoryRefs.length > 0 ? /* @__PURE__ */
|
|
56960
|
-
hasInterrupted && /* @__PURE__ */
|
|
56961
|
-
hasFailedWithoutContent && /* @__PURE__ */
|
|
57036
|
+
memoryRefs.length > 0 ? /* @__PURE__ */ jsx25(MemoryRefsHint, { refs: memoryRefs, className: classNames?.memoryRefs }) : null,
|
|
57037
|
+
hasInterrupted && /* @__PURE__ */ jsx25("div", { className: "ml-4 w-fit rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }),
|
|
57038
|
+
hasFailedWithoutContent && /* @__PURE__ */ jsx25("div", { className: "ml-4 w-fit rounded-full border border-red-500/30 bg-red-500/10 px-2.5 py-1 text-[10px] font-medium text-red-400", children: "\u751F\u6210\u5931\u8D25" }),
|
|
56962
57039
|
messages.map((message, index3) => {
|
|
56963
|
-
return hasRenderableMessageContent(message) ? /* @__PURE__ */
|
|
57040
|
+
return hasRenderableMessageContent(message) ? /* @__PURE__ */ jsx25(
|
|
56964
57041
|
"div",
|
|
56965
57042
|
{
|
|
56966
57043
|
className: "flex flex-col gap-3",
|
|
56967
|
-
children: /* @__PURE__ */
|
|
57044
|
+
children: /* @__PURE__ */ jsx25(
|
|
56968
57045
|
AssistantMessageContent,
|
|
56969
57046
|
{
|
|
56970
57047
|
message,
|
|
@@ -56978,7 +57055,7 @@ function AssistantTurnBlock({
|
|
|
56978
57055
|
message.entry_id ?? `${message.timestamp ?? "assistant"}-${index3}`
|
|
56979
57056
|
) : null;
|
|
56980
57057
|
}),
|
|
56981
|
-
inlineToolUiCards.length > 0 ? /* @__PURE__ */
|
|
57058
|
+
inlineToolUiCards.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-3", children: inlineToolUiCards.map((entry) => /* @__PURE__ */ jsx25(ToolUiCardView, { card: entry.card, sessionId }, entry.key)) }) : null
|
|
56982
57059
|
]
|
|
56983
57060
|
}
|
|
56984
57061
|
);
|
|
@@ -56990,16 +57067,16 @@ function AssistantTurnBlock({
|
|
|
56990
57067
|
part: "assistant-turn",
|
|
56991
57068
|
className: cn("blade-chat-assistant-turn flex flex-col gap-3", classNames?.assistantTurn),
|
|
56992
57069
|
children: [
|
|
56993
|
-
memoryRefs.length > 0 ? /* @__PURE__ */
|
|
56994
|
-
hasInterrupted && /* @__PURE__ */
|
|
56995
|
-
hasFailedWithoutContent && /* @__PURE__ */
|
|
57070
|
+
memoryRefs.length > 0 ? /* @__PURE__ */ jsx25(MemoryRefsHint, { refs: memoryRefs, className: classNames?.memoryRefs }) : null,
|
|
57071
|
+
hasInterrupted && /* @__PURE__ */ jsx25("div", { className: "ml-4 w-fit rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }),
|
|
57072
|
+
hasFailedWithoutContent && /* @__PURE__ */ jsx25("div", { className: "ml-4 w-fit rounded-full border border-red-500/30 bg-red-500/10 px-2.5 py-1 text-[10px] font-medium text-red-400", children: "\u751F\u6210\u5931\u8D25" }),
|
|
56996
57073
|
/* @__PURE__ */ jsxs19("div", { className: "flex w-full items-start gap-2.5", children: [
|
|
56997
|
-
/* @__PURE__ */
|
|
57074
|
+
/* @__PURE__ */ jsx25(
|
|
56998
57075
|
"span",
|
|
56999
57076
|
{
|
|
57000
57077
|
className: "grid size-[30px] shrink-0 place-items-center rounded-full bg-[hsl(var(--muted)/0.55)] text-[hsl(var(--foreground))]",
|
|
57001
57078
|
"aria-hidden": "true",
|
|
57002
|
-
children: /* @__PURE__ */
|
|
57079
|
+
children: /* @__PURE__ */ jsx25(Bot, { size: 16 })
|
|
57003
57080
|
}
|
|
57004
57081
|
),
|
|
57005
57082
|
/* @__PURE__ */ jsxs19("div", { className: "min-w-0 flex-1 pt-0.5", children: [
|
|
@@ -57016,14 +57093,14 @@ function AssistantTurnBlock({
|
|
|
57016
57093
|
"data-testid": "assistant-execution-summary",
|
|
57017
57094
|
className: "inline-flex min-w-0 max-w-full select-none items-center gap-1 bg-transparent p-0 text-left text-xs leading-[22px] text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
57018
57095
|
children: [
|
|
57019
|
-
/* @__PURE__ */
|
|
57096
|
+
/* @__PURE__ */ jsx25("span", { className: "min-w-0 truncate", children: executionSummaryLabel({
|
|
57020
57097
|
messages,
|
|
57021
57098
|
isStreaming,
|
|
57022
57099
|
durationMs: liveExecutionDurationMs,
|
|
57023
57100
|
sessionStatus,
|
|
57024
57101
|
askAnswers
|
|
57025
57102
|
}) }),
|
|
57026
|
-
/* @__PURE__ */
|
|
57103
|
+
/* @__PURE__ */ jsx25(
|
|
57027
57104
|
ChevronRight,
|
|
57028
57105
|
{
|
|
57029
57106
|
size: 14,
|
|
@@ -57038,10 +57115,10 @@ function AssistantTurnBlock({
|
|
|
57038
57115
|
]
|
|
57039
57116
|
}
|
|
57040
57117
|
),
|
|
57041
|
-
/* @__PURE__ */
|
|
57118
|
+
/* @__PURE__ */ jsx25("div", { className: "mt-3 h-px w-full bg-[hsl(var(--border)/0.75)]" })
|
|
57042
57119
|
] })
|
|
57043
57120
|
] }),
|
|
57044
|
-
effectiveMode === "detail" ? /* @__PURE__ */
|
|
57121
|
+
effectiveMode === "detail" ? /* @__PURE__ */ jsx25("div", { className: "ml-10 flex flex-col gap-1", children: messages.map((message, index3) => {
|
|
57045
57122
|
const isLast = index3 === messages.length - 1;
|
|
57046
57123
|
const streamingThis = isStreaming && isLast;
|
|
57047
57124
|
const text4 = getMessageText(message);
|
|
@@ -57056,7 +57133,7 @@ function AssistantTurnBlock({
|
|
|
57056
57133
|
{
|
|
57057
57134
|
className: "flex flex-col gap-1",
|
|
57058
57135
|
children: [
|
|
57059
|
-
showReasoning && message.reasoning ? /* @__PURE__ */
|
|
57136
|
+
showReasoning && message.reasoning ? /* @__PURE__ */ jsx25(
|
|
57060
57137
|
ThinkingBlock,
|
|
57061
57138
|
{
|
|
57062
57139
|
reasoning: message.reasoning,
|
|
@@ -57065,7 +57142,7 @@ function AssistantTurnBlock({
|
|
|
57065
57142
|
}
|
|
57066
57143
|
) : null,
|
|
57067
57144
|
orderedParts.length > 0 ? orderedParts.map(
|
|
57068
|
-
(part) => part.type === "text" ? /* @__PURE__ */
|
|
57145
|
+
(part) => part.type === "text" ? /* @__PURE__ */ jsx25(
|
|
57069
57146
|
AssistantMessageContent,
|
|
57070
57147
|
{
|
|
57071
57148
|
message: { ...message, content: part.content, tool_calls: turnToolCalls },
|
|
@@ -57076,9 +57153,9 @@ function AssistantTurnBlock({
|
|
|
57076
57153
|
renderers
|
|
57077
57154
|
},
|
|
57078
57155
|
part.key
|
|
57079
|
-
) : /* @__PURE__ */
|
|
57156
|
+
) : /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-1", children: part.toolCalls.map((toolCall) => {
|
|
57080
57157
|
const custom2 = renderers?.toolCall?.(toolCall);
|
|
57081
|
-
return custom2 !== null && custom2 !== void 0 ? /* @__PURE__ */
|
|
57158
|
+
return custom2 !== null && custom2 !== void 0 ? /* @__PURE__ */ jsx25("div", { children: custom2 }, toolCall.id) : formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx25(AgentLoopBlock, { toolCall, className: classNames?.agentLoop }, toolCall.id) : /* @__PURE__ */ jsx25(
|
|
57082
57159
|
ExecutionToolRow,
|
|
57083
57160
|
{
|
|
57084
57161
|
toolCall,
|
|
@@ -57087,7 +57164,7 @@ function AssistantTurnBlock({
|
|
|
57087
57164
|
toolCall.id
|
|
57088
57165
|
);
|
|
57089
57166
|
}) }, part.key)
|
|
57090
|
-
) : hasRenderableMessageContent(message) && message !== finalMessage ? /* @__PURE__ */
|
|
57167
|
+
) : hasRenderableMessageContent(message) && message !== finalMessage ? /* @__PURE__ */ jsx25(
|
|
57091
57168
|
AssistantMessageContent,
|
|
57092
57169
|
{
|
|
57093
57170
|
message,
|
|
@@ -57098,9 +57175,9 @@ function AssistantTurnBlock({
|
|
|
57098
57175
|
renderers
|
|
57099
57176
|
}
|
|
57100
57177
|
) : null,
|
|
57101
|
-
orderedParts.length === 0 && toolCalls.length > 0 ? /* @__PURE__ */
|
|
57178
|
+
orderedParts.length === 0 && toolCalls.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "flex flex-col gap-1", children: toolCalls.map((toolCall) => {
|
|
57102
57179
|
const custom2 = renderers?.toolCall?.(toolCall);
|
|
57103
|
-
return custom2 !== null && custom2 !== void 0 ? /* @__PURE__ */
|
|
57180
|
+
return custom2 !== null && custom2 !== void 0 ? /* @__PURE__ */ jsx25("div", { children: custom2 }, toolCall.id) : formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx25(AgentLoopBlock, { toolCall, className: classNames?.agentLoop }, toolCall.id) : /* @__PURE__ */ jsx25(
|
|
57104
57181
|
ExecutionToolRow,
|
|
57105
57182
|
{
|
|
57106
57183
|
toolCall,
|
|
@@ -57109,14 +57186,14 @@ function AssistantTurnBlock({
|
|
|
57109
57186
|
toolCall.id
|
|
57110
57187
|
);
|
|
57111
57188
|
}) }) : null,
|
|
57112
|
-
messageToolUiCards.map((entry) => /* @__PURE__ */
|
|
57189
|
+
messageToolUiCards.map((entry) => /* @__PURE__ */ jsx25(ToolUiCardView, { card: entry.card, sessionId }, entry.key))
|
|
57113
57190
|
]
|
|
57114
57191
|
},
|
|
57115
57192
|
message.entry_id ?? `${message.timestamp ?? "assistant"}-${index3}`
|
|
57116
57193
|
);
|
|
57117
57194
|
}) }) : null,
|
|
57118
|
-
effectiveMode === "compact" && inlineToolUiCards.length > 0 ? /* @__PURE__ */
|
|
57119
|
-
finalMessage && (effectiveMode === "compact" || finalOrderedParts.length === 0) ? /* @__PURE__ */
|
|
57195
|
+
effectiveMode === "compact" && inlineToolUiCards.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "ml-10 flex flex-col gap-3", children: inlineToolUiCards.map((entry) => /* @__PURE__ */ jsx25(ToolUiCardView, { card: entry.card, sessionId }, entry.key)) }) : null,
|
|
57196
|
+
finalMessage && (effectiveMode === "compact" || finalOrderedParts.length === 0) ? /* @__PURE__ */ jsx25("div", { className: "ml-10", children: /* @__PURE__ */ jsx25(
|
|
57120
57197
|
AssistantMessageContent,
|
|
57121
57198
|
{
|
|
57122
57199
|
message: finalMessage,
|
|
@@ -57126,7 +57203,7 @@ function AssistantTurnBlock({
|
|
|
57126
57203
|
renderers
|
|
57127
57204
|
}
|
|
57128
57205
|
) }) : null,
|
|
57129
|
-
questionToolCalls.map((toolCall) => /* @__PURE__ */
|
|
57206
|
+
questionToolCalls.map((toolCall) => /* @__PURE__ */ jsx25(
|
|
57130
57207
|
ToolCallBlock,
|
|
57131
57208
|
{
|
|
57132
57209
|
toolCall,
|
|
@@ -57152,22 +57229,22 @@ function collectMemoryRefs(messages) {
|
|
|
57152
57229
|
return [...refs.values()];
|
|
57153
57230
|
}
|
|
57154
57231
|
function MemoryRefsHint({ refs, className }) {
|
|
57155
|
-
const [expanded, setExpanded] =
|
|
57232
|
+
const [expanded, setExpanded] = useState33(false);
|
|
57156
57233
|
const label = refs.some((ref) => ref.skill_name) ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
57157
57234
|
return /* @__PURE__ */ jsxs19("div", { part: "memory-refs", className: cn("blade-chat-memory-refs ml-1 w-full max-w-[680px]", className), children: [
|
|
57158
57235
|
/* @__PURE__ */ jsxs19("button", { type: "button", onClick: () => setExpanded((value) => !value), className: "inline-flex h-8 items-center gap-1.5 rounded-lg border border-[hsl(var(--primary)/0.22)] bg-[hsl(var(--primary)/0.07)] px-3 text-xs font-medium text-[hsl(var(--primary))]", children: [
|
|
57159
|
-
/* @__PURE__ */
|
|
57236
|
+
/* @__PURE__ */ jsx25(BookOpen, { size: 12 }),
|
|
57160
57237
|
/* @__PURE__ */ jsxs19("span", { children: [
|
|
57161
57238
|
label,
|
|
57162
57239
|
"\uFF08",
|
|
57163
57240
|
refs.length,
|
|
57164
57241
|
"\uFF09"
|
|
57165
57242
|
] }),
|
|
57166
|
-
/* @__PURE__ */
|
|
57243
|
+
/* @__PURE__ */ jsx25(ChevronRight, { size: 10, className: cn("transition-transform", expanded && "rotate-90") })
|
|
57167
57244
|
] }),
|
|
57168
|
-
expanded ? /* @__PURE__ */
|
|
57169
|
-
/* @__PURE__ */
|
|
57170
|
-
ref.skill_name ? /* @__PURE__ */
|
|
57245
|
+
expanded ? /* @__PURE__ */ jsx25("div", { className: "mt-2 flex flex-col gap-2 rounded-xl border border-[hsl(var(--border)/0.8)] bg-[hsl(var(--muted)/0.28)] p-2.5", children: refs.map((ref) => /* @__PURE__ */ jsxs19("div", { className: "rounded-lg border border-[hsl(var(--border)/0.55)] bg-[hsl(var(--background)/0.72)] px-3 py-2.5 text-xs", children: [
|
|
57246
|
+
/* @__PURE__ */ jsx25("p", { className: "line-clamp-2 break-words leading-5", children: ref.content_preview }),
|
|
57247
|
+
ref.skill_name ? /* @__PURE__ */ jsx25("span", { className: "mt-1 inline-flex text-[10px] text-[hsl(var(--primary))]", children: ref.skill_name }) : null
|
|
57171
57248
|
] }, ref.id)) }) : null
|
|
57172
57249
|
] });
|
|
57173
57250
|
}
|
|
@@ -57183,9 +57260,9 @@ function AssistantMessageContent({
|
|
|
57183
57260
|
const imageParts = getImageParts(message.content);
|
|
57184
57261
|
const fileParts = getFileParts(message.content);
|
|
57185
57262
|
const failed = message.status === "failed";
|
|
57186
|
-
const failedBadge = failed ? /* @__PURE__ */
|
|
57263
|
+
const failedBadge = failed ? /* @__PURE__ */ jsx25("div", { className: "w-fit rounded-full border border-red-500/30 bg-red-500/10 px-2.5 py-1 text-[10px] font-medium text-red-400", children: "\u751F\u6210\u5931\u8D25" }) : null;
|
|
57187
57264
|
const customText = text4 ? renderers?.assistantText?.({ message, streaming, compact, sessionId }) : void 0;
|
|
57188
|
-
const textContent = text4 ? customText ?? /* @__PURE__ */
|
|
57265
|
+
const textContent = text4 ? customText ?? /* @__PURE__ */ jsx25(
|
|
57189
57266
|
"div",
|
|
57190
57267
|
{
|
|
57191
57268
|
part: "assistant-text",
|
|
@@ -57194,7 +57271,7 @@ function AssistantMessageContent({
|
|
|
57194
57271
|
compact ? "text-xs leading-[22px] text-[hsl(var(--foreground))]" : "text-[15px] leading-8 text-[hsl(var(--foreground))]",
|
|
57195
57272
|
classNames?.assistantText
|
|
57196
57273
|
),
|
|
57197
|
-
children: /* @__PURE__ */
|
|
57274
|
+
children: /* @__PURE__ */ jsx25(
|
|
57198
57275
|
MarkdownContent,
|
|
57199
57276
|
{
|
|
57200
57277
|
mode: streaming ? "streaming" : "static",
|
|
@@ -57214,7 +57291,7 @@ function AssistantMessageContent({
|
|
|
57214
57291
|
}
|
|
57215
57292
|
return /* @__PURE__ */ jsxs19("div", { className: "flex flex-col gap-3", children: [
|
|
57216
57293
|
failedBadge,
|
|
57217
|
-
imageParts.length > 0 ? /* @__PURE__ */
|
|
57294
|
+
imageParts.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx25(
|
|
57218
57295
|
MessageImage,
|
|
57219
57296
|
{
|
|
57220
57297
|
src: part.image_url.url,
|
|
@@ -57225,7 +57302,7 @@ function AssistantMessageContent({
|
|
|
57225
57302
|
},
|
|
57226
57303
|
part.image_url.url
|
|
57227
57304
|
)) }) : null,
|
|
57228
|
-
fileParts.length > 0 ? /* @__PURE__ */
|
|
57305
|
+
fileParts.length > 0 ? /* @__PURE__ */ jsx25("div", { className: "flex flex-wrap gap-1.5", children: fileParts.map((part) => /* @__PURE__ */ jsxs19(
|
|
57229
57306
|
"div",
|
|
57230
57307
|
{
|
|
57231
57308
|
part: "file-card",
|
|
@@ -57235,8 +57312,8 @@ function AssistantMessageContent({
|
|
|
57235
57312
|
),
|
|
57236
57313
|
title: part.name,
|
|
57237
57314
|
children: [
|
|
57238
|
-
/* @__PURE__ */
|
|
57239
|
-
/* @__PURE__ */
|
|
57315
|
+
/* @__PURE__ */ jsx25(FileText, { size: 12, className: "blade-chat-file-card-icon shrink-0" }),
|
|
57316
|
+
/* @__PURE__ */ jsx25("span", { className: "blade-chat-file-card-name max-w-56 truncate", children: part.name })
|
|
57240
57317
|
]
|
|
57241
57318
|
},
|
|
57242
57319
|
`${part.name}-${part.data.slice(0, 32)}`
|
|
@@ -57247,7 +57324,7 @@ function AssistantMessageContent({
|
|
|
57247
57324
|
|
|
57248
57325
|
// src/components/RenderErrorBoundary.tsx
|
|
57249
57326
|
import { Component as Component2 } from "react";
|
|
57250
|
-
import { jsx as
|
|
57327
|
+
import { jsx as jsx26, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
57251
57328
|
function getFirstComponentName(componentStack) {
|
|
57252
57329
|
const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
|
|
57253
57330
|
return match?.[1] ?? null;
|
|
@@ -57280,8 +57357,8 @@ var RenderErrorBoundary = class extends Component2 {
|
|
|
57280
57357
|
return children;
|
|
57281
57358
|
}
|
|
57282
57359
|
const componentName = getFirstComponentName(componentStack);
|
|
57283
|
-
return /* @__PURE__ */
|
|
57284
|
-
/* @__PURE__ */
|
|
57360
|
+
return /* @__PURE__ */ jsx26("div", { className: "blade-chat-render-error rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3 text-sm text-amber-100", children: /* @__PURE__ */ jsxs20("div", { className: "flex items-start gap-2", children: [
|
|
57361
|
+
/* @__PURE__ */ jsx26(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-300" }),
|
|
57285
57362
|
/* @__PURE__ */ jsxs20("div", { className: "min-w-0 flex-1", children: [
|
|
57286
57363
|
/* @__PURE__ */ jsxs20("div", { className: "font-medium", children: [
|
|
57287
57364
|
label,
|
|
@@ -57291,15 +57368,15 @@ var RenderErrorBoundary = class extends Component2 {
|
|
|
57291
57368
|
componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
|
|
57292
57369
|
error61.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
|
|
57293
57370
|
] }),
|
|
57294
|
-
details ? /* @__PURE__ */
|
|
57371
|
+
details ? /* @__PURE__ */ jsx26("div", { className: "mt-1 truncate text-xs text-amber-100/55", children: details }) : null
|
|
57295
57372
|
] })
|
|
57296
57373
|
] }) });
|
|
57297
57374
|
}
|
|
57298
57375
|
};
|
|
57299
57376
|
|
|
57300
57377
|
// src/components/PostChatFollowupBlock.tsx
|
|
57301
|
-
import { useCallback as useCallback28, useEffect as
|
|
57302
|
-
import { Fragment as Fragment8, jsx as
|
|
57378
|
+
import { useCallback as useCallback28, useEffect as useEffect26, useRef as useRef28, useState as useState34 } from "react";
|
|
57379
|
+
import { Fragment as Fragment8, jsx as jsx27, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
57303
57380
|
function emitInteraction(callback, event) {
|
|
57304
57381
|
try {
|
|
57305
57382
|
callback?.(event);
|
|
@@ -57318,7 +57395,7 @@ function ArtifactCard({
|
|
|
57318
57395
|
onArtifactOpened
|
|
57319
57396
|
}) {
|
|
57320
57397
|
const client = useBladeClient();
|
|
57321
|
-
const [downloading, setDownloading] =
|
|
57398
|
+
const [downloading, setDownloading] = useState34(false);
|
|
57322
57399
|
const name = artifact.label || basename(artifact.target);
|
|
57323
57400
|
if (artifact.kind === "link") {
|
|
57324
57401
|
return /* @__PURE__ */ jsxs21(
|
|
@@ -57332,9 +57409,9 @@ function ArtifactCard({
|
|
|
57332
57409
|
${artifact.target}`,
|
|
57333
57410
|
className: "group relative flex min-w-0 items-center gap-1.5 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-2 py-1.5 text-xs text-[hsl(var(--card-foreground))] hover:bg-[hsl(var(--accent))]",
|
|
57334
57411
|
children: [
|
|
57335
|
-
/* @__PURE__ */
|
|
57336
|
-
/* @__PURE__ */
|
|
57337
|
-
/* @__PURE__ */
|
|
57412
|
+
/* @__PURE__ */ jsx27(Globe, { size: 15, className: "shrink-0 text-[hsl(var(--primary))]" }),
|
|
57413
|
+
/* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1 truncate font-medium", children: name }),
|
|
57414
|
+
/* @__PURE__ */ jsx27(ArrowUpRight, { size: 13, className: "absolute right-2 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100" })
|
|
57338
57415
|
]
|
|
57339
57416
|
}
|
|
57340
57417
|
);
|
|
@@ -57369,7 +57446,7 @@ ${artifact.target}`,
|
|
|
57369
57446
|
setDownloading(false);
|
|
57370
57447
|
}
|
|
57371
57448
|
};
|
|
57372
|
-
return /* @__PURE__ */
|
|
57449
|
+
return /* @__PURE__ */ jsx27(
|
|
57373
57450
|
"a",
|
|
57374
57451
|
{
|
|
57375
57452
|
href: downloadUrl,
|
|
@@ -57424,15 +57501,15 @@ function ResultFeedback({
|
|
|
57424
57501
|
onFeedbackSaved
|
|
57425
57502
|
}) {
|
|
57426
57503
|
const client = useBladeClient();
|
|
57427
|
-
const [saved, setSaved] =
|
|
57428
|
-
const [helpful, setHelpful] =
|
|
57429
|
-
const [reason, setReason] =
|
|
57430
|
-
const [saving, setSaving] =
|
|
57431
|
-
const [saveError, setSaveError] =
|
|
57432
|
-
const reportedShown =
|
|
57433
|
-
const latestChoice =
|
|
57504
|
+
const [saved, setSaved] = useState34(savedFeedback ?? null);
|
|
57505
|
+
const [helpful, setHelpful] = useState34(savedFeedback?.helpful ?? null);
|
|
57506
|
+
const [reason, setReason] = useState34(savedFeedback?.reason ?? null);
|
|
57507
|
+
const [saving, setSaving] = useState34(false);
|
|
57508
|
+
const [saveError, setSaveError] = useState34(false);
|
|
57509
|
+
const reportedShown = useRef28(false);
|
|
57510
|
+
const latestChoice = useRef28(null);
|
|
57434
57511
|
const eligible = followup.feedback_eligible === true && Boolean(sessionId) && !isViewer;
|
|
57435
|
-
|
|
57512
|
+
useEffect26(() => {
|
|
57436
57513
|
if (!eligible || reportedShown.current) return;
|
|
57437
57514
|
reportedShown.current = true;
|
|
57438
57515
|
emitInteraction(onInteraction, {
|
|
@@ -57441,7 +57518,7 @@ function ResultFeedback({
|
|
|
57441
57518
|
assistantEntryId: followup.assistant_entry_id
|
|
57442
57519
|
});
|
|
57443
57520
|
}, [eligible, followup.assistant_entry_id, onInteraction, sessionId]);
|
|
57444
|
-
|
|
57521
|
+
useEffect26(() => {
|
|
57445
57522
|
if (!savedFeedback || latestChoice.current) return;
|
|
57446
57523
|
setSaved(savedFeedback);
|
|
57447
57524
|
setHelpful(savedFeedback.helpful);
|
|
@@ -57488,9 +57565,9 @@ function ResultFeedback({
|
|
|
57488
57565
|
"aria-label": "\u7ED3\u679C\u53CD\u9988",
|
|
57489
57566
|
className: "flex flex-col gap-2 border-t border-[hsl(var(--border))] pt-3",
|
|
57490
57567
|
children: [
|
|
57491
|
-
/* @__PURE__ */
|
|
57568
|
+
/* @__PURE__ */ jsx27("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u76EE\u524D\u7684\u6574\u4F53\u7ED3\u679C\u6709\u5E2E\u52A9\u5417\uFF1F" }),
|
|
57492
57569
|
/* @__PURE__ */ jsxs21("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
57493
|
-
/* @__PURE__ */
|
|
57570
|
+
/* @__PURE__ */ jsx27(
|
|
57494
57571
|
"button",
|
|
57495
57572
|
{
|
|
57496
57573
|
type: "button",
|
|
@@ -57501,7 +57578,7 @@ function ResultFeedback({
|
|
|
57501
57578
|
children: "\u6709\u5E2E\u52A9"
|
|
57502
57579
|
}
|
|
57503
57580
|
),
|
|
57504
|
-
/* @__PURE__ */
|
|
57581
|
+
/* @__PURE__ */ jsx27(
|
|
57505
57582
|
"button",
|
|
57506
57583
|
{
|
|
57507
57584
|
type: "button",
|
|
@@ -57513,7 +57590,7 @@ function ResultFeedback({
|
|
|
57513
57590
|
}
|
|
57514
57591
|
)
|
|
57515
57592
|
] }),
|
|
57516
|
-
helpful === false ? /* @__PURE__ */
|
|
57593
|
+
helpful === false ? /* @__PURE__ */ jsx27("div", { className: "flex flex-wrap gap-1.5", "aria-label": "\u6CA1\u5E2E\u52A9\u7684\u4E3B\u8981\u539F\u56E0", children: FEEDBACK_REASONS.map((item) => /* @__PURE__ */ jsx27(
|
|
57517
57594
|
"button",
|
|
57518
57595
|
{
|
|
57519
57596
|
type: "button",
|
|
@@ -57526,8 +57603,8 @@ function ResultFeedback({
|
|
|
57526
57603
|
item.value
|
|
57527
57604
|
)) }) : null,
|
|
57528
57605
|
saveError ? /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--destructive))]", children: [
|
|
57529
|
-
/* @__PURE__ */
|
|
57530
|
-
/* @__PURE__ */
|
|
57606
|
+
/* @__PURE__ */ jsx27("span", { children: "\u53CD\u9988\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u91CD\u8BD5" }),
|
|
57607
|
+
/* @__PURE__ */ jsx27(
|
|
57531
57608
|
"button",
|
|
57532
57609
|
{
|
|
57533
57610
|
type: "button",
|
|
@@ -57539,7 +57616,7 @@ function ResultFeedback({
|
|
|
57539
57616
|
children: "\u91CD\u8BD5"
|
|
57540
57617
|
}
|
|
57541
57618
|
)
|
|
57542
|
-
] }) : saved ? /* @__PURE__ */
|
|
57619
|
+
] }) : saved ? /* @__PURE__ */ jsx27("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u968F\u65F6\u4FEE\u6539" }) : null
|
|
57543
57620
|
]
|
|
57544
57621
|
}
|
|
57545
57622
|
);
|
|
@@ -57555,14 +57632,14 @@ function PostChatFollowupBlock({
|
|
|
57555
57632
|
className,
|
|
57556
57633
|
suggestionClassName
|
|
57557
57634
|
}) {
|
|
57558
|
-
const [expanded, setExpanded] =
|
|
57559
|
-
const adopted =
|
|
57560
|
-
const reportedSuggestions =
|
|
57561
|
-
const reportedArtifacts =
|
|
57562
|
-
const openedArtifacts =
|
|
57635
|
+
const [expanded, setExpanded] = useState34(false);
|
|
57636
|
+
const adopted = useRef28(/* @__PURE__ */ new Set());
|
|
57637
|
+
const reportedSuggestions = useRef28(false);
|
|
57638
|
+
const reportedArtifacts = useRef28(/* @__PURE__ */ new Set());
|
|
57639
|
+
const openedArtifacts = useRef28(/* @__PURE__ */ new Set());
|
|
57563
57640
|
const artifacts = followup.final_artifacts ?? [];
|
|
57564
57641
|
const visibleArtifacts = expanded ? artifacts : artifacts.slice(0, 3);
|
|
57565
|
-
|
|
57642
|
+
useEffect26(() => {
|
|
57566
57643
|
if (!reportedSuggestions.current && followup.suggestions.length > 0) {
|
|
57567
57644
|
reportedSuggestions.current = true;
|
|
57568
57645
|
emitInteraction(onInteraction, {
|
|
@@ -57619,12 +57696,12 @@ function PostChatFollowupBlock({
|
|
|
57619
57696
|
children: [
|
|
57620
57697
|
followup.recaption || artifacts.length > 0 ? /* @__PURE__ */ jsxs21("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
|
|
57621
57698
|
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
57622
|
-
/* @__PURE__ */
|
|
57699
|
+
/* @__PURE__ */ jsx27(Sparkles, { size: 14 }),
|
|
57623
57700
|
"\u672C\u8F6E\u5C0F\u7ED3"
|
|
57624
57701
|
] }),
|
|
57625
|
-
followup.recaption ? /* @__PURE__ */
|
|
57702
|
+
followup.recaption ? /* @__PURE__ */ jsx27("p", { className: "text-[13px] leading-5", children: followup.recaption }) : null,
|
|
57626
57703
|
artifacts.length > 0 ? /* @__PURE__ */ jsxs21(Fragment8, { children: [
|
|
57627
|
-
/* @__PURE__ */
|
|
57704
|
+
/* @__PURE__ */ jsx27("div", { className: "grid max-w-full grid-cols-3 gap-1.5", children: visibleArtifacts.map((artifact, artifactIndex) => /* @__PURE__ */ jsx27(
|
|
57628
57705
|
ArtifactCard,
|
|
57629
57706
|
{
|
|
57630
57707
|
artifact,
|
|
@@ -57645,14 +57722,14 @@ function PostChatFollowupBlock({
|
|
|
57645
57722
|
className: "flex w-fit items-center gap-0.5 text-[11px] text-[hsl(var(--muted-foreground))]",
|
|
57646
57723
|
children: [
|
|
57647
57724
|
expanded ? "\u6536\u8D77" : `\u5C55\u5F00 ${artifacts.length - 3} \u4E2A`,
|
|
57648
|
-
/* @__PURE__ */
|
|
57725
|
+
/* @__PURE__ */ jsx27(ChevronDown, { size: 13, className: expanded ? "rotate-180" : void 0 })
|
|
57649
57726
|
]
|
|
57650
57727
|
}
|
|
57651
57728
|
) : null
|
|
57652
57729
|
] }) : null
|
|
57653
57730
|
] }) : null,
|
|
57654
57731
|
followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs21("section", { "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", className: "flex flex-col gap-1.5", children: [
|
|
57655
|
-
/* @__PURE__ */
|
|
57732
|
+
/* @__PURE__ */ jsx27("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
|
|
57656
57733
|
followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs21(
|
|
57657
57734
|
"button",
|
|
57658
57735
|
{
|
|
@@ -57676,14 +57753,14 @@ function PostChatFollowupBlock({
|
|
|
57676
57753
|
suggestionClassName
|
|
57677
57754
|
),
|
|
57678
57755
|
children: [
|
|
57679
|
-
/* @__PURE__ */
|
|
57680
|
-
/* @__PURE__ */
|
|
57756
|
+
/* @__PURE__ */ jsx27("span", { children: suggestion }),
|
|
57757
|
+
/* @__PURE__ */ jsx27(ArrowRight, { size: 14, className: "ml-auto shrink-0" })
|
|
57681
57758
|
]
|
|
57682
57759
|
},
|
|
57683
57760
|
suggestion
|
|
57684
57761
|
))
|
|
57685
57762
|
] }) : null,
|
|
57686
|
-
/* @__PURE__ */
|
|
57763
|
+
/* @__PURE__ */ jsx27(
|
|
57687
57764
|
ResultFeedback,
|
|
57688
57765
|
{
|
|
57689
57766
|
followup,
|
|
@@ -57760,31 +57837,31 @@ function parseWhatIfPrompt(text4) {
|
|
|
57760
57837
|
}
|
|
57761
57838
|
|
|
57762
57839
|
// src/components/WhatIfUserBubble.tsx
|
|
57763
|
-
import { jsx as
|
|
57840
|
+
import { jsx as jsx28, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
57764
57841
|
function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
57765
57842
|
const { fromStep, quotes, userText } = parsed;
|
|
57766
57843
|
return /* @__PURE__ */ jsxs22("div", { className: "flex flex-col items-end gap-2", children: [
|
|
57767
57844
|
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.5)] px-2.5 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
57768
|
-
/* @__PURE__ */
|
|
57769
|
-
/* @__PURE__ */
|
|
57845
|
+
/* @__PURE__ */ jsx28(RefreshCcw, { size: 10 }),
|
|
57846
|
+
/* @__PURE__ */ jsx28("span", { children: fromStep != null ? `\u91CD\u8DD1\u81EA step ${fromStep}` : "\u91CD\u8DD1" })
|
|
57770
57847
|
] }),
|
|
57771
|
-
quotes.length > 0 && /* @__PURE__ */
|
|
57848
|
+
quotes.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex max-w-[min(72vw,42rem)] flex-col items-stretch gap-2", children: quotes.map((quote, index3) => {
|
|
57772
57849
|
const clickable = quote.stepNumber != null && !!onQuoteClick;
|
|
57773
57850
|
const label = quote.stepNumber != null ? `\u6B65\u9AA4${quote.stepNumber} \xB7 ${quote.label}` : quote.label;
|
|
57774
57851
|
return /* @__PURE__ */ jsxs22("div", { className: "rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.8)] px-3 py-2 text-left", children: [
|
|
57775
57852
|
/* @__PURE__ */ jsxs22("button", { type: "button", disabled: !clickable, onClick: () => clickable && onQuoteClick(quote.stepNumber), className: "inline-flex max-w-full items-center gap-1 text-[11px] font-medium text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] disabled:cursor-default", title: clickable ? "\u8DF3\u8F6C\u5230\u5BF9\u5E94\u6B65\u9AA4\u5361\u7247" : void 0, children: [
|
|
57776
|
-
/* @__PURE__ */
|
|
57777
|
-
/* @__PURE__ */
|
|
57853
|
+
/* @__PURE__ */ jsx28("span", { children: "\u21B3" }),
|
|
57854
|
+
/* @__PURE__ */ jsx28("span", { className: "truncate", children: label })
|
|
57778
57855
|
] }),
|
|
57779
|
-
quote.snapshot ? /* @__PURE__ */
|
|
57856
|
+
quote.snapshot ? /* @__PURE__ */ jsx28("div", { className: "mt-1 border-l-2 border-[hsl(var(--accent-foreground)/0.35)] pl-2 text-xs leading-relaxed text-[hsl(var(--foreground)/0.8)]", children: /* @__PURE__ */ jsx28(MarkdownContent, { className: "blade-chat-prose", children: quote.snapshot }) }) : null
|
|
57780
57857
|
] }, `${quote.stepNumber ?? "x"}-${index3}`);
|
|
57781
57858
|
}) }),
|
|
57782
|
-
userText && /* @__PURE__ */
|
|
57859
|
+
userText && /* @__PURE__ */ jsx28("div", { className: "rounded-2xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-sm leading-relaxed text-[hsl(var(--user-msg-fg))]", children: /* @__PURE__ */ jsx28(MarkdownContent, { className: "blade-chat-prose", children: userText }) })
|
|
57783
57860
|
] });
|
|
57784
57861
|
}
|
|
57785
57862
|
|
|
57786
57863
|
// src/components/UserMessageBubble.tsx
|
|
57787
|
-
import { jsx as
|
|
57864
|
+
import { jsx as jsx29, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
57788
57865
|
function isUserMessage(message) {
|
|
57789
57866
|
return message.role === "user";
|
|
57790
57867
|
}
|
|
@@ -57799,17 +57876,17 @@ function UserMessageBubble({ message, classNames, renderers }) {
|
|
|
57799
57876
|
const whatifParsed = text4 && imageParts.length === 0 && fileParts.length === 0 ? parseWhatIfPrompt(text4) : null;
|
|
57800
57877
|
const customBubble = renderers?.userMessage?.({ message });
|
|
57801
57878
|
if (whatifParsed) {
|
|
57802
|
-
return /* @__PURE__ */
|
|
57879
|
+
return /* @__PURE__ */ jsx29("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", classNames?.userMessage), children: /* @__PURE__ */ jsx29("div", { className: "blade-chat-user-col flex max-w-[72%] flex-col items-end gap-3", children: customBubble ?? /* @__PURE__ */ jsx29(
|
|
57803
57880
|
"div",
|
|
57804
57881
|
{
|
|
57805
57882
|
part: "user-bubble",
|
|
57806
57883
|
className: cn("blade-chat-user-bubble", classNames?.userBubble),
|
|
57807
|
-
children: /* @__PURE__ */
|
|
57884
|
+
children: /* @__PURE__ */ jsx29(WhatIfUserBubble, { parsed: whatifParsed })
|
|
57808
57885
|
}
|
|
57809
57886
|
) }) });
|
|
57810
57887
|
}
|
|
57811
|
-
return /* @__PURE__ */
|
|
57812
|
-
imageParts.length > 0 && /* @__PURE__ */
|
|
57888
|
+
return /* @__PURE__ */ jsx29("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", classNames?.userMessage), children: /* @__PURE__ */ jsxs23("div", { className: "blade-chat-user-col flex max-w-[72%] flex-col items-end gap-3", children: [
|
|
57889
|
+
imageParts.length > 0 && /* @__PURE__ */ jsx29("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx29(
|
|
57813
57890
|
MessageImage,
|
|
57814
57891
|
{
|
|
57815
57892
|
src: part.image_url.url,
|
|
@@ -57820,7 +57897,7 @@ function UserMessageBubble({ message, classNames, renderers }) {
|
|
|
57820
57897
|
},
|
|
57821
57898
|
part.image_url.url
|
|
57822
57899
|
)) }),
|
|
57823
|
-
fileParts.length > 0 && /* @__PURE__ */
|
|
57900
|
+
fileParts.length > 0 && /* @__PURE__ */ jsx29("div", { className: "flex flex-col items-end gap-1.5", children: fileParts.map((part) => /* @__PURE__ */ jsxs23(
|
|
57824
57901
|
"div",
|
|
57825
57902
|
{
|
|
57826
57903
|
part: "file-card",
|
|
@@ -57829,13 +57906,13 @@ function UserMessageBubble({ message, classNames, renderers }) {
|
|
|
57829
57906
|
classNames?.fileCard
|
|
57830
57907
|
),
|
|
57831
57908
|
children: [
|
|
57832
|
-
/* @__PURE__ */
|
|
57833
|
-
/* @__PURE__ */
|
|
57909
|
+
/* @__PURE__ */ jsx29(FileText, { size: 12, className: "blade-chat-file-card-icon shrink-0" }),
|
|
57910
|
+
/* @__PURE__ */ jsx29("span", { className: "blade-chat-file-card-name max-w-56 truncate", title: part.name, children: part.name })
|
|
57834
57911
|
]
|
|
57835
57912
|
},
|
|
57836
57913
|
`${part.name}-${part.data.length}`
|
|
57837
57914
|
)) }),
|
|
57838
|
-
text4 && (customBubble ?? /* @__PURE__ */
|
|
57915
|
+
text4 && (customBubble ?? /* @__PURE__ */ jsx29(
|
|
57839
57916
|
"div",
|
|
57840
57917
|
{
|
|
57841
57918
|
part: "user-bubble",
|
|
@@ -57843,12 +57920,12 @@ function UserMessageBubble({ message, classNames, renderers }) {
|
|
|
57843
57920
|
"blade-chat-user-bubble max-w-full rounded-[20px] rounded-br-[6px] border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-[18px] py-[13px] text-sm leading-[1.65] text-[hsl(var(--user-msg-fg))]",
|
|
57844
57921
|
classNames?.userBubble
|
|
57845
57922
|
),
|
|
57846
|
-
children: /* @__PURE__ */
|
|
57923
|
+
children: /* @__PURE__ */ jsx29(MarkdownContent, { className: "blade-chat-prose", children: text4 })
|
|
57847
57924
|
}
|
|
57848
57925
|
)),
|
|
57849
57926
|
text4 && isSending(message) && /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-1 pr-1 text-[11px] font-medium text-[hsl(var(--muted-foreground))/0.85]", children: [
|
|
57850
|
-
/* @__PURE__ */
|
|
57851
|
-
/* @__PURE__ */
|
|
57927
|
+
/* @__PURE__ */ jsx29(LoaderCircle, { size: 11, className: "animate-spin", "aria-hidden": "true" }),
|
|
57928
|
+
/* @__PURE__ */ jsx29("span", { children: "\u53D1\u9001\u4E2D" })
|
|
57852
57929
|
] })
|
|
57853
57930
|
] }) });
|
|
57854
57931
|
}
|
|
@@ -57857,11 +57934,11 @@ function ErrorMessageBlock({
|
|
|
57857
57934
|
className
|
|
57858
57935
|
}) {
|
|
57859
57936
|
const text4 = chatErrorForDisplay(getTextContent3(message.content));
|
|
57860
|
-
return /* @__PURE__ */
|
|
57937
|
+
return /* @__PURE__ */ jsx29("div", { part: "error-row", className: cn("blade-chat-error-row flex min-w-0 justify-start", className), children: /* @__PURE__ */ jsx29("div", { className: "blade-chat-error-block min-w-0 max-w-full whitespace-pre-wrap break-words border-l-[3px] border-[hsl(var(--border))] px-3 py-1 text-left text-sm leading-7 text-[hsl(var(--muted-foreground))] [overflow-wrap:anywhere]", children: text4 }) });
|
|
57861
57938
|
}
|
|
57862
57939
|
|
|
57863
57940
|
// src/components/MessageList.tsx
|
|
57864
|
-
import { jsx as
|
|
57941
|
+
import { jsx as jsx30, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
57865
57942
|
function parseModeChange(message) {
|
|
57866
57943
|
if (message.kind !== "mode_change" || typeof message.content !== "string") {
|
|
57867
57944
|
return null;
|
|
@@ -57939,10 +58016,10 @@ function MessageList({
|
|
|
57939
58016
|
const contentReveal = useTypewriterReveal(revealContentText, isRevealLive, revealTargetKey);
|
|
57940
58017
|
const reasoningReveal = useTypewriterReveal(revealReasoningText, isRevealLive, revealTargetKey);
|
|
57941
58018
|
const isRevealingAny = contentReveal.isRevealing || reasoningReveal.isRevealing;
|
|
57942
|
-
|
|
58019
|
+
useEffect27(() => {
|
|
57943
58020
|
onRevealingChange?.(isRevealingAny);
|
|
57944
58021
|
}, [isRevealingAny, onRevealingChange]);
|
|
57945
|
-
|
|
58022
|
+
useEffect27(() => {
|
|
57946
58023
|
if (isStopping) {
|
|
57947
58024
|
contentReveal.flushNow();
|
|
57948
58025
|
reasoningReveal.flushNow();
|
|
@@ -58029,8 +58106,8 @@ function MessageList({
|
|
|
58029
58106
|
}
|
|
58030
58107
|
return blocks;
|
|
58031
58108
|
}, [visibleRootMessages, isStreaming, isRevealingAny]);
|
|
58032
|
-
const rootRef =
|
|
58033
|
-
const stopAutoScrollRef =
|
|
58109
|
+
const rootRef = useRef29(null);
|
|
58110
|
+
const stopAutoScrollRef = useRef29(null);
|
|
58034
58111
|
const {
|
|
58035
58112
|
items: turnNavItems,
|
|
58036
58113
|
activeEntryId: activeNavTurnId,
|
|
@@ -58050,7 +58127,7 @@ function MessageList({
|
|
|
58050
58127
|
isEntryLoaded: (entryId) => findEntryRow(rootRef.current, entryId) !== null,
|
|
58051
58128
|
beforeSeek: () => stopAutoScrollRef.current?.()
|
|
58052
58129
|
});
|
|
58053
|
-
const [viewportNavTurnId, setViewportNavTurnId] =
|
|
58130
|
+
const [viewportNavTurnId, setViewportNavTurnId] = useState35(null);
|
|
58054
58131
|
const latestNavTurnId = turnNavItems.at(-1)?.id ?? null;
|
|
58055
58132
|
return /* @__PURE__ */ jsxs24(
|
|
58056
58133
|
"div",
|
|
@@ -58059,8 +58136,8 @@ function MessageList({
|
|
|
58059
58136
|
part: "messages",
|
|
58060
58137
|
className: cn("blade-chat-messages relative min-h-0 flex-1", classNames?.messageList),
|
|
58061
58138
|
children: [
|
|
58062
|
-
isStreaming || isRevealingAny ? /* @__PURE__ */
|
|
58063
|
-
/* @__PURE__ */
|
|
58139
|
+
isStreaming || isRevealingAny ? /* @__PURE__ */ jsx30("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
|
|
58140
|
+
/* @__PURE__ */ jsx30(
|
|
58064
58141
|
TurnNavRail,
|
|
58065
58142
|
{
|
|
58066
58143
|
items: turnNavItems,
|
|
@@ -58078,23 +58155,23 @@ function MessageList({
|
|
|
58078
58155
|
initial: "instant",
|
|
58079
58156
|
resize: "instant",
|
|
58080
58157
|
children: [
|
|
58081
|
-
/* @__PURE__ */
|
|
58082
|
-
historyPaging && (historyPaging.hasOlder || historyPaging.loading) ? /* @__PURE__ */
|
|
58158
|
+
/* @__PURE__ */ jsx30(StickToBottom.Content, { part: "messages-scroll", className: cn("blade-chat-messages-scroll", classNames?.messagesScroll), children: /* @__PURE__ */ jsxs24("div", { part: "messages-content", className: cn("blade-chat-messages-content mx-auto max-w-[748px]", classNames?.messagesContent), children: [
|
|
58159
|
+
historyPaging && (historyPaging.hasOlder || historyPaging.loading) ? /* @__PURE__ */ jsx30(LoadOlderSentinel, { ...historyPaging }) : null,
|
|
58083
58160
|
/* @__PURE__ */ jsxs24("div", { className: "flex min-w-0 flex-col", children: [
|
|
58084
58161
|
renderBlocks.length === 0 ? emptyState ?? /* @__PURE__ */ jsxs24("div", { part: "empty", className: cn("blade-chat-empty", classNames?.empty), children: [
|
|
58085
|
-
/* @__PURE__ */
|
|
58086
|
-
/* @__PURE__ */
|
|
58087
|
-
/* @__PURE__ */
|
|
58162
|
+
/* @__PURE__ */ jsx30(MessageSquare, { size: 40, strokeWidth: 1.5 }),
|
|
58163
|
+
/* @__PURE__ */ jsx30("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
|
|
58164
|
+
/* @__PURE__ */ jsx30("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
58088
58165
|
] }) : renderBlocks.map((block) => {
|
|
58089
58166
|
if (block.type === "message") {
|
|
58090
|
-
return /* @__PURE__ */
|
|
58167
|
+
return /* @__PURE__ */ jsx30("div", { "data-entry-id": block.message.entry_id, children: isBackgroundWakeMessage(block.message) ? /* @__PURE__ */ jsx30(BackgroundWakeNotice, {}) : isUserMessage(block.message) ? /* @__PURE__ */ jsx30(
|
|
58091
58168
|
UserMessageBubble,
|
|
58092
58169
|
{
|
|
58093
58170
|
message: block.message,
|
|
58094
58171
|
classNames,
|
|
58095
58172
|
renderers
|
|
58096
58173
|
}
|
|
58097
|
-
) : isErrorMessage(block.message) ? /* @__PURE__ */
|
|
58174
|
+
) : isErrorMessage(block.message) ? /* @__PURE__ */ jsx30(
|
|
58098
58175
|
ErrorMessageBlock,
|
|
58099
58176
|
{
|
|
58100
58177
|
message: block.message,
|
|
@@ -58112,14 +58189,14 @@ function MessageList({
|
|
|
58112
58189
|
(message) => message.entry_id === postChatFollowup.assistant_entry_id
|
|
58113
58190
|
)
|
|
58114
58191
|
);
|
|
58115
|
-
return /* @__PURE__ */
|
|
58192
|
+
return /* @__PURE__ */ jsx30("div", { "data-entry-id": displayMessages[0]?.entry_id, children: /* @__PURE__ */ jsxs24(
|
|
58116
58193
|
RenderErrorBoundary,
|
|
58117
58194
|
{
|
|
58118
58195
|
label: "\u52A9\u624B\u6D88\u606F",
|
|
58119
58196
|
details: block.key,
|
|
58120
58197
|
resetKey: getMessageResetSignature(displayMessages),
|
|
58121
58198
|
children: [
|
|
58122
|
-
/* @__PURE__ */
|
|
58199
|
+
/* @__PURE__ */ jsx30(
|
|
58123
58200
|
AssistantTurnBlock,
|
|
58124
58201
|
{
|
|
58125
58202
|
messages: displayMessages,
|
|
@@ -58133,8 +58210,8 @@ function MessageList({
|
|
|
58133
58210
|
sessionId
|
|
58134
58211
|
}
|
|
58135
58212
|
),
|
|
58136
|
-
blockFeedback && !hasActiveFollowup ? /* @__PURE__ */
|
|
58137
|
-
hasActiveFollowup && postChatFollowup ? /* @__PURE__ */
|
|
58213
|
+
blockFeedback && !hasActiveFollowup ? /* @__PURE__ */ jsx30(HistoricalResultFeedback, { feedback: blockFeedback }) : null,
|
|
58214
|
+
hasActiveFollowup && postChatFollowup ? /* @__PURE__ */ jsx30(
|
|
58138
58215
|
PostChatFollowupBlock,
|
|
58139
58216
|
{
|
|
58140
58217
|
followup: postChatFollowup,
|
|
@@ -58158,19 +58235,19 @@ function MessageList({
|
|
|
58158
58235
|
{
|
|
58159
58236
|
className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
58160
58237
|
children: [
|
|
58161
|
-
/* @__PURE__ */
|
|
58162
|
-
/* @__PURE__ */
|
|
58238
|
+
/* @__PURE__ */ jsx30(Layers, { size: 12 }),
|
|
58239
|
+
/* @__PURE__ */ jsx30("span", { children: "\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29" })
|
|
58163
58240
|
]
|
|
58164
58241
|
},
|
|
58165
58242
|
block.key
|
|
58166
58243
|
);
|
|
58167
58244
|
}
|
|
58168
|
-
return /* @__PURE__ */
|
|
58245
|
+
return /* @__PURE__ */ jsx30(PlanningDivider, { kind: block.kind }, block.key);
|
|
58169
58246
|
}),
|
|
58170
|
-
sessionStatus === "interrupted" && !isStreaming ? /* @__PURE__ */
|
|
58247
|
+
sessionStatus === "interrupted" && !isStreaming ? /* @__PURE__ */ jsx30("div", { className: "flex", children: /* @__PURE__ */ jsx30("div", { className: "rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }) }) : null
|
|
58171
58248
|
] })
|
|
58172
58249
|
] }) }),
|
|
58173
|
-
/* @__PURE__ */
|
|
58250
|
+
/* @__PURE__ */ jsx30(
|
|
58174
58251
|
PinLatestUserMessage,
|
|
58175
58252
|
{
|
|
58176
58253
|
userMessageCount: userMessages.length,
|
|
@@ -58180,9 +58257,9 @@ function MessageList({
|
|
|
58180
58257
|
},
|
|
58181
58258
|
sessionId ?? "no-session"
|
|
58182
58259
|
),
|
|
58183
|
-
/* @__PURE__ */
|
|
58184
|
-
/* @__PURE__ */
|
|
58185
|
-
/* @__PURE__ */
|
|
58260
|
+
/* @__PURE__ */ jsx30(ScrollToBottomButton, { className: classNames?.scrollToBottom }),
|
|
58261
|
+
/* @__PURE__ */ jsx30(StopAutoScrollBridge, { stopRef: stopAutoScrollRef }),
|
|
58262
|
+
/* @__PURE__ */ jsx30(
|
|
58186
58263
|
ViewportTurnBridge,
|
|
58187
58264
|
{
|
|
58188
58265
|
rootRef,
|
|
@@ -58204,10 +58281,10 @@ function LoadOlderSentinel({
|
|
|
58204
58281
|
loadOlder
|
|
58205
58282
|
}) {
|
|
58206
58283
|
const { contentRef, scrollRef } = useStickToBottomContext();
|
|
58207
|
-
const sentinelRef =
|
|
58208
|
-
const stateRef =
|
|
58284
|
+
const sentinelRef = useRef29(null);
|
|
58285
|
+
const stateRef = useRef29({ hasOlder, loading, loadOlder });
|
|
58209
58286
|
stateRef.current = { hasOlder, loading, loadOlder };
|
|
58210
|
-
|
|
58287
|
+
useEffect27(() => {
|
|
58211
58288
|
const sentinel = sentinelRef.current;
|
|
58212
58289
|
const scroller = scrollRef.current;
|
|
58213
58290
|
if (!sentinel || !scroller || typeof IntersectionObserver === "undefined") return;
|
|
@@ -58266,7 +58343,7 @@ function LoadOlderSentinel({
|
|
|
58266
58343
|
observer.disconnect();
|
|
58267
58344
|
};
|
|
58268
58345
|
}, [contentRef, scrollRef]);
|
|
58269
|
-
return /* @__PURE__ */
|
|
58346
|
+
return /* @__PURE__ */ jsx30("div", { ref: sentinelRef, "data-history-sentinel": true, className: "flex h-6 items-center justify-center", children: loading ? /* @__PURE__ */ jsx30("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u52A0\u8F7D\u66F4\u65E9\u6D88\u606F\u2026" }) : null });
|
|
58270
58347
|
}
|
|
58271
58348
|
function PinLatestUserMessage({
|
|
58272
58349
|
userMessageCount,
|
|
@@ -58275,8 +58352,8 @@ function PinLatestUserMessage({
|
|
|
58275
58352
|
targetKey
|
|
58276
58353
|
}) {
|
|
58277
58354
|
const { contentRef, scrollRef, scrollToBottom, stopScroll } = useStickToBottomContext();
|
|
58278
|
-
const previousCountRef =
|
|
58279
|
-
const spacerHeightRef =
|
|
58355
|
+
const previousCountRef = useRef29(userMessageCount);
|
|
58356
|
+
const spacerHeightRef = useRef29(0);
|
|
58280
58357
|
const getScrollElement = useCallback29(() => scrollRef.current, [scrollRef]);
|
|
58281
58358
|
const getContentElement = useCallback29(() => contentRef.current, [contentRef]);
|
|
58282
58359
|
const getTargetElement = useCallback29(() => {
|
|
@@ -58318,7 +58395,7 @@ function PinLatestUserMessage({
|
|
|
58318
58395
|
stopAutoScroll: stopScroll,
|
|
58319
58396
|
scrollToBottom
|
|
58320
58397
|
});
|
|
58321
|
-
|
|
58398
|
+
useEffect27(() => {
|
|
58322
58399
|
if (userMessageCount > previousCountRef.current && !shouldPinLatestUser) {
|
|
58323
58400
|
scrollToBottom("instant");
|
|
58324
58401
|
}
|
|
@@ -58328,9 +58405,9 @@ function PinLatestUserMessage({
|
|
|
58328
58405
|
}
|
|
58329
58406
|
function ScrollToBottomButton({ className }) {
|
|
58330
58407
|
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
58331
|
-
const [visible, setVisible] =
|
|
58332
|
-
const hideTimerRef =
|
|
58333
|
-
|
|
58408
|
+
const [visible, setVisible] = useState35(false);
|
|
58409
|
+
const hideTimerRef = useRef29(null);
|
|
58410
|
+
useEffect27(() => {
|
|
58334
58411
|
if (isAtBottom) {
|
|
58335
58412
|
if (!hideTimerRef.current) {
|
|
58336
58413
|
hideTimerRef.current = setTimeout(() => {
|
|
@@ -58373,20 +58450,20 @@ function ScrollToBottomButton({ className }) {
|
|
|
58373
58450
|
className
|
|
58374
58451
|
),
|
|
58375
58452
|
children: [
|
|
58376
|
-
/* @__PURE__ */
|
|
58377
|
-
/* @__PURE__ */
|
|
58453
|
+
/* @__PURE__ */ jsx30(ChevronDown, { size: 14 }),
|
|
58454
|
+
/* @__PURE__ */ jsx30("span", { className: "blade-chat-scroll-bottom-label", children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
|
|
58378
58455
|
]
|
|
58379
58456
|
}
|
|
58380
58457
|
);
|
|
58381
58458
|
}
|
|
58382
58459
|
function PlanningDivider({ kind }) {
|
|
58383
58460
|
return /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3 py-1", children: [
|
|
58384
|
-
/* @__PURE__ */
|
|
58461
|
+
/* @__PURE__ */ jsx30("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
|
|
58385
58462
|
/* @__PURE__ */ jsxs24("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-amber-500/30 bg-amber-500/10 px-3 py-1 text-[11px] text-amber-300", children: [
|
|
58386
|
-
/* @__PURE__ */
|
|
58387
|
-
/* @__PURE__ */
|
|
58463
|
+
/* @__PURE__ */ jsx30(Lightbulb, { size: 12 }),
|
|
58464
|
+
/* @__PURE__ */ jsx30("span", { children: kind === "enter" ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
|
|
58388
58465
|
] }),
|
|
58389
|
-
/* @__PURE__ */
|
|
58466
|
+
/* @__PURE__ */ jsx30("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
|
|
58390
58467
|
] });
|
|
58391
58468
|
}
|
|
58392
58469
|
function findEntryRow(root, entryId) {
|
|
@@ -58402,13 +58479,13 @@ function ViewportTurnBridge({
|
|
|
58402
58479
|
onActiveChange
|
|
58403
58480
|
}) {
|
|
58404
58481
|
const { scrollRef } = useStickToBottomContext();
|
|
58405
|
-
const itemsRef =
|
|
58406
|
-
const updateRef =
|
|
58407
|
-
|
|
58482
|
+
const itemsRef = useRef29(items);
|
|
58483
|
+
const updateRef = useRef29(null);
|
|
58484
|
+
useEffect27(() => {
|
|
58408
58485
|
itemsRef.current = items;
|
|
58409
58486
|
updateRef.current?.();
|
|
58410
58487
|
}, [items]);
|
|
58411
|
-
|
|
58488
|
+
useEffect27(() => {
|
|
58412
58489
|
const scroller = scrollRef.current;
|
|
58413
58490
|
const root = rootRef.current;
|
|
58414
58491
|
if (!scroller || !root) return;
|
|
@@ -58452,7 +58529,7 @@ function ViewportTurnBridge({
|
|
|
58452
58529
|
var VIEWPORT_ACTIVE_OFFSET = 8;
|
|
58453
58530
|
function StopAutoScrollBridge({ stopRef }) {
|
|
58454
58531
|
const { stopScroll } = useStickToBottomContext();
|
|
58455
|
-
|
|
58532
|
+
useEffect27(() => {
|
|
58456
58533
|
stopRef.current = stopScroll;
|
|
58457
58534
|
return () => {
|
|
58458
58535
|
stopRef.current = null;
|
|
@@ -58462,7 +58539,7 @@ function StopAutoScrollBridge({ stopRef }) {
|
|
|
58462
58539
|
}
|
|
58463
58540
|
|
|
58464
58541
|
// src/components/ChatSurface.tsx
|
|
58465
|
-
import { jsx as
|
|
58542
|
+
import { jsx as jsx31, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
58466
58543
|
function themeAttr(theme) {
|
|
58467
58544
|
return theme === "dark" ? "dark" : void 0;
|
|
58468
58545
|
}
|
|
@@ -58502,7 +58579,7 @@ function ChatSurface({
|
|
|
58502
58579
|
onRevealingChange,
|
|
58503
58580
|
isReplay
|
|
58504
58581
|
}) {
|
|
58505
|
-
const [pending, setPending] =
|
|
58582
|
+
const [pending, setPending] = useState36([]);
|
|
58506
58583
|
const currentPending = pending.filter((item) => item.sessionId === sessionId);
|
|
58507
58584
|
const sendWithApps = async (text4) => {
|
|
58508
58585
|
const content3 = [...currentPending.map((item) => `[${item.label}]
|
|
@@ -58520,7 +58597,7 @@ ${item.content}`), text4].filter(Boolean).join("\n\n");
|
|
|
58520
58597
|
return current ? parsePlanUpdate(current.arguments) : null;
|
|
58521
58598
|
}, [messages, renderers?.planUpdate]);
|
|
58522
58599
|
const customPlan = planForRenderer ? renderers?.planUpdate?.({ plan: planForRenderer, running: isStreaming, sessionId }) : void 0;
|
|
58523
|
-
return /* @__PURE__ */
|
|
58600
|
+
return /* @__PURE__ */ jsx31(McpAppMessageContext.Provider, { value: (message) => {
|
|
58524
58601
|
if (!sessionId || message.sessionId !== sessionId || isViewer) throw new Error("\u5F53\u524D\u4F1A\u8BDD\u4E0D\u80FD\u63A5\u6536\u5E94\u7528\u6D88\u606F");
|
|
58525
58602
|
setPending((items) => [...items, { ...message, sessionId, id: randomId() }]);
|
|
58526
58603
|
}, children: /* @__PURE__ */ jsxs25(
|
|
@@ -58533,7 +58610,7 @@ ${item.content}`), text4].filter(Boolean).join("\n\n");
|
|
|
58533
58610
|
classNames?.root
|
|
58534
58611
|
),
|
|
58535
58612
|
children: [
|
|
58536
|
-
/* @__PURE__ */
|
|
58613
|
+
/* @__PURE__ */ jsx31(ConnectionBanner, { connection, className: classNames?.banner }),
|
|
58537
58614
|
banner,
|
|
58538
58615
|
errorMessage && /* @__PURE__ */ jsxs25(
|
|
58539
58616
|
"div",
|
|
@@ -58541,13 +58618,13 @@ ${item.content}`), text4].filter(Boolean).join("\n\n");
|
|
|
58541
58618
|
part: "error-bar",
|
|
58542
58619
|
className: cn("blade-chat-error-bar flex items-start gap-2 border-b px-4 py-3 text-sm", classNames?.errorBar),
|
|
58543
58620
|
children: [
|
|
58544
|
-
/* @__PURE__ */
|
|
58545
|
-
/* @__PURE__ */
|
|
58621
|
+
/* @__PURE__ */ jsx31(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
|
|
58622
|
+
/* @__PURE__ */ jsx31("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay2(errorMessage) })
|
|
58546
58623
|
]
|
|
58547
58624
|
}
|
|
58548
58625
|
),
|
|
58549
58626
|
slots?.header,
|
|
58550
|
-
/* @__PURE__ */
|
|
58627
|
+
/* @__PURE__ */ jsx31(
|
|
58551
58628
|
MessageList,
|
|
58552
58629
|
{
|
|
58553
58630
|
messages,
|
|
@@ -58573,7 +58650,7 @@ ${item.content}`), text4].filter(Boolean).join("\n\n");
|
|
|
58573
58650
|
turnNavigation
|
|
58574
58651
|
}
|
|
58575
58652
|
),
|
|
58576
|
-
showPlanUpdates ? customPlan ?? /* @__PURE__ */
|
|
58653
|
+
showPlanUpdates ? customPlan ?? /* @__PURE__ */ jsx31(
|
|
58577
58654
|
CurrentPlanPanel,
|
|
58578
58655
|
{
|
|
58579
58656
|
messages,
|
|
@@ -58584,15 +58661,15 @@ ${item.content}`), text4].filter(Boolean).join("\n\n");
|
|
|
58584
58661
|
}
|
|
58585
58662
|
) : null,
|
|
58586
58663
|
beforeInput,
|
|
58587
|
-
/* @__PURE__ */
|
|
58664
|
+
/* @__PURE__ */ jsx31(QueuePanelAdjacencyContext.Provider, { value: currentPending.length === 0, children: queuePanel }),
|
|
58588
58665
|
currentPending.map((item) => /* @__PURE__ */ jsxs25("div", { style: { display: "flex", gap: 8, padding: "8px 16px" }, children: [
|
|
58589
58666
|
/* @__PURE__ */ jsxs25("details", { style: { flex: 1, minWidth: 0 }, children: [
|
|
58590
|
-
/* @__PURE__ */
|
|
58591
|
-
/* @__PURE__ */
|
|
58667
|
+
/* @__PURE__ */ jsx31("summary", { children: item.label }),
|
|
58668
|
+
/* @__PURE__ */ jsx31("pre", { style: { whiteSpace: "pre-wrap", overflowWrap: "anywhere" }, children: item.content })
|
|
58592
58669
|
] }),
|
|
58593
|
-
/* @__PURE__ */
|
|
58670
|
+
/* @__PURE__ */ jsx31("button", { type: "button", "aria-label": "\u79FB\u9664\u5F85\u53D1\u9001\u5185\u5BB9", title: "\u79FB\u9664", onClick: () => setPending((items) => items.filter((other) => other.id !== item.id)), children: /* @__PURE__ */ jsx31(X, { size: 16 }) })
|
|
58594
58671
|
] }, item.id)),
|
|
58595
|
-
/* @__PURE__ */
|
|
58672
|
+
/* @__PURE__ */ jsx31(
|
|
58596
58673
|
ChatInput,
|
|
58597
58674
|
{
|
|
58598
58675
|
value: inputText,
|
|
@@ -58619,13 +58696,13 @@ ${item.content}`), text4].filter(Boolean).join("\n\n");
|
|
|
58619
58696
|
}
|
|
58620
58697
|
|
|
58621
58698
|
// src/components/AgentChat.tsx
|
|
58622
|
-
import { Fragment as Fragment9, jsx as
|
|
58699
|
+
import { Fragment as Fragment9, jsx as jsx32, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
58623
58700
|
function isUnauthorizedError(error61) {
|
|
58624
58701
|
return error61 instanceof BladeApiError2 && error61.status === 401;
|
|
58625
58702
|
}
|
|
58626
58703
|
function LoginCard({ client, onLoggedIn }) {
|
|
58627
|
-
const [loggingIn, setLoggingIn] =
|
|
58628
|
-
const [loginError, setLoginError] =
|
|
58704
|
+
const [loggingIn, setLoggingIn] = useState37(false);
|
|
58705
|
+
const [loginError, setLoginError] = useState37(null);
|
|
58629
58706
|
const handleLogin = async () => {
|
|
58630
58707
|
setLoggingIn(true);
|
|
58631
58708
|
setLoginError(null);
|
|
@@ -58638,11 +58715,11 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
58638
58715
|
setLoggingIn(false);
|
|
58639
58716
|
}
|
|
58640
58717
|
};
|
|
58641
|
-
return /* @__PURE__ */
|
|
58642
|
-
/* @__PURE__ */
|
|
58643
|
-
/* @__PURE__ */
|
|
58644
|
-
/* @__PURE__ */
|
|
58645
|
-
/* @__PURE__ */
|
|
58718
|
+
return /* @__PURE__ */ jsx32("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs26("div", { className: "flex w-full max-w-sm flex-col items-center gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-6 py-8 text-center", children: [
|
|
58719
|
+
/* @__PURE__ */ jsx32(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
|
|
58720
|
+
/* @__PURE__ */ jsx32("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
|
|
58721
|
+
/* @__PURE__ */ jsx32("div", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u767B\u5F55\u540E\u5373\u53EF\u4E0E\u667A\u80FD\u4F53\u5BF9\u8BDD\uFF0C\u4F60\u7684\u4F1A\u8BDD\u5185\u5BB9\u4EC5\u81EA\u5DF1\u53EF\u89C1\u3002" }),
|
|
58722
|
+
/* @__PURE__ */ jsx32(
|
|
58646
58723
|
"button",
|
|
58647
58724
|
{
|
|
58648
58725
|
type: "button",
|
|
@@ -58652,21 +58729,21 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
58652
58729
|
children: loggingIn ? "\u767B\u5F55\u4E2D\u2026" : "\u767B\u5F55"
|
|
58653
58730
|
}
|
|
58654
58731
|
),
|
|
58655
|
-
loginError && /* @__PURE__ */
|
|
58732
|
+
loginError && /* @__PURE__ */ jsx32("div", { className: "text-xs text-[hsl(var(--destructive))]", children: loginError })
|
|
58656
58733
|
] }) });
|
|
58657
58734
|
}
|
|
58658
58735
|
function AgentChat(props) {
|
|
58659
58736
|
const client = useBladeClient();
|
|
58660
|
-
const [attempt, setAttempt] =
|
|
58661
|
-
const [needLogin, setNeedLogin] =
|
|
58737
|
+
const [attempt, setAttempt] = useState37(0);
|
|
58738
|
+
const [needLogin, setNeedLogin] = useState37(() => !client.hasToken());
|
|
58662
58739
|
if (needLogin) {
|
|
58663
|
-
return /* @__PURE__ */
|
|
58740
|
+
return /* @__PURE__ */ jsx32(
|
|
58664
58741
|
"div",
|
|
58665
58742
|
{
|
|
58666
58743
|
"data-theme": themeAttr(props.theme),
|
|
58667
58744
|
part: "root",
|
|
58668
58745
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col", props.classNames?.root),
|
|
58669
|
-
children: /* @__PURE__ */
|
|
58746
|
+
children: /* @__PURE__ */ jsx32(
|
|
58670
58747
|
LoginCard,
|
|
58671
58748
|
{
|
|
58672
58749
|
client,
|
|
@@ -58679,7 +58756,7 @@ function AgentChat(props) {
|
|
|
58679
58756
|
}
|
|
58680
58757
|
);
|
|
58681
58758
|
}
|
|
58682
|
-
return /* @__PURE__ */
|
|
58759
|
+
return /* @__PURE__ */ jsx32(ChatSessionView, { ...props, onUnauthorized: () => setNeedLogin(true) }, attempt);
|
|
58683
58760
|
}
|
|
58684
58761
|
function ChatSessionView({
|
|
58685
58762
|
sessionId,
|
|
@@ -58697,7 +58774,7 @@ function ChatSessionView({
|
|
|
58697
58774
|
onUnauthorized
|
|
58698
58775
|
}) {
|
|
58699
58776
|
const client = useBladeClient();
|
|
58700
|
-
const [planRevealRevisions, setPlanRevealRevisions] =
|
|
58777
|
+
const [planRevealRevisions, setPlanRevealRevisions] = useState37(
|
|
58701
58778
|
() => /* @__PURE__ */ new Map()
|
|
58702
58779
|
);
|
|
58703
58780
|
const handleSessionConnected = useCallback30((connectedSession) => {
|
|
@@ -58718,24 +58795,24 @@ function ChatSessionView({
|
|
|
58718
58795
|
onSessionConnected: handleSessionConnected
|
|
58719
58796
|
});
|
|
58720
58797
|
const replay = useReplay(session);
|
|
58721
|
-
const [stopRequested, setStopRequested] =
|
|
58722
|
-
const [isRevealing, setIsRevealing] =
|
|
58723
|
-
const [inputText, setInputText] =
|
|
58724
|
-
const [queueNotice, setQueueNotice] =
|
|
58725
|
-
const [queuePendingItemId, setQueuePendingItemId] =
|
|
58726
|
-
const [queuePanelVisible, setQueuePanelVisible] =
|
|
58727
|
-
const [resultFeedback, setResultFeedback] =
|
|
58728
|
-
const [timelineRewrite, setTimelineRewrite] =
|
|
58798
|
+
const [stopRequested, setStopRequested] = useState37(false);
|
|
58799
|
+
const [isRevealing, setIsRevealing] = useState37(false);
|
|
58800
|
+
const [inputText, setInputText] = useState37("");
|
|
58801
|
+
const [queueNotice, setQueueNotice] = useState37(null);
|
|
58802
|
+
const [queuePendingItemId, setQueuePendingItemId] = useState37(null);
|
|
58803
|
+
const [queuePanelVisible, setQueuePanelVisible] = useState37(false);
|
|
58804
|
+
const [resultFeedback, setResultFeedback] = useState37([]);
|
|
58805
|
+
const [timelineRewrite, setTimelineRewrite] = useState37(0);
|
|
58729
58806
|
const resolvedSessionId = session?.sessionId;
|
|
58730
58807
|
const isViewer = state?.viewerRole === "viewer";
|
|
58731
58808
|
const canUseQueue = !isViewer;
|
|
58732
|
-
const onSessionReadyRef =
|
|
58733
|
-
const readySessionRef =
|
|
58809
|
+
const onSessionReadyRef = useRef30(onSessionReady);
|
|
58810
|
+
const readySessionRef = useRef30(null);
|
|
58734
58811
|
const hasOnSessionReady = onSessionReady !== void 0;
|
|
58735
|
-
|
|
58812
|
+
useEffect28(() => {
|
|
58736
58813
|
onSessionReadyRef.current = onSessionReady;
|
|
58737
58814
|
}, [onSessionReady]);
|
|
58738
|
-
|
|
58815
|
+
useEffect28(() => {
|
|
58739
58816
|
setResultFeedback([]);
|
|
58740
58817
|
if (!resolvedSessionId || isViewer) return;
|
|
58741
58818
|
let cancelled = false;
|
|
@@ -58770,13 +58847,13 @@ function ChatSessionView({
|
|
|
58770
58847
|
saved
|
|
58771
58848
|
]);
|
|
58772
58849
|
}, []);
|
|
58773
|
-
|
|
58850
|
+
useEffect28(() => {
|
|
58774
58851
|
const handler = onSessionReadyRef.current;
|
|
58775
58852
|
if (!session || !hasOnSessionReady || !handler || readySessionRef.current === session) return;
|
|
58776
58853
|
readySessionRef.current = session;
|
|
58777
58854
|
handler(session);
|
|
58778
58855
|
}, [session, hasOnSessionReady]);
|
|
58779
|
-
|
|
58856
|
+
useEffect28(() => {
|
|
58780
58857
|
if (!session) return;
|
|
58781
58858
|
const offAttach = session.on("attachRequested", ({ label, content: content3 }) => {
|
|
58782
58859
|
setInputText((prev) => `${prev ? `${prev}
|
|
@@ -58796,12 +58873,12 @@ ${content3}`);
|
|
|
58796
58873
|
offRewind();
|
|
58797
58874
|
};
|
|
58798
58875
|
}, [session]);
|
|
58799
|
-
|
|
58876
|
+
useEffect28(() => {
|
|
58800
58877
|
if (isUnauthorizedError(error61)) {
|
|
58801
58878
|
onUnauthorized();
|
|
58802
58879
|
}
|
|
58803
58880
|
}, [error61, onUnauthorized]);
|
|
58804
|
-
|
|
58881
|
+
useEffect28(() => {
|
|
58805
58882
|
if (!session || !commands) return;
|
|
58806
58883
|
const unsubscribes = Object.entries(commands).map(
|
|
58807
58884
|
([action, handler]) => session.onCommand(action, (payload) => handler(payload))
|
|
@@ -58867,7 +58944,7 @@ ${content3}`);
|
|
|
58867
58944
|
next[to] = item.id;
|
|
58868
58945
|
handleQueueReorder(next);
|
|
58869
58946
|
};
|
|
58870
|
-
return /* @__PURE__ */
|
|
58947
|
+
return /* @__PURE__ */ jsx32(
|
|
58871
58948
|
ChatSurface,
|
|
58872
58949
|
{
|
|
58873
58950
|
theme,
|
|
@@ -58878,8 +58955,8 @@ ${content3}`);
|
|
|
58878
58955
|
placeholder,
|
|
58879
58956
|
connection: state?.connection ?? "connecting",
|
|
58880
58957
|
banner: /* @__PURE__ */ jsxs26(Fragment9, { children: [
|
|
58881
|
-
resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : /* @__PURE__ */
|
|
58882
|
-
/* @__PURE__ */
|
|
58958
|
+
resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : /* @__PURE__ */ jsx32(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
|
|
58959
|
+
/* @__PURE__ */ jsx32(
|
|
58883
58960
|
ReplayBar,
|
|
58884
58961
|
{
|
|
58885
58962
|
isReplay: replay.isReplay,
|
|
@@ -58889,7 +58966,7 @@ ${content3}`);
|
|
|
58889
58966
|
onExit: () => void replay.exitToAutonomous()
|
|
58890
58967
|
}
|
|
58891
58968
|
),
|
|
58892
|
-
/* @__PURE__ */
|
|
58969
|
+
/* @__PURE__ */ jsx32(ReplayMismatchPrompt, { mismatch: replay.mismatch })
|
|
58893
58970
|
] }),
|
|
58894
58971
|
errorMessage,
|
|
58895
58972
|
messages: state?.messages ?? [],
|
|
@@ -58901,7 +58978,7 @@ ${content3}`);
|
|
|
58901
58978
|
planRevealRevision,
|
|
58902
58979
|
queuePanel: (
|
|
58903
58980
|
// 只读身份不能操作队列,藏起来免得每个按钮都弹冲突。
|
|
58904
|
-
canUseQueue ? /* @__PURE__ */
|
|
58981
|
+
canUseQueue ? /* @__PURE__ */ jsx32(
|
|
58905
58982
|
SessionQueuePanel,
|
|
58906
58983
|
{
|
|
58907
58984
|
rootClassName: classNames?.queuePanel,
|
|
@@ -58973,11 +59050,11 @@ ${content3}`);
|
|
|
58973
59050
|
}
|
|
58974
59051
|
|
|
58975
59052
|
// src/components/LlmChat.tsx
|
|
58976
|
-
import { useEffect as
|
|
59053
|
+
import { useEffect as useEffect29, useMemo as useMemo19, useState as useState39 } from "react";
|
|
58977
59054
|
|
|
58978
59055
|
// src/components/LlmAdvancedSettings.tsx
|
|
58979
|
-
import { useState as
|
|
58980
|
-
import { jsx as
|
|
59056
|
+
import { useState as useState38 } from "react";
|
|
59057
|
+
import { jsx as jsx33, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
58981
59058
|
var FIELDS = [
|
|
58982
59059
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
58983
59060
|
{ id: "model", label: "\u6A21\u578B", placeholder: "\u6A21\u578B\u540D\u79F0" },
|
|
@@ -59023,8 +59100,8 @@ function writeOverride(settings, baseURL, override) {
|
|
|
59023
59100
|
}
|
|
59024
59101
|
function LlmAdvancedSettingsBar({ settings, defaults: defaults2, override, onChange }) {
|
|
59025
59102
|
const normalized = normalizeAdvanced(settings);
|
|
59026
|
-
const [open2, setOpen] =
|
|
59027
|
-
const [draft, setDraft] =
|
|
59103
|
+
const [open2, setOpen] = useState38(false);
|
|
59104
|
+
const [draft, setDraft] = useState38(override);
|
|
59028
59105
|
if (!normalized) return null;
|
|
59029
59106
|
const fields2 = FIELDS.filter((field) => normalized[field.id]);
|
|
59030
59107
|
const dirty = Object.keys(override).length > 0;
|
|
@@ -59039,16 +59116,16 @@ function LlmAdvancedSettingsBar({ settings, defaults: defaults2, override, onCha
|
|
|
59039
59116
|
},
|
|
59040
59117
|
className: "flex items-center gap-1.5 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
59041
59118
|
children: [
|
|
59042
|
-
/* @__PURE__ */
|
|
59119
|
+
/* @__PURE__ */ jsx33(Settings2, { size: 13 }),
|
|
59043
59120
|
"\u9AD8\u7EA7\u8BBE\u7F6E",
|
|
59044
|
-
dirty && /* @__PURE__ */
|
|
59121
|
+
dirty && /* @__PURE__ */ jsx33("span", { className: "text-[hsl(var(--primary))]", children: "\uFF08\u5DF2\u81EA\u5B9A\u4E49\uFF09" })
|
|
59045
59122
|
]
|
|
59046
59123
|
}
|
|
59047
59124
|
),
|
|
59048
59125
|
open2 && /* @__PURE__ */ jsxs27("div", { className: "mt-2 flex flex-col gap-2", children: [
|
|
59049
59126
|
fields2.map((field) => /* @__PURE__ */ jsxs27("label", { className: "flex flex-col gap-1", children: [
|
|
59050
|
-
/* @__PURE__ */
|
|
59051
|
-
/* @__PURE__ */
|
|
59127
|
+
/* @__PURE__ */ jsx33("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
|
|
59128
|
+
/* @__PURE__ */ jsx33(
|
|
59052
59129
|
"input",
|
|
59053
59130
|
{
|
|
59054
59131
|
type: field.secret ? "password" : "text",
|
|
@@ -59059,9 +59136,9 @@ function LlmAdvancedSettingsBar({ settings, defaults: defaults2, override, onCha
|
|
|
59059
59136
|
}
|
|
59060
59137
|
)
|
|
59061
59138
|
] }, field.id)),
|
|
59062
|
-
normalized.apiKey && /* @__PURE__ */
|
|
59139
|
+
normalized.apiKey && /* @__PURE__ */ jsx33("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u5BC6\u94A5\u4F1A\u5B58\u5728\u8FD9\u53F0\u6D4F\u89C8\u5668\u91CC\u3002\u53EA\u5728\u4F60\u4FE1\u5F97\u8FC7\u8FD9\u53F0\u673A\u5668\u65F6\u586B\u3002" }),
|
|
59063
59140
|
/* @__PURE__ */ jsxs27("div", { className: "flex gap-2", children: [
|
|
59064
|
-
/* @__PURE__ */
|
|
59141
|
+
/* @__PURE__ */ jsx33(
|
|
59065
59142
|
"button",
|
|
59066
59143
|
{
|
|
59067
59144
|
type: "button",
|
|
@@ -59076,7 +59153,7 @@ function LlmAdvancedSettingsBar({ settings, defaults: defaults2, override, onCha
|
|
|
59076
59153
|
children: "\u4FDD\u5B58"
|
|
59077
59154
|
}
|
|
59078
59155
|
),
|
|
59079
|
-
/* @__PURE__ */
|
|
59156
|
+
/* @__PURE__ */ jsx33(
|
|
59080
59157
|
"button",
|
|
59081
59158
|
{
|
|
59082
59159
|
type: "button",
|
|
@@ -59095,7 +59172,7 @@ function LlmAdvancedSettingsBar({ settings, defaults: defaults2, override, onCha
|
|
|
59095
59172
|
}
|
|
59096
59173
|
|
|
59097
59174
|
// src/components/LlmChat.tsx
|
|
59098
|
-
import { jsx as
|
|
59175
|
+
import { jsx as jsx34 } from "react/jsx-runtime";
|
|
59099
59176
|
function LlmChat({
|
|
59100
59177
|
classNames,
|
|
59101
59178
|
renderers,
|
|
@@ -59107,12 +59184,12 @@ function LlmChat({
|
|
|
59107
59184
|
onOverrideChange,
|
|
59108
59185
|
...options
|
|
59109
59186
|
}) {
|
|
59110
|
-
const [override, setOverride] =
|
|
59187
|
+
const [override, setOverride] = useState39(() => readOverride(advanced, options.baseURL));
|
|
59111
59188
|
const effective = { ...options, ...override };
|
|
59112
59189
|
const { messages, isStreaming, error: error61, send, stop, reset } = useLlmChat(effective);
|
|
59113
|
-
const [inputText, setInputText] =
|
|
59114
|
-
const [stopRequested, setStopRequested] =
|
|
59115
|
-
const [isRevealing, setIsRevealing] =
|
|
59190
|
+
const [inputText, setInputText] = useState39("");
|
|
59191
|
+
const [stopRequested, setStopRequested] = useState39(false);
|
|
59192
|
+
const [isRevealing, setIsRevealing] = useState39(false);
|
|
59116
59193
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
59117
59194
|
const handle = useMemo19(
|
|
59118
59195
|
() => ({
|
|
@@ -59123,10 +59200,10 @@ ${text4}` : text4),
|
|
|
59123
59200
|
}),
|
|
59124
59201
|
[send, reset]
|
|
59125
59202
|
);
|
|
59126
|
-
|
|
59203
|
+
useEffect29(() => {
|
|
59127
59204
|
onReady?.(handle);
|
|
59128
59205
|
}, [handle, onReady]);
|
|
59129
|
-
return /* @__PURE__ */
|
|
59206
|
+
return /* @__PURE__ */ jsx34(
|
|
59130
59207
|
ChatSurface,
|
|
59131
59208
|
{
|
|
59132
59209
|
theme,
|
|
@@ -59152,7 +59229,7 @@ ${text4}` : text4),
|
|
|
59152
59229
|
setStopRequested(true);
|
|
59153
59230
|
stop();
|
|
59154
59231
|
},
|
|
59155
|
-
beforeInput: advanced ? /* @__PURE__ */
|
|
59232
|
+
beforeInput: advanced ? /* @__PURE__ */ jsx34(
|
|
59156
59233
|
LlmAdvancedSettingsBar,
|
|
59157
59234
|
{
|
|
59158
59235
|
settings: advanced,
|
|
@@ -59170,14 +59247,14 @@ ${text4}` : text4),
|
|
|
59170
59247
|
}
|
|
59171
59248
|
|
|
59172
59249
|
// src/components/ChatView.tsx
|
|
59173
|
-
import { jsx as
|
|
59250
|
+
import { jsx as jsx35 } from "react/jsx-runtime";
|
|
59174
59251
|
function ChatView(props) {
|
|
59175
59252
|
const { mode, llm, onLlmReady, ...rest } = props;
|
|
59176
59253
|
if (mode === "llm") {
|
|
59177
59254
|
if (!llm) {
|
|
59178
59255
|
throw new Error('ChatView: mode="llm" \u9700\u8981\u540C\u65F6\u4F20 llm={{ baseURL, model }}');
|
|
59179
59256
|
}
|
|
59180
|
-
return /* @__PURE__ */
|
|
59257
|
+
return /* @__PURE__ */ jsx35(
|
|
59181
59258
|
LlmChat,
|
|
59182
59259
|
{
|
|
59183
59260
|
...llm,
|
|
@@ -59190,11 +59267,11 @@ function ChatView(props) {
|
|
|
59190
59267
|
}
|
|
59191
59268
|
);
|
|
59192
59269
|
}
|
|
59193
|
-
return /* @__PURE__ */
|
|
59270
|
+
return /* @__PURE__ */ jsx35(AgentChat, { ...rest });
|
|
59194
59271
|
}
|
|
59195
59272
|
|
|
59196
59273
|
// src/components/ConnectorPanel.tsx
|
|
59197
|
-
import { useCallback as useCallback31, useEffect as
|
|
59274
|
+
import { useCallback as useCallback31, useEffect as useEffect30, useMemo as useMemo20, useRef as useRef31, useState as useState40 } from "react";
|
|
59198
59275
|
|
|
59199
59276
|
// src/components/connector-panel-types.ts
|
|
59200
59277
|
function selectionFromItem(item) {
|
|
@@ -59216,12 +59293,12 @@ function triggerSummary(items) {
|
|
|
59216
59293
|
}
|
|
59217
59294
|
|
|
59218
59295
|
// src/components/ConnectorPanel.tsx
|
|
59219
|
-
import { Fragment as Fragment10, jsx as
|
|
59296
|
+
import { Fragment as Fragment10, jsx as jsx36, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
59220
59297
|
function PanelDivider() {
|
|
59221
|
-
return /* @__PURE__ */
|
|
59298
|
+
return /* @__PURE__ */ jsx36("div", { className: "my-1 border-[hsl(var(--border))] border-t" });
|
|
59222
59299
|
}
|
|
59223
59300
|
function PanelTitle({ children }) {
|
|
59224
|
-
return /* @__PURE__ */
|
|
59301
|
+
return /* @__PURE__ */ jsx36("div", { className: "px-3 pt-1 pb-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children });
|
|
59225
59302
|
}
|
|
59226
59303
|
function ConnectorPanel({
|
|
59227
59304
|
client,
|
|
@@ -59237,10 +59314,10 @@ function ConnectorPanel({
|
|
|
59237
59314
|
visibleSections = ["plugins", "computers", "accounts"],
|
|
59238
59315
|
className
|
|
59239
59316
|
}) {
|
|
59240
|
-
const [query, setQuery] =
|
|
59241
|
-
const [pendingCatalog, setPendingCatalog] =
|
|
59242
|
-
const [pendingLoading, setPendingLoading] =
|
|
59243
|
-
const [pendingError, setPendingError] =
|
|
59317
|
+
const [query, setQuery] = useState40("");
|
|
59318
|
+
const [pendingCatalog, setPendingCatalog] = useState40(null);
|
|
59319
|
+
const [pendingLoading, setPendingLoading] = useState40(false);
|
|
59320
|
+
const [pendingError, setPendingError] = useState40(false);
|
|
59244
59321
|
const activation = useSessionPluginActivation({
|
|
59245
59322
|
client,
|
|
59246
59323
|
// 首页不会走这个分支:待选在下面自己处理开关,不碰会话接口。
|
|
@@ -59248,7 +59325,7 @@ function ConnectorPanel({
|
|
|
59248
59325
|
onChange: onPluginsChanged
|
|
59249
59326
|
});
|
|
59250
59327
|
const { reload, items: sessionItems } = activation;
|
|
59251
|
-
|
|
59328
|
+
useEffect30(() => {
|
|
59252
59329
|
if (sessionId) reload();
|
|
59253
59330
|
}, [reload, sessionId]);
|
|
59254
59331
|
const loadPendingCatalog = useCallback31(async () => {
|
|
@@ -59263,7 +59340,7 @@ function ConnectorPanel({
|
|
|
59263
59340
|
setPendingLoading(false);
|
|
59264
59341
|
}
|
|
59265
59342
|
}, [client]);
|
|
59266
|
-
|
|
59343
|
+
useEffect30(() => {
|
|
59267
59344
|
if (sessionId) return;
|
|
59268
59345
|
void loadPendingCatalog();
|
|
59269
59346
|
}, [loadPendingCatalog, sessionId]);
|
|
@@ -59294,20 +59371,20 @@ function ConnectorPanel({
|
|
|
59294
59371
|
() => items.filter((item) => item.active),
|
|
59295
59372
|
[items]
|
|
59296
59373
|
);
|
|
59297
|
-
const onSelectedChangeRef =
|
|
59374
|
+
const onSelectedChangeRef = useRef31(onSelectedChange);
|
|
59298
59375
|
onSelectedChangeRef.current = onSelectedChange;
|
|
59299
|
-
const latestSelected =
|
|
59376
|
+
const latestSelected = useRef31(selectedItems);
|
|
59300
59377
|
latestSelected.current = selectedItems;
|
|
59301
59378
|
const reportSelected = useCallback31(() => {
|
|
59302
59379
|
onSelectedChangeRef.current?.(latestSelected.current);
|
|
59303
59380
|
}, []);
|
|
59304
59381
|
const selectedNames = selectedItems.map((item) => item.name).join("\0");
|
|
59305
|
-
|
|
59382
|
+
useEffect30(reportSelected, [reportSelected, selectedNames]);
|
|
59306
59383
|
const failed = sessionId ? activation.listError : pendingError;
|
|
59307
59384
|
return /* @__PURE__ */ jsxs28("div", { className, children: [
|
|
59308
59385
|
/* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 border-[hsl(var(--border))] border-b px-3 py-2", children: [
|
|
59309
|
-
/* @__PURE__ */
|
|
59310
|
-
/* @__PURE__ */
|
|
59386
|
+
/* @__PURE__ */ jsx36(Search, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]", "aria-hidden": "true" }),
|
|
59387
|
+
/* @__PURE__ */ jsx36(
|
|
59311
59388
|
"input",
|
|
59312
59389
|
{
|
|
59313
59390
|
value: query,
|
|
@@ -59319,22 +59396,22 @@ function ConnectorPanel({
|
|
|
59319
59396
|
)
|
|
59320
59397
|
] }),
|
|
59321
59398
|
visibleSections.includes("computers") && renderComputerSection ? /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
59322
|
-
/* @__PURE__ */
|
|
59399
|
+
/* @__PURE__ */ jsx36(PanelTitle, { children: "\u7535\u8111" }),
|
|
59323
59400
|
renderComputerSection(query)
|
|
59324
59401
|
] }) : null,
|
|
59325
59402
|
visibleSections.includes("plugins") ? /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
59326
|
-
/* @__PURE__ */
|
|
59327
|
-
/* @__PURE__ */
|
|
59403
|
+
/* @__PURE__ */ jsx36(PanelDivider, {}),
|
|
59404
|
+
/* @__PURE__ */ jsx36(PanelTitle, { children: "\u63D2\u4EF6" }),
|
|
59328
59405
|
!sessionId ? (
|
|
59329
59406
|
// 首页没有会话,开关只记下「这条消息要带上谁」:不说清楚,用户会以为已经
|
|
59330
59407
|
// 生效(issue 明确要求「明确为待选,不宣称已经激活」)。
|
|
59331
|
-
/* @__PURE__ */
|
|
59408
|
+
/* @__PURE__ */ jsx36("div", { className: "px-3 pb-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: "\u5148\u9009\u4E2D\uFF0C\u53D1\u9001\u8FD9\u6761\u6D88\u606F\u65F6\u4F1A\u4E00\u5E76\u542F\u7528" })
|
|
59332
59409
|
) : null,
|
|
59333
59410
|
(sessionId ? activation.loading : pendingLoading) && visibleItems.length === 0 ? /* @__PURE__ */ jsxs28("div", { className: "px-3 py-1.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
59334
|
-
/* @__PURE__ */
|
|
59411
|
+
/* @__PURE__ */ jsx36(LoaderCircle, { size: 12, className: "mr-1 inline animate-spin" }),
|
|
59335
59412
|
"\u6B63\u5728\u83B7\u53D6\u63D2\u4EF6\u2026"
|
|
59336
59413
|
] }) : null,
|
|
59337
|
-
failed ? /* @__PURE__ */
|
|
59414
|
+
failed ? /* @__PURE__ */ jsx36(
|
|
59338
59415
|
"button",
|
|
59339
59416
|
{
|
|
59340
59417
|
type: "button",
|
|
@@ -59343,7 +59420,7 @@ function ConnectorPanel({
|
|
|
59343
59420
|
children: "\u63D2\u4EF6\u5217\u8868\u6682\u4E0D\u53EF\u7528\uFF0C\u70B9\u51FB\u91CD\u8BD5"
|
|
59344
59421
|
}
|
|
59345
59422
|
) : null,
|
|
59346
|
-
/* @__PURE__ */
|
|
59423
|
+
/* @__PURE__ */ jsx36(
|
|
59347
59424
|
PluginConnectorList,
|
|
59348
59425
|
{
|
|
59349
59426
|
client,
|
|
@@ -59366,19 +59443,19 @@ function ConnectorPanel({
|
|
|
59366
59443
|
)
|
|
59367
59444
|
] }) : null,
|
|
59368
59445
|
visibleSections.includes("accounts") && renderExternalAccounts ? /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
59369
|
-
/* @__PURE__ */
|
|
59370
|
-
/* @__PURE__ */
|
|
59446
|
+
/* @__PURE__ */ jsx36(PanelDivider, {}),
|
|
59447
|
+
/* @__PURE__ */ jsx36(PanelTitle, { children: "\u5916\u90E8\u8D26\u53F7" }),
|
|
59371
59448
|
renderExternalAccounts(query)
|
|
59372
59449
|
] }) : null,
|
|
59373
59450
|
renderFooterActions ? /* @__PURE__ */ jsxs28(Fragment10, { children: [
|
|
59374
|
-
/* @__PURE__ */
|
|
59451
|
+
/* @__PURE__ */ jsx36(PanelDivider, {}),
|
|
59375
59452
|
renderFooterActions()
|
|
59376
59453
|
] }) : null
|
|
59377
59454
|
] });
|
|
59378
59455
|
}
|
|
59379
59456
|
|
|
59380
59457
|
// src/components/PluginTriggerStack.tsx
|
|
59381
|
-
import { jsx as
|
|
59458
|
+
import { jsx as jsx37, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
59382
59459
|
var AVATAR_SIZE = 20;
|
|
59383
59460
|
function hueOf(name) {
|
|
59384
59461
|
let hash2 = 0;
|
|
@@ -59402,7 +59479,7 @@ function PluginTriggerStack({ client, sessionId, summary, className }) {
|
|
|
59402
59479
|
summary.visible.map((item) => {
|
|
59403
59480
|
const label = item.displayName?.trim() || item.name;
|
|
59404
59481
|
const tone = AVATAR_PALETTE[hueOf(item.name) % AVATAR_PALETTE.length];
|
|
59405
|
-
return item.icon ? /* @__PURE__ */
|
|
59482
|
+
return item.icon ? /* @__PURE__ */ jsx37(
|
|
59406
59483
|
SessionPluginIcon,
|
|
59407
59484
|
{
|
|
59408
59485
|
client,
|
|
@@ -59413,7 +59490,7 @@ function PluginTriggerStack({ client, sessionId, summary, className }) {
|
|
|
59413
59490
|
className: ring
|
|
59414
59491
|
},
|
|
59415
59492
|
item.name
|
|
59416
|
-
) : /* @__PURE__ */
|
|
59493
|
+
) : /* @__PURE__ */ jsx37(
|
|
59417
59494
|
"span",
|
|
59418
59495
|
{
|
|
59419
59496
|
title: label,
|
|
@@ -59443,7 +59520,7 @@ import {
|
|
|
59443
59520
|
getContextDisplayState,
|
|
59444
59521
|
getContextGroupDisplayState
|
|
59445
59522
|
} from "@blade-hq/agent-client";
|
|
59446
|
-
import { jsx as
|
|
59523
|
+
import { jsx as jsx38, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
59447
59524
|
function ContextCard({ context, className }) {
|
|
59448
59525
|
const display = getContextDisplayState(context);
|
|
59449
59526
|
return /* @__PURE__ */ jsxs30(
|
|
@@ -59452,7 +59529,7 @@ function ContextCard({ context, className }) {
|
|
|
59452
59529
|
className: `blade-chat-context-card group/context-card overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`,
|
|
59453
59530
|
children: [
|
|
59454
59531
|
/* @__PURE__ */ jsxs30("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
|
|
59455
|
-
/* @__PURE__ */
|
|
59532
|
+
/* @__PURE__ */ jsx38(
|
|
59456
59533
|
Layers,
|
|
59457
59534
|
{
|
|
59458
59535
|
size: 15,
|
|
@@ -59461,10 +59538,10 @@ function ContextCard({ context, className }) {
|
|
|
59461
59538
|
}
|
|
59462
59539
|
),
|
|
59463
59540
|
/* @__PURE__ */ jsxs30("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
59464
|
-
/* @__PURE__ */
|
|
59465
|
-
/* @__PURE__ */
|
|
59541
|
+
/* @__PURE__ */ jsx38("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: display.title }),
|
|
59542
|
+
/* @__PURE__ */ jsx38("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: display.summary })
|
|
59466
59543
|
] }),
|
|
59467
|
-
/* @__PURE__ */
|
|
59544
|
+
/* @__PURE__ */ jsx38(
|
|
59468
59545
|
ChevronDown,
|
|
59469
59546
|
{
|
|
59470
59547
|
size: 14,
|
|
@@ -59473,7 +59550,7 @@ function ContextCard({ context, className }) {
|
|
|
59473
59550
|
}
|
|
59474
59551
|
)
|
|
59475
59552
|
] }),
|
|
59476
|
-
/* @__PURE__ */
|
|
59553
|
+
/* @__PURE__ */ jsx38("div", { className: "blade-chat-context-detail border-t border-[hsl(var(--border))] px-3 py-2.5 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: display.detail })
|
|
59477
59554
|
]
|
|
59478
59555
|
}
|
|
59479
59556
|
);
|
|
@@ -59484,7 +59561,7 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
59484
59561
|
const group = single ? null : getContextGroupDisplayState(contexts);
|
|
59485
59562
|
return /* @__PURE__ */ jsxs30("details", { className: `blade-chat-context-card group/context-group overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`, children: [
|
|
59486
59563
|
/* @__PURE__ */ jsxs30("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
|
|
59487
|
-
/* @__PURE__ */
|
|
59564
|
+
/* @__PURE__ */ jsx38(
|
|
59488
59565
|
Layers,
|
|
59489
59566
|
{
|
|
59490
59567
|
size: 15,
|
|
@@ -59493,10 +59570,10 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
59493
59570
|
}
|
|
59494
59571
|
),
|
|
59495
59572
|
/* @__PURE__ */ jsxs30("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
59496
|
-
/* @__PURE__ */
|
|
59497
|
-
/* @__PURE__ */
|
|
59573
|
+
/* @__PURE__ */ jsx38("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: single ? single.title : `${group?.title} \xB7 ${group?.count} \u9879` }),
|
|
59574
|
+
/* @__PURE__ */ jsx38("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: single ? single.summary : group?.summary })
|
|
59498
59575
|
] }),
|
|
59499
|
-
/* @__PURE__ */
|
|
59576
|
+
/* @__PURE__ */ jsx38(
|
|
59500
59577
|
ChevronDown,
|
|
59501
59578
|
{
|
|
59502
59579
|
size: 14,
|
|
@@ -59505,7 +59582,7 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
59505
59582
|
}
|
|
59506
59583
|
)
|
|
59507
59584
|
] }),
|
|
59508
|
-
single ? /* @__PURE__ */
|
|
59585
|
+
single ? /* @__PURE__ */ jsx38("div", { className: "blade-chat-context-detail border-t border-[hsl(var(--border))] px-3 py-2.5 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: single.detail }) : /* @__PURE__ */ jsx38("div", { className: "blade-chat-context-group-items flex flex-col gap-1.5 border-t border-[hsl(var(--border))] p-2", children: contexts.map((context) => /* @__PURE__ */ jsx38(
|
|
59509
59586
|
ContextCard,
|
|
59510
59587
|
{
|
|
59511
59588
|
context
|
|
@@ -59516,8 +59593,8 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
59516
59593
|
}
|
|
59517
59594
|
|
|
59518
59595
|
// src/components/SessionMemoryToggle.tsx
|
|
59519
|
-
import { useCallback as useCallback32, useEffect as
|
|
59520
|
-
import { jsx as
|
|
59596
|
+
import { useCallback as useCallback32, useEffect as useEffect31, useRef as useRef32, useState as useState41, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
59597
|
+
import { jsx as jsx39, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
59521
59598
|
var saveStates = /* @__PURE__ */ new WeakMap();
|
|
59522
59599
|
function getSaveState(client, sessionId) {
|
|
59523
59600
|
let clientStates = saveStates.get(client);
|
|
@@ -59574,10 +59651,10 @@ function SessionMemoryToggle({
|
|
|
59574
59651
|
getSaving,
|
|
59575
59652
|
getSaving
|
|
59576
59653
|
);
|
|
59577
|
-
const [draftEnabled, setDraftEnabled] =
|
|
59578
|
-
const activeSessionIdRef =
|
|
59654
|
+
const [draftEnabled, setDraftEnabled] = useState41(enabled);
|
|
59655
|
+
const activeSessionIdRef = useRef32(sessionId);
|
|
59579
59656
|
activeSessionIdRef.current = sessionId;
|
|
59580
|
-
|
|
59657
|
+
useEffect31(() => {
|
|
59581
59658
|
setDraftEnabled(enabled);
|
|
59582
59659
|
}, [enabled, sessionId]);
|
|
59583
59660
|
const update = useCallback32(
|
|
@@ -59607,8 +59684,8 @@ function SessionMemoryToggle({
|
|
|
59607
59684
|
[client, enabled, onError, onSaved, sessionId]
|
|
59608
59685
|
);
|
|
59609
59686
|
return /* @__PURE__ */ jsxs31("label", { className: cn("flex items-center justify-between", className), children: [
|
|
59610
|
-
/* @__PURE__ */
|
|
59611
|
-
/* @__PURE__ */
|
|
59687
|
+
/* @__PURE__ */ jsx39("span", { className: labelClassName, children: label }),
|
|
59688
|
+
/* @__PURE__ */ jsx39(
|
|
59612
59689
|
"input",
|
|
59613
59690
|
{
|
|
59614
59691
|
type: "checkbox",
|
|
@@ -59719,7 +59796,7 @@ function useComposedRefs(...refs) {
|
|
|
59719
59796
|
|
|
59720
59797
|
// ../../node_modules/.pnpm/@radix-ui+react-context@1.1.2_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-context/dist/index.mjs
|
|
59721
59798
|
import * as React3 from "react";
|
|
59722
|
-
import { jsx as
|
|
59799
|
+
import { jsx as jsx40 } from "react/jsx-runtime";
|
|
59723
59800
|
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
59724
59801
|
let defaultContexts = [];
|
|
59725
59802
|
function createContext32(rootComponentName, defaultContext) {
|
|
@@ -59730,7 +59807,7 @@ function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
|
59730
59807
|
const { scope, children, ...context } = props;
|
|
59731
59808
|
const Context = scope?.[scopeName]?.[index3] || BaseContext;
|
|
59732
59809
|
const value = React3.useMemo(() => context, Object.values(context));
|
|
59733
|
-
return /* @__PURE__ */
|
|
59810
|
+
return /* @__PURE__ */ jsx40(Context.Provider, { value, children });
|
|
59734
59811
|
};
|
|
59735
59812
|
Provider2.displayName = rootComponentName + "Provider";
|
|
59736
59813
|
function useContext22(consumerName, scope) {
|
|
@@ -59787,7 +59864,7 @@ import * as ReactDOM from "react-dom";
|
|
|
59787
59864
|
|
|
59788
59865
|
// ../../node_modules/.pnpm/@radix-ui+react-slot@1.2.3_@types+react@19.2.14_react@19.2.4/node_modules/@radix-ui/react-slot/dist/index.mjs
|
|
59789
59866
|
import * as React4 from "react";
|
|
59790
|
-
import { Fragment as Fragment22, jsx as
|
|
59867
|
+
import { Fragment as Fragment22, jsx as jsx41 } from "react/jsx-runtime";
|
|
59791
59868
|
// @__NO_SIDE_EFFECTS__
|
|
59792
59869
|
function createSlot(ownerName) {
|
|
59793
59870
|
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
@@ -59805,9 +59882,9 @@ function createSlot(ownerName) {
|
|
|
59805
59882
|
return child;
|
|
59806
59883
|
}
|
|
59807
59884
|
});
|
|
59808
|
-
return /* @__PURE__ */
|
|
59885
|
+
return /* @__PURE__ */ jsx41(SlotClone, { ...slotProps, ref: forwardedRef, children: React4.isValidElement(newElement) ? React4.cloneElement(newElement, void 0, newChildren) : null });
|
|
59809
59886
|
}
|
|
59810
|
-
return /* @__PURE__ */
|
|
59887
|
+
return /* @__PURE__ */ jsx41(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
59811
59888
|
});
|
|
59812
59889
|
Slot2.displayName = `${ownerName}.Slot`;
|
|
59813
59890
|
return Slot2;
|
|
@@ -59833,7 +59910,7 @@ var SLOTTABLE_IDENTIFIER = /* @__PURE__ */ Symbol("radix.slottable");
|
|
|
59833
59910
|
// @__NO_SIDE_EFFECTS__
|
|
59834
59911
|
function createSlottable(ownerName) {
|
|
59835
59912
|
const Slottable2 = ({ children }) => {
|
|
59836
|
-
return /* @__PURE__ */
|
|
59913
|
+
return /* @__PURE__ */ jsx41(Fragment22, { children });
|
|
59837
59914
|
};
|
|
59838
59915
|
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
59839
59916
|
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
@@ -59881,7 +59958,7 @@ function getElementRef(element2) {
|
|
|
59881
59958
|
}
|
|
59882
59959
|
|
|
59883
59960
|
// ../../node_modules/.pnpm/@radix-ui+react-primitive@2.1.3_@types+react-dom@19.2.3_@types+react@19.2.14__@types+re_1181ea5061ec9212248424669240e4ec/node_modules/@radix-ui/react-primitive/dist/index.mjs
|
|
59884
|
-
import { jsx as
|
|
59961
|
+
import { jsx as jsx42 } from "react/jsx-runtime";
|
|
59885
59962
|
var NODES = [
|
|
59886
59963
|
"a",
|
|
59887
59964
|
"button",
|
|
@@ -59909,7 +59986,7 @@ var Primitive = NODES.reduce((primitive, node3) => {
|
|
|
59909
59986
|
if (typeof window !== "undefined") {
|
|
59910
59987
|
window[/* @__PURE__ */ Symbol.for("radix-ui")] = true;
|
|
59911
59988
|
}
|
|
59912
|
-
return /* @__PURE__ */
|
|
59989
|
+
return /* @__PURE__ */ jsx42(Comp, { ...primitiveProps, ref: forwardedRef });
|
|
59913
59990
|
});
|
|
59914
59991
|
Node2.displayName = `Primitive.${node3}`;
|
|
59915
59992
|
return { ...primitive, [node3]: Node2 };
|
|
@@ -59944,7 +60021,7 @@ function useEscapeKeydown(onEscapeKeyDownProp, ownerDocument = globalThis?.docum
|
|
|
59944
60021
|
}
|
|
59945
60022
|
|
|
59946
60023
|
// ../../node_modules/.pnpm/@radix-ui+react-dismissable-layer@1.1.11_@types+react-dom@19.2.3_@types+react@19.2.14___3d3960154a4c07d09bb90cb341135fc5/node_modules/@radix-ui/react-dismissable-layer/dist/index.mjs
|
|
59947
|
-
import { jsx as
|
|
60024
|
+
import { jsx as jsx43 } from "react/jsx-runtime";
|
|
59948
60025
|
var DISMISSABLE_LAYER_NAME = "DismissableLayer";
|
|
59949
60026
|
var CONTEXT_UPDATE = "dismissableLayer.update";
|
|
59950
60027
|
var POINTER_DOWN_OUTSIDE = "dismissableLayer.pointerDownOutside";
|
|
@@ -60032,7 +60109,7 @@ var DismissableLayer = React8.forwardRef(
|
|
|
60032
60109
|
document.addEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
60033
60110
|
return () => document.removeEventListener(CONTEXT_UPDATE, handleUpdate);
|
|
60034
60111
|
}, []);
|
|
60035
|
-
return /* @__PURE__ */
|
|
60112
|
+
return /* @__PURE__ */ jsx43(
|
|
60036
60113
|
Primitive.div,
|
|
60037
60114
|
{
|
|
60038
60115
|
...layerProps,
|
|
@@ -60066,7 +60143,7 @@ var DismissableLayerBranch = React8.forwardRef((props, forwardedRef) => {
|
|
|
60066
60143
|
};
|
|
60067
60144
|
}
|
|
60068
60145
|
}, [context.branches]);
|
|
60069
|
-
return /* @__PURE__ */
|
|
60146
|
+
return /* @__PURE__ */ jsx43(Primitive.div, { ...props, ref: composedRefs });
|
|
60070
60147
|
});
|
|
60071
60148
|
DismissableLayerBranch.displayName = BRANCH_NAME;
|
|
60072
60149
|
function usePointerDownOutside(onPointerDownOutside, ownerDocument = globalThis?.document) {
|
|
@@ -62100,11 +62177,11 @@ var arrow3 = (options, deps) => {
|
|
|
62100
62177
|
|
|
62101
62178
|
// ../../node_modules/.pnpm/@radix-ui+react-arrow@1.1.7_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react@_e05f2c19a58a99fddf374207b5e3778c/node_modules/@radix-ui/react-arrow/dist/index.mjs
|
|
62102
62179
|
import * as React12 from "react";
|
|
62103
|
-
import { jsx as
|
|
62180
|
+
import { jsx as jsx44 } from "react/jsx-runtime";
|
|
62104
62181
|
var NAME = "Arrow";
|
|
62105
62182
|
var Arrow = React12.forwardRef((props, forwardedRef) => {
|
|
62106
62183
|
const { children, width = 10, height = 5, ...arrowProps } = props;
|
|
62107
|
-
return /* @__PURE__ */
|
|
62184
|
+
return /* @__PURE__ */ jsx44(
|
|
62108
62185
|
Primitive.svg,
|
|
62109
62186
|
{
|
|
62110
62187
|
...arrowProps,
|
|
@@ -62113,7 +62190,7 @@ var Arrow = React12.forwardRef((props, forwardedRef) => {
|
|
|
62113
62190
|
height,
|
|
62114
62191
|
viewBox: "0 0 30 10",
|
|
62115
62192
|
preserveAspectRatio: "none",
|
|
62116
|
-
children: props.asChild ? children : /* @__PURE__ */
|
|
62193
|
+
children: props.asChild ? children : /* @__PURE__ */ jsx44("polygon", { points: "0,0 30,0 15,10" })
|
|
62117
62194
|
}
|
|
62118
62195
|
);
|
|
62119
62196
|
});
|
|
@@ -62158,14 +62235,14 @@ function useSize(element2) {
|
|
|
62158
62235
|
}
|
|
62159
62236
|
|
|
62160
62237
|
// ../../node_modules/.pnpm/@radix-ui+react-popper@1.2.8_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react_13e0521d8aea7ebfbfb8bee1fb615c05/node_modules/@radix-ui/react-popper/dist/index.mjs
|
|
62161
|
-
import { jsx as
|
|
62238
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
62162
62239
|
var POPPER_NAME = "Popper";
|
|
62163
62240
|
var [createPopperContext, createPopperScope] = createContextScope(POPPER_NAME);
|
|
62164
62241
|
var [PopperProvider, usePopperContext] = createPopperContext(POPPER_NAME);
|
|
62165
62242
|
var Popper = (props) => {
|
|
62166
62243
|
const { __scopePopper, children } = props;
|
|
62167
62244
|
const [anchor2, setAnchor] = React14.useState(null);
|
|
62168
|
-
return /* @__PURE__ */
|
|
62245
|
+
return /* @__PURE__ */ jsx45(PopperProvider, { scope: __scopePopper, anchor: anchor2, onAnchorChange: setAnchor, children });
|
|
62169
62246
|
};
|
|
62170
62247
|
Popper.displayName = POPPER_NAME;
|
|
62171
62248
|
var ANCHOR_NAME = "PopperAnchor";
|
|
@@ -62183,7 +62260,7 @@ var PopperAnchor = React14.forwardRef(
|
|
|
62183
62260
|
context.onAnchorChange(anchorRef.current);
|
|
62184
62261
|
}
|
|
62185
62262
|
});
|
|
62186
|
-
return virtualRef ? null : /* @__PURE__ */
|
|
62263
|
+
return virtualRef ? null : /* @__PURE__ */ jsx45(Primitive.div, { ...anchorProps, ref: composedRefs });
|
|
62187
62264
|
}
|
|
62188
62265
|
);
|
|
62189
62266
|
PopperAnchor.displayName = ANCHOR_NAME;
|
|
@@ -62276,7 +62353,7 @@ var PopperContent = React14.forwardRef(
|
|
|
62276
62353
|
useLayoutEffect22(() => {
|
|
62277
62354
|
if (content3) setContentZIndex(window.getComputedStyle(content3).zIndex);
|
|
62278
62355
|
}, [content3]);
|
|
62279
|
-
return /* @__PURE__ */
|
|
62356
|
+
return /* @__PURE__ */ jsx45(
|
|
62280
62357
|
"div",
|
|
62281
62358
|
{
|
|
62282
62359
|
ref: refs.setFloating,
|
|
@@ -62300,7 +62377,7 @@ var PopperContent = React14.forwardRef(
|
|
|
62300
62377
|
}
|
|
62301
62378
|
},
|
|
62302
62379
|
dir: props.dir,
|
|
62303
|
-
children: /* @__PURE__ */
|
|
62380
|
+
children: /* @__PURE__ */ jsx45(
|
|
62304
62381
|
PopperContentProvider,
|
|
62305
62382
|
{
|
|
62306
62383
|
scope: __scopePopper,
|
|
@@ -62309,7 +62386,7 @@ var PopperContent = React14.forwardRef(
|
|
|
62309
62386
|
arrowX,
|
|
62310
62387
|
arrowY,
|
|
62311
62388
|
shouldHideArrow: cannotCenterArrow,
|
|
62312
|
-
children: /* @__PURE__ */
|
|
62389
|
+
children: /* @__PURE__ */ jsx45(
|
|
62313
62390
|
Primitive.div,
|
|
62314
62391
|
{
|
|
62315
62392
|
"data-side": placedSide,
|
|
@@ -62346,7 +62423,7 @@ var PopperArrow = React14.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
62346
62423
|
// we have to use an extra wrapper because `ResizeObserver` (used by `useSize`)
|
|
62347
62424
|
// doesn't report size as we'd expect on SVG elements.
|
|
62348
62425
|
// it reports their bounding box which is effectively the largest path inside the SVG.
|
|
62349
|
-
/* @__PURE__ */
|
|
62426
|
+
/* @__PURE__ */ jsx45(
|
|
62350
62427
|
"span",
|
|
62351
62428
|
{
|
|
62352
62429
|
ref: contentContext.onArrowChange,
|
|
@@ -62369,7 +62446,7 @@ var PopperArrow = React14.forwardRef(function PopperArrow2(props, forwardedRef)
|
|
|
62369
62446
|
}[contentContext.placedSide],
|
|
62370
62447
|
visibility: contentContext.shouldHideArrow ? "hidden" : void 0
|
|
62371
62448
|
},
|
|
62372
|
-
children: /* @__PURE__ */
|
|
62449
|
+
children: /* @__PURE__ */ jsx45(
|
|
62373
62450
|
Root,
|
|
62374
62451
|
{
|
|
62375
62452
|
...arrowProps,
|
|
@@ -62432,14 +62509,14 @@ var Arrow2 = PopperArrow;
|
|
|
62432
62509
|
// ../../node_modules/.pnpm/@radix-ui+react-portal@1.1.9_@types+react-dom@19.2.3_@types+react@19.2.14__@types+react_7668895bec2444446faa4e0f4eb5244b/node_modules/@radix-ui/react-portal/dist/index.mjs
|
|
62433
62510
|
import * as React15 from "react";
|
|
62434
62511
|
import ReactDOM3 from "react-dom";
|
|
62435
|
-
import { jsx as
|
|
62512
|
+
import { jsx as jsx46 } from "react/jsx-runtime";
|
|
62436
62513
|
var PORTAL_NAME = "Portal";
|
|
62437
62514
|
var Portal = React15.forwardRef((props, forwardedRef) => {
|
|
62438
62515
|
const { container: containerProp, ...portalProps } = props;
|
|
62439
62516
|
const [mounted, setMounted] = React15.useState(false);
|
|
62440
62517
|
useLayoutEffect22(() => setMounted(true), []);
|
|
62441
62518
|
const container = containerProp || mounted && globalThis?.document?.body;
|
|
62442
|
-
return container ? ReactDOM3.createPortal(/* @__PURE__ */
|
|
62519
|
+
return container ? ReactDOM3.createPortal(/* @__PURE__ */ jsx46(Primitive.div, { ...portalProps, ref: forwardedRef }), container) : null;
|
|
62443
62520
|
});
|
|
62444
62521
|
Portal.displayName = PORTAL_NAME;
|
|
62445
62522
|
|
|
@@ -62639,7 +62716,7 @@ function isFunction(value) {
|
|
|
62639
62716
|
|
|
62640
62717
|
// ../../node_modules/.pnpm/@radix-ui+react-visually-hidden@1.2.3_@types+react-dom@19.2.3_@types+react@19.2.14__@ty_fa89646d7248b32d1762bf88948f6339/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
|
|
62641
62718
|
import * as React18 from "react";
|
|
62642
|
-
import { jsx as
|
|
62719
|
+
import { jsx as jsx47 } from "react/jsx-runtime";
|
|
62643
62720
|
var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
62644
62721
|
// See: https://github.com/twbs/bootstrap/blob/main/scss/mixins/_visually-hidden.scss
|
|
62645
62722
|
position: "absolute",
|
|
@@ -62656,7 +62733,7 @@ var VISUALLY_HIDDEN_STYLES = Object.freeze({
|
|
|
62656
62733
|
var NAME2 = "VisuallyHidden";
|
|
62657
62734
|
var VisuallyHidden = React18.forwardRef(
|
|
62658
62735
|
(props, forwardedRef) => {
|
|
62659
|
-
return /* @__PURE__ */
|
|
62736
|
+
return /* @__PURE__ */ jsx47(
|
|
62660
62737
|
Primitive.span,
|
|
62661
62738
|
{
|
|
62662
62739
|
...props,
|
|
@@ -62670,7 +62747,7 @@ VisuallyHidden.displayName = NAME2;
|
|
|
62670
62747
|
var Root3 = VisuallyHidden;
|
|
62671
62748
|
|
|
62672
62749
|
// ../../node_modules/.pnpm/@radix-ui+react-tooltip@1.2.8_@types+react-dom@19.2.3_@types+react@19.2.14__@types+reac_9074d9fb06315b089b2bee17c4c65951/node_modules/@radix-ui/react-tooltip/dist/index.mjs
|
|
62673
|
-
import { jsx as
|
|
62750
|
+
import { jsx as jsx48, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
62674
62751
|
var [createTooltipContext, createTooltipScope] = createContextScope("Tooltip", [
|
|
62675
62752
|
createPopperScope
|
|
62676
62753
|
]);
|
|
@@ -62694,7 +62771,7 @@ var TooltipProvider = (props) => {
|
|
|
62694
62771
|
const skipDelayTimer = skipDelayTimerRef.current;
|
|
62695
62772
|
return () => window.clearTimeout(skipDelayTimer);
|
|
62696
62773
|
}, []);
|
|
62697
|
-
return /* @__PURE__ */
|
|
62774
|
+
return /* @__PURE__ */ jsx48(
|
|
62698
62775
|
TooltipProviderContextProvider,
|
|
62699
62776
|
{
|
|
62700
62777
|
scope: __scopeTooltip,
|
|
@@ -62785,7 +62862,7 @@ var Tooltip = (props) => {
|
|
|
62785
62862
|
}
|
|
62786
62863
|
};
|
|
62787
62864
|
}, []);
|
|
62788
|
-
return /* @__PURE__ */
|
|
62865
|
+
return /* @__PURE__ */ jsx48(Root2, { ...popperScope, children: /* @__PURE__ */ jsx48(
|
|
62789
62866
|
TooltipContextProvider,
|
|
62790
62867
|
{
|
|
62791
62868
|
scope: __scopeTooltip,
|
|
@@ -62829,7 +62906,7 @@ var TooltipTrigger = React19.forwardRef(
|
|
|
62829
62906
|
React19.useEffect(() => {
|
|
62830
62907
|
return () => document.removeEventListener("pointerup", handlePointerUp);
|
|
62831
62908
|
}, [handlePointerUp]);
|
|
62832
|
-
return /* @__PURE__ */
|
|
62909
|
+
return /* @__PURE__ */ jsx48(Anchor, { asChild: true, ...popperScope, children: /* @__PURE__ */ jsx48(
|
|
62833
62910
|
Primitive.button,
|
|
62834
62911
|
{
|
|
62835
62912
|
"aria-describedby": context.open ? context.contentId : void 0,
|
|
@@ -62871,7 +62948,7 @@ var [PortalProvider, usePortalContext] = createTooltipContext(PORTAL_NAME2, {
|
|
|
62871
62948
|
var TooltipPortal = (props) => {
|
|
62872
62949
|
const { __scopeTooltip, forceMount, children, container } = props;
|
|
62873
62950
|
const context = useTooltipContext(PORTAL_NAME2, __scopeTooltip);
|
|
62874
|
-
return /* @__PURE__ */
|
|
62951
|
+
return /* @__PURE__ */ jsx48(PortalProvider, { scope: __scopeTooltip, forceMount, children: /* @__PURE__ */ jsx48(Presence, { present: forceMount || context.open, children: /* @__PURE__ */ jsx48(Portal, { asChild: true, container, children }) }) });
|
|
62875
62952
|
};
|
|
62876
62953
|
TooltipPortal.displayName = PORTAL_NAME2;
|
|
62877
62954
|
var CONTENT_NAME2 = "TooltipContent";
|
|
@@ -62880,7 +62957,7 @@ var TooltipContent = React19.forwardRef(
|
|
|
62880
62957
|
const portalContext = usePortalContext(CONTENT_NAME2, props.__scopeTooltip);
|
|
62881
62958
|
const { forceMount = portalContext.forceMount, side = "top", ...contentProps } = props;
|
|
62882
62959
|
const context = useTooltipContext(CONTENT_NAME2, props.__scopeTooltip);
|
|
62883
|
-
return /* @__PURE__ */
|
|
62960
|
+
return /* @__PURE__ */ jsx48(Presence, { present: forceMount || context.open, children: context.disableHoverableContent ? /* @__PURE__ */ jsx48(TooltipContentImpl, { side, ...contentProps, ref: forwardedRef }) : /* @__PURE__ */ jsx48(TooltipContentHoverable, { side, ...contentProps, ref: forwardedRef }) });
|
|
62884
62961
|
}
|
|
62885
62962
|
);
|
|
62886
62963
|
var TooltipContentHoverable = React19.forwardRef((props, forwardedRef) => {
|
|
@@ -62942,7 +63019,7 @@ var TooltipContentHoverable = React19.forwardRef((props, forwardedRef) => {
|
|
|
62942
63019
|
return () => document.removeEventListener("pointermove", handleTrackPointerGrace);
|
|
62943
63020
|
}
|
|
62944
63021
|
}, [trigger, content3, pointerGraceArea, onClose, handleRemoveGraceArea]);
|
|
62945
|
-
return /* @__PURE__ */
|
|
63022
|
+
return /* @__PURE__ */ jsx48(TooltipContentImpl, { ...props, ref: composedRefs });
|
|
62946
63023
|
});
|
|
62947
63024
|
var [VisuallyHiddenContentContextProvider, useVisuallyHiddenContentContext] = createTooltipContext(TOOLTIP_NAME, { isInside: false });
|
|
62948
63025
|
var Slottable = createSlottable("TooltipContent");
|
|
@@ -62973,7 +63050,7 @@ var TooltipContentImpl = React19.forwardRef(
|
|
|
62973
63050
|
return () => window.removeEventListener("scroll", handleScroll, { capture: true });
|
|
62974
63051
|
}
|
|
62975
63052
|
}, [context.trigger, onClose]);
|
|
62976
|
-
return /* @__PURE__ */
|
|
63053
|
+
return /* @__PURE__ */ jsx48(
|
|
62977
63054
|
DismissableLayer,
|
|
62978
63055
|
{
|
|
62979
63056
|
asChild: true,
|
|
@@ -63001,8 +63078,8 @@ var TooltipContentImpl = React19.forwardRef(
|
|
|
63001
63078
|
}
|
|
63002
63079
|
},
|
|
63003
63080
|
children: [
|
|
63004
|
-
/* @__PURE__ */
|
|
63005
|
-
/* @__PURE__ */
|
|
63081
|
+
/* @__PURE__ */ jsx48(Slottable, { children }),
|
|
63082
|
+
/* @__PURE__ */ jsx48(VisuallyHiddenContentContextProvider, { scope: __scopeTooltip, isInside: true, children: /* @__PURE__ */ jsx48(Root3, { id: context.contentId, role: "tooltip", children: ariaLabel || children }) })
|
|
63006
63083
|
]
|
|
63007
63084
|
}
|
|
63008
63085
|
)
|
|
@@ -63020,7 +63097,7 @@ var TooltipArrow = React19.forwardRef(
|
|
|
63020
63097
|
ARROW_NAME2,
|
|
63021
63098
|
__scopeTooltip
|
|
63022
63099
|
);
|
|
63023
|
-
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */
|
|
63100
|
+
return visuallyHiddenContentContext.isInside ? null : /* @__PURE__ */ jsx48(Arrow2, { ...popperScope, ...arrowProps, ref: forwardedRef });
|
|
63024
63101
|
}
|
|
63025
63102
|
);
|
|
63026
63103
|
TooltipArrow.displayName = ARROW_NAME2;
|
|
@@ -63146,8 +63223,8 @@ var Portal2 = TooltipPortal;
|
|
|
63146
63223
|
var Content2 = TooltipContent;
|
|
63147
63224
|
|
|
63148
63225
|
// src/components/SessionBranchPicker.tsx
|
|
63149
|
-
import { useMemo as useMemo26, useState as
|
|
63150
|
-
import { jsx as
|
|
63226
|
+
import { useMemo as useMemo26, useState as useState51 } from "react";
|
|
63227
|
+
import { jsx as jsx49, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
63151
63228
|
var ROW_HEIGHT = 32;
|
|
63152
63229
|
var SVG_WIDTH = 44;
|
|
63153
63230
|
function SessionBranchPicker({
|
|
@@ -63155,8 +63232,8 @@ function SessionBranchPicker({
|
|
|
63155
63232
|
disabled = false,
|
|
63156
63233
|
onCheckout
|
|
63157
63234
|
}) {
|
|
63158
|
-
const [checkoutError, setCheckoutError] =
|
|
63159
|
-
const [pendingNodeId, setPendingNodeId] =
|
|
63235
|
+
const [checkoutError, setCheckoutError] = useState51(null);
|
|
63236
|
+
const [pendingNodeId, setPendingNodeId] = useState51(null);
|
|
63160
63237
|
const hasHistory = tree.nodes.length > 0;
|
|
63161
63238
|
const layout = useMemo26(() => buildLayoutNodes(tree), [tree]);
|
|
63162
63239
|
const nodeMap = useMemo26(() => new Map(tree.nodes.map((node3) => [node3.id, node3])), [tree]);
|
|
@@ -63187,9 +63264,9 @@ function SessionBranchPicker({
|
|
|
63187
63264
|
}
|
|
63188
63265
|
if (!hasHistory) return null;
|
|
63189
63266
|
return /* @__PURE__ */ jsxs33(Provider, { delayDuration: 200, children: [
|
|
63190
|
-
checkoutError ? /* @__PURE__ */
|
|
63191
|
-
/* @__PURE__ */
|
|
63192
|
-
/* @__PURE__ */
|
|
63267
|
+
checkoutError ? /* @__PURE__ */ jsx49("p", { role: "alert", className: "mb-2 text-xs text-destructive", children: checkoutError }) : null,
|
|
63268
|
+
/* @__PURE__ */ jsx49("div", { className: "flex max-h-52 justify-center overflow-x-auto overflow-y-auto", children: /* @__PURE__ */ jsxs33("div", { className: "relative", style: { height: graphHeight, width: graphWidth }, children: [
|
|
63269
|
+
/* @__PURE__ */ jsx49(
|
|
63193
63270
|
"svg",
|
|
63194
63271
|
{
|
|
63195
63272
|
"aria-hidden": "true",
|
|
@@ -63203,7 +63280,7 @@ function SessionBranchPicker({
|
|
|
63203
63280
|
return null;
|
|
63204
63281
|
}
|
|
63205
63282
|
const childStroke = node3.isActive ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))";
|
|
63206
|
-
return /* @__PURE__ */
|
|
63283
|
+
return /* @__PURE__ */ jsx49(
|
|
63207
63284
|
"path",
|
|
63208
63285
|
{
|
|
63209
63286
|
d: buildEdgePath(
|
|
@@ -63224,12 +63301,12 @@ function SessionBranchPicker({
|
|
|
63224
63301
|
})
|
|
63225
63302
|
}
|
|
63226
63303
|
),
|
|
63227
|
-
/* @__PURE__ */
|
|
63304
|
+
/* @__PURE__ */ jsx49("div", { className: "relative z-0 h-full", children: layout.nodes.map((node3) => {
|
|
63228
63305
|
const isPendingNode = pendingNodeId === node3.id;
|
|
63229
63306
|
const color2 = node3.isActive ? "hsl(var(--primary))" : "hsl(var(--muted-foreground))";
|
|
63230
63307
|
const previewText = node3.isVirtual ? isPendingNode ? "\u5207\u6362\u4E2D..." : "" : isPendingNode ? "\u5207\u6362\u4E2D..." : node3.preview;
|
|
63231
63308
|
const shouldShowTooltip = !node3.isVirtual || Boolean(previewText);
|
|
63232
|
-
const button = /* @__PURE__ */
|
|
63309
|
+
const button = /* @__PURE__ */ jsx49(
|
|
63233
63310
|
"button",
|
|
63234
63311
|
{
|
|
63235
63312
|
type: "button",
|
|
@@ -63245,7 +63322,7 @@ function SessionBranchPicker({
|
|
|
63245
63322
|
top: node3.row * ROW_HEIGHT,
|
|
63246
63323
|
left: getColumnX(node3.column) - 12
|
|
63247
63324
|
},
|
|
63248
|
-
children: /* @__PURE__ */
|
|
63325
|
+
children: /* @__PURE__ */ jsx49("span", { "aria-hidden": "true", className: "absolute left-0 top-0 h-8 w-6", children: /* @__PURE__ */ jsx49(
|
|
63249
63326
|
"svg",
|
|
63250
63327
|
{
|
|
63251
63328
|
"aria-hidden": "true",
|
|
@@ -63255,7 +63332,7 @@ function SessionBranchPicker({
|
|
|
63255
63332
|
height: ROW_HEIGHT,
|
|
63256
63333
|
viewBox: `0 0 24 ${ROW_HEIGHT}`,
|
|
63257
63334
|
fill: "none",
|
|
63258
|
-
children: node3.isVirtual ? /* @__PURE__ */
|
|
63335
|
+
children: node3.isVirtual ? /* @__PURE__ */ jsx49(
|
|
63259
63336
|
"circle",
|
|
63260
63337
|
{
|
|
63261
63338
|
cx: 12,
|
|
@@ -63268,8 +63345,8 @@ function SessionBranchPicker({
|
|
|
63268
63345
|
opacity: 0.7
|
|
63269
63346
|
}
|
|
63270
63347
|
) : /* @__PURE__ */ jsxs33("g", { children: [
|
|
63271
|
-
node3.isCurrent ? /* @__PURE__ */
|
|
63272
|
-
/* @__PURE__ */
|
|
63348
|
+
node3.isCurrent ? /* @__PURE__ */ jsx49("circle", { cx: 12, cy: ROW_HEIGHT / 2, r: 9, fill: color2, opacity: 0.18 }) : null,
|
|
63349
|
+
/* @__PURE__ */ jsx49(
|
|
63273
63350
|
"circle",
|
|
63274
63351
|
{
|
|
63275
63352
|
cx: 12,
|
|
@@ -63284,11 +63361,11 @@ function SessionBranchPicker({
|
|
|
63284
63361
|
}
|
|
63285
63362
|
);
|
|
63286
63363
|
if (!shouldShowTooltip) {
|
|
63287
|
-
return /* @__PURE__ */
|
|
63364
|
+
return /* @__PURE__ */ jsx49("div", { children: button }, node3.id);
|
|
63288
63365
|
}
|
|
63289
63366
|
return /* @__PURE__ */ jsxs33(Root32, { children: [
|
|
63290
|
-
/* @__PURE__ */
|
|
63291
|
-
/* @__PURE__ */
|
|
63367
|
+
/* @__PURE__ */ jsx49(Trigger, { asChild: true, children: button }),
|
|
63368
|
+
/* @__PURE__ */ jsx49(Portal2, { children: /* @__PURE__ */ jsx49(
|
|
63292
63369
|
Content2,
|
|
63293
63370
|
{
|
|
63294
63371
|
side: "right",
|
|
@@ -63454,6 +63531,7 @@ export {
|
|
|
63454
63531
|
MarkdownContent,
|
|
63455
63532
|
MarkdownRenderer,
|
|
63456
63533
|
McpAppCard,
|
|
63534
|
+
McpAppFrame,
|
|
63457
63535
|
MemoryRefsHint,
|
|
63458
63536
|
MessageImage,
|
|
63459
63537
|
PLAN_AUTO_COLLAPSE_MS,
|