@blade-hq/agent-kit 0.5.23 → 0.5.25
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/{SkillStatusBar-Dn5im-__.d.ts → SkillStatusBar-BUisTEAL.d.ts} +5 -2
- package/dist/{blade-client-Bhp0hHiZ.d.ts → blade-client-KmBClau6.d.ts} +35 -2
- package/dist/{chunk-B4RZNR3L.js → chunk-FZXLII7S.js} +30 -2
- package/dist/chunk-FZXLII7S.js.map +1 -0
- package/dist/{chunk-SLTENCW7.js → chunk-HAFDWDFG.js} +2 -2
- package/dist/{chunk-LI3WURWU.js → chunk-PKQKLRFQ.js} +15 -5
- package/dist/chunk-PKQKLRFQ.js.map +1 -0
- package/dist/{chunk-PRWPDK6Z.js → chunk-SENUKC7C.js} +368 -315
- package/dist/chunk-SENUKC7C.js.map +1 -0
- package/dist/{chunk-NWKF2VEC.js → chunk-UQWHEHG3.js} +2 -2
- package/dist/client/index.d.ts +4619 -2838
- package/dist/react/api/vibe-coding.d.ts +3 -3
- package/dist/react/api/vibe-coding.js +1 -1
- package/dist/react/components/chat/index.d.ts +4 -4
- package/dist/react/components/chat/index.js +4 -4
- package/dist/react/components/plan/index.js +3 -3
- package/dist/react/components/session/index.d.ts +1 -1
- package/dist/react/components/session/index.js +2 -2
- package/dist/react/components/workspace/index.d.ts +22 -2
- package/dist/react/components/workspace/index.js +30 -14
- package/dist/react/components/workspace/index.js.map +1 -1
- package/dist/react/index.d.ts +17 -179
- package/dist/react/index.js +6 -5
- package/dist/react/index.js.map +1 -1
- package/dist/{session-BuaeCsMC.d.ts → session-B5v5KkVd.d.ts} +5 -3
- package/dist/sessions-DfRYZZnH.d.ts +174 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-B4RZNR3L.js.map +0 -1
- package/dist/chunk-LI3WURWU.js.map +0 -1
- package/dist/chunk-PRWPDK6Z.js.map +0 -1
- /package/dist/{chunk-SLTENCW7.js.map → chunk-HAFDWDFG.js.map} +0 -0
- /package/dist/{chunk-NWKF2VEC.js.map → chunk-UQWHEHG3.js.map} +0 -0
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
getCodeLanguageFromFilename,
|
|
9
9
|
parseAskUserQuestion,
|
|
10
10
|
useHighlightedCodeHtml
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-PKQKLRFQ.js";
|
|
12
12
|
import {
|
|
13
13
|
Collapsible,
|
|
14
14
|
CollapsibleContent,
|
|
@@ -16,7 +16,7 @@ import {
|
|
|
16
16
|
} from "./chunk-H62LH2AG.js";
|
|
17
17
|
import {
|
|
18
18
|
resolveSessionFilePreviewTarget
|
|
19
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-UQWHEHG3.js";
|
|
20
20
|
import {
|
|
21
21
|
apiFetchResponse,
|
|
22
22
|
buildMessageContent,
|
|
@@ -60,7 +60,7 @@ import {
|
|
|
60
60
|
useUiBridgeStore,
|
|
61
61
|
useUiStore,
|
|
62
62
|
writeFile
|
|
63
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-FZXLII7S.js";
|
|
64
64
|
import {
|
|
65
65
|
registerBridgeIframe,
|
|
66
66
|
tapBridgeEvent
|
|
@@ -79,6 +79,7 @@ import {
|
|
|
79
79
|
} from "./chunk-PZ5AY32C.js";
|
|
80
80
|
|
|
81
81
|
// src/react/components/chat/ChatView.tsx
|
|
82
|
+
import { CircleAlert as CircleAlert2 } from "lucide-react";
|
|
82
83
|
import { Eye } from "lucide-react";
|
|
83
84
|
import { useCallback as useCallback13, useMemo as useMemo18 } from "react";
|
|
84
85
|
|
|
@@ -5519,6 +5520,52 @@ function SearchRenderer({ toolCall }) {
|
|
|
5519
5520
|
] });
|
|
5520
5521
|
}
|
|
5521
5522
|
|
|
5523
|
+
// src/react/components/chat/tool-renderers/SubmitResultRenderer.tsx
|
|
5524
|
+
import { CheckCircle2, CircleAlert } from "lucide-react";
|
|
5525
|
+
import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
5526
|
+
function extractText(value, key) {
|
|
5527
|
+
if (!isPlainObject(value)) return null;
|
|
5528
|
+
const field = value[key];
|
|
5529
|
+
return typeof field === "string" && field.trim() ? field.trim() : null;
|
|
5530
|
+
}
|
|
5531
|
+
function parsePayload(toolCall) {
|
|
5532
|
+
const resultText = getResultText(toolCall.result);
|
|
5533
|
+
const parsedResult = parseJsonValue(resultText);
|
|
5534
|
+
const parsedArgs = parseJsonValue(toolCall.arguments);
|
|
5535
|
+
const source = isPlainObject(parsedResult) ? parsedResult : parsedArgs;
|
|
5536
|
+
const description = extractText(source, "description");
|
|
5537
|
+
const result = extractText(source, "result") ?? (typeof resultText === "string" ? resultText.trim() : null);
|
|
5538
|
+
const error = extractText(source, "err_msg") ?? extractText(source, "error");
|
|
5539
|
+
const status = extractText(source, "status");
|
|
5540
|
+
return { description, result, error, status };
|
|
5541
|
+
}
|
|
5542
|
+
function SubmitResultRenderer({ toolCall }) {
|
|
5543
|
+
const { description, result, error, status } = parsePayload(toolCall);
|
|
5544
|
+
const isError = toolCall.status === "error" || Boolean(error);
|
|
5545
|
+
const Icon = isError ? CircleAlert : CheckCircle2;
|
|
5546
|
+
return /* @__PURE__ */ jsxs16("div", { className: "overflow-hidden rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-sm", children: [
|
|
5547
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-3 border-b border-[hsl(var(--border))] bg-[hsl(var(--muted))]/25 px-4 py-3", children: [
|
|
5548
|
+
/* @__PURE__ */ jsx20("div", { className: isError ? "text-red-500" : "text-emerald-500", children: /* @__PURE__ */ jsx20(Icon, { size: 18 }) }),
|
|
5549
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 flex-1", children: [
|
|
5550
|
+
/* @__PURE__ */ jsx20("div", { className: "font-medium text-[hsl(var(--foreground))]", children: description || (isError ? "\u4EFB\u52A1\u6267\u884C\u5931\u8D25" : "\u4EFB\u52A1\u7ED3\u679C\u5DF2\u63D0\u4EA4") }),
|
|
5551
|
+
description ? /* @__PURE__ */ jsx20("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,
|
|
5552
|
+
status ? /* @__PURE__ */ jsxs16("div", { className: "mt-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
5553
|
+
"\u72B6\u6001\uFF1A",
|
|
5554
|
+
status
|
|
5555
|
+
] }) : null
|
|
5556
|
+
] })
|
|
5557
|
+
] }),
|
|
5558
|
+
/* @__PURE__ */ jsxs16("div", { className: "space-y-3 px-4 py-4 text-sm leading-6 text-[hsl(var(--foreground))]", children: [
|
|
5559
|
+
result ? /* @__PURE__ */ jsx20("p", { className: "whitespace-pre-wrap", children: result }) : null,
|
|
5560
|
+
error ? /* @__PURE__ */ jsxs16("div", { className: "rounded-xl border border-red-500/30 bg-red-500/10 px-3 py-2 text-sm text-red-700 dark:text-red-200", children: [
|
|
5561
|
+
/* @__PURE__ */ jsx20("div", { className: "mb-1 font-medium", children: "\u9519\u8BEF\u4FE1\u606F" }),
|
|
5562
|
+
/* @__PURE__ */ jsx20("div", { className: "whitespace-pre-wrap", children: error })
|
|
5563
|
+
] }) : null,
|
|
5564
|
+
!result && !error ? /* @__PURE__ */ jsx20("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u667A\u80FD\u4F53\u5DF2\u7ED3\u675F\u672C\u8F6E\u4EFB\u52A1\u3002" }) : null
|
|
5565
|
+
] })
|
|
5566
|
+
] });
|
|
5567
|
+
}
|
|
5568
|
+
|
|
5522
5569
|
// src/react/components/chat/tool-renderers/registry.ts
|
|
5523
5570
|
var RENDERERS = /* @__PURE__ */ new Map([
|
|
5524
5571
|
["Bash", BashRenderer],
|
|
@@ -5530,14 +5577,15 @@ var RENDERERS = /* @__PURE__ */ new Map([
|
|
|
5530
5577
|
["Read", FileReadRenderer],
|
|
5531
5578
|
["WebFetch", SearchRenderer],
|
|
5532
5579
|
["WebSearch", SearchRenderer],
|
|
5533
|
-
["Write", FileEditRenderer]
|
|
5580
|
+
["Write", FileEditRenderer],
|
|
5581
|
+
["submit_result", SubmitResultRenderer]
|
|
5534
5582
|
]);
|
|
5535
5583
|
function getRenderer(toolName) {
|
|
5536
5584
|
return RENDERERS.get(formatToolName(toolName)) ?? null;
|
|
5537
5585
|
}
|
|
5538
5586
|
|
|
5539
5587
|
// src/react/components/chat/ToolCallBlock.tsx
|
|
5540
|
-
import { Fragment as Fragment5, jsx as
|
|
5588
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5541
5589
|
function FilePathLink({ filePath, sessionId }) {
|
|
5542
5590
|
const activeSessionId = useSessionStore((s) => s.activeSessionId);
|
|
5543
5591
|
const pushArtifact = useUiStore((s) => s.pushArtifact);
|
|
@@ -5555,14 +5603,14 @@ function FilePathLink({ filePath, sessionId }) {
|
|
|
5555
5603
|
} catch {
|
|
5556
5604
|
}
|
|
5557
5605
|
};
|
|
5558
|
-
return /* @__PURE__ */
|
|
5606
|
+
return /* @__PURE__ */ jsx21(
|
|
5559
5607
|
"button",
|
|
5560
5608
|
{
|
|
5561
5609
|
type: "button",
|
|
5562
5610
|
onClick: handleClick,
|
|
5563
5611
|
className: "flex min-w-0 items-center gap-1 text-blue-400 hover:text-blue-300 hover:underline cursor-pointer font-mono",
|
|
5564
5612
|
title: `\u9884\u89C8 ${filePath}`,
|
|
5565
|
-
children: /* @__PURE__ */
|
|
5613
|
+
children: /* @__PURE__ */ jsx21("span", { className: "truncate", children: fileName })
|
|
5566
5614
|
}
|
|
5567
5615
|
);
|
|
5568
5616
|
}
|
|
@@ -5605,7 +5653,7 @@ function ToolCallBlock({
|
|
|
5605
5653
|
const canAnswer = toolCall.status === "awaiting_answer" && Boolean(resolvedOnAnswer) && Boolean(resolvedSessionStatus);
|
|
5606
5654
|
const shouldRenderQuestion = Boolean(askData) && (canAnswer || resolvedAnswered || toolCall.status === "done");
|
|
5607
5655
|
if (askData && shouldRenderQuestion) {
|
|
5608
|
-
const questionBlock = /* @__PURE__ */
|
|
5656
|
+
const questionBlock = /* @__PURE__ */ jsx21(
|
|
5609
5657
|
AskUserQuestionBlock,
|
|
5610
5658
|
{
|
|
5611
5659
|
data: askData,
|
|
@@ -5619,9 +5667,9 @@ function ToolCallBlock({
|
|
|
5619
5667
|
if (!reasoning) {
|
|
5620
5668
|
return questionBlock;
|
|
5621
5669
|
}
|
|
5622
|
-
return /* @__PURE__ */
|
|
5670
|
+
return /* @__PURE__ */ jsxs17("div", { className: "flex flex-col gap-1", children: [
|
|
5623
5671
|
questionBlock,
|
|
5624
|
-
/* @__PURE__ */
|
|
5672
|
+
/* @__PURE__ */ jsx21("div", { className: "ml-4", children: /* @__PURE__ */ jsx21(ThinkingBadge, { reasoning, variant: "block" }) })
|
|
5625
5673
|
] });
|
|
5626
5674
|
}
|
|
5627
5675
|
}
|
|
@@ -5632,11 +5680,11 @@ function ToolCallBlock({
|
|
|
5632
5680
|
const borderWidthClass = level === 2 ? "border-l-[2px]" : "border-l-[3px]";
|
|
5633
5681
|
const indentClass = level === 2 ? "ml-3" : "ml-4";
|
|
5634
5682
|
const toneClass = tone === "red" ? "border-l-[hsl(var(--muted-foreground)/0.5)]" : tone === "amber" ? "border-l-amber-400" : tone === "blue" ? "border-l-blue-500" : "border-l-[hsl(var(--primary))]";
|
|
5635
|
-
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */
|
|
5683
|
+
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */ jsx21(Loader23, { size: 11, className: "animate-spin" }) : toolCall.status === "awaiting_answer" ? /* @__PURE__ */ jsx21(MessageSquareMore, { size: 11 }) : toolCall.status === "cancelled" || toolCall.status === "error" ? /* @__PURE__ */ jsx21(X4, { size: 11 }) : /* @__PURE__ */ jsx21(Check, { size: 11 });
|
|
5636
5684
|
const statusTextClass = tone === "red" ? "text-[hsl(var(--muted-foreground))]" : tone === "amber" ? "text-amber-300" : tone === "blue" ? "text-blue-300" : "text-[hsl(var(--primary))]";
|
|
5637
|
-
return /* @__PURE__ */
|
|
5638
|
-
/* @__PURE__ */
|
|
5639
|
-
/* @__PURE__ */
|
|
5685
|
+
return /* @__PURE__ */ jsxs17("div", { className: cn(indentClass, "text-xs", customization?.classNames?.toolCall), children: [
|
|
5686
|
+
/* @__PURE__ */ jsxs17("div", { className: cn(borderWidthClass, toneClass, "flex items-center gap-2 px-3 py-2"), children: [
|
|
5687
|
+
/* @__PURE__ */ jsxs17(
|
|
5640
5688
|
"button",
|
|
5641
5689
|
{
|
|
5642
5690
|
type: "button",
|
|
@@ -5644,7 +5692,7 @@ function ToolCallBlock({
|
|
|
5644
5692
|
className: "flex min-w-0 flex-1 items-center gap-2 text-left transition-colors hover:bg-white/3 focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
5645
5693
|
"aria-expanded": expanded,
|
|
5646
5694
|
children: [
|
|
5647
|
-
/* @__PURE__ */
|
|
5695
|
+
/* @__PURE__ */ jsx21(
|
|
5648
5696
|
ChevronRight3,
|
|
5649
5697
|
{
|
|
5650
5698
|
size: 11,
|
|
@@ -5654,21 +5702,21 @@ function ToolCallBlock({
|
|
|
5654
5702
|
)
|
|
5655
5703
|
}
|
|
5656
5704
|
),
|
|
5657
|
-
/* @__PURE__ */
|
|
5705
|
+
/* @__PURE__ */ jsxs17("span", { className: cn("flex shrink-0 items-center gap-1 text-[10px]", statusTextClass), children: [
|
|
5658
5706
|
statusIcon,
|
|
5659
|
-
/* @__PURE__ */
|
|
5707
|
+
/* @__PURE__ */ jsx21("span", { children: getToolStatusLabel(toolCall.status) })
|
|
5660
5708
|
] }),
|
|
5661
|
-
/* @__PURE__ */
|
|
5709
|
+
/* @__PURE__ */ jsxs17("span", { className: "min-w-0 flex-1 truncate font-medium text-[hsl(var(--foreground))]", children: [
|
|
5662
5710
|
displayName,
|
|
5663
5711
|
toolCall.status === "error" ? "\uFF08\u5F85\u91CD\u8BD5\uFF09" : ""
|
|
5664
5712
|
] })
|
|
5665
5713
|
]
|
|
5666
5714
|
}
|
|
5667
5715
|
),
|
|
5668
|
-
filePath && /* @__PURE__ */
|
|
5669
|
-
reasoning ? /* @__PURE__ */
|
|
5670
|
-
typeof toolCall.duration_ms === "number" && toolCall.duration_ms > 0 && /* @__PURE__ */
|
|
5671
|
-
uiMeta?.target === "preview" && resolvedSessionId && !isInternalStatusPreview(uiMeta) ? /* @__PURE__ */
|
|
5716
|
+
filePath && /* @__PURE__ */ jsx21("span", { className: "flex min-w-0 max-w-[50%] text-[hsl(var(--muted-foreground))]", children: /* @__PURE__ */ jsx21(FilePathLink, { filePath, sessionId: resolvedSessionId }) }),
|
|
5717
|
+
reasoning ? /* @__PURE__ */ jsx21(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
5718
|
+
typeof toolCall.duration_ms === "number" && toolCall.duration_ms > 0 && /* @__PURE__ */ jsx21("span", { className: "shrink-0 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: formatToolDuration(toolCall.duration_ms) }),
|
|
5719
|
+
uiMeta?.target === "preview" && resolvedSessionId && !isInternalStatusPreview(uiMeta) ? /* @__PURE__ */ jsxs17(
|
|
5672
5720
|
"button",
|
|
5673
5721
|
{
|
|
5674
5722
|
type: "button",
|
|
@@ -5686,20 +5734,20 @@ function ToolCallBlock({
|
|
|
5686
5734
|
className: "inline-flex shrink-0 items-center gap-1 text-blue-400 hover:text-blue-300 hover:underline cursor-pointer",
|
|
5687
5735
|
title: `\u6253\u5F00 ${uiMeta.title ?? displayName}`,
|
|
5688
5736
|
children: [
|
|
5689
|
-
/* @__PURE__ */
|
|
5690
|
-
/* @__PURE__ */
|
|
5737
|
+
/* @__PURE__ */ jsx21(PanelRightOpen, { size: 11 }),
|
|
5738
|
+
/* @__PURE__ */ jsx21("span", { children: uiMeta.title ?? displayName })
|
|
5691
5739
|
]
|
|
5692
5740
|
}
|
|
5693
5741
|
) : null
|
|
5694
5742
|
] }),
|
|
5695
|
-
expanded && /* @__PURE__ */
|
|
5696
|
-
/* @__PURE__ */
|
|
5697
|
-
/* @__PURE__ */
|
|
5698
|
-
/* @__PURE__ */
|
|
5699
|
-
/* @__PURE__ */
|
|
5700
|
-
toolCall.result != null && /* @__PURE__ */
|
|
5701
|
-
/* @__PURE__ */
|
|
5702
|
-
/* @__PURE__ */
|
|
5743
|
+
expanded && /* @__PURE__ */ jsx21("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx21(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
5744
|
+
/* @__PURE__ */ jsx21("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u5DE5\u5177" }),
|
|
5745
|
+
/* @__PURE__ */ jsx21("div", { className: "mb-3 font-mono text-[11px] text-[hsl(var(--foreground))]", children: normalizedName }),
|
|
5746
|
+
/* @__PURE__ */ jsx21("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u53C2\u6570" }),
|
|
5747
|
+
/* @__PURE__ */ jsx21("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) }),
|
|
5748
|
+
toolCall.result != null && /* @__PURE__ */ jsxs17(Fragment5, { children: [
|
|
5749
|
+
/* @__PURE__ */ jsx21("div", { className: "mb-1 mt-3 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u7ED3\u679C" }),
|
|
5750
|
+
/* @__PURE__ */ jsx21(
|
|
5703
5751
|
"pre",
|
|
5704
5752
|
{
|
|
5705
5753
|
className: cn(
|
|
@@ -5890,7 +5938,7 @@ import { Download as Download3, X as X5 } from "lucide-react";
|
|
|
5890
5938
|
import { useEffect as useEffect12 } from "react";
|
|
5891
5939
|
import { createPortal as createPortal4 } from "react-dom";
|
|
5892
5940
|
import { useQuery as useQuery6 } from "@tanstack/react-query";
|
|
5893
|
-
import { jsx as
|
|
5941
|
+
import { jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5894
5942
|
function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
5895
5943
|
useEffect12(() => {
|
|
5896
5944
|
if (!open) return;
|
|
@@ -5918,7 +5966,7 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
5918
5966
|
staleTime: 6e4
|
|
5919
5967
|
});
|
|
5920
5968
|
if (!open) return null;
|
|
5921
|
-
const body = /* @__PURE__ */
|
|
5969
|
+
const body = /* @__PURE__ */ jsx22(
|
|
5922
5970
|
"div",
|
|
5923
5971
|
{
|
|
5924
5972
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/60 p-4",
|
|
@@ -5929,17 +5977,17 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
5929
5977
|
role: "dialog",
|
|
5930
5978
|
"aria-modal": "true",
|
|
5931
5979
|
"aria-labelledby": "attachment-preview-title",
|
|
5932
|
-
children: /* @__PURE__ */
|
|
5980
|
+
children: /* @__PURE__ */ jsxs18(
|
|
5933
5981
|
"div",
|
|
5934
5982
|
{
|
|
5935
5983
|
className: "max-h-[90vh] w-full max-w-3xl overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--background))] shadow-2xl",
|
|
5936
5984
|
onClick: (e) => e.stopPropagation(),
|
|
5937
5985
|
onKeyDown: (e) => e.stopPropagation(),
|
|
5938
5986
|
children: [
|
|
5939
|
-
/* @__PURE__ */
|
|
5940
|
-
/* @__PURE__ */
|
|
5941
|
-
/* @__PURE__ */
|
|
5942
|
-
url && /* @__PURE__ */
|
|
5987
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
|
|
5988
|
+
/* @__PURE__ */ jsx22("h3", { id: "attachment-preview-title", className: "truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: filename }),
|
|
5989
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center gap-1", children: [
|
|
5990
|
+
url && /* @__PURE__ */ jsx22(
|
|
5943
5991
|
"a",
|
|
5944
5992
|
{
|
|
5945
5993
|
href: url,
|
|
@@ -5948,22 +5996,22 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
5948
5996
|
rel: "noopener noreferrer",
|
|
5949
5997
|
title: "\u4E0B\u8F7D",
|
|
5950
5998
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
5951
|
-
children: /* @__PURE__ */
|
|
5999
|
+
children: /* @__PURE__ */ jsx22(Download3, { size: 14 })
|
|
5952
6000
|
}
|
|
5953
6001
|
),
|
|
5954
|
-
/* @__PURE__ */
|
|
6002
|
+
/* @__PURE__ */ jsx22(
|
|
5955
6003
|
"button",
|
|
5956
6004
|
{
|
|
5957
6005
|
type: "button",
|
|
5958
6006
|
onClick: () => onOpenChange(false),
|
|
5959
6007
|
title: "\u5173\u95ED",
|
|
5960
6008
|
className: "flex h-7 w-7 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
5961
|
-
children: /* @__PURE__ */
|
|
6009
|
+
children: /* @__PURE__ */ jsx22(X5, { size: 14 })
|
|
5962
6010
|
}
|
|
5963
6011
|
)
|
|
5964
6012
|
] })
|
|
5965
6013
|
] }),
|
|
5966
|
-
/* @__PURE__ */
|
|
6014
|
+
/* @__PURE__ */ jsx22("div", { className: "max-h-[calc(90vh-56px)] overflow-auto px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: renderContent({ mode, url, content, error }) })
|
|
5967
6015
|
]
|
|
5968
6016
|
}
|
|
5969
6017
|
)
|
|
@@ -5978,43 +6026,43 @@ function renderContent({
|
|
|
5978
6026
|
error
|
|
5979
6027
|
}) {
|
|
5980
6028
|
if (!url) {
|
|
5981
|
-
return /* @__PURE__ */
|
|
6029
|
+
return /* @__PURE__ */ jsx22("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6B64\u9644\u4EF6\u6682\u65E0\u53EF\u7528\u9884\u89C8\u5730\u5740\u3002" });
|
|
5982
6030
|
}
|
|
5983
6031
|
if (mode === "default") {
|
|
5984
|
-
return /* @__PURE__ */
|
|
6032
|
+
return /* @__PURE__ */ jsxs18("p", { className: "text-[hsl(var(--muted-foreground))]", children: [
|
|
5985
6033
|
"\u6B64\u7C7B\u578B\u6682\u4E0D\u652F\u6301\u5185\u5D4C\u9884\u89C8\u3002\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2",
|
|
5986
|
-
/* @__PURE__ */
|
|
6034
|
+
/* @__PURE__ */ jsx22("span", { className: "mx-1 font-medium text-[hsl(var(--foreground))]", children: "\u4E0B\u8F7D" }),
|
|
5987
6035
|
"\u6309\u94AE\u67E5\u770B\u3002"
|
|
5988
6036
|
] });
|
|
5989
6037
|
}
|
|
5990
6038
|
if (error) {
|
|
5991
|
-
return /* @__PURE__ */
|
|
6039
|
+
return /* @__PURE__ */ jsxs18("p", { className: "text-[hsl(var(--destructive))]", children: [
|
|
5992
6040
|
"\u52A0\u8F7D\u5931\u8D25\uFF1A",
|
|
5993
6041
|
String(error?.message ?? error)
|
|
5994
6042
|
] });
|
|
5995
6043
|
}
|
|
5996
6044
|
if (content == null) {
|
|
5997
|
-
return /* @__PURE__ */
|
|
6045
|
+
return /* @__PURE__ */ jsx22("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u52A0\u8F7D\u4E2D\u2026" });
|
|
5998
6046
|
}
|
|
5999
6047
|
if (mode === "markdown") {
|
|
6000
|
-
return /* @__PURE__ */
|
|
6048
|
+
return /* @__PURE__ */ jsx22(MarkdownContent, { className: "prose prose-sm prose-invert max-w-none", children: content });
|
|
6001
6049
|
}
|
|
6002
|
-
return /* @__PURE__ */
|
|
6050
|
+
return /* @__PURE__ */ jsx22("pre", { className: "whitespace-pre-wrap font-mono text-xs leading-relaxed", children: content });
|
|
6003
6051
|
}
|
|
6004
6052
|
|
|
6005
6053
|
// src/react/components/chat/MessageContextPills.tsx
|
|
6006
6054
|
import { Bookmark } from "lucide-react";
|
|
6007
|
-
import { jsx as
|
|
6055
|
+
import { jsx as jsx23, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
6008
6056
|
function MessageContextPills({ contexts }) {
|
|
6009
6057
|
if (contexts.length === 0) return null;
|
|
6010
|
-
return /* @__PURE__ */
|
|
6058
|
+
return /* @__PURE__ */ jsx23("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index) => /* @__PURE__ */ jsxs19(
|
|
6011
6059
|
"div",
|
|
6012
6060
|
{
|
|
6013
6061
|
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)]",
|
|
6014
6062
|
title: ctx.content,
|
|
6015
6063
|
children: [
|
|
6016
|
-
/* @__PURE__ */
|
|
6017
|
-
/* @__PURE__ */
|
|
6064
|
+
/* @__PURE__ */ jsx23(Bookmark, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.65)]" }),
|
|
6065
|
+
/* @__PURE__ */ jsx23("span", { className: "max-w-56 truncate", children: ctx.label })
|
|
6018
6066
|
]
|
|
6019
6067
|
},
|
|
6020
6068
|
`${ctx.label}:${index}`
|
|
@@ -6023,7 +6071,7 @@ function MessageContextPills({ contexts }) {
|
|
|
6023
6071
|
|
|
6024
6072
|
// src/react/components/chat/MessageFileAttachmentList.tsx
|
|
6025
6073
|
import { Archive as Archive2, File as File3, FileCode2 as FileCode22, FileText as FileText4, Film as Film2, Music as Music2 } from "lucide-react";
|
|
6026
|
-
import { Fragment as Fragment6, jsx as
|
|
6074
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
6027
6075
|
function getFileIcon(fileName) {
|
|
6028
6076
|
const lowerName = fileName.toLowerCase();
|
|
6029
6077
|
if (/\.(zip|rar|7z|tar|gz|bz2|xz)$/.test(lowerName)) {
|
|
@@ -6052,15 +6100,15 @@ function MessageFileAttachmentList({
|
|
|
6052
6100
|
return null;
|
|
6053
6101
|
}
|
|
6054
6102
|
const pillClass = "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-2.5 py-1 text-[11px] text-[hsl(var(--foreground))]";
|
|
6055
|
-
return /* @__PURE__ */
|
|
6103
|
+
return /* @__PURE__ */ jsx24("div", { className: cn("flex flex-wrap gap-1.5", className), children: files.map((file) => {
|
|
6056
6104
|
const Icon = getFileIcon(file.name);
|
|
6057
6105
|
const key = `${file.name}-${file.data.slice(0, 32)}`;
|
|
6058
|
-
const content = /* @__PURE__ */
|
|
6059
|
-
/* @__PURE__ */
|
|
6060
|
-
/* @__PURE__ */
|
|
6106
|
+
const content = /* @__PURE__ */ jsxs20(Fragment6, { children: [
|
|
6107
|
+
/* @__PURE__ */ jsx24(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
6108
|
+
/* @__PURE__ */ jsx24("span", { className: "max-w-32 truncate", children: file.name })
|
|
6061
6109
|
] });
|
|
6062
6110
|
if (onPreview) {
|
|
6063
|
-
return /* @__PURE__ */
|
|
6111
|
+
return /* @__PURE__ */ jsx24(
|
|
6064
6112
|
"button",
|
|
6065
6113
|
{
|
|
6066
6114
|
type: "button",
|
|
@@ -6072,14 +6120,14 @@ function MessageFileAttachmentList({
|
|
|
6072
6120
|
key
|
|
6073
6121
|
);
|
|
6074
6122
|
}
|
|
6075
|
-
return /* @__PURE__ */
|
|
6123
|
+
return /* @__PURE__ */ jsx24("div", { className: pillClass, title: file.name, children: content }, key);
|
|
6076
6124
|
}) });
|
|
6077
6125
|
}
|
|
6078
6126
|
|
|
6079
6127
|
// src/react/components/chat/MessageActions.tsx
|
|
6080
6128
|
import { Check as Check2, Copy } from "lucide-react";
|
|
6081
6129
|
import { useState as useState15 } from "react";
|
|
6082
|
-
import { jsx as
|
|
6130
|
+
import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
6083
6131
|
function MessageActions({ content, className }) {
|
|
6084
6132
|
const [copied, setCopied] = useState15(false);
|
|
6085
6133
|
const handleCopy = async () => {
|
|
@@ -6089,7 +6137,7 @@ function MessageActions({ content, className }) {
|
|
|
6089
6137
|
setTimeout(() => setCopied(false), 2e3);
|
|
6090
6138
|
}
|
|
6091
6139
|
};
|
|
6092
|
-
return /* @__PURE__ */
|
|
6140
|
+
return /* @__PURE__ */ jsx25("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */ jsxs21(
|
|
6093
6141
|
"button",
|
|
6094
6142
|
{
|
|
6095
6143
|
type: "button",
|
|
@@ -6099,8 +6147,8 @@ function MessageActions({ content, className }) {
|
|
|
6099
6147
|
copied ? "text-[hsl(var(--primary))]" : "text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] hover:bg-[hsl(var(--accent))]"
|
|
6100
6148
|
),
|
|
6101
6149
|
children: [
|
|
6102
|
-
copied ? /* @__PURE__ */
|
|
6103
|
-
/* @__PURE__ */
|
|
6150
|
+
copied ? /* @__PURE__ */ jsx25(Check2, { size: 12 }) : /* @__PURE__ */ jsx25(Copy, { size: 12 }),
|
|
6151
|
+
/* @__PURE__ */ jsx25("span", { children: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236" })
|
|
6104
6152
|
]
|
|
6105
6153
|
}
|
|
6106
6154
|
) });
|
|
@@ -6108,7 +6156,7 @@ function MessageActions({ content, className }) {
|
|
|
6108
6156
|
|
|
6109
6157
|
// src/react/components/chat/TextAttachmentPills.tsx
|
|
6110
6158
|
import { Archive as Archive3, File as File4, FileCode2 as FileCode23, FileText as FileText5, Film as Film3, Music as Music3, FileSpreadsheet, Image } from "lucide-react";
|
|
6111
|
-
import { Fragment as Fragment7, jsx as
|
|
6159
|
+
import { Fragment as Fragment7, jsx as jsx26, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
6112
6160
|
function getFileIcon2(fileName) {
|
|
6113
6161
|
const lower2 = fileName.toLowerCase();
|
|
6114
6162
|
if (/\.(zip|rar|7z|tar|gz)$/.test(lower2)) return Archive3;
|
|
@@ -6123,15 +6171,15 @@ function getFileIcon2(fileName) {
|
|
|
6123
6171
|
function TextAttachmentPills({ attachments, onPreview }) {
|
|
6124
6172
|
if (attachments.length === 0) return null;
|
|
6125
6173
|
const pillClass = "flex shrink-0 items-center gap-1.5 rounded-full border border-[hsl(var(--primary)/0.2)] bg-[hsl(var(--primary)/0.08)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary)/0.8)]";
|
|
6126
|
-
return /* @__PURE__ */
|
|
6174
|
+
return /* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1.5", children: attachments.map((att, index) => {
|
|
6127
6175
|
const Icon = getFileIcon2(att.name);
|
|
6128
6176
|
const key = `${att.uploadedPath ?? att.name}:${att.name}:${index}`;
|
|
6129
|
-
const content = /* @__PURE__ */
|
|
6130
|
-
/* @__PURE__ */
|
|
6131
|
-
/* @__PURE__ */
|
|
6177
|
+
const content = /* @__PURE__ */ jsxs22(Fragment7, { children: [
|
|
6178
|
+
/* @__PURE__ */ jsx26(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.6)]" }),
|
|
6179
|
+
/* @__PURE__ */ jsx26("span", { className: "max-w-40 truncate", children: att.name })
|
|
6132
6180
|
] });
|
|
6133
6181
|
if (onPreview) {
|
|
6134
|
-
return /* @__PURE__ */
|
|
6182
|
+
return /* @__PURE__ */ jsx26(
|
|
6135
6183
|
"button",
|
|
6136
6184
|
{
|
|
6137
6185
|
type: "button",
|
|
@@ -6143,7 +6191,7 @@ function TextAttachmentPills({ attachments, onPreview }) {
|
|
|
6143
6191
|
key
|
|
6144
6192
|
);
|
|
6145
6193
|
}
|
|
6146
|
-
return /* @__PURE__ */
|
|
6194
|
+
return /* @__PURE__ */ jsx26("div", { className: pillClass, title: att.name, children: content }, key);
|
|
6147
6195
|
}) });
|
|
6148
6196
|
}
|
|
6149
6197
|
|
|
@@ -6152,34 +6200,34 @@ import { RefreshCcw } from "lucide-react";
|
|
|
6152
6200
|
|
|
6153
6201
|
// src/react/components/chat/whatif-quote-context.tsx
|
|
6154
6202
|
import { createContext as createContext3, useContext as useContext3, useMemo as useMemo13 } from "react";
|
|
6155
|
-
import { jsx as
|
|
6203
|
+
import { jsx as jsx27 } from "react/jsx-runtime";
|
|
6156
6204
|
var WhatIfQuoteContext = createContext3({});
|
|
6157
6205
|
function WhatIfQuoteProvider({
|
|
6158
6206
|
onJumpToStep,
|
|
6159
6207
|
children
|
|
6160
6208
|
}) {
|
|
6161
6209
|
const value = useMemo13(() => ({ onJumpToStep }), [onJumpToStep]);
|
|
6162
|
-
return /* @__PURE__ */
|
|
6210
|
+
return /* @__PURE__ */ jsx27(WhatIfQuoteContext.Provider, { value, children });
|
|
6163
6211
|
}
|
|
6164
6212
|
function useWhatIfQuoteContext() {
|
|
6165
6213
|
return useContext3(WhatIfQuoteContext);
|
|
6166
6214
|
}
|
|
6167
6215
|
|
|
6168
6216
|
// src/react/components/chat/WhatIfUserBubble.tsx
|
|
6169
|
-
import { jsx as
|
|
6217
|
+
import { jsx as jsx28, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
6170
6218
|
function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
6171
6219
|
const { onJumpToStep } = useWhatIfQuoteContext();
|
|
6172
6220
|
const handleQuoteClick = onQuoteClick ?? onJumpToStep;
|
|
6173
6221
|
const { fromStep, quotes, userText } = parsed;
|
|
6174
|
-
return /* @__PURE__ */
|
|
6175
|
-
/* @__PURE__ */
|
|
6176
|
-
/* @__PURE__ */
|
|
6177
|
-
/* @__PURE__ */
|
|
6222
|
+
return /* @__PURE__ */ jsxs23("div", { className: "flex flex-col items-end gap-2", children: [
|
|
6223
|
+
/* @__PURE__ */ jsxs23("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: [
|
|
6224
|
+
/* @__PURE__ */ jsx28(RefreshCcw, { size: 10 }),
|
|
6225
|
+
/* @__PURE__ */ jsx28("span", { children: fromStep != null ? `\u91CD\u8DD1\u81EA step ${fromStep}` : "\u91CD\u8DD1" })
|
|
6178
6226
|
] }),
|
|
6179
|
-
quotes.length > 0 && /* @__PURE__ */
|
|
6227
|
+
quotes.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex flex-wrap justify-end gap-1.5", children: quotes.map((q, i) => {
|
|
6180
6228
|
const clickable = q.stepNumber != null && !!handleQuoteClick;
|
|
6181
6229
|
const label = q.stepNumber != null ? `\u6B65\u9AA4${q.stepNumber} \xB7 ${q.label}` : q.label;
|
|
6182
|
-
return /* @__PURE__ */
|
|
6230
|
+
return /* @__PURE__ */ jsxs23(
|
|
6183
6231
|
"button",
|
|
6184
6232
|
{
|
|
6185
6233
|
type: "button",
|
|
@@ -6188,14 +6236,14 @@ function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
|
6188
6236
|
className: "inline-flex items-center gap-1 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-2.5 py-0.5 text-[11px] text-[hsl(var(--muted-foreground))] transition-colors hover:border-[hsl(var(--ring)/0.5)] hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] disabled:cursor-default disabled:hover:border-[hsl(var(--border))] disabled:hover:bg-[hsl(var(--card))]",
|
|
6189
6237
|
title: clickable ? "\u8DF3\u8F6C\u5230\u5BF9\u5E94\u6B65\u9AA4\u5361\u7247" : void 0,
|
|
6190
6238
|
children: [
|
|
6191
|
-
/* @__PURE__ */
|
|
6192
|
-
/* @__PURE__ */
|
|
6239
|
+
/* @__PURE__ */ jsx28("span", { children: "\u21B3" }),
|
|
6240
|
+
/* @__PURE__ */ jsx28("span", { className: "max-w-[14rem] truncate", children: label })
|
|
6193
6241
|
]
|
|
6194
6242
|
},
|
|
6195
6243
|
`${q.stepNumber ?? "x"}-${i}`
|
|
6196
6244
|
);
|
|
6197
6245
|
}) }),
|
|
6198
|
-
userText && /* @__PURE__ */
|
|
6246
|
+
userText && /* @__PURE__ */ jsx28("div", { className: "rounded-2xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-sm leading-relaxed text-[hsl(var(--user-msg-fg))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]", children: /* @__PURE__ */ jsx28(
|
|
6199
6247
|
MarkdownContent,
|
|
6200
6248
|
{
|
|
6201
6249
|
className: "prose prose-sm prose-invert max-w-none [&_li>p]:inline [&_p]:mb-3 [&_p:last-child]:mb-0",
|
|
@@ -6207,7 +6255,7 @@ function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
|
6207
6255
|
}
|
|
6208
6256
|
|
|
6209
6257
|
// src/react/components/chat/UserMessageBubble.tsx
|
|
6210
|
-
import { jsx as
|
|
6258
|
+
import { jsx as jsx29, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
6211
6259
|
function isUserMessage(message) {
|
|
6212
6260
|
return message.role === "user";
|
|
6213
6261
|
}
|
|
@@ -6236,9 +6284,9 @@ function UserMessageBubble({ message, className }) {
|
|
|
6236
6284
|
const trimmedClean = cleanText.trim();
|
|
6237
6285
|
const whatifParsed = trimmedClean && imageParts.length === 0 && fileParts.length === 0 && textAttachments.length === 0 ? parseWhatIfPrompt(cleanText) : null;
|
|
6238
6286
|
if (whatifParsed) {
|
|
6239
|
-
return /* @__PURE__ */
|
|
6240
|
-
/* @__PURE__ */
|
|
6241
|
-
whatifParsed.userText && /* @__PURE__ */
|
|
6287
|
+
return /* @__PURE__ */ jsx29("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs24("div", { className: "group flex max-w-[72%] flex-col items-end gap-2", children: [
|
|
6288
|
+
/* @__PURE__ */ jsx29(WhatIfUserBubble, { parsed: whatifParsed }),
|
|
6289
|
+
whatifParsed.userText && /* @__PURE__ */ jsx29(
|
|
6242
6290
|
MessageActions,
|
|
6243
6291
|
{
|
|
6244
6292
|
content: whatifParsed.userText,
|
|
@@ -6310,16 +6358,16 @@ function UserMessageBubble({ message, className }) {
|
|
|
6310
6358
|
const mode = kind === "text" ? lower2.endsWith(".md") ? "markdown" : "text" : "default";
|
|
6311
6359
|
setPreview({ filename: attachment.name, url, mode });
|
|
6312
6360
|
};
|
|
6313
|
-
return /* @__PURE__ */
|
|
6314
|
-
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */
|
|
6315
|
-
imageParts.map((part, idx) => /* @__PURE__ */
|
|
6361
|
+
return /* @__PURE__ */ jsx29("div", { className: cn("flex justify-end", className), children: /* @__PURE__ */ jsxs24("div", { className: "group flex max-w-[72%] flex-col items-end gap-3", children: [
|
|
6362
|
+
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */ jsxs24("div", { className: "grid gap-2", children: [
|
|
6363
|
+
imageParts.map((part, idx) => /* @__PURE__ */ jsx29(
|
|
6316
6364
|
"button",
|
|
6317
6365
|
{
|
|
6318
6366
|
type: "button",
|
|
6319
6367
|
onClick: () => setLightboxIndex(idx),
|
|
6320
6368
|
className: "cursor-zoom-in",
|
|
6321
6369
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
6322
|
-
children: /* @__PURE__ */
|
|
6370
|
+
children: /* @__PURE__ */ jsx29(
|
|
6323
6371
|
"img",
|
|
6324
6372
|
{
|
|
6325
6373
|
src: part.image_url.url,
|
|
@@ -6332,14 +6380,14 @@ function UserMessageBubble({ message, className }) {
|
|
|
6332
6380
|
)),
|
|
6333
6381
|
imageTextAttachmentMeta.map((att, idx) => {
|
|
6334
6382
|
const blobUrl = imageAttachmentQueries[idx]?.data;
|
|
6335
|
-
return blobUrl ? /* @__PURE__ */
|
|
6383
|
+
return blobUrl ? /* @__PURE__ */ jsx29(
|
|
6336
6384
|
"button",
|
|
6337
6385
|
{
|
|
6338
6386
|
type: "button",
|
|
6339
6387
|
onClick: () => setLightboxIndex(imageParts.length + idx),
|
|
6340
6388
|
className: "cursor-zoom-in",
|
|
6341
6389
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
6342
|
-
children: /* @__PURE__ */
|
|
6390
|
+
children: /* @__PURE__ */ jsx29(
|
|
6343
6391
|
"img",
|
|
6344
6392
|
{
|
|
6345
6393
|
src: blobUrl,
|
|
@@ -6349,7 +6397,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
6349
6397
|
)
|
|
6350
6398
|
},
|
|
6351
6399
|
`${att.uploadedPath}:${att.name}`
|
|
6352
|
-
) : imageAttachmentQueries[idx]?.isError ? null : /* @__PURE__ */
|
|
6400
|
+
) : imageAttachmentQueries[idx]?.isError ? null : /* @__PURE__ */ jsx29(
|
|
6353
6401
|
"div",
|
|
6354
6402
|
{
|
|
6355
6403
|
className: "flex h-20 items-center justify-center rounded-xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--muted)/0.3)] text-xs text-[hsl(var(--muted-foreground))]",
|
|
@@ -6359,7 +6407,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
6359
6407
|
);
|
|
6360
6408
|
})
|
|
6361
6409
|
] }),
|
|
6362
|
-
lightboxImages.length > 0 && /* @__PURE__ */
|
|
6410
|
+
lightboxImages.length > 0 && /* @__PURE__ */ jsx29(
|
|
6363
6411
|
ImageLightbox,
|
|
6364
6412
|
{
|
|
6365
6413
|
open: lightboxIndex != null,
|
|
@@ -6370,15 +6418,15 @@ function UserMessageBubble({ message, className }) {
|
|
|
6370
6418
|
initialIndex: lightboxIndex ?? 0
|
|
6371
6419
|
}
|
|
6372
6420
|
),
|
|
6373
|
-
/* @__PURE__ */
|
|
6374
|
-
/* @__PURE__ */
|
|
6421
|
+
/* @__PURE__ */ jsx29(MessageFileAttachmentList, { files: fileParts }),
|
|
6422
|
+
/* @__PURE__ */ jsx29(
|
|
6375
6423
|
TextAttachmentPills,
|
|
6376
6424
|
{
|
|
6377
6425
|
attachments: nonImageTextAttachments,
|
|
6378
6426
|
onPreview: handleTextAttachmentPreview
|
|
6379
6427
|
}
|
|
6380
6428
|
),
|
|
6381
|
-
preview && /* @__PURE__ */
|
|
6429
|
+
preview && /* @__PURE__ */ jsx29(
|
|
6382
6430
|
AttachmentPreviewDialog,
|
|
6383
6431
|
{
|
|
6384
6432
|
open: preview != null,
|
|
@@ -6390,8 +6438,8 @@ function UserMessageBubble({ message, className }) {
|
|
|
6390
6438
|
mode: preview.mode
|
|
6391
6439
|
}
|
|
6392
6440
|
),
|
|
6393
|
-
/* @__PURE__ */
|
|
6394
|
-
trimmedClean && /* @__PURE__ */
|
|
6441
|
+
/* @__PURE__ */ jsx29(MessageContextPills, { contexts: textContexts }),
|
|
6442
|
+
trimmedClean && /* @__PURE__ */ jsx29("div", { className: "rounded-2xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-sm leading-relaxed text-[hsl(var(--user-msg-fg))] shadow-[inset_0_1px_0_rgba(255,255,255,0.04)]", children: /* @__PURE__ */ jsx29(
|
|
6395
6443
|
MarkdownContent,
|
|
6396
6444
|
{
|
|
6397
6445
|
className: USER_MESSAGE_MARKDOWN_CLASS,
|
|
@@ -6399,7 +6447,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
6399
6447
|
children: cleanText
|
|
6400
6448
|
}
|
|
6401
6449
|
) }),
|
|
6402
|
-
trimmedClean && /* @__PURE__ */
|
|
6450
|
+
trimmedClean && /* @__PURE__ */ jsx29(
|
|
6403
6451
|
MessageActions,
|
|
6404
6452
|
{
|
|
6405
6453
|
content: cleanText,
|
|
@@ -6414,14 +6462,14 @@ function ErrorMessageBlock({
|
|
|
6414
6462
|
}) {
|
|
6415
6463
|
const text = getTextContent(message.content);
|
|
6416
6464
|
const looksLikeModelUnavailable = /no source matches this model|404/i.test(text);
|
|
6417
|
-
return /* @__PURE__ */
|
|
6465
|
+
return /* @__PURE__ */ jsx29("div", { className: cn("flex justify-center", className), children: /* @__PURE__ */ jsxs24("div", { className: "max-w-[85%] border-l-[3px] border-[hsl(var(--destructive))] px-4 py-1 text-sm leading-7 text-[hsl(var(--destructive))]", children: [
|
|
6418
6466
|
text,
|
|
6419
|
-
looksLikeModelUnavailable ? /* @__PURE__ */
|
|
6467
|
+
looksLikeModelUnavailable ? /* @__PURE__ */ jsx29("div", { className: "mt-1 opacity-80", children: "\u6A21\u578B\u53EF\u80FD\u672A\u542F\u52A8\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5\u3002" }) : null
|
|
6420
6468
|
] }) });
|
|
6421
6469
|
}
|
|
6422
6470
|
|
|
6423
6471
|
// src/react/components/chat/AgentLoopBlock.tsx
|
|
6424
|
-
import { Fragment as Fragment8, jsx as
|
|
6472
|
+
import { Fragment as Fragment8, jsx as jsx30, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
6425
6473
|
var EMPTY_MESSAGES2 = [];
|
|
6426
6474
|
var EMPTY_AGENT_LOOPS = {};
|
|
6427
6475
|
var COLLAPSED_SUMMARY_HIDDEN_TOOLS = /* @__PURE__ */ new Set(["ReadSkill", "Read"]);
|
|
@@ -6521,7 +6569,7 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6521
6569
|
const description = safeParseDescription(toolCall.arguments);
|
|
6522
6570
|
const status = hasAwaitingAnswer || toolCall.status === "awaiting_answer" ? "awaiting_answer" : toolCall.status === "pending" || loopEntry?.info.status === "running" ? "running" : "done";
|
|
6523
6571
|
const cardStyles = getLoopCardStyles(status);
|
|
6524
|
-
return /* @__PURE__ */
|
|
6572
|
+
return /* @__PURE__ */ jsxs25(
|
|
6525
6573
|
"div",
|
|
6526
6574
|
{
|
|
6527
6575
|
className: cn(
|
|
@@ -6529,8 +6577,8 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6529
6577
|
cardStyles.borderClass
|
|
6530
6578
|
),
|
|
6531
6579
|
children: [
|
|
6532
|
-
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */
|
|
6533
|
-
/* @__PURE__ */
|
|
6580
|
+
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
6581
|
+
/* @__PURE__ */ jsxs25(
|
|
6534
6582
|
"div",
|
|
6535
6583
|
{
|
|
6536
6584
|
className: cn(
|
|
@@ -6538,24 +6586,24 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6538
6586
|
cardStyles.headerClass
|
|
6539
6587
|
),
|
|
6540
6588
|
children: [
|
|
6541
|
-
/* @__PURE__ */
|
|
6589
|
+
/* @__PURE__ */ jsx30(
|
|
6542
6590
|
"button",
|
|
6543
6591
|
{
|
|
6544
6592
|
type: "button",
|
|
6545
6593
|
onClick: toggleExpanded,
|
|
6546
6594
|
"aria-expanded": expanded,
|
|
6547
6595
|
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",
|
|
6548
|
-
children: /* @__PURE__ */
|
|
6549
|
-
status === "awaiting_answer" ? /* @__PURE__ */
|
|
6550
|
-
/* @__PURE__ */
|
|
6596
|
+
children: /* @__PURE__ */ jsxs25("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
6597
|
+
status === "awaiting_answer" ? /* @__PURE__ */ jsx30(MessageSquareMore2, { size: 14, className: "shrink-0 text-amber-500" }) : /* @__PURE__ */ jsx30(Bot, { size: 14, className: "shrink-0 text-blue-500" }),
|
|
6598
|
+
/* @__PURE__ */ jsxs25("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: [
|
|
6551
6599
|
description,
|
|
6552
6600
|
status === "awaiting_answer" ? " \u2014 \u7B49\u5F85\u56DE\u7B54" : ""
|
|
6553
6601
|
] })
|
|
6554
6602
|
] })
|
|
6555
6603
|
}
|
|
6556
6604
|
),
|
|
6557
|
-
reasoning ? /* @__PURE__ */
|
|
6558
|
-
/* @__PURE__ */
|
|
6605
|
+
reasoning ? /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
6606
|
+
/* @__PURE__ */ jsx30(
|
|
6559
6607
|
Bot,
|
|
6560
6608
|
{
|
|
6561
6609
|
size: 13,
|
|
@@ -6563,14 +6611,14 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6563
6611
|
"aria-label": "\u5B50\u667A\u80FD\u4F53"
|
|
6564
6612
|
}
|
|
6565
6613
|
),
|
|
6566
|
-
/* @__PURE__ */
|
|
6614
|
+
/* @__PURE__ */ jsx30(
|
|
6567
6615
|
"button",
|
|
6568
6616
|
{
|
|
6569
6617
|
type: "button",
|
|
6570
6618
|
onClick: toggleExpanded,
|
|
6571
6619
|
"aria-expanded": expanded,
|
|
6572
6620
|
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--muted))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
6573
|
-
children: /* @__PURE__ */
|
|
6621
|
+
children: /* @__PURE__ */ jsx30(
|
|
6574
6622
|
ChevronRight4,
|
|
6575
6623
|
{
|
|
6576
6624
|
size: 14,
|
|
@@ -6585,7 +6633,7 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6585
6633
|
]
|
|
6586
6634
|
}
|
|
6587
6635
|
),
|
|
6588
|
-
!expanded ? /* @__PURE__ */
|
|
6636
|
+
!expanded ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-1 py-2", children: visibleLoopToolCalls.length > 0 ? visibleLoopToolCalls.map((childToolCall) => /* @__PURE__ */ jsx30(
|
|
6589
6637
|
ToolCallBlock,
|
|
6590
6638
|
{
|
|
6591
6639
|
toolCall: childToolCall,
|
|
@@ -6593,12 +6641,12 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6593
6641
|
level: 2
|
|
6594
6642
|
},
|
|
6595
6643
|
childToolCall.id
|
|
6596
|
-
)) : /* @__PURE__ */
|
|
6597
|
-
/* @__PURE__ */
|
|
6598
|
-
/* @__PURE__ */
|
|
6599
|
-
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */
|
|
6600
|
-
] }) : /* @__PURE__ */
|
|
6601
|
-
/* @__PURE__ */
|
|
6644
|
+
)) : /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-2 px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
6645
|
+
/* @__PURE__ */ jsx30(Loader24, { size: 12, className: "shrink-0 animate-spin text-blue-500" }),
|
|
6646
|
+
/* @__PURE__ */ jsx30("span", { children: "\u6B63\u5728\u542F\u52A8..." })
|
|
6647
|
+
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-1 py-2", children: /* @__PURE__ */ jsx30("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
|
|
6648
|
+
] }) : /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
6649
|
+
/* @__PURE__ */ jsxs25(
|
|
6602
6650
|
"div",
|
|
6603
6651
|
{
|
|
6604
6652
|
className: cn(
|
|
@@ -6606,21 +6654,21 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6606
6654
|
cardStyles.headerClass
|
|
6607
6655
|
),
|
|
6608
6656
|
children: [
|
|
6609
|
-
/* @__PURE__ */
|
|
6657
|
+
/* @__PURE__ */ jsx30(
|
|
6610
6658
|
"button",
|
|
6611
6659
|
{
|
|
6612
6660
|
type: "button",
|
|
6613
6661
|
onClick: toggleExpanded,
|
|
6614
6662
|
"aria-expanded": expanded,
|
|
6615
6663
|
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",
|
|
6616
|
-
children: /* @__PURE__ */
|
|
6617
|
-
/* @__PURE__ */
|
|
6618
|
-
/* @__PURE__ */
|
|
6664
|
+
children: /* @__PURE__ */ jsxs25("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
6665
|
+
/* @__PURE__ */ jsx30(Check3, { size: 14, className: "shrink-0 text-emerald-500" }),
|
|
6666
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: description })
|
|
6619
6667
|
] })
|
|
6620
6668
|
}
|
|
6621
6669
|
),
|
|
6622
|
-
reasoning ? /* @__PURE__ */
|
|
6623
|
-
/* @__PURE__ */
|
|
6670
|
+
reasoning ? /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
6671
|
+
/* @__PURE__ */ jsx30(
|
|
6624
6672
|
Bot,
|
|
6625
6673
|
{
|
|
6626
6674
|
size: 13,
|
|
@@ -6628,14 +6676,14 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6628
6676
|
"aria-label": "\u5B50\u667A\u80FD\u4F53"
|
|
6629
6677
|
}
|
|
6630
6678
|
),
|
|
6631
|
-
/* @__PURE__ */
|
|
6679
|
+
/* @__PURE__ */ jsx30(
|
|
6632
6680
|
"button",
|
|
6633
6681
|
{
|
|
6634
6682
|
type: "button",
|
|
6635
6683
|
onClick: toggleExpanded,
|
|
6636
6684
|
"aria-expanded": expanded,
|
|
6637
6685
|
className: "inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--muted))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
6638
|
-
children: /* @__PURE__ */
|
|
6686
|
+
children: /* @__PURE__ */ jsx30(
|
|
6639
6687
|
ChevronRight4,
|
|
6640
6688
|
{
|
|
6641
6689
|
size: 14,
|
|
@@ -6650,9 +6698,9 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6650
6698
|
]
|
|
6651
6699
|
}
|
|
6652
6700
|
),
|
|
6653
|
-
!expanded ? /* @__PURE__ */
|
|
6654
|
-
/* @__PURE__ */
|
|
6655
|
-
(item) => item.kind === "file" ? /* @__PURE__ */
|
|
6701
|
+
!expanded ? /* @__PURE__ */ jsxs25(Fragment8, { children: [
|
|
6702
|
+
/* @__PURE__ */ jsx30("div", { className: "flex flex-wrap gap-1.5 px-4 py-2", children: completedToolLabels.length > 0 ? completedToolLabels.map(
|
|
6703
|
+
(item) => item.kind === "file" ? /* @__PURE__ */ jsxs25(
|
|
6656
6704
|
"span",
|
|
6657
6705
|
{
|
|
6658
6706
|
className: "inline-flex min-w-0 items-center gap-1 rounded-md border px-2 py-0.5 text-xs font-semibold dark:border-emerald-500/25 dark:bg-emerald-500/10 dark:text-emerald-300",
|
|
@@ -6663,12 +6711,12 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6663
6711
|
},
|
|
6664
6712
|
title: item.label,
|
|
6665
6713
|
children: [
|
|
6666
|
-
/* @__PURE__ */
|
|
6667
|
-
/* @__PURE__ */
|
|
6714
|
+
/* @__PURE__ */ jsx30(FileText6, { size: 12, className: "shrink-0", "aria-hidden": "true" }),
|
|
6715
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate", children: item.label })
|
|
6668
6716
|
]
|
|
6669
6717
|
},
|
|
6670
6718
|
item.key
|
|
6671
|
-
) : /* @__PURE__ */
|
|
6719
|
+
) : /* @__PURE__ */ jsx30(
|
|
6672
6720
|
"span",
|
|
6673
6721
|
{
|
|
6674
6722
|
className: "inline-flex items-center rounded-md border px-2 py-0.5 text-xs font-semibold dark:border-blue-300 dark:bg-blue-400/10 dark:text-blue-300",
|
|
@@ -6681,20 +6729,20 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6681
6729
|
},
|
|
6682
6730
|
item.key
|
|
6683
6731
|
)
|
|
6684
|
-
) : /* @__PURE__ */
|
|
6685
|
-
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */
|
|
6732
|
+
) : /* @__PURE__ */ jsx30("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u5DE5\u5177\u8C03\u7528" }) }),
|
|
6733
|
+
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-2 px-4 pb-3", children: inlineToolUiBlocks.map((block) => /* @__PURE__ */ jsx30(ResourceIframe, { ui: block.ui, sessionId }, block.key)) }) : null
|
|
6686
6734
|
] }) : null
|
|
6687
6735
|
] }),
|
|
6688
|
-
expanded && /* @__PURE__ */
|
|
6736
|
+
expanded && /* @__PURE__ */ jsxs25("div", { className: "border-t border-[hsl(var(--border))] py-2", children: [
|
|
6689
6737
|
(() => {
|
|
6690
6738
|
const taskPrompt = safeParsePrompt(toolCall.arguments);
|
|
6691
|
-
return taskPrompt ? /* @__PURE__ */
|
|
6692
|
-
/* @__PURE__ */
|
|
6693
|
-
/* @__PURE__ */
|
|
6739
|
+
return taskPrompt ? /* @__PURE__ */ jsxs25("details", { className: "mx-3 mb-2 rounded-md bg-[hsl(var(--muted))]/40", children: [
|
|
6740
|
+
/* @__PURE__ */ jsx30("summary", { className: "cursor-pointer px-3 py-1.5 text-[11px] font-medium text-[hsl(var(--muted-foreground))]", children: "\u4EFB\u52A1" }),
|
|
6741
|
+
/* @__PURE__ */ jsx30("div", { className: "px-3 pb-2", children: /* @__PURE__ */ jsx30("pre", { className: "whitespace-pre-wrap text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: taskPrompt }) })
|
|
6694
6742
|
] }) : null;
|
|
6695
6743
|
})(),
|
|
6696
|
-
childMessages.length > 0 ? /* @__PURE__ */
|
|
6697
|
-
(message, index) => message.role === "assistant" ? /* @__PURE__ */
|
|
6744
|
+
childMessages.length > 0 ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-3 px-3", children: childMessages.map(
|
|
6745
|
+
(message, index) => message.role === "assistant" ? /* @__PURE__ */ jsx30(
|
|
6698
6746
|
ExpandedChildAssistantMessage,
|
|
6699
6747
|
{
|
|
6700
6748
|
message,
|
|
@@ -6702,13 +6750,13 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6702
6750
|
isStreaming: message.status === "streaming"
|
|
6703
6751
|
},
|
|
6704
6752
|
message.entry_id ?? `${message.timestamp ?? "child"}-${index}`
|
|
6705
|
-
) : message.role === "user" ? /* @__PURE__ */
|
|
6753
|
+
) : message.role === "user" ? /* @__PURE__ */ jsx30(
|
|
6706
6754
|
ExpandedChildUserMessage,
|
|
6707
6755
|
{
|
|
6708
6756
|
message
|
|
6709
6757
|
},
|
|
6710
6758
|
message.entry_id ?? `${message.timestamp ?? "user"}-${index}`
|
|
6711
|
-
) : message.role === "error" ? /* @__PURE__ */
|
|
6759
|
+
) : message.role === "error" ? /* @__PURE__ */ jsx30(
|
|
6712
6760
|
"div",
|
|
6713
6761
|
{
|
|
6714
6762
|
className: "border-l-[2px] border-l-red-500 px-3 py-2 text-[11px] text-red-200",
|
|
@@ -6716,17 +6764,17 @@ function AgentLoopBlock({ toolCall, sessionId, reasoning }) {
|
|
|
6716
6764
|
},
|
|
6717
6765
|
message.entry_id ?? `${message.timestamp ?? "error"}-${index}`
|
|
6718
6766
|
) : null
|
|
6719
|
-
) }) : status === "running" ? /* @__PURE__ */
|
|
6720
|
-
/* @__PURE__ */
|
|
6767
|
+
) }) : status === "running" ? /* @__PURE__ */ jsxs25("div", { className: "px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
6768
|
+
/* @__PURE__ */ jsx30(Loader24, { size: 12, className: "mr-1.5 inline animate-spin" }),
|
|
6721
6769
|
"\u6B63\u5728\u542F\u52A8..."
|
|
6722
|
-
] }) : toolCall.result ? /* @__PURE__ */
|
|
6770
|
+
] }) : toolCall.result ? /* @__PURE__ */ jsx30("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
|
|
6723
6771
|
] })
|
|
6724
6772
|
]
|
|
6725
6773
|
}
|
|
6726
6774
|
);
|
|
6727
6775
|
}
|
|
6728
6776
|
function ExpandedChildUserMessage({ message }) {
|
|
6729
|
-
return /* @__PURE__ */
|
|
6777
|
+
return /* @__PURE__ */ jsx30("div", { className: "pl-8", children: /* @__PURE__ */ jsx30(UserMessageBubble, { message }) });
|
|
6730
6778
|
}
|
|
6731
6779
|
function ExpandedChildAssistantMessage({
|
|
6732
6780
|
message,
|
|
@@ -6736,12 +6784,12 @@ function ExpandedChildAssistantMessage({
|
|
|
6736
6784
|
const text = typeof message.content === "string" ? message.content.trim() : message.content.filter((part) => part.type === "text").map((part) => part.text).join("").trim();
|
|
6737
6785
|
const toolCalls = message.tool_calls ?? [];
|
|
6738
6786
|
const hasToolCalls = toolCalls.length > 0;
|
|
6739
|
-
return /* @__PURE__ */
|
|
6740
|
-
message.reasoning && /* @__PURE__ */
|
|
6741
|
-
/* @__PURE__ */
|
|
6742
|
-
/* @__PURE__ */
|
|
6787
|
+
return /* @__PURE__ */ jsxs25("div", { className: "flex flex-col gap-2", children: [
|
|
6788
|
+
message.reasoning && /* @__PURE__ */ jsxs25(Reasoning, { isStreaming, children: [
|
|
6789
|
+
/* @__PURE__ */ jsx30(ReasoningTrigger, { wordCount: message.reasoning.length }),
|
|
6790
|
+
/* @__PURE__ */ jsx30(ReasoningContent, { children: message.reasoning })
|
|
6743
6791
|
] }),
|
|
6744
|
-
text ? /* @__PURE__ */
|
|
6792
|
+
text ? /* @__PURE__ */ jsx30(
|
|
6745
6793
|
ChildText,
|
|
6746
6794
|
{
|
|
6747
6795
|
text,
|
|
@@ -6750,9 +6798,9 @@ function ExpandedChildAssistantMessage({
|
|
|
6750
6798
|
reasoning: void 0
|
|
6751
6799
|
}
|
|
6752
6800
|
) : null,
|
|
6753
|
-
!text && isStreaming && /* @__PURE__ */
|
|
6754
|
-
hasToolCalls && /* @__PURE__ */
|
|
6755
|
-
(toolCall) => formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */
|
|
6801
|
+
!text && isStreaming && /* @__PURE__ */ jsx30("span", { className: "pl-8 text-[12px] text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u751F\u6210..." }),
|
|
6802
|
+
hasToolCalls && /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-2", children: toolCalls.map(
|
|
6803
|
+
(toolCall) => formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx30(
|
|
6756
6804
|
AgentLoopBlock,
|
|
6757
6805
|
{
|
|
6758
6806
|
toolCall,
|
|
@@ -6760,7 +6808,7 @@ function ExpandedChildAssistantMessage({
|
|
|
6760
6808
|
reasoning: void 0
|
|
6761
6809
|
},
|
|
6762
6810
|
toolCall.id
|
|
6763
|
-
) : /* @__PURE__ */
|
|
6811
|
+
) : /* @__PURE__ */ jsx30(
|
|
6764
6812
|
ToolCallBlock,
|
|
6765
6813
|
{
|
|
6766
6814
|
toolCall,
|
|
@@ -6772,8 +6820,8 @@ function ExpandedChildAssistantMessage({
|
|
|
6772
6820
|
toolCall.id
|
|
6773
6821
|
)
|
|
6774
6822
|
) }),
|
|
6775
|
-
message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */
|
|
6776
|
-
(block, index) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */
|
|
6823
|
+
message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-2", children: message.blocks.map(
|
|
6824
|
+
(block, index) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */ jsx30("div", { className: "ml-4", children: /* @__PURE__ */ jsx30(ResourceIframe, { ui: block.content, sessionId }) }, `${block.tool_call_id}-${index}`) : null
|
|
6777
6825
|
) }) : null
|
|
6778
6826
|
] });
|
|
6779
6827
|
}
|
|
@@ -6783,8 +6831,8 @@ function ChildText({
|
|
|
6783
6831
|
sessionId,
|
|
6784
6832
|
reasoning
|
|
6785
6833
|
}) {
|
|
6786
|
-
return /* @__PURE__ */
|
|
6787
|
-
/* @__PURE__ */
|
|
6834
|
+
return /* @__PURE__ */ jsxs25("div", { className: "pl-8 text-[12px] leading-6 text-[hsl(var(--foreground))]", children: [
|
|
6835
|
+
/* @__PURE__ */ jsx30(
|
|
6788
6836
|
MarkdownContent,
|
|
6789
6837
|
{
|
|
6790
6838
|
mode: "streaming",
|
|
@@ -6794,8 +6842,8 @@ function ChildText({
|
|
|
6794
6842
|
children: text
|
|
6795
6843
|
}
|
|
6796
6844
|
),
|
|
6797
|
-
isStreaming && /* @__PURE__ */
|
|
6798
|
-
reasoning ? /* @__PURE__ */
|
|
6845
|
+
isStreaming && /* @__PURE__ */ jsx30("span", { className: "ml-0.5 inline-block h-[1em] w-[3px] animate-pulse rounded-sm bg-current opacity-60" }),
|
|
6846
|
+
reasoning ? /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning }) : null
|
|
6799
6847
|
] });
|
|
6800
6848
|
}
|
|
6801
6849
|
function getLoopCardStyles(status) {
|
|
@@ -6835,7 +6883,7 @@ function getLoopCardStyles(status) {
|
|
|
6835
6883
|
}
|
|
6836
6884
|
|
|
6837
6885
|
// src/react/components/chat/AssistantTurnBlock.tsx
|
|
6838
|
-
import { jsx as
|
|
6886
|
+
import { jsx as jsx31, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
6839
6887
|
var EMPTY_MESSAGES3 = [];
|
|
6840
6888
|
var EMPTY_AGENT_LOOPS2 = {};
|
|
6841
6889
|
function defaultTurnDisplayMode({
|
|
@@ -7003,7 +7051,7 @@ function AssistantTurnBlockBase({
|
|
|
7003
7051
|
const hasInterruptedState = messages.some((message) => message.status === "interrupted");
|
|
7004
7052
|
const effectiveMode = resolveTurnDisplayMode({ isStreaming, displayMode });
|
|
7005
7053
|
const memoryRefs = Array.isArray(messages[0]?.memory_refs) ? messages[0].memory_refs : [];
|
|
7006
|
-
return /* @__PURE__ */
|
|
7054
|
+
return /* @__PURE__ */ jsxs26(
|
|
7007
7055
|
"div",
|
|
7008
7056
|
{
|
|
7009
7057
|
className: cn(
|
|
@@ -7012,17 +7060,17 @@ function AssistantTurnBlockBase({
|
|
|
7012
7060
|
customization?.classNames?.assistantTurn
|
|
7013
7061
|
),
|
|
7014
7062
|
children: [
|
|
7015
|
-
memoryRefs.length > 0 && /* @__PURE__ */
|
|
7016
|
-
hasInterruptedState && /* @__PURE__ */
|
|
7017
|
-
!isStreaming && /* @__PURE__ */
|
|
7063
|
+
memoryRefs.length > 0 && /* @__PURE__ */ jsx31(MemoryRefsHint, { refs: memoryRefs }),
|
|
7064
|
+
hasInterruptedState && /* @__PURE__ */ jsx31("div", { className: "ml-4 w-fit rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }),
|
|
7065
|
+
!isStreaming && /* @__PURE__ */ jsx31("div", { className: "flex justify-end", children: /* @__PURE__ */ jsxs26(
|
|
7018
7066
|
"button",
|
|
7019
7067
|
{
|
|
7020
7068
|
type: "button",
|
|
7021
7069
|
onClick: () => setDisplayMode(displayMode === "detail" ? "compact" : "detail"),
|
|
7022
7070
|
className: "inline-flex shrink-0 items-center gap-1 text-xs text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
7023
7071
|
children: [
|
|
7024
|
-
/* @__PURE__ */
|
|
7025
|
-
/* @__PURE__ */
|
|
7072
|
+
/* @__PURE__ */ jsx31("span", { children: effectiveMode === "detail" ? "\u7CBE\u7B80" : "\u8BE6\u7EC6" }),
|
|
7073
|
+
/* @__PURE__ */ jsx31(
|
|
7026
7074
|
ChevronRight5,
|
|
7027
7075
|
{
|
|
7028
7076
|
size: 18,
|
|
@@ -7032,7 +7080,7 @@ function AssistantTurnBlockBase({
|
|
|
7032
7080
|
]
|
|
7033
7081
|
}
|
|
7034
7082
|
) }),
|
|
7035
|
-
effectiveMode === "detail" ? /* @__PURE__ */
|
|
7083
|
+
effectiveMode === "detail" ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-3", children: /* @__PURE__ */ jsx31(
|
|
7036
7084
|
AssistantMessages,
|
|
7037
7085
|
{
|
|
7038
7086
|
messages,
|
|
@@ -7045,15 +7093,15 @@ function AssistantTurnBlockBase({
|
|
|
7045
7093
|
showToolDetails: true,
|
|
7046
7094
|
customization
|
|
7047
7095
|
}
|
|
7048
|
-
) }) : /* @__PURE__ */
|
|
7049
|
-
resourceBlocks.length > 0 ? /* @__PURE__ */
|
|
7050
|
-
finalMessage ? /* @__PURE__ */
|
|
7096
|
+
) }) : /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-4", children: /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-4", children: [
|
|
7097
|
+
resourceBlocks.length > 0 ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-3", children: resourceBlocks.map((block) => /* @__PURE__ */ jsx31(ResourceIframe, { ui: block.ui, sessionId }, block.key)) }) : null,
|
|
7098
|
+
finalMessage ? /* @__PURE__ */ jsx31(
|
|
7051
7099
|
"div",
|
|
7052
7100
|
{
|
|
7053
7101
|
className: cn(
|
|
7054
7102
|
resourceBlocks.length > 0 && "border-t border-[hsl(var(--border))] pt-4"
|
|
7055
7103
|
),
|
|
7056
|
-
children: /* @__PURE__ */
|
|
7104
|
+
children: /* @__PURE__ */ jsx31(
|
|
7057
7105
|
AssistantMessageContent,
|
|
7058
7106
|
{
|
|
7059
7107
|
message: finalMessage,
|
|
@@ -7064,7 +7112,7 @@ function AssistantTurnBlockBase({
|
|
|
7064
7112
|
}
|
|
7065
7113
|
)
|
|
7066
7114
|
}
|
|
7067
|
-
) : isStreaming ? /* @__PURE__ */
|
|
7115
|
+
) : isStreaming ? /* @__PURE__ */ jsx31("span", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u751F\u6210..." }) : null
|
|
7068
7116
|
] }) })
|
|
7069
7117
|
]
|
|
7070
7118
|
}
|
|
@@ -7093,16 +7141,16 @@ function AssistantMessages({
|
|
|
7093
7141
|
const toolCalls = message.tool_calls ?? [];
|
|
7094
7142
|
const hasToolCalls = toolCalls.length > 0;
|
|
7095
7143
|
const toolRenderItems = groupDetailedToolCalls(toolCalls);
|
|
7096
|
-
return /* @__PURE__ */
|
|
7144
|
+
return /* @__PURE__ */ jsxs26(
|
|
7097
7145
|
"div",
|
|
7098
7146
|
{
|
|
7099
7147
|
className: "flex flex-col gap-3",
|
|
7100
7148
|
children: [
|
|
7101
|
-
hasReasoning && /* @__PURE__ */
|
|
7102
|
-
/* @__PURE__ */
|
|
7103
|
-
/* @__PURE__ */
|
|
7149
|
+
hasReasoning && /* @__PURE__ */ jsxs26(Reasoning, { isStreaming: isStreamingLastMessage, children: [
|
|
7150
|
+
/* @__PURE__ */ jsx31(ReasoningTrigger, { wordCount: reasoning.length }),
|
|
7151
|
+
/* @__PURE__ */ jsx31(ReasoningContent, { children: reasoning })
|
|
7104
7152
|
] }),
|
|
7105
|
-
/* @__PURE__ */
|
|
7153
|
+
/* @__PURE__ */ jsx31(
|
|
7106
7154
|
AssistantMessageContent,
|
|
7107
7155
|
{
|
|
7108
7156
|
message,
|
|
@@ -7112,9 +7160,9 @@ function AssistantMessages({
|
|
|
7112
7160
|
className: customization?.classNames?.assistantText
|
|
7113
7161
|
}
|
|
7114
7162
|
),
|
|
7115
|
-
hasToolCalls && showToolDetails && /* @__PURE__ */
|
|
7163
|
+
hasToolCalls && showToolDetails && /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-2", children: toolRenderItems.map((item) => {
|
|
7116
7164
|
if (item.kind === "read_group") {
|
|
7117
|
-
return /* @__PURE__ */
|
|
7165
|
+
return /* @__PURE__ */ jsx31(
|
|
7118
7166
|
CompactToolGroupBlock,
|
|
7119
7167
|
{
|
|
7120
7168
|
toolCalls: item.toolCalls,
|
|
@@ -7131,7 +7179,7 @@ function AssistantMessages({
|
|
|
7131
7179
|
);
|
|
7132
7180
|
}
|
|
7133
7181
|
const { toolCall } = item;
|
|
7134
|
-
return formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */
|
|
7182
|
+
return formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx31(
|
|
7135
7183
|
AgentLoopBlock,
|
|
7136
7184
|
{
|
|
7137
7185
|
toolCall,
|
|
@@ -7139,7 +7187,7 @@ function AssistantMessages({
|
|
|
7139
7187
|
reasoning: void 0
|
|
7140
7188
|
},
|
|
7141
7189
|
toolCall.id
|
|
7142
|
-
) : customization?.components?.ToolCall ? /* @__PURE__ */
|
|
7190
|
+
) : customization?.components?.ToolCall ? /* @__PURE__ */ jsx31(
|
|
7143
7191
|
customization.components.ToolCall,
|
|
7144
7192
|
{
|
|
7145
7193
|
toolCall,
|
|
@@ -7154,7 +7202,7 @@ function AssistantMessages({
|
|
|
7154
7202
|
customization
|
|
7155
7203
|
},
|
|
7156
7204
|
toolCall.id
|
|
7157
|
-
) : /* @__PURE__ */
|
|
7205
|
+
) : /* @__PURE__ */ jsx31(
|
|
7158
7206
|
ToolCallBlock,
|
|
7159
7207
|
{
|
|
7160
7208
|
toolCall,
|
|
@@ -7171,8 +7219,8 @@ function AssistantMessages({
|
|
|
7171
7219
|
toolCall.id
|
|
7172
7220
|
);
|
|
7173
7221
|
}) }),
|
|
7174
|
-
showToolDetails && message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */
|
|
7175
|
-
(block, blockIndex) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */
|
|
7222
|
+
showToolDetails && message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-2", children: message.blocks.map(
|
|
7223
|
+
(block, blockIndex) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */ jsx31("div", { className: "ml-4", children: /* @__PURE__ */ jsx31(ResourceIframe, { ui: block.content, sessionId }) }, `${block.tool_call_id}-${blockIndex}`) : null
|
|
7176
7224
|
) }) : null
|
|
7177
7225
|
]
|
|
7178
7226
|
},
|
|
@@ -7220,12 +7268,12 @@ function CompactToolGroupBlock({
|
|
|
7220
7268
|
return filePath ? formatFileName(filePath) : "\u672A\u77E5\u6587\u4EF6";
|
|
7221
7269
|
});
|
|
7222
7270
|
const title = `\u8BFB\u53D6 ${toolCalls.length} \u4E2A\u6587\u4EF6`;
|
|
7223
|
-
return /* @__PURE__ */
|
|
7224
|
-
/* @__PURE__ */
|
|
7271
|
+
return /* @__PURE__ */ jsxs26("div", { className: cn(indentClass, "text-xs"), children: [
|
|
7272
|
+
/* @__PURE__ */ jsxs26("div", { className: cn(
|
|
7225
7273
|
"flex items-center gap-2 border-l-[3px] px-3 py-2",
|
|
7226
7274
|
hasError ? "border-l-[hsl(var(--destructive))]" : "border-l-[hsl(var(--primary))]"
|
|
7227
7275
|
), children: [
|
|
7228
|
-
/* @__PURE__ */
|
|
7276
|
+
/* @__PURE__ */ jsxs26(
|
|
7229
7277
|
"button",
|
|
7230
7278
|
{
|
|
7231
7279
|
type: "button",
|
|
@@ -7233,7 +7281,7 @@ function CompactToolGroupBlock({
|
|
|
7233
7281
|
className: "flex min-w-0 shrink-0 items-center gap-2 text-left transition-colors hover:bg-white/3 focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
7234
7282
|
"aria-expanded": expanded,
|
|
7235
7283
|
children: [
|
|
7236
|
-
/* @__PURE__ */
|
|
7284
|
+
/* @__PURE__ */ jsx31(
|
|
7237
7285
|
ChevronRight5,
|
|
7238
7286
|
{
|
|
7239
7287
|
size: 11,
|
|
@@ -7243,18 +7291,18 @@ function CompactToolGroupBlock({
|
|
|
7243
7291
|
)
|
|
7244
7292
|
}
|
|
7245
7293
|
),
|
|
7246
|
-
hasError ? /* @__PURE__ */
|
|
7247
|
-
/* @__PURE__ */
|
|
7248
|
-
/* @__PURE__ */
|
|
7249
|
-
] }) : /* @__PURE__ */
|
|
7250
|
-
/* @__PURE__ */
|
|
7251
|
-
/* @__PURE__ */
|
|
7294
|
+
hasError ? /* @__PURE__ */ jsxs26("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-[hsl(var(--destructive))]", children: [
|
|
7295
|
+
/* @__PURE__ */ jsx31(AlertCircle, { size: 11 }),
|
|
7296
|
+
/* @__PURE__ */ jsx31("span", { children: "\u5931\u8D25" })
|
|
7297
|
+
] }) : /* @__PURE__ */ jsxs26("span", { className: "flex shrink-0 items-center gap-1 text-[10px] text-[hsl(var(--primary))]", children: [
|
|
7298
|
+
/* @__PURE__ */ jsx31(Check4, { size: 11 }),
|
|
7299
|
+
/* @__PURE__ */ jsx31("span", { children: "\u5B8C\u6210" })
|
|
7252
7300
|
] }),
|
|
7253
|
-
/* @__PURE__ */
|
|
7301
|
+
/* @__PURE__ */ jsx31("span", { className: "min-w-0 shrink-0 font-medium text-[hsl(var(--foreground))]", children: title })
|
|
7254
7302
|
]
|
|
7255
7303
|
}
|
|
7256
7304
|
),
|
|
7257
|
-
/* @__PURE__ */
|
|
7305
|
+
/* @__PURE__ */ jsx31("div", { className: "flex min-w-0 flex-1 flex-wrap gap-1.5", children: tags.map((tag, index) => /* @__PURE__ */ jsx31(
|
|
7258
7306
|
"span",
|
|
7259
7307
|
{
|
|
7260
7308
|
className: "max-w-40 truncate rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-1.5 py-0.5 font-mono text-[10px] text-[hsl(var(--muted-foreground))]",
|
|
@@ -7263,12 +7311,12 @@ function CompactToolGroupBlock({
|
|
|
7263
7311
|
},
|
|
7264
7312
|
`${tag}-${index}`
|
|
7265
7313
|
)) }),
|
|
7266
|
-
reasoning ? /* @__PURE__ */
|
|
7267
|
-
totalDurationMs > 0 ? /* @__PURE__ */
|
|
7314
|
+
reasoning ? /* @__PURE__ */ jsx31(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
7315
|
+
totalDurationMs > 0 ? /* @__PURE__ */ jsx31("span", { className: "shrink-0 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: formatToolDuration2(totalDurationMs) }) : null
|
|
7268
7316
|
] }),
|
|
7269
|
-
expanded ? /* @__PURE__ */
|
|
7317
|
+
expanded ? /* @__PURE__ */ jsx31("div", { className: "mt-1 flex flex-col gap-1", children: toolCalls.map((toolCall) => {
|
|
7270
7318
|
const CustomToolCall = customization?.components?.ToolCall;
|
|
7271
|
-
return CustomToolCall ? /* @__PURE__ */
|
|
7319
|
+
return CustomToolCall ? /* @__PURE__ */ jsx31(
|
|
7272
7320
|
CustomToolCall,
|
|
7273
7321
|
{
|
|
7274
7322
|
toolCall,
|
|
@@ -7282,7 +7330,7 @@ function CompactToolGroupBlock({
|
|
|
7282
7330
|
customization
|
|
7283
7331
|
},
|
|
7284
7332
|
toolCall.id
|
|
7285
|
-
) : /* @__PURE__ */
|
|
7333
|
+
) : /* @__PURE__ */ jsx31(
|
|
7286
7334
|
ToolCallBlock,
|
|
7287
7335
|
{
|
|
7288
7336
|
toolCall,
|
|
@@ -7313,8 +7361,8 @@ function AssistantMessageContent({
|
|
|
7313
7361
|
if (!text && imageParts.length === 0 && fileParts.length === 0 && !isStreaming && !reasoning) {
|
|
7314
7362
|
return null;
|
|
7315
7363
|
}
|
|
7316
|
-
return /* @__PURE__ */
|
|
7317
|
-
imageParts.length > 0 && /* @__PURE__ */
|
|
7364
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col gap-3", children: [
|
|
7365
|
+
imageParts.length > 0 && /* @__PURE__ */ jsx31("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx31(
|
|
7318
7366
|
"img",
|
|
7319
7367
|
{
|
|
7320
7368
|
src: part.image_url.url,
|
|
@@ -7323,8 +7371,8 @@ function AssistantMessageContent({
|
|
|
7323
7371
|
},
|
|
7324
7372
|
part.image_url.url
|
|
7325
7373
|
)) }),
|
|
7326
|
-
/* @__PURE__ */
|
|
7327
|
-
text ? /* @__PURE__ */
|
|
7374
|
+
/* @__PURE__ */ jsx31(MessageFileAttachmentList, { files: fileParts }),
|
|
7375
|
+
text ? /* @__PURE__ */ jsx31(
|
|
7328
7376
|
AssistantText,
|
|
7329
7377
|
{
|
|
7330
7378
|
text,
|
|
@@ -7334,8 +7382,8 @@ function AssistantMessageContent({
|
|
|
7334
7382
|
className
|
|
7335
7383
|
}
|
|
7336
7384
|
) : null,
|
|
7337
|
-
!text && isStreaming && /* @__PURE__ */
|
|
7338
|
-
!text && reasoning ? /* @__PURE__ */
|
|
7385
|
+
!text && isStreaming && /* @__PURE__ */ jsx31("span", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u6B63\u5728\u751F\u6210..." }),
|
|
7386
|
+
!text && reasoning ? /* @__PURE__ */ jsx31(ThinkingBadge, { reasoning, variant: "block" }) : null
|
|
7339
7387
|
] });
|
|
7340
7388
|
}
|
|
7341
7389
|
function AssistantText({
|
|
@@ -7355,8 +7403,8 @@ function AssistantText({
|
|
|
7355
7403
|
() => ({ sessionId, messageId, sendMessage }),
|
|
7356
7404
|
[sessionId, messageId, sendMessage]
|
|
7357
7405
|
);
|
|
7358
|
-
return /* @__PURE__ */
|
|
7359
|
-
/* @__PURE__ */
|
|
7406
|
+
return /* @__PURE__ */ jsxs26("div", { className: cn("text-[15px] leading-8 text-[hsl(var(--foreground))]", className), children: [
|
|
7407
|
+
/* @__PURE__ */ jsx31(CardContext.Provider, { value: cardCtx, children: /* @__PURE__ */ jsx31(
|
|
7360
7408
|
MarkdownContent,
|
|
7361
7409
|
{
|
|
7362
7410
|
mode: "streaming",
|
|
@@ -7366,7 +7414,7 @@ function AssistantText({
|
|
|
7366
7414
|
children: text
|
|
7367
7415
|
}
|
|
7368
7416
|
) }),
|
|
7369
|
-
reasoning ? /* @__PURE__ */
|
|
7417
|
+
reasoning ? /* @__PURE__ */ jsx31(ThinkingBadge, { reasoning }) : null
|
|
7370
7418
|
] });
|
|
7371
7419
|
}
|
|
7372
7420
|
function MemoryRefsHint({ refs: rawRefs }) {
|
|
@@ -7374,22 +7422,22 @@ function MemoryRefsHint({ refs: rawRefs }) {
|
|
|
7374
7422
|
const [expanded, setExpanded] = useState18(false);
|
|
7375
7423
|
const hasSkill = refs.some((r3) => r3.skill_name);
|
|
7376
7424
|
const label = hasSkill ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
7377
|
-
return /* @__PURE__ */
|
|
7378
|
-
/* @__PURE__ */
|
|
7425
|
+
return /* @__PURE__ */ jsxs26("div", { className: "ml-4", children: [
|
|
7426
|
+
/* @__PURE__ */ jsxs26(
|
|
7379
7427
|
"button",
|
|
7380
7428
|
{
|
|
7381
7429
|
type: "button",
|
|
7382
7430
|
onClick: () => setExpanded(!expanded),
|
|
7383
7431
|
className: "inline-flex items-center gap-1.5 rounded-md border border-[hsl(var(--primary)/0.25)] bg-[hsl(var(--primary)/0.08)] px-2.5 py-1 text-[11px] text-[hsl(var(--primary))] transition-colors hover:bg-[hsl(var(--primary)/0.12)]",
|
|
7384
7432
|
children: [
|
|
7385
|
-
/* @__PURE__ */
|
|
7386
|
-
/* @__PURE__ */
|
|
7433
|
+
/* @__PURE__ */ jsx31(BookOpen, { size: 12 }),
|
|
7434
|
+
/* @__PURE__ */ jsxs26("span", { children: [
|
|
7387
7435
|
label,
|
|
7388
7436
|
"\uFF08",
|
|
7389
7437
|
refs.length,
|
|
7390
7438
|
"\uFF09"
|
|
7391
7439
|
] }),
|
|
7392
|
-
/* @__PURE__ */
|
|
7440
|
+
/* @__PURE__ */ jsx31(
|
|
7393
7441
|
ChevronRight5,
|
|
7394
7442
|
{
|
|
7395
7443
|
size: 10,
|
|
@@ -7399,13 +7447,13 @@ function MemoryRefsHint({ refs: rawRefs }) {
|
|
|
7399
7447
|
]
|
|
7400
7448
|
}
|
|
7401
7449
|
),
|
|
7402
|
-
expanded && /* @__PURE__ */
|
|
7403
|
-
refs.map((ref) => /* @__PURE__ */
|
|
7404
|
-
/* @__PURE__ */
|
|
7405
|
-
/* @__PURE__ */
|
|
7406
|
-
ref.skill_name && /* @__PURE__ */
|
|
7450
|
+
expanded && /* @__PURE__ */ jsxs26("div", { className: "mt-1.5 flex flex-col gap-1 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.45)] px-3 py-2", children: [
|
|
7451
|
+
refs.map((ref) => /* @__PURE__ */ jsxs26("div", { className: "flex items-start gap-2 text-[11px] text-[hsl(var(--foreground)/0.82)]", children: [
|
|
7452
|
+
/* @__PURE__ */ jsx31("span", { className: "mt-0.5 shrink-0 text-[hsl(var(--primary)/0.75)]", children: "\u2022" }),
|
|
7453
|
+
/* @__PURE__ */ jsx31("span", { className: "line-clamp-1", children: ref.content_preview }),
|
|
7454
|
+
ref.skill_name && /* @__PURE__ */ jsx31("span", { className: "ml-auto shrink-0 rounded bg-[hsl(var(--primary)/0.12)] px-1.5 py-0.5 text-[10px] text-[hsl(var(--primary))]", children: ref.skill_name })
|
|
7407
7455
|
] }, ref.id)),
|
|
7408
|
-
/* @__PURE__ */
|
|
7456
|
+
/* @__PURE__ */ jsx31(
|
|
7409
7457
|
"a",
|
|
7410
7458
|
{
|
|
7411
7459
|
href: MEMORIES_ROUTE,
|
|
@@ -7420,7 +7468,7 @@ function MemoryRefsHint({ refs: rawRefs }) {
|
|
|
7420
7468
|
// src/react/components/chat/CompactionCard.tsx
|
|
7421
7469
|
import { ChevronDown as ChevronDown2, ChevronRight as ChevronRight6, Loader2 as Loader25, Square as Square3, XCircle } from "lucide-react";
|
|
7422
7470
|
import { useState as useState19 } from "react";
|
|
7423
|
-
import { jsx as
|
|
7471
|
+
import { jsx as jsx32, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
7424
7472
|
var PERCENT_FORMATTER = new Intl.NumberFormat("zh-CN", {
|
|
7425
7473
|
style: "percent",
|
|
7426
7474
|
maximumFractionDigits: 0
|
|
@@ -7480,9 +7528,9 @@ function CompactionCard({
|
|
|
7480
7528
|
const hasSummary = typeof source.summary_full === "string" && source.summary_full.trim().length > 0 && !isGenericArchiveSummary(source.summary_full);
|
|
7481
7529
|
const hasFailureReason = source.status === "failed" && Boolean(source.failure_reason);
|
|
7482
7530
|
const canExpand = source.status === "completed" && (hasSummary || archivedToolCalls.length > 0) || hasFailureReason;
|
|
7483
|
-
return /* @__PURE__ */
|
|
7484
|
-
/* @__PURE__ */
|
|
7485
|
-
/* @__PURE__ */
|
|
7531
|
+
return /* @__PURE__ */ jsxs27("div", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
7532
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex items-center justify-between gap-2", children: [
|
|
7533
|
+
/* @__PURE__ */ jsxs27(
|
|
7486
7534
|
"button",
|
|
7487
7535
|
{
|
|
7488
7536
|
type: "button",
|
|
@@ -7493,21 +7541,21 @@ function CompactionCard({
|
|
|
7493
7541
|
),
|
|
7494
7542
|
"aria-expanded": expanded,
|
|
7495
7543
|
children: [
|
|
7496
|
-
canExpand ? expanded ? /* @__PURE__ */
|
|
7497
|
-
/* @__PURE__ */
|
|
7498
|
-
/* @__PURE__ */
|
|
7544
|
+
canExpand ? expanded ? /* @__PURE__ */ jsx32(ChevronDown2, { size: 12, className: "shrink-0" }) : /* @__PURE__ */ jsx32(ChevronRight6, { size: 12, className: "shrink-0" }) : null,
|
|
7545
|
+
/* @__PURE__ */ jsx32("span", { children: source.status === "streaming" ? /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-1", children: [
|
|
7546
|
+
/* @__PURE__ */ jsx32(Loader25, { size: 12, className: "animate-spin" }),
|
|
7499
7547
|
"\u6B63\u5728\u538B\u7F29\u4E0A\u4E0B\u6587"
|
|
7500
|
-
] }) : source.status === "failed" ? /* @__PURE__ */
|
|
7501
|
-
/* @__PURE__ */
|
|
7548
|
+
] }) : source.status === "failed" ? /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-1 text-rose-500/80", children: [
|
|
7549
|
+
/* @__PURE__ */ jsx32(XCircle, { size: 12 }),
|
|
7502
7550
|
"\u4E0A\u4E0B\u6587\u538B\u7F29\u5931\u8D25"
|
|
7503
|
-
] }) : source.status === "interrupted" ? /* @__PURE__ */
|
|
7504
|
-
/* @__PURE__ */
|
|
7551
|
+
] }) : source.status === "interrupted" ? /* @__PURE__ */ jsxs27("span", { className: "inline-flex items-center gap-1 text-amber-500/80", children: [
|
|
7552
|
+
/* @__PURE__ */ jsx32(Square3, { size: 11 }),
|
|
7505
7553
|
"\u4E0A\u4E0B\u6587\u538B\u7F29\u5DF2\u53D6\u6D88"
|
|
7506
7554
|
] }) : "\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29" })
|
|
7507
7555
|
]
|
|
7508
7556
|
}
|
|
7509
7557
|
),
|
|
7510
|
-
canCancel ? /* @__PURE__ */
|
|
7558
|
+
canCancel ? /* @__PURE__ */ jsx32(
|
|
7511
7559
|
"button",
|
|
7512
7560
|
{
|
|
7513
7561
|
type: "button",
|
|
@@ -7517,13 +7565,13 @@ function CompactionCard({
|
|
|
7517
7565
|
}
|
|
7518
7566
|
) : null
|
|
7519
7567
|
] }),
|
|
7520
|
-
expanded ? /* @__PURE__ */
|
|
7521
|
-
/* @__PURE__ */
|
|
7522
|
-
/* @__PURE__ */
|
|
7568
|
+
expanded ? /* @__PURE__ */ jsxs27("div", { className: "mt-1 max-w-3xl rounded-lg border border-[hsl(var(--border))]/70 bg-[hsl(var(--card))]/80 px-3 py-2 text-[11px] leading-relaxed shadow-sm", children: [
|
|
7569
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-x-3 gap-y-1 text-[hsl(var(--muted-foreground))]", children: [
|
|
7570
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
7523
7571
|
"#",
|
|
7524
7572
|
shortId(source.compaction_id)
|
|
7525
7573
|
] }),
|
|
7526
|
-
/* @__PURE__ */
|
|
7574
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
7527
7575
|
"\u8282\u7701 ",
|
|
7528
7576
|
formatSavedRatio(source.saved_ratio),
|
|
7529
7577
|
"\uFF08",
|
|
@@ -7533,31 +7581,31 @@ function CompactionCard({
|
|
|
7533
7581
|
formatTokens(source.tokens_after),
|
|
7534
7582
|
" token\uFF09"
|
|
7535
7583
|
] }),
|
|
7536
|
-
/* @__PURE__ */
|
|
7584
|
+
/* @__PURE__ */ jsxs27("span", { children: [
|
|
7537
7585
|
"\u5F52\u6863 ",
|
|
7538
7586
|
archivedCount,
|
|
7539
7587
|
" \u4E2A\u5DE5\u5177\u7ED3\u679C"
|
|
7540
7588
|
] })
|
|
7541
7589
|
] }),
|
|
7542
|
-
archivedToolCalls.length > 0 ? /* @__PURE__ */
|
|
7590
|
+
archivedToolCalls.length > 0 ? /* @__PURE__ */ jsx32("div", { className: "mt-2 space-y-1.5", children: archivedToolCalls.map((item, index) => {
|
|
7543
7591
|
const archivePath = getArchivePath(item, archivedFiles);
|
|
7544
|
-
return /* @__PURE__ */
|
|
7592
|
+
return /* @__PURE__ */ jsxs27(
|
|
7545
7593
|
"div",
|
|
7546
7594
|
{
|
|
7547
7595
|
className: "rounded-md border border-[hsl(var(--border))]/70 bg-[hsl(var(--muted))]/35 px-2 py-1.5",
|
|
7548
7596
|
children: [
|
|
7549
|
-
/* @__PURE__ */
|
|
7550
|
-
/* @__PURE__ */
|
|
7551
|
-
item.tool_call_id ? /* @__PURE__ */
|
|
7597
|
+
/* @__PURE__ */ jsxs27("div", { className: "flex flex-wrap items-center gap-x-2 gap-y-1 text-[hsl(var(--foreground))]", children: [
|
|
7598
|
+
/* @__PURE__ */ jsx32("span", { className: "font-medium", children: getArchivedToolLabel(item) }),
|
|
7599
|
+
item.tool_call_id ? /* @__PURE__ */ jsx32("span", { className: "font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: item.tool_call_id }) : null
|
|
7552
7600
|
] }),
|
|
7553
|
-
archivePath ? /* @__PURE__ */
|
|
7601
|
+
archivePath ? /* @__PURE__ */ jsx32("div", { className: "mt-0.5 break-all font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: archivePath }) : null
|
|
7554
7602
|
]
|
|
7555
7603
|
},
|
|
7556
7604
|
item.tool_call_id || item.entry_id || `${item.tool_name}-${index}`
|
|
7557
7605
|
);
|
|
7558
7606
|
}) }) : null,
|
|
7559
|
-
hasSummary ? /* @__PURE__ */
|
|
7560
|
-
source.status === "failed" && source.failure_reason ? /* @__PURE__ */
|
|
7607
|
+
hasSummary ? /* @__PURE__ */ jsx32("pre", { className: "mt-2 max-h-[360px] overflow-auto whitespace-pre-wrap rounded-md border border-[hsl(var(--border))]/70 bg-[hsl(var(--muted))]/25 px-2 py-1.5 font-mono text-[11px] leading-relaxed text-[hsl(var(--foreground))]", children: source.summary_full }) : null,
|
|
7608
|
+
source.status === "failed" && source.failure_reason ? /* @__PURE__ */ jsxs27("div", { className: "mt-2 text-rose-500/90", children: [
|
|
7561
7609
|
"\u5931\u8D25\u539F\u56E0\uFF1A",
|
|
7562
7610
|
source.failure_reason
|
|
7563
7611
|
] }) : null
|
|
@@ -7568,7 +7616,7 @@ function CompactionCard({
|
|
|
7568
7616
|
// src/react/components/chat/RenderErrorBoundary.tsx
|
|
7569
7617
|
import { AlertTriangle as AlertTriangle2 } from "lucide-react";
|
|
7570
7618
|
import { Component } from "react";
|
|
7571
|
-
import { jsx as
|
|
7619
|
+
import { jsx as jsx33, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
7572
7620
|
function getFirstComponentName(componentStack) {
|
|
7573
7621
|
const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
|
|
7574
7622
|
return match?.[1] ?? null;
|
|
@@ -7601,18 +7649,18 @@ var RenderErrorBoundary = class extends Component {
|
|
|
7601
7649
|
return children;
|
|
7602
7650
|
}
|
|
7603
7651
|
const componentName = getFirstComponentName(componentStack);
|
|
7604
|
-
return /* @__PURE__ */
|
|
7605
|
-
/* @__PURE__ */
|
|
7606
|
-
/* @__PURE__ */
|
|
7607
|
-
/* @__PURE__ */
|
|
7652
|
+
return /* @__PURE__ */ jsx33("div", { className: "rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3 text-sm text-amber-100", children: /* @__PURE__ */ jsxs28("div", { className: "flex items-start gap-2", children: [
|
|
7653
|
+
/* @__PURE__ */ jsx33(AlertTriangle2, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-300" }),
|
|
7654
|
+
/* @__PURE__ */ jsxs28("div", { className: "min-w-0 flex-1", children: [
|
|
7655
|
+
/* @__PURE__ */ jsxs28("div", { className: "font-medium", children: [
|
|
7608
7656
|
label,
|
|
7609
7657
|
"\u6E32\u67D3\u5931\u8D25"
|
|
7610
7658
|
] }),
|
|
7611
|
-
/* @__PURE__ */
|
|
7659
|
+
/* @__PURE__ */ jsxs28("div", { className: "mt-1 break-words text-xs leading-5 text-amber-100/75", children: [
|
|
7612
7660
|
componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
|
|
7613
7661
|
error.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
|
|
7614
7662
|
] }),
|
|
7615
|
-
details ? /* @__PURE__ */
|
|
7663
|
+
details ? /* @__PURE__ */ jsx33("div", { className: "mt-1 truncate text-xs text-amber-100/55", children: details }) : null
|
|
7616
7664
|
] })
|
|
7617
7665
|
] }) });
|
|
7618
7666
|
}
|
|
@@ -7631,7 +7679,7 @@ import {
|
|
|
7631
7679
|
WandSparkles
|
|
7632
7680
|
} from "lucide-react";
|
|
7633
7681
|
import { useEffect as useEffect16, useMemo as useMemo16, useState as useState20 } from "react";
|
|
7634
|
-
import { jsx as
|
|
7682
|
+
import { jsx as jsx34, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
7635
7683
|
var EMPTY_EVENTS = [];
|
|
7636
7684
|
function formatElapsedDuration(durationMs) {
|
|
7637
7685
|
if (durationMs == null) return null;
|
|
@@ -7741,22 +7789,22 @@ function StickyStatusBar({
|
|
|
7741
7789
|
}
|
|
7742
7790
|
const elapsedLabel = formatElapsedDuration(elapsedDuration);
|
|
7743
7791
|
const Icon = action.Icon;
|
|
7744
|
-
return /* @__PURE__ */
|
|
7792
|
+
return /* @__PURE__ */ jsxs29(
|
|
7745
7793
|
"button",
|
|
7746
7794
|
{
|
|
7747
7795
|
type: "button",
|
|
7748
7796
|
onClick: onJumpToLatest,
|
|
7749
7797
|
className: "sticky top-0 z-20 mb-4 flex w-full items-center gap-3 rounded-2xl border border-[hsl(var(--primary)/0.2)] bg-[hsl(var(--background)/0.92)] px-4 py-3 text-left shadow-[0_12px_32px_-24px_hsl(var(--foreground)/0.6)] backdrop-blur",
|
|
7750
7798
|
children: [
|
|
7751
|
-
/* @__PURE__ */
|
|
7752
|
-
/* @__PURE__ */
|
|
7753
|
-
/* @__PURE__ */
|
|
7754
|
-
/* @__PURE__ */
|
|
7755
|
-
elapsedLabel ? /* @__PURE__ */
|
|
7799
|
+
/* @__PURE__ */ jsx34("span", { className: "flex h-10 w-10 shrink-0 items-center justify-center rounded-2xl bg-[hsl(var(--primary)/0.12)] text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx34(Icon, { size: 18, className: Icon === LoaderCircle2 ? "animate-spin" : void 0 }) }),
|
|
7800
|
+
/* @__PURE__ */ jsxs29("div", { className: "min-w-0 flex-1", children: [
|
|
7801
|
+
/* @__PURE__ */ jsx34("div", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: action.label }),
|
|
7802
|
+
/* @__PURE__ */ jsxs29("div", { className: "mt-1 flex flex-wrap items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
7803
|
+
elapsedLabel ? /* @__PURE__ */ jsxs29("span", { className: "font-mono", children: [
|
|
7756
7804
|
"\u5DF2\u6301\u7EED ",
|
|
7757
7805
|
elapsedLabel
|
|
7758
7806
|
] }) : null,
|
|
7759
|
-
/* @__PURE__ */
|
|
7807
|
+
/* @__PURE__ */ jsx34("span", { children: "\u70B9\u51FB\u8DF3\u5230\u6700\u65B0\u4F4D\u7F6E" })
|
|
7760
7808
|
] })
|
|
7761
7809
|
] })
|
|
7762
7810
|
]
|
|
@@ -7765,7 +7813,7 @@ function StickyStatusBar({
|
|
|
7765
7813
|
}
|
|
7766
7814
|
|
|
7767
7815
|
// src/react/components/chat/TurnNavRail.tsx
|
|
7768
|
-
import { jsx as
|
|
7816
|
+
import { jsx as jsx35, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
7769
7817
|
function TurnNavRail({
|
|
7770
7818
|
items,
|
|
7771
7819
|
activeTurnId,
|
|
@@ -7774,14 +7822,14 @@ function TurnNavRail({
|
|
|
7774
7822
|
if (items.length < 2) {
|
|
7775
7823
|
return null;
|
|
7776
7824
|
}
|
|
7777
|
-
return /* @__PURE__ */
|
|
7825
|
+
return /* @__PURE__ */ jsx35(
|
|
7778
7826
|
"nav",
|
|
7779
7827
|
{
|
|
7780
7828
|
"aria-label": "\u56DE\u5408\u5BFC\u822A",
|
|
7781
7829
|
className: "absolute right-2 top-4 z-10 hidden flex-col items-end gap-0.5 md:flex",
|
|
7782
7830
|
children: items.map((item, index) => {
|
|
7783
7831
|
const isActive = item.id === activeTurnId;
|
|
7784
|
-
return /* @__PURE__ */
|
|
7832
|
+
return /* @__PURE__ */ jsxs30(
|
|
7785
7833
|
"button",
|
|
7786
7834
|
{
|
|
7787
7835
|
type: "button",
|
|
@@ -7789,8 +7837,8 @@ function TurnNavRail({
|
|
|
7789
7837
|
"aria-current": isActive ? "true" : void 0,
|
|
7790
7838
|
className: "group relative flex h-3.5 items-center",
|
|
7791
7839
|
children: [
|
|
7792
|
-
/* @__PURE__ */
|
|
7793
|
-
/* @__PURE__ */
|
|
7840
|
+
/* @__PURE__ */ jsx35("span", { className: "pointer-events-none absolute right-full mr-2 hidden max-w-48 truncate whitespace-nowrap rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1.5 text-xs text-[hsl(var(--popover-foreground))] shadow-lg group-hover:block", children: item.title || `\u7B2C ${index + 1} \u8F6E` }),
|
|
7841
|
+
/* @__PURE__ */ jsx35(
|
|
7794
7842
|
"span",
|
|
7795
7843
|
{
|
|
7796
7844
|
className: cn(
|
|
@@ -7809,7 +7857,7 @@ function TurnNavRail({
|
|
|
7809
7857
|
}
|
|
7810
7858
|
|
|
7811
7859
|
// src/react/components/chat/MessageList.tsx
|
|
7812
|
-
import { jsx as
|
|
7860
|
+
import { jsx as jsx36, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
7813
7861
|
function parseModeChange(message) {
|
|
7814
7862
|
if (message.kind !== "mode_change" || typeof message.content !== "string") {
|
|
7815
7863
|
return null;
|
|
@@ -8085,13 +8133,13 @@ function MessageList({
|
|
|
8085
8133
|
const handleSelectTurn = useCallback12((turnId) => {
|
|
8086
8134
|
document.getElementById(turnId)?.scrollIntoView({ behavior: "smooth", block: "start" });
|
|
8087
8135
|
}, []);
|
|
8088
|
-
return /* @__PURE__ */
|
|
8136
|
+
return /* @__PURE__ */ jsxs31(
|
|
8089
8137
|
"div",
|
|
8090
8138
|
{
|
|
8091
8139
|
ref: containerRef,
|
|
8092
8140
|
className: `relative min-h-0 flex-1 ${customization?.classNames?.messageListRoot ?? ""}`,
|
|
8093
8141
|
children: [
|
|
8094
|
-
turnNavItems.length > 1 ? /* @__PURE__ */
|
|
8142
|
+
turnNavItems.length > 1 ? /* @__PURE__ */ jsx36(
|
|
8095
8143
|
TurnNavRail,
|
|
8096
8144
|
{
|
|
8097
8145
|
items: turnNavItems,
|
|
@@ -8099,7 +8147,7 @@ function MessageList({
|
|
|
8099
8147
|
onSelectTurn: handleSelectTurn
|
|
8100
8148
|
}
|
|
8101
8149
|
) : null,
|
|
8102
|
-
/* @__PURE__ */
|
|
8150
|
+
/* @__PURE__ */ jsxs31(
|
|
8103
8151
|
StickToBottom,
|
|
8104
8152
|
{
|
|
8105
8153
|
contextRef: stickContextRef,
|
|
@@ -8107,7 +8155,7 @@ function MessageList({
|
|
|
8107
8155
|
initial: "instant",
|
|
8108
8156
|
resize: stickyTurn ? { damping: 0.8, stiffness: 0.08, mass: 1 } : "instant",
|
|
8109
8157
|
children: [
|
|
8110
|
-
/* @__PURE__ */
|
|
8158
|
+
/* @__PURE__ */ jsx36(StickToBottom.Content, { className: "px-5 py-6", children: /* @__PURE__ */ jsx36(
|
|
8111
8159
|
MessageListContent,
|
|
8112
8160
|
{
|
|
8113
8161
|
askAnswers,
|
|
@@ -8124,7 +8172,7 @@ function MessageList({
|
|
|
8124
8172
|
customization
|
|
8125
8173
|
}
|
|
8126
8174
|
) }),
|
|
8127
|
-
/* @__PURE__ */
|
|
8175
|
+
/* @__PURE__ */ jsx36(ScrollToBottomButton, {})
|
|
8128
8176
|
]
|
|
8129
8177
|
}
|
|
8130
8178
|
)
|
|
@@ -8154,8 +8202,8 @@ function MessageListContent({
|
|
|
8154
8202
|
}
|
|
8155
8203
|
scrollToBottom();
|
|
8156
8204
|
}, [lastTurnId, scrollToBottom]);
|
|
8157
|
-
return /* @__PURE__ */
|
|
8158
|
-
stickyTurn ? /* @__PURE__ */
|
|
8205
|
+
return /* @__PURE__ */ jsx36("div", { className: `mx-auto max-w-3xl ${customization?.classNames?.messageListContent ?? ""}`, children: /* @__PURE__ */ jsxs31("div", { className: `min-w-0 flex flex-col gap-8 ${customization?.classNames?.messageListInner ?? ""}`, children: [
|
|
8206
|
+
stickyTurn ? /* @__PURE__ */ jsx36(
|
|
8159
8207
|
StickyStatusBar,
|
|
8160
8208
|
{
|
|
8161
8209
|
sessionId,
|
|
@@ -8165,31 +8213,31 @@ function MessageListContent({
|
|
|
8165
8213
|
onJumpToLatest: handleJumpToLatest
|
|
8166
8214
|
}
|
|
8167
8215
|
) : null,
|
|
8168
|
-
renderBlocks.length === 0 ? customization?.components?.EmptyState ? /* @__PURE__ */
|
|
8169
|
-
/* @__PURE__ */
|
|
8170
|
-
/* @__PURE__ */
|
|
8171
|
-
/* @__PURE__ */
|
|
8216
|
+
renderBlocks.length === 0 ? customization?.components?.EmptyState ? /* @__PURE__ */ jsx36(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs31("div", { className: `flex flex-col items-center justify-center gap-3 py-24 text-[hsl(var(--muted-foreground))] ${customization?.classNames?.emptyState ?? ""}`, children: [
|
|
8217
|
+
/* @__PURE__ */ jsx36(MessageSquare, { size: 40, strokeWidth: 1.5 }),
|
|
8218
|
+
/* @__PURE__ */ jsx36("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
|
|
8219
|
+
/* @__PURE__ */ jsx36("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
8172
8220
|
] }) : renderBlocks.map((block, blockIndex) => {
|
|
8173
8221
|
if (block.type === "message") {
|
|
8174
|
-
return /* @__PURE__ */
|
|
8222
|
+
return /* @__PURE__ */ jsx36("div", { className: "msg-animate", children: isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx36(
|
|
8175
8223
|
customization.components.UserMessage,
|
|
8176
8224
|
{
|
|
8177
8225
|
message: block.message,
|
|
8178
8226
|
className: customization.classNames?.userMessage
|
|
8179
8227
|
}
|
|
8180
|
-
) : /* @__PURE__ */
|
|
8228
|
+
) : /* @__PURE__ */ jsx36(
|
|
8181
8229
|
UserMessageBubble,
|
|
8182
8230
|
{
|
|
8183
8231
|
message: block.message,
|
|
8184
8232
|
className: customization?.classNames?.userMessage
|
|
8185
8233
|
}
|
|
8186
|
-
) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */
|
|
8234
|
+
) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx36(
|
|
8187
8235
|
customization.components.ErrorMessage,
|
|
8188
8236
|
{
|
|
8189
8237
|
message: block.message,
|
|
8190
8238
|
className: customization.classNames?.errorMessage
|
|
8191
8239
|
}
|
|
8192
|
-
) : /* @__PURE__ */
|
|
8240
|
+
) : /* @__PURE__ */ jsx36(
|
|
8193
8241
|
ErrorMessageBlock,
|
|
8194
8242
|
{
|
|
8195
8243
|
message: block.message,
|
|
@@ -8206,20 +8254,20 @@ function MessageListContent({
|
|
|
8206
8254
|
);
|
|
8207
8255
|
const isFollowedByPlanningExit = nextBlock?.type === "planning_divider" && nextBlock.kind === "exit";
|
|
8208
8256
|
const showPlanCard = (hasExitPlan || isFollowedByPlanningExit) && onConfirmPlan && sessionStatus === "waiting_for_input";
|
|
8209
|
-
return /* @__PURE__ */
|
|
8257
|
+
return /* @__PURE__ */ jsxs31(
|
|
8210
8258
|
"div",
|
|
8211
8259
|
{
|
|
8212
8260
|
id: block.anchorId,
|
|
8213
8261
|
"data-turn-id": block.anchorId,
|
|
8214
8262
|
className: "msg-animate flex scroll-mt-6 flex-col gap-4",
|
|
8215
8263
|
children: [
|
|
8216
|
-
/* @__PURE__ */
|
|
8264
|
+
/* @__PURE__ */ jsx36(
|
|
8217
8265
|
RenderErrorBoundary,
|
|
8218
8266
|
{
|
|
8219
8267
|
label: "\u52A9\u624B\u6D88\u606F",
|
|
8220
8268
|
details: block.key,
|
|
8221
8269
|
resetKey: getMessagesResetSignature(block.messages),
|
|
8222
|
-
children: customization?.components?.AssistantTurn ? /* @__PURE__ */
|
|
8270
|
+
children: customization?.components?.AssistantTurn ? /* @__PURE__ */ jsx36(
|
|
8223
8271
|
customization.components.AssistantTurn,
|
|
8224
8272
|
{
|
|
8225
8273
|
turnKey: block.key,
|
|
@@ -8232,7 +8280,7 @@ function MessageListContent({
|
|
|
8232
8280
|
sessionStatus,
|
|
8233
8281
|
customization
|
|
8234
8282
|
}
|
|
8235
|
-
) : /* @__PURE__ */
|
|
8283
|
+
) : /* @__PURE__ */ jsx36(
|
|
8236
8284
|
AssistantTurnBlock,
|
|
8237
8285
|
{
|
|
8238
8286
|
turnKey: block.key,
|
|
@@ -8248,13 +8296,13 @@ function MessageListContent({
|
|
|
8248
8296
|
)
|
|
8249
8297
|
}
|
|
8250
8298
|
),
|
|
8251
|
-
showPlanCard ? /* @__PURE__ */
|
|
8299
|
+
showPlanCard ? /* @__PURE__ */ jsx36(
|
|
8252
8300
|
RenderErrorBoundary,
|
|
8253
8301
|
{
|
|
8254
8302
|
label: "\u89C4\u5212\u6458\u8981",
|
|
8255
8303
|
details: block.key,
|
|
8256
8304
|
resetKey: `${sessionStatus ?? ""}:${layoutSignature}`,
|
|
8257
|
-
children: /* @__PURE__ */
|
|
8305
|
+
children: /* @__PURE__ */ jsx36(
|
|
8258
8306
|
PlanSummaryCard,
|
|
8259
8307
|
{
|
|
8260
8308
|
messages: extractLatestPlanMessages(messages),
|
|
@@ -8270,7 +8318,7 @@ function MessageListContent({
|
|
|
8270
8318
|
);
|
|
8271
8319
|
}
|
|
8272
8320
|
if (block.type === "compaction") {
|
|
8273
|
-
return /* @__PURE__ */
|
|
8321
|
+
return /* @__PURE__ */ jsx36("div", { className: "msg-animate", children: /* @__PURE__ */ jsx36(
|
|
8274
8322
|
CompactionCard,
|
|
8275
8323
|
{
|
|
8276
8324
|
sessionId,
|
|
@@ -8279,41 +8327,41 @@ function MessageListContent({
|
|
|
8279
8327
|
}
|
|
8280
8328
|
) }, block.key);
|
|
8281
8329
|
}
|
|
8282
|
-
return /* @__PURE__ */
|
|
8330
|
+
return /* @__PURE__ */ jsx36(PlanningDivider, { kind: block.kind }, block.key);
|
|
8283
8331
|
}),
|
|
8284
|
-
sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */
|
|
8332
|
+
sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */ jsx36("div", { className: "flex", children: /* @__PURE__ */ jsx36("div", { className: "rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }) }) : null
|
|
8285
8333
|
] }) });
|
|
8286
8334
|
}
|
|
8287
8335
|
function ScrollToBottomButton() {
|
|
8288
8336
|
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
8289
8337
|
if (isAtBottom) return null;
|
|
8290
|
-
return /* @__PURE__ */
|
|
8338
|
+
return /* @__PURE__ */ jsxs31(
|
|
8291
8339
|
"button",
|
|
8292
8340
|
{
|
|
8293
8341
|
type: "button",
|
|
8294
8342
|
onClick: () => scrollToBottom(),
|
|
8295
8343
|
className: "absolute bottom-4 right-4 flex items-center gap-1 rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-3 py-1.5 text-xs text-[hsl(var(--muted-foreground))] shadow-lg transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
8296
8344
|
children: [
|
|
8297
|
-
/* @__PURE__ */
|
|
8298
|
-
/* @__PURE__ */
|
|
8345
|
+
/* @__PURE__ */ jsx36(ChevronDown3, { size: 14 }),
|
|
8346
|
+
/* @__PURE__ */ jsx36("span", { children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
|
|
8299
8347
|
]
|
|
8300
8348
|
}
|
|
8301
8349
|
);
|
|
8302
8350
|
}
|
|
8303
8351
|
function PlanningDivider({ kind }) {
|
|
8304
8352
|
const isEnter = kind === "enter";
|
|
8305
|
-
return /* @__PURE__ */
|
|
8306
|
-
/* @__PURE__ */
|
|
8307
|
-
/* @__PURE__ */
|
|
8308
|
-
/* @__PURE__ */
|
|
8309
|
-
/* @__PURE__ */
|
|
8353
|
+
return /* @__PURE__ */ jsxs31("div", { className: "flex items-center gap-3 py-1", children: [
|
|
8354
|
+
/* @__PURE__ */ jsx36("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
|
|
8355
|
+
/* @__PURE__ */ jsxs31("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-amber-500/30 bg-amber-500/10 px-3 py-1 text-[11px] text-amber-300", children: [
|
|
8356
|
+
/* @__PURE__ */ jsx36(Lightbulb2, { size: 12 }),
|
|
8357
|
+
/* @__PURE__ */ jsx36("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
|
|
8310
8358
|
] }),
|
|
8311
|
-
/* @__PURE__ */
|
|
8359
|
+
/* @__PURE__ */ jsx36("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
|
|
8312
8360
|
] });
|
|
8313
8361
|
}
|
|
8314
8362
|
|
|
8315
8363
|
// src/react/components/chat/ChatView.tsx
|
|
8316
|
-
import { jsx as
|
|
8364
|
+
import { jsx as jsx37, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
8317
8365
|
function ChatView({
|
|
8318
8366
|
sessionId,
|
|
8319
8367
|
renderAttachments,
|
|
@@ -8334,6 +8382,7 @@ function ChatView({
|
|
|
8334
8382
|
stop
|
|
8335
8383
|
} = useChat(sessionId);
|
|
8336
8384
|
const session = useSessionStore((s) => s.sessions.find((ss) => ss.id === sessionId));
|
|
8385
|
+
const errorMessage = useSessionStore((s) => s.errorMessages[sessionId]);
|
|
8337
8386
|
const mode = useSessionStore((s) => s.modes[sessionId] ?? "executing");
|
|
8338
8387
|
const toggleMode = useCallback13(
|
|
8339
8388
|
() => useSessionStore.getState().togglePlanningMode(sessionId),
|
|
@@ -8356,13 +8405,17 @@ function ChatView({
|
|
|
8356
8405
|
[classNames, components, renderers]
|
|
8357
8406
|
);
|
|
8358
8407
|
const SkillStatus = components?.SkillStatusBar;
|
|
8359
|
-
return /* @__PURE__ */
|
|
8360
|
-
isViewer && /* @__PURE__ */
|
|
8361
|
-
/* @__PURE__ */
|
|
8408
|
+
return /* @__PURE__ */ jsxs32("div", { className: `flex min-h-0 flex-1 flex-col overflow-hidden ${classNames?.root ?? ""}`, children: [
|
|
8409
|
+
isViewer && /* @__PURE__ */ jsxs32("div", { className: `flex items-center justify-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--card))] py-2 text-xs text-[hsl(var(--muted-foreground))] ${classNames?.viewerBanner ?? ""}`, children: [
|
|
8410
|
+
/* @__PURE__ */ jsx37(Eye, { size: 14 }),
|
|
8362
8411
|
"\u4F60\u6B63\u5728\u67E5\u770B\u5206\u4EAB\u7684\u4F1A\u8BDD\uFF08\u53EA\u8BFB\uFF09"
|
|
8363
8412
|
] }),
|
|
8364
|
-
!isViewer && /* @__PURE__ */
|
|
8365
|
-
/* @__PURE__ */
|
|
8413
|
+
!isViewer && /* @__PURE__ */ jsx37(ConnectionBanner, {}),
|
|
8414
|
+
errorMessage && /* @__PURE__ */ jsxs32("div", { className: "flex items-start gap-2 border-b border-red-200 bg-red-50 px-4 py-3 text-sm text-red-800 dark:border-red-800/30 dark:bg-red-950/30 dark:text-red-300", children: [
|
|
8415
|
+
/* @__PURE__ */ jsx37(CircleAlert2, { size: 16, className: "mt-0.5 shrink-0" }),
|
|
8416
|
+
/* @__PURE__ */ jsx37("span", { children: errorMessage })
|
|
8417
|
+
] }),
|
|
8418
|
+
/* @__PURE__ */ jsx37(
|
|
8366
8419
|
MessageList,
|
|
8367
8420
|
{
|
|
8368
8421
|
sessionId,
|
|
@@ -8374,7 +8427,7 @@ function ChatView({
|
|
|
8374
8427
|
},
|
|
8375
8428
|
sessionId
|
|
8376
8429
|
),
|
|
8377
|
-
!isViewer && /* @__PURE__ */
|
|
8430
|
+
!isViewer && /* @__PURE__ */ jsx37(
|
|
8378
8431
|
ChatInput,
|
|
8379
8432
|
{
|
|
8380
8433
|
onSend: (msg, _targetSessionId, model) => send(msg, mode, void 0, { model: model || void 0 }),
|
|
@@ -8450,4 +8503,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
8450
8503
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
8451
8504
|
*--------------------------------------------------------------------------------------------*)
|
|
8452
8505
|
*/
|
|
8453
|
-
//# sourceMappingURL=chunk-
|
|
8506
|
+
//# sourceMappingURL=chunk-SENUKC7C.js.map
|