@blade-hq/agent-react 2612.0.0-beta.32 → 2612.0.0-beta.34
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/chat/markdown/ExternalAnchor.d.ts +2 -2
- package/dist/{chunk-XTYNDVUV.js → chunk-6PSSFMTQ.js} +307 -230
- package/dist/chunk-6PSSFMTQ.js.map +1 -0
- package/dist/chunk-MHXY4KAY.js +577 -0
- package/dist/chunk-MHXY4KAY.js.map +1 -0
- package/dist/{chunk-M5NAFIU4.js → chunk-PQZC5LMU.js} +437 -413
- package/dist/{chunk-M5NAFIU4.js.map → chunk-PQZC5LMU.js.map} +1 -1
- package/dist/components/AccountConnectors.d.ts +13 -0
- package/dist/components/BrowserConnectionDialog.d.ts +7 -0
- package/dist/components/SessionPluginConfigForm.d.ts +3 -1
- package/dist/components/plugin-connector.d.ts +1 -0
- package/dist/embed/entry.d.ts +1 -0
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +2 -0
- package/dist/internal.js +7 -3
- package/dist/internal.js.map +1 -1
- package/dist/rich-input.js +2 -2
- package/dist/style.full.css +1 -1
- package/package.json +2 -2
- package/dist/chunk-PHWYZP6F.js +0 -253
- package/dist/chunk-PHWYZP6F.js.map +0 -1
- package/dist/chunk-XTYNDVUV.js.map +0 -1
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
Bookmark,
|
|
11
11
|
Bot,
|
|
12
12
|
Brain,
|
|
13
|
+
BrowserConnectionDialog,
|
|
13
14
|
ChatEnvironmentProvider,
|
|
14
15
|
Check,
|
|
15
16
|
ChevronDown,
|
|
@@ -55,6 +56,7 @@ import {
|
|
|
55
56
|
PencilLine,
|
|
56
57
|
PlanUpdateBlock,
|
|
57
58
|
Play,
|
|
59
|
+
Plug,
|
|
58
60
|
PluginConnectorList,
|
|
59
61
|
Plus,
|
|
60
62
|
RefreshCcw,
|
|
@@ -114,7 +116,7 @@ import {
|
|
|
114
116
|
useSessionSource,
|
|
115
117
|
useSessionState,
|
|
116
118
|
useSingleSessionSource
|
|
117
|
-
} from "./chunk-
|
|
119
|
+
} from "./chunk-6PSSFMTQ.js";
|
|
118
120
|
import {
|
|
119
121
|
__export
|
|
120
122
|
} from "./chunk-PR4QN5HX.js";
|
|
@@ -470,10 +472,10 @@ function ReplayMismatchPrompt({ mismatch, className }) {
|
|
|
470
472
|
|
|
471
473
|
// src/components/AgentChat.tsx
|
|
472
474
|
import { BladeApiError as BladeApiError2 } from "@blade-hq/agent-client/internal";
|
|
473
|
-
import { useEffect as useEffect31, useMemo as useMemo18, useRef as useRef29, useState as
|
|
475
|
+
import { useEffect as useEffect31, useMemo as useMemo18, useRef as useRef29, useState as useState37 } from "react";
|
|
474
476
|
|
|
475
477
|
// src/chat/ChatPanel.tsx
|
|
476
|
-
import { useCallback as useCallback17, useEffect as useEffect29, useMemo as useMemo17, useState as
|
|
478
|
+
import { useCallback as useCallback17, useEffect as useEffect29, useMemo as useMemo17, useState as useState35 } from "react";
|
|
477
479
|
import {
|
|
478
480
|
chatErrorForDisplay as chatErrorForDisplay3,
|
|
479
481
|
latestPostChatFollowup
|
|
@@ -26459,7 +26461,7 @@ function ChatLoadingIndicator({ preparing = false }) {
|
|
|
26459
26461
|
}
|
|
26460
26462
|
|
|
26461
26463
|
// src/chat/LiteMessageList.tsx
|
|
26462
|
-
import { useCallback as useCallback8, useEffect as useEffect20, useMemo as useMemo12, useRef as useRef19, useState as
|
|
26464
|
+
import { useCallback as useCallback8, useEffect as useEffect20, useMemo as useMemo12, useRef as useRef19, useState as useState26 } from "react";
|
|
26463
26465
|
import {
|
|
26464
26466
|
extractTextAttachments as extractTextAttachments2,
|
|
26465
26467
|
getTextContent as getTextContent3,
|
|
@@ -26611,7 +26613,7 @@ var MessageImage = forwardRef(function MessageImage2({ client: suppliedClient, s
|
|
|
26611
26613
|
});
|
|
26612
26614
|
|
|
26613
26615
|
// src/chat/AssistantTurnBlock.tsx
|
|
26614
|
-
import { memo as memo5, useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef16, useState as
|
|
26616
|
+
import { memo as memo5, useCallback as useCallback5, useEffect as useEffect17, useMemo as useMemo11, useRef as useRef16, useState as useState24 } from "react";
|
|
26615
26617
|
import { getFileParts as getFileParts2, getImageParts as getImageParts2, getTextContent as getTextContent2, normalizeMessageContent } from "@blade-hq/agent-client/internal";
|
|
26616
26618
|
|
|
26617
26619
|
// src/chat/lib/ui-meta.ts
|
|
@@ -26676,7 +26678,7 @@ import {
|
|
|
26676
26678
|
useEffect as useEffect8,
|
|
26677
26679
|
useMemo as useMemo5,
|
|
26678
26680
|
useRef as useRef11,
|
|
26679
|
-
useState as
|
|
26681
|
+
useState as useState11
|
|
26680
26682
|
} from "react";
|
|
26681
26683
|
|
|
26682
26684
|
// src/chat/ai-elements/shimmer.tsx
|
|
@@ -35627,8 +35629,30 @@ function MarkdownRenderer({
|
|
|
35627
35629
|
}
|
|
35628
35630
|
|
|
35629
35631
|
// src/chat/markdown/ExternalAnchor.tsx
|
|
35630
|
-
import {
|
|
35632
|
+
import { useState as useState9 } from "react";
|
|
35633
|
+
import { Fragment as Fragment6, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
35631
35634
|
function ExternalAnchor({ children, href, ...props }) {
|
|
35635
|
+
const client = useOptionalBladeClient();
|
|
35636
|
+
const [connecting, setConnecting] = useState9(false);
|
|
35637
|
+
let authorizationName = null;
|
|
35638
|
+
if (client && href) {
|
|
35639
|
+
try {
|
|
35640
|
+
const url2 = new URL(href, client.options.baseUrl);
|
|
35641
|
+
const match = url2.pathname.match(/\/connector-auth\/([^/]+)$/);
|
|
35642
|
+
if (match) {
|
|
35643
|
+
const expected = new URL(client.connectors.browserAuthorizationUrl(decodeURIComponent(match[1])));
|
|
35644
|
+
if (url2.origin === expected.origin && url2.pathname === expected.pathname) authorizationName = decodeURIComponent(match[1]);
|
|
35645
|
+
}
|
|
35646
|
+
} catch {
|
|
35647
|
+
}
|
|
35648
|
+
}
|
|
35649
|
+
if (authorizationName && client) return /* @__PURE__ */ jsxs11(Fragment6, { children: [
|
|
35650
|
+
/* @__PURE__ */ jsxs11("button", { type: "button", onClick: () => setConnecting(true), className: "my-1 inline-flex items-center gap-1.5 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--background))] px-3 py-1.5 text-sm font-medium text-[hsl(var(--foreground))] hover:bg-[hsl(var(--accent))]", children: [
|
|
35651
|
+
/* @__PURE__ */ jsx14(Plug, { size: 14, "aria-hidden": "true" }),
|
|
35652
|
+
children || "\u8FDE\u63A5\u8D26\u53F7"
|
|
35653
|
+
] }),
|
|
35654
|
+
connecting ? /* @__PURE__ */ jsx14(BrowserConnectionDialog, { client, name: authorizationName, onClose: () => setConnecting(false) }) : null
|
|
35655
|
+
] });
|
|
35632
35656
|
if (typeof href === "string" && href.startsWith("#")) {
|
|
35633
35657
|
return /* @__PURE__ */ jsx14("a", { ...props, href, children });
|
|
35634
35658
|
}
|
|
@@ -35716,7 +35740,7 @@ function normalizeAdjacentUrlFormatting(value) {
|
|
|
35716
35740
|
}
|
|
35717
35741
|
|
|
35718
35742
|
// src/chat/markdown/MarkdownContent.tsx
|
|
35719
|
-
import { isValidElement, useMemo as useMemo4, useRef as useRef10, useState as
|
|
35743
|
+
import { isValidElement, useMemo as useMemo4, useRef as useRef10, useState as useState10 } from "react";
|
|
35720
35744
|
|
|
35721
35745
|
// src/chat/lib/markdown-asset-url.ts
|
|
35722
35746
|
function isAbsoluteAssetUrl(src, hasFileContext) {
|
|
@@ -35755,7 +35779,7 @@ function resolveSessionMarkdownAssetUrl(rawSrc, sessionId, baseFilePath, buildAu
|
|
|
35755
35779
|
}
|
|
35756
35780
|
|
|
35757
35781
|
// src/chat/markdown/MarkdownContent.tsx
|
|
35758
|
-
import { Fragment as
|
|
35782
|
+
import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
35759
35783
|
var SYSTEM_REMINDER_TAG = "system-reminder";
|
|
35760
35784
|
var TOOL_CALL_TAG = "blade-malformed-tool-call";
|
|
35761
35785
|
var CITATION_TAG = "blade-citation-ref";
|
|
@@ -35792,8 +35816,8 @@ function InlineToolCallBlock({
|
|
|
35792
35816
|
...props
|
|
35793
35817
|
}) {
|
|
35794
35818
|
const rawText = resolveCollapsedContent({ dataKeyAttribute, dataRawAttribute, children }) || extractText(children).trim();
|
|
35795
|
-
const [open2, setOpen] =
|
|
35796
|
-
return /* @__PURE__ */
|
|
35819
|
+
const [open2, setOpen] = useState10(false);
|
|
35820
|
+
return /* @__PURE__ */ jsxs12("span", { ...props, className: "not-prose relative inline-flex align-baseline", children: [
|
|
35797
35821
|
/* @__PURE__ */ jsx15(
|
|
35798
35822
|
"button",
|
|
35799
35823
|
{
|
|
@@ -35805,13 +35829,13 @@ function InlineToolCallBlock({
|
|
|
35805
35829
|
children: "\u6298\u53E0\u7684\u5185\u5BB9"
|
|
35806
35830
|
}
|
|
35807
35831
|
),
|
|
35808
|
-
/* @__PURE__ */ jsx15(Dialog, { open: open2, onOpenChange: setOpen, children: /* @__PURE__ */
|
|
35832
|
+
/* @__PURE__ */ jsx15(Dialog, { open: open2, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs12(
|
|
35809
35833
|
DialogContent,
|
|
35810
35834
|
{
|
|
35811
35835
|
showCloseButton: false,
|
|
35812
35836
|
className: "m-0 flex max-h-[min(520px,calc(100vh-48px))] w-[min(760px,calc(100vw-48px))] flex-col gap-0 overflow-hidden p-0 text-left text-[13px] leading-6",
|
|
35813
35837
|
children: [
|
|
35814
|
-
/* @__PURE__ */
|
|
35838
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-2", children: [
|
|
35815
35839
|
/* @__PURE__ */ jsx15(DialogTitle, { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u6298\u53E0\u7684\u5185\u5BB9" }),
|
|
35816
35840
|
/* @__PURE__ */ jsx15(
|
|
35817
35841
|
DialogClose,
|
|
@@ -35830,10 +35854,10 @@ function InlineToolCallBlock({
|
|
|
35830
35854
|
}
|
|
35831
35855
|
function CitationRefBlock({ "data-n": dataN, citations }) {
|
|
35832
35856
|
const overlayRoot = useOverlayRoot();
|
|
35833
|
-
const [snapshotOpen, setSnapshotOpen] =
|
|
35857
|
+
const [snapshotOpen, setSnapshotOpen] = useState10(false);
|
|
35834
35858
|
const n2 = Number(dataN);
|
|
35835
35859
|
const entry = Number.isFinite(n2) ? citations?.[n2] : void 0;
|
|
35836
|
-
if (!entry) return /* @__PURE__ */
|
|
35860
|
+
if (!entry) return /* @__PURE__ */ jsxs12(Fragment7, { children: [
|
|
35837
35861
|
"[",
|
|
35838
35862
|
dataN,
|
|
35839
35863
|
"]"
|
|
@@ -35845,8 +35869,8 @@ function CitationRefBlock({ "data-n": dataN, citations }) {
|
|
|
35845
35869
|
window.open(entry.previewUrl, "_blank", "noopener,noreferrer");
|
|
35846
35870
|
}
|
|
35847
35871
|
};
|
|
35848
|
-
return /* @__PURE__ */
|
|
35849
|
-
/* @__PURE__ */
|
|
35872
|
+
return /* @__PURE__ */ jsxs12(dist_exports2.Provider, { delayDuration: 150, children: [
|
|
35873
|
+
/* @__PURE__ */ jsxs12(dist_exports2.Root, { children: [
|
|
35850
35874
|
/* @__PURE__ */ jsx15(dist_exports2.Trigger, { asChild: true, children: /* @__PURE__ */ jsx15(
|
|
35851
35875
|
"button",
|
|
35852
35876
|
{
|
|
@@ -35861,7 +35885,7 @@ function CitationRefBlock({ "data-n": dataN, citations }) {
|
|
|
35861
35885
|
children: entry.n
|
|
35862
35886
|
}
|
|
35863
35887
|
) }),
|
|
35864
|
-
/* @__PURE__ */ jsx15(dist_exports2.Portal, { container: overlayRoot, children: /* @__PURE__ */
|
|
35888
|
+
/* @__PURE__ */ jsx15(dist_exports2.Portal, { container: overlayRoot, children: /* @__PURE__ */ jsxs12(
|
|
35865
35889
|
dist_exports2.Content,
|
|
35866
35890
|
{
|
|
35867
35891
|
side: "top",
|
|
@@ -35876,7 +35900,7 @@ function CitationRefBlock({ "data-n": dataN, citations }) {
|
|
|
35876
35900
|
}
|
|
35877
35901
|
) })
|
|
35878
35902
|
] }),
|
|
35879
|
-
entry.snapshot ? /* @__PURE__ */ jsx15(Dialog, { open: snapshotOpen, onOpenChange: setSnapshotOpen, children: /* @__PURE__ */
|
|
35903
|
+
entry.snapshot ? /* @__PURE__ */ jsx15(Dialog, { open: snapshotOpen, onOpenChange: setSnapshotOpen, children: /* @__PURE__ */ jsxs12(DialogContent, { "aria-describedby": void 0, className: "max-h-[80vh] overflow-y-auto", children: [
|
|
35880
35904
|
/* @__PURE__ */ jsx15(DialogTitle, { children: entry.title }),
|
|
35881
35905
|
/* @__PURE__ */ jsx15("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u56DE\u7B54\u65F6\u4FDD\u5B58\u7684\u539F\u6587" }),
|
|
35882
35906
|
/* @__PURE__ */ jsx15("div", { className: "whitespace-pre-wrap break-words text-sm", children: entry.text.slice(0, 2e4) }),
|
|
@@ -35906,7 +35930,7 @@ function resolveCollapsedContent({
|
|
|
35906
35930
|
}
|
|
35907
35931
|
function CodeBlockPre({ children, ...props }) {
|
|
35908
35932
|
const preRef = useRef10(null);
|
|
35909
|
-
const [copied, setCopied] =
|
|
35933
|
+
const [copied, setCopied] = useState10(false);
|
|
35910
35934
|
const codeChild = Array.isArray(children) ? children[0] : children;
|
|
35911
35935
|
const hasCodeNode = isValidElement(codeChild);
|
|
35912
35936
|
const codeClassName = isValidElement(codeChild) ? codeChild.props.className : void 0;
|
|
@@ -35934,11 +35958,11 @@ function CodeBlockPre({ children, ...props }) {
|
|
|
35934
35958
|
if (!hasCodeNode) {
|
|
35935
35959
|
return /* @__PURE__ */ jsx15("div", { className: "relative", children: /* @__PURE__ */ jsx15("pre", { ref: preRef, ...props, children }) });
|
|
35936
35960
|
}
|
|
35937
|
-
return /* @__PURE__ */
|
|
35938
|
-
/* @__PURE__ */
|
|
35961
|
+
return /* @__PURE__ */ jsxs12("div", { className: "blade-chat-codeblock not-prose my-3 overflow-hidden rounded-xl border border-[hsl(var(--border))]", children: [
|
|
35962
|
+
/* @__PURE__ */ jsxs12("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: [
|
|
35939
35963
|
/* @__PURE__ */ jsx15("span", { className: "font-mono text-[12px] text-[hsl(var(--muted-foreground))]", children: language || "code" }),
|
|
35940
|
-
/* @__PURE__ */
|
|
35941
|
-
/* @__PURE__ */
|
|
35964
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-0.5", children: [
|
|
35965
|
+
/* @__PURE__ */ jsxs12(
|
|
35942
35966
|
"button",
|
|
35943
35967
|
{
|
|
35944
35968
|
type: "button",
|
|
@@ -35953,7 +35977,7 @@ function CodeBlockPre({ children, ...props }) {
|
|
|
35953
35977
|
]
|
|
35954
35978
|
}
|
|
35955
35979
|
),
|
|
35956
|
-
/* @__PURE__ */
|
|
35980
|
+
/* @__PURE__ */ jsxs12(
|
|
35957
35981
|
"button",
|
|
35958
35982
|
{
|
|
35959
35983
|
type: "button",
|
|
@@ -36139,7 +36163,7 @@ function MarkdownContent({
|
|
|
36139
36163
|
}
|
|
36140
36164
|
|
|
36141
36165
|
// src/chat/ai-elements/reasoning.tsx
|
|
36142
|
-
import { Fragment as
|
|
36166
|
+
import { Fragment as Fragment8, jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
36143
36167
|
var ReasoningContext = createContext5(null);
|
|
36144
36168
|
var useReasoning = () => {
|
|
36145
36169
|
const context = useContext5(ReasoningContext);
|
|
@@ -36224,11 +36248,11 @@ var ReasoningTrigger = memo4(
|
|
|
36224
36248
|
className
|
|
36225
36249
|
),
|
|
36226
36250
|
...props,
|
|
36227
|
-
children: children ?? /* @__PURE__ */
|
|
36251
|
+
children: children ?? /* @__PURE__ */ jsxs13(Fragment8, { children: [
|
|
36228
36252
|
/* @__PURE__ */ jsx16(Brain, { className: "size-4" }),
|
|
36229
|
-
/* @__PURE__ */
|
|
36253
|
+
/* @__PURE__ */ jsxs13("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
36230
36254
|
isStreaming || duration3 === 0 ? /* @__PURE__ */ jsx16(Shimmer, { duration: 1, children: status }) : /* @__PURE__ */ jsx16("span", { children: status }),
|
|
36231
|
-
/* @__PURE__ */
|
|
36255
|
+
/* @__PURE__ */ jsxs13("span", { className: "whitespace-nowrap tabular-nums text-[hsl(var(--muted-foreground))]/70", children: [
|
|
36232
36256
|
"\xB7 ",
|
|
36233
36257
|
detail
|
|
36234
36258
|
] })
|
|
@@ -36271,8 +36295,8 @@ function compactReasoningText(text4) {
|
|
|
36271
36295
|
}
|
|
36272
36296
|
function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
36273
36297
|
const compactReasoning = compactReasoningText(reasoning);
|
|
36274
|
-
const [open2, setOpen] =
|
|
36275
|
-
return /* @__PURE__ */
|
|
36298
|
+
const [open2, setOpen] = useState11(false);
|
|
36299
|
+
return /* @__PURE__ */ jsxs13(
|
|
36276
36300
|
"span",
|
|
36277
36301
|
{
|
|
36278
36302
|
className: cn(
|
|
@@ -36294,13 +36318,13 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
|
36294
36318
|
children: "\u601D\u8003\u8BE6\u60C5"
|
|
36295
36319
|
}
|
|
36296
36320
|
),
|
|
36297
|
-
/* @__PURE__ */ jsx16(Dialog, { open: open2, onOpenChange: setOpen, children: /* @__PURE__ */
|
|
36321
|
+
/* @__PURE__ */ jsx16(Dialog, { open: open2, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs13(
|
|
36298
36322
|
DialogContent,
|
|
36299
36323
|
{
|
|
36300
36324
|
showCloseButton: false,
|
|
36301
36325
|
className: "m-0 flex max-h-[min(520px,calc(100vh-48px))] w-[min(760px,calc(100vw-48px))] flex-col gap-0 overflow-hidden p-0 text-left text-[13px] leading-6",
|
|
36302
36326
|
children: [
|
|
36303
|
-
/* @__PURE__ */
|
|
36327
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-2", children: [
|
|
36304
36328
|
/* @__PURE__ */ jsx16(DialogTitle, { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u601D\u8003\u8BE6\u60C5" }),
|
|
36305
36329
|
/* @__PURE__ */ jsx16(
|
|
36306
36330
|
DialogClose,
|
|
@@ -36328,8 +36352,8 @@ import { createContext as createContext6, useContext as useContext6 } from "reac
|
|
|
36328
36352
|
var CardContext = createContext6({});
|
|
36329
36353
|
|
|
36330
36354
|
// src/chat/FileDeliveryCards.tsx
|
|
36331
|
-
import { useMemo as useMemo6, useState as
|
|
36332
|
-
import { Fragment as
|
|
36355
|
+
import { useMemo as useMemo6, useState as useState12 } from "react";
|
|
36356
|
+
import { Fragment as Fragment9, jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
36333
36357
|
var AGENT_WORKSPACE_DIR_NAME = "\u667A\u80FD\u52A9\u624B\u5DE5\u4F5C\u7A7A\u95F4";
|
|
36334
36358
|
var EXT_LABELS = {
|
|
36335
36359
|
py: "Python",
|
|
@@ -36405,8 +36429,8 @@ function DeliveryCard({
|
|
|
36405
36429
|
}) {
|
|
36406
36430
|
const client = useBladeClient();
|
|
36407
36431
|
const host = useBladeHost();
|
|
36408
|
-
const [opening, setOpening] =
|
|
36409
|
-
const [downloading, setDownloading] =
|
|
36432
|
+
const [opening, setOpening] = useState12(false);
|
|
36433
|
+
const [downloading, setDownloading] = useState12(false);
|
|
36410
36434
|
const handleOpen = async () => {
|
|
36411
36435
|
if (opening) return;
|
|
36412
36436
|
if (!host.openWorkspaceFile) {
|
|
@@ -36433,13 +36457,13 @@ function DeliveryCard({
|
|
|
36433
36457
|
setDownloading(false);
|
|
36434
36458
|
}
|
|
36435
36459
|
};
|
|
36436
|
-
return /* @__PURE__ */
|
|
36460
|
+
return /* @__PURE__ */ jsxs14(
|
|
36437
36461
|
"div",
|
|
36438
36462
|
{
|
|
36439
36463
|
"data-artifact-kind": isVideoFile(name) ? "video" : "file",
|
|
36440
36464
|
className: compact ? "file-delivery-card group/delivery relative flex w-full max-w-full items-stretch self-start overflow-hidden rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-sm transition-colors hover:bg-[hsl(var(--accent)/0.45)] focus-within:ring-1 focus-within:ring-[hsl(var(--ring))]" : "file-delivery-card group/delivery relative flex w-[320px] max-w-full items-center self-start rounded-[14px] border border-[hsl(var(--border))] bg-[hsl(var(--card))] transition-colors duration-150 hover:border-[hsl(var(--primary)/0.3)] hover:bg-[hsl(var(--muted)/0.6)] focus-within:ring-1 focus-within:ring-[hsl(var(--ring))]",
|
|
36441
36465
|
children: [
|
|
36442
|
-
/* @__PURE__ */
|
|
36466
|
+
/* @__PURE__ */ jsxs14(
|
|
36443
36467
|
"button",
|
|
36444
36468
|
{
|
|
36445
36469
|
type: "button",
|
|
@@ -36451,9 +36475,9 @@ function DeliveryCard({
|
|
|
36451
36475
|
${name}` : name,
|
|
36452
36476
|
children: [
|
|
36453
36477
|
/* @__PURE__ */ jsx17("span", { className: compact ? "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]" : "flex h-[42px] w-[42px] shrink-0 items-center justify-center rounded-[11px] bg-gradient-to-br from-[hsl(var(--primary))/0.1] to-[hsl(var(--primary))/0.2] text-[hsl(var(--primary))]", children: opening ? /* @__PURE__ */ jsx17(LoaderCircle, { size: compact ? 15 : 22, className: "animate-spin", "aria-hidden": "true" }) : isVideoFile(name) ? /* @__PURE__ */ jsx17(Film, { size: compact ? 15 : 22, "aria-hidden": "true" }) : /* @__PURE__ */ jsx17(FileGlyph, {}) }),
|
|
36454
|
-
/* @__PURE__ */
|
|
36478
|
+
/* @__PURE__ */ jsxs14("span", { className: compact ? "min-w-0" : "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
36455
36479
|
/* @__PURE__ */ jsx17("span", { className: compact ? "block truncate text-xs font-medium leading-5" : "truncate text-[15px] font-semibold text-[hsl(var(--foreground))]", children: displayName || name }),
|
|
36456
|
-
!compact ? /* @__PURE__ */ jsx17("span", { className: "flex items-center gap-1.5 truncate text-[12.5px] text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx17("span", { className: "truncate", children: description }) : /* @__PURE__ */
|
|
36480
|
+
!compact ? /* @__PURE__ */ jsx17("span", { className: "flex items-center gap-1.5 truncate text-[12.5px] text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx17("span", { className: "truncate", children: description }) : /* @__PURE__ */ jsxs14(Fragment9, { children: [
|
|
36457
36481
|
/* @__PURE__ */ jsx17("span", { className: "font-mono", children: getExtLabel(name) }),
|
|
36458
36482
|
/* @__PURE__ */ jsx17("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
36459
36483
|
/* @__PURE__ */ jsx17("span", { className: "text-[hsl(var(--primary))]", children: "AI \u751F\u6210" })
|
|
@@ -36482,7 +36506,7 @@ ${name}` : name,
|
|
|
36482
36506
|
);
|
|
36483
36507
|
}
|
|
36484
36508
|
function FileGlyph() {
|
|
36485
|
-
return /* @__PURE__ */
|
|
36509
|
+
return /* @__PURE__ */ jsxs14(
|
|
36486
36510
|
"svg",
|
|
36487
36511
|
{
|
|
36488
36512
|
width: "21",
|
|
@@ -36513,10 +36537,10 @@ function FileDeliveryCards({
|
|
|
36513
36537
|
}
|
|
36514
36538
|
|
|
36515
36539
|
// src/chat/MessageActions.tsx
|
|
36516
|
-
import { useState as
|
|
36517
|
-
import { jsx as jsx18, jsxs as
|
|
36540
|
+
import { useState as useState13 } from "react";
|
|
36541
|
+
import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
36518
36542
|
function MessageActions({ content: content3, className }) {
|
|
36519
|
-
const [copied, setCopied] =
|
|
36543
|
+
const [copied, setCopied] = useState13(false);
|
|
36520
36544
|
const handleCopy = async () => {
|
|
36521
36545
|
const ok3 = await copyToClipboard(content3);
|
|
36522
36546
|
if (ok3) {
|
|
@@ -36524,7 +36548,7 @@ function MessageActions({ content: content3, className }) {
|
|
|
36524
36548
|
setTimeout(() => setCopied(false), 2e3);
|
|
36525
36549
|
}
|
|
36526
36550
|
};
|
|
36527
|
-
return /* @__PURE__ */ jsx18("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */
|
|
36551
|
+
return /* @__PURE__ */ jsx18("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */ jsxs15(
|
|
36528
36552
|
"button",
|
|
36529
36553
|
{
|
|
36530
36554
|
type: "button",
|
|
@@ -36542,7 +36566,7 @@ function MessageActions({ content: content3, className }) {
|
|
|
36542
36566
|
}
|
|
36543
36567
|
|
|
36544
36568
|
// src/chat/MessageFileAttachmentList.tsx
|
|
36545
|
-
import { Fragment as
|
|
36569
|
+
import { Fragment as Fragment10, jsx as jsx19, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
36546
36570
|
function getFileIcon(fileName) {
|
|
36547
36571
|
const lowerName = fileName.toLowerCase();
|
|
36548
36572
|
if (/\.(zip|rar|7z|tar|gz|bz2|xz)$/.test(lowerName)) {
|
|
@@ -36574,7 +36598,7 @@ function MessageFileAttachmentList({
|
|
|
36574
36598
|
return /* @__PURE__ */ jsx19("div", { className: cn("flex flex-wrap gap-1.5", className), children: files.map((file2) => {
|
|
36575
36599
|
const Icon = getFileIcon(file2.name);
|
|
36576
36600
|
const key = `${file2.name}-${file2.data.slice(0, 32)}`;
|
|
36577
|
-
const content3 = /* @__PURE__ */
|
|
36601
|
+
const content3 = /* @__PURE__ */ jsxs16(Fragment10, { children: [
|
|
36578
36602
|
/* @__PURE__ */ jsx19(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
36579
36603
|
/* @__PURE__ */ jsx19("span", { className: "max-w-32 truncate", children: file2.name })
|
|
36580
36604
|
] });
|
|
@@ -36598,8 +36622,8 @@ function MessageFileAttachmentList({
|
|
|
36598
36622
|
|
|
36599
36623
|
// src/components/ToolUiCardView.tsx
|
|
36600
36624
|
import { resolveToolUiCardContent } from "@blade-hq/agent-client/internal";
|
|
36601
|
-
import { useEffect as useEffect9, useState as
|
|
36602
|
-
import { jsx as jsx20, jsxs as
|
|
36625
|
+
import { useEffect as useEffect9, useState as useState14 } from "react";
|
|
36626
|
+
import { jsx as jsx20, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
36603
36627
|
function ToolUiCardView({ card, sessionId }) {
|
|
36604
36628
|
if (card.mcpApp) return sessionId ? /* @__PURE__ */ jsx20(McpAppCard, { sessionId, sourceId: card.mcpApp.sourceId }) : null;
|
|
36605
36629
|
const resolved = resolveToolUiCardContent(card);
|
|
@@ -36625,9 +36649,9 @@ function ToolUiCardView({ card, sessionId }) {
|
|
|
36625
36649
|
}
|
|
36626
36650
|
function FileCard({ card, sessionId, path: path2 }) {
|
|
36627
36651
|
const client = useBladeClient();
|
|
36628
|
-
const [html, setHtml] =
|
|
36629
|
-
const [failed, setFailed] =
|
|
36630
|
-
const [refreshVersion, setRefreshVersion] =
|
|
36652
|
+
const [html, setHtml] = useState14(null);
|
|
36653
|
+
const [failed, setFailed] = useState14(false);
|
|
36654
|
+
const [refreshVersion, setRefreshVersion] = useState14(0);
|
|
36631
36655
|
useEffect9(() => {
|
|
36632
36656
|
const abort = new AbortController();
|
|
36633
36657
|
setHtml(null);
|
|
@@ -36647,7 +36671,7 @@ function FileCard({ card, sessionId, path: path2 }) {
|
|
|
36647
36671
|
`api/sessions/${encodeURIComponent(sessionId)}/serve/${filePath}`,
|
|
36648
36672
|
`${client.options.baseUrl.replace(/\/$/, "")}/`
|
|
36649
36673
|
).href;
|
|
36650
|
-
return /* @__PURE__ */
|
|
36674
|
+
return /* @__PURE__ */ jsxs17("div", { children: [
|
|
36651
36675
|
/* @__PURE__ */ jsx20("div", { className: "flex justify-end py-2", children: /* @__PURE__ */ jsx20(
|
|
36652
36676
|
"button",
|
|
36653
36677
|
{
|
|
@@ -36696,15 +36720,15 @@ function ToolUiCard({ card, sessionId }) {
|
|
|
36696
36720
|
}
|
|
36697
36721
|
|
|
36698
36722
|
// src/chat/ToolCallBlock.tsx
|
|
36699
|
-
import { useEffect as useEffect12, useMemo as useMemo8, useState as
|
|
36723
|
+
import { useEffect as useEffect12, useMemo as useMemo8, useState as useState18 } from "react";
|
|
36700
36724
|
import {
|
|
36701
36725
|
isInternalStatusToolUiCard,
|
|
36702
36726
|
isWorkflowRunToolName
|
|
36703
36727
|
} from "@blade-hq/agent-client/internal";
|
|
36704
36728
|
|
|
36705
36729
|
// src/chat/AskUserQuestionBlock.tsx
|
|
36706
|
-
import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef12, useState as
|
|
36707
|
-
import { jsx as jsx22, jsxs as
|
|
36730
|
+
import { useEffect as useEffect10, useMemo as useMemo7, useRef as useRef12, useState as useState15 } from "react";
|
|
36731
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
36708
36732
|
var CUSTOM_TEXTAREA_MAX_HEIGHT = 160;
|
|
36709
36733
|
function resizeCustomTextarea(textarea) {
|
|
36710
36734
|
textarea.style.height = "auto";
|
|
@@ -36742,11 +36766,11 @@ function AskUserQuestionBlock({
|
|
|
36742
36766
|
answerData,
|
|
36743
36767
|
onAnswer
|
|
36744
36768
|
}) {
|
|
36745
|
-
const [selections, setSelections] =
|
|
36746
|
-
const [customTexts, setCustomTexts] =
|
|
36747
|
-
const [usingCustom, setUsingCustom] =
|
|
36748
|
-
const [note, setNote] =
|
|
36749
|
-
const [submitted, setSubmitted] =
|
|
36769
|
+
const [selections, setSelections] = useState15(/* @__PURE__ */ new Map());
|
|
36770
|
+
const [customTexts, setCustomTexts] = useState15(/* @__PURE__ */ new Map());
|
|
36771
|
+
const [usingCustom, setUsingCustom] = useState15(/* @__PURE__ */ new Set());
|
|
36772
|
+
const [note, setNote] = useState15("");
|
|
36773
|
+
const [submitted, setSubmitted] = useState15(false);
|
|
36750
36774
|
useEffect10(() => {
|
|
36751
36775
|
if (sessionStatus === "failed" || sessionStatus === "interrupted") {
|
|
36752
36776
|
setSubmitted(false);
|
|
@@ -36854,7 +36878,7 @@ ${parts.join("\n")}`,
|
|
|
36854
36878
|
setSubmitted(true);
|
|
36855
36879
|
onAnswer(text4, toolCallId, nextAnswerData);
|
|
36856
36880
|
};
|
|
36857
|
-
return /* @__PURE__ */
|
|
36881
|
+
return /* @__PURE__ */ jsxs18(
|
|
36858
36882
|
"div",
|
|
36859
36883
|
{
|
|
36860
36884
|
part: "ask-card",
|
|
@@ -36863,7 +36887,7 @@ ${parts.join("\n")}`,
|
|
|
36863
36887
|
answered ? "max-w-2xl space-y-3 p-3 text-xs text-[hsl(var(--muted-foreground))] opacity-80" : "max-w-lg space-y-5 p-4 text-sm"
|
|
36864
36888
|
),
|
|
36865
36889
|
children: [
|
|
36866
|
-
data.source_loop?.description && /* @__PURE__ */
|
|
36890
|
+
data.source_loop?.description && /* @__PURE__ */ jsxs18("div", { className: "rounded-lg bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
36867
36891
|
"\u5B50\u667A\u80FD\u4F53\u300C",
|
|
36868
36892
|
data.source_loop.description,
|
|
36869
36893
|
"\u300D\u5728\u7B49\u5F85\u4F60\u7684\u56DE\u7B54"
|
|
@@ -36902,7 +36926,7 @@ ${parts.join("\n")}`,
|
|
|
36902
36926
|
children: allAnswered ? "\u786E\u8BA4" : "\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u9009\u9879"
|
|
36903
36927
|
}
|
|
36904
36928
|
),
|
|
36905
|
-
submitted && !answered && /* @__PURE__ */
|
|
36929
|
+
submitted && !answered && /* @__PURE__ */ jsxs18(
|
|
36906
36930
|
"button",
|
|
36907
36931
|
{
|
|
36908
36932
|
type: "button",
|
|
@@ -36931,8 +36955,8 @@ function QuestionCard({
|
|
|
36931
36955
|
}) {
|
|
36932
36956
|
const multi = question.multiSelect ?? false;
|
|
36933
36957
|
const customTextareaRef = useAutoResizeTextarea(customText);
|
|
36934
|
-
return /* @__PURE__ */
|
|
36935
|
-
/* @__PURE__ */
|
|
36958
|
+
return /* @__PURE__ */ jsxs18("div", { children: [
|
|
36959
|
+
/* @__PURE__ */ jsxs18("div", { className: cn("flex items-start gap-2", answered ? "mb-2" : "mb-3"), children: [
|
|
36936
36960
|
/* @__PURE__ */ jsx22(
|
|
36937
36961
|
MessageSquareMore,
|
|
36938
36962
|
{
|
|
@@ -36961,10 +36985,10 @@ function QuestionCard({
|
|
|
36961
36985
|
}
|
|
36962
36986
|
)
|
|
36963
36987
|
] }),
|
|
36964
|
-
/* @__PURE__ */
|
|
36988
|
+
/* @__PURE__ */ jsxs18("div", { className: cn("flex flex-col pl-5", answered ? "gap-1" : "gap-1.5"), children: [
|
|
36965
36989
|
question.options.map((opt, optIdx) => {
|
|
36966
36990
|
const isSel = selected.has(optIdx);
|
|
36967
|
-
return /* @__PURE__ */
|
|
36991
|
+
return /* @__PURE__ */ jsxs18(
|
|
36968
36992
|
"button",
|
|
36969
36993
|
{
|
|
36970
36994
|
type: "button",
|
|
@@ -36996,7 +37020,7 @@ function QuestionCard({
|
|
|
36996
37020
|
)
|
|
36997
37021
|
}
|
|
36998
37022
|
),
|
|
36999
|
-
/* @__PURE__ */
|
|
37023
|
+
/* @__PURE__ */ jsxs18("div", { className: "min-w-0", children: [
|
|
37000
37024
|
/* @__PURE__ */ jsx22("div", { className: cn("font-medium", answered ? "text-xs" : "text-[13px]"), children: opt.label }),
|
|
37001
37025
|
opt.description && /* @__PURE__ */ jsx22(
|
|
37002
37026
|
"div",
|
|
@@ -37015,7 +37039,7 @@ function QuestionCard({
|
|
|
37015
37039
|
opt.label
|
|
37016
37040
|
);
|
|
37017
37041
|
}),
|
|
37018
|
-
answered && !isCustom ? null : /* @__PURE__ */
|
|
37042
|
+
answered && !isCustom ? null : /* @__PURE__ */ jsxs18(
|
|
37019
37043
|
"div",
|
|
37020
37044
|
{
|
|
37021
37045
|
className: cn(
|
|
@@ -37058,7 +37082,7 @@ function NoteField({
|
|
|
37058
37082
|
const textareaRef = useAutoResizeTextarea(note);
|
|
37059
37083
|
const readOnly = answered || submitted;
|
|
37060
37084
|
if (answered && !note.trim()) return null;
|
|
37061
|
-
return /* @__PURE__ */
|
|
37085
|
+
return /* @__PURE__ */ jsxs18(
|
|
37062
37086
|
"label",
|
|
37063
37087
|
{
|
|
37064
37088
|
className: cn(
|
|
@@ -37267,7 +37291,7 @@ function CodePreview({
|
|
|
37267
37291
|
}
|
|
37268
37292
|
|
|
37269
37293
|
// src/chat/tool-renderers/BashRenderer.tsx
|
|
37270
|
-
import { jsx as jsx24, jsxs as
|
|
37294
|
+
import { jsx as jsx24, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
37271
37295
|
function pickOutputField(data) {
|
|
37272
37296
|
if (!data) return null;
|
|
37273
37297
|
for (const key of ["output", "stdout", "stderr"]) {
|
|
@@ -37300,16 +37324,16 @@ function BashRenderer({ toolCall }) {
|
|
|
37300
37324
|
const rawFallbackOutput = result === null && typeof resultStr === "string" && resultStr.trim().length > 0 ? resultStr : null;
|
|
37301
37325
|
const output2 = structuredOutput !== null ? structuredOutput : errorMessage ?? rawFallbackOutput ?? (normalizedName === "BgBash" ? "" : null);
|
|
37302
37326
|
const hasFailure = toolCall.status === "error" || timedOut || exitCode !== null && exitCode !== 0;
|
|
37303
|
-
return /* @__PURE__ */
|
|
37304
|
-
(description || cwd) && /* @__PURE__ */
|
|
37327
|
+
return /* @__PURE__ */ jsxs19("div", { className: "space-y-3", children: [
|
|
37328
|
+
(description || cwd) && /* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
37305
37329
|
description ? /* @__PURE__ */ jsx24("span", { children: description }) : null,
|
|
37306
37330
|
cwd ? /* @__PURE__ */ jsx24("span", { className: "rounded-full bg-[hsl(var(--muted))] px-2 py-0.5 font-mono", children: cwd }) : null
|
|
37307
37331
|
] }),
|
|
37308
|
-
/* @__PURE__ */
|
|
37332
|
+
/* @__PURE__ */ jsxs19("div", { className: "overflow-hidden rounded-lg border border-border bg-card", children: [
|
|
37309
37333
|
/* @__PURE__ */ jsx24("div", { className: "border-b border-border px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u547D\u4EE4" }),
|
|
37310
37334
|
/* @__PURE__ */ jsx24("pre", { className: "overflow-x-auto px-3 py-3 font-mono text-[11px] leading-5 text-foreground", children: /* @__PURE__ */ jsx24("code", { children: `$ ${command || "\uFF08\u672A\u63D0\u4F9B\u547D\u4EE4\uFF09"}` }) })
|
|
37311
37335
|
] }),
|
|
37312
|
-
/* @__PURE__ */
|
|
37336
|
+
/* @__PURE__ */ jsxs19(
|
|
37313
37337
|
"div",
|
|
37314
37338
|
{
|
|
37315
37339
|
className: cn(
|
|
@@ -37317,9 +37341,9 @@ function BashRenderer({ toolCall }) {
|
|
|
37317
37341
|
hasFailure ? "border-[hsl(var(--swf-danger)/0.5)]" : "border-border"
|
|
37318
37342
|
),
|
|
37319
37343
|
children: [
|
|
37320
|
-
/* @__PURE__ */
|
|
37344
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center justify-between gap-2 border-b border-border px-3 py-2", children: [
|
|
37321
37345
|
/* @__PURE__ */ jsx24("div", { className: "text-[10px] uppercase tracking-[0.16em] text-muted-foreground", children: "\u8F93\u51FA" }),
|
|
37322
|
-
/* @__PURE__ */
|
|
37346
|
+
/* @__PURE__ */ jsxs19("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
37323
37347
|
taskId ? /* @__PURE__ */ jsx24(MetaPill, { label: `\u4EFB\u52A1 ${taskId}` }) : null,
|
|
37324
37348
|
exitCode !== null ? /* @__PURE__ */ jsx24(MetaPill, { label: `\u9000\u51FA\u7801 ${exitCode}` }) : null,
|
|
37325
37349
|
timedOut ? /* @__PURE__ */ jsx24(MetaPill, { label: "\u5DF2\u8D85\u65F6" }) : null,
|
|
@@ -37347,7 +37371,7 @@ function scrollWritePreviewToLatest(preview) {
|
|
|
37347
37371
|
}
|
|
37348
37372
|
|
|
37349
37373
|
// src/chat/tool-renderers/FileEditRenderer.tsx
|
|
37350
|
-
import { jsx as jsx25, jsxs as
|
|
37374
|
+
import { jsx as jsx25, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
37351
37375
|
var MAX_DIFF_LINES = 200;
|
|
37352
37376
|
var FILE_PATH_FIELDS = ["file_path", "path"];
|
|
37353
37377
|
function computeDiff(oldText, newText) {
|
|
@@ -37552,9 +37576,9 @@ function FileEditRenderer({ toolCall }) {
|
|
|
37552
37576
|
if (!preview || !followLatest || writeContent.length === 0) return;
|
|
37553
37577
|
scrollWritePreviewToLatest(preview);
|
|
37554
37578
|
}, [followLatest, writeContent]);
|
|
37555
|
-
return /* @__PURE__ */
|
|
37556
|
-
/* @__PURE__ */
|
|
37557
|
-
/* @__PURE__ */
|
|
37579
|
+
return /* @__PURE__ */ jsxs20("div", { className: "space-y-3", children: [
|
|
37580
|
+
/* @__PURE__ */ jsxs20("div", { className: "flex items-start justify-between gap-3", children: [
|
|
37581
|
+
/* @__PURE__ */ jsxs20("div", { className: "min-w-0", children: [
|
|
37558
37582
|
/* @__PURE__ */ jsx25("div", { className: "text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5199\u5165\u6587\u4EF6" : "\u7F16\u8F91\u6587\u4EF6" }),
|
|
37559
37583
|
/* @__PURE__ */ jsx25("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: fileName })
|
|
37560
37584
|
] }),
|
|
@@ -37562,7 +37586,7 @@ function FileEditRenderer({ toolCall }) {
|
|
|
37562
37586
|
] }),
|
|
37563
37587
|
description ? /* @__PURE__ */ jsx25("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
37564
37588
|
displayErrorMessage ? /* @__PURE__ */ jsx25("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: displayErrorMessage }) : null,
|
|
37565
|
-
/* @__PURE__ */
|
|
37589
|
+
/* @__PURE__ */ jsxs20("div", { className: "file-edit-preview overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20", children: [
|
|
37566
37590
|
/* @__PURE__ */ jsx25("div", { className: "border-b border-[hsl(var(--border))] px-3 py-2 text-[10px] uppercase tracking-[0.16em] text-[hsl(var(--muted-foreground))]", children: normalizedName === "Write" ? "\u5185\u5BB9\u9884\u89C8" : "\u53D8\u66F4\u9884\u89C8" }),
|
|
37567
37591
|
/* @__PURE__ */ jsx25(
|
|
37568
37592
|
"pre",
|
|
@@ -37571,7 +37595,7 @@ function FileEditRenderer({ toolCall }) {
|
|
|
37571
37595
|
className: "max-h-[320px] overflow-auto p-0 font-mono text-[11px] leading-5",
|
|
37572
37596
|
children: diffLines.length > 0 ? diffLines.map((line, index2) => {
|
|
37573
37597
|
const prefix = line.type === "added" ? "+ " : line.type === "removed" ? "- " : " ";
|
|
37574
|
-
return /* @__PURE__ */
|
|
37598
|
+
return /* @__PURE__ */ jsxs20(
|
|
37575
37599
|
"div",
|
|
37576
37600
|
{
|
|
37577
37601
|
className: cn(
|
|
@@ -37582,7 +37606,7 @@ function FileEditRenderer({ toolCall }) {
|
|
|
37582
37606
|
),
|
|
37583
37607
|
children: [
|
|
37584
37608
|
/* @__PURE__ */ jsx25("span", { className: "select-none py-0.5 text-right text-[10px] text-[hsl(var(--muted-foreground))]", children: line.line ?? "" }),
|
|
37585
|
-
/* @__PURE__ */
|
|
37609
|
+
/* @__PURE__ */ jsxs20("span", { className: "min-w-0 whitespace-pre-wrap break-words py-0.5", children: [
|
|
37586
37610
|
prefix,
|
|
37587
37611
|
line.value
|
|
37588
37612
|
] })
|
|
@@ -37599,21 +37623,21 @@ function FileEditRenderer({ toolCall }) {
|
|
|
37599
37623
|
}
|
|
37600
37624
|
|
|
37601
37625
|
// src/chat/tool-renderers/FileReadRenderer.tsx
|
|
37602
|
-
import { useState as
|
|
37626
|
+
import { useState as useState17 } from "react";
|
|
37603
37627
|
|
|
37604
37628
|
// src/chat/ImageLightbox.tsx
|
|
37605
|
-
import { useCallback as useCallback4, useEffect as useEffect11, useRef as useRef14, useState as
|
|
37629
|
+
import { useCallback as useCallback4, useEffect as useEffect11, useRef as useRef14, useState as useState16 } from "react";
|
|
37606
37630
|
import { createPortal } from "react-dom";
|
|
37607
|
-
import { Fragment as
|
|
37631
|
+
import { Fragment as Fragment11, jsx as jsx26, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
37608
37632
|
function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 }) {
|
|
37609
|
-
const [currentIndex, setCurrentIndex] =
|
|
37610
|
-
const [scale, setScale] =
|
|
37611
|
-
const [translate, setTranslate] =
|
|
37633
|
+
const [currentIndex, setCurrentIndex] = useState16(initialIndex);
|
|
37634
|
+
const [scale, setScale] = useState16(1);
|
|
37635
|
+
const [translate, setTranslate] = useState16({ x: 0, y: 0 });
|
|
37612
37636
|
const dragging = useRef14(false);
|
|
37613
37637
|
const dragStart = useRef14({ x: 0, y: 0 });
|
|
37614
37638
|
const translateStart = useRef14({ x: 0, y: 0 });
|
|
37615
37639
|
const imgRef = useRef14(null);
|
|
37616
|
-
const [loadedSource, setLoadedSource] =
|
|
37640
|
+
const [loadedSource, setLoadedSource] = useState16(null);
|
|
37617
37641
|
const reset = useCallback4(() => {
|
|
37618
37642
|
setScale(1);
|
|
37619
37643
|
setTranslate({ x: 0, y: 0 });
|
|
@@ -37718,7 +37742,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
37718
37742
|
if (images.length === 0) {
|
|
37719
37743
|
return createPortal(
|
|
37720
37744
|
// biome-ignore lint/a11y/useKeyWithClickEvents: ESC handler is registered via useEffect
|
|
37721
|
-
/* @__PURE__ */
|
|
37745
|
+
/* @__PURE__ */ jsxs21(
|
|
37722
37746
|
"div",
|
|
37723
37747
|
{
|
|
37724
37748
|
className: "fixed inset-0 z-50 flex animate-in items-center justify-center bg-black/80 fade-in-0 duration-(--motion-duration-fast)",
|
|
@@ -37744,13 +37768,13 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
37744
37768
|
const showNav = images.length > 1;
|
|
37745
37769
|
return createPortal(
|
|
37746
37770
|
// biome-ignore lint/a11y/useKeyWithClickEvents: ESC handler is registered via useEffect
|
|
37747
|
-
/* @__PURE__ */
|
|
37771
|
+
/* @__PURE__ */ jsxs21(
|
|
37748
37772
|
"div",
|
|
37749
37773
|
{
|
|
37750
37774
|
className: "fixed inset-0 z-50 animate-in bg-black/80 fade-in-0 duration-(--motion-duration-fast)",
|
|
37751
37775
|
onClick: handleAreaClick,
|
|
37752
37776
|
children: [
|
|
37753
|
-
/* @__PURE__ */
|
|
37777
|
+
/* @__PURE__ */ jsxs21(
|
|
37754
37778
|
"div",
|
|
37755
37779
|
{
|
|
37756
37780
|
className: "absolute right-4 top-4 z-10 flex items-center gap-1.5",
|
|
@@ -37814,7 +37838,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
37814
37838
|
children: /* @__PURE__ */ jsx26(ChevronRight, { size: 24 })
|
|
37815
37839
|
}
|
|
37816
37840
|
),
|
|
37817
|
-
/* @__PURE__ */
|
|
37841
|
+
/* @__PURE__ */ jsxs21("div", { className: "absolute bottom-6 left-1/2 z-10 flex -translate-x-1/2 items-center gap-1 rounded-full bg-black/50 px-2 py-1", children: [
|
|
37818
37842
|
/* @__PURE__ */ jsx26(
|
|
37819
37843
|
"button",
|
|
37820
37844
|
{
|
|
@@ -37824,7 +37848,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
37824
37848
|
children: /* @__PURE__ */ jsx26(Minus, { size: 16 })
|
|
37825
37849
|
}
|
|
37826
37850
|
),
|
|
37827
|
-
/* @__PURE__ */
|
|
37851
|
+
/* @__PURE__ */ jsxs21("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
37828
37852
|
Math.round(scale * 100),
|
|
37829
37853
|
"%"
|
|
37830
37854
|
] }),
|
|
@@ -37846,9 +37870,9 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
37846
37870
|
children: /* @__PURE__ */ jsx26(RotateCcw, { size: 16 })
|
|
37847
37871
|
}
|
|
37848
37872
|
),
|
|
37849
|
-
showNav && /* @__PURE__ */
|
|
37873
|
+
showNav && /* @__PURE__ */ jsxs21(Fragment11, { children: [
|
|
37850
37874
|
/* @__PURE__ */ jsx26("div", { className: "mx-1 h-4 w-px bg-white/20" }),
|
|
37851
|
-
/* @__PURE__ */
|
|
37875
|
+
/* @__PURE__ */ jsxs21("span", { className: "min-w-[3rem] text-center text-xs text-white/80", children: [
|
|
37852
37876
|
currentIndex + 1,
|
|
37853
37877
|
" / ",
|
|
37854
37878
|
images.length
|
|
@@ -37892,7 +37916,7 @@ function ImageLightbox({ open: open2, onOpenChange, images, initialIndex = 0 })
|
|
|
37892
37916
|
}
|
|
37893
37917
|
|
|
37894
37918
|
// src/chat/tool-renderers/FileReadRenderer.tsx
|
|
37895
|
-
import { jsx as jsx27, jsxs as
|
|
37919
|
+
import { jsx as jsx27, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
37896
37920
|
var NUMBERED_LINE_RE = /^(\s*\d+)\t([\s\S]*)$/;
|
|
37897
37921
|
function parseReadResult(result) {
|
|
37898
37922
|
if (!result) {
|
|
@@ -37936,7 +37960,7 @@ function formatLineRange(startLine, endLine) {
|
|
|
37936
37960
|
return startLine === endLine ? `\u7B2C ${startLine} \u884C` : `\u7B2C ${startLine}-${endLine} \u884C`;
|
|
37937
37961
|
}
|
|
37938
37962
|
function FileReadRenderer({ toolCall }) {
|
|
37939
|
-
const [lightboxIndex, setLightboxIndex] =
|
|
37963
|
+
const [lightboxIndex, setLightboxIndex] = useState17(null);
|
|
37940
37964
|
const argsValue = parseJsonValue(toolCall.arguments);
|
|
37941
37965
|
const args = isPlainObject3(argsValue) ? argsValue : null;
|
|
37942
37966
|
const filePath = extractToolFilePath(toolCall);
|
|
@@ -37954,20 +37978,20 @@ function FileReadRenderer({ toolCall }) {
|
|
|
37954
37978
|
const resolvedStartLine = startLine ?? (lineCount > 0 ? fallbackStart : null);
|
|
37955
37979
|
const resolvedEndLine = endLine ?? (resolvedStartLine !== null && lineCount > 0 ? resolvedStartLine + lineCount - 1 : null);
|
|
37956
37980
|
const lineRange = formatLineRange(resolvedStartLine, resolvedEndLine);
|
|
37957
|
-
return /* @__PURE__ */
|
|
37958
|
-
/* @__PURE__ */
|
|
37959
|
-
/* @__PURE__ */
|
|
37981
|
+
return /* @__PURE__ */ jsxs22("div", { className: "space-y-3", children: [
|
|
37982
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-start justify-between gap-3", children: [
|
|
37983
|
+
/* @__PURE__ */ jsxs22("div", { className: "min-w-0", children: [
|
|
37960
37984
|
/* @__PURE__ */ jsx27("div", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: displayName }),
|
|
37961
37985
|
filePath ? /* @__PURE__ */ jsx27("div", { className: "truncate text-[10px] text-[hsl(var(--muted-foreground))]", children: filePath }) : null
|
|
37962
37986
|
] }),
|
|
37963
|
-
/* @__PURE__ */
|
|
37987
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex flex-wrap items-center justify-end gap-1.5", children: [
|
|
37964
37988
|
lineRange ? /* @__PURE__ */ jsx27("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 text-[10px] text-[hsl(var(--muted-foreground))]", children: lineRange }) : null,
|
|
37965
37989
|
checksum ? /* @__PURE__ */ jsx27("span", { className: "rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--muted))] px-2 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: checksum }) : null
|
|
37966
37990
|
] })
|
|
37967
37991
|
] }),
|
|
37968
37992
|
description ? /* @__PURE__ */ jsx27("div", { className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/35 px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: description }) : null,
|
|
37969
37993
|
errorMessage ? /* @__PURE__ */ jsx27("div", { className: "rounded-lg border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-[11px] text-[hsl(var(--swf-danger))]", children: errorMessage }) : null,
|
|
37970
|
-
isImageResult ? /* @__PURE__ */
|
|
37994
|
+
isImageResult ? /* @__PURE__ */ jsxs22("div", { className: "grid gap-2", children: [
|
|
37971
37995
|
imageUrls.map((url2, idx) => /* @__PURE__ */ jsx27(
|
|
37972
37996
|
"button",
|
|
37973
37997
|
{
|
|
@@ -38006,7 +38030,7 @@ function FileReadRenderer({ toolCall }) {
|
|
|
38006
38030
|
}
|
|
38007
38031
|
|
|
38008
38032
|
// src/chat/tool-renderers/SearchRenderer.tsx
|
|
38009
|
-
import { jsx as jsx28, jsxs as
|
|
38033
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
38010
38034
|
function toRecordArray(value) {
|
|
38011
38035
|
return Array.isArray(value) ? value.filter(isPlainObject3) : [];
|
|
38012
38036
|
}
|
|
@@ -38071,17 +38095,17 @@ function SearchRenderer({ toolCall }) {
|
|
|
38071
38095
|
if (normalizedName === "Ls" || normalizedName === "Glob") {
|
|
38072
38096
|
const items = parseDirectoryItems(resultStr);
|
|
38073
38097
|
const path2 = getStringValue(args, "path");
|
|
38074
|
-
return /* @__PURE__ */
|
|
38075
|
-
path2 ? /* @__PURE__ */
|
|
38098
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-3", children: [
|
|
38099
|
+
path2 ? /* @__PURE__ */ jsxs23("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
38076
38100
|
"\u76EE\u5F55\uFF1A",
|
|
38077
38101
|
path2
|
|
38078
38102
|
] }) : null,
|
|
38079
|
-
items.length > 0 ? /* @__PURE__ */ jsx28("div", { className: "grid gap-2", children: items.map((item) => /* @__PURE__ */
|
|
38103
|
+
items.length > 0 ? /* @__PURE__ */ jsx28("div", { className: "grid gap-2", children: items.map((item) => /* @__PURE__ */ jsxs23(
|
|
38080
38104
|
"div",
|
|
38081
38105
|
{
|
|
38082
38106
|
className: "flex items-center justify-between gap-3 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
38083
38107
|
children: [
|
|
38084
|
-
/* @__PURE__ */
|
|
38108
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
38085
38109
|
item.isDir ? /* @__PURE__ */ jsx28(Folder, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }) : /* @__PURE__ */ jsx28(FileText, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
38086
38110
|
/* @__PURE__ */ jsx28("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: item.name })
|
|
38087
38111
|
] }),
|
|
@@ -38095,22 +38119,22 @@ function SearchRenderer({ toolCall }) {
|
|
|
38095
38119
|
if (normalizedName === "Grep") {
|
|
38096
38120
|
const { matches, searchPath } = parseGrepResult(resultStr);
|
|
38097
38121
|
const pattern = getStringValue(args, "pattern");
|
|
38098
|
-
return /* @__PURE__ */
|
|
38099
|
-
/* @__PURE__ */
|
|
38122
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-3", children: [
|
|
38123
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex flex-wrap items-center gap-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
38100
38124
|
pattern ? /* @__PURE__ */ jsx28("span", { className: "rounded-full bg-[hsl(var(--muted))] px-2 py-0.5 font-mono", children: pattern }) : null,
|
|
38101
|
-
searchPath ? /* @__PURE__ */
|
|
38125
|
+
searchPath ? /* @__PURE__ */ jsxs23("span", { children: [
|
|
38102
38126
|
"\u8303\u56F4\uFF1A",
|
|
38103
38127
|
searchPath
|
|
38104
38128
|
] }) : null
|
|
38105
38129
|
] }),
|
|
38106
|
-
matches.length > 0 ? /* @__PURE__ */ jsx28("div", { className: "grid gap-2", children: matches.map((match) => /* @__PURE__ */
|
|
38130
|
+
matches.length > 0 ? /* @__PURE__ */ jsx28("div", { className: "grid gap-2", children: matches.map((match) => /* @__PURE__ */ jsxs23(
|
|
38107
38131
|
"div",
|
|
38108
38132
|
{
|
|
38109
38133
|
className: "rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-2",
|
|
38110
38134
|
children: [
|
|
38111
|
-
/* @__PURE__ */
|
|
38135
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-center justify-between gap-3", children: [
|
|
38112
38136
|
/* @__PURE__ */ jsx28("span", { className: "truncate font-mono text-[11px] text-[hsl(var(--foreground))]", children: match.path }),
|
|
38113
|
-
match.lineNumber !== null ? /* @__PURE__ */
|
|
38137
|
+
match.lineNumber !== null ? /* @__PURE__ */ jsxs23("span", { className: "shrink-0 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
38114
38138
|
"\u7B2C ",
|
|
38115
38139
|
match.lineNumber,
|
|
38116
38140
|
" \u884C"
|
|
@@ -38126,8 +38150,8 @@ function SearchRenderer({ toolCall }) {
|
|
|
38126
38150
|
if (normalizedName === "WebFetch") {
|
|
38127
38151
|
const url2 = getStringValue(args, "url");
|
|
38128
38152
|
const text4 = resultStr?.trim();
|
|
38129
|
-
return /* @__PURE__ */
|
|
38130
|
-
url2 ? /* @__PURE__ */
|
|
38153
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-3", children: [
|
|
38154
|
+
url2 ? /* @__PURE__ */ jsxs23(
|
|
38131
38155
|
"a",
|
|
38132
38156
|
{
|
|
38133
38157
|
href: url2,
|
|
@@ -38146,8 +38170,8 @@ function SearchRenderer({ toolCall }) {
|
|
|
38146
38170
|
}
|
|
38147
38171
|
const results = parseWebResults(resultStr);
|
|
38148
38172
|
const query = getStringValue(args, "query");
|
|
38149
|
-
return /* @__PURE__ */
|
|
38150
|
-
query ? /* @__PURE__ */
|
|
38173
|
+
return /* @__PURE__ */ jsxs23("div", { className: "space-y-3", children: [
|
|
38174
|
+
query ? /* @__PURE__ */ jsxs23("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
38151
38175
|
"\u67E5\u8BE2\uFF1A",
|
|
38152
38176
|
query
|
|
38153
38177
|
] }) : null,
|
|
@@ -38161,10 +38185,10 @@ function SearchRenderer({ toolCall }) {
|
|
|
38161
38185
|
"rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted))]/20 px-3 py-3 transition-colors",
|
|
38162
38186
|
item.url && "hover:border-[hsl(var(--ring))] hover:bg-[hsl(var(--muted))]/35"
|
|
38163
38187
|
),
|
|
38164
|
-
children: /* @__PURE__ */
|
|
38188
|
+
children: /* @__PURE__ */ jsxs23("div", { className: "flex items-start gap-3", children: [
|
|
38165
38189
|
/* @__PURE__ */ jsx28(Earth, { size: 16, className: "mt-0.5 shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
38166
|
-
/* @__PURE__ */
|
|
38167
|
-
/* @__PURE__ */
|
|
38190
|
+
/* @__PURE__ */ jsxs23("div", { className: "min-w-0 flex-1", children: [
|
|
38191
|
+
/* @__PURE__ */ jsxs23("div", { className: "flex items-start justify-between gap-3", children: [
|
|
38168
38192
|
/* @__PURE__ */ jsx28("span", { className: "line-clamp-2 text-[11px] font-medium text-[hsl(var(--foreground))]", children: item.title ?? item.url ?? "\u672A\u547D\u540D\u7ED3\u679C" }),
|
|
38169
38193
|
item.url ? /* @__PURE__ */ jsx28(
|
|
38170
38194
|
ExternalLink,
|
|
@@ -38175,7 +38199,7 @@ function SearchRenderer({ toolCall }) {
|
|
|
38175
38199
|
) : null
|
|
38176
38200
|
] }),
|
|
38177
38201
|
item.url ? /* @__PURE__ */ jsx28("div", { className: "mt-1 truncate font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.url }) : null,
|
|
38178
|
-
item.publishedDate ? /* @__PURE__ */
|
|
38202
|
+
item.publishedDate ? /* @__PURE__ */ jsxs23("div", { className: "mt-1 text-[10px] text-[hsl(var(--muted-foreground))]", children: [
|
|
38179
38203
|
"\u53D1\u5E03\u4E8E ",
|
|
38180
38204
|
item.publishedDate.slice(0, 10)
|
|
38181
38205
|
] }) : null,
|
|
@@ -38189,7 +38213,7 @@ function SearchRenderer({ toolCall }) {
|
|
|
38189
38213
|
}
|
|
38190
38214
|
|
|
38191
38215
|
// src/chat/tool-renderers/SubmitResultRenderer.tsx
|
|
38192
|
-
import { jsx as jsx29, jsxs as
|
|
38216
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
38193
38217
|
function extractText2(value, key) {
|
|
38194
38218
|
if (!isPlainObject3(value)) return null;
|
|
38195
38219
|
const field = value[key];
|
|
@@ -38210,21 +38234,21 @@ function SubmitResultRenderer({ toolCall }) {
|
|
|
38210
38234
|
const { description, result, error: error61, status } = parsePayload(toolCall);
|
|
38211
38235
|
const isError = toolCall.status === "error" || Boolean(error61);
|
|
38212
38236
|
const Icon = isError ? CircleAlert : CircleCheck;
|
|
38213
|
-
return /* @__PURE__ */
|
|
38214
|
-
/* @__PURE__ */
|
|
38237
|
+
return /* @__PURE__ */ jsxs24("div", { className: "overflow-hidden rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]", children: [
|
|
38238
|
+
/* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-3 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/25 px-4 py-3", children: [
|
|
38215
38239
|
/* @__PURE__ */ jsx29("div", { className: isError ? "text-[hsl(var(--swf-danger))]" : "text-[hsl(var(--swf-success))]", children: /* @__PURE__ */ jsx29(Icon, { size: 18 }) }),
|
|
38216
|
-
/* @__PURE__ */
|
|
38240
|
+
/* @__PURE__ */ jsxs24("div", { className: "min-w-0 flex-1", children: [
|
|
38217
38241
|
/* @__PURE__ */ jsx29("div", { className: "font-medium text-[hsl(var(--foreground))]", children: description || (isError ? "\u4EFB\u52A1\u6267\u884C\u5931\u8D25" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4") }),
|
|
38218
38242
|
description ? /* @__PURE__ */ jsx29("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: isError ? "\u4EFB\u52A1\u6267\u884C\u5931\u8D25" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4" }) : null,
|
|
38219
|
-
status ? /* @__PURE__ */
|
|
38243
|
+
status ? /* @__PURE__ */ jsxs24("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
38220
38244
|
"\u72B6\u6001\uFF1A",
|
|
38221
38245
|
status
|
|
38222
38246
|
] }) : null
|
|
38223
38247
|
] })
|
|
38224
38248
|
] }),
|
|
38225
|
-
/* @__PURE__ */
|
|
38249
|
+
/* @__PURE__ */ jsxs24("div", { className: "space-y-3 px-4 py-4 text-sm leading-6 text-[hsl(var(--foreground))]", children: [
|
|
38226
38250
|
result ? /* @__PURE__ */ jsx29("p", { className: "whitespace-pre-wrap", children: result }) : null,
|
|
38227
|
-
error61 ? /* @__PURE__ */
|
|
38251
|
+
error61 ? /* @__PURE__ */ jsxs24("div", { className: "rounded-xl border border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-3 py-2 text-sm text-[hsl(var(--swf-danger))]", children: [
|
|
38228
38252
|
/* @__PURE__ */ jsx29("div", { className: "mb-1 font-medium", children: "\u9519\u8BEF\u4FE1\u606F" }),
|
|
38229
38253
|
/* @__PURE__ */ jsx29("div", { className: "whitespace-pre-wrap", children: error61 })
|
|
38230
38254
|
] }) : null,
|
|
@@ -38253,7 +38277,7 @@ function getRenderer(toolName) {
|
|
|
38253
38277
|
}
|
|
38254
38278
|
|
|
38255
38279
|
// src/chat/ToolCallBlock.tsx
|
|
38256
|
-
import { Fragment as
|
|
38280
|
+
import { Fragment as Fragment12, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
38257
38281
|
function getFilePreviewName(filePath) {
|
|
38258
38282
|
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
38259
38283
|
}
|
|
@@ -38316,7 +38340,7 @@ function ToolPreviewAction({
|
|
|
38316
38340
|
return null;
|
|
38317
38341
|
}
|
|
38318
38342
|
const label = uiMeta.title ?? displayName;
|
|
38319
|
-
return /* @__PURE__ */
|
|
38343
|
+
return /* @__PURE__ */ jsxs25(
|
|
38320
38344
|
"button",
|
|
38321
38345
|
{
|
|
38322
38346
|
type: "button",
|
|
@@ -38360,7 +38384,7 @@ function ToolCallBlock({
|
|
|
38360
38384
|
}) {
|
|
38361
38385
|
const normalizedName = formatToolName(toolCall.name);
|
|
38362
38386
|
const shouldAutoExpandWhileStreaming = toolCall.status === "pending" && isLivePreviewTool(normalizedName);
|
|
38363
|
-
const [expanded, setExpanded] =
|
|
38387
|
+
const [expanded, setExpanded] = useState18(shouldAutoExpandWhileStreaming);
|
|
38364
38388
|
const currentSessionId = useCurrentChatSessionId();
|
|
38365
38389
|
const resolvedSessionId = providedSessionId ?? currentSessionId ?? void 0;
|
|
38366
38390
|
const storedAnswerData = useSessionState(resolvedSessionId, (s) => s.askAnswers[toolCall.id]);
|
|
@@ -38406,8 +38430,8 @@ function ToolCallBlock({
|
|
|
38406
38430
|
onAnswer: canAnswer ? resolvedOnAnswer : void 0
|
|
38407
38431
|
}) : null;
|
|
38408
38432
|
const customToolCall2 = customQuestion == null && !customization?.renderers?.askUserQuestion ? customization?.renderers?.toolCall?.(toolCall) : null;
|
|
38409
|
-
if (customQuestion != null) return /* @__PURE__ */ jsx30(
|
|
38410
|
-
if (customToolCall2 != null) return /* @__PURE__ */ jsx30(
|
|
38433
|
+
if (customQuestion != null) return /* @__PURE__ */ jsx30(Fragment12, { children: customQuestion });
|
|
38434
|
+
if (customToolCall2 != null) return /* @__PURE__ */ jsx30(Fragment12, { children: customToolCall2 });
|
|
38411
38435
|
if (toolCall.status === "error") return null;
|
|
38412
38436
|
if (askData) {
|
|
38413
38437
|
const questionBlock = /* @__PURE__ */ jsx30(
|
|
@@ -38424,20 +38448,20 @@ function ToolCallBlock({
|
|
|
38424
38448
|
if (!reasoning) {
|
|
38425
38449
|
return questionBlock;
|
|
38426
38450
|
}
|
|
38427
|
-
return /* @__PURE__ */
|
|
38451
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-1", children: [
|
|
38428
38452
|
questionBlock,
|
|
38429
38453
|
/* @__PURE__ */ jsx30("div", { className: "ml-4", children: /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning, variant: "block" }) })
|
|
38430
38454
|
] });
|
|
38431
38455
|
}
|
|
38432
38456
|
if (toolCall.status === "pending") {
|
|
38433
|
-
return /* @__PURE__ */
|
|
38457
|
+
return /* @__PURE__ */ jsxs25("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 flex max-w-lg items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
|
|
38434
38458
|
/* @__PURE__ */ jsx30(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
38435
38459
|
/* @__PURE__ */ jsx30("span", { children: "\u6B63\u5728\u51C6\u5907\u95EE\u9898\u2026" })
|
|
38436
38460
|
] });
|
|
38437
38461
|
}
|
|
38438
|
-
return /* @__PURE__ */
|
|
38462
|
+
return /* @__PURE__ */ jsxs25("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 max-w-lg rounded-xl border border-[hsl(var(--swf-warning)/0.35)] bg-[hsl(var(--swf-warning-soft))] p-4 text-sm text-[hsl(var(--foreground))]", children: [
|
|
38439
38463
|
/* @__PURE__ */ jsx30("div", { className: "font-semibold", children: "\u9009\u62E9\u9898\u5185\u5BB9\u6682\u65F6\u65E0\u6CD5\u663E\u793A" }),
|
|
38440
|
-
/* @__PURE__ */
|
|
38464
|
+
/* @__PURE__ */ jsxs25("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: [
|
|
38441
38465
|
"\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u6216\u7248\u672C\u4E0D\u517C\u5BB9\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u63D0\u4F9B\u4EA4\u4E92\u7F16\u53F7",
|
|
38442
38466
|
/* @__PURE__ */ jsx30("span", { className: "ml-1 font-mono", children: toolCall.id }),
|
|
38443
38467
|
"\u3002"
|
|
@@ -38445,14 +38469,14 @@ function ToolCallBlock({
|
|
|
38445
38469
|
] });
|
|
38446
38470
|
}
|
|
38447
38471
|
const customToolCall = customization?.renderers?.toolCall?.(toolCall);
|
|
38448
|
-
if (customToolCall != null) return /* @__PURE__ */ jsx30(
|
|
38472
|
+
if (customToolCall != null) return /* @__PURE__ */ jsx30(Fragment12, { children: customToolCall });
|
|
38449
38473
|
const tone = getToolTone(toolCall.status);
|
|
38450
38474
|
const displayName = getToolDisplayLabel(toolCall);
|
|
38451
38475
|
const Renderer = customization?.renderers?.tool?.[normalizedName] ?? getRenderer(normalizedName);
|
|
38452
38476
|
const indentClass = level === 2 ? "ml-3" : "";
|
|
38453
38477
|
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */ jsx30(LoaderCircle, { size: 12, className: "animate-spin" }) : toolCall.status === "awaiting_answer" ? /* @__PURE__ */ jsx30(MessageSquareMore, { size: 12 }) : toolCall.status === "cancelled" || toolCall.status === "error" ? /* @__PURE__ */ jsx30(X, { size: 12 }) : /* @__PURE__ */ jsx30(Check, { size: 12 });
|
|
38454
38478
|
const statusTextClass = tone === "failed" ? "text-[hsl(var(--swf-danger))]" : tone === "awaiting" ? "text-[hsl(var(--swf-warning))]" : tone === "running" ? "text-[hsl(var(--muted-foreground))]" : "text-[hsl(var(--primary))]";
|
|
38455
|
-
return /* @__PURE__ */
|
|
38479
|
+
return /* @__PURE__ */ jsxs25(
|
|
38456
38480
|
"div",
|
|
38457
38481
|
{
|
|
38458
38482
|
part: normalizedName === "Agent" ? "agent-loop" : "tool-row",
|
|
@@ -38463,8 +38487,8 @@ function ToolCallBlock({
|
|
|
38463
38487
|
customization?.classNames?.toolCall
|
|
38464
38488
|
),
|
|
38465
38489
|
children: [
|
|
38466
|
-
/* @__PURE__ */
|
|
38467
|
-
/* @__PURE__ */
|
|
38490
|
+
/* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 min-h-7 pr-3 leading-5", children: [
|
|
38491
|
+
/* @__PURE__ */ jsxs25(
|
|
38468
38492
|
"button",
|
|
38469
38493
|
{
|
|
38470
38494
|
type: "button",
|
|
@@ -38482,11 +38506,11 @@ function ToolCallBlock({
|
|
|
38482
38506
|
)
|
|
38483
38507
|
}
|
|
38484
38508
|
),
|
|
38485
|
-
/* @__PURE__ */
|
|
38509
|
+
/* @__PURE__ */ jsxs25("span", { className: cn("flex shrink-0 items-center gap-1 text-[10px]", statusTextClass), children: [
|
|
38486
38510
|
statusIcon,
|
|
38487
38511
|
/* @__PURE__ */ jsx30("span", { children: getToolStatusLabel(toolCall.status) })
|
|
38488
38512
|
] }),
|
|
38489
|
-
/* @__PURE__ */
|
|
38513
|
+
/* @__PURE__ */ jsxs25("span", { className: "min-w-0 flex-1 truncate font-medium text-[hsl(var(--foreground))]", children: [
|
|
38490
38514
|
displayName,
|
|
38491
38515
|
toolCall.status === "error" ? "\uFF08\u5F85\u91CD\u8BD5\uFF09" : ""
|
|
38492
38516
|
] })
|
|
@@ -38504,12 +38528,12 @@ function ToolCallBlock({
|
|
|
38504
38528
|
}
|
|
38505
38529
|
)
|
|
38506
38530
|
] }),
|
|
38507
|
-
expanded && /* @__PURE__ */ jsx30("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx30(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */
|
|
38531
|
+
expanded && /* @__PURE__ */ jsx30("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx30(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs25(Fragment12, { children: [
|
|
38508
38532
|
/* @__PURE__ */ jsx30("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u5DE5\u5177" }),
|
|
38509
38533
|
/* @__PURE__ */ jsx30("div", { className: "mb-3 font-mono text-[11px] text-[hsl(var(--foreground))]", children: normalizedName }),
|
|
38510
38534
|
/* @__PURE__ */ jsx30("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u53C2\u6570" }),
|
|
38511
38535
|
/* @__PURE__ */ jsx30("pre", { className: "overflow-x-auto whitespace-pre-wrap rounded-md bg-[hsl(var(--muted))] p-2 font-mono text-[11px] text-[hsl(var(--foreground))]", children: formatArgs(toolCall.arguments) }),
|
|
38512
|
-
toolCall.result != null && /* @__PURE__ */
|
|
38536
|
+
toolCall.result != null && /* @__PURE__ */ jsxs25(Fragment12, { children: [
|
|
38513
38537
|
/* @__PURE__ */ jsx30("div", { className: "mb-1 mt-3 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u7ED3\u679C" }),
|
|
38514
38538
|
/* @__PURE__ */ jsx30(
|
|
38515
38539
|
"pre",
|
|
@@ -38555,19 +38579,19 @@ function buildAskUserPayload(argumentsJson) {
|
|
|
38555
38579
|
}
|
|
38556
38580
|
|
|
38557
38581
|
// src/chat/WorkflowRunBlock.tsx
|
|
38558
|
-
import { useMemo as useMemo10, useState as
|
|
38582
|
+
import { useMemo as useMemo10, useState as useState23 } from "react";
|
|
38559
38583
|
|
|
38560
38584
|
// src/chat/AgentLoopBlock.tsx
|
|
38561
|
-
import { useEffect as useEffect16, useMemo as useMemo9, useState as
|
|
38585
|
+
import { useEffect as useEffect16, useMemo as useMemo9, useState as useState22 } from "react";
|
|
38562
38586
|
import { collectInlineToolUiCards } from "@blade-hq/agent-client/internal";
|
|
38563
38587
|
|
|
38564
38588
|
// src/chat/ContextAttachmentPills.tsx
|
|
38565
|
-
import { useEffect as useEffect14, useRef as useRef15, useState as
|
|
38589
|
+
import { useEffect as useEffect14, useRef as useRef15, useState as useState20 } from "react";
|
|
38566
38590
|
|
|
38567
38591
|
// src/chat/lib/use-async-value.ts
|
|
38568
|
-
import { useEffect as useEffect13, useState as
|
|
38592
|
+
import { useEffect as useEffect13, useState as useState19 } from "react";
|
|
38569
38593
|
function useAsyncValue(key, load2) {
|
|
38570
|
-
const [result, setResult] =
|
|
38594
|
+
const [result, setResult] = useState19(null);
|
|
38571
38595
|
useEffect13(() => {
|
|
38572
38596
|
if (key === null) return;
|
|
38573
38597
|
const controller = new AbortController();
|
|
@@ -38588,7 +38612,7 @@ function useAsyncValue(key, load2) {
|
|
|
38588
38612
|
}
|
|
38589
38613
|
|
|
38590
38614
|
// src/chat/AttachmentPreviewDialog.tsx
|
|
38591
|
-
import { jsx as jsx31, jsxs as
|
|
38615
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
38592
38616
|
function AttachmentPreviewDialog({ open: open2, onOpenChange, filename, url: url2, mode }) {
|
|
38593
38617
|
const enabled = open2 && url2 != null && (mode === "markdown" || mode === "text");
|
|
38594
38618
|
const { data: content3, error: error61 } = useAsyncValue(enabled ? `${mode}:${url2}` : null, async (signal) => {
|
|
@@ -38604,15 +38628,15 @@ function AttachmentPreviewDialog({ open: open2, onOpenChange, filename, url: url
|
|
|
38604
38628
|
return res.text();
|
|
38605
38629
|
});
|
|
38606
38630
|
if (!open2) return null;
|
|
38607
|
-
return /* @__PURE__ */ jsx31(Dialog, { open: open2, onOpenChange, children: /* @__PURE__ */
|
|
38631
|
+
return /* @__PURE__ */ jsx31(Dialog, { open: open2, onOpenChange, children: /* @__PURE__ */ jsxs26(
|
|
38608
38632
|
DialogContent,
|
|
38609
38633
|
{
|
|
38610
38634
|
showCloseButton: false,
|
|
38611
38635
|
className: "flex max-h-[90vh] w-full max-w-3xl flex-col gap-0 overflow-hidden p-0",
|
|
38612
38636
|
children: [
|
|
38613
|
-
/* @__PURE__ */
|
|
38637
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
|
|
38614
38638
|
/* @__PURE__ */ jsx31(DialogTitle, { className: "truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: filename }),
|
|
38615
|
-
/* @__PURE__ */
|
|
38639
|
+
/* @__PURE__ */ jsxs26("div", { className: "flex items-center gap-1", children: [
|
|
38616
38640
|
url2 && /* @__PURE__ */ jsx31(
|
|
38617
38641
|
"a",
|
|
38618
38642
|
{
|
|
@@ -38650,14 +38674,14 @@ function renderContent({
|
|
|
38650
38674
|
return /* @__PURE__ */ jsx31("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6B64\u9644\u4EF6\u6682\u65E0\u53EF\u7528\u9884\u89C8\u5730\u5740\u3002" });
|
|
38651
38675
|
}
|
|
38652
38676
|
if (mode === "default") {
|
|
38653
|
-
return /* @__PURE__ */
|
|
38677
|
+
return /* @__PURE__ */ jsxs26("p", { className: "text-[hsl(var(--muted-foreground))]", children: [
|
|
38654
38678
|
"\u6B64\u7C7B\u578B\u6682\u4E0D\u652F\u6301\u5185\u5D4C\u9884\u89C8\u3002\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2",
|
|
38655
38679
|
/* @__PURE__ */ jsx31("span", { className: "mx-1 font-medium text-[hsl(var(--foreground))]", children: "\u4E0B\u8F7D" }),
|
|
38656
38680
|
"\u6309\u94AE\u67E5\u770B\u3002"
|
|
38657
38681
|
] });
|
|
38658
38682
|
}
|
|
38659
38683
|
if (error61) {
|
|
38660
|
-
return /* @__PURE__ */
|
|
38684
|
+
return /* @__PURE__ */ jsxs26("p", { className: "text-[hsl(var(--destructive))]", children: [
|
|
38661
38685
|
"\u52A0\u8F7D\u5931\u8D25\uFF1A",
|
|
38662
38686
|
String(error61?.message ?? error61)
|
|
38663
38687
|
] });
|
|
@@ -38708,15 +38732,15 @@ function dispatchPreview(filename, url2) {
|
|
|
38708
38732
|
}
|
|
38709
38733
|
|
|
38710
38734
|
// src/chat/ContextAttachmentPills.tsx
|
|
38711
|
-
import { Fragment as
|
|
38735
|
+
import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
38712
38736
|
function ContextAttachmentPills({ attachments }) {
|
|
38713
38737
|
const client = useOptionalBladeClient();
|
|
38714
38738
|
const download = useRef15(null);
|
|
38715
38739
|
useEffect14(() => () => download.current?.abort(), []);
|
|
38716
|
-
const [selected, setSelected] =
|
|
38717
|
-
const [preview, setPreview] =
|
|
38718
|
-
const [loading, setLoading] =
|
|
38719
|
-
const [unavailable, setUnavailable] =
|
|
38740
|
+
const [selected, setSelected] = useState20(null);
|
|
38741
|
+
const [preview, setPreview] = useState20(null);
|
|
38742
|
+
const [loading, setLoading] = useState20(null);
|
|
38743
|
+
const [unavailable, setUnavailable] = useState20(null);
|
|
38720
38744
|
useEffect14(() => () => {
|
|
38721
38745
|
if (preview) URL.revokeObjectURL(preview.url);
|
|
38722
38746
|
}, [preview]);
|
|
@@ -38744,19 +38768,19 @@ function ContextAttachmentPills({ attachments }) {
|
|
|
38744
38768
|
if (!controller.signal.aborted) setLoading(null);
|
|
38745
38769
|
}
|
|
38746
38770
|
};
|
|
38747
|
-
return /* @__PURE__ */
|
|
38771
|
+
return /* @__PURE__ */ jsxs27(Fragment13, { children: [
|
|
38748
38772
|
/* @__PURE__ */ jsx32("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u9644\u52A0\u8D44\u6599", children: attachments.map((item) => /* @__PURE__ */ jsx32("button", { type: "button", onClick: () => {
|
|
38749
38773
|
setSelected(selected?.id === item.id ? null : item);
|
|
38750
38774
|
setUnavailable(null);
|
|
38751
38775
|
}, "aria-expanded": selected?.id === item.id, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: item.label }, item.id)) }),
|
|
38752
|
-
selected && /* @__PURE__ */
|
|
38776
|
+
selected && /* @__PURE__ */ jsxs27("div", { className: "max-w-full rounded-xl border border-border bg-muted p-3 text-sm text-foreground", children: [
|
|
38753
38777
|
/* @__PURE__ */ jsx32("div", { className: "mb-2 font-medium", children: selected.label }),
|
|
38754
38778
|
/* @__PURE__ */ jsx32("div", { className: "whitespace-pre-wrap break-words", children: selected.content }),
|
|
38755
|
-
selected.files?.map((file2, index2) => /* @__PURE__ */
|
|
38779
|
+
selected.files?.map((file2, index2) => /* @__PURE__ */ jsxs27("button", { type: "button", disabled: loading != null || !file2.path || !file2.session_id, onClick: () => void openFile(file2), className: "mt-2 block max-w-full truncate text-left underline", children: [
|
|
38756
38780
|
file2.name,
|
|
38757
38781
|
!file2.path || !file2.session_id ? " \xB7 \u6587\u4EF6\u4E0D\u53EF\u7528" : loading === file2.name ? " \xB7 \u8BFB\u53D6\u4E2D" : ""
|
|
38758
38782
|
] }, index2)),
|
|
38759
|
-
unavailable && /* @__PURE__ */
|
|
38783
|
+
unavailable && /* @__PURE__ */ jsxs27("output", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
38760
38784
|
unavailable,
|
|
38761
38785
|
" \xB7 \u6587\u4EF6\u4E0D\u53EF\u7528"
|
|
38762
38786
|
] })
|
|
@@ -38769,7 +38793,7 @@ function ContextAttachmentPills({ attachments }) {
|
|
|
38769
38793
|
|
|
38770
38794
|
// src/chat/UserMessageBubble.tsx
|
|
38771
38795
|
import { chatErrorForDisplay } from "@blade-hq/agent-client";
|
|
38772
|
-
import { useEffect as useEffect15, useState as
|
|
38796
|
+
import { useEffect as useEffect15, useState as useState21 } from "react";
|
|
38773
38797
|
import { extractTextAttachments, getFileParts, getImageParts, getTextContent } from "@blade-hq/agent-client/internal";
|
|
38774
38798
|
|
|
38775
38799
|
// src/lib/whatif-prompt.ts
|
|
@@ -38825,10 +38849,10 @@ function parseWhatIfPrompt(text4) {
|
|
|
38825
38849
|
}
|
|
38826
38850
|
|
|
38827
38851
|
// src/chat/MessageContextPills.tsx
|
|
38828
|
-
import { jsx as jsx33, jsxs as
|
|
38852
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
38829
38853
|
function MessageContextPills({ contexts }) {
|
|
38830
38854
|
if (contexts.length === 0) return null;
|
|
38831
|
-
return /* @__PURE__ */ jsx33("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index2) => /* @__PURE__ */
|
|
38855
|
+
return /* @__PURE__ */ jsx33("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index2) => /* @__PURE__ */ jsxs28(
|
|
38832
38856
|
"div",
|
|
38833
38857
|
{
|
|
38834
38858
|
className: "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--primary)/0.25)] bg-[hsl(var(--primary)/0.1)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary)/0.85)]",
|
|
@@ -38843,7 +38867,7 @@ function MessageContextPills({ contexts }) {
|
|
|
38843
38867
|
}
|
|
38844
38868
|
|
|
38845
38869
|
// src/chat/TextAttachmentPills.tsx
|
|
38846
|
-
import { Fragment as
|
|
38870
|
+
import { Fragment as Fragment14, jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
38847
38871
|
function getFileIcon2(fileName) {
|
|
38848
38872
|
const lower2 = fileName.toLowerCase();
|
|
38849
38873
|
if (/\.(zip|rar|7z|tar|gz)$/.test(lower2)) return Archive;
|
|
@@ -38861,7 +38885,7 @@ function TextAttachmentPills({ attachments, onPreview }) {
|
|
|
38861
38885
|
return /* @__PURE__ */ jsx34("div", { className: "flex flex-wrap gap-1.5", children: attachments.map((att, index2) => {
|
|
38862
38886
|
const Icon = getFileIcon2(att.name);
|
|
38863
38887
|
const key = `${att.uploadedPath ?? att.name}:${att.name}:${index2}`;
|
|
38864
|
-
const content3 = /* @__PURE__ */
|
|
38888
|
+
const content3 = /* @__PURE__ */ jsxs29(Fragment14, { children: [
|
|
38865
38889
|
/* @__PURE__ */ jsx34(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.6)]" }),
|
|
38866
38890
|
/* @__PURE__ */ jsx34("span", { className: "max-w-40 truncate", children: att.name })
|
|
38867
38891
|
] });
|
|
@@ -38883,19 +38907,19 @@ function TextAttachmentPills({ attachments, onPreview }) {
|
|
|
38883
38907
|
}
|
|
38884
38908
|
|
|
38885
38909
|
// src/components/WhatIfUserBubble.tsx
|
|
38886
|
-
import { jsx as jsx35, jsxs as
|
|
38910
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
38887
38911
|
function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
38888
38912
|
const { fromStep, quotes, userText } = parsed;
|
|
38889
|
-
return /* @__PURE__ */
|
|
38890
|
-
/* @__PURE__ */
|
|
38913
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col items-end gap-2", children: [
|
|
38914
|
+
/* @__PURE__ */ jsxs30("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: [
|
|
38891
38915
|
/* @__PURE__ */ jsx35(RefreshCcw, { size: 10 }),
|
|
38892
38916
|
/* @__PURE__ */ jsx35("span", { children: fromStep != null ? `\u91CD\u8DD1\u81EA step ${fromStep}` : "\u91CD\u8DD1" })
|
|
38893
38917
|
] }),
|
|
38894
38918
|
quotes.length > 0 && /* @__PURE__ */ jsx35("div", { className: "flex max-w-[min(72vw,42rem)] flex-col items-stretch gap-2", children: quotes.map((quote, index2) => {
|
|
38895
38919
|
const clickable = quote.stepNumber != null && !!onQuoteClick;
|
|
38896
38920
|
const label = quote.stepNumber != null ? `\u6B65\u9AA4${quote.stepNumber} \xB7 ${quote.label}` : quote.label;
|
|
38897
|
-
return /* @__PURE__ */
|
|
38898
|
-
/* @__PURE__ */
|
|
38921
|
+
return /* @__PURE__ */ jsxs30("div", { className: "rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.8)] px-3 py-2 text-left", children: [
|
|
38922
|
+
/* @__PURE__ */ jsxs30("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: [
|
|
38899
38923
|
/* @__PURE__ */ jsx35("span", { children: "\u21B3" }),
|
|
38900
38924
|
/* @__PURE__ */ jsx35("span", { className: "truncate", children: label })
|
|
38901
38925
|
] }),
|
|
@@ -38907,7 +38931,7 @@ function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
|
38907
38931
|
}
|
|
38908
38932
|
|
|
38909
38933
|
// src/chat/UserMessageBubble.tsx
|
|
38910
|
-
import { jsx as jsx36, jsxs as
|
|
38934
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
38911
38935
|
function isUserMessage(message) {
|
|
38912
38936
|
return message.role === "user";
|
|
38913
38937
|
}
|
|
@@ -38958,13 +38982,13 @@ function UserMessageBubble({ message, className }) {
|
|
|
38958
38982
|
} = extractTextAttachments(message.content);
|
|
38959
38983
|
const trimmedClean = cleanText.trim();
|
|
38960
38984
|
const pluginPills = message.refs?.length ? /* @__PURE__ */ jsx36("div", { className: "flex flex-wrap justify-end gap-1.5", "aria-label": "\u6D88\u606F\u5F15\u7528", children: message.refs.map((ref) => /* @__PURE__ */ jsx36("span", { className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs", children: ref.provider === "skill" ? `\u6280\u80FD \xB7 ${ref.label}` : ref.label }, ref.provider === "skill" ? `skill:${ref.id}` : `${ref.plugin}:${ref.server}:${ref.id}`)) }) : null;
|
|
38961
|
-
const topicAssetPills = message.topic_asset_refs?.length ? /* @__PURE__ */ jsx36("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u5F15\u7528\u7684\u4E3B\u9898\u8D44\u4EA7", children: message.topic_asset_refs.map((ref) => /* @__PURE__ */
|
|
38985
|
+
const topicAssetPills = message.topic_asset_refs?.length ? /* @__PURE__ */ jsx36("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u5F15\u7528\u7684\u4E3B\u9898\u8D44\u4EA7", children: message.topic_asset_refs.map((ref) => /* @__PURE__ */ jsxs31("span", { title: ref.path, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: [
|
|
38962
38986
|
"\u4E3B\u9898\u8D44\u4EA7 \xB7 ",
|
|
38963
38987
|
ref.path
|
|
38964
38988
|
] }, `${ref.topic_id}:${ref.path}`)) }) : null;
|
|
38965
38989
|
const whatifParsed = trimmedClean && imageParts.length === 0 && fileParts.length === 0 && textAttachments.length === 0 ? parseWhatIfPrompt(cleanText) : null;
|
|
38966
38990
|
if (whatifParsed && customBubble == null) {
|
|
38967
|
-
return /* @__PURE__ */ jsx36("div", { part: "user-row", className: "blade-chat-user-row flex justify-end", children: /* @__PURE__ */
|
|
38991
|
+
return /* @__PURE__ */ jsx36("div", { part: "user-row", className: "blade-chat-user-row flex justify-end", children: /* @__PURE__ */ jsxs31("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-2", children: [
|
|
38968
38992
|
pluginPills,
|
|
38969
38993
|
topicAssetPills,
|
|
38970
38994
|
/* @__PURE__ */ jsx36(ContextAttachmentPills, { attachments: message.context_attachments }),
|
|
@@ -39000,8 +39024,8 @@ function UserMessageBubble({ message, className }) {
|
|
|
39000
39024
|
alt: imageTextAttachmentMeta[i2]?.name || "\u7528\u6237\u4E0A\u4F20\u7684\u56FE\u7247"
|
|
39001
39025
|
}))
|
|
39002
39026
|
];
|
|
39003
|
-
const [lightboxIndex, setLightboxIndex] =
|
|
39004
|
-
const [preview, setPreview] =
|
|
39027
|
+
const [lightboxIndex, setLightboxIndex] = useState21(null);
|
|
39028
|
+
const [preview, setPreview] = useState21(null);
|
|
39005
39029
|
const handleTextAttachmentPreview = (attachment) => {
|
|
39006
39030
|
if (!activeSessionId || !client) return;
|
|
39007
39031
|
const pathForUrl = attachment.uploadedPath ?? attachment.name;
|
|
@@ -39020,8 +39044,8 @@ function UserMessageBubble({ message, className }) {
|
|
|
39020
39044
|
const mode = kind === "text" ? lower2.endsWith(".md") ? "markdown" : "text" : "default";
|
|
39021
39045
|
setPreview({ filename: attachment.name, url: url2, mode });
|
|
39022
39046
|
};
|
|
39023
|
-
return /* @__PURE__ */ jsx36("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", className), children: /* @__PURE__ */
|
|
39024
|
-
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */
|
|
39047
|
+
return /* @__PURE__ */ jsx36("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", className), children: /* @__PURE__ */ jsxs31("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-3", children: [
|
|
39048
|
+
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */ jsxs31("div", { className: "grid gap-2", children: [
|
|
39025
39049
|
imageParts.map((part, idx) => /* @__PURE__ */ jsx36(
|
|
39026
39050
|
"button",
|
|
39027
39051
|
{
|
|
@@ -39133,7 +39157,7 @@ function ErrorMessageBlock({
|
|
|
39133
39157
|
}) {
|
|
39134
39158
|
const text4 = chatErrorForDisplay(getTextContent(message.content));
|
|
39135
39159
|
const looksLikeModelUnavailable = /no source matches this model|404/i.test(text4);
|
|
39136
|
-
return /* @__PURE__ */ jsx36("div", { part: "error-row", className: cn("blade-chat-error-row flex min-w-0 justify-start", className), children: /* @__PURE__ */
|
|
39160
|
+
return /* @__PURE__ */ jsx36("div", { part: "error-row", className: cn("blade-chat-error-row flex min-w-0 justify-start", className), children: /* @__PURE__ */ jsxs31("div", { className: "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: [
|
|
39137
39161
|
text4,
|
|
39138
39162
|
looksLikeModelUnavailable ? /* @__PURE__ */ jsx36("div", { className: "mt-1 opacity-80", children: "\u6A21\u578B\u53EF\u80FD\u672A\u542F\u52A8\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002" }) : null
|
|
39139
39163
|
] }) });
|
|
@@ -39148,7 +39172,7 @@ function findLatestReasoningMessageIndex(messages) {
|
|
|
39148
39172
|
}
|
|
39149
39173
|
|
|
39150
39174
|
// src/chat/AgentLoopBlock.tsx
|
|
39151
|
-
import { Fragment as
|
|
39175
|
+
import { Fragment as Fragment15, jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
39152
39176
|
var COLLAPSED_SUMMARY_HIDDEN_TOOLS = /* @__PURE__ */ new Set(["ReadSkill", "Read"]);
|
|
39153
39177
|
function safeParseDescription(argsStr) {
|
|
39154
39178
|
try {
|
|
@@ -39208,7 +39232,7 @@ function AgentLoopBlock({
|
|
|
39208
39232
|
() => visibleLoopToolCalls.some((childToolCall) => childToolCall.status === "awaiting_answer" && !askAnswers?.[childToolCall.id]),
|
|
39209
39233
|
[visibleLoopToolCalls, askAnswers]
|
|
39210
39234
|
);
|
|
39211
|
-
const [expanded, setExpanded] =
|
|
39235
|
+
const [expanded, setExpanded] = useState22(defaultExpanded || hasAwaitingAnswer);
|
|
39212
39236
|
const completedToolLabels = useMemo9(
|
|
39213
39237
|
() => visibleLoopToolCalls.flatMap((childToolCall) => {
|
|
39214
39238
|
const isCompleted = childToolCall.status === "done" || childToolCall.status !== "pending" && childToolCall.status !== "awaiting_answer" && childToolCall.status !== "error" && childToolCall.status !== "cancelled";
|
|
@@ -39251,7 +39275,7 @@ function AgentLoopBlock({
|
|
|
39251
39275
|
const status = hasAwaitingAnswer || toolCall.status === "awaiting_answer" && visibleLoopToolCalls.length === 0 ? "awaiting_answer" : toolCall.status === "pending" || loopEntry?.info.status === "running" ? "running" : toolCall.status === "error" || loopEntry?.info.status === "error" ? "error" : toolCall.status === "cancelled" || loopEntry?.info.status === "cancelled" ? "cancelled" : "done";
|
|
39252
39276
|
const latestReasoningIndex = status === "running" ? findLatestReasoningMessageIndex(childMessages) : -1;
|
|
39253
39277
|
const cardStyles = getLoopCardStyles(status);
|
|
39254
|
-
return /* @__PURE__ */
|
|
39278
|
+
return /* @__PURE__ */ jsxs32(
|
|
39255
39279
|
"div",
|
|
39256
39280
|
{
|
|
39257
39281
|
part: "agent-loop",
|
|
@@ -39260,8 +39284,8 @@ function AgentLoopBlock({
|
|
|
39260
39284
|
cardStyles.borderClass
|
|
39261
39285
|
),
|
|
39262
39286
|
children: [
|
|
39263
|
-
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */
|
|
39264
|
-
/* @__PURE__ */
|
|
39287
|
+
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs32(Fragment15, { children: [
|
|
39288
|
+
/* @__PURE__ */ jsxs32(
|
|
39265
39289
|
"div",
|
|
39266
39290
|
{
|
|
39267
39291
|
className: cn(
|
|
@@ -39276,9 +39300,9 @@ function AgentLoopBlock({
|
|
|
39276
39300
|
onClick: toggleExpanded,
|
|
39277
39301
|
"aria-expanded": expanded,
|
|
39278
39302
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
39279
|
-
children: /* @__PURE__ */
|
|
39303
|
+
children: /* @__PURE__ */ jsxs32("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
39280
39304
|
status === "awaiting_answer" ? /* @__PURE__ */ jsx37(MessageSquareMore, { size: 14, className: "shrink-0 text-[hsl(var(--swf-warning))] motion-safe:animate-pulse" }) : /* @__PURE__ */ jsx37(Bot, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
39281
|
-
/* @__PURE__ */
|
|
39305
|
+
/* @__PURE__ */ jsxs32("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: [
|
|
39282
39306
|
renderDescription ? renderDescription(description) : description,
|
|
39283
39307
|
status === "awaiting_answer" ? " \u2014 \u7B49\u5F85\u56DE\u7B54" : ""
|
|
39284
39308
|
] })
|
|
@@ -39324,12 +39348,12 @@ function AgentLoopBlock({
|
|
|
39324
39348
|
level: 2
|
|
39325
39349
|
},
|
|
39326
39350
|
childToolCall.id
|
|
39327
|
-
)) : /* @__PURE__ */
|
|
39351
|
+
)) : /* @__PURE__ */ jsxs32("div", { className: "flex items-center gap-2 px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
39328
39352
|
/* @__PURE__ */ jsx37(LoaderCircle, { size: 12, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }),
|
|
39329
39353
|
/* @__PURE__ */ jsx37("span", { children: "\u6B63\u5728\u542F\u52A8..." })
|
|
39330
39354
|
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */ jsx37("div", { className: "flex flex-col gap-1 py-2", children: /* @__PURE__ */ jsx37("div", { className: "px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: "\u8BF7\u5728\u4E0B\u65B9\u5B50\u667A\u80FD\u4F53\u5BF9\u8BDD\u4E2D\u5B8C\u6210\u786E\u8BA4" }) }) : null
|
|
39331
|
-
] }) : /* @__PURE__ */
|
|
39332
|
-
/* @__PURE__ */
|
|
39355
|
+
] }) : /* @__PURE__ */ jsxs32(Fragment15, { children: [
|
|
39356
|
+
/* @__PURE__ */ jsxs32(
|
|
39333
39357
|
"div",
|
|
39334
39358
|
{
|
|
39335
39359
|
className: cn(
|
|
@@ -39344,7 +39368,7 @@ function AgentLoopBlock({
|
|
|
39344
39368
|
onClick: toggleExpanded,
|
|
39345
39369
|
"aria-expanded": expanded,
|
|
39346
39370
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
39347
|
-
children: /* @__PURE__ */
|
|
39371
|
+
children: /* @__PURE__ */ jsxs32("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
39348
39372
|
status === "error" ? /* @__PURE__ */ jsx37(X, { size: 14, className: cn("shrink-0", cardStyles.iconClass) }) : status === "cancelled" ? /* @__PURE__ */ jsx37(Ban, { size: 14, className: cn("shrink-0", cardStyles.iconClass) }) : /* @__PURE__ */ jsx37(Check, { size: 14, className: "shrink-0 text-[hsl(var(--swf-success))]" }),
|
|
39349
39373
|
/* @__PURE__ */ jsx37("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: renderDescription ? renderDescription(description) : description })
|
|
39350
39374
|
] })
|
|
@@ -39381,9 +39405,9 @@ function AgentLoopBlock({
|
|
|
39381
39405
|
]
|
|
39382
39406
|
}
|
|
39383
39407
|
),
|
|
39384
|
-
!expanded ? /* @__PURE__ */
|
|
39408
|
+
!expanded ? /* @__PURE__ */ jsxs32(Fragment15, { children: [
|
|
39385
39409
|
/* @__PURE__ */ jsx37("div", { className: "flex flex-wrap gap-1.5 px-4 py-2", children: completedToolLabels.length > 0 ? completedToolLabels.map(
|
|
39386
|
-
(item) => item.kind === "file" ? /* @__PURE__ */
|
|
39410
|
+
(item) => item.kind === "file" ? /* @__PURE__ */ jsxs32(
|
|
39387
39411
|
"span",
|
|
39388
39412
|
{
|
|
39389
39413
|
className: "inline-flex min-w-0 items-center gap-1 rounded-[6px] bg-[hsl(var(--muted))] px-2 py-0.5 text-xs font-medium text-[hsl(var(--secondary-foreground))]",
|
|
@@ -39406,10 +39430,10 @@ function AgentLoopBlock({
|
|
|
39406
39430
|
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */ jsx37("div", { className: "flex flex-col gap-2 px-4 pb-3", children: inlineToolUiBlocks.map((block) => /* @__PURE__ */ jsx37(ToolUiCard, { card: block.card, sessionId }, block.key)) }) : null
|
|
39407
39431
|
] }) : null
|
|
39408
39432
|
] }),
|
|
39409
|
-
expanded && /* @__PURE__ */
|
|
39433
|
+
expanded && /* @__PURE__ */ jsxs32("div", { className: "border-t border-[hsl(var(--border))] py-2", children: [
|
|
39410
39434
|
(() => {
|
|
39411
39435
|
const taskPrompt = safeParsePrompt(toolCall.arguments);
|
|
39412
|
-
return taskPrompt ? /* @__PURE__ */
|
|
39436
|
+
return taskPrompt ? /* @__PURE__ */ jsxs32("details", { className: "mx-3 mb-2 rounded-md bg-[hsl(var(--muted))]/40", children: [
|
|
39413
39437
|
/* @__PURE__ */ jsx37("summary", { className: "cursor-pointer px-3 py-1.5 text-[11px] font-medium text-[hsl(var(--muted-foreground))]", children: "\u4EFB\u52A1" }),
|
|
39414
39438
|
/* @__PURE__ */ jsx37("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsx37("pre", { className: "whitespace-pre-wrap text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: taskPrompt }) })
|
|
39415
39439
|
] }) : null;
|
|
@@ -39439,7 +39463,7 @@ function AgentLoopBlock({
|
|
|
39439
39463
|
},
|
|
39440
39464
|
message.entry_id ?? `${message.timestamp ?? "error"}-${index2}`
|
|
39441
39465
|
) : null
|
|
39442
|
-
) }) : status === "running" ? /* @__PURE__ */
|
|
39466
|
+
) }) : status === "running" ? /* @__PURE__ */ jsxs32("div", { className: "px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
39443
39467
|
/* @__PURE__ */ jsx37(LoaderCircle, { size: 12, className: "mr-1.5 inline animate-spin" }),
|
|
39444
39468
|
"\u6B63\u5728\u542F\u52A8..."
|
|
39445
39469
|
] }) : toolCall.result ? /* @__PURE__ */ jsx37("pre", { className: "max-h-[400px] overflow-auto px-3 py-2 whitespace-pre-wrap text-[11px] text-[hsl(var(--muted-foreground))]", children: typeof toolCall.result === "string" ? toolCall.result : JSON.stringify(toolCall.result, null, 2) }) : null
|
|
@@ -39463,8 +39487,8 @@ function ExpandedChildAssistantMessage({
|
|
|
39463
39487
|
(toolCall) => formatToolName(toolCall.name) !== "AskUserQuestion"
|
|
39464
39488
|
) : message.tool_calls ?? [];
|
|
39465
39489
|
const hasToolCalls = toolCalls.length > 0;
|
|
39466
|
-
return /* @__PURE__ */
|
|
39467
|
-
showReasoning && message.reasoning && /* @__PURE__ */
|
|
39490
|
+
return /* @__PURE__ */ jsxs32("div", { className: "flex flex-col gap-2", children: [
|
|
39491
|
+
showReasoning && message.reasoning && /* @__PURE__ */ jsxs32(Reasoning, { isStreaming, children: [
|
|
39468
39492
|
/* @__PURE__ */ jsx37(ReasoningTrigger, { wordCount: message.reasoning.length }),
|
|
39469
39493
|
/* @__PURE__ */ jsx37(ReasoningContent, { children: message.reasoning })
|
|
39470
39494
|
] }),
|
|
@@ -39510,7 +39534,7 @@ function ChildText({
|
|
|
39510
39534
|
sessionId,
|
|
39511
39535
|
reasoning
|
|
39512
39536
|
}) {
|
|
39513
|
-
return /* @__PURE__ */
|
|
39537
|
+
return /* @__PURE__ */ jsxs32("div", { className: "pl-8 text-[12px] leading-6 text-[hsl(var(--foreground))]", children: [
|
|
39514
39538
|
/* @__PURE__ */ jsx37(
|
|
39515
39539
|
MarkdownContent,
|
|
39516
39540
|
{
|
|
@@ -39550,7 +39574,7 @@ function getLoopCardStyles(status) {
|
|
|
39550
39574
|
}
|
|
39551
39575
|
|
|
39552
39576
|
// src/chat/WorkflowRunBlock.tsx
|
|
39553
|
-
import { Fragment as
|
|
39577
|
+
import { Fragment as Fragment16, jsx as jsx38, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
39554
39578
|
var EMPTY_ENTRIES = [];
|
|
39555
39579
|
function synthToolCall(loopName, info, desc) {
|
|
39556
39580
|
return {
|
|
@@ -39641,7 +39665,7 @@ function RefTokenText({ text: text4, refs }) {
|
|
|
39641
39665
|
const id = match[1];
|
|
39642
39666
|
const info = refs.get(id);
|
|
39643
39667
|
parts.push(
|
|
39644
|
-
/* @__PURE__ */
|
|
39668
|
+
/* @__PURE__ */ jsxs33(
|
|
39645
39669
|
"span",
|
|
39646
39670
|
{
|
|
39647
39671
|
title: info?.value ? info.value.slice(0, 300) : "\u5C1A\u65E0\u8F93\u51FA",
|
|
@@ -39657,13 +39681,13 @@ function RefTokenText({ text: text4, refs }) {
|
|
|
39657
39681
|
cursor = match.index + match[0].length;
|
|
39658
39682
|
}
|
|
39659
39683
|
if (cursor < text4.length) parts.push(text4.slice(cursor));
|
|
39660
|
-
return /* @__PURE__ */ jsx38(
|
|
39684
|
+
return /* @__PURE__ */ jsx38(Fragment16, { children: parts });
|
|
39661
39685
|
}
|
|
39662
39686
|
function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
39663
39687
|
const run = useSessionState(sessionId, (state) => state.workflowRuns[toolCall.id]);
|
|
39664
39688
|
const agentLoops = useSessionState(sessionId, (state) => state.agentLoops);
|
|
39665
39689
|
const sessionMessages = useSessionState(sessionId, (state) => state.messages);
|
|
39666
|
-
const [collapsed, setCollapsed] =
|
|
39690
|
+
const [collapsed, setCollapsed] = useState23(false);
|
|
39667
39691
|
const stepLoops = useMemo10(
|
|
39668
39692
|
() => Object.entries(agentLoops).filter(([, info]) => info.workflowRunId === toolCall.id).map(([loopName, info]) => ({ loopName, info })),
|
|
39669
39693
|
[agentLoops, toolCall.id]
|
|
@@ -39716,8 +39740,8 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
39716
39740
|
const title = run?.name || "\u6280\u80FD";
|
|
39717
39741
|
const statusSummary = running ? `\u8FDB\u884C\u4E2D \xB7 ${stepCount} \u6B65` : status === "error" ? `\u5931\u8D25 \xB7 ${stepCount} \u6B65` : status === "cancelled" ? `\u5DF2\u53D6\u6D88 \xB7 ${stepCount} \u6B65` : `\u5DF2\u5B8C\u6210 \xB7 ${stepCount} \u6B65`;
|
|
39718
39742
|
const hasStepContent = groups.length > 0 || stepLoops.length > 0;
|
|
39719
|
-
return /* @__PURE__ */
|
|
39720
|
-
/* @__PURE__ */
|
|
39743
|
+
return /* @__PURE__ */ jsxs33("div", { className: "msg-animate overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]/50", children: [
|
|
39744
|
+
/* @__PURE__ */ jsxs33(
|
|
39721
39745
|
"button",
|
|
39722
39746
|
{
|
|
39723
39747
|
type: "button",
|
|
@@ -39726,11 +39750,11 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
39726
39750
|
className: "flex w-full items-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--primary)/0.06)] px-4 py-2.5 text-left transition-colors hover:bg-[hsl(var(--primary)/0.1)] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
39727
39751
|
children: [
|
|
39728
39752
|
/* @__PURE__ */ jsx38(Zap, { size: 15, className: "shrink-0 text-violet-600" }),
|
|
39729
|
-
/* @__PURE__ */
|
|
39753
|
+
/* @__PURE__ */ jsxs33("span", { className: "min-w-0 truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: [
|
|
39730
39754
|
"\u56FA\u5B9A\u6D41\u7A0B \xB7 ",
|
|
39731
39755
|
title
|
|
39732
39756
|
] }),
|
|
39733
|
-
/* @__PURE__ */
|
|
39757
|
+
/* @__PURE__ */ jsxs33("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
39734
39758
|
running ? /* @__PURE__ */ jsx38(LoaderCircle, { size: 12, className: "animate-spin" }) : null,
|
|
39735
39759
|
statusSummary
|
|
39736
39760
|
] }),
|
|
@@ -39747,13 +39771,13 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
39747
39771
|
]
|
|
39748
39772
|
}
|
|
39749
39773
|
),
|
|
39750
|
-
!collapsed && /* @__PURE__ */
|
|
39774
|
+
!collapsed && /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-2 p-3", children: [
|
|
39751
39775
|
/* @__PURE__ */ jsx38(LogLines, { logs: meaningfulLogs(prelude) }),
|
|
39752
39776
|
groups.map((group, index2) => {
|
|
39753
39777
|
const loop = groupLoops[index2];
|
|
39754
39778
|
const logs = meaningfulLogs(group.logs);
|
|
39755
39779
|
if (loop) {
|
|
39756
|
-
return /* @__PURE__ */
|
|
39780
|
+
return /* @__PURE__ */ jsxs33("div", { className: "flex flex-col gap-1", children: [
|
|
39757
39781
|
/* @__PURE__ */ jsx38(
|
|
39758
39782
|
AgentLoopBlock,
|
|
39759
39783
|
{
|
|
@@ -39767,7 +39791,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
39767
39791
|
] }, group.key);
|
|
39768
39792
|
}
|
|
39769
39793
|
const container = CONTAINER_LABEL[group.stepKind];
|
|
39770
|
-
return /* @__PURE__ */
|
|
39794
|
+
return /* @__PURE__ */ jsxs33(
|
|
39771
39795
|
"div",
|
|
39772
39796
|
{
|
|
39773
39797
|
className: cn(
|
|
@@ -39775,7 +39799,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
39775
39799
|
container ? "border border-dashed border-violet-400/50 bg-violet-500/5" : "border border-[hsl(var(--border))] bg-[hsl(var(--card))]"
|
|
39776
39800
|
),
|
|
39777
39801
|
children: [
|
|
39778
|
-
/* @__PURE__ */
|
|
39802
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-1.5 text-sm text-[hsl(var(--foreground))]", children: [
|
|
39779
39803
|
/* @__PURE__ */ jsx38(StatusIcon, { status: stepStatus(group, status) }),
|
|
39780
39804
|
container ? /* @__PURE__ */ jsx38("span", { className: "text-[11px] font-semibold text-violet-600", children: container }) : null,
|
|
39781
39805
|
/* @__PURE__ */ jsx38("span", { className: "min-w-0 truncate", children: renderRefText(group.desc || group.stepId) })
|
|
@@ -39797,7 +39821,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
39797
39821
|
step.loopName
|
|
39798
39822
|
)),
|
|
39799
39823
|
(!hasStepContent && output2 || status === "error" && output2) && /* @__PURE__ */ jsx38("pre", { className: "max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-[hsl(var(--border))] px-3 py-2 font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]", children: output2 }),
|
|
39800
|
-
status === "done" && hasStepContent && finalOutput && /* @__PURE__ */
|
|
39824
|
+
status === "done" && hasStepContent && finalOutput && /* @__PURE__ */ jsxs33("details", { className: "rounded-lg border border-[hsl(var(--border))] px-3 py-2", children: [
|
|
39801
39825
|
/* @__PURE__ */ jsx38("summary", { className: "cursor-pointer select-none text-xs text-[hsl(var(--muted-foreground))]", children: "\u6700\u7EC8\u8F93\u51FA" }),
|
|
39802
39826
|
/* @__PURE__ */ jsx38("pre", { className: "mt-1.5 max-h-48 overflow-y-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]", children: finalOutput })
|
|
39803
39827
|
] }),
|
|
@@ -39859,7 +39883,7 @@ function toolCallAnswered(toolCall, sessionStatus, answerData) {
|
|
|
39859
39883
|
}
|
|
39860
39884
|
|
|
39861
39885
|
// src/chat/AssistantTurnBlock.tsx
|
|
39862
|
-
import { jsx as jsx39, jsxs as
|
|
39886
|
+
import { jsx as jsx39, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
39863
39887
|
var EMPTY_MESSAGES = [];
|
|
39864
39888
|
var EMPTY_AGENT_LOOPS = {};
|
|
39865
39889
|
var turnDisplayModeMemory = /* @__PURE__ */ new Map();
|
|
@@ -40077,7 +40101,7 @@ function AssistantTurnBlockBase({
|
|
|
40077
40101
|
),
|
|
40078
40102
|
[assistantTurnMessages]
|
|
40079
40103
|
);
|
|
40080
|
-
const [displayMode, setDisplayMode] =
|
|
40104
|
+
const [displayMode, setDisplayMode] = useState24(
|
|
40081
40105
|
() => forceExpanded ? "detail" : (displayModeMemoryKey ? turnDisplayModeMemory.get(displayModeMemoryKey) : void 0) ?? defaultTurnDisplayMode({ forceExpanded, hasActionableToolCall, isStreaming })
|
|
40082
40106
|
);
|
|
40083
40107
|
const wasStreamingRef = useRef16(isStreaming);
|
|
@@ -40157,7 +40181,7 @@ function AssistantTurnBlockBase({
|
|
|
40157
40181
|
messages,
|
|
40158
40182
|
isStreaming
|
|
40159
40183
|
});
|
|
40160
|
-
const [clock, setClock] =
|
|
40184
|
+
const [clock, setClock] = useState24(() => performance.now());
|
|
40161
40185
|
useEffect17(() => {
|
|
40162
40186
|
if (!isStreaming) return;
|
|
40163
40187
|
const timer = window.setInterval(() => setClock(performance.now()), 1e3);
|
|
@@ -40169,12 +40193,12 @@ function AssistantTurnBlockBase({
|
|
|
40169
40193
|
now: sessionId ? getServerTime(client, clock) : Date.now()
|
|
40170
40194
|
}) : executionDurationMs;
|
|
40171
40195
|
const observedMemoryRefs = useMemo11(() => collectMemoryRefs(messages), [messages]);
|
|
40172
|
-
const [cachedMemoryRefs, setCachedMemoryRefs] =
|
|
40196
|
+
const [cachedMemoryRefs, setCachedMemoryRefs] = useState24([]);
|
|
40173
40197
|
useEffect17(() => {
|
|
40174
40198
|
if (observedMemoryRefs.length > 0) setCachedMemoryRefs(observedMemoryRefs);
|
|
40175
40199
|
}, [observedMemoryRefs]);
|
|
40176
40200
|
const memoryRefs = observedMemoryRefs.length > 0 ? observedMemoryRefs : cachedMemoryRefs;
|
|
40177
|
-
return /* @__PURE__ */
|
|
40201
|
+
return /* @__PURE__ */ jsxs34(
|
|
40178
40202
|
"div",
|
|
40179
40203
|
{
|
|
40180
40204
|
"aria-busy": isStreaming || void 0,
|
|
@@ -40188,7 +40212,7 @@ function AssistantTurnBlockBase({
|
|
|
40188
40212
|
memoryRefs.length > 0 && /* @__PURE__ */ jsx39(MemoryRefsHint, { refs: memoryRefs }),
|
|
40189
40213
|
hasInterruptedState && /* @__PURE__ */ jsx39("div", { className: "ml-4 w-fit rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--swf-warning))]", children: "\u5DF2\u4E2D\u65AD" }),
|
|
40190
40214
|
hasFailedWithoutContent && /* @__PURE__ */ jsx39("div", { className: "ml-4 w-fit rounded-full border border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--destructive))]", children: "\u751F\u6210\u5931\u8D25" }),
|
|
40191
|
-
hasExecutionProcess && /* @__PURE__ */
|
|
40215
|
+
hasExecutionProcess && /* @__PURE__ */ jsxs34("div", { className: "flex w-full items-start gap-2.5", children: [
|
|
40192
40216
|
/* @__PURE__ */ jsx39(
|
|
40193
40217
|
"span",
|
|
40194
40218
|
{
|
|
@@ -40197,8 +40221,8 @@ function AssistantTurnBlockBase({
|
|
|
40197
40221
|
children: /* @__PURE__ */ jsx39(Bot, { size: 16 })
|
|
40198
40222
|
}
|
|
40199
40223
|
),
|
|
40200
|
-
/* @__PURE__ */
|
|
40201
|
-
/* @__PURE__ */
|
|
40224
|
+
/* @__PURE__ */ jsxs34("div", { className: "min-w-0 flex-1 pt-0.5", children: [
|
|
40225
|
+
/* @__PURE__ */ jsxs34(
|
|
40202
40226
|
"button",
|
|
40203
40227
|
{
|
|
40204
40228
|
type: "button",
|
|
@@ -40240,7 +40264,7 @@ function AssistantTurnBlockBase({
|
|
|
40240
40264
|
/* @__PURE__ */ jsx39("div", { className: "mt-3 h-px w-full bg-[hsl(var(--border)/0.75)]" })
|
|
40241
40265
|
] })
|
|
40242
40266
|
] }),
|
|
40243
|
-
hasExecutionProcess && effectiveMode === "detail" ? /* @__PURE__ */
|
|
40267
|
+
hasExecutionProcess && effectiveMode === "detail" ? /* @__PURE__ */ jsxs34("div", { className: "ml-10 flex flex-col gap-1", children: [
|
|
40244
40268
|
/* @__PURE__ */ jsx39(
|
|
40245
40269
|
AssistantMessages,
|
|
40246
40270
|
{
|
|
@@ -40470,12 +40494,12 @@ function AssistantMessages({
|
|
|
40470
40494
|
);
|
|
40471
40495
|
const hasToolCalls = toolCalls.length > 0;
|
|
40472
40496
|
const orderedParts = getOrderedMessageParts(message, toolCalls);
|
|
40473
|
-
return /* @__PURE__ */
|
|
40497
|
+
return /* @__PURE__ */ jsxs34(
|
|
40474
40498
|
"div",
|
|
40475
40499
|
{
|
|
40476
40500
|
className: "flex flex-col gap-1",
|
|
40477
40501
|
children: [
|
|
40478
|
-
showReasoning && /* @__PURE__ */
|
|
40502
|
+
showReasoning && /* @__PURE__ */ jsxs34(
|
|
40479
40503
|
Reasoning,
|
|
40480
40504
|
{
|
|
40481
40505
|
isStreaming: isReasoningStreamingLastMessage,
|
|
@@ -40584,7 +40608,7 @@ function CompactToolGroupBlock({
|
|
|
40584
40608
|
level,
|
|
40585
40609
|
customization
|
|
40586
40610
|
}) {
|
|
40587
|
-
return /* @__PURE__ */
|
|
40611
|
+
return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-1", children: [
|
|
40588
40612
|
toolCalls.map((toolCall) => {
|
|
40589
40613
|
if (isWorkflowRunToolName2(toolCall.name)) return null;
|
|
40590
40614
|
const CustomToolCall = customization?.components?.ToolCall;
|
|
@@ -40645,7 +40669,7 @@ function AssistantMessageContent({
|
|
|
40645
40669
|
if (!text4 && imageParts.length === 0 && fileParts.length === 0 && !reasoning && !failed) {
|
|
40646
40670
|
return null;
|
|
40647
40671
|
}
|
|
40648
|
-
return /* @__PURE__ */
|
|
40672
|
+
return /* @__PURE__ */ jsxs34("div", { className: "flex flex-col gap-3", children: [
|
|
40649
40673
|
failed ? /* @__PURE__ */ jsx39("div", { className: "w-fit rounded-full border border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--destructive))]", children: "\u751F\u6210\u5931\u8D25" }) : null,
|
|
40650
40674
|
imageParts.length > 0 && /* @__PURE__ */ jsx39("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx39(
|
|
40651
40675
|
MessageImage,
|
|
@@ -40694,7 +40718,7 @@ function AssistantText({
|
|
|
40694
40718
|
() => ({ sessionId, messageId, sendMessage }),
|
|
40695
40719
|
[sessionId, messageId, sendMessage]
|
|
40696
40720
|
);
|
|
40697
|
-
return /* @__PURE__ */
|
|
40721
|
+
return /* @__PURE__ */ jsxs34(
|
|
40698
40722
|
"div",
|
|
40699
40723
|
{
|
|
40700
40724
|
part: "assistant-text",
|
|
@@ -40725,17 +40749,17 @@ function collectMemoryRefs(messages) {
|
|
|
40725
40749
|
}
|
|
40726
40750
|
function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
40727
40751
|
const refs = Array.isArray(rawRefs) ? rawRefs : [];
|
|
40728
|
-
const [expanded, setExpanded] =
|
|
40752
|
+
const [expanded, setExpanded] = useState24(false);
|
|
40729
40753
|
const memoriesHref = useChatEnvironment().memoriesHref;
|
|
40730
40754
|
const hasSkill = refs.some((r) => r.skill_name);
|
|
40731
40755
|
const label = hasSkill ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
40732
|
-
return /* @__PURE__ */
|
|
40756
|
+
return /* @__PURE__ */ jsxs34(
|
|
40733
40757
|
"div",
|
|
40734
40758
|
{
|
|
40735
40759
|
part: "memory-refs",
|
|
40736
40760
|
className: cn("blade-chat-memory-refs relative z-[1] ml-1 w-[calc(100%-0.25rem)] max-w-[680px] self-start", className),
|
|
40737
40761
|
children: [
|
|
40738
|
-
/* @__PURE__ */
|
|
40762
|
+
/* @__PURE__ */ jsxs34(
|
|
40739
40763
|
"button",
|
|
40740
40764
|
{
|
|
40741
40765
|
type: "button",
|
|
@@ -40743,7 +40767,7 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
|
40743
40767
|
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))] transition-colors hover:bg-[hsl(var(--primary)/0.12)]",
|
|
40744
40768
|
children: [
|
|
40745
40769
|
/* @__PURE__ */ jsx39(BookOpen, { size: 12 }),
|
|
40746
|
-
/* @__PURE__ */
|
|
40770
|
+
/* @__PURE__ */ jsxs34("span", { children: [
|
|
40747
40771
|
label,
|
|
40748
40772
|
"\uFF08",
|
|
40749
40773
|
refs.length,
|
|
@@ -40759,8 +40783,8 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
|
40759
40783
|
]
|
|
40760
40784
|
}
|
|
40761
40785
|
),
|
|
40762
|
-
expanded && /* @__PURE__ */
|
|
40763
|
-
refs.map((ref) => /* @__PURE__ */
|
|
40786
|
+
expanded && /* @__PURE__ */ jsxs34("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: [
|
|
40787
|
+
refs.map((ref) => /* @__PURE__ */ jsxs34(
|
|
40764
40788
|
"div",
|
|
40765
40789
|
{
|
|
40766
40790
|
className: "rounded-lg border border-[hsl(var(--border)/0.55)] bg-[hsl(var(--background)/0.72)] px-3 py-2.5",
|
|
@@ -40771,7 +40795,7 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
|
40771
40795
|
},
|
|
40772
40796
|
ref.id
|
|
40773
40797
|
)),
|
|
40774
|
-
memoriesHref ? /* @__PURE__ */
|
|
40798
|
+
memoriesHref ? /* @__PURE__ */ jsxs34(
|
|
40775
40799
|
"a",
|
|
40776
40800
|
{
|
|
40777
40801
|
href: memoriesHref,
|
|
@@ -41249,15 +41273,15 @@ import {
|
|
|
41249
41273
|
getContextDisplayState,
|
|
41250
41274
|
getContextGroupDisplayState
|
|
41251
41275
|
} from "@blade-hq/agent-client/internal";
|
|
41252
|
-
import { jsx as jsx40, jsxs as
|
|
41276
|
+
import { jsx as jsx40, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
41253
41277
|
function ContextCard({ context, className }) {
|
|
41254
41278
|
const display = getContextDisplayState(context);
|
|
41255
|
-
return /* @__PURE__ */
|
|
41279
|
+
return /* @__PURE__ */ jsxs35(
|
|
41256
41280
|
"details",
|
|
41257
41281
|
{
|
|
41258
41282
|
className: `blade-chat-context-card group/context-card overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`,
|
|
41259
41283
|
children: [
|
|
41260
|
-
/* @__PURE__ */
|
|
41284
|
+
/* @__PURE__ */ jsxs35("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: [
|
|
41261
41285
|
/* @__PURE__ */ jsx40(
|
|
41262
41286
|
Layers,
|
|
41263
41287
|
{
|
|
@@ -41266,7 +41290,7 @@ function ContextCard({ context, className }) {
|
|
|
41266
41290
|
"aria-hidden": "true"
|
|
41267
41291
|
}
|
|
41268
41292
|
),
|
|
41269
|
-
/* @__PURE__ */
|
|
41293
|
+
/* @__PURE__ */ jsxs35("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
41270
41294
|
/* @__PURE__ */ jsx40("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: display.title }),
|
|
41271
41295
|
/* @__PURE__ */ jsx40("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: display.summary })
|
|
41272
41296
|
] }),
|
|
@@ -41288,8 +41312,8 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
41288
41312
|
if (contexts.length === 0) return null;
|
|
41289
41313
|
const single = contexts.length === 1 ? getContextDisplayState(contexts[0]) : null;
|
|
41290
41314
|
const group = single ? null : getContextGroupDisplayState(contexts);
|
|
41291
|
-
return /* @__PURE__ */
|
|
41292
|
-
/* @__PURE__ */
|
|
41315
|
+
return /* @__PURE__ */ jsxs35("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: [
|
|
41316
|
+
/* @__PURE__ */ jsxs35("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: [
|
|
41293
41317
|
/* @__PURE__ */ jsx40(
|
|
41294
41318
|
Layers,
|
|
41295
41319
|
{
|
|
@@ -41298,7 +41322,7 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
41298
41322
|
"aria-hidden": "true"
|
|
41299
41323
|
}
|
|
41300
41324
|
),
|
|
41301
|
-
/* @__PURE__ */
|
|
41325
|
+
/* @__PURE__ */ jsxs35("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
41302
41326
|
/* @__PURE__ */ jsx40("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: single ? single.title : `${group?.title} \xB7 ${group?.count} \u9879` }),
|
|
41303
41327
|
/* @__PURE__ */ jsx40("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: single ? single.summary : group?.summary })
|
|
41304
41328
|
] }),
|
|
@@ -41322,8 +41346,8 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
41322
41346
|
}
|
|
41323
41347
|
|
|
41324
41348
|
// src/chat/ResultFeedback.tsx
|
|
41325
|
-
import { useCallback as useCallback7, useEffect as useEffect19, useRef as useRef18, useState as
|
|
41326
|
-
import { jsx as jsx41, jsxs as
|
|
41349
|
+
import { useCallback as useCallback7, useEffect as useEffect19, useRef as useRef18, useState as useState25 } from "react";
|
|
41350
|
+
import { jsx as jsx41, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
41327
41351
|
var REASONS = [
|
|
41328
41352
|
{ value: "not_solved", label: "\u6CA1\u89E3\u51B3\u95EE\u9898" },
|
|
41329
41353
|
{ value: "inaccurate", label: "\u5185\u5BB9\u4E0D\u51C6\u786E" },
|
|
@@ -41337,17 +41361,17 @@ function reasonLabel(reason) {
|
|
|
41337
41361
|
}
|
|
41338
41362
|
function HistoricalResultFeedback({ feedback }) {
|
|
41339
41363
|
const label = reasonLabel(feedback.reason);
|
|
41340
|
-
return /* @__PURE__ */
|
|
41364
|
+
return /* @__PURE__ */ jsxs36(
|
|
41341
41365
|
"section",
|
|
41342
41366
|
{
|
|
41343
41367
|
"aria-label": "\u5386\u53F2\u7ED3\u679C\u53CD\u9988",
|
|
41344
41368
|
className: "w-fit max-w-full rounded-lg border border-[hsl(var(--border)/0.7)] bg-[hsl(var(--muted)/0.2)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
41345
41369
|
children: [
|
|
41346
|
-
/* @__PURE__ */
|
|
41370
|
+
/* @__PURE__ */ jsxs36("span", { children: [
|
|
41347
41371
|
"\u4F60\u5BF9\u6B64\u8F6E\u7ED3\u679C\u7684\u8BC4\u4EF7\uFF1A",
|
|
41348
41372
|
feedback.helpful ? "\u6709\u5E2E\u52A9" : "\u6CA1\u5E2E\u52A9"
|
|
41349
41373
|
] }),
|
|
41350
|
-
label ? /* @__PURE__ */
|
|
41374
|
+
label ? /* @__PURE__ */ jsxs36("span", { children: [
|
|
41351
41375
|
" \xB7 ",
|
|
41352
41376
|
label
|
|
41353
41377
|
] }) : null
|
|
@@ -41363,15 +41387,15 @@ function ResultFeedback({
|
|
|
41363
41387
|
onSaved
|
|
41364
41388
|
}) {
|
|
41365
41389
|
const client = useBladeClient();
|
|
41366
|
-
const [saved, setSaved] =
|
|
41367
|
-
const [selectedHelpful, setSelectedHelpful] =
|
|
41390
|
+
const [saved, setSaved] = useState25(savedFeedback ?? null);
|
|
41391
|
+
const [selectedHelpful, setSelectedHelpful] = useState25(
|
|
41368
41392
|
savedFeedback?.helpful ?? null
|
|
41369
41393
|
);
|
|
41370
|
-
const [selectedReason, setSelectedReason] =
|
|
41394
|
+
const [selectedReason, setSelectedReason] = useState25(
|
|
41371
41395
|
savedFeedback?.reason ?? null
|
|
41372
41396
|
);
|
|
41373
|
-
const [saving, setSaving] =
|
|
41374
|
-
const [saveError, setSaveError] =
|
|
41397
|
+
const [saving, setSaving] = useState25(false);
|
|
41398
|
+
const [saveError, setSaveError] = useState25(false);
|
|
41375
41399
|
const latestChoice = useRef18(null);
|
|
41376
41400
|
const eligible = followup.feedback_eligible === true;
|
|
41377
41401
|
const emit = useFollowupInteraction();
|
|
@@ -41422,14 +41446,14 @@ function ResultFeedback({
|
|
|
41422
41446
|
[client, emit, followup.assistant_entry_id, onSaved, sessionId]
|
|
41423
41447
|
);
|
|
41424
41448
|
if (!visible) return null;
|
|
41425
|
-
return /* @__PURE__ */
|
|
41449
|
+
return /* @__PURE__ */ jsxs36(
|
|
41426
41450
|
"section",
|
|
41427
41451
|
{
|
|
41428
41452
|
"aria-label": "\u7ED3\u679C\u53CD\u9988",
|
|
41429
41453
|
className: "flex flex-col gap-2 border-t border-[hsl(var(--border)/0.7)] pt-3",
|
|
41430
41454
|
children: [
|
|
41431
41455
|
/* @__PURE__ */ jsx41("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u76EE\u524D\u7684\u6574\u4F53\u7ED3\u679C\u6709\u5E2E\u52A9\u5417\uFF1F" }),
|
|
41432
|
-
/* @__PURE__ */
|
|
41456
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
41433
41457
|
/* @__PURE__ */ jsx41(
|
|
41434
41458
|
"button",
|
|
41435
41459
|
{
|
|
@@ -41465,7 +41489,7 @@ function ResultFeedback({
|
|
|
41465
41489
|
},
|
|
41466
41490
|
reason.value
|
|
41467
41491
|
)) }) : null,
|
|
41468
|
-
saveError ? /* @__PURE__ */
|
|
41492
|
+
saveError ? /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--destructive))]", children: [
|
|
41469
41493
|
/* @__PURE__ */ jsx41("span", { children: "\u53CD\u9988\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u91CD\u8BD5" }),
|
|
41470
41494
|
/* @__PURE__ */ jsx41(
|
|
41471
41495
|
"button",
|
|
@@ -41486,7 +41510,7 @@ function ResultFeedback({
|
|
|
41486
41510
|
}
|
|
41487
41511
|
|
|
41488
41512
|
// src/chat/LiteMessageList.tsx
|
|
41489
|
-
import { jsx as jsx42, jsxs as
|
|
41513
|
+
import { jsx as jsx42, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
41490
41514
|
var LITE_LOADING_INDICATOR_HEIGHT = 38;
|
|
41491
41515
|
function messageText(message) {
|
|
41492
41516
|
return getTextContent3(normalizeMessageContent2(message.content)).trim();
|
|
@@ -41774,7 +41798,7 @@ function LiteMessageList({
|
|
|
41774
41798
|
},
|
|
41775
41799
|
[]
|
|
41776
41800
|
);
|
|
41777
|
-
return /* @__PURE__ */
|
|
41801
|
+
return /* @__PURE__ */ jsxs37(
|
|
41778
41802
|
"div",
|
|
41779
41803
|
{
|
|
41780
41804
|
ref: scrollRef,
|
|
@@ -41788,7 +41812,7 @@ function LiteMessageList({
|
|
|
41788
41812
|
},
|
|
41789
41813
|
className: "min-h-0 flex-1 overflow-y-auto overscroll-contain px-4 py-6 sm:px-8",
|
|
41790
41814
|
children: [
|
|
41791
|
-
rows.length === 0 ? /* @__PURE__ */ jsx42("div", { className: "grid min-h-full place-items-center text-sm text-[hsl(var(--muted-foreground))]", children: isLoadingHistory ? "\u6B63\u5728\u52A0\u8F7D\u6D88\u606F\u2026" : "\u5F00\u59CB\u65B0\u7684\u5BF9\u8BDD\u5427" }) : /* @__PURE__ */
|
|
41815
|
+
rows.length === 0 ? /* @__PURE__ */ jsx42("div", { className: "grid min-h-full place-items-center text-sm text-[hsl(var(--muted-foreground))]", children: isLoadingHistory ? "\u6B63\u5728\u52A0\u8F7D\u6D88\u606F\u2026" : "\u5F00\u59CB\u65B0\u7684\u5BF9\u8BDD\u5427" }) : /* @__PURE__ */ jsxs37(
|
|
41792
41816
|
"div",
|
|
41793
41817
|
{
|
|
41794
41818
|
className: "relative mx-auto w-full max-w-3xl",
|
|
@@ -41876,7 +41900,7 @@ function PlainTextMessage({
|
|
|
41876
41900
|
if (row.role === "user") {
|
|
41877
41901
|
return /* @__PURE__ */ jsx42("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx42("div", { className: `max-w-[82%] rounded-[24px] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-base leading-[1.7] transition-colors duration-200 ${row.sending ? "text-[hsl(var(--muted-foreground))]" : "text-[hsl(var(--user-msg-fg))]"}`, children: markdown }) });
|
|
41878
41902
|
}
|
|
41879
|
-
return /* @__PURE__ */
|
|
41903
|
+
return /* @__PURE__ */ jsxs37(
|
|
41880
41904
|
"div",
|
|
41881
41905
|
{
|
|
41882
41906
|
className: `break-words text-sm leading-6 ${row.role === "error" ? "text-[hsl(var(--destructive))]" : "text-[hsl(var(--foreground))]"}`,
|
|
@@ -41896,7 +41920,7 @@ function LiteFollowup({
|
|
|
41896
41920
|
}) {
|
|
41897
41921
|
const client = useBladeClient();
|
|
41898
41922
|
const composer = useComposerBridge(sessionId);
|
|
41899
|
-
const [downloadingPath, setDownloadingPath] =
|
|
41923
|
+
const [downloadingPath, setDownloadingPath] = useState26(null);
|
|
41900
41924
|
const artifacts = followup.final_artifacts ?? [];
|
|
41901
41925
|
const downloadArtifact = async (target, label) => {
|
|
41902
41926
|
if (downloadingPath) return;
|
|
@@ -41908,11 +41932,11 @@ function LiteFollowup({
|
|
|
41908
41932
|
setDownloadingPath(null);
|
|
41909
41933
|
}
|
|
41910
41934
|
};
|
|
41911
|
-
return /* @__PURE__ */
|
|
41912
|
-
artifacts.length > 0 ? /* @__PURE__ */
|
|
41935
|
+
return /* @__PURE__ */ jsxs37("div", { className: "flex flex-col items-start gap-3", children: [
|
|
41936
|
+
artifacts.length > 0 ? /* @__PURE__ */ jsxs37("div", { className: "flex w-full flex-col items-start gap-1.5", children: [
|
|
41913
41937
|
/* @__PURE__ */ jsx42("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u672C\u8F6E\u6210\u679C" }),
|
|
41914
41938
|
artifacts.map(
|
|
41915
|
-
(artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */
|
|
41939
|
+
(artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */ jsxs37(
|
|
41916
41940
|
"a",
|
|
41917
41941
|
{
|
|
41918
41942
|
href: artifact.target,
|
|
@@ -41925,7 +41949,7 @@ function LiteFollowup({
|
|
|
41925
41949
|
]
|
|
41926
41950
|
},
|
|
41927
41951
|
`${artifact.kind}:${artifactIndex}`
|
|
41928
|
-
) : /* @__PURE__ */
|
|
41952
|
+
) : /* @__PURE__ */ jsxs37(
|
|
41929
41953
|
"button",
|
|
41930
41954
|
{
|
|
41931
41955
|
type: "button",
|
|
@@ -41945,9 +41969,9 @@ function LiteFollowup({
|
|
|
41945
41969
|
)
|
|
41946
41970
|
)
|
|
41947
41971
|
] }) : null,
|
|
41948
|
-
followup.suggestions.length > 0 ? /* @__PURE__ */
|
|
41972
|
+
followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs37("div", { className: "flex max-w-full flex-col items-start gap-1.5", children: [
|
|
41949
41973
|
/* @__PURE__ */ jsx42("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
|
|
41950
|
-
followup.suggestions.map((suggestion) => /* @__PURE__ */
|
|
41974
|
+
followup.suggestions.map((suggestion) => /* @__PURE__ */ jsxs37(
|
|
41951
41975
|
"button",
|
|
41952
41976
|
{
|
|
41953
41977
|
type: "button",
|
|
@@ -41985,11 +42009,11 @@ import {
|
|
|
41985
42009
|
useLayoutEffect as useLayoutEffect7,
|
|
41986
42010
|
useMemo as useMemo16,
|
|
41987
42011
|
useRef as useRef27,
|
|
41988
|
-
useState as
|
|
42012
|
+
useState as useState33
|
|
41989
42013
|
} from "react";
|
|
41990
42014
|
|
|
41991
42015
|
// ../../node_modules/.pnpm/use-stick-to-bottom@1.1.3_react@19.2.4/node_modules/use-stick-to-bottom/dist/useStickToBottom.js
|
|
41992
|
-
import { useCallback as useCallback9, useMemo as useMemo13, useRef as useRef20, useState as
|
|
42016
|
+
import { useCallback as useCallback9, useMemo as useMemo13, useRef as useRef20, useState as useState27 } from "react";
|
|
41993
42017
|
var DEFAULT_SPRING_ANIMATION = {
|
|
41994
42018
|
/**
|
|
41995
42019
|
* A value from 0 to 1, on how much to damp the animation.
|
|
@@ -42026,9 +42050,9 @@ globalThis.document?.addEventListener("click", () => {
|
|
|
42026
42050
|
mouseDown = false;
|
|
42027
42051
|
});
|
|
42028
42052
|
var useStickToBottom = (options = {}) => {
|
|
42029
|
-
const [escapedFromLock, updateEscapedFromLock] =
|
|
42030
|
-
const [isAtBottom, updateIsAtBottom] =
|
|
42031
|
-
const [isNearBottom, setIsNearBottom] =
|
|
42053
|
+
const [escapedFromLock, updateEscapedFromLock] = useState27(false);
|
|
42054
|
+
const [isAtBottom, updateIsAtBottom] = useState27(options.initial !== false);
|
|
42055
|
+
const [isNearBottom, setIsNearBottom] = useState27(false);
|
|
42032
42056
|
const optionsRef = useRef20(null);
|
|
42033
42057
|
optionsRef.current = options;
|
|
42034
42058
|
const isSelecting = useCallback9(() => {
|
|
@@ -42418,7 +42442,7 @@ import {
|
|
|
42418
42442
|
isHiddenInternalMessage as isHiddenInternalMessage2,
|
|
42419
42443
|
normalizeMessageContent as normalizeMessageContent3
|
|
42420
42444
|
} from "@blade-hq/agent-client/internal";
|
|
42421
|
-
import { useCallback as useCallback11, useEffect as useEffect22, useLayoutEffect as useLayoutEffect5, useRef as useRef22, useState as
|
|
42445
|
+
import { useCallback as useCallback11, useEffect as useEffect22, useLayoutEffect as useLayoutEffect5, useRef as useRef22, useState as useState28 } from "react";
|
|
42422
42446
|
var HIGHLIGHT_MS = 1600;
|
|
42423
42447
|
var TURN_NAV_HIGHLIGHT_CLASS = "blade-turn-nav-flash";
|
|
42424
42448
|
var MAX_FRAMES_AFTER_LOCATE = 20;
|
|
@@ -42482,12 +42506,12 @@ function useTurnNavigation({
|
|
|
42482
42506
|
revealEntry,
|
|
42483
42507
|
beforeSeek
|
|
42484
42508
|
});
|
|
42485
|
-
const [index2, setIndex] =
|
|
42486
|
-
const [loadingEntryId, setLoadingEntryId] =
|
|
42487
|
-
const [activeEntryId, setActiveEntryId] =
|
|
42488
|
-
const [failedEntryId, setFailedEntryId] =
|
|
42489
|
-
const [error61, setError] =
|
|
42490
|
-
const [indexRefresh, setIndexRefresh] =
|
|
42509
|
+
const [index2, setIndex] = useState28({ sessionId: null, items: [] });
|
|
42510
|
+
const [loadingEntryId, setLoadingEntryId] = useState28(null);
|
|
42511
|
+
const [activeEntryId, setActiveEntryId] = useState28(null);
|
|
42512
|
+
const [failedEntryId, setFailedEntryId] = useState28(null);
|
|
42513
|
+
const [error61, setError] = useState28(null);
|
|
42514
|
+
const [indexRefresh, setIndexRefresh] = useState28(0);
|
|
42491
42515
|
const seekSeq = useRef22(0);
|
|
42492
42516
|
const indexSeq = useRef22(0);
|
|
42493
42517
|
const indexRef = useRef22({
|
|
@@ -42654,7 +42678,7 @@ function useTurnNavigation({
|
|
|
42654
42678
|
}
|
|
42655
42679
|
|
|
42656
42680
|
// src/hooks/use-typewriter-reveal.ts
|
|
42657
|
-
import { useCallback as useCallback12, useEffect as useEffect23, useRef as useRef23, useState as
|
|
42681
|
+
import { useCallback as useCallback12, useEffect as useEffect23, useRef as useRef23, useState as useState29 } from "react";
|
|
42658
42682
|
var REVEAL_INITIAL_CPS = 18;
|
|
42659
42683
|
var REVEAL_MIN_CPS = 6;
|
|
42660
42684
|
var REVEAL_MAX_CPS = 240;
|
|
@@ -42690,7 +42714,7 @@ function initialRevealState(targetText, isLive, resetKey) {
|
|
|
42690
42714
|
};
|
|
42691
42715
|
}
|
|
42692
42716
|
function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
42693
|
-
const [state, setState] =
|
|
42717
|
+
const [state, setState] = useState29(() => initialRevealState(targetText, isLive, resetKey));
|
|
42694
42718
|
const targetTextRef = useRef23(targetText);
|
|
42695
42719
|
targetTextRef.current = targetText;
|
|
42696
42720
|
const revealedLenRef = useRef23(state.revealedLen);
|
|
@@ -42793,7 +42817,7 @@ function useTypewriterReveal(targetText, isLive, resetKey) {
|
|
|
42793
42817
|
}
|
|
42794
42818
|
|
|
42795
42819
|
// src/chat/plan/PlanSummaryCard.tsx
|
|
42796
|
-
import { useMemo as useMemo15, useState as
|
|
42820
|
+
import { useMemo as useMemo15, useState as useState30 } from "react";
|
|
42797
42821
|
|
|
42798
42822
|
// ../../node_modules/.pnpm/js-yaml@4.1.1/node_modules/js-yaml/dist/js-yaml.mjs
|
|
42799
42823
|
function isNothing(subject) {
|
|
@@ -45753,7 +45777,7 @@ function extractRefs(content3) {
|
|
|
45753
45777
|
}
|
|
45754
45778
|
|
|
45755
45779
|
// src/chat/plan/PlanSummaryCard.tsx
|
|
45756
|
-
import { Fragment as
|
|
45780
|
+
import { Fragment as Fragment17, jsx as jsx43, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
45757
45781
|
function PlanSummaryCard({
|
|
45758
45782
|
messages,
|
|
45759
45783
|
sessionStatus,
|
|
@@ -45768,8 +45792,8 @@ function PlanSummaryCard({
|
|
|
45768
45792
|
const isWaitingForInput = sessionStatus === "waiting_for_input";
|
|
45769
45793
|
const canConfirm = Boolean(onConfirmPlan) && isWaitingForInput && data.lastPauseTool === "ExitPlanMode";
|
|
45770
45794
|
const openPlanPanel = openPlanPanelAction && sessionId ? () => openPlanPanelAction(sessionId) : void 0;
|
|
45771
|
-
return /* @__PURE__ */
|
|
45772
|
-
/* @__PURE__ */
|
|
45795
|
+
return /* @__PURE__ */ jsxs38("div", { className: "flex w-full flex-col gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.55)] p-4", children: [
|
|
45796
|
+
/* @__PURE__ */ jsxs38(
|
|
45773
45797
|
"button",
|
|
45774
45798
|
{
|
|
45775
45799
|
type: "button",
|
|
@@ -45777,14 +45801,14 @@ function PlanSummaryCard({
|
|
|
45777
45801
|
disabled: isHistorical || !openPlanPanel,
|
|
45778
45802
|
className: "flex w-full flex-col gap-4 text-left transition-colors hover:text-[hsl(var(--foreground))]",
|
|
45779
45803
|
children: [
|
|
45780
|
-
/* @__PURE__ */
|
|
45781
|
-
/* @__PURE__ */
|
|
45782
|
-
/* @__PURE__ */
|
|
45804
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-start justify-between gap-3", children: [
|
|
45805
|
+
/* @__PURE__ */ jsxs38("div", { className: "min-w-0 space-y-2", children: [
|
|
45806
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
45783
45807
|
/* @__PURE__ */ jsx43(Sparkles, { size: 12 }),
|
|
45784
45808
|
/* @__PURE__ */ jsx43("span", { children: "\u89C4\u5212\u6458\u8981" })
|
|
45785
45809
|
] }),
|
|
45786
45810
|
/* @__PURE__ */ jsx43("div", { className: "truncate text-base font-medium text-[hsl(var(--foreground))]", children: data.intent || "\u5F53\u524D\u89C4\u5212" }),
|
|
45787
|
-
/* @__PURE__ */ jsx43("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */
|
|
45811
|
+
/* @__PURE__ */ jsx43("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */ jsxs38(Fragment17, { children: [
|
|
45788
45812
|
/* @__PURE__ */ jsx43("span", { className: "rounded-full bg-[hsl(var(--accent))] px-2.5 py-1 text-[hsl(var(--foreground))]", children: summaryState.label }),
|
|
45789
45813
|
/* @__PURE__ */ jsx43("span", { className: "font-mono tracking-[0.25em] text-[hsl(var(--muted-foreground))]", children: summaryState.dots })
|
|
45790
45814
|
] }) : /* @__PURE__ */ jsx43(
|
|
@@ -45809,16 +45833,16 @@ function PlanSummaryCard({
|
|
|
45809
45833
|
}
|
|
45810
45834
|
)
|
|
45811
45835
|
] }),
|
|
45812
|
-
summaryState.kind === "complete" && /* @__PURE__ */
|
|
45813
|
-
/* @__PURE__ */
|
|
45836
|
+
summaryState.kind === "complete" && /* @__PURE__ */ jsxs38("div", { className: "flex flex-wrap items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
45837
|
+
/* @__PURE__ */ jsxs38("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
|
|
45814
45838
|
data.selectedSkills.length,
|
|
45815
45839
|
" \u4E2A\u6280\u80FD"
|
|
45816
45840
|
] }),
|
|
45817
|
-
/* @__PURE__ */
|
|
45841
|
+
/* @__PURE__ */ jsxs38("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
|
|
45818
45842
|
stepCount,
|
|
45819
45843
|
" \u4E2A\u6B65\u9AA4"
|
|
45820
45844
|
] }),
|
|
45821
|
-
!isHistorical && /* @__PURE__ */
|
|
45845
|
+
!isHistorical && /* @__PURE__ */ jsxs38("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))]", children: [
|
|
45822
45846
|
/* @__PURE__ */ jsx43(CircleCheck, { size: 12 }),
|
|
45823
45847
|
"\u53F3\u4FA7\u67E5\u770B\u8BE6\u60C5"
|
|
45824
45848
|
] })
|
|
@@ -45832,8 +45856,8 @@ function PlanSummaryCard({
|
|
|
45832
45856
|
function PlanConfirmationPanel({
|
|
45833
45857
|
onConfirmPlan
|
|
45834
45858
|
}) {
|
|
45835
|
-
const [isEditing, setIsEditing] =
|
|
45836
|
-
const [revisionText, setRevisionText] =
|
|
45859
|
+
const [isEditing, setIsEditing] = useState30(false);
|
|
45860
|
+
const [revisionText, setRevisionText] = useState30("");
|
|
45837
45861
|
const submitRevision = () => {
|
|
45838
45862
|
const trimmed = revisionText.trim();
|
|
45839
45863
|
if (!trimmed) return;
|
|
@@ -45841,9 +45865,9 @@ function PlanConfirmationPanel({
|
|
|
45841
45865
|
setRevisionText("");
|
|
45842
45866
|
setIsEditing(false);
|
|
45843
45867
|
};
|
|
45844
|
-
return /* @__PURE__ */
|
|
45845
|
-
/* @__PURE__ */
|
|
45846
|
-
/* @__PURE__ */
|
|
45868
|
+
return /* @__PURE__ */ jsxs38("div", { className: "space-y-3 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--background)/0.45)] p-3", children: [
|
|
45869
|
+
/* @__PURE__ */ jsxs38("div", { className: "flex flex-wrap gap-2", children: [
|
|
45870
|
+
/* @__PURE__ */ jsxs38(
|
|
45847
45871
|
"button",
|
|
45848
45872
|
{
|
|
45849
45873
|
type: "button",
|
|
@@ -45855,7 +45879,7 @@ function PlanConfirmationPanel({
|
|
|
45855
45879
|
]
|
|
45856
45880
|
}
|
|
45857
45881
|
),
|
|
45858
|
-
/* @__PURE__ */
|
|
45882
|
+
/* @__PURE__ */ jsxs38(
|
|
45859
45883
|
"button",
|
|
45860
45884
|
{
|
|
45861
45885
|
type: "button",
|
|
@@ -45868,7 +45892,7 @@ function PlanConfirmationPanel({
|
|
|
45868
45892
|
}
|
|
45869
45893
|
)
|
|
45870
45894
|
] }),
|
|
45871
|
-
isEditing && /* @__PURE__ */
|
|
45895
|
+
isEditing && /* @__PURE__ */ jsxs38("div", { className: "space-y-2", children: [
|
|
45872
45896
|
/* @__PURE__ */ jsx43(
|
|
45873
45897
|
"textarea",
|
|
45874
45898
|
{
|
|
@@ -45998,8 +46022,8 @@ function extractPlanMessagesForTurn(messages, turnLastMessage) {
|
|
|
45998
46022
|
import { useEffect as useEffect25, useRef as useRef25 } from "react";
|
|
45999
46023
|
|
|
46000
46024
|
// src/chat/FinalArtifactCards.tsx
|
|
46001
|
-
import { useEffect as useEffect24, useRef as useRef24, useState as
|
|
46002
|
-
import { Fragment as
|
|
46025
|
+
import { useEffect as useEffect24, useRef as useRef24, useState as useState31 } from "react";
|
|
46026
|
+
import { Fragment as Fragment18, jsx as jsx44, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
46003
46027
|
function basename2(path2) {
|
|
46004
46028
|
return path2.split("/").filter(Boolean).pop() || path2;
|
|
46005
46029
|
}
|
|
@@ -46020,7 +46044,7 @@ function LinkCard({
|
|
|
46020
46044
|
const bladeHost = useBladeHost();
|
|
46021
46045
|
const host = hostOf(url2);
|
|
46022
46046
|
const local = isLoopbackUrl(url2) && Boolean(bladeHost.openPreview);
|
|
46023
|
-
const content3 = /* @__PURE__ */
|
|
46047
|
+
const content3 = /* @__PURE__ */ jsxs39(Fragment18, { children: [
|
|
46024
46048
|
/* @__PURE__ */ jsx44("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx44(Globe, { size: 15, "aria-hidden": "true" }) }),
|
|
46025
46049
|
/* @__PURE__ */ jsx44("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx44("span", { className: "block truncate text-xs font-medium leading-5", children: label || host }) }),
|
|
46026
46050
|
/* @__PURE__ */ jsx44(
|
|
@@ -46069,7 +46093,7 @@ function FinalArtifactCards({
|
|
|
46069
46093
|
sessionId,
|
|
46070
46094
|
assistantEntryId
|
|
46071
46095
|
}) {
|
|
46072
|
-
const [expanded, setExpanded] =
|
|
46096
|
+
const [expanded, setExpanded] = useState31(false);
|
|
46073
46097
|
const hasMore = artifacts.length > 3;
|
|
46074
46098
|
const visibleArtifacts = expanded ? artifacts : artifacts.slice(0, 3);
|
|
46075
46099
|
const emit = useFollowupInteraction();
|
|
@@ -46092,7 +46116,7 @@ function FinalArtifactCards({
|
|
|
46092
46116
|
const columnCount = Math.min(artifacts.length, 3);
|
|
46093
46117
|
const gridWidth = columnCount * 180 + Math.max(0, columnCount - 1) * 6;
|
|
46094
46118
|
if (artifacts.length === 0) return null;
|
|
46095
|
-
return /* @__PURE__ */
|
|
46119
|
+
return /* @__PURE__ */ jsxs39("div", { className: "flex max-w-full flex-col gap-1.5", children: [
|
|
46096
46120
|
/* @__PURE__ */ jsx44(
|
|
46097
46121
|
"div",
|
|
46098
46122
|
{
|
|
@@ -46128,7 +46152,7 @@ function FinalArtifactCards({
|
|
|
46128
46152
|
)
|
|
46129
46153
|
}
|
|
46130
46154
|
),
|
|
46131
|
-
hasMore ? /* @__PURE__ */
|
|
46155
|
+
hasMore ? /* @__PURE__ */ jsxs39(
|
|
46132
46156
|
"button",
|
|
46133
46157
|
{
|
|
46134
46158
|
type: "button",
|
|
@@ -46152,7 +46176,7 @@ function FinalArtifactCards({
|
|
|
46152
46176
|
}
|
|
46153
46177
|
|
|
46154
46178
|
// src/chat/PostChatFollowupBlock.tsx
|
|
46155
|
-
import { jsx as jsx45, jsxs as
|
|
46179
|
+
import { jsx as jsx45, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
46156
46180
|
function PostChatFollowupBlock({
|
|
46157
46181
|
sessionId,
|
|
46158
46182
|
followup,
|
|
@@ -46174,9 +46198,9 @@ function PostChatFollowupBlock({
|
|
|
46174
46198
|
}, [assistantEntryId, emit, sessionId, suggestionCount]);
|
|
46175
46199
|
if (!followup || !followup.recaption && followup.suggestions.length === 0 && artifacts.length === 0 && !followup.feedback_eligible)
|
|
46176
46200
|
return null;
|
|
46177
|
-
return /* @__PURE__ */
|
|
46178
|
-
followup.recaption ? /* @__PURE__ */
|
|
46179
|
-
/* @__PURE__ */
|
|
46201
|
+
return /* @__PURE__ */ jsxs40("div", { part: "followup", className: "blade-chat-followup flex w-fit max-w-full flex-col gap-4 rounded-xl border border-[hsl(var(--border)/0.75)] bg-[hsl(var(--muted)/0.28)] px-3 py-3 sm:min-w-[340px] sm:max-w-[680px]", children: [
|
|
46202
|
+
followup.recaption ? /* @__PURE__ */ jsxs40("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
|
|
46203
|
+
/* @__PURE__ */ jsxs40("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
46180
46204
|
/* @__PURE__ */ jsx45(Sparkles, { size: 14, "aria-hidden": "true" }),
|
|
46181
46205
|
"\u672C\u8F6E\u5C0F\u7ED3"
|
|
46182
46206
|
] }),
|
|
@@ -46198,9 +46222,9 @@ function PostChatFollowupBlock({
|
|
|
46198
46222
|
assistantEntryId
|
|
46199
46223
|
}
|
|
46200
46224
|
) }) : null,
|
|
46201
|
-
followup.suggestions.length > 0 ? /* @__PURE__ */
|
|
46225
|
+
followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs40("section", { className: "flex flex-col items-start gap-1.5", "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", children: [
|
|
46202
46226
|
/* @__PURE__ */ jsx45("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
|
|
46203
|
-
/* @__PURE__ */ jsx45("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */
|
|
46227
|
+
/* @__PURE__ */ jsx45("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs40(
|
|
46204
46228
|
"button",
|
|
46205
46229
|
{
|
|
46206
46230
|
type: "button",
|
|
@@ -46245,7 +46269,7 @@ function PostChatFollowupBlock({
|
|
|
46245
46269
|
|
|
46246
46270
|
// src/chat/RenderErrorBoundary.tsx
|
|
46247
46271
|
import { Component } from "react";
|
|
46248
|
-
import { jsx as jsx46, jsxs as
|
|
46272
|
+
import { jsx as jsx46, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
46249
46273
|
function getFirstComponentName(componentStack) {
|
|
46250
46274
|
const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
|
|
46251
46275
|
return match?.[1] ?? null;
|
|
@@ -46278,14 +46302,14 @@ var RenderErrorBoundary = class extends Component {
|
|
|
46278
46302
|
return children;
|
|
46279
46303
|
}
|
|
46280
46304
|
const componentName = getFirstComponentName(componentStack);
|
|
46281
|
-
return /* @__PURE__ */ jsx46("div", { className: "blade-chat-render-error rounded-xl border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: /* @__PURE__ */
|
|
46305
|
+
return /* @__PURE__ */ jsx46("div", { className: "blade-chat-render-error rounded-xl border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: /* @__PURE__ */ jsxs41("div", { className: "flex items-start gap-2", children: [
|
|
46282
46306
|
/* @__PURE__ */ jsx46(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--swf-warning))]" }),
|
|
46283
|
-
/* @__PURE__ */
|
|
46284
|
-
/* @__PURE__ */
|
|
46307
|
+
/* @__PURE__ */ jsxs41("div", { className: "min-w-0 flex-1", children: [
|
|
46308
|
+
/* @__PURE__ */ jsxs41("div", { className: "font-medium", children: [
|
|
46285
46309
|
label,
|
|
46286
46310
|
"\u6E32\u67D3\u5931\u8D25"
|
|
46287
46311
|
] }),
|
|
46288
|
-
/* @__PURE__ */
|
|
46312
|
+
/* @__PURE__ */ jsxs41("div", { className: "mt-1 break-words text-xs leading-5 text-[hsl(var(--secondary-foreground))]", children: [
|
|
46289
46313
|
componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
|
|
46290
46314
|
error61.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
|
|
46291
46315
|
] }),
|
|
@@ -46296,8 +46320,8 @@ var RenderErrorBoundary = class extends Component {
|
|
|
46296
46320
|
};
|
|
46297
46321
|
|
|
46298
46322
|
// src/chat/TurnNavRail.tsx
|
|
46299
|
-
import { useCallback as useCallback13, useEffect as useEffect26, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as
|
|
46300
|
-
import { jsx as jsx47, jsxs as
|
|
46323
|
+
import { useCallback as useCallback13, useEffect as useEffect26, useLayoutEffect as useLayoutEffect6, useRef as useRef26, useState as useState32 } from "react";
|
|
46324
|
+
import { jsx as jsx47, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
46301
46325
|
var PANEL_MAX_HEIGHT = 448;
|
|
46302
46326
|
var PANEL_MARGIN = 16;
|
|
46303
46327
|
function clippingAncestor(element2) {
|
|
@@ -46318,8 +46342,8 @@ function TurnNavRail({
|
|
|
46318
46342
|
error: error61 = null,
|
|
46319
46343
|
failedTurnId = null
|
|
46320
46344
|
}) {
|
|
46321
|
-
const [hoveredTurnId, setHoveredTurnId] =
|
|
46322
|
-
const [panelOpen, setPanelOpen] =
|
|
46345
|
+
const [hoveredTurnId, setHoveredTurnId] = useState32(null);
|
|
46346
|
+
const [panelOpen, setPanelOpen] = useState32(false);
|
|
46323
46347
|
const listRef = useRef26(null);
|
|
46324
46348
|
const markerRef = useRef26(null);
|
|
46325
46349
|
const edgeRatioRef = useRef26(0.5);
|
|
@@ -46442,8 +46466,8 @@ function TurnNavRail({
|
|
|
46442
46466
|
setPanelOpen(false);
|
|
46443
46467
|
setHoveredTurnId(null);
|
|
46444
46468
|
},
|
|
46445
|
-
children: /* @__PURE__ */
|
|
46446
|
-
/* @__PURE__ */
|
|
46469
|
+
children: /* @__PURE__ */ jsxs42("div", { className: "flex flex-col items-end", children: [
|
|
46470
|
+
/* @__PURE__ */ jsxs42(
|
|
46447
46471
|
"div",
|
|
46448
46472
|
{
|
|
46449
46473
|
ref: markerRef,
|
|
@@ -46491,7 +46515,7 @@ function TurnNavRail({
|
|
|
46491
46515
|
]
|
|
46492
46516
|
}
|
|
46493
46517
|
),
|
|
46494
|
-
error61 ? /* @__PURE__ */
|
|
46518
|
+
error61 ? /* @__PURE__ */ jsxs42(
|
|
46495
46519
|
"div",
|
|
46496
46520
|
{
|
|
46497
46521
|
role: "alert",
|
|
@@ -46596,7 +46620,7 @@ function calculateAnimatedScrollTop({
|
|
|
46596
46620
|
}
|
|
46597
46621
|
|
|
46598
46622
|
// src/chat/MessageList.tsx
|
|
46599
|
-
import { Fragment as
|
|
46623
|
+
import { Fragment as Fragment19, jsx as jsx48, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
46600
46624
|
function isReasoningRevealingForMessage(message, isRevealing, isStopping = false) {
|
|
46601
46625
|
if (isStopping) return false;
|
|
46602
46626
|
const hasContent = message?.content != null && message.content.length > 0;
|
|
@@ -46832,9 +46856,9 @@ function MessageListBody({
|
|
|
46832
46856
|
const observedLatestUserStableIdRef = useRef27(
|
|
46833
46857
|
latestUserIsOptimistic ? null : latestUserStableId
|
|
46834
46858
|
);
|
|
46835
|
-
const [activeTurnId, setActiveTurnId] =
|
|
46836
|
-
const [virtualScrollMargin, setVirtualScrollMargin] =
|
|
46837
|
-
const [scrollContainerElement, setScrollContainerElement] =
|
|
46859
|
+
const [activeTurnId, setActiveTurnId] = useState33(lastTurnId);
|
|
46860
|
+
const [virtualScrollMargin, setVirtualScrollMargin] = useState33(0);
|
|
46861
|
+
const [scrollContainerElement, setScrollContainerElement] = useState33(null);
|
|
46838
46862
|
const loadingOlderRef = useRef27(false);
|
|
46839
46863
|
const virtualizationEnabled = Boolean(useChatEnvironment().useVirtualizer);
|
|
46840
46864
|
const stablePrefixEnd = useMemo16(
|
|
@@ -47589,7 +47613,7 @@ function MessageListBody({
|
|
|
47589
47613
|
stablePrefixEnd,
|
|
47590
47614
|
virtualizer
|
|
47591
47615
|
]);
|
|
47592
|
-
return /* @__PURE__ */
|
|
47616
|
+
return /* @__PURE__ */ jsxs43(
|
|
47593
47617
|
"div",
|
|
47594
47618
|
{
|
|
47595
47619
|
ref: containerRef,
|
|
@@ -47608,7 +47632,7 @@ function MessageListBody({
|
|
|
47608
47632
|
failedTurnId: navFailedEntryId
|
|
47609
47633
|
}
|
|
47610
47634
|
) : null,
|
|
47611
|
-
/* @__PURE__ */
|
|
47635
|
+
/* @__PURE__ */ jsxs43(
|
|
47612
47636
|
StickToBottom,
|
|
47613
47637
|
{
|
|
47614
47638
|
contextRef: stickContextRef,
|
|
@@ -47617,7 +47641,7 @@ function MessageListBody({
|
|
|
47617
47641
|
resize: stickyTurn ? { damping: 0.8, stiffness: 0.08, mass: 1 } : "instant",
|
|
47618
47642
|
targetScrollTop: shouldAnchorEntry ? getAnchorTargetScrollTop : void 0,
|
|
47619
47643
|
children: [
|
|
47620
|
-
/* @__PURE__ */
|
|
47644
|
+
/* @__PURE__ */ jsxs43(
|
|
47621
47645
|
StickToBottom.Content,
|
|
47622
47646
|
{
|
|
47623
47647
|
part: "messages-scroll",
|
|
@@ -47777,7 +47801,7 @@ function MessageListContent({
|
|
|
47777
47801
|
const isHistoricalPlan = globalBlockIndex !== latestPlanCardBlockIndex;
|
|
47778
47802
|
const blockFeedback = displayMessages.map((message) => message.entry_id && resultFeedbackByEntry.get(message.entry_id)).find((feedback) => feedback != null);
|
|
47779
47803
|
const isActiveFollowup = block.anchorId === followupTurnId;
|
|
47780
|
-
return /* @__PURE__ */
|
|
47804
|
+
return /* @__PURE__ */ jsxs43(
|
|
47781
47805
|
"div",
|
|
47782
47806
|
{
|
|
47783
47807
|
ref: getTurnElementRef(block.anchorId),
|
|
@@ -47869,7 +47893,7 @@ function MessageListContent({
|
|
|
47869
47893
|
const renderMeasuredRow = (block, globalBlockIndex, virtualItem) => {
|
|
47870
47894
|
const persistentId = getRenderBlockPersistentId(block);
|
|
47871
47895
|
const isVirtual = virtualItem !== void 0;
|
|
47872
|
-
return /* @__PURE__ */
|
|
47896
|
+
return /* @__PURE__ */ jsxs43(
|
|
47873
47897
|
"div",
|
|
47874
47898
|
{
|
|
47875
47899
|
ref: getMeasuredRowRef(block, globalBlockIndex, isVirtual),
|
|
@@ -47900,8 +47924,8 @@ function MessageListContent({
|
|
|
47900
47924
|
{
|
|
47901
47925
|
part: "messages-content",
|
|
47902
47926
|
className: `blade-chat-messages-content mx-auto max-w-[748px] ${customization?.classNames?.messageListContent ?? ""}`,
|
|
47903
|
-
children: /* @__PURE__ */
|
|
47904
|
-
renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx48(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx48(customization.components.EmptyState, {}) : /* @__PURE__ */
|
|
47927
|
+
children: /* @__PURE__ */ jsxs43("div", { className: `min-w-0 flex flex-col gap-9 ${customization?.classNames?.messageListInner ?? ""}`, children: [
|
|
47928
|
+
renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx48(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx48(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs43(
|
|
47905
47929
|
"div",
|
|
47906
47930
|
{
|
|
47907
47931
|
part: "empty",
|
|
@@ -47912,7 +47936,7 @@ function MessageListContent({
|
|
|
47912
47936
|
/* @__PURE__ */ jsx48("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
47913
47937
|
]
|
|
47914
47938
|
}
|
|
47915
|
-
) : /* @__PURE__ */
|
|
47939
|
+
) : /* @__PURE__ */ jsxs43(Fragment19, { children: [
|
|
47916
47940
|
stablePrefixEnd > 0 ? /* @__PURE__ */ jsx48(
|
|
47917
47941
|
"div",
|
|
47918
47942
|
{
|
|
@@ -47936,14 +47960,14 @@ function MessageListContent({
|
|
|
47936
47960
|
);
|
|
47937
47961
|
}
|
|
47938
47962
|
function HistoryLoadingPlaceholder() {
|
|
47939
|
-
return /* @__PURE__ */
|
|
47940
|
-
/* @__PURE__ */
|
|
47963
|
+
return /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-9", "aria-busy": "true", "aria-live": "polite", children: [
|
|
47964
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex items-center justify-center gap-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
|
|
47941
47965
|
/* @__PURE__ */ jsx48("span", { className: "size-3.5 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
47942
47966
|
/* @__PURE__ */ jsx48("span", { children: "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8BDD\u8BB0\u5F55\u2026" })
|
|
47943
47967
|
] }),
|
|
47944
|
-
[0, 1].map((index2) => /* @__PURE__ */
|
|
47968
|
+
[0, 1].map((index2) => /* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-4", children: [
|
|
47945
47969
|
/* @__PURE__ */ jsx48("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx48("div", { className: "h-10 w-2/5 animate-pulse rounded-2xl bg-[hsl(var(--muted))]" }) }),
|
|
47946
|
-
/* @__PURE__ */
|
|
47970
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex flex-col gap-2.5", children: [
|
|
47947
47971
|
/* @__PURE__ */ jsx48("div", { className: "h-4 w-1/3 animate-pulse rounded bg-[hsl(var(--muted))]" }),
|
|
47948
47972
|
/* @__PURE__ */ jsx48("div", { className: "h-4 w-4/5 animate-pulse rounded bg-[hsl(var(--muted))]" }),
|
|
47949
47973
|
/* @__PURE__ */ jsx48("div", { className: "h-4 w-3/5 animate-pulse rounded bg-[hsl(var(--muted))]" })
|
|
@@ -47954,7 +47978,7 @@ function HistoryLoadingPlaceholder() {
|
|
|
47954
47978
|
function ScrollToBottomButton({ onBeforeScroll }) {
|
|
47955
47979
|
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
47956
47980
|
if (isAtBottom) return null;
|
|
47957
|
-
return /* @__PURE__ */
|
|
47981
|
+
return /* @__PURE__ */ jsxs43(
|
|
47958
47982
|
"button",
|
|
47959
47983
|
{
|
|
47960
47984
|
type: "button",
|
|
@@ -47974,9 +47998,9 @@ function ScrollToBottomButton({ onBeforeScroll }) {
|
|
|
47974
47998
|
}
|
|
47975
47999
|
function PlanningDivider({ kind }) {
|
|
47976
48000
|
const isEnter = kind === "enter";
|
|
47977
|
-
return /* @__PURE__ */
|
|
48001
|
+
return /* @__PURE__ */ jsxs43("div", { className: "flex items-center gap-3 py-1", children: [
|
|
47978
48002
|
/* @__PURE__ */ jsx48("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
|
|
47979
|
-
/* @__PURE__ */
|
|
48003
|
+
/* @__PURE__ */ jsxs43("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-3 py-1 text-[11px] text-[hsl(var(--swf-warning))]", children: [
|
|
47980
48004
|
/* @__PURE__ */ jsx48(Lightbulb, { size: 12 }),
|
|
47981
48005
|
/* @__PURE__ */ jsx48("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
|
|
47982
48006
|
] }),
|
|
@@ -47991,14 +48015,14 @@ function MessageList(props) {
|
|
|
47991
48015
|
}
|
|
47992
48016
|
|
|
47993
48017
|
// src/chat/runtime/use-chat-actions.ts
|
|
47994
|
-
import { useCallback as useCallback15, useEffect as useEffect28, useRef as useRef28, useState as
|
|
48018
|
+
import { useCallback as useCallback15, useEffect as useEffect28, useRef as useRef28, useState as useState34 } from "react";
|
|
47995
48019
|
function useChatActions(sessionId) {
|
|
47996
48020
|
const source = useSessionSource();
|
|
47997
48021
|
const session = useSessionHandle(sessionId);
|
|
47998
48022
|
const isStreaming = useSessionState(sessionId, (state) => state.isStreaming);
|
|
47999
|
-
const [isStopping, setIsStopping] =
|
|
48000
|
-
const [queueNotice, setQueueNotice] =
|
|
48001
|
-
const [pendingQueueItemId, setPendingQueueItemId] =
|
|
48023
|
+
const [isStopping, setIsStopping] = useState34(false);
|
|
48024
|
+
const [queueNotice, setQueueNotice] = useState34(null);
|
|
48025
|
+
const [pendingQueueItemId, setPendingQueueItemId] = useState34(null);
|
|
48002
48026
|
const previousSessionIdRef = useRef28(sessionId);
|
|
48003
48027
|
const send = useCallback15(
|
|
48004
48028
|
(msg, targetMode, askuserAnswer, options) => source.whenReady ? source.whenReady(sessionId, (ready) => sendToSession(ready, msg, targetMode, askuserAnswer, options)) : session ? sendToSession(session, msg, targetMode, askuserAnswer, options) : Promise.resolve(false),
|
|
@@ -48149,7 +48173,7 @@ function SessionReplayBar({
|
|
|
48149
48173
|
}
|
|
48150
48174
|
|
|
48151
48175
|
// src/chat/ChatPanel.tsx
|
|
48152
|
-
import { Fragment as
|
|
48176
|
+
import { Fragment as Fragment20, jsx as jsx50, jsxs as jsxs44 } from "react/jsx-runtime";
|
|
48153
48177
|
function nextQueuedOrder(items, itemId, delta) {
|
|
48154
48178
|
const pending = items.filter((item) => item.status === "pending");
|
|
48155
48179
|
const index2 = pending.findIndex((item) => item.id === itemId);
|
|
@@ -48231,12 +48255,12 @@ function ChatPanel({
|
|
|
48231
48255
|
deliverQueuedMessage,
|
|
48232
48256
|
resumeQueue
|
|
48233
48257
|
} = useChatActions(sessionId);
|
|
48234
|
-
const [isRevealing, setIsRevealing] =
|
|
48258
|
+
const [isRevealing, setIsRevealing] = useState35(false);
|
|
48235
48259
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
48236
48260
|
const detail = useChatSessionDetail(sessionId);
|
|
48237
48261
|
const { isReplay } = useSessionReplay(sessionId);
|
|
48238
48262
|
const isLoadingHistory = useIsSessionHistoryLoading(sessionId);
|
|
48239
|
-
const [queuePanelVisible, setQueuePanelVisible] =
|
|
48263
|
+
const [queuePanelVisible, setQueuePanelVisible] = useState35(false);
|
|
48240
48264
|
const loadOlder = useCallback17(
|
|
48241
48265
|
async (beforeCommit) => {
|
|
48242
48266
|
if (!agentSession) return false;
|
|
@@ -48246,7 +48270,7 @@ function ChatPanel({
|
|
|
48246
48270
|
},
|
|
48247
48271
|
[agentSession]
|
|
48248
48272
|
);
|
|
48249
|
-
const [paginationActivation, setPaginationActivation] =
|
|
48273
|
+
const [paginationActivation, setPaginationActivation] = useState35(() => ({
|
|
48250
48274
|
sessionId,
|
|
48251
48275
|
activated: Boolean(nextBefore)
|
|
48252
48276
|
}));
|
|
@@ -48267,7 +48291,7 @@ function ChatPanel({
|
|
|
48267
48291
|
const isViewer = (viewerRole ?? detail?.viewer_role) === "viewer";
|
|
48268
48292
|
const isCompacting = activeCompaction != null || compactionPending;
|
|
48269
48293
|
const postChatFollowup = useMemo17(() => latestPostChatFollowup(turns), [turns]);
|
|
48270
|
-
const [resultFeedback, setResultFeedback] =
|
|
48294
|
+
const [resultFeedback, setResultFeedback] = useState35([]);
|
|
48271
48295
|
useEffect29(() => {
|
|
48272
48296
|
setResultFeedback([]);
|
|
48273
48297
|
if (isViewer || !sessionId) return;
|
|
@@ -48397,14 +48421,14 @@ function ChatPanel({
|
|
|
48397
48421
|
initialDraftKey,
|
|
48398
48422
|
lite
|
|
48399
48423
|
};
|
|
48400
|
-
return /* @__PURE__ */ jsx50(ChatEnvironmentProvider, { value: scopedEnvironment, children: /* @__PURE__ */ jsx50(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx50(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx50(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsx50(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: /* @__PURE__ */
|
|
48424
|
+
return /* @__PURE__ */ jsx50(ChatEnvironmentProvider, { value: scopedEnvironment, children: /* @__PURE__ */ jsx50(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx50(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx50(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsx50(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: /* @__PURE__ */ jsxs44(
|
|
48401
48425
|
"div",
|
|
48402
48426
|
{
|
|
48403
48427
|
"data-theme": theme,
|
|
48404
48428
|
part: "root",
|
|
48405
48429
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
|
|
48406
48430
|
children: [
|
|
48407
|
-
isViewer && /* @__PURE__ */
|
|
48431
|
+
isViewer && /* @__PURE__ */ jsxs44(
|
|
48408
48432
|
"div",
|
|
48409
48433
|
{
|
|
48410
48434
|
className: cn(
|
|
@@ -48420,7 +48444,7 @@ function ChatPanel({
|
|
|
48420
48444
|
!isViewer && /* @__PURE__ */ jsx50(ConnectionBanner, { connection }),
|
|
48421
48445
|
banner,
|
|
48422
48446
|
/* @__PURE__ */ jsx50(SessionReplayBar, { sessionId, onExit: onExitReplay }),
|
|
48423
|
-
errorMessage && /* @__PURE__ */
|
|
48447
|
+
errorMessage && /* @__PURE__ */ jsxs44(
|
|
48424
48448
|
"div",
|
|
48425
48449
|
{
|
|
48426
48450
|
part: "error-bar",
|
|
@@ -48503,7 +48527,7 @@ function ChatPanel({
|
|
|
48503
48527
|
className: cn("mx-auto w-full max-w-3xl px-5 pb-3", classNames?.chatInputInner)
|
|
48504
48528
|
}
|
|
48505
48529
|
) : null,
|
|
48506
|
-
!isViewer && /* @__PURE__ */
|
|
48530
|
+
!isViewer && /* @__PURE__ */ jsxs44(Fragment20, { children: [
|
|
48507
48531
|
/* @__PURE__ */ jsx50(
|
|
48508
48532
|
SessionQueuePanel,
|
|
48509
48533
|
{
|
|
@@ -48534,14 +48558,14 @@ function ChatPanel({
|
|
|
48534
48558
|
}
|
|
48535
48559
|
|
|
48536
48560
|
// src/components/SessionPluginSelector.tsx
|
|
48537
|
-
import { useEffect as useEffect30, useState as
|
|
48538
|
-
import { jsx as jsx51, jsxs as
|
|
48561
|
+
import { useEffect as useEffect30, useState as useState36 } from "react";
|
|
48562
|
+
import { jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
|
|
48539
48563
|
function SessionPluginSelector(props) {
|
|
48540
48564
|
return /* @__PURE__ */ jsx51(PluginSelectorState, { ...props }, props.sessionId);
|
|
48541
48565
|
}
|
|
48542
48566
|
function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
|
|
48543
|
-
const [open2, setOpen] =
|
|
48544
|
-
return /* @__PURE__ */
|
|
48567
|
+
const [open2, setOpen] = useState36(false);
|
|
48568
|
+
return /* @__PURE__ */ jsxs45("div", { className: `relative text-xs ${className ?? ""}`, children: [
|
|
48545
48569
|
/* @__PURE__ */ jsx51(
|
|
48546
48570
|
"button",
|
|
48547
48571
|
{
|
|
@@ -48567,7 +48591,7 @@ function PluginSelectorList({
|
|
|
48567
48591
|
useEffect30(() => {
|
|
48568
48592
|
reload();
|
|
48569
48593
|
}, [reload]);
|
|
48570
|
-
return /* @__PURE__ */
|
|
48594
|
+
return /* @__PURE__ */ jsxs45(
|
|
48571
48595
|
"div",
|
|
48572
48596
|
{
|
|
48573
48597
|
className: `absolute left-0 z-40 my-2 max-h-72 w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-3 text-[hsl(var(--popover-foreground))] shadow-lg ${side === "top" ? "bottom-full" : "top-full"}`,
|
|
@@ -48597,13 +48621,13 @@ function PluginSelectorList({
|
|
|
48597
48621
|
}
|
|
48598
48622
|
|
|
48599
48623
|
// src/components/AgentChat.tsx
|
|
48600
|
-
import { Fragment as
|
|
48624
|
+
import { Fragment as Fragment21, jsx as jsx52, jsxs as jsxs46 } from "react/jsx-runtime";
|
|
48601
48625
|
function isUnauthorizedError(error61) {
|
|
48602
48626
|
return error61 instanceof BladeApiError2 && error61.status === 401;
|
|
48603
48627
|
}
|
|
48604
48628
|
function LoginCard({ client, onLoggedIn }) {
|
|
48605
|
-
const [loggingIn, setLoggingIn] =
|
|
48606
|
-
const [loginError, setLoginError] =
|
|
48629
|
+
const [loggingIn, setLoggingIn] = useState37(false);
|
|
48630
|
+
const [loginError, setLoginError] = useState37(null);
|
|
48607
48631
|
const handleLogin = async () => {
|
|
48608
48632
|
setLoggingIn(true);
|
|
48609
48633
|
setLoginError(null);
|
|
@@ -48616,7 +48640,7 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
48616
48640
|
setLoggingIn(false);
|
|
48617
48641
|
}
|
|
48618
48642
|
};
|
|
48619
|
-
return /* @__PURE__ */ jsx52("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */
|
|
48643
|
+
return /* @__PURE__ */ jsx52("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs46("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: [
|
|
48620
48644
|
/* @__PURE__ */ jsx52(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
|
|
48621
48645
|
/* @__PURE__ */ jsx52("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
|
|
48622
48646
|
/* @__PURE__ */ jsx52("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" }),
|
|
@@ -48635,8 +48659,8 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
48635
48659
|
}
|
|
48636
48660
|
function AgentChat(props) {
|
|
48637
48661
|
const client = useBladeClient();
|
|
48638
|
-
const [attempt, setAttempt] =
|
|
48639
|
-
const [needLogin, setNeedLogin] =
|
|
48662
|
+
const [attempt, setAttempt] = useState37(0);
|
|
48663
|
+
const [needLogin, setNeedLogin] = useState37(() => !client.hasToken());
|
|
48640
48664
|
if (needLogin) {
|
|
48641
48665
|
return /* @__PURE__ */ jsx52(
|
|
48642
48666
|
"div",
|
|
@@ -48681,7 +48705,7 @@ function ChatSessionView({
|
|
|
48681
48705
|
onSessionCreated
|
|
48682
48706
|
});
|
|
48683
48707
|
const replay = useReplay(session);
|
|
48684
|
-
const [notice, setNotice] =
|
|
48708
|
+
const [notice, setNotice] = useState37(null);
|
|
48685
48709
|
const source = useSingleSessionSource(session, !session || state === null);
|
|
48686
48710
|
const resolvedSessionId = session?.sessionId;
|
|
48687
48711
|
const isViewer = state?.viewerRole === "viewer";
|
|
@@ -48740,7 +48764,7 @@ function ChatSessionView({
|
|
|
48740
48764
|
onFollowupInteraction,
|
|
48741
48765
|
errorMessage: connectError ?? replay.error?.message ?? notice,
|
|
48742
48766
|
onExitReplay: () => void replay.exitToAutonomous(),
|
|
48743
|
-
banner: /* @__PURE__ */
|
|
48767
|
+
banner: /* @__PURE__ */ jsxs46(Fragment21, { children: [
|
|
48744
48768
|
resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */ jsx52(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
|
|
48745
48769
|
/* @__PURE__ */ jsx52(ReplayMismatchPrompt, { mismatch: replay.mismatch })
|
|
48746
48770
|
] })
|
|
@@ -48750,20 +48774,20 @@ function ChatSessionView({
|
|
|
48750
48774
|
|
|
48751
48775
|
// src/components/LlmChat.tsx
|
|
48752
48776
|
import { chatErrorForDisplay as chatErrorForDisplay4 } from "@blade-hq/agent-client/internal";
|
|
48753
|
-
import { useEffect as useEffect32, useMemo as useMemo20, useState as
|
|
48777
|
+
import { useEffect as useEffect32, useMemo as useMemo20, useState as useState40 } from "react";
|
|
48754
48778
|
|
|
48755
48779
|
// src/hooks/use-llm-chat.ts
|
|
48756
|
-
import { useCallback as useCallback18, useMemo as useMemo19, useRef as useRef30, useState as
|
|
48780
|
+
import { useCallback as useCallback18, useMemo as useMemo19, useRef as useRef30, useState as useState38 } from "react";
|
|
48757
48781
|
var DEFAULT_HISTORY_TURNS = 12;
|
|
48758
48782
|
var DEFAULT_MAX_TOOL_ROUNDS = 4;
|
|
48759
48783
|
var syntheticIdSeq = 0;
|
|
48760
48784
|
function useLlmChat(options) {
|
|
48761
|
-
const [history, setHistory] =
|
|
48762
|
-
const [streamingText, setStreamingText] =
|
|
48763
|
-
const [streamingCalls, setStreamingCalls] =
|
|
48764
|
-
const [failedToolIds, setFailedToolIds] =
|
|
48765
|
-
const [error61, setError] =
|
|
48766
|
-
const [isStreaming, setIsStreaming] =
|
|
48785
|
+
const [history, setHistory] = useState38([]);
|
|
48786
|
+
const [streamingText, setStreamingText] = useState38(null);
|
|
48787
|
+
const [streamingCalls, setStreamingCalls] = useState38([]);
|
|
48788
|
+
const [failedToolIds, setFailedToolIds] = useState38([]);
|
|
48789
|
+
const [error61, setError] = useState38(null);
|
|
48790
|
+
const [isStreaming, setIsStreaming] = useState38(false);
|
|
48767
48791
|
const abortRef = useRef30(null);
|
|
48768
48792
|
const activeStartedAtRef = useRef30(null);
|
|
48769
48793
|
const assistantTimingsRef = useRef30(/* @__PURE__ */ new WeakMap());
|
|
@@ -49109,8 +49133,8 @@ function toToolCallInfo(call, results, failedToolIds) {
|
|
|
49109
49133
|
}
|
|
49110
49134
|
|
|
49111
49135
|
// src/components/LlmAdvancedSettings.tsx
|
|
49112
|
-
import { useState as
|
|
49113
|
-
import { jsx as jsx53, jsxs as
|
|
49136
|
+
import { useState as useState39 } from "react";
|
|
49137
|
+
import { jsx as jsx53, jsxs as jsxs47 } from "react/jsx-runtime";
|
|
49114
49138
|
var FIELDS = [
|
|
49115
49139
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
49116
49140
|
{ id: "model", label: "\u6A21\u578B", placeholder: "\u6A21\u578B\u540D\u79F0" },
|
|
@@ -49156,13 +49180,13 @@ function writeOverride(settings, baseURL, override) {
|
|
|
49156
49180
|
}
|
|
49157
49181
|
function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
49158
49182
|
const normalized = normalizeAdvanced(settings);
|
|
49159
|
-
const [open2, setOpen] =
|
|
49160
|
-
const [draft, setDraft] =
|
|
49183
|
+
const [open2, setOpen] = useState39(false);
|
|
49184
|
+
const [draft, setDraft] = useState39(override);
|
|
49161
49185
|
if (!normalized) return null;
|
|
49162
49186
|
const fields = FIELDS.filter((field) => normalized[field.id]);
|
|
49163
49187
|
const dirty = Object.keys(override).length > 0;
|
|
49164
|
-
return /* @__PURE__ */
|
|
49165
|
-
/* @__PURE__ */
|
|
49188
|
+
return /* @__PURE__ */ jsxs47("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
|
|
49189
|
+
/* @__PURE__ */ jsxs47(
|
|
49166
49190
|
"button",
|
|
49167
49191
|
{
|
|
49168
49192
|
type: "button",
|
|
@@ -49178,8 +49202,8 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
49178
49202
|
]
|
|
49179
49203
|
}
|
|
49180
49204
|
),
|
|
49181
|
-
open2 && /* @__PURE__ */
|
|
49182
|
-
fields.map((field) => /* @__PURE__ */
|
|
49205
|
+
open2 && /* @__PURE__ */ jsxs47("div", { className: "mt-2 flex flex-col gap-2", children: [
|
|
49206
|
+
fields.map((field) => /* @__PURE__ */ jsxs47("label", { className: "flex flex-col gap-1", children: [
|
|
49183
49207
|
/* @__PURE__ */ jsx53("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
|
|
49184
49208
|
/* @__PURE__ */ jsx53(
|
|
49185
49209
|
"input",
|
|
@@ -49193,7 +49217,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
49193
49217
|
)
|
|
49194
49218
|
] }, field.id)),
|
|
49195
49219
|
normalized.apiKey && /* @__PURE__ */ jsx53("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" }),
|
|
49196
|
-
/* @__PURE__ */
|
|
49220
|
+
/* @__PURE__ */ jsxs47("div", { className: "flex gap-2", children: [
|
|
49197
49221
|
/* @__PURE__ */ jsx53(
|
|
49198
49222
|
"button",
|
|
49199
49223
|
{
|
|
@@ -49228,7 +49252,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
49228
49252
|
}
|
|
49229
49253
|
|
|
49230
49254
|
// src/components/LlmChat.tsx
|
|
49231
|
-
import { jsx as jsx54, jsxs as
|
|
49255
|
+
import { jsx as jsx54, jsxs as jsxs48 } from "react/jsx-runtime";
|
|
49232
49256
|
function LlmChat({
|
|
49233
49257
|
classNames,
|
|
49234
49258
|
renderers,
|
|
@@ -49240,12 +49264,12 @@ function LlmChat({
|
|
|
49240
49264
|
onOverrideChange,
|
|
49241
49265
|
...options
|
|
49242
49266
|
}) {
|
|
49243
|
-
const [override, setOverride] =
|
|
49267
|
+
const [override, setOverride] = useState40(() => readOverride(advanced, options.baseURL));
|
|
49244
49268
|
const effective = { ...options, ...override };
|
|
49245
49269
|
const { messages, isStreaming, error: error61, send, stop, reset } = useLlmChat(effective);
|
|
49246
|
-
const [inputText, setInputText] =
|
|
49247
|
-
const [stopRequested, setStopRequested] =
|
|
49248
|
-
const [isRevealing, setIsRevealing] =
|
|
49270
|
+
const [inputText, setInputText] = useState40("");
|
|
49271
|
+
const [stopRequested, setStopRequested] = useState40(false);
|
|
49272
|
+
const [isRevealing, setIsRevealing] = useState40(false);
|
|
49249
49273
|
const isStreamingDisplay = isStreaming || isRevealing;
|
|
49250
49274
|
const handle = useMemo20(
|
|
49251
49275
|
() => ({
|
|
@@ -49260,14 +49284,14 @@ ${text4}` : text4),
|
|
|
49260
49284
|
onReady?.(handle);
|
|
49261
49285
|
}, [handle, onReady]);
|
|
49262
49286
|
const customization = useMemo20(() => ({ classNames, renderers }), [classNames, renderers]);
|
|
49263
|
-
return /* @__PURE__ */ jsx54(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */
|
|
49287
|
+
return /* @__PURE__ */ jsx54(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsxs48(
|
|
49264
49288
|
"div",
|
|
49265
49289
|
{
|
|
49266
49290
|
"data-theme": theme,
|
|
49267
49291
|
part: "root",
|
|
49268
49292
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
|
|
49269
49293
|
children: [
|
|
49270
|
-
error61 ? /* @__PURE__ */
|
|
49294
|
+
error61 ? /* @__PURE__ */ jsxs48(
|
|
49271
49295
|
"div",
|
|
49272
49296
|
{
|
|
49273
49297
|
part: "error-bar",
|
|
@@ -49357,8 +49381,8 @@ function ChatView(props) {
|
|
|
49357
49381
|
}
|
|
49358
49382
|
|
|
49359
49383
|
// src/components/TopicAssetSubmitDialog.tsx
|
|
49360
|
-
import { useRef as useRef31, useState as
|
|
49361
|
-
import { jsx as jsx56, jsxs as
|
|
49384
|
+
import { useRef as useRef31, useState as useState41 } from "react";
|
|
49385
|
+
import { jsx as jsx56, jsxs as jsxs49 } from "react/jsx-runtime";
|
|
49362
49386
|
function useTopicAssetSubmissionAccess(sessionId) {
|
|
49363
49387
|
const client = useBladeClient();
|
|
49364
49388
|
return useAsyncValue(sessionId, async (signal) => {
|
|
@@ -49374,12 +49398,12 @@ function useTopicAssetSubmissionAccess(sessionId) {
|
|
|
49374
49398
|
}
|
|
49375
49399
|
function TopicAssetSubmitDialog({ sessionId, topicId, path: path2, onClose, onSubmitted }) {
|
|
49376
49400
|
const client = useBladeClient();
|
|
49377
|
-
const [folder, setFolder] =
|
|
49378
|
-
const [message, setMessage] =
|
|
49379
|
-
const [error61, setError] =
|
|
49380
|
-
const [busy, setBusy] =
|
|
49401
|
+
const [folder, setFolder] = useState41("");
|
|
49402
|
+
const [message, setMessage] = useState41("");
|
|
49403
|
+
const [error61, setError] = useState41(null);
|
|
49404
|
+
const [busy, setBusy] = useState41(false);
|
|
49381
49405
|
const submitting = useRef31(false);
|
|
49382
|
-
const [revision, setRevision] =
|
|
49406
|
+
const [revision, setRevision] = useState41(0);
|
|
49383
49407
|
const assets = useAsyncValue(`${sessionId}:${topicId}:${revision}`, async () => {
|
|
49384
49408
|
const [session, groups, result] = await Promise.all([
|
|
49385
49409
|
client.sessions.getSession(sessionId),
|
|
@@ -49416,32 +49440,32 @@ function TopicAssetSubmitDialog({ sessionId, topicId, path: path2, onClose, onSu
|
|
|
49416
49440
|
};
|
|
49417
49441
|
return /* @__PURE__ */ jsx56(Dialog, { open: true, onOpenChange: (open2) => {
|
|
49418
49442
|
if (!open2 && !busy) onClose();
|
|
49419
|
-
}, children: /* @__PURE__ */
|
|
49443
|
+
}, children: /* @__PURE__ */ jsxs49(DialogContent, { className: "max-w-md", children: [
|
|
49420
49444
|
/* @__PURE__ */ jsx56(DialogTitle, { children: "\u63D0\u4EA4\u5230\u8D44\u4EA7" }),
|
|
49421
49445
|
/* @__PURE__ */ jsx56(DialogDescription, { children: "\u5C06\u6587\u4EF6\u590D\u5236\u5230\u4E3B\u9898\u4F9B\u6210\u5458\u4F7F\u7528\uFF0C\u5DE5\u4F5C\u533A\u539F\u6587\u4EF6\u4F1A\u4FDD\u7559\u3002\u540C\u540D\u8D44\u4EA7\u4F1A\u88AB\u66FF\u6362\u3002" }),
|
|
49422
|
-
/* @__PURE__ */
|
|
49446
|
+
/* @__PURE__ */ jsxs49("form", { onSubmit: (event) => {
|
|
49423
49447
|
event.preventDefault();
|
|
49424
49448
|
void submit();
|
|
49425
49449
|
}, className: "flex flex-col gap-4", children: [
|
|
49426
49450
|
/* @__PURE__ */ jsx56("p", { className: "break-all text-sm text-secondary-foreground", children: path2 }),
|
|
49427
|
-
/* @__PURE__ */
|
|
49451
|
+
/* @__PURE__ */ jsxs49("label", { className: "flex flex-col gap-1 text-sm", children: [
|
|
49428
49452
|
"\u76EE\u6807\u6587\u4EF6\u5939",
|
|
49429
|
-
/* @__PURE__ */
|
|
49453
|
+
/* @__PURE__ */ jsxs49("select", { "aria-label": "\u76EE\u6807\u6587\u4EF6\u5939", value: folder, onChange: (event) => setFolder(event.target.value), disabled: busy || !assets.data, className: "rounded-md border border-border bg-background p-2", children: [
|
|
49430
49454
|
/* @__PURE__ */ jsx56("option", { value: "", children: "\u8D44\u4EA7\u6839\u76EE\u5F55" }),
|
|
49431
49455
|
assets.data?.map((item) => /* @__PURE__ */ jsx56("option", { value: item, children: item }, item))
|
|
49432
49456
|
] })
|
|
49433
49457
|
] }),
|
|
49434
|
-
/* @__PURE__ */
|
|
49458
|
+
/* @__PURE__ */ jsxs49("label", { className: "flex flex-col gap-1 text-sm", children: [
|
|
49435
49459
|
"\u8BF4\u660E\uFF08\u53EF\u9009\uFF09",
|
|
49436
49460
|
/* @__PURE__ */ jsx56("textarea", { "aria-label": "\u63D0\u4EA4\u8BF4\u660E", value: message, onChange: (event) => setMessage(event.target.value), maxLength: 1e3, disabled: busy, className: "min-h-20 rounded-md border border-border bg-background p-2" })
|
|
49437
49461
|
] }),
|
|
49438
|
-
assets.error ? /* @__PURE__ */
|
|
49462
|
+
assets.error ? /* @__PURE__ */ jsxs49("div", { role: "alert", className: "text-sm text-muted-foreground", children: [
|
|
49439
49463
|
assets.error instanceof Error ? assets.error.message : "\u8D44\u4EA7\u52A0\u8F7D\u5931\u8D25",
|
|
49440
49464
|
" ",
|
|
49441
49465
|
/* @__PURE__ */ jsx56("button", { type: "button", onClick: () => setRevision((n2) => n2 + 1), className: "underline", children: "\u91CD\u8BD5" })
|
|
49442
49466
|
] }) : !assets.data ? /* @__PURE__ */ jsx56("output", { className: "text-sm text-muted-foreground", children: "\u6B63\u5728\u52A0\u8F7D\u8D44\u4EA7\u2026" }) : null,
|
|
49443
49467
|
error61 ? /* @__PURE__ */ jsx56("p", { role: "alert", className: "text-sm text-muted-foreground", children: error61 }) : null,
|
|
49444
|
-
/* @__PURE__ */
|
|
49468
|
+
/* @__PURE__ */ jsxs49("div", { className: "flex justify-end gap-2", children: [
|
|
49445
49469
|
/* @__PURE__ */ jsx56("button", { type: "button", disabled: busy, onClick: onClose, className: "rounded-md border border-border px-3 py-2 text-sm", children: "\u53D6\u6D88" }),
|
|
49446
49470
|
/* @__PURE__ */ jsx56("button", { type: "submit", disabled: busy || !assets.data, className: "rounded-md bg-primary px-3 py-2 text-sm text-primary-foreground disabled:opacity-50", children: busy ? "\u63D0\u4EA4\u4E2D\u2026" : "\u63D0\u4EA4" })
|
|
49447
49471
|
] })
|
|
@@ -49503,4 +49527,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
49503
49527
|
js-yaml/dist/js-yaml.mjs:
|
|
49504
49528
|
(*! js-yaml 4.1.1 https://github.com/nodeca/js-yaml @license MIT *)
|
|
49505
49529
|
*/
|
|
49506
|
-
//# sourceMappingURL=chunk-
|
|
49530
|
+
//# sourceMappingURL=chunk-PQZC5LMU.js.map
|