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