@blade-hq/agent-react 2612.0.1-beta.2 → 2612.0.1-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/McpAppCard-WFCF2MLR.js +208 -0
- package/dist/McpAppCard-WFCF2MLR.js.map +1 -0
- package/dist/{McpAppFrame-IQK5AOMD.js → McpAppFrame-MROYFPW4.js} +2 -2
- package/dist/chat/runtime/input-services.d.ts +2 -0
- package/dist/{chunk-DNND32V4.js → chunk-CSAENPN2.js} +2 -2
- package/dist/chunk-CSAENPN2.js.map +1 -0
- package/dist/{chunk-LFC3UTIJ.js → chunk-D64PHHWL.js} +77 -69
- package/dist/chunk-D64PHHWL.js.map +1 -0
- package/dist/{chunk-4WFRH7FG.js → chunk-H2RHTYTN.js} +252 -37
- package/dist/{chunk-4WFRH7FG.js.map → chunk-H2RHTYTN.js.map} +1 -1
- package/dist/{chunk-VUUX2BIU.js → chunk-ND476ANG.js} +887 -796
- package/dist/chunk-ND476ANG.js.map +1 -0
- package/dist/{chunk-7DG4JFRS.js → chunk-R3CDECVX.js} +1 -1
- package/dist/chunk-R3CDECVX.js.map +1 -0
- package/dist/{chunk-GRUDJLWG.js → chunk-USBLVHQB.js} +1 -1
- package/dist/chunk-USBLVHQB.js.map +1 -0
- package/dist/components/AgentChat.d.ts +3 -0
- package/dist/components/CaseDemoPlayer.d.ts +10 -0
- package/dist/components/ConnectorPanel.d.ts +3 -2
- package/dist/components/McpAppCard.d.ts +2 -8
- package/dist/components/McpAppFrame.d.ts +3 -0
- package/dist/components/UserMessageText.d.ts +8 -0
- package/dist/components/connector-panel-types.d.ts +1 -0
- package/dist/components/lazy-mcp-app-card.d.ts +3 -1
- package/dist/components/mcp-app-context.d.ts +2 -6
- package/dist/components/mcp-app-types.d.ts +40 -0
- package/dist/embed/entry.d.ts +3 -0
- package/dist/host.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +11 -4
- package/dist/internal.js +10 -6
- package/dist/internal.js.map +1 -1
- package/dist/rich-input/ComposerControls.d.ts +6 -1
- package/dist/rich-input.js +26 -14
- package/dist/rich-input.js.map +1 -1
- package/dist/style.full.css +1 -1
- package/dist/tool-details.js +1 -1
- package/package.json +2 -2
- package/public-api.md +71 -2
- package/dist/McpAppCard-NJEKKEEN.js +0 -171
- package/dist/McpAppCard-NJEKKEEN.js.map +0 -1
- package/dist/chunk-7DG4JFRS.js.map +0 -1
- package/dist/chunk-DNND32V4.js.map +0 -1
- package/dist/chunk-GRUDJLWG.js.map +0 -1
- package/dist/chunk-LFC3UTIJ.js.map +0 -1
- package/dist/chunk-VUUX2BIU.js.map +0 -1
- /package/dist/{McpAppFrame-IQK5AOMD.js.map → McpAppFrame-MROYFPW4.js.map} +0 -0
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
McpAppMessageContext
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-USBLVHQB.js";
|
|
4
4
|
import {
|
|
5
5
|
BackgroundLogDialog,
|
|
6
6
|
CompletionNoticeRow,
|
|
7
7
|
NamedSubagentCard,
|
|
8
8
|
PluginConnectorList,
|
|
9
9
|
RelatedWorkContext,
|
|
10
|
+
RichInputServicesProvider,
|
|
10
11
|
chatTone,
|
|
11
12
|
getPluginSuggestionItems,
|
|
12
13
|
isQueueShortcut,
|
|
@@ -14,15 +15,16 @@ import {
|
|
|
14
15
|
queueShortcutLabel,
|
|
15
16
|
sendToSession,
|
|
16
17
|
useEffectEvent,
|
|
18
|
+
useRichInputServices,
|
|
17
19
|
useSessionPluginActivation,
|
|
18
20
|
useSessionSkills
|
|
19
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-R3CDECVX.js";
|
|
20
22
|
import {
|
|
21
23
|
ImageLightbox,
|
|
22
24
|
MessageImage,
|
|
23
25
|
ToolUiCardView,
|
|
24
26
|
getRenderer
|
|
25
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-CSAENPN2.js";
|
|
26
28
|
import {
|
|
27
29
|
MarkdownContent
|
|
28
30
|
} from "./chunk-XCASYOA6.js";
|
|
@@ -588,6 +590,24 @@ function ReplayMismatchPrompt({ mismatch, className }) {
|
|
|
588
590
|
);
|
|
589
591
|
}
|
|
590
592
|
|
|
593
|
+
// src/components/UserMessageText.tsx
|
|
594
|
+
import { parseSkillMessage } from "@blade-hq/agent-client";
|
|
595
|
+
import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
596
|
+
function UserMessageText({
|
|
597
|
+
text,
|
|
598
|
+
skillRefs,
|
|
599
|
+
resolveSkillName,
|
|
600
|
+
renderText
|
|
601
|
+
}) {
|
|
602
|
+
const host = useBladeHost();
|
|
603
|
+
const resolve = resolveSkillName ?? host.resolveSkillName;
|
|
604
|
+
const { skills, body } = parseSkillMessage(text, skillRefs);
|
|
605
|
+
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|
|
606
|
+
skills.length > 0 && /* @__PURE__ */ jsx3("div", { className: "flex flex-wrap gap-1.5", "aria-label": "\u6280\u80FD", children: skills.map(({ id, label }) => /* @__PURE__ */ jsx3("span", { "data-skill-id": id, className: "max-w-full break-words rounded-full border border-border bg-muted px-2 py-0.5 text-xs text-foreground", children: label?.trim() || resolve?.(id)?.trim() || id }, id)) }),
|
|
607
|
+
body.trim() && renderText(body)
|
|
608
|
+
] });
|
|
609
|
+
}
|
|
610
|
+
|
|
591
611
|
// src/components/AgentChat.tsx
|
|
592
612
|
import { BladeApiError as BladeApiError2, isReadOnlySession as isReadOnlySession3 } from "@blade-hq/agent-client/internal";
|
|
593
613
|
import { useEffect as useEffect28, useMemo as useMemo16, useRef as useRef24, useState as useState34 } from "react";
|
|
@@ -615,7 +635,7 @@ import { createContext } from "react";
|
|
|
615
635
|
var QueuePanelAdjacencyContext = createContext(null);
|
|
616
636
|
|
|
617
637
|
// src/components/SessionQueuePanel.tsx
|
|
618
|
-
import { Fragment as
|
|
638
|
+
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
619
639
|
var QUEUE_INSET_CLASS = "mx-3";
|
|
620
640
|
function isQueuePanelVisible(snapshot, notice, editing = false) {
|
|
621
641
|
return snapshot.items.length > 0 || snapshot.paused || Boolean(notice) || editing;
|
|
@@ -699,18 +719,18 @@ function SessionQueuePanel({
|
|
|
699
719
|
next.splice(edge === "after" ? target + 1 : target, 0, sourceId);
|
|
700
720
|
onReorder(next);
|
|
701
721
|
};
|
|
702
|
-
return /* @__PURE__ */
|
|
703
|
-
snapshot.paused || collapsible ? /* @__PURE__ */
|
|
704
|
-
/* @__PURE__ */
|
|
722
|
+
return /* @__PURE__ */ jsx4("section", { part: "queue", className: cn("blade-chat-queue shrink-0 pt-2", rootClassName), "aria-label": "\u5F85\u6267\u884C\u6D88\u606F", children: /* @__PURE__ */ jsxs4("div", { className: cn("mx-auto", contentWidthClassName), children: [
|
|
723
|
+
snapshot.paused || collapsible ? /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 px-0.5 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
724
|
+
/* @__PURE__ */ jsxs4("span", { className: "font-medium", children: [
|
|
705
725
|
"\u5F85\u6267\u884C \xB7 ",
|
|
706
726
|
items.length
|
|
707
727
|
] }),
|
|
708
|
-
snapshot.paused && /* @__PURE__ */
|
|
709
|
-
/* @__PURE__ */
|
|
710
|
-
/* @__PURE__ */
|
|
728
|
+
snapshot.paused && /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
729
|
+
/* @__PURE__ */ jsxs4("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--destructive))]", children: [
|
|
730
|
+
/* @__PURE__ */ jsx4(CirclePause, { size: 12 }),
|
|
711
731
|
pauseLabel
|
|
712
732
|
] }),
|
|
713
|
-
/* @__PURE__ */
|
|
733
|
+
/* @__PURE__ */ jsx4(
|
|
714
734
|
"button",
|
|
715
735
|
{
|
|
716
736
|
type: "button",
|
|
@@ -720,7 +740,7 @@ function SessionQueuePanel({
|
|
|
720
740
|
}
|
|
721
741
|
)
|
|
722
742
|
] }),
|
|
723
|
-
collapsible && /* @__PURE__ */
|
|
743
|
+
collapsible && /* @__PURE__ */ jsxs4(
|
|
724
744
|
"button",
|
|
725
745
|
{
|
|
726
746
|
type: "button",
|
|
@@ -729,18 +749,18 @@ function SessionQueuePanel({
|
|
|
729
749
|
className: "ml-auto inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
730
750
|
children: [
|
|
731
751
|
collapsed ? "\u5C55\u5F00" : "\u6298\u53E0",
|
|
732
|
-
/* @__PURE__ */
|
|
752
|
+
/* @__PURE__ */ jsx4(ChevronDown, { size: 12, className: cn(!collapsed && "rotate-180") })
|
|
733
753
|
]
|
|
734
754
|
}
|
|
735
755
|
)
|
|
736
756
|
] }) : null,
|
|
737
|
-
notice && /* @__PURE__ */
|
|
738
|
-
/* @__PURE__ */
|
|
739
|
-
/* @__PURE__ */
|
|
757
|
+
notice && /* @__PURE__ */ jsxs4("div", { className: "blade-chat-queue-notice mt-2 flex items-start gap-1.5 text-xs text-[hsl(var(--destructive))]", children: [
|
|
758
|
+
/* @__PURE__ */ jsx4(CircleAlert, { size: 13, className: "mt-0.5 shrink-0" }),
|
|
759
|
+
/* @__PURE__ */ jsx4("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: notice })
|
|
740
760
|
] }),
|
|
741
|
-
detachedEdit && /* @__PURE__ */
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
761
|
+
detachedEdit && /* @__PURE__ */ jsxs4("div", { className: "mt-2 flex flex-col gap-2 text-xs", children: [
|
|
762
|
+
/* @__PURE__ */ jsx4("span", { children: "\u539F\u6D88\u606F\u5DF2\u53D8\u5316\uFF0C\u4FEE\u6539\u5185\u5BB9\u5DF2\u4FDD\u7559" }),
|
|
763
|
+
/* @__PURE__ */ jsx4(
|
|
744
764
|
"textarea",
|
|
745
765
|
{
|
|
746
766
|
"aria-label": "\u4FDD\u7559\u7684\u4FEE\u6539\u5185\u5BB9",
|
|
@@ -750,9 +770,9 @@ function SessionQueuePanel({
|
|
|
750
770
|
className: "w-full rounded border border-[hsl(var(--border))] bg-transparent p-2"
|
|
751
771
|
}
|
|
752
772
|
),
|
|
753
|
-
/* @__PURE__ */
|
|
754
|
-
/* @__PURE__ */
|
|
755
|
-
onRequeue && /* @__PURE__ */
|
|
773
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex justify-end gap-2", children: [
|
|
774
|
+
/* @__PURE__ */ jsx4("button", { type: "button", className: "rounded border border-[hsl(var(--border))] px-2 py-1", disabled: requeueing, onClick: stopEdit, children: "\u653E\u5F03\u4FEE\u6539" }),
|
|
775
|
+
onRequeue && /* @__PURE__ */ jsx4("button", { type: "button", className: "rounded bg-[hsl(var(--primary))] px-2 py-1 text-[hsl(var(--primary-foreground))] disabled:opacity-40", disabled: requeueing || !detachedEdit.text.trim(), onClick: async () => {
|
|
756
776
|
if (requeuePending.current) return;
|
|
757
777
|
requeuePending.current = true;
|
|
758
778
|
setRequeueing(true);
|
|
@@ -768,7 +788,7 @@ function SessionQueuePanel({
|
|
|
768
788
|
}, children: "\u4F5C\u4E3A\u6392\u961F\u6D88\u606F\u53D1\u9001" })
|
|
769
789
|
] })
|
|
770
790
|
] }),
|
|
771
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ jsx4(
|
|
772
792
|
"ul",
|
|
773
793
|
{
|
|
774
794
|
className: cn(
|
|
@@ -784,7 +804,7 @@ function SessionQueuePanel({
|
|
|
784
804
|
const pendingIndex = pendingIds.indexOf(item.id);
|
|
785
805
|
const statusLabel = item.status === "pending" ? null : queuedMessageStatusLabel(item.status);
|
|
786
806
|
const deliverable = canDeliver && canDeliverQueuedMessage(item);
|
|
787
|
-
return /* @__PURE__ */
|
|
807
|
+
return /* @__PURE__ */ jsx4(
|
|
788
808
|
"li",
|
|
789
809
|
{
|
|
790
810
|
draggable: pending && !busy && !isEditing,
|
|
@@ -833,8 +853,8 @@ function SessionQueuePanel({
|
|
|
833
853
|
busy && "opacity-60",
|
|
834
854
|
draggingId === item.id && "opacity-40"
|
|
835
855
|
),
|
|
836
|
-
children: isEditing ? /* @__PURE__ */
|
|
837
|
-
/* @__PURE__ */
|
|
856
|
+
children: isEditing ? /* @__PURE__ */ jsxs4("div", { className: "flex min-w-0 flex-1 flex-col gap-1.5", children: [
|
|
857
|
+
/* @__PURE__ */ jsx4(
|
|
838
858
|
"textarea",
|
|
839
859
|
{
|
|
840
860
|
value: activeEdit?.text ?? "",
|
|
@@ -846,8 +866,8 @@ function SessionQueuePanel({
|
|
|
846
866
|
className: "w-full resize-none rounded-md border border-[hsl(var(--border))] bg-transparent px-2 py-1.5 text-sm leading-5 text-[hsl(var(--foreground))] outline-none"
|
|
847
867
|
}
|
|
848
868
|
),
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
/* @__PURE__ */
|
|
869
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex justify-end gap-1.5", children: [
|
|
870
|
+
/* @__PURE__ */ jsx4(
|
|
851
871
|
"button",
|
|
852
872
|
{
|
|
853
873
|
type: "button",
|
|
@@ -856,7 +876,7 @@ function SessionQueuePanel({
|
|
|
856
876
|
children: "\u53D6\u6D88"
|
|
857
877
|
}
|
|
858
878
|
),
|
|
859
|
-
/* @__PURE__ */
|
|
879
|
+
/* @__PURE__ */ jsx4(
|
|
860
880
|
"button",
|
|
861
881
|
{
|
|
862
882
|
type: "button",
|
|
@@ -867,8 +887,8 @@ function SessionQueuePanel({
|
|
|
867
887
|
}
|
|
868
888
|
)
|
|
869
889
|
] })
|
|
870
|
-
] }) : /* @__PURE__ */
|
|
871
|
-
dropAt?.id === item.id ? /* @__PURE__ */
|
|
890
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment3, { children: [
|
|
891
|
+
dropAt?.id === item.id ? /* @__PURE__ */ jsx4(
|
|
872
892
|
"span",
|
|
873
893
|
{
|
|
874
894
|
"aria-hidden": "true",
|
|
@@ -879,7 +899,7 @@ function SessionQueuePanel({
|
|
|
879
899
|
)
|
|
880
900
|
}
|
|
881
901
|
) : null,
|
|
882
|
-
/* @__PURE__ */
|
|
902
|
+
/* @__PURE__ */ jsx4(
|
|
883
903
|
"button",
|
|
884
904
|
{
|
|
885
905
|
type: "button",
|
|
@@ -897,10 +917,10 @@ function SessionQueuePanel({
|
|
|
897
917
|
onMove(item, delta);
|
|
898
918
|
},
|
|
899
919
|
className: "-ml-0.5 flex h-5 w-4 shrink-0 cursor-grab items-center justify-center rounded text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] active:cursor-grabbing disabled:cursor-default disabled:opacity-60 disabled:hover:bg-transparent",
|
|
900
|
-
children: /* @__PURE__ */
|
|
920
|
+
children: /* @__PURE__ */ jsx4(Menu, { size: 14, "aria-hidden": "true" })
|
|
901
921
|
}
|
|
902
922
|
),
|
|
903
|
-
/* @__PURE__ */
|
|
923
|
+
/* @__PURE__ */ jsx4(
|
|
904
924
|
"span",
|
|
905
925
|
{
|
|
906
926
|
"data-queue-text": true,
|
|
@@ -908,12 +928,12 @@ function SessionQueuePanel({
|
|
|
908
928
|
children: item.content
|
|
909
929
|
}
|
|
910
930
|
),
|
|
911
|
-
item.error ? /* @__PURE__ */
|
|
912
|
-
/* @__PURE__ */
|
|
931
|
+
item.error ? /* @__PURE__ */ jsx4("span", { className: "shrink-0 pt-1 text-[11px] text-[hsl(var(--destructive))]", children: item.error }) : busy ? /* @__PURE__ */ jsxs4("span", { className: "mt-0.5 inline-flex shrink-0 items-center gap-1 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
932
|
+
/* @__PURE__ */ jsx4(LoaderCircle, { size: 11, className: "animate-spin" }),
|
|
913
933
|
"\u5904\u7406\u4E2D"
|
|
914
|
-
] }) : statusLabel ? /* @__PURE__ */
|
|
915
|
-
/* @__PURE__ */
|
|
916
|
-
/* @__PURE__ */
|
|
934
|
+
] }) : statusLabel ? /* @__PURE__ */ jsx4("span", { className: "shrink-0 pt-1 text-[11px] text-[hsl(var(--muted-foreground))]", children: statusLabel }) : null,
|
|
935
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex shrink-0 items-center gap-0.5 opacity-0 [@media(hover:none)]:opacity-100 transition-opacity group-hover:opacity-100 group-has-[:focus-visible]:opacity-100", children: [
|
|
936
|
+
/* @__PURE__ */ jsxs4(
|
|
917
937
|
"button",
|
|
918
938
|
{
|
|
919
939
|
type: "button",
|
|
@@ -923,12 +943,12 @@ function SessionQueuePanel({
|
|
|
923
943
|
onClick: () => onDeliver(item),
|
|
924
944
|
className: LABEL_BUTTON,
|
|
925
945
|
children: [
|
|
926
|
-
/* @__PURE__ */
|
|
946
|
+
/* @__PURE__ */ jsx4(Send, { size: 13, "aria-hidden": "true" }),
|
|
927
947
|
"\u7ACB\u523B\u53D1\u9001"
|
|
928
948
|
]
|
|
929
949
|
}
|
|
930
950
|
),
|
|
931
|
-
/* @__PURE__ */
|
|
951
|
+
/* @__PURE__ */ jsx4(
|
|
932
952
|
"button",
|
|
933
953
|
{
|
|
934
954
|
type: "button",
|
|
@@ -937,10 +957,10 @@ function SessionQueuePanel({
|
|
|
937
957
|
disabled: busy || !pending,
|
|
938
958
|
onClick: () => startEdit(item),
|
|
939
959
|
className: ICON_BUTTON,
|
|
940
|
-
children: /* @__PURE__ */
|
|
960
|
+
children: /* @__PURE__ */ jsx4(Pencil, { size: 13, "aria-hidden": "true" })
|
|
941
961
|
}
|
|
942
962
|
),
|
|
943
|
-
/* @__PURE__ */
|
|
963
|
+
/* @__PURE__ */ jsx4(
|
|
944
964
|
"button",
|
|
945
965
|
{
|
|
946
966
|
type: "button",
|
|
@@ -949,7 +969,7 @@ function SessionQueuePanel({
|
|
|
949
969
|
disabled: busy || !canCancelQueuedMessage(item),
|
|
950
970
|
onClick: () => onCancel(item),
|
|
951
971
|
className: ICON_BUTTON,
|
|
952
|
-
children: /* @__PURE__ */
|
|
972
|
+
children: /* @__PURE__ */ jsx4(Trash2, { size: 13, "aria-hidden": "true" })
|
|
953
973
|
}
|
|
954
974
|
)
|
|
955
975
|
] })
|
|
@@ -965,7 +985,7 @@ function SessionQueuePanel({
|
|
|
965
985
|
|
|
966
986
|
// src/chat/ConnectionBanner.tsx
|
|
967
987
|
import { useEffect as useEffect3, useRef as useRef3, useState as useState5 } from "react";
|
|
968
|
-
import { jsx as
|
|
988
|
+
import { jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
969
989
|
var CONNECTION_NOTICE_DELAY_MS = 3e3;
|
|
970
990
|
var CONNECTION_ERROR_DELAY_MS = 15e3;
|
|
971
991
|
function useConnectionNoticePhase(connected) {
|
|
@@ -1015,14 +1035,14 @@ function useConnectionNoticePhase(connected) {
|
|
|
1015
1035
|
function getBannerCopy(phase, hasEverConnected) {
|
|
1016
1036
|
if (phase === "recovering") {
|
|
1017
1037
|
return {
|
|
1018
|
-
icon: /* @__PURE__ */
|
|
1038
|
+
icon: /* @__PURE__ */ jsx5(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
1019
1039
|
toneClass: "border-[hsl(var(--swf-warning)/0.25)] bg-[hsl(var(--swf-warning-soft))] text-[hsl(var(--swf-warning))]",
|
|
1020
1040
|
title: hasEverConnected ? "\u6B63\u5728\u6062\u590D\u8FDE\u63A5\u2026" : "\u6B63\u5728\u8FDE\u63A5\u2026",
|
|
1021
1041
|
detail: "\u6062\u590D\u540E\u4F1A\u81EA\u52A8\u540C\u6B65\u6700\u65B0\u6D88\u606F\uFF0C\u8BF7\u7A0D\u5019"
|
|
1022
1042
|
};
|
|
1023
1043
|
}
|
|
1024
1044
|
return {
|
|
1025
|
-
icon: /* @__PURE__ */
|
|
1045
|
+
icon: /* @__PURE__ */ jsx5(TriangleAlert, { size: 14 }),
|
|
1026
1046
|
toneClass: "border-[hsl(var(--swf-danger)/0.25)] bg-[hsl(var(--swf-danger-soft))] text-[hsl(var(--swf-danger))]",
|
|
1027
1047
|
title: hasEverConnected ? "\u6682\u65F6\u65E0\u6CD5\u6062\u590D\u8FDE\u63A5" : "\u6682\u65F6\u65E0\u6CD5\u8FDE\u63A5",
|
|
1028
1048
|
detail: "\u8BF7\u68C0\u67E5\u7F51\u7EDC\u6216\u670D\u52A1\u72B6\u6001\uFF0C\u7CFB\u7EDF\u4F1A\u7EE7\u7EED\u81EA\u52A8\u91CD\u8BD5"
|
|
@@ -1041,7 +1061,7 @@ function ConnectionBanner({
|
|
|
1041
1061
|
const phase = useConnectionNoticePhase(connected);
|
|
1042
1062
|
if (connected || phase === "hidden") return null;
|
|
1043
1063
|
const copy = getBannerCopy(phase, hasEverConnected);
|
|
1044
|
-
return /* @__PURE__ */
|
|
1064
|
+
return /* @__PURE__ */ jsx5("div", { part: "banner", className: cn("blade-chat-banner bg-[hsl(var(--background))] px-5 pt-3", className), children: /* @__PURE__ */ jsxs5(
|
|
1045
1065
|
"div",
|
|
1046
1066
|
{
|
|
1047
1067
|
className: cn(
|
|
@@ -1049,10 +1069,10 @@ function ConnectionBanner({
|
|
|
1049
1069
|
copy.toneClass
|
|
1050
1070
|
),
|
|
1051
1071
|
children: [
|
|
1052
|
-
/* @__PURE__ */
|
|
1053
|
-
/* @__PURE__ */
|
|
1054
|
-
/* @__PURE__ */
|
|
1055
|
-
/* @__PURE__ */
|
|
1072
|
+
/* @__PURE__ */ jsx5("span", { className: "mt-0.5 shrink-0", children: copy.icon }),
|
|
1073
|
+
/* @__PURE__ */ jsxs5("div", { className: "min-w-0", children: [
|
|
1074
|
+
/* @__PURE__ */ jsx5("div", { className: "text-sm font-medium", children: copy.title }),
|
|
1075
|
+
/* @__PURE__ */ jsx5("div", { className: "text-xs opacity-80", children: copy.detail })
|
|
1056
1076
|
] })
|
|
1057
1077
|
]
|
|
1058
1078
|
}
|
|
@@ -1067,7 +1087,7 @@ import React, { lazy, Suspense, useId, useLayoutEffect as useLayoutEffect2, useR
|
|
|
1067
1087
|
|
|
1068
1088
|
// src/chat/RenderErrorBoundary.tsx
|
|
1069
1089
|
import { Component } from "react";
|
|
1070
|
-
import { jsx as
|
|
1090
|
+
import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1071
1091
|
function getFirstComponentName(componentStack) {
|
|
1072
1092
|
const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
|
|
1073
1093
|
return match?.[1] ?? null;
|
|
@@ -1100,32 +1120,32 @@ var RenderErrorBoundary = class extends Component {
|
|
|
1100
1120
|
return children;
|
|
1101
1121
|
}
|
|
1102
1122
|
const componentName = getFirstComponentName(componentStack);
|
|
1103
|
-
return /* @__PURE__ */
|
|
1104
|
-
/* @__PURE__ */
|
|
1105
|
-
/* @__PURE__ */
|
|
1106
|
-
/* @__PURE__ */
|
|
1123
|
+
return /* @__PURE__ */ jsx6("div", { className: "blade-chat-render-error rounded-xl border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-4 py-3 text-sm text-[hsl(var(--foreground))]", children: /* @__PURE__ */ jsxs6("div", { className: "flex items-start gap-2", children: [
|
|
1124
|
+
/* @__PURE__ */ jsx6(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-[hsl(var(--swf-warning))]" }),
|
|
1125
|
+
/* @__PURE__ */ jsxs6("div", { className: "min-w-0 flex-1", children: [
|
|
1126
|
+
/* @__PURE__ */ jsxs6("div", { className: "font-medium", children: [
|
|
1107
1127
|
label,
|
|
1108
1128
|
"\u6E32\u67D3\u5931\u8D25"
|
|
1109
1129
|
] }),
|
|
1110
|
-
/* @__PURE__ */
|
|
1130
|
+
/* @__PURE__ */ jsxs6("div", { className: "mt-1 break-words text-xs leading-5 text-[hsl(var(--secondary-foreground))]", children: [
|
|
1111
1131
|
componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
|
|
1112
1132
|
error.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
|
|
1113
1133
|
] }),
|
|
1114
|
-
details ? /* @__PURE__ */
|
|
1134
|
+
details ? /* @__PURE__ */ jsx6("div", { className: "mt-1 truncate text-xs text-[hsl(var(--muted-foreground))]", children: details }) : null
|
|
1115
1135
|
] })
|
|
1116
1136
|
] }) });
|
|
1117
1137
|
}
|
|
1118
1138
|
};
|
|
1119
1139
|
|
|
1120
1140
|
// src/chat/plan/PlanSurface.tsx
|
|
1121
|
-
import { Fragment as
|
|
1141
|
+
import { Fragment as Fragment4, jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1122
1142
|
var PlanGraph = lazy(async () => {
|
|
1123
1143
|
const { createPlanGraph } = await import("./PlanGraph-WTXKSHID.js");
|
|
1124
1144
|
return { default: await createPlanGraph(React) };
|
|
1125
1145
|
});
|
|
1126
1146
|
var STALE_APPROVAL_ERROR = "\u8BA1\u5212\u5DF2\u66F4\u65B0\uFF0C\u8BF7\u91CD\u65B0\u786E\u8BA4";
|
|
1127
1147
|
function PlanCanvas({ plan, historical, agentActions }) {
|
|
1128
|
-
return /* @__PURE__ */
|
|
1148
|
+
return /* @__PURE__ */ jsx7(RenderErrorBoundary, { label: "\u8BA1\u5212", children: /* @__PURE__ */ jsx7(Suspense, { fallback: /* @__PURE__ */ jsx7("output", { className: "blade-plan-loading", children: "\u6B63\u5728\u52A0\u8F7D\u8BA1\u5212\u2026" }), children: /* @__PURE__ */ jsx7(PlanGraph, { plan, historical, agentActions }, plan.plan_id) }) });
|
|
1129
1149
|
}
|
|
1130
1150
|
function ActivePlanSurface({ plan, sidebar, session, agentActions, onOpenPanel }) {
|
|
1131
1151
|
const queue = useSessionState(session?.sessionId, (state2) => plan.phase === "draft" && session ? state2.queue : void 0);
|
|
@@ -1166,13 +1186,13 @@ function ActivePlanSurface({ plan, sidebar, session, agentActions, onOpenPanel }
|
|
|
1166
1186
|
setSubmitting(false);
|
|
1167
1187
|
}
|
|
1168
1188
|
}
|
|
1169
|
-
const approvalButton = plan.phase === "draft" && session ? /* @__PURE__ */
|
|
1170
|
-
const approvalStatus = plan.phase === "draft" && session ? approvalError ? /* @__PURE__ */
|
|
1171
|
-
const approval = approvalButton && /* @__PURE__ */
|
|
1189
|
+
const approvalButton = plan.phase === "draft" && session ? /* @__PURE__ */ jsx7("button", { type: "button", className: "blade-plan-approve-btn", onClick: () => void approve(), disabled: submitting || pendingApproval, children: submitting ? "\u6B63\u5728\u63D0\u4EA4\u2026" : "\u786E\u8BA4\u5E76\u5F00\u59CB\u6267\u884C" }) : null;
|
|
1190
|
+
const approvalStatus = plan.phase === "draft" && session ? approvalError ? /* @__PURE__ */ jsx7("span", { role: "alert", children: approvalError }) : receipt?.status === "accepted" ? /* @__PURE__ */ jsx7("output", { children: "\u5DF2\u63D0\u4EA4\uFF0C\u7B49\u5F85\u5F00\u59CB\u6267\u884C" }) : null : null;
|
|
1191
|
+
const approval = approvalButton && /* @__PURE__ */ jsxs7("div", { className: "blade-plan-approval", children: [
|
|
1172
1192
|
approvalButton,
|
|
1173
1193
|
approvalStatus
|
|
1174
1194
|
] });
|
|
1175
|
-
return /* @__PURE__ */
|
|
1195
|
+
return /* @__PURE__ */ jsx7(
|
|
1176
1196
|
PlanSurface,
|
|
1177
1197
|
{
|
|
1178
1198
|
plan,
|
|
@@ -1208,26 +1228,26 @@ function PlanSurface({ plan, historical = false, sidebar = false, approval, appr
|
|
|
1208
1228
|
if (opensPanel) onOpenPanel?.();
|
|
1209
1229
|
else setExpanded(true);
|
|
1210
1230
|
};
|
|
1211
|
-
return /* @__PURE__ */
|
|
1212
|
-
inlineApproval ? /* @__PURE__ */
|
|
1213
|
-
/* @__PURE__ */
|
|
1214
|
-
/* @__PURE__ */
|
|
1231
|
+
return /* @__PURE__ */ jsxs7("section", { className: "blade-plan-surface", "aria-label": title, "data-sidebar": sidebar || void 0, children: [
|
|
1232
|
+
inlineApproval ? /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1233
|
+
/* @__PURE__ */ jsxs7("div", { className: "blade-plan-header-row", children: [
|
|
1234
|
+
/* @__PURE__ */ jsx7(
|
|
1215
1235
|
"button",
|
|
1216
1236
|
{
|
|
1217
1237
|
type: "button",
|
|
1218
1238
|
className: "blade-plan-header",
|
|
1219
1239
|
"aria-haspopup": opensPanel ? void 0 : "dialog",
|
|
1220
1240
|
onClick: handleOpen,
|
|
1221
|
-
children: /* @__PURE__ */
|
|
1222
|
-
/* @__PURE__ */
|
|
1223
|
-
/* @__PURE__ */
|
|
1224
|
-
current && /* @__PURE__ */
|
|
1241
|
+
children: /* @__PURE__ */ jsxs7("span", { className: "blade-plan-heading", children: [
|
|
1242
|
+
/* @__PURE__ */ jsx7("span", { className: "blade-plan-caption", children: title }),
|
|
1243
|
+
/* @__PURE__ */ jsx7("strong", { children: plan.title }),
|
|
1244
|
+
current && /* @__PURE__ */ jsx7("span", { className: "blade-plan-current", children: current.label })
|
|
1225
1245
|
] })
|
|
1226
1246
|
}
|
|
1227
1247
|
),
|
|
1228
|
-
/* @__PURE__ */
|
|
1248
|
+
/* @__PURE__ */ jsxs7("div", { className: "blade-plan-header-actions", children: [
|
|
1229
1249
|
approvalButton,
|
|
1230
|
-
!opensPanel && /* @__PURE__ */
|
|
1250
|
+
!opensPanel && /* @__PURE__ */ jsx7(
|
|
1231
1251
|
"button",
|
|
1232
1252
|
{
|
|
1233
1253
|
type: "button",
|
|
@@ -1235,13 +1255,13 @@ function PlanSurface({ plan, historical = false, sidebar = false, approval, appr
|
|
|
1235
1255
|
"aria-label": "\u5C55\u5F00\u8BA1\u5212",
|
|
1236
1256
|
"aria-haspopup": "dialog",
|
|
1237
1257
|
onClick: handleOpen,
|
|
1238
|
-
children: /* @__PURE__ */
|
|
1258
|
+
children: /* @__PURE__ */ jsx7(Maximize2, { size: 15, "aria-hidden": "true" })
|
|
1239
1259
|
}
|
|
1240
1260
|
)
|
|
1241
1261
|
] })
|
|
1242
1262
|
] }),
|
|
1243
|
-
approvalStatus && /* @__PURE__ */
|
|
1244
|
-
] }) : /* @__PURE__ */
|
|
1263
|
+
approvalStatus && /* @__PURE__ */ jsx7("div", { className: "blade-plan-approval", children: approvalStatus })
|
|
1264
|
+
] }) : /* @__PURE__ */ jsxs7(
|
|
1245
1265
|
"button",
|
|
1246
1266
|
{
|
|
1247
1267
|
type: "button",
|
|
@@ -1249,41 +1269,41 @@ function PlanSurface({ plan, historical = false, sidebar = false, approval, appr
|
|
|
1249
1269
|
"aria-haspopup": opensPanel ? void 0 : "dialog",
|
|
1250
1270
|
onClick: handleOpen,
|
|
1251
1271
|
children: [
|
|
1252
|
-
/* @__PURE__ */
|
|
1253
|
-
/* @__PURE__ */
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
!inlineGraph && current && /* @__PURE__ */
|
|
1272
|
+
/* @__PURE__ */ jsxs7("span", { className: "blade-plan-heading", children: [
|
|
1273
|
+
/* @__PURE__ */ jsx7("span", { className: "blade-plan-caption", children: title }),
|
|
1274
|
+
/* @__PURE__ */ jsx7("strong", { children: plan.title }),
|
|
1275
|
+
!inlineGraph && current && /* @__PURE__ */ jsx7("span", { className: "blade-plan-current", children: current.label })
|
|
1256
1276
|
] }),
|
|
1257
|
-
plan.phase !== "draft" && /* @__PURE__ */
|
|
1277
|
+
plan.phase !== "draft" && /* @__PURE__ */ jsxs7("span", { className: "blade-plan-count", children: [
|
|
1258
1278
|
done,
|
|
1259
1279
|
"/",
|
|
1260
1280
|
leaves.length,
|
|
1261
1281
|
" \u5DF2\u5B8C\u6210",
|
|
1262
|
-
/* @__PURE__ */
|
|
1282
|
+
/* @__PURE__ */ jsx7("progress", { max: Math.max(1, leaves.length), value: done, "aria-label": "\u5B8C\u6210\u8FDB\u5EA6" })
|
|
1263
1283
|
] }),
|
|
1264
|
-
!opensPanel && /* @__PURE__ */
|
|
1284
|
+
!opensPanel && /* @__PURE__ */ jsx7(Maximize2, { size: 15, "aria-label": "\u5C55\u5F00\u8BA1\u5212" })
|
|
1265
1285
|
]
|
|
1266
1286
|
}
|
|
1267
1287
|
),
|
|
1268
|
-
inlineGraph && /* @__PURE__ */
|
|
1288
|
+
inlineGraph && /* @__PURE__ */ jsx7("div", { className: "blade-plan-inline", children: /* @__PURE__ */ jsx7(PlanCanvas, { plan, historical: false, agentActions }) }),
|
|
1269
1289
|
!expanded && !inlineApproval && approval,
|
|
1270
|
-
!opensPanel && /* @__PURE__ */
|
|
1271
|
-
/* @__PURE__ */
|
|
1272
|
-
/* @__PURE__ */
|
|
1273
|
-
/* @__PURE__ */
|
|
1290
|
+
!opensPanel && /* @__PURE__ */ jsx7("dialog", { ref: dialogRef, className: "blade-plan-dialog", "aria-labelledby": titleId, onClose: () => setExpanded(false), children: expanded && /* @__PURE__ */ jsxs7(Fragment4, { children: [
|
|
1291
|
+
/* @__PURE__ */ jsxs7("header", { className: "blade-plan-dialog-header", children: [
|
|
1292
|
+
/* @__PURE__ */ jsx7("h2", { id: titleId, children: plan.title }),
|
|
1293
|
+
/* @__PURE__ */ jsx7("button", { type: "button", "aria-label": "\u5173\u95ED\u8BA1\u5212", onClick: () => {
|
|
1274
1294
|
const dialog = dialogRef.current;
|
|
1275
1295
|
if (typeof dialog?.close === "function") dialog.close();
|
|
1276
1296
|
else dialog?.removeAttribute("open");
|
|
1277
1297
|
setExpanded(false);
|
|
1278
|
-
}, children: /* @__PURE__ */
|
|
1298
|
+
}, children: /* @__PURE__ */ jsx7(X, { size: 20 }) })
|
|
1279
1299
|
] }),
|
|
1280
|
-
/* @__PURE__ */
|
|
1300
|
+
/* @__PURE__ */ jsx7(PlanCanvas, { plan, historical, agentActions }),
|
|
1281
1301
|
approval
|
|
1282
1302
|
] }) })
|
|
1283
1303
|
] });
|
|
1284
1304
|
}
|
|
1285
1305
|
function PlanHistoryCard({ plan }) {
|
|
1286
|
-
return /* @__PURE__ */
|
|
1306
|
+
return /* @__PURE__ */ jsx7(PlanSurface, { plan, historical: true });
|
|
1287
1307
|
}
|
|
1288
1308
|
function SessionPlan({ sessionId, sidebar = false, readOnly = false }) {
|
|
1289
1309
|
const session = useSessionHandle(sessionId);
|
|
@@ -1294,7 +1314,7 @@ function SessionPlan({ sessionId, sidebar = false, readOnly = false }) {
|
|
|
1294
1314
|
if (!plan) return null;
|
|
1295
1315
|
const viewer = readOnly || (viewerRole ?? detail?.viewer_role) === "viewer";
|
|
1296
1316
|
const onOpenPanel = !sidebar && !viewer && openPlanPanel ? () => openPlanPanel(sessionId) : void 0;
|
|
1297
|
-
return /* @__PURE__ */
|
|
1317
|
+
return /* @__PURE__ */ jsx7(
|
|
1298
1318
|
ActivePlanSurface,
|
|
1299
1319
|
{
|
|
1300
1320
|
plan,
|
|
@@ -1319,11 +1339,11 @@ function useChatCustomization() {
|
|
|
1319
1339
|
}
|
|
1320
1340
|
|
|
1321
1341
|
// src/chat/CurrentPlanPanel.tsx
|
|
1322
|
-
import { Fragment as
|
|
1342
|
+
import { Fragment as Fragment5, jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1323
1343
|
function PlanUpdatingNotice() {
|
|
1324
|
-
return /* @__PURE__ */
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1344
|
+
return /* @__PURE__ */ jsxs8("div", { className: "mb-2 flex items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
1345
|
+
/* @__PURE__ */ jsx8(LoaderCircle, { size: 14, className: "shrink-0 animate-spin" }),
|
|
1346
|
+
/* @__PURE__ */ jsx8("span", { children: "\u6B63\u5728\u66F4\u65B0\u4EFB\u52A1\u8FDB\u5EA6\u2026" })
|
|
1327
1347
|
] });
|
|
1328
1348
|
}
|
|
1329
1349
|
function CurrentPlanPanelContent({
|
|
@@ -1336,9 +1356,9 @@ function CurrentPlanPanelContent({
|
|
|
1336
1356
|
const { current, updating } = getPlanUpdateDisplayState(messages);
|
|
1337
1357
|
if (hideTodo) return null;
|
|
1338
1358
|
if (!current && !updating) return null;
|
|
1339
|
-
return /* @__PURE__ */
|
|
1340
|
-
updating ? /* @__PURE__ */
|
|
1341
|
-
current ? /* @__PURE__ */
|
|
1359
|
+
return /* @__PURE__ */ jsxs8(Fragment5, { children: [
|
|
1360
|
+
updating ? /* @__PURE__ */ jsx8(PlanUpdatingNotice, {}) : null,
|
|
1361
|
+
current ? /* @__PURE__ */ jsx8(
|
|
1342
1362
|
PlanUpdateBlock,
|
|
1343
1363
|
{
|
|
1344
1364
|
toolCall: current,
|
|
@@ -1378,11 +1398,11 @@ function CurrentPlanPanel({
|
|
|
1378
1398
|
const customPlan = parsedPlan ? renderPlan?.({ plan: parsedPlan, running: isStreaming, sessionId }) : null;
|
|
1379
1399
|
if (activePlan) {
|
|
1380
1400
|
if (hideTodo && activePlan.phase !== "draft") return null;
|
|
1381
|
-
return /* @__PURE__ */
|
|
1401
|
+
return /* @__PURE__ */ jsx8("div", { part: "plan", "data-plan-surface-slot": "true", className: cn("blade-chat-plan py-2 empty:hidden", className), children: /* @__PURE__ */ jsx8(SessionPlan, { sessionId, readOnly }) });
|
|
1382
1402
|
}
|
|
1383
1403
|
if (hideTodo || !hasPlanUpdate) return null;
|
|
1384
|
-
if (customPlan != null) return /* @__PURE__ */
|
|
1385
|
-
return /* @__PURE__ */
|
|
1404
|
+
if (customPlan != null) return /* @__PURE__ */ jsx8(Fragment5, { children: customPlan });
|
|
1405
|
+
return /* @__PURE__ */ jsx8("div", { part: "plan", className: cn("blade-chat-plan", className), children: /* @__PURE__ */ jsx8(
|
|
1386
1406
|
CurrentPlanPanelContent,
|
|
1387
1407
|
{
|
|
1388
1408
|
messages,
|
|
@@ -1396,7 +1416,7 @@ function CurrentPlanPanel({
|
|
|
1396
1416
|
|
|
1397
1417
|
// src/chat/chat-column-width.tsx
|
|
1398
1418
|
import { useCallback as useCallback2, useEffect as useEffect5, useRef as useRef6, useState as useState7, useSyncExternalStore as useSyncExternalStore2 } from "react";
|
|
1399
|
-
import { jsx as
|
|
1419
|
+
import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1400
1420
|
var CHAT_COLUMN_WIDTH_STORAGE_KEY = "blade-ui:chat-column-width";
|
|
1401
1421
|
var DEFAULT_CHAT_COLUMN_WIDTH = 780;
|
|
1402
1422
|
var MIN_CHAT_COLUMN_WIDTH = 640;
|
|
@@ -1509,7 +1529,7 @@ function ChatColumnResizeRails({
|
|
|
1509
1529
|
const renderRail = (side) => {
|
|
1510
1530
|
const isDragging = draggingSide === side;
|
|
1511
1531
|
const offsetStyle = side === "left" ? { left: `calc(50% - ${Math.round(effectiveWidth / 2)}px - 22px)` } : { left: `calc(50% + ${Math.round(effectiveWidth / 2)}px + 10px)` };
|
|
1512
|
-
return /* @__PURE__ */
|
|
1532
|
+
return /* @__PURE__ */ jsx9(
|
|
1513
1533
|
"div",
|
|
1514
1534
|
{
|
|
1515
1535
|
role: "slider",
|
|
@@ -1588,7 +1608,7 @@ function ChatColumnResizeRails({
|
|
|
1588
1608
|
className: cn(
|
|
1589
1609
|
"group/rail pointer-events-auto absolute inset-y-4 z-20 hidden w-3 cursor-col-resize select-none touch-none items-start justify-center lg:flex"
|
|
1590
1610
|
),
|
|
1591
|
-
children: /* @__PURE__ */
|
|
1611
|
+
children: /* @__PURE__ */ jsx9(
|
|
1592
1612
|
"span",
|
|
1593
1613
|
{
|
|
1594
1614
|
ref: side === "left" ? leftIndicatorRef : rightIndicatorRef,
|
|
@@ -1604,7 +1624,7 @@ function ChatColumnResizeRails({
|
|
|
1604
1624
|
side
|
|
1605
1625
|
);
|
|
1606
1626
|
};
|
|
1607
|
-
return /* @__PURE__ */
|
|
1627
|
+
return /* @__PURE__ */ jsxs9("div", { "aria-hidden": false, className: "pointer-events-none absolute inset-0 z-20 overflow-hidden", children: [
|
|
1608
1628
|
renderRail("left"),
|
|
1609
1629
|
renderRail("right")
|
|
1610
1630
|
] });
|
|
@@ -1653,7 +1673,7 @@ import { BladeApiError, normalizePluginRefs } from "@blade-hq/agent-client";
|
|
|
1653
1673
|
|
|
1654
1674
|
// src/components/ChatInput.tsx
|
|
1655
1675
|
import { useRef as useRef7, useState as useState8 } from "react";
|
|
1656
|
-
import { Fragment as
|
|
1676
|
+
import { Fragment as Fragment6, jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
1657
1677
|
function isImeCompositionKey(event) {
|
|
1658
1678
|
return event.isComposing || event.keyCode === 229;
|
|
1659
1679
|
}
|
|
@@ -1715,7 +1735,7 @@ function ChatInput({
|
|
|
1715
1735
|
void handleSend(isQueueShortcut(event));
|
|
1716
1736
|
}
|
|
1717
1737
|
};
|
|
1718
|
-
return /* @__PURE__ */
|
|
1738
|
+
return /* @__PURE__ */ jsxs10(
|
|
1719
1739
|
"div",
|
|
1720
1740
|
{
|
|
1721
1741
|
style: mergesWithPanelAbove ? { "--blade-chat-input-top-border": "0" } : void 0,
|
|
@@ -1728,7 +1748,7 @@ function ChatInput({
|
|
|
1728
1748
|
className
|
|
1729
1749
|
),
|
|
1730
1750
|
children: [
|
|
1731
|
-
/* @__PURE__ */
|
|
1751
|
+
/* @__PURE__ */ jsxs10(
|
|
1732
1752
|
"div",
|
|
1733
1753
|
{
|
|
1734
1754
|
part: "input-inner",
|
|
@@ -1738,7 +1758,7 @@ function ChatInput({
|
|
|
1738
1758
|
innerClassName
|
|
1739
1759
|
),
|
|
1740
1760
|
children: [
|
|
1741
|
-
/* @__PURE__ */
|
|
1761
|
+
/* @__PURE__ */ jsx10(
|
|
1742
1762
|
"textarea",
|
|
1743
1763
|
{
|
|
1744
1764
|
value,
|
|
@@ -1760,10 +1780,10 @@ function ChatInput({
|
|
|
1760
1780
|
}
|
|
1761
1781
|
),
|
|
1762
1782
|
attachmentPicker,
|
|
1763
|
-
/* @__PURE__ */
|
|
1764
|
-
queueWhileRunning ? /* @__PURE__ */
|
|
1765
|
-
/* @__PURE__ */
|
|
1766
|
-
] }) : /* @__PURE__ */
|
|
1783
|
+
/* @__PURE__ */ jsx10("div", { part: "input-toolbar", className: cn("blade-chat-input-toolbar flex shrink-0 items-center gap-2", toolbarClassName), children: isStreaming ? /* @__PURE__ */ jsxs10(Fragment6, { children: [
|
|
1784
|
+
queueWhileRunning ? /* @__PURE__ */ jsx10("button", { type: "button", onClick: () => void handleSend(), disabled: !canSend, "aria-label": "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F", title: "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] disabled:opacity-40", children: /* @__PURE__ */ jsx10(ArrowUp, { size: 15 }) }) : null,
|
|
1785
|
+
/* @__PURE__ */ jsx10("button", { type: "button", onClick: onStop, disabled: isStopping, "aria-label": isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u56DE\u590D", title: isStopping ? "\u6B63\u5728\u505C\u6B62" : "\u505C\u6B62\u56DE\u590D", className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--muted))] text-[hsl(var(--foreground))] transition-opacity hover:opacity-90 disabled:opacity-60", children: isStopping ? /* @__PURE__ */ jsx10(LoaderCircle, { size: 14, className: "animate-spin" }) : /* @__PURE__ */ jsx10(Square, { size: 12, fill: "currentColor" }) })
|
|
1786
|
+
] }) : /* @__PURE__ */ jsx10(
|
|
1767
1787
|
"button",
|
|
1768
1788
|
{
|
|
1769
1789
|
type: "button",
|
|
@@ -1772,13 +1792,13 @@ function ChatInput({
|
|
|
1772
1792
|
"aria-label": "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F",
|
|
1773
1793
|
title: "\u53D1\u9001\u5F15\u5BFC\u6D88\u606F",
|
|
1774
1794
|
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-full bg-[hsl(var(--primary))] text-[hsl(var(--primary-foreground))] transition-opacity hover:opacity-90 disabled:cursor-not-allowed disabled:opacity-40",
|
|
1775
|
-
children: /* @__PURE__ */
|
|
1795
|
+
children: /* @__PURE__ */ jsx10(ArrowUp, { size: 15 })
|
|
1776
1796
|
}
|
|
1777
1797
|
) })
|
|
1778
1798
|
]
|
|
1779
1799
|
}
|
|
1780
1800
|
),
|
|
1781
|
-
(isStreaming || isWaitingForInput) && queueWhileRunning && !isStopping && trimmed && canSend && !hasAttachments && /* @__PURE__ */
|
|
1801
|
+
(isStreaming || isWaitingForInput) && queueWhileRunning && !isStopping && trimmed && canSend && !hasAttachments && /* @__PURE__ */ jsxs10("div", { className: "mx-auto mt-1 max-w-[var(--blade-chat-width,780px)] text-right text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
1782
1802
|
queueShortcutLabel(),
|
|
1783
1803
|
" \xB7 \u6392\u961F\u6D88\u606F"
|
|
1784
1804
|
] })
|
|
@@ -1788,7 +1808,7 @@ function ChatInput({
|
|
|
1788
1808
|
}
|
|
1789
1809
|
|
|
1790
1810
|
// src/chat/LightComposer.tsx
|
|
1791
|
-
import { Fragment as
|
|
1811
|
+
import { Fragment as Fragment7, jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
1792
1812
|
function LightComposer({
|
|
1793
1813
|
sessionId,
|
|
1794
1814
|
onSend,
|
|
@@ -1914,31 +1934,31 @@ ${content}`);
|
|
|
1914
1934
|
}
|
|
1915
1935
|
return accepted;
|
|
1916
1936
|
}
|
|
1917
|
-
return /* @__PURE__ */
|
|
1918
|
-
planPanel ? /* @__PURE__ */
|
|
1919
|
-
refs.length ? /* @__PURE__ */
|
|
1937
|
+
return /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
1938
|
+
planPanel ? /* @__PURE__ */ jsx11("div", { className: maxWidthClassName ? `mx-auto w-full ${maxWidthClassName}` : void 0, children: planPanel }) : null,
|
|
1939
|
+
refs.length ? /* @__PURE__ */ jsx11("div", { "aria-label": "\u9009\u62E9\u7684\u63D2\u4EF6\u6761\u76EE", className: "flex flex-wrap gap-2 px-3 pt-2", children: refs.map((ref) => /* @__PURE__ */ jsxs11("span", { className: "rounded bg-[hsl(var(--muted))] px-2 py-1 text-xs", children: [
|
|
1920
1940
|
ref.label,
|
|
1921
|
-
/* @__PURE__ */
|
|
1941
|
+
/* @__PURE__ */ jsx11("button", { type: "button", "aria-label": `\u79FB\u9664${ref.label}`, onClick: () => setRefs((prev) => prev.filter((item) => item !== ref)), children: " \xD7" })
|
|
1922
1942
|
] }, JSON.stringify([ref.plugin, ref.server, ref.id]))) }) : null,
|
|
1923
|
-
query !== null && items.length ? /* @__PURE__ */
|
|
1924
|
-
item.icon ? /* @__PURE__ */
|
|
1943
|
+
query !== null && items.length ? /* @__PURE__ */ jsx11("fieldset", { "aria-label": "\u63D2\u4EF6\u6761\u76EE\u5019\u9009", className: "m-0 min-w-0 border-0 px-3 py-2", children: items.map((item, index) => item.kind === "plugin" ? /* @__PURE__ */ jsxs11("button", { type: "button", "aria-pressed": candidates[selectedIndex] === item, onMouseDown: (event) => event.preventDefault(), onClick: () => select(item), className: `flex w-full items-center gap-2 rounded px-2 py-1 text-sm hover:bg-[hsl(var(--muted))] ${candidates[selectedIndex] === item ? "bg-[hsl(var(--muted))]" : ""}`, children: [
|
|
1944
|
+
item.icon ? /* @__PURE__ */ jsx11("img", { src: item.icon, alt: "", width: 16, height: 16 }) : null,
|
|
1925
1945
|
item.label,
|
|
1926
|
-
/* @__PURE__ */
|
|
1927
|
-
] }, JSON.stringify([item.plugin, item.server, item.id])) : /* @__PURE__ */
|
|
1928
|
-
currentFiles.length > 0 && /* @__PURE__ */
|
|
1929
|
-
/* @__PURE__ */
|
|
1930
|
-
file.error ? /* @__PURE__ */
|
|
1931
|
-
/* @__PURE__ */
|
|
1946
|
+
/* @__PURE__ */ jsx11("span", { className: "ml-auto text-xs text-[hsl(var(--muted-foreground))]", children: item.display_name })
|
|
1947
|
+
] }, JSON.stringify([item.plugin, item.server, item.id])) : /* @__PURE__ */ jsx11("div", { className: "text-xs", children: item.message }, index)) }) : null,
|
|
1948
|
+
currentFiles.length > 0 && /* @__PURE__ */ jsx11("ul", { "aria-label": "\u5F85\u53D1\u9001\u9644\u4EF6", className: "flex flex-wrap gap-2 px-4 pb-2", children: currentFiles.map((file) => /* @__PURE__ */ jsxs11("li", { className: "flex min-w-0 items-center gap-2 rounded-md bg-[hsl(var(--muted))] px-2 py-1 text-xs", children: [
|
|
1949
|
+
/* @__PURE__ */ jsx11("span", { className: "truncate", title: file.name, children: file.name }),
|
|
1950
|
+
file.error ? /* @__PURE__ */ jsx11("span", { role: "alert", children: file.error }) : !file.path ? /* @__PURE__ */ jsx11("output", { children: "\u4E0A\u4F20\u4E2D\u2026" }) : null,
|
|
1951
|
+
/* @__PURE__ */ jsx11(
|
|
1932
1952
|
"button",
|
|
1933
1953
|
{
|
|
1934
1954
|
type: "button",
|
|
1935
1955
|
"aria-label": `\u79FB\u9664\u9644\u4EF6 ${file.name}`,
|
|
1936
1956
|
onClick: () => setFiles((previous) => previous.filter((item) => item.id !== file.id)),
|
|
1937
|
-
children: /* @__PURE__ */
|
|
1957
|
+
children: /* @__PURE__ */ jsx11(X, { size: 14, "aria-hidden": "true" })
|
|
1938
1958
|
}
|
|
1939
1959
|
)
|
|
1940
1960
|
] }, file.id)) }),
|
|
1941
|
-
/* @__PURE__ */
|
|
1961
|
+
/* @__PURE__ */ jsx11(
|
|
1942
1962
|
ChatInput,
|
|
1943
1963
|
{
|
|
1944
1964
|
value,
|
|
@@ -1946,8 +1966,8 @@ ${content}`);
|
|
|
1946
1966
|
onSend: send,
|
|
1947
1967
|
hasAttachments: refs.length > 0 || currentFiles.length > 0,
|
|
1948
1968
|
attachmentsBlocked,
|
|
1949
|
-
attachmentPicker: sessionId && /* @__PURE__ */
|
|
1950
|
-
onToggleMode && /* @__PURE__ */
|
|
1969
|
+
attachmentPicker: sessionId && /* @__PURE__ */ jsxs11(Fragment7, { children: [
|
|
1970
|
+
onToggleMode && /* @__PURE__ */ jsx11(
|
|
1951
1971
|
"button",
|
|
1952
1972
|
{
|
|
1953
1973
|
type: "button",
|
|
@@ -1957,7 +1977,7 @@ ${content}`);
|
|
|
1957
1977
|
children: "\u89C4\u5212"
|
|
1958
1978
|
}
|
|
1959
1979
|
),
|
|
1960
|
-
/* @__PURE__ */
|
|
1980
|
+
/* @__PURE__ */ jsx11(
|
|
1961
1981
|
"input",
|
|
1962
1982
|
{
|
|
1963
1983
|
ref: fileInput,
|
|
@@ -1971,7 +1991,7 @@ ${content}`);
|
|
|
1971
1991
|
}
|
|
1972
1992
|
}
|
|
1973
1993
|
),
|
|
1974
|
-
/* @__PURE__ */
|
|
1994
|
+
/* @__PURE__ */ jsx11(
|
|
1975
1995
|
"button",
|
|
1976
1996
|
{
|
|
1977
1997
|
type: "button",
|
|
@@ -1979,7 +1999,7 @@ ${content}`);
|
|
|
1979
1999
|
title: "\u6DFB\u52A0\u9644\u4EF6",
|
|
1980
2000
|
onClick: () => fileInput.current?.click(),
|
|
1981
2001
|
className: "flex h-8 w-8 shrink-0 items-center justify-center rounded-md hover:bg-[hsl(var(--muted))]",
|
|
1982
|
-
children: /* @__PURE__ */
|
|
2002
|
+
children: /* @__PURE__ */ jsx11(Paperclip, { size: 16, "aria-hidden": "true" })
|
|
1983
2003
|
}
|
|
1984
2004
|
)
|
|
1985
2005
|
] }),
|
|
@@ -2020,7 +2040,7 @@ import { useEffect as useEffect7, useState as useState10 } from "react";
|
|
|
2020
2040
|
|
|
2021
2041
|
// src/chat/ai-elements/shimmer.tsx
|
|
2022
2042
|
import { memo, useMemo as useMemo3 } from "react";
|
|
2023
|
-
import { jsx as
|
|
2043
|
+
import { jsx as jsx12 } from "react/jsx-runtime";
|
|
2024
2044
|
var ShimmerComponent = ({
|
|
2025
2045
|
children,
|
|
2026
2046
|
as: Component2 = "span",
|
|
@@ -2032,7 +2052,7 @@ var ShimmerComponent = ({
|
|
|
2032
2052
|
() => Math.max(28, Math.round((children?.length ?? 0) * spread)),
|
|
2033
2053
|
[children, spread]
|
|
2034
2054
|
);
|
|
2035
|
-
return /* @__PURE__ */
|
|
2055
|
+
return /* @__PURE__ */ jsx12(
|
|
2036
2056
|
Component2,
|
|
2037
2057
|
{
|
|
2038
2058
|
className: cn(
|
|
@@ -2053,7 +2073,7 @@ var ShimmerComponent = ({
|
|
|
2053
2073
|
var Shimmer = memo(ShimmerComponent);
|
|
2054
2074
|
|
|
2055
2075
|
// src/chat/ChatLoadingIndicator.tsx
|
|
2056
|
-
import { jsx as
|
|
2076
|
+
import { jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2057
2077
|
function isPreparingReply(messages) {
|
|
2058
2078
|
for (let index = messages.length - 1; index >= 0; index -= 1) {
|
|
2059
2079
|
const message = messages[index];
|
|
@@ -2109,23 +2129,23 @@ function ChatLoadingIndicator({
|
|
|
2109
2129
|
}, [originMs, nowMs, useRunClock]);
|
|
2110
2130
|
const elapsedMs = Math.max(0, nowMs - originMs);
|
|
2111
2131
|
const label = resolveLoadingStageLabel({ preparing, elapsedMs, activeToolLabel });
|
|
2112
|
-
return /* @__PURE__ */
|
|
2132
|
+
return /* @__PURE__ */ jsxs12(
|
|
2113
2133
|
"output",
|
|
2114
2134
|
{
|
|
2115
2135
|
"data-testid": "chat-loading-indicator",
|
|
2116
2136
|
className: "flex min-h-[38px] items-center gap-2.5 px-1.5 py-1 text-xs text-[hsl(var(--muted-foreground))]",
|
|
2117
2137
|
"aria-live": "polite",
|
|
2118
2138
|
children: [
|
|
2119
|
-
/* @__PURE__ */
|
|
2139
|
+
/* @__PURE__ */ jsx13(
|
|
2120
2140
|
"span",
|
|
2121
2141
|
{
|
|
2122
2142
|
className: "blade-loading-pulse flex h-5 w-5 shrink-0 items-center justify-center rounded-md bg-[hsl(var(--primary)/0.12)] text-[hsl(var(--primary))]",
|
|
2123
2143
|
"aria-hidden": "true",
|
|
2124
|
-
children: /* @__PURE__ */
|
|
2144
|
+
children: /* @__PURE__ */ jsx13(Sparkles, { size: 12 })
|
|
2125
2145
|
}
|
|
2126
2146
|
),
|
|
2127
|
-
/* @__PURE__ */
|
|
2128
|
-
/* @__PURE__ */
|
|
2147
|
+
/* @__PURE__ */ jsx13(Shimmer, { as: "span", className: "min-w-0 truncate text-[13px] font-medium leading-5", children: label }),
|
|
2148
|
+
/* @__PURE__ */ jsx13(
|
|
2129
2149
|
"span",
|
|
2130
2150
|
{
|
|
2131
2151
|
"data-testid": "chat-loading-elapsed",
|
|
@@ -2574,18 +2594,18 @@ function useStickToBottomContext() {
|
|
|
2574
2594
|
}
|
|
2575
2595
|
|
|
2576
2596
|
// src/components/BackgroundWakeNotice.tsx
|
|
2577
|
-
import { jsx as
|
|
2597
|
+
import { jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2578
2598
|
function BackgroundWakeNotice() {
|
|
2579
|
-
return /* @__PURE__ */
|
|
2599
|
+
return /* @__PURE__ */ jsxs13(
|
|
2580
2600
|
"div",
|
|
2581
2601
|
{
|
|
2582
2602
|
"data-background-wakeup": true,
|
|
2583
2603
|
className: "my-3 flex items-start gap-2 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
2584
2604
|
children: [
|
|
2585
|
-
/* @__PURE__ */
|
|
2586
|
-
/* @__PURE__ */
|
|
2587
|
-
/* @__PURE__ */
|
|
2588
|
-
/* @__PURE__ */
|
|
2605
|
+
/* @__PURE__ */ jsx14(BellRing, { size: 14, className: "mt-0.5 shrink-0", "aria-hidden": "true" }),
|
|
2606
|
+
/* @__PURE__ */ jsxs13("div", { children: [
|
|
2607
|
+
/* @__PURE__ */ jsx14("p", { className: "font-medium", children: "\u540E\u53F0\u4EFB\u52A1\u5DF2\u7ED3\u675F" }),
|
|
2608
|
+
/* @__PURE__ */ jsx14("p", { className: "mt-0.5", children: "\u52A9\u624B\u5DF2\u81EA\u52A8\u7EE7\u7EED\u5904\u7406\u7ED3\u679C" })
|
|
2589
2609
|
] })
|
|
2590
2610
|
]
|
|
2591
2611
|
}
|
|
@@ -2593,11 +2613,11 @@ function BackgroundWakeNotice() {
|
|
|
2593
2613
|
}
|
|
2594
2614
|
|
|
2595
2615
|
// src/components/PackEventNotice.tsx
|
|
2596
|
-
import { jsx as
|
|
2616
|
+
import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2597
2617
|
function PackEventNotice({ title }) {
|
|
2598
|
-
return /* @__PURE__ */
|
|
2599
|
-
/* @__PURE__ */
|
|
2600
|
-
/* @__PURE__ */
|
|
2618
|
+
return /* @__PURE__ */ jsxs14("div", { "data-pack-event": true, className: "my-3 flex items-center gap-2 rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
2619
|
+
/* @__PURE__ */ jsx15(BellRing, { size: 14, className: "shrink-0", "aria-hidden": "true" }),
|
|
2620
|
+
/* @__PURE__ */ jsx15("span", { children: title })
|
|
2601
2621
|
] });
|
|
2602
2622
|
}
|
|
2603
2623
|
|
|
@@ -3001,7 +3021,7 @@ import { useMemo as useMemo7, useState as useState15 } from "react";
|
|
|
3001
3021
|
import { formatAskUserAnswer } from "@blade-hq/agent-client";
|
|
3002
3022
|
import { useEffect as useEffect11, useMemo as useMemo6, useRef as useRef13, useState as useState14 } from "react";
|
|
3003
3023
|
import { parseAskUserQuestion } from "@blade-hq/agent-client";
|
|
3004
|
-
import { jsx as
|
|
3024
|
+
import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3005
3025
|
var CUSTOM_TEXTAREA_MAX_HEIGHT = 160;
|
|
3006
3026
|
function resizeCustomTextarea(textarea) {
|
|
3007
3027
|
textarea.style.height = "auto";
|
|
@@ -3029,7 +3049,7 @@ function useAutoResizeTextarea(value) {
|
|
|
3029
3049
|
return textareaRef;
|
|
3030
3050
|
}
|
|
3031
3051
|
function AskUserQuestionBlock(props) {
|
|
3032
|
-
return /* @__PURE__ */
|
|
3052
|
+
return /* @__PURE__ */ jsx16(AskUserQuestionCard, { ...props }, props.toolCallId);
|
|
3033
3053
|
}
|
|
3034
3054
|
function AskUserQuestionCard({
|
|
3035
3055
|
data,
|
|
@@ -3156,7 +3176,7 @@ function AskUserQuestionCard({
|
|
|
3156
3176
|
clearTimeout(timer);
|
|
3157
3177
|
}
|
|
3158
3178
|
};
|
|
3159
|
-
return /* @__PURE__ */
|
|
3179
|
+
return /* @__PURE__ */ jsxs15(
|
|
3160
3180
|
"div",
|
|
3161
3181
|
{
|
|
3162
3182
|
part: "ask-card",
|
|
@@ -3165,13 +3185,13 @@ function AskUserQuestionCard({
|
|
|
3165
3185
|
locked ? "max-w-2xl space-y-3 p-3 text-xs text-[hsl(var(--muted-foreground))] opacity-80" : "max-w-lg space-y-5 p-4 text-sm"
|
|
3166
3186
|
),
|
|
3167
3187
|
children: [
|
|
3168
|
-
data.source_loop?.description && /* @__PURE__ */
|
|
3188
|
+
data.source_loop?.description && /* @__PURE__ */ jsxs15("div", { className: "rounded-lg bg-[hsl(var(--muted)/0.35)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
3169
3189
|
"\u5B50\u667A\u80FD\u4F53\u300C",
|
|
3170
3190
|
data.source_loop.description,
|
|
3171
3191
|
"\u300D",
|
|
3172
3192
|
locked ? "\u66FE\u53D1\u8D77\u63D0\u95EE" : "\u5728\u7B49\u5F85\u4F60\u7684\u56DE\u7B54"
|
|
3173
3193
|
] }),
|
|
3174
|
-
data.questions.map((q, qIdx) => /* @__PURE__ */
|
|
3194
|
+
data.questions.map((q, qIdx) => /* @__PURE__ */ jsx16(
|
|
3175
3195
|
QuestionCard,
|
|
3176
3196
|
{
|
|
3177
3197
|
question: q,
|
|
@@ -3186,7 +3206,7 @@ function AskUserQuestionCard({
|
|
|
3186
3206
|
},
|
|
3187
3207
|
q.question
|
|
3188
3208
|
)),
|
|
3189
|
-
/* @__PURE__ */
|
|
3209
|
+
/* @__PURE__ */ jsx16(
|
|
3190
3210
|
NoteField,
|
|
3191
3211
|
{
|
|
3192
3212
|
answered: locked,
|
|
@@ -3195,8 +3215,8 @@ function AskUserQuestionCard({
|
|
|
3195
3215
|
onChange: setNote
|
|
3196
3216
|
}
|
|
3197
3217
|
),
|
|
3198
|
-
!readOnly && locked && !hasAnswer && /* @__PURE__ */
|
|
3199
|
-
!locked && !submitted && /* @__PURE__ */
|
|
3218
|
+
!readOnly && locked && !hasAnswer && /* @__PURE__ */ jsx16("div", { className: "text-xs", children: "\u5DF2\u7ED3\u675F" }),
|
|
3219
|
+
!locked && !submitted && /* @__PURE__ */ jsx16(
|
|
3200
3220
|
"button",
|
|
3201
3221
|
{
|
|
3202
3222
|
type: "button",
|
|
@@ -3206,14 +3226,14 @@ function AskUserQuestionCard({
|
|
|
3206
3226
|
children: allAnswered ? "\u786E\u8BA4" : "\u8BF7\u5148\u9009\u62E9\u4E00\u4E2A\u9009\u9879"
|
|
3207
3227
|
}
|
|
3208
3228
|
),
|
|
3209
|
-
submitted && !locked && /* @__PURE__ */
|
|
3229
|
+
submitted && !locked && /* @__PURE__ */ jsxs15(
|
|
3210
3230
|
"button",
|
|
3211
3231
|
{
|
|
3212
3232
|
type: "button",
|
|
3213
3233
|
disabled: true,
|
|
3214
3234
|
className: "flex w-full items-center justify-center gap-2 rounded-lg bg-[hsl(var(--primary))] px-4 py-2 text-xs font-semibold text-[hsl(var(--primary-foreground))] opacity-80",
|
|
3215
3235
|
children: [
|
|
3216
|
-
/* @__PURE__ */
|
|
3236
|
+
/* @__PURE__ */ jsx16(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
3217
3237
|
"\u786E\u8BA4\u4E2D"
|
|
3218
3238
|
]
|
|
3219
3239
|
}
|
|
@@ -3235,23 +3255,23 @@ function QuestionCard({
|
|
|
3235
3255
|
}) {
|
|
3236
3256
|
const multi = question.multiSelect ?? false;
|
|
3237
3257
|
const customTextareaRef = useAutoResizeTextarea(customText);
|
|
3238
|
-
return /* @__PURE__ */
|
|
3239
|
-
/* @__PURE__ */
|
|
3240
|
-
/* @__PURE__ */
|
|
3258
|
+
return /* @__PURE__ */ jsxs15("div", { children: [
|
|
3259
|
+
/* @__PURE__ */ jsxs15("div", { className: cn("flex items-start gap-2", answered ? "mb-2" : "mb-3"), children: [
|
|
3260
|
+
/* @__PURE__ */ jsx16(
|
|
3241
3261
|
MessageSquareMore,
|
|
3242
3262
|
{
|
|
3243
3263
|
size: answered ? 12 : 13,
|
|
3244
3264
|
className: "mt-0.5 shrink-0 text-[hsl(var(--primary))]"
|
|
3245
3265
|
}
|
|
3246
3266
|
),
|
|
3247
|
-
/* @__PURE__ */
|
|
3267
|
+
/* @__PURE__ */ jsx16(
|
|
3248
3268
|
"div",
|
|
3249
3269
|
{
|
|
3250
3270
|
className: cn(
|
|
3251
3271
|
"min-w-0 flex-1 font-medium text-[hsl(var(--foreground))]",
|
|
3252
3272
|
answered ? "text-xs" : "text-sm"
|
|
3253
3273
|
),
|
|
3254
|
-
children: /* @__PURE__ */
|
|
3274
|
+
children: /* @__PURE__ */ jsx16(
|
|
3255
3275
|
MarkdownContent,
|
|
3256
3276
|
{
|
|
3257
3277
|
className: cn(
|
|
@@ -3265,10 +3285,10 @@ function QuestionCard({
|
|
|
3265
3285
|
}
|
|
3266
3286
|
)
|
|
3267
3287
|
] }),
|
|
3268
|
-
/* @__PURE__ */
|
|
3288
|
+
/* @__PURE__ */ jsxs15("div", { className: cn("flex flex-col pl-5", answered ? "gap-1" : "gap-1.5"), children: [
|
|
3269
3289
|
question.options.map((opt, optIdx) => {
|
|
3270
3290
|
const isSel = selected.has(optIdx);
|
|
3271
|
-
return /* @__PURE__ */
|
|
3291
|
+
return /* @__PURE__ */ jsxs15(
|
|
3272
3292
|
"button",
|
|
3273
3293
|
{
|
|
3274
3294
|
type: "button",
|
|
@@ -3284,14 +3304,14 @@ function QuestionCard({
|
|
|
3284
3304
|
answered && !isSel && "text-[hsl(var(--muted-foreground))]"
|
|
3285
3305
|
),
|
|
3286
3306
|
children: [
|
|
3287
|
-
multi && /* @__PURE__ */
|
|
3307
|
+
multi && /* @__PURE__ */ jsx16(
|
|
3288
3308
|
"div",
|
|
3289
3309
|
{
|
|
3290
3310
|
className: cn(
|
|
3291
3311
|
"mt-0.5 flex h-4 w-4 shrink-0 items-center justify-center rounded border transition-colors",
|
|
3292
3312
|
isSel && !answered ? "border-[hsl(var(--primary-foreground)/0.6)] bg-[hsl(var(--primary-foreground)/0.2)]" : isSel ? "border-[hsl(var(--primary)/0.45)] bg-[hsl(var(--primary)/0.12)]" : "border-[hsl(var(--border))]"
|
|
3293
3313
|
),
|
|
3294
|
-
children: isSel && /* @__PURE__ */
|
|
3314
|
+
children: isSel && /* @__PURE__ */ jsx16(
|
|
3295
3315
|
Check,
|
|
3296
3316
|
{
|
|
3297
3317
|
size: 10,
|
|
@@ -3300,9 +3320,9 @@ function QuestionCard({
|
|
|
3300
3320
|
)
|
|
3301
3321
|
}
|
|
3302
3322
|
),
|
|
3303
|
-
/* @__PURE__ */
|
|
3304
|
-
/* @__PURE__ */
|
|
3305
|
-
opt.description && /* @__PURE__ */
|
|
3323
|
+
/* @__PURE__ */ jsxs15("div", { className: "min-w-0", children: [
|
|
3324
|
+
/* @__PURE__ */ jsx16("div", { className: cn("font-medium", answered ? "text-xs" : "text-[13px]"), children: opt.label }),
|
|
3325
|
+
opt.description && /* @__PURE__ */ jsx16(
|
|
3306
3326
|
"div",
|
|
3307
3327
|
{
|
|
3308
3328
|
className: cn(
|
|
@@ -3319,7 +3339,7 @@ function QuestionCard({
|
|
|
3319
3339
|
opt.label
|
|
3320
3340
|
);
|
|
3321
3341
|
}),
|
|
3322
|
-
answered && !isCustom ? null : /* @__PURE__ */
|
|
3342
|
+
answered && !isCustom ? null : /* @__PURE__ */ jsxs15(
|
|
3323
3343
|
"div",
|
|
3324
3344
|
{
|
|
3325
3345
|
className: cn(
|
|
@@ -3329,8 +3349,8 @@ function QuestionCard({
|
|
|
3329
3349
|
answered && "cursor-default"
|
|
3330
3350
|
),
|
|
3331
3351
|
children: [
|
|
3332
|
-
/* @__PURE__ */
|
|
3333
|
-
/* @__PURE__ */
|
|
3352
|
+
/* @__PURE__ */ jsx16("span", { className: "shrink-0 pt-1 text-xs text-[hsl(var(--muted-foreground))]", children: "\u5176\u4ED6\uFF1A" }),
|
|
3353
|
+
/* @__PURE__ */ jsx16(
|
|
3334
3354
|
"textarea",
|
|
3335
3355
|
{
|
|
3336
3356
|
ref: customTextareaRef,
|
|
@@ -3362,7 +3382,7 @@ function NoteField({
|
|
|
3362
3382
|
const textareaRef = useAutoResizeTextarea(note);
|
|
3363
3383
|
const readOnly = answered || submitted;
|
|
3364
3384
|
if (answered && !note.trim()) return null;
|
|
3365
|
-
return /* @__PURE__ */
|
|
3385
|
+
return /* @__PURE__ */ jsxs15(
|
|
3366
3386
|
"label",
|
|
3367
3387
|
{
|
|
3368
3388
|
className: cn(
|
|
@@ -3372,8 +3392,8 @@ function NoteField({
|
|
|
3372
3392
|
readOnly && "cursor-default"
|
|
3373
3393
|
),
|
|
3374
3394
|
children: [
|
|
3375
|
-
/* @__PURE__ */
|
|
3376
|
-
/* @__PURE__ */
|
|
3395
|
+
/* @__PURE__ */ jsx16("span", { className: "mb-1.5 block text-xs text-[hsl(var(--muted-foreground))]", children: "\u8865\u5145\u8BF4\u660E\uFF08\u53EF\u9009\uFF09" }),
|
|
3396
|
+
/* @__PURE__ */ jsx16(
|
|
3377
3397
|
"textarea",
|
|
3378
3398
|
{
|
|
3379
3399
|
ref: textareaRef,
|
|
@@ -6859,7 +6879,7 @@ function extractRefs(content) {
|
|
|
6859
6879
|
}
|
|
6860
6880
|
|
|
6861
6881
|
// src/chat/plan/PlanSummaryCard.tsx
|
|
6862
|
-
import { Fragment as
|
|
6882
|
+
import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
6863
6883
|
function PlanSummaryCard({
|
|
6864
6884
|
messages,
|
|
6865
6885
|
sessionStatus,
|
|
@@ -6874,8 +6894,8 @@ function PlanSummaryCard({
|
|
|
6874
6894
|
const isWaitingForInput = sessionStatus === "waiting_for_input";
|
|
6875
6895
|
const canConfirm = Boolean(onConfirmPlan) && isWaitingForInput && data.lastPauseTool === "ExitPlanMode";
|
|
6876
6896
|
const openPlanPanel = openPlanPanelAction && sessionId ? () => openPlanPanelAction(sessionId) : void 0;
|
|
6877
|
-
return /* @__PURE__ */
|
|
6878
|
-
/* @__PURE__ */
|
|
6897
|
+
return /* @__PURE__ */ jsxs16("div", { className: "flex w-full flex-col gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.55)] p-4", children: [
|
|
6898
|
+
/* @__PURE__ */ jsxs16(
|
|
6879
6899
|
"button",
|
|
6880
6900
|
{
|
|
6881
6901
|
type: "button",
|
|
@@ -6883,17 +6903,17 @@ function PlanSummaryCard({
|
|
|
6883
6903
|
disabled: isHistorical || !openPlanPanel,
|
|
6884
6904
|
className: "flex w-full flex-col gap-4 text-left transition-colors hover:text-[hsl(var(--foreground))]",
|
|
6885
6905
|
children: [
|
|
6886
|
-
/* @__PURE__ */
|
|
6887
|
-
/* @__PURE__ */
|
|
6888
|
-
/* @__PURE__ */
|
|
6889
|
-
/* @__PURE__ */
|
|
6890
|
-
/* @__PURE__ */
|
|
6906
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-start justify-between gap-3", children: [
|
|
6907
|
+
/* @__PURE__ */ jsxs16("div", { className: "min-w-0 space-y-2", children: [
|
|
6908
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
6909
|
+
/* @__PURE__ */ jsx17(Sparkles, { size: 12 }),
|
|
6910
|
+
/* @__PURE__ */ jsx17("span", { children: "\u89C4\u5212\u6458\u8981" })
|
|
6891
6911
|
] }),
|
|
6892
|
-
/* @__PURE__ */
|
|
6893
|
-
/* @__PURE__ */
|
|
6894
|
-
/* @__PURE__ */
|
|
6895
|
-
/* @__PURE__ */
|
|
6896
|
-
] }) : /* @__PURE__ */
|
|
6912
|
+
/* @__PURE__ */ jsx17("div", { className: "truncate text-base font-medium text-[hsl(var(--foreground))]", children: data.intent || data.plan?.root.label || "\u5F53\u524D\u89C4\u5212" }),
|
|
6913
|
+
/* @__PURE__ */ jsx17("div", { className: "flex flex-wrap items-center gap-2 text-xs", children: summaryState.kind === "progress" ? /* @__PURE__ */ jsxs16(Fragment8, { children: [
|
|
6914
|
+
/* @__PURE__ */ jsx17("span", { className: "rounded-full bg-[hsl(var(--accent))] px-2.5 py-1 text-[hsl(var(--foreground))]", children: summaryState.label }),
|
|
6915
|
+
/* @__PURE__ */ jsx17("span", { className: "font-mono tracking-[0.25em] text-[hsl(var(--muted-foreground))]", children: summaryState.dots })
|
|
6916
|
+
] }) : /* @__PURE__ */ jsx17(
|
|
6897
6917
|
"span",
|
|
6898
6918
|
{
|
|
6899
6919
|
className: cn(
|
|
@@ -6906,7 +6926,7 @@ function PlanSummaryCard({
|
|
|
6906
6926
|
}
|
|
6907
6927
|
) })
|
|
6908
6928
|
] }),
|
|
6909
|
-
!isHistorical && /* @__PURE__ */
|
|
6929
|
+
!isHistorical && /* @__PURE__ */ jsx17(
|
|
6910
6930
|
ChevronRight,
|
|
6911
6931
|
{
|
|
6912
6932
|
size: 16,
|
|
@@ -6915,37 +6935,37 @@ function PlanSummaryCard({
|
|
|
6915
6935
|
}
|
|
6916
6936
|
)
|
|
6917
6937
|
] }),
|
|
6918
|
-
summaryState.kind === "complete" && /* @__PURE__ */
|
|
6919
|
-
/* @__PURE__ */
|
|
6938
|
+
summaryState.kind === "complete" && /* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
6939
|
+
/* @__PURE__ */ jsxs16("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
|
|
6920
6940
|
data.selectedSkills.length,
|
|
6921
6941
|
" \u4E2A\u6280\u80FD"
|
|
6922
6942
|
] }),
|
|
6923
|
-
/* @__PURE__ */
|
|
6943
|
+
/* @__PURE__ */ jsxs16("span", { className: "rounded-full border border-[hsl(var(--border))] px-2.5 py-1", children: [
|
|
6924
6944
|
stepCount,
|
|
6925
6945
|
" \u4E2A\u6B65\u9AA4"
|
|
6926
6946
|
] }),
|
|
6927
|
-
!isHistorical && /* @__PURE__ */
|
|
6928
|
-
/* @__PURE__ */
|
|
6947
|
+
!isHistorical && /* @__PURE__ */ jsxs16("span", { className: "inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))]", children: [
|
|
6948
|
+
/* @__PURE__ */ jsx17(CircleCheck, { size: 12 }),
|
|
6929
6949
|
"\u53F3\u4FA7\u67E5\u770B\u8BE6\u60C5"
|
|
6930
6950
|
] })
|
|
6931
6951
|
] })
|
|
6932
6952
|
]
|
|
6933
6953
|
}
|
|
6934
6954
|
),
|
|
6935
|
-
data.plan ? /* @__PURE__ */
|
|
6936
|
-
/* @__PURE__ */
|
|
6937
|
-
/* @__PURE__ */
|
|
6938
|
-
data.plan.notes.map((note) => /* @__PURE__ */
|
|
6939
|
-
] }) : !data.hasPlanContent ? /* @__PURE__ */
|
|
6940
|
-
canConfirm && /* @__PURE__ */
|
|
6955
|
+
data.plan ? /* @__PURE__ */ jsxs16("details", { className: "text-sm", children: [
|
|
6956
|
+
/* @__PURE__ */ jsx17("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u8BA1\u5212\u6B65\u9AA4" }),
|
|
6957
|
+
/* @__PURE__ */ jsx17(LegacyPlanSteps, { nodes: data.plan.root.id === "plan-root" ? data.plan.root.children : [data.plan.root] }),
|
|
6958
|
+
data.plan.notes.map((note) => /* @__PURE__ */ jsx17("p", { children: note }, note))
|
|
6959
|
+
] }) : !data.hasPlanContent ? /* @__PURE__ */ jsx17("p", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u65E7\u7248\u5DE5\u4F5C\u533A\u8BA1\u5212\u65E0\u5386\u53F2\u5FEB\u7167" }) : null,
|
|
6960
|
+
canConfirm && /* @__PURE__ */ jsx17(PlanConfirmationPanel, { onConfirmPlan })
|
|
6941
6961
|
] });
|
|
6942
6962
|
}
|
|
6943
6963
|
function LegacyPlanSteps({ nodes }) {
|
|
6944
|
-
return /* @__PURE__ */
|
|
6964
|
+
return /* @__PURE__ */ jsx17("ul", { className: "list-disc space-y-1 pl-5 pt-1", children: nodes.map((node) => /* @__PURE__ */ jsxs16("li", { children: [
|
|
6945
6965
|
node.label,
|
|
6946
6966
|
" ",
|
|
6947
|
-
/* @__PURE__ */
|
|
6948
|
-
node.children.length > 0 && /* @__PURE__ */
|
|
6967
|
+
/* @__PURE__ */ jsx17("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: planStatusLabels[node.status] }),
|
|
6968
|
+
node.children.length > 0 && /* @__PURE__ */ jsx17(LegacyPlanSteps, { nodes: node.children })
|
|
6949
6969
|
] }, node.id)) });
|
|
6950
6970
|
}
|
|
6951
6971
|
function PlanConfirmationPanel({
|
|
@@ -6960,35 +6980,35 @@ function PlanConfirmationPanel({
|
|
|
6960
6980
|
setRevisionText("");
|
|
6961
6981
|
setIsEditing(false);
|
|
6962
6982
|
};
|
|
6963
|
-
return /* @__PURE__ */
|
|
6964
|
-
/* @__PURE__ */
|
|
6965
|
-
/* @__PURE__ */
|
|
6983
|
+
return /* @__PURE__ */ jsxs16("div", { className: "space-y-3 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--background)/0.45)] p-3", children: [
|
|
6984
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-wrap gap-2", children: [
|
|
6985
|
+
/* @__PURE__ */ jsxs16(
|
|
6966
6986
|
"button",
|
|
6967
6987
|
{
|
|
6968
6988
|
type: "button",
|
|
6969
6989
|
onClick: () => onConfirmPlan?.("execute"),
|
|
6970
6990
|
className: "inline-flex items-center gap-1.5 rounded-lg bg-[hsl(var(--primary))] px-3 py-2 text-sm font-medium text-[hsl(var(--primary-foreground))] transition-opacity hover:opacity-90",
|
|
6971
6991
|
children: [
|
|
6972
|
-
/* @__PURE__ */
|
|
6992
|
+
/* @__PURE__ */ jsx17(Play, { size: 14 }),
|
|
6973
6993
|
"\u5F00\u59CB\u6267\u884C"
|
|
6974
6994
|
]
|
|
6975
6995
|
}
|
|
6976
6996
|
),
|
|
6977
|
-
/* @__PURE__ */
|
|
6997
|
+
/* @__PURE__ */ jsxs16(
|
|
6978
6998
|
"button",
|
|
6979
6999
|
{
|
|
6980
7000
|
type: "button",
|
|
6981
7001
|
onClick: () => setIsEditing((value) => !value),
|
|
6982
7002
|
className: "inline-flex items-center gap-1.5 rounded-lg border border-[hsl(var(--border))] px-3 py-2 text-sm text-[hsl(var(--foreground))] transition-colors hover:bg-[hsl(var(--accent))]",
|
|
6983
7003
|
children: [
|
|
6984
|
-
/* @__PURE__ */
|
|
7004
|
+
/* @__PURE__ */ jsx17(PencilLine, { size: 14 }),
|
|
6985
7005
|
"\u4FEE\u6539"
|
|
6986
7006
|
]
|
|
6987
7007
|
}
|
|
6988
7008
|
)
|
|
6989
7009
|
] }),
|
|
6990
|
-
isEditing && /* @__PURE__ */
|
|
6991
|
-
/* @__PURE__ */
|
|
7010
|
+
isEditing && /* @__PURE__ */ jsxs16("div", { className: "space-y-2", children: [
|
|
7011
|
+
/* @__PURE__ */ jsx17(
|
|
6992
7012
|
"textarea",
|
|
6993
7013
|
{
|
|
6994
7014
|
value: revisionText,
|
|
@@ -6997,7 +7017,7 @@ function PlanConfirmationPanel({
|
|
|
6997
7017
|
className: "min-h-24 w-full resize-y rounded-lg border border-[hsl(var(--border))] bg-transparent px-3 py-2 text-sm text-[hsl(var(--foreground))] outline-none placeholder:text-[hsl(var(--muted-foreground))]"
|
|
6998
7018
|
}
|
|
6999
7019
|
),
|
|
7000
|
-
/* @__PURE__ */
|
|
7020
|
+
/* @__PURE__ */ jsx17("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx17(
|
|
7001
7021
|
"button",
|
|
7002
7022
|
{
|
|
7003
7023
|
type: "button",
|
|
@@ -7262,7 +7282,7 @@ import {
|
|
|
7262
7282
|
useRef as useRef14,
|
|
7263
7283
|
useState as useState16
|
|
7264
7284
|
} from "react";
|
|
7265
|
-
import { Fragment as
|
|
7285
|
+
import { Fragment as Fragment9, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
7266
7286
|
var ReasoningContext = createContext6(null);
|
|
7267
7287
|
var useReasoning = () => {
|
|
7268
7288
|
const context = useContext5(ReasoningContext);
|
|
@@ -7313,7 +7333,7 @@ var Reasoning = memo2(
|
|
|
7313
7333
|
() => ({ duration, isOpen, isStreaming, setIsOpen }),
|
|
7314
7334
|
[duration, isOpen, isStreaming, setIsOpen]
|
|
7315
7335
|
);
|
|
7316
|
-
return /* @__PURE__ */
|
|
7336
|
+
return /* @__PURE__ */ jsx18(ReasoningContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx18(
|
|
7317
7337
|
Collapsible,
|
|
7318
7338
|
{
|
|
7319
7339
|
className: cn("not-prose", className),
|
|
@@ -7339,7 +7359,7 @@ var ReasoningTrigger = memo2(
|
|
|
7339
7359
|
const { isStreaming, isOpen, duration } = useReasoning();
|
|
7340
7360
|
const status = isStreaming || duration === 0 ? "\u6B63\u5728\u601D\u8003" : "\u5DF2\u601D\u8003";
|
|
7341
7361
|
const detail = `${formatWordCount(wordCount)} \u5B57`;
|
|
7342
|
-
return /* @__PURE__ */
|
|
7362
|
+
return /* @__PURE__ */ jsx18(
|
|
7343
7363
|
CollapsibleTrigger,
|
|
7344
7364
|
{
|
|
7345
7365
|
className: cn(
|
|
@@ -7347,16 +7367,16 @@ var ReasoningTrigger = memo2(
|
|
|
7347
7367
|
className
|
|
7348
7368
|
),
|
|
7349
7369
|
...props,
|
|
7350
|
-
children: children ?? /* @__PURE__ */
|
|
7351
|
-
/* @__PURE__ */
|
|
7352
|
-
/* @__PURE__ */
|
|
7353
|
-
isStreaming || duration === 0 ? /* @__PURE__ */
|
|
7354
|
-
/* @__PURE__ */
|
|
7370
|
+
children: children ?? /* @__PURE__ */ jsxs17(Fragment9, { children: [
|
|
7371
|
+
/* @__PURE__ */ jsx18(Brain, { className: "size-4" }),
|
|
7372
|
+
/* @__PURE__ */ jsxs17("span", { className: "inline-flex items-center gap-1.5", children: [
|
|
7373
|
+
isStreaming || duration === 0 ? /* @__PURE__ */ jsx18(Shimmer, { duration: 1, children: status }) : /* @__PURE__ */ jsx18("span", { children: status }),
|
|
7374
|
+
/* @__PURE__ */ jsxs17("span", { className: "whitespace-nowrap tabular-nums text-[hsl(var(--muted-foreground))]/70", children: [
|
|
7355
7375
|
"\xB7 ",
|
|
7356
7376
|
detail
|
|
7357
7377
|
] })
|
|
7358
7378
|
] }),
|
|
7359
|
-
/* @__PURE__ */
|
|
7379
|
+
/* @__PURE__ */ jsx18(
|
|
7360
7380
|
ChevronDown,
|
|
7361
7381
|
{
|
|
7362
7382
|
className: cn(
|
|
@@ -7372,11 +7392,11 @@ var ReasoningTrigger = memo2(
|
|
|
7372
7392
|
);
|
|
7373
7393
|
function ReasoningMarkdown({ children }) {
|
|
7374
7394
|
const Injected = useChatEnvironment().ReasoningMarkdown;
|
|
7375
|
-
if (Injected) return /* @__PURE__ */
|
|
7376
|
-
return /* @__PURE__ */
|
|
7395
|
+
if (Injected) return /* @__PURE__ */ jsx18(Injected, { children });
|
|
7396
|
+
return /* @__PURE__ */ jsx18(MarkdownContent, { children });
|
|
7377
7397
|
}
|
|
7378
7398
|
var ReasoningContent = memo2(
|
|
7379
|
-
({ className, children, ...props }) => /* @__PURE__ */
|
|
7399
|
+
({ className, children, ...props }) => /* @__PURE__ */ jsx18(
|
|
7380
7400
|
CollapsibleContent,
|
|
7381
7401
|
{
|
|
7382
7402
|
className: cn(
|
|
@@ -7385,7 +7405,7 @@ var ReasoningContent = memo2(
|
|
|
7385
7405
|
className
|
|
7386
7406
|
),
|
|
7387
7407
|
...props,
|
|
7388
|
-
children: /* @__PURE__ */
|
|
7408
|
+
children: /* @__PURE__ */ jsx18(ReasoningMarkdown, { children })
|
|
7389
7409
|
}
|
|
7390
7410
|
)
|
|
7391
7411
|
);
|
|
@@ -7395,7 +7415,7 @@ function compactReasoningText(text) {
|
|
|
7395
7415
|
function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
7396
7416
|
const compactReasoning = compactReasoningText(reasoning);
|
|
7397
7417
|
const [open, setOpen] = useState16(false);
|
|
7398
|
-
return /* @__PURE__ */
|
|
7418
|
+
return /* @__PURE__ */ jsxs17(
|
|
7399
7419
|
"span",
|
|
7400
7420
|
{
|
|
7401
7421
|
className: cn(
|
|
@@ -7403,7 +7423,7 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
|
7403
7423
|
variant === "inline" ? "ml-1" : "ml-1 shrink-0"
|
|
7404
7424
|
),
|
|
7405
7425
|
children: [
|
|
7406
|
-
/* @__PURE__ */
|
|
7426
|
+
/* @__PURE__ */ jsx18(
|
|
7407
7427
|
"button",
|
|
7408
7428
|
{
|
|
7409
7429
|
type: "button",
|
|
@@ -7417,24 +7437,24 @@ function ThinkingBadge({ reasoning, variant = "inline", onClick }) {
|
|
|
7417
7437
|
children: "\u601D\u8003\u8BE6\u60C5"
|
|
7418
7438
|
}
|
|
7419
7439
|
),
|
|
7420
|
-
/* @__PURE__ */
|
|
7440
|
+
/* @__PURE__ */ jsx18(Dialog, { open, onOpenChange: setOpen, children: /* @__PURE__ */ jsxs17(
|
|
7421
7441
|
DialogContent,
|
|
7422
7442
|
{
|
|
7423
7443
|
showCloseButton: false,
|
|
7424
7444
|
className: "m-0 flex max-h-[min(520px,calc(100vh-48px))] w-[min(760px,calc(100vw-48px))] flex-col gap-0 overflow-hidden p-0 text-left text-[13px] leading-6",
|
|
7425
7445
|
children: [
|
|
7426
|
-
/* @__PURE__ */
|
|
7427
|
-
/* @__PURE__ */
|
|
7428
|
-
/* @__PURE__ */
|
|
7446
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between gap-3 border-b border-[hsl(var(--border))] px-4 py-2", children: [
|
|
7447
|
+
/* @__PURE__ */ jsx18(DialogTitle, { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u601D\u8003\u8BE6\u60C5" }),
|
|
7448
|
+
/* @__PURE__ */ jsx18(
|
|
7429
7449
|
DialogClose,
|
|
7430
7450
|
{
|
|
7431
7451
|
className: "inline-flex h-6 w-6 items-center justify-center rounded-md text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
7432
7452
|
"aria-label": "\u5173\u95ED\u601D\u8003\u8BE6\u60C5",
|
|
7433
|
-
children: /* @__PURE__ */
|
|
7453
|
+
children: /* @__PURE__ */ jsx18(X, { size: 14, "aria-hidden": "true" })
|
|
7434
7454
|
}
|
|
7435
7455
|
)
|
|
7436
7456
|
] }),
|
|
7437
|
-
/* @__PURE__ */
|
|
7457
|
+
/* @__PURE__ */ jsx18("div", { className: "overflow-auto px-4 py-3 whitespace-normal [&_*]:whitespace-normal [&_p]:my-1.5 [&_p:first-child]:mt-0 [&_p:last-child]:mb-0 [&_ul]:my-1.5 [&_ol]:my-1.5", children: /* @__PURE__ */ jsx18(ReasoningMarkdown, { children: compactReasoning }) })
|
|
7438
7458
|
]
|
|
7439
7459
|
}
|
|
7440
7460
|
) })
|
|
@@ -7453,7 +7473,7 @@ var useCardContext = () => useContext6(CardContext);
|
|
|
7453
7473
|
|
|
7454
7474
|
// src/chat/FileDeliveryCards.tsx
|
|
7455
7475
|
import { useMemo as useMemo9, useState as useState17 } from "react";
|
|
7456
|
-
import { Fragment as
|
|
7476
|
+
import { Fragment as Fragment10, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
7457
7477
|
var AGENT_WORKSPACE_DIR_NAME = "\u667A\u80FD\u52A9\u624B\u5DE5\u4F5C\u7A7A\u95F4";
|
|
7458
7478
|
var EXT_LABELS = {
|
|
7459
7479
|
py: "PY",
|
|
@@ -7564,13 +7584,13 @@ function DeliveryCard({
|
|
|
7564
7584
|
}
|
|
7565
7585
|
};
|
|
7566
7586
|
const badgeText = changeKind === "modified" ? "\u5DF2\u66F4\u65B0" : "\u65B0\u5EFA";
|
|
7567
|
-
return /* @__PURE__ */
|
|
7587
|
+
return /* @__PURE__ */ jsxs18(
|
|
7568
7588
|
"div",
|
|
7569
7589
|
{
|
|
7570
7590
|
"data-artifact-kind": isVideoFile(name) ? "video" : "file",
|
|
7571
7591
|
className: compact ? "file-delivery-card group/delivery relative flex w-full max-w-full items-stretch self-start overflow-hidden rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--card))] shadow-sm transition-colors hover:bg-[hsl(var(--accent)/0.45)] focus-within:ring-1 focus-within:ring-[hsl(var(--ring))]" : "file-delivery-card group/delivery relative flex w-full max-w-full items-center self-start rounded-[12px] border border-[hsl(var(--border)/0.85)] bg-[hsl(var(--background)/0.65)] transition-colors duration-150 hover:border-[hsl(var(--primary)/0.4)] hover:bg-[hsl(var(--accent)/0.4)] focus-within:ring-1 focus-within:ring-[hsl(var(--ring))]",
|
|
7572
7592
|
children: [
|
|
7573
|
-
/* @__PURE__ */
|
|
7593
|
+
/* @__PURE__ */ jsxs18(
|
|
7574
7594
|
"button",
|
|
7575
7595
|
{
|
|
7576
7596
|
type: "button",
|
|
@@ -7581,19 +7601,19 @@ function DeliveryCard({
|
|
|
7581
7601
|
title: displayName ? `${displayName}
|
|
7582
7602
|
${path}` : path,
|
|
7583
7603
|
children: [
|
|
7584
|
-
/* @__PURE__ */
|
|
7585
|
-
/* @__PURE__ */
|
|
7586
|
-
/* @__PURE__ */
|
|
7587
|
-
!compact ? /* @__PURE__ */
|
|
7588
|
-
/* @__PURE__ */
|
|
7589
|
-
/* @__PURE__ */
|
|
7590
|
-
/* @__PURE__ */
|
|
7604
|
+
/* @__PURE__ */ jsx19("span", { className: compact ? "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]" : "flex h-9 w-9 shrink-0 items-center justify-center rounded-[10px] bg-[hsl(var(--primary)/0.12)] font-mono text-[11px] font-bold text-[hsl(var(--primary))]", children: opening ? /* @__PURE__ */ jsx19(LoaderCircle, { size: compact ? 14 : 18, className: "animate-spin", "aria-hidden": "true" }) : isVideoFile(name) ? /* @__PURE__ */ jsx19(Film, { size: compact ? 14 : 18, "aria-hidden": "true" }) : compact ? /* @__PURE__ */ jsx19(FileGlyph, {}) : getExtLabel(name) }),
|
|
7605
|
+
/* @__PURE__ */ jsxs18("span", { className: compact ? "min-w-0" : "flex min-w-0 flex-1 flex-col gap-0.5", children: [
|
|
7606
|
+
/* @__PURE__ */ jsx19("span", { className: compact ? "block truncate text-xs font-medium leading-5" : "truncate text-[13px] font-semibold text-[hsl(var(--foreground))]", children: displayName || name }),
|
|
7607
|
+
!compact ? /* @__PURE__ */ jsx19("span", { className: "flex items-center gap-1.5 truncate text-xs text-[hsl(var(--muted-foreground))]", children: description ? /* @__PURE__ */ jsx19("span", { className: "truncate", children: description }) : /* @__PURE__ */ jsxs18(Fragment10, { children: [
|
|
7608
|
+
/* @__PURE__ */ jsx19("span", { className: "truncate", children: path }),
|
|
7609
|
+
/* @__PURE__ */ jsx19("span", { "aria-hidden": "true", children: "\xB7" }),
|
|
7610
|
+
/* @__PURE__ */ jsx19("span", { className: "shrink-0 text-[hsl(var(--primary))]", children: badgeText })
|
|
7591
7611
|
] }) }) : null
|
|
7592
7612
|
] })
|
|
7593
7613
|
]
|
|
7594
7614
|
}
|
|
7595
7615
|
),
|
|
7596
|
-
/* @__PURE__ */
|
|
7616
|
+
/* @__PURE__ */ jsx19(
|
|
7597
7617
|
"button",
|
|
7598
7618
|
{
|
|
7599
7619
|
type: "button",
|
|
@@ -7605,7 +7625,7 @@ ${path}` : path,
|
|
|
7605
7625
|
className: compact ? "absolute inset-y-0 right-0 flex w-7 items-center justify-center bg-transparent text-[hsl(var(--muted-foreground))] opacity-0 [@media(hover:none)]:opacity-100 transition-[opacity,color] hover:text-[hsl(var(--foreground))] focus:opacity-100 focus:outline-none group-hover/delivery:opacity-100 group-focus-within/delivery:opacity-100" : "absolute right-2.5 top-1/2 grid h-8 w-8 -translate-y-1/2 place-items-center rounded-[8px] text-[hsl(var(--muted-foreground))] opacity-0 [@media(hover:none)]:opacity-100 transition-opacity hover:bg-[hsl(var(--card))] hover:text-[hsl(var(--foreground))] focus:opacity-100 focus:outline-none group-hover/delivery:opacity-100",
|
|
7606
7626
|
title: "\u4E0B\u8F7D\u6587\u4EF6",
|
|
7607
7627
|
"aria-label": `\u4E0B\u8F7D\u6587\u4EF6\uFF1A${displayName || name}`,
|
|
7608
|
-
children: downloading ? /* @__PURE__ */
|
|
7628
|
+
children: downloading ? /* @__PURE__ */ jsx19(LoaderCircle, { size: compact ? 13 : 15, className: "animate-spin", "aria-hidden": "true" }) : /* @__PURE__ */ jsx19(Download, { size: compact ? 13 : 15, "aria-hidden": "true" })
|
|
7609
7629
|
}
|
|
7610
7630
|
)
|
|
7611
7631
|
]
|
|
@@ -7613,7 +7633,7 @@ ${path}` : path,
|
|
|
7613
7633
|
);
|
|
7614
7634
|
}
|
|
7615
7635
|
function FileGlyph() {
|
|
7616
|
-
return /* @__PURE__ */
|
|
7636
|
+
return /* @__PURE__ */ jsxs18(
|
|
7617
7637
|
"svg",
|
|
7618
7638
|
{
|
|
7619
7639
|
width: "15",
|
|
@@ -7626,8 +7646,8 @@ function FileGlyph() {
|
|
|
7626
7646
|
strokeLinejoin: "round",
|
|
7627
7647
|
"aria-hidden": "true",
|
|
7628
7648
|
children: [
|
|
7629
|
-
/* @__PURE__ */
|
|
7630
|
-
/* @__PURE__ */
|
|
7649
|
+
/* @__PURE__ */ jsx19("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7z" }),
|
|
7650
|
+
/* @__PURE__ */ jsx19("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })
|
|
7631
7651
|
]
|
|
7632
7652
|
}
|
|
7633
7653
|
);
|
|
@@ -7642,24 +7662,24 @@ function FileDeliveryCards({
|
|
|
7642
7662
|
[toolCalls, sessionId, excludePaths]
|
|
7643
7663
|
);
|
|
7644
7664
|
if (files.length === 0) return null;
|
|
7645
|
-
return /* @__PURE__ */
|
|
7665
|
+
return /* @__PURE__ */ jsxs18(
|
|
7646
7666
|
"div",
|
|
7647
7667
|
{
|
|
7648
7668
|
"data-testid": "turn-deliverables-card",
|
|
7649
7669
|
className: "ml-10 flex flex-col gap-2 rounded-[16px] border border-[hsl(var(--border)/0.85)] bg-[hsl(var(--card))] p-3 shadow-xs",
|
|
7650
7670
|
children: [
|
|
7651
|
-
/* @__PURE__ */
|
|
7652
|
-
/* @__PURE__ */
|
|
7653
|
-
/* @__PURE__ */
|
|
7654
|
-
/* @__PURE__ */
|
|
7671
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex items-center justify-between gap-2 px-0.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
7672
|
+
/* @__PURE__ */ jsxs18("span", { className: "inline-flex items-center gap-1.5 font-medium text-[hsl(var(--foreground))]", children: [
|
|
7673
|
+
/* @__PURE__ */ jsx19(FolderOutput, { size: 13, className: "text-[hsl(var(--primary))]", "aria-hidden": "true" }),
|
|
7674
|
+
/* @__PURE__ */ jsxs18("span", { children: [
|
|
7655
7675
|
"\u672C\u8F6E\u4EA7\u51FA\u4E0E\u6539\u52A8\u6587\u4EF6\uFF08",
|
|
7656
7676
|
files.length,
|
|
7657
7677
|
"\uFF09"
|
|
7658
7678
|
] })
|
|
7659
7679
|
] }),
|
|
7660
|
-
/* @__PURE__ */
|
|
7680
|
+
/* @__PURE__ */ jsx19("span", { className: "hidden sm:inline", children: "\u70B9\u51FB\u67E5\u770B\u9884\u89C8" })
|
|
7661
7681
|
] }),
|
|
7662
|
-
/* @__PURE__ */
|
|
7682
|
+
/* @__PURE__ */ jsx19("div", { className: "grid grid-cols-1 gap-1.5 sm:grid-cols-2", children: files.map((file) => /* @__PURE__ */ jsx19(
|
|
7663
7683
|
DeliveryCard,
|
|
7664
7684
|
{
|
|
7665
7685
|
path: file.relPath,
|
|
@@ -7676,7 +7696,7 @@ function FileDeliveryCards({
|
|
|
7676
7696
|
|
|
7677
7697
|
// src/chat/MessageActions.tsx
|
|
7678
7698
|
import { useState as useState18 } from "react";
|
|
7679
|
-
import { jsx as
|
|
7699
|
+
import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
7680
7700
|
function MessageActions({ content, className }) {
|
|
7681
7701
|
const [copied, setCopied] = useState18(false);
|
|
7682
7702
|
const handleCopy = async () => {
|
|
@@ -7686,7 +7706,7 @@ function MessageActions({ content, className }) {
|
|
|
7686
7706
|
setTimeout(() => setCopied(false), 2e3);
|
|
7687
7707
|
}
|
|
7688
7708
|
};
|
|
7689
|
-
return /* @__PURE__ */
|
|
7709
|
+
return /* @__PURE__ */ jsx20("div", { className: cn("flex items-center gap-1 mt-1.5", className), children: /* @__PURE__ */ jsxs19(
|
|
7690
7710
|
"button",
|
|
7691
7711
|
{
|
|
7692
7712
|
type: "button",
|
|
@@ -7696,15 +7716,15 @@ function MessageActions({ content, className }) {
|
|
|
7696
7716
|
copied ? "text-[hsl(var(--primary))]" : "text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] hover:bg-[hsl(var(--accent))]"
|
|
7697
7717
|
),
|
|
7698
7718
|
children: [
|
|
7699
|
-
copied ? /* @__PURE__ */
|
|
7700
|
-
/* @__PURE__ */
|
|
7719
|
+
copied ? /* @__PURE__ */ jsx20(Check, { size: 12 }) : /* @__PURE__ */ jsx20(Copy, { size: 12 }),
|
|
7720
|
+
/* @__PURE__ */ jsx20("span", { children: copied ? "\u5DF2\u590D\u5236" : "\u590D\u5236" })
|
|
7701
7721
|
]
|
|
7702
7722
|
}
|
|
7703
7723
|
) });
|
|
7704
7724
|
}
|
|
7705
7725
|
|
|
7706
7726
|
// src/chat/MessageFileAttachmentList.tsx
|
|
7707
|
-
import { Fragment as
|
|
7727
|
+
import { Fragment as Fragment11, jsx as jsx21, jsxs as jsxs20 } from "react/jsx-runtime";
|
|
7708
7728
|
function getFileIcon(fileName) {
|
|
7709
7729
|
const lowerName = fileName.toLowerCase();
|
|
7710
7730
|
if (/\.(zip|rar|7z|tar|gz|bz2|xz)$/.test(lowerName)) {
|
|
@@ -7733,15 +7753,15 @@ function MessageFileAttachmentList({
|
|
|
7733
7753
|
return null;
|
|
7734
7754
|
}
|
|
7735
7755
|
const pillClass = "blade-chat-file-card 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))]";
|
|
7736
|
-
return /* @__PURE__ */
|
|
7756
|
+
return /* @__PURE__ */ jsx21("div", { className: cn("flex flex-wrap gap-1.5", className), children: files.map((file) => {
|
|
7737
7757
|
const Icon = getFileIcon(file.name);
|
|
7738
7758
|
const key = `${file.name}-${file.data.slice(0, 32)}`;
|
|
7739
|
-
const content = /* @__PURE__ */
|
|
7740
|
-
/* @__PURE__ */
|
|
7741
|
-
/* @__PURE__ */
|
|
7759
|
+
const content = /* @__PURE__ */ jsxs20(Fragment11, { children: [
|
|
7760
|
+
/* @__PURE__ */ jsx21(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
7761
|
+
/* @__PURE__ */ jsx21("span", { className: "max-w-32 truncate", children: file.name })
|
|
7742
7762
|
] });
|
|
7743
7763
|
if (onPreview) {
|
|
7744
|
-
return /* @__PURE__ */
|
|
7764
|
+
return /* @__PURE__ */ jsx21(
|
|
7745
7765
|
"button",
|
|
7746
7766
|
{
|
|
7747
7767
|
type: "button",
|
|
@@ -7754,16 +7774,16 @@ function MessageFileAttachmentList({
|
|
|
7754
7774
|
key
|
|
7755
7775
|
);
|
|
7756
7776
|
}
|
|
7757
|
-
return /* @__PURE__ */
|
|
7777
|
+
return /* @__PURE__ */ jsx21("div", { part: "file-card", className: pillClass, title: file.name, children: content }, key);
|
|
7758
7778
|
}) });
|
|
7759
7779
|
}
|
|
7760
7780
|
|
|
7761
7781
|
// src/chat/ToolUiCard.tsx
|
|
7762
|
-
import { jsx as
|
|
7782
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
7763
7783
|
function ToolUiCard({ card, sessionId }) {
|
|
7764
7784
|
const Injected = useChatEnvironment().ToolUiCard;
|
|
7765
|
-
if (Injected) return /* @__PURE__ */
|
|
7766
|
-
return /* @__PURE__ */
|
|
7785
|
+
if (Injected) return /* @__PURE__ */ jsx22(Injected, { card, sessionId });
|
|
7786
|
+
return /* @__PURE__ */ jsx22(ToolUiCardView, { card, sessionId });
|
|
7767
7787
|
}
|
|
7768
7788
|
|
|
7769
7789
|
// src/chat/ToolCallBlock.tsx
|
|
@@ -7773,7 +7793,7 @@ import {
|
|
|
7773
7793
|
isInternalStatusToolUiCard,
|
|
7774
7794
|
isWorkflowRunToolName
|
|
7775
7795
|
} from "@blade-hq/agent-client/internal";
|
|
7776
|
-
import { Fragment as
|
|
7796
|
+
import { Fragment as Fragment12, jsx as jsx23, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
7777
7797
|
function getFilePreviewName(filePath) {
|
|
7778
7798
|
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
7779
7799
|
}
|
|
@@ -7791,16 +7811,16 @@ function FilePathLink({ filePath, sessionId }) {
|
|
|
7791
7811
|
}
|
|
7792
7812
|
};
|
|
7793
7813
|
if (!openWorkspaceFile) {
|
|
7794
|
-
return /* @__PURE__ */
|
|
7814
|
+
return /* @__PURE__ */ jsx23("span", { className: "min-w-0 truncate font-mono text-[hsl(var(--muted-foreground))]", children: displayLabel });
|
|
7795
7815
|
}
|
|
7796
|
-
return /* @__PURE__ */
|
|
7816
|
+
return /* @__PURE__ */ jsx23(
|
|
7797
7817
|
"button",
|
|
7798
7818
|
{
|
|
7799
7819
|
type: "button",
|
|
7800
7820
|
onClick: handleClick,
|
|
7801
7821
|
className: "flex min-w-0 cursor-pointer items-center gap-1 font-mono text-[hsl(var(--swf-link-text))] hover:underline",
|
|
7802
7822
|
title: `\u9884\u89C8 ${displayLabel}`,
|
|
7803
|
-
children: /* @__PURE__ */
|
|
7823
|
+
children: /* @__PURE__ */ jsx23("span", { className: "truncate", children: displayLabel })
|
|
7804
7824
|
}
|
|
7805
7825
|
);
|
|
7806
7826
|
}
|
|
@@ -7811,7 +7831,7 @@ function ToolFilePreviewAction({
|
|
|
7811
7831
|
}) {
|
|
7812
7832
|
const filePath = extractToolFilePath(toolCall);
|
|
7813
7833
|
if (!filePath) return null;
|
|
7814
|
-
return /* @__PURE__ */
|
|
7834
|
+
return /* @__PURE__ */ jsx23("span", { className: cn("flex min-w-0", className), children: /* @__PURE__ */ jsx23(FilePathLink, { filePath, sessionId }) });
|
|
7815
7835
|
}
|
|
7816
7836
|
function isLivePreviewTool(toolName) {
|
|
7817
7837
|
return toolName === "Write" || toolName === "Edit" || toolName === "MultiEdit";
|
|
@@ -7836,7 +7856,7 @@ function ToolPreviewAction({
|
|
|
7836
7856
|
return null;
|
|
7837
7857
|
}
|
|
7838
7858
|
const label = uiMeta.title ?? displayName;
|
|
7839
|
-
return /* @__PURE__ */
|
|
7859
|
+
return /* @__PURE__ */ jsxs21(
|
|
7840
7860
|
"button",
|
|
7841
7861
|
{
|
|
7842
7862
|
type: "button",
|
|
@@ -7847,8 +7867,8 @@ function ToolPreviewAction({
|
|
|
7847
7867
|
),
|
|
7848
7868
|
title: `\u6253\u5F00 ${label}`,
|
|
7849
7869
|
children: [
|
|
7850
|
-
/* @__PURE__ */
|
|
7851
|
-
/* @__PURE__ */
|
|
7870
|
+
/* @__PURE__ */ jsx23(PanelRightOpen, { size: 12 }),
|
|
7871
|
+
/* @__PURE__ */ jsx23("span", { children: label })
|
|
7852
7872
|
]
|
|
7853
7873
|
}
|
|
7854
7874
|
);
|
|
@@ -7920,11 +7940,11 @@ function ToolCallBlock({
|
|
|
7920
7940
|
onAnswer: canAnswer ? resolvedOnAnswer : void 0
|
|
7921
7941
|
}) : null;
|
|
7922
7942
|
const customToolCall2 = customQuestion == null && !customization?.renderers?.askUserQuestion ? customization?.renderers?.toolCall?.(toolCall) : null;
|
|
7923
|
-
if (customQuestion != null) return /* @__PURE__ */
|
|
7924
|
-
if (customToolCall2 != null) return /* @__PURE__ */
|
|
7943
|
+
if (customQuestion != null) return /* @__PURE__ */ jsx23(Fragment12, { children: customQuestion });
|
|
7944
|
+
if (customToolCall2 != null) return /* @__PURE__ */ jsx23(Fragment12, { children: customToolCall2 });
|
|
7925
7945
|
if (toolCall.status === "error") return null;
|
|
7926
7946
|
if (askData) {
|
|
7927
|
-
const questionBlock = /* @__PURE__ */
|
|
7947
|
+
const questionBlock = /* @__PURE__ */ jsx23(
|
|
7928
7948
|
AskUserQuestionBlock,
|
|
7929
7949
|
{
|
|
7930
7950
|
data: askData,
|
|
@@ -7939,36 +7959,36 @@ function ToolCallBlock({
|
|
|
7939
7959
|
if (!reasoning) {
|
|
7940
7960
|
return questionBlock;
|
|
7941
7961
|
}
|
|
7942
|
-
return /* @__PURE__ */
|
|
7962
|
+
return /* @__PURE__ */ jsxs21("div", { className: "flex flex-col gap-1", children: [
|
|
7943
7963
|
questionBlock,
|
|
7944
|
-
/* @__PURE__ */
|
|
7964
|
+
/* @__PURE__ */ jsx23("div", { className: "ml-4", children: /* @__PURE__ */ jsx23(ThinkingBadge, { reasoning, variant: "block" }) })
|
|
7945
7965
|
] });
|
|
7946
7966
|
}
|
|
7947
7967
|
if (toolCall.status === "pending") {
|
|
7948
|
-
return /* @__PURE__ */
|
|
7949
|
-
/* @__PURE__ */
|
|
7950
|
-
/* @__PURE__ */
|
|
7968
|
+
return /* @__PURE__ */ jsxs21("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 flex max-w-lg items-center gap-2 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] p-4 text-sm text-[hsl(var(--muted-foreground))]", children: [
|
|
7969
|
+
/* @__PURE__ */ jsx23(LoaderCircle, { size: 14, className: "animate-spin" }),
|
|
7970
|
+
/* @__PURE__ */ jsx23("span", { children: "\u6B63\u5728\u51C6\u5907\u95EE\u9898\u2026" })
|
|
7951
7971
|
] });
|
|
7952
7972
|
}
|
|
7953
|
-
return /* @__PURE__ */
|
|
7954
|
-
/* @__PURE__ */
|
|
7955
|
-
/* @__PURE__ */
|
|
7973
|
+
return /* @__PURE__ */ jsxs21("div", { part: "ask-card", className: "blade-chat-ask-card ml-4 max-w-lg rounded-xl border border-[hsl(var(--swf-warning)/0.35)] bg-[hsl(var(--swf-warning-soft))] p-4 text-sm text-[hsl(var(--foreground))]", children: [
|
|
7974
|
+
/* @__PURE__ */ jsx23("div", { className: "font-semibold", children: "\u9009\u62E9\u9898\u5185\u5BB9\u6682\u65F6\u65E0\u6CD5\u663E\u793A" }),
|
|
7975
|
+
/* @__PURE__ */ jsxs21("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: [
|
|
7956
7976
|
"\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u6216\u7248\u672C\u4E0D\u517C\u5BB9\u3002\u8BF7\u91CD\u8BD5\uFF1B\u82E5\u95EE\u9898\u6301\u7EED\uFF0C\u8BF7\u63D0\u4F9B\u4EA4\u4E92\u7F16\u53F7",
|
|
7957
|
-
/* @__PURE__ */
|
|
7977
|
+
/* @__PURE__ */ jsx23("span", { className: "ml-1 font-mono", children: toolCall.id }),
|
|
7958
7978
|
"\u3002"
|
|
7959
7979
|
] })
|
|
7960
7980
|
] });
|
|
7961
7981
|
}
|
|
7962
7982
|
const customToolCall = customization?.renderers?.toolCall?.(toolCall);
|
|
7963
|
-
if (customToolCall != null) return /* @__PURE__ */
|
|
7964
|
-
if (namedSubagent(toolCall)) return /* @__PURE__ */
|
|
7983
|
+
if (customToolCall != null) return /* @__PURE__ */ jsx23(Fragment12, { children: customToolCall });
|
|
7984
|
+
if (namedSubagent(toolCall)) return /* @__PURE__ */ jsx23(NamedSubagentCard, { tool: toolCall, sessionId: resolvedSessionId });
|
|
7965
7985
|
const tone = getToolTone(toolCall.status);
|
|
7966
7986
|
const displayName = getToolDisplayLabel(toolCall);
|
|
7967
7987
|
const Renderer = customization?.renderers?.tool?.[normalizedName] ?? getRenderer(normalizedName);
|
|
7968
7988
|
const indentClass = level === 2 ? "ml-3" : "";
|
|
7969
|
-
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */
|
|
7989
|
+
const statusIcon = toolCall.status === "pending" ? /* @__PURE__ */ jsx23(LoaderCircle, { size: 12, className: "animate-spin" }) : toolCall.status === "awaiting_answer" ? /* @__PURE__ */ jsx23(MessageSquareMore, { size: 12 }) : toolCall.status === "cancelled" || toolCall.status === "error" ? /* @__PURE__ */ jsx23(X, { size: 12 }) : /* @__PURE__ */ jsx23(Check, { size: 12 });
|
|
7970
7990
|
const statusTextClass = tone === "failed" ? "text-[hsl(var(--swf-danger))]" : tone === "awaiting" ? "text-[hsl(var(--swf-warning))]" : tone === "running" ? "text-[hsl(var(--muted-foreground))]" : "text-[hsl(var(--primary))]";
|
|
7971
|
-
return /* @__PURE__ */
|
|
7991
|
+
return /* @__PURE__ */ jsxs21(
|
|
7972
7992
|
"div",
|
|
7973
7993
|
{
|
|
7974
7994
|
part: normalizedName === "Agent" ? "agent-loop" : "tool-row",
|
|
@@ -7979,8 +7999,8 @@ function ToolCallBlock({
|
|
|
7979
7999
|
customization?.classNames?.toolCall
|
|
7980
8000
|
),
|
|
7981
8001
|
children: [
|
|
7982
|
-
/* @__PURE__ */
|
|
7983
|
-
/* @__PURE__ */
|
|
8002
|
+
/* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2 min-h-7 pr-3 leading-5", children: [
|
|
8003
|
+
/* @__PURE__ */ jsxs21(
|
|
7984
8004
|
"button",
|
|
7985
8005
|
{
|
|
7986
8006
|
type: "button",
|
|
@@ -7988,7 +8008,7 @@ function ToolCallBlock({
|
|
|
7988
8008
|
className: "flex min-h-7 min-w-0 flex-1 items-center gap-2 text-left transition-colors hover:bg-[hsl(var(--swf-fill-light))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
7989
8009
|
"aria-expanded": expanded,
|
|
7990
8010
|
children: [
|
|
7991
|
-
/* @__PURE__ */
|
|
8011
|
+
/* @__PURE__ */ jsx23(
|
|
7992
8012
|
ChevronRight,
|
|
7993
8013
|
{
|
|
7994
8014
|
size: 12,
|
|
@@ -7998,20 +8018,20 @@ function ToolCallBlock({
|
|
|
7998
8018
|
)
|
|
7999
8019
|
}
|
|
8000
8020
|
),
|
|
8001
|
-
/* @__PURE__ */
|
|
8021
|
+
/* @__PURE__ */ jsxs21("span", { className: cn("flex shrink-0 items-center gap-1 text-[10px]", statusTextClass), children: [
|
|
8002
8022
|
statusIcon,
|
|
8003
|
-
/* @__PURE__ */
|
|
8023
|
+
/* @__PURE__ */ jsx23("span", { children: getToolStatusLabel(toolCall.status) })
|
|
8004
8024
|
] }),
|
|
8005
|
-
/* @__PURE__ */
|
|
8025
|
+
/* @__PURE__ */ jsxs21("span", { className: "min-w-0 flex-1 truncate font-medium text-[hsl(var(--foreground))]", children: [
|
|
8006
8026
|
displayName,
|
|
8007
8027
|
toolCall.status === "error" ? "\uFF08\u5F85\u91CD\u8BD5\uFF09" : ""
|
|
8008
8028
|
] })
|
|
8009
8029
|
]
|
|
8010
8030
|
}
|
|
8011
8031
|
),
|
|
8012
|
-
reasoning ? /* @__PURE__ */
|
|
8013
|
-
typeof toolCall.duration_ms === "number" && toolCall.duration_ms > 0 && /* @__PURE__ */
|
|
8014
|
-
/* @__PURE__ */
|
|
8032
|
+
reasoning ? /* @__PURE__ */ jsx23(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
8033
|
+
typeof toolCall.duration_ms === "number" && toolCall.duration_ms > 0 && /* @__PURE__ */ jsx23("span", { className: "shrink-0 font-mono text-[10px] text-[hsl(var(--muted-foreground))]", children: formatToolDuration(toolCall.duration_ms) }),
|
|
8034
|
+
/* @__PURE__ */ jsx23(
|
|
8015
8035
|
ToolPreviewAction,
|
|
8016
8036
|
{
|
|
8017
8037
|
toolCall,
|
|
@@ -8020,14 +8040,14 @@ function ToolCallBlock({
|
|
|
8020
8040
|
}
|
|
8021
8041
|
)
|
|
8022
8042
|
] }),
|
|
8023
|
-
expanded && /* @__PURE__ */
|
|
8024
|
-
/* @__PURE__ */
|
|
8025
|
-
/* @__PURE__ */
|
|
8026
|
-
/* @__PURE__ */
|
|
8027
|
-
/* @__PURE__ */
|
|
8028
|
-
toolCall.result != null && /* @__PURE__ */
|
|
8029
|
-
/* @__PURE__ */
|
|
8030
|
-
/* @__PURE__ */
|
|
8043
|
+
expanded && /* @__PURE__ */ jsx23("div", { className: "ml-4 mt-1 rounded-xl bg-[hsl(var(--card))] px-3 py-3", children: Renderer ? /* @__PURE__ */ jsx23(Renderer, { toolCall, sessionId: resolvedSessionId }) : /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
8044
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u5DE5\u5177" }),
|
|
8045
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-3 font-mono text-[11px] text-[hsl(var(--foreground))]", children: normalizedName }),
|
|
8046
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-1 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u53C2\u6570" }),
|
|
8047
|
+
/* @__PURE__ */ jsx23("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) }),
|
|
8048
|
+
toolCall.result != null && /* @__PURE__ */ jsxs21(Fragment12, { children: [
|
|
8049
|
+
/* @__PURE__ */ jsx23("div", { className: "mb-1 mt-3 text-[10px] uppercase tracking-wider text-[hsl(var(--muted-foreground))]", children: "\u7ED3\u679C" }),
|
|
8050
|
+
/* @__PURE__ */ jsx23(
|
|
8031
8051
|
"pre",
|
|
8032
8052
|
{
|
|
8033
8053
|
className: cn(
|
|
@@ -8038,9 +8058,9 @@ function ToolCallBlock({
|
|
|
8038
8058
|
}
|
|
8039
8059
|
)
|
|
8040
8060
|
] }),
|
|
8041
|
-
toolCall.recorded_result && /* @__PURE__ */
|
|
8042
|
-
/* @__PURE__ */
|
|
8043
|
-
/* @__PURE__ */
|
|
8061
|
+
toolCall.recorded_result && /* @__PURE__ */ jsxs21("details", { className: "mt-3 text-[11px]", children: [
|
|
8062
|
+
/* @__PURE__ */ jsx23("summary", { className: "cursor-pointer text-[hsl(var(--muted-foreground))]", children: "\u5BF9\u7167\u5F55\u5236\u7ED3\u679C" }),
|
|
8063
|
+
/* @__PURE__ */ jsx23("pre", { className: "mt-1 max-h-[200px] overflow-auto whitespace-pre-wrap rounded-md bg-[hsl(var(--muted))] p-2 font-mono", children: toolCall.recorded_result })
|
|
8044
8064
|
] })
|
|
8045
8065
|
] }) })
|
|
8046
8066
|
]
|
|
@@ -8108,7 +8128,7 @@ function useAsyncValue(key, load2) {
|
|
|
8108
8128
|
}
|
|
8109
8129
|
|
|
8110
8130
|
// src/chat/AttachmentPreviewDialog.tsx
|
|
8111
|
-
import { jsx as
|
|
8131
|
+
import { jsx as jsx24, jsxs as jsxs22 } from "react/jsx-runtime";
|
|
8112
8132
|
function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
8113
8133
|
const client = useOptionalBladeClient();
|
|
8114
8134
|
const enabled = open && url != null && (mode === "markdown" || mode === "text");
|
|
@@ -8122,16 +8142,16 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
8122
8142
|
return res.text();
|
|
8123
8143
|
});
|
|
8124
8144
|
if (!open) return null;
|
|
8125
|
-
return /* @__PURE__ */
|
|
8145
|
+
return /* @__PURE__ */ jsx24(Dialog, { open, onOpenChange, children: /* @__PURE__ */ jsxs22(
|
|
8126
8146
|
DialogContent,
|
|
8127
8147
|
{
|
|
8128
8148
|
showCloseButton: false,
|
|
8129
8149
|
className: "flex max-h-[90vh] w-full max-w-3xl flex-col gap-0 overflow-hidden p-0",
|
|
8130
8150
|
children: [
|
|
8131
|
-
/* @__PURE__ */
|
|
8132
|
-
/* @__PURE__ */
|
|
8133
|
-
/* @__PURE__ */
|
|
8134
|
-
url && /* @__PURE__ */
|
|
8151
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center justify-between border-b border-[hsl(var(--border))] px-4 py-3", children: [
|
|
8152
|
+
/* @__PURE__ */ jsx24(DialogTitle, { className: "truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: filename }),
|
|
8153
|
+
/* @__PURE__ */ jsxs22("div", { className: "flex items-center gap-1", children: [
|
|
8154
|
+
url && /* @__PURE__ */ jsx24(
|
|
8135
8155
|
"a",
|
|
8136
8156
|
{
|
|
8137
8157
|
href: url,
|
|
@@ -8140,20 +8160,20 @@ function AttachmentPreviewDialog({ open, onOpenChange, filename, url, mode }) {
|
|
|
8140
8160
|
rel: "noopener noreferrer",
|
|
8141
8161
|
title: "\u4E0B\u8F7D",
|
|
8142
8162
|
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))]",
|
|
8143
|
-
children: /* @__PURE__ */
|
|
8163
|
+
children: /* @__PURE__ */ jsx24(Download, { size: 14 })
|
|
8144
8164
|
}
|
|
8145
8165
|
),
|
|
8146
|
-
/* @__PURE__ */
|
|
8166
|
+
/* @__PURE__ */ jsx24(
|
|
8147
8167
|
DialogClose,
|
|
8148
8168
|
{
|
|
8149
8169
|
title: "\u5173\u95ED",
|
|
8150
8170
|
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))]",
|
|
8151
|
-
children: /* @__PURE__ */
|
|
8171
|
+
children: /* @__PURE__ */ jsx24(X, { size: 14 })
|
|
8152
8172
|
}
|
|
8153
8173
|
)
|
|
8154
8174
|
] })
|
|
8155
8175
|
] }),
|
|
8156
|
-
/* @__PURE__ */
|
|
8176
|
+
/* @__PURE__ */ jsx24("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 }) })
|
|
8157
8177
|
]
|
|
8158
8178
|
}
|
|
8159
8179
|
) });
|
|
@@ -8165,28 +8185,28 @@ function renderContent({
|
|
|
8165
8185
|
error
|
|
8166
8186
|
}) {
|
|
8167
8187
|
if (!url) {
|
|
8168
|
-
return /* @__PURE__ */
|
|
8188
|
+
return /* @__PURE__ */ jsx24("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u6B64\u9644\u4EF6\u6682\u65E0\u53EF\u7528\u9884\u89C8\u5730\u5740\u3002" });
|
|
8169
8189
|
}
|
|
8170
8190
|
if (mode === "default") {
|
|
8171
|
-
return /* @__PURE__ */
|
|
8191
|
+
return /* @__PURE__ */ jsxs22("p", { className: "text-[hsl(var(--muted-foreground))]", children: [
|
|
8172
8192
|
"\u6B64\u7C7B\u578B\u6682\u4E0D\u652F\u6301\u5185\u5D4C\u9884\u89C8\u3002\u8BF7\u70B9\u51FB\u53F3\u4E0A\u89D2",
|
|
8173
|
-
/* @__PURE__ */
|
|
8193
|
+
/* @__PURE__ */ jsx24("span", { className: "mx-1 font-medium text-[hsl(var(--foreground))]", children: "\u4E0B\u8F7D" }),
|
|
8174
8194
|
"\u6309\u94AE\u67E5\u770B\u3002"
|
|
8175
8195
|
] });
|
|
8176
8196
|
}
|
|
8177
8197
|
if (error) {
|
|
8178
|
-
return /* @__PURE__ */
|
|
8198
|
+
return /* @__PURE__ */ jsxs22("p", { className: "text-[hsl(var(--destructive))]", children: [
|
|
8179
8199
|
"\u52A0\u8F7D\u5931\u8D25\uFF1A",
|
|
8180
8200
|
String(error?.message ?? error)
|
|
8181
8201
|
] });
|
|
8182
8202
|
}
|
|
8183
8203
|
if (content == null) {
|
|
8184
|
-
return /* @__PURE__ */
|
|
8204
|
+
return /* @__PURE__ */ jsx24("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u52A0\u8F7D\u4E2D\u2026" });
|
|
8185
8205
|
}
|
|
8186
8206
|
if (mode === "markdown") {
|
|
8187
|
-
return /* @__PURE__ */
|
|
8207
|
+
return /* @__PURE__ */ jsx24(MarkdownContent, { className: "prose prose-sm prose-invert max-w-none", children: content });
|
|
8188
8208
|
}
|
|
8189
|
-
return /* @__PURE__ */
|
|
8209
|
+
return /* @__PURE__ */ jsx24("pre", { className: "whitespace-pre-wrap font-mono text-xs leading-relaxed", children: content });
|
|
8190
8210
|
}
|
|
8191
8211
|
|
|
8192
8212
|
// src/chat/lib/preview-dispatch.ts
|
|
@@ -8226,7 +8246,7 @@ function dispatchPreview(filename, url) {
|
|
|
8226
8246
|
}
|
|
8227
8247
|
|
|
8228
8248
|
// src/chat/ContextAttachmentPills.tsx
|
|
8229
|
-
import { Fragment as
|
|
8249
|
+
import { Fragment as Fragment13, jsx as jsx25, jsxs as jsxs23 } from "react/jsx-runtime";
|
|
8230
8250
|
function ContextAttachmentPills({ attachments }) {
|
|
8231
8251
|
const client = useOptionalBladeClient();
|
|
8232
8252
|
const download = useRef15(null);
|
|
@@ -8264,24 +8284,24 @@ function ContextAttachmentPills({ attachments }) {
|
|
|
8264
8284
|
if (!controller.signal.aborted) setLoading(null);
|
|
8265
8285
|
}
|
|
8266
8286
|
};
|
|
8267
|
-
return /* @__PURE__ */
|
|
8268
|
-
/* @__PURE__ */
|
|
8287
|
+
return /* @__PURE__ */ jsxs23(Fragment13, { children: [
|
|
8288
|
+
/* @__PURE__ */ jsx25("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u9644\u52A0\u8D44\u6599", children: visibleAttachments.map((item) => /* @__PURE__ */ jsx25("button", { type: "button", onClick: () => {
|
|
8269
8289
|
setSelectedId(selectedId === item.id ? null : item.id);
|
|
8270
8290
|
setUnavailable(null);
|
|
8271
8291
|
}, "aria-expanded": selected?.id === item.id, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: item.label }, item.id)) }),
|
|
8272
|
-
selected && /* @__PURE__ */
|
|
8273
|
-
/* @__PURE__ */
|
|
8274
|
-
/* @__PURE__ */
|
|
8275
|
-
selected.files?.map((file, index) => /* @__PURE__ */
|
|
8292
|
+
selected && /* @__PURE__ */ jsxs23("div", { className: "max-w-full rounded-xl border border-border bg-muted p-3 text-sm text-foreground", children: [
|
|
8293
|
+
/* @__PURE__ */ jsx25("div", { className: "mb-2 font-medium", children: selected.label }),
|
|
8294
|
+
/* @__PURE__ */ jsx25("div", { className: "whitespace-pre-wrap break-words", children: selected.content }),
|
|
8295
|
+
selected.files?.map((file, index) => /* @__PURE__ */ jsxs23("button", { type: "button", disabled: loading != null || !file.path || !file.session_id, onClick: () => void openFile(file), className: "mt-2 block max-w-full truncate text-left underline", children: [
|
|
8276
8296
|
file.name,
|
|
8277
8297
|
!file.path || !file.session_id ? " \xB7 \u6587\u4EF6\u4E0D\u53EF\u7528" : loading === file.name ? " \xB7 \u8BFB\u53D6\u4E2D" : ""
|
|
8278
8298
|
] }, index)),
|
|
8279
|
-
unavailable && /* @__PURE__ */
|
|
8299
|
+
unavailable && /* @__PURE__ */ jsxs23("output", { className: "mt-2 block text-xs text-muted-foreground", children: [
|
|
8280
8300
|
unavailable,
|
|
8281
8301
|
" \xB7 \u6587\u4EF6\u4E0D\u53EF\u7528"
|
|
8282
8302
|
] })
|
|
8283
8303
|
] }),
|
|
8284
|
-
preview && /* @__PURE__ */
|
|
8304
|
+
preview && /* @__PURE__ */ jsx25(AttachmentPreviewDialog, { open: true, onOpenChange: (open) => {
|
|
8285
8305
|
if (!open) setPreview(null);
|
|
8286
8306
|
}, filename: preview.name, url: preview.url, mode: preview.mode })
|
|
8287
8307
|
] });
|
|
@@ -8345,17 +8365,17 @@ function parseWhatIfPrompt(text) {
|
|
|
8345
8365
|
}
|
|
8346
8366
|
|
|
8347
8367
|
// src/chat/MessageContextPills.tsx
|
|
8348
|
-
import { jsx as
|
|
8368
|
+
import { jsx as jsx26, jsxs as jsxs24 } from "react/jsx-runtime";
|
|
8349
8369
|
function MessageContextPills({ contexts }) {
|
|
8350
8370
|
if (contexts.length === 0) return null;
|
|
8351
|
-
return /* @__PURE__ */
|
|
8371
|
+
return /* @__PURE__ */ jsx26("div", { className: "flex flex-wrap gap-1.5", children: contexts.map((ctx, index) => /* @__PURE__ */ jsxs24(
|
|
8352
8372
|
"div",
|
|
8353
8373
|
{
|
|
8354
8374
|
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)]",
|
|
8355
8375
|
title: ctx.content,
|
|
8356
8376
|
children: [
|
|
8357
|
-
/* @__PURE__ */
|
|
8358
|
-
/* @__PURE__ */
|
|
8377
|
+
/* @__PURE__ */ jsx26(Bookmark, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.65)]" }),
|
|
8378
|
+
/* @__PURE__ */ jsx26("span", { className: "max-w-56 truncate", children: ctx.label })
|
|
8359
8379
|
]
|
|
8360
8380
|
},
|
|
8361
8381
|
`${ctx.label}:${index}`
|
|
@@ -8363,7 +8383,7 @@ function MessageContextPills({ contexts }) {
|
|
|
8363
8383
|
}
|
|
8364
8384
|
|
|
8365
8385
|
// src/chat/TextAttachmentPills.tsx
|
|
8366
|
-
import { Fragment as
|
|
8386
|
+
import { Fragment as Fragment14, jsx as jsx27, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
8367
8387
|
function getFileIcon2(fileName) {
|
|
8368
8388
|
const lower2 = fileName.toLowerCase();
|
|
8369
8389
|
if (/\.(zip|rar|7z|tar|gz)$/.test(lower2)) return Archive;
|
|
@@ -8378,15 +8398,15 @@ function getFileIcon2(fileName) {
|
|
|
8378
8398
|
function TextAttachmentPills({ attachments, onPreview }) {
|
|
8379
8399
|
if (attachments.length === 0) return null;
|
|
8380
8400
|
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)]";
|
|
8381
|
-
return /* @__PURE__ */
|
|
8401
|
+
return /* @__PURE__ */ jsx27("div", { className: "flex flex-wrap gap-1.5", children: attachments.map((att, index) => {
|
|
8382
8402
|
const Icon = getFileIcon2(att.name);
|
|
8383
8403
|
const key = `${att.uploadedPath ?? att.name}:${att.name}:${index}`;
|
|
8384
|
-
const content = /* @__PURE__ */
|
|
8385
|
-
/* @__PURE__ */
|
|
8386
|
-
/* @__PURE__ */
|
|
8404
|
+
const content = /* @__PURE__ */ jsxs25(Fragment14, { children: [
|
|
8405
|
+
/* @__PURE__ */ jsx27(Icon, { size: 12, className: "shrink-0 text-[hsl(var(--primary)/0.6)]" }),
|
|
8406
|
+
/* @__PURE__ */ jsx27("span", { className: "max-w-40 truncate", children: att.name })
|
|
8387
8407
|
] });
|
|
8388
8408
|
if (onPreview) {
|
|
8389
|
-
return /* @__PURE__ */
|
|
8409
|
+
return /* @__PURE__ */ jsx27(
|
|
8390
8410
|
"button",
|
|
8391
8411
|
{
|
|
8392
8412
|
type: "button",
|
|
@@ -8398,36 +8418,36 @@ function TextAttachmentPills({ attachments, onPreview }) {
|
|
|
8398
8418
|
key
|
|
8399
8419
|
);
|
|
8400
8420
|
}
|
|
8401
|
-
return /* @__PURE__ */
|
|
8421
|
+
return /* @__PURE__ */ jsx27("div", { className: pillClass, title: att.name, children: content }, key);
|
|
8402
8422
|
}) });
|
|
8403
8423
|
}
|
|
8404
8424
|
|
|
8405
8425
|
// src/components/WhatIfUserBubble.tsx
|
|
8406
|
-
import { jsx as
|
|
8426
|
+
import { jsx as jsx28, jsxs as jsxs26 } from "react/jsx-runtime";
|
|
8407
8427
|
function WhatIfUserBubble({ parsed, onQuoteClick }) {
|
|
8408
8428
|
const { fromStep, quotes, userText } = parsed;
|
|
8409
|
-
return /* @__PURE__ */
|
|
8410
|
-
/* @__PURE__ */
|
|
8411
|
-
/* @__PURE__ */
|
|
8412
|
-
/* @__PURE__ */
|
|
8429
|
+
return /* @__PURE__ */ jsxs26("div", { className: "flex flex-col items-end gap-2", children: [
|
|
8430
|
+
/* @__PURE__ */ jsxs26("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: [
|
|
8431
|
+
/* @__PURE__ */ jsx28(RefreshCcw, { size: 10 }),
|
|
8432
|
+
/* @__PURE__ */ jsx28("span", { children: fromStep != null ? `\u91CD\u8DD1\u81EA step ${fromStep}` : "\u91CD\u8DD1" })
|
|
8413
8433
|
] }),
|
|
8414
|
-
quotes.length > 0 && /* @__PURE__ */
|
|
8434
|
+
quotes.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex max-w-[min(72vw,42rem)] flex-col items-stretch gap-2", children: quotes.map((quote, index) => {
|
|
8415
8435
|
const clickable = quote.stepNumber != null && !!onQuoteClick;
|
|
8416
8436
|
const label = quote.stepNumber != null ? `\u6B65\u9AA4${quote.stepNumber} \xB7 ${quote.label}` : quote.label;
|
|
8417
|
-
return /* @__PURE__ */
|
|
8418
|
-
/* @__PURE__ */
|
|
8419
|
-
/* @__PURE__ */
|
|
8420
|
-
/* @__PURE__ */
|
|
8437
|
+
return /* @__PURE__ */ jsxs26("div", { className: "rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card)/0.8)] px-3 py-2 text-left", children: [
|
|
8438
|
+
/* @__PURE__ */ jsxs26("button", { type: "button", disabled: !clickable, onClick: () => clickable && onQuoteClick(quote.stepNumber), className: "inline-flex max-w-full items-center gap-1 text-[11px] font-medium text-[hsl(var(--muted-foreground))] hover:text-[hsl(var(--foreground))] disabled:cursor-default", title: clickable ? "\u8DF3\u8F6C\u5230\u5BF9\u5E94\u6B65\u9AA4\u5361\u7247" : void 0, children: [
|
|
8439
|
+
/* @__PURE__ */ jsx28("span", { children: "\u21B3" }),
|
|
8440
|
+
/* @__PURE__ */ jsx28("span", { className: "truncate", children: label })
|
|
8421
8441
|
] }),
|
|
8422
|
-
quote.snapshot ? /* @__PURE__ */
|
|
8442
|
+
quote.snapshot ? /* @__PURE__ */ jsx28("div", { className: "mt-1 border-l-2 border-[hsl(var(--accent-foreground)/0.35)] pl-2 text-xs leading-relaxed text-[hsl(var(--foreground)/0.8)]", children: /* @__PURE__ */ jsx28(MarkdownContent, { className: "blade-chat-prose", children: quote.snapshot }) }) : null
|
|
8423
8443
|
] }, `${quote.stepNumber ?? "x"}-${index}`);
|
|
8424
8444
|
}) }),
|
|
8425
|
-
userText && /* @__PURE__ */
|
|
8445
|
+
userText && /* @__PURE__ */ jsx28("div", { className: "rounded-2xl border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-sm leading-relaxed text-[hsl(var(--user-msg-fg))]", children: /* @__PURE__ */ jsx28(MarkdownContent, { className: "blade-chat-prose", children: userText }) })
|
|
8426
8446
|
] });
|
|
8427
8447
|
}
|
|
8428
8448
|
|
|
8429
8449
|
// src/chat/UserMessageBubble.tsx
|
|
8430
|
-
import { jsx as
|
|
8450
|
+
import { Fragment as Fragment15, jsx as jsx29, jsxs as jsxs27 } from "react/jsx-runtime";
|
|
8431
8451
|
function isUserMessage(message) {
|
|
8432
8452
|
return message.role === "user";
|
|
8433
8453
|
}
|
|
@@ -8477,19 +8497,23 @@ function UserMessageBubble({ message, className }) {
|
|
|
8477
8497
|
contexts: textContexts
|
|
8478
8498
|
} = extractTextAttachments(message.content);
|
|
8479
8499
|
const trimmedClean = cleanText.trim();
|
|
8480
|
-
const
|
|
8481
|
-
const
|
|
8500
|
+
const skillRefs = message.refs?.filter((ref) => ref.provider === "skill");
|
|
8501
|
+
const skillPills = /* @__PURE__ */ jsx29(UserMessageText, { text: cleanText, skillRefs, renderText: () => null });
|
|
8502
|
+
const pluginRefs = message.refs?.filter((ref) => ref.provider === "plugin");
|
|
8503
|
+
const pluginPills = pluginRefs?.length ? /* @__PURE__ */ jsx29("div", { className: "flex flex-wrap justify-end gap-1.5", "aria-label": "\u6D88\u606F\u5F15\u7528", children: pluginRefs.map((ref) => /* @__PURE__ */ jsx29("span", { className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs", children: ref.label }, `${ref.plugin}:${ref.server}:${ref.id}`)) }) : null;
|
|
8504
|
+
const topicAssetPills = message.topic_asset_refs?.length ? /* @__PURE__ */ jsx29("div", { className: "flex max-w-full flex-wrap justify-end gap-1.5", "aria-label": "\u5F15\u7528\u7684\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7", children: message.topic_asset_refs.map((ref) => /* @__PURE__ */ jsxs27("span", { title: ref.path, className: "max-w-full truncate rounded-full border border-border bg-muted px-2.5 py-1 text-xs text-foreground", children: [
|
|
8482
8505
|
"\u5DE5\u4F5C\u7A7A\u95F4\u8D44\u4EA7 \xB7 ",
|
|
8483
8506
|
ref.path
|
|
8484
8507
|
] }, `${ref.topic_id}:${ref.path}`)) }) : null;
|
|
8485
8508
|
const whatifParsed = trimmedClean && imageParts.length === 0 && fileParts.length === 0 && textAttachments.length === 0 ? parseWhatIfPrompt(cleanText) : null;
|
|
8486
8509
|
if (whatifParsed && customBubble == null) {
|
|
8487
|
-
return /* @__PURE__ */
|
|
8510
|
+
return /* @__PURE__ */ jsx29("div", { part: "user-row", className: "blade-chat-user-row flex justify-end", children: /* @__PURE__ */ jsxs27("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-2", children: [
|
|
8488
8511
|
pluginPills,
|
|
8489
8512
|
topicAssetPills,
|
|
8490
|
-
/* @__PURE__ */
|
|
8491
|
-
|
|
8492
|
-
|
|
8513
|
+
/* @__PURE__ */ jsx29(ContextAttachmentPills, { attachments: message.context_attachments }),
|
|
8514
|
+
skillPills,
|
|
8515
|
+
/* @__PURE__ */ jsx29(WhatIfUserBubble, { parsed: whatifParsed }),
|
|
8516
|
+
whatifParsed.userText && /* @__PURE__ */ jsx29(
|
|
8493
8517
|
MessageActions,
|
|
8494
8518
|
{
|
|
8495
8519
|
content: whatifParsed.userText,
|
|
@@ -8540,16 +8564,16 @@ function UserMessageBubble({ message, className }) {
|
|
|
8540
8564
|
const mode = kind === "text" ? lower2.endsWith(".md") ? "markdown" : "text" : "default";
|
|
8541
8565
|
setPreview({ filename: attachment.name, url, mode });
|
|
8542
8566
|
};
|
|
8543
|
-
return /* @__PURE__ */
|
|
8544
|
-
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */
|
|
8545
|
-
imageParts.map((part, idx) => /* @__PURE__ */
|
|
8567
|
+
return /* @__PURE__ */ jsx29("div", { part: "user-row", className: cn("blade-chat-user-row flex justify-end", className), children: /* @__PURE__ */ jsxs27("div", { className: "blade-chat-user-col group flex max-w-[72%] flex-col items-end gap-3", children: [
|
|
8568
|
+
(imageParts.length > 0 || imageTextAttachmentMeta.length > 0) && /* @__PURE__ */ jsxs27("div", { className: "grid gap-2", children: [
|
|
8569
|
+
imageParts.map((part, idx) => /* @__PURE__ */ jsx29(
|
|
8546
8570
|
"button",
|
|
8547
8571
|
{
|
|
8548
8572
|
type: "button",
|
|
8549
8573
|
onClick: () => setLightboxIndex(idx),
|
|
8550
8574
|
className: "cursor-zoom-in",
|
|
8551
8575
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
8552
|
-
children: /* @__PURE__ */
|
|
8576
|
+
children: /* @__PURE__ */ jsx29(
|
|
8553
8577
|
MessageImage,
|
|
8554
8578
|
{
|
|
8555
8579
|
src: part.image_url.url,
|
|
@@ -8564,14 +8588,14 @@ function UserMessageBubble({ message, className }) {
|
|
|
8564
8588
|
)),
|
|
8565
8589
|
imageTextAttachmentMeta.map((att, idx) => {
|
|
8566
8590
|
const blobUrl = imageAttachmentUrls[idx];
|
|
8567
|
-
return blobUrl ? /* @__PURE__ */
|
|
8591
|
+
return blobUrl ? /* @__PURE__ */ jsx29(
|
|
8568
8592
|
"button",
|
|
8569
8593
|
{
|
|
8570
8594
|
type: "button",
|
|
8571
8595
|
onClick: () => setLightboxIndex(imageParts.length + idx),
|
|
8572
8596
|
className: "cursor-zoom-in",
|
|
8573
8597
|
title: "\u67E5\u770B\u5927\u56FE",
|
|
8574
|
-
children: /* @__PURE__ */
|
|
8598
|
+
children: /* @__PURE__ */ jsx29(
|
|
8575
8599
|
"img",
|
|
8576
8600
|
{
|
|
8577
8601
|
src: blobUrl,
|
|
@@ -8581,7 +8605,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
8581
8605
|
)
|
|
8582
8606
|
},
|
|
8583
8607
|
`${att.uploadedPath}:${att.name}`
|
|
8584
|
-
) : blobUrl === null ? null : /* @__PURE__ */
|
|
8608
|
+
) : blobUrl === null ? null : /* @__PURE__ */ jsx29(
|
|
8585
8609
|
"div",
|
|
8586
8610
|
{
|
|
8587
8611
|
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))]",
|
|
@@ -8591,7 +8615,7 @@ function UserMessageBubble({ message, className }) {
|
|
|
8591
8615
|
);
|
|
8592
8616
|
})
|
|
8593
8617
|
] }),
|
|
8594
|
-
lightboxImages.length > 0 && /* @__PURE__ */
|
|
8618
|
+
lightboxImages.length > 0 && /* @__PURE__ */ jsx29(
|
|
8595
8619
|
ImageLightbox,
|
|
8596
8620
|
{
|
|
8597
8621
|
open: lightboxIndex != null,
|
|
@@ -8602,15 +8626,15 @@ function UserMessageBubble({ message, className }) {
|
|
|
8602
8626
|
initialIndex: lightboxIndex ?? 0
|
|
8603
8627
|
}
|
|
8604
8628
|
),
|
|
8605
|
-
/* @__PURE__ */
|
|
8606
|
-
/* @__PURE__ */
|
|
8629
|
+
/* @__PURE__ */ jsx29(MessageFileAttachmentList, { files: fileParts }),
|
|
8630
|
+
/* @__PURE__ */ jsx29(
|
|
8607
8631
|
TextAttachmentPills,
|
|
8608
8632
|
{
|
|
8609
8633
|
attachments: nonImageTextAttachments,
|
|
8610
8634
|
onPreview: handleTextAttachmentPreview
|
|
8611
8635
|
}
|
|
8612
8636
|
),
|
|
8613
|
-
preview && /* @__PURE__ */
|
|
8637
|
+
preview && /* @__PURE__ */ jsx29(
|
|
8614
8638
|
AttachmentPreviewDialog,
|
|
8615
8639
|
{
|
|
8616
8640
|
open: preview != null,
|
|
@@ -8622,11 +8646,14 @@ function UserMessageBubble({ message, className }) {
|
|
|
8622
8646
|
mode: preview.mode
|
|
8623
8647
|
}
|
|
8624
8648
|
),
|
|
8625
|
-
/* @__PURE__ */
|
|
8649
|
+
/* @__PURE__ */ jsx29(MessageContextPills, { contexts: textContexts }),
|
|
8626
8650
|
pluginPills,
|
|
8627
8651
|
topicAssetPills,
|
|
8628
|
-
/* @__PURE__ */
|
|
8629
|
-
trimmedClean && (customBubble != null ?
|
|
8652
|
+
/* @__PURE__ */ jsx29(ContextAttachmentPills, { attachments: message.context_attachments }),
|
|
8653
|
+
(trimmedClean || Boolean(skillRefs?.length)) && (customBubble != null ? /* @__PURE__ */ jsxs27(Fragment15, { children: [
|
|
8654
|
+
skillPills,
|
|
8655
|
+
customBubble
|
|
8656
|
+
] }) : /* @__PURE__ */ jsx29(
|
|
8630
8657
|
"div",
|
|
8631
8658
|
{
|
|
8632
8659
|
part: "user-bubble",
|
|
@@ -8634,17 +8661,24 @@ function UserMessageBubble({ message, className }) {
|
|
|
8634
8661
|
"blade-chat-user-bubble max-w-full rounded-[24px] bg-[hsl(var(--user-msg-bg))] px-4 py-2.5 text-base leading-[1.7] transition-colors duration-200",
|
|
8635
8662
|
isSending(message) ? "text-[hsl(var(--muted-foreground))]" : "text-[hsl(var(--user-msg-fg))]"
|
|
8636
8663
|
),
|
|
8637
|
-
children: /* @__PURE__ */
|
|
8638
|
-
|
|
8664
|
+
children: /* @__PURE__ */ jsx29(
|
|
8665
|
+
UserMessageText,
|
|
8639
8666
|
{
|
|
8640
|
-
|
|
8641
|
-
|
|
8642
|
-
|
|
8667
|
+
text: cleanText,
|
|
8668
|
+
skillRefs,
|
|
8669
|
+
renderText: (body) => /* @__PURE__ */ jsx29(
|
|
8670
|
+
MarkdownContent,
|
|
8671
|
+
{
|
|
8672
|
+
className: cn(USER_MESSAGE_MARKDOWN_CLASS, "text-inherit [&_strong]:text-inherit [&_p]:text-inherit"),
|
|
8673
|
+
controls: { code: true },
|
|
8674
|
+
children: body
|
|
8675
|
+
}
|
|
8676
|
+
)
|
|
8643
8677
|
}
|
|
8644
8678
|
)
|
|
8645
8679
|
}
|
|
8646
8680
|
)),
|
|
8647
|
-
trimmedClean && !isSending(message) && /* @__PURE__ */
|
|
8681
|
+
trimmedClean && !isSending(message) && /* @__PURE__ */ jsx29(MessageActions, { content: cleanText, className: "opacity-0 transition-opacity group-hover:opacity-100 [@media(hover:none)]:opacity-100" })
|
|
8648
8682
|
] }) });
|
|
8649
8683
|
}
|
|
8650
8684
|
function ErrorMessageBlock({
|
|
@@ -8653,9 +8687,9 @@ function ErrorMessageBlock({
|
|
|
8653
8687
|
}) {
|
|
8654
8688
|
const text = chatErrorForDisplay(getTextContent2(message.content));
|
|
8655
8689
|
const looksLikeModelUnavailable = /no source matches this model|404/i.test(text);
|
|
8656
|
-
return /* @__PURE__ */
|
|
8690
|
+
return /* @__PURE__ */ jsx29("div", { part: "error-row", className: cn("blade-chat-error-row flex min-w-0 justify-start", className), children: /* @__PURE__ */ jsxs27("div", { className: "min-w-0 max-w-full whitespace-pre-wrap break-words border-l-[3px] border-[hsl(var(--border))] px-3 py-1 text-left text-sm leading-7 text-[hsl(var(--muted-foreground))] [overflow-wrap:anywhere]", children: [
|
|
8657
8691
|
text,
|
|
8658
|
-
looksLikeModelUnavailable ? /* @__PURE__ */
|
|
8692
|
+
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
|
|
8659
8693
|
] }) });
|
|
8660
8694
|
}
|
|
8661
8695
|
|
|
@@ -8668,7 +8702,7 @@ function findLatestReasoningMessageIndex(messages) {
|
|
|
8668
8702
|
}
|
|
8669
8703
|
|
|
8670
8704
|
// src/chat/AgentLoopBlock.tsx
|
|
8671
|
-
import { Fragment as
|
|
8705
|
+
import { Fragment as Fragment16, jsx as jsx30, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
8672
8706
|
var COLLAPSED_SUMMARY_HIDDEN_TOOLS = /* @__PURE__ */ new Set(["ReadSkill", "Read"]);
|
|
8673
8707
|
function safeParseDescription(argsStr) {
|
|
8674
8708
|
try {
|
|
@@ -8771,7 +8805,7 @@ function AgentLoopBlock({
|
|
|
8771
8805
|
const status = hasAwaitingAnswer || toolCall.status === "awaiting_answer" && visibleLoopToolCalls.length === 0 ? "awaiting_answer" : toolCall.status === "pending" || loopEntry?.info.status === "running" ? "running" : toolCall.status === "error" || loopEntry?.info.status === "error" ? "error" : toolCall.status === "cancelled" || loopEntry?.info.status === "cancelled" ? "cancelled" : "done";
|
|
8772
8806
|
const latestReasoningIndex = status === "running" ? findLatestReasoningMessageIndex(childMessages) : -1;
|
|
8773
8807
|
const cardStyles = getLoopCardStyles(status);
|
|
8774
|
-
return /* @__PURE__ */
|
|
8808
|
+
return /* @__PURE__ */ jsxs28(
|
|
8775
8809
|
"div",
|
|
8776
8810
|
{
|
|
8777
8811
|
part: "agent-loop",
|
|
@@ -8780,8 +8814,8 @@ function AgentLoopBlock({
|
|
|
8780
8814
|
cardStyles.borderClass
|
|
8781
8815
|
),
|
|
8782
8816
|
children: [
|
|
8783
|
-
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */
|
|
8784
|
-
/* @__PURE__ */
|
|
8817
|
+
status === "running" || status === "awaiting_answer" ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
8818
|
+
/* @__PURE__ */ jsxs28(
|
|
8785
8819
|
"div",
|
|
8786
8820
|
{
|
|
8787
8821
|
className: cn(
|
|
@@ -8789,24 +8823,24 @@ function AgentLoopBlock({
|
|
|
8789
8823
|
cardStyles.headerClass
|
|
8790
8824
|
),
|
|
8791
8825
|
children: [
|
|
8792
|
-
/* @__PURE__ */
|
|
8826
|
+
/* @__PURE__ */ jsx30(
|
|
8793
8827
|
"button",
|
|
8794
8828
|
{
|
|
8795
8829
|
type: "button",
|
|
8796
8830
|
onClick: toggleExpanded,
|
|
8797
8831
|
"aria-expanded": expanded,
|
|
8798
8832
|
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",
|
|
8799
|
-
children: /* @__PURE__ */
|
|
8800
|
-
status === "awaiting_answer" ? /* @__PURE__ */
|
|
8801
|
-
/* @__PURE__ */
|
|
8833
|
+
children: /* @__PURE__ */ jsxs28("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
8834
|
+
status === "awaiting_answer" ? /* @__PURE__ */ jsx30(MessageSquareMore, { size: 14, className: "shrink-0 text-[hsl(var(--swf-warning))] motion-safe:animate-pulse" }) : /* @__PURE__ */ jsx30(Bot, { size: 14, className: "shrink-0 text-[hsl(var(--muted-foreground))]" }),
|
|
8835
|
+
/* @__PURE__ */ jsxs28("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: [
|
|
8802
8836
|
renderDescription ? renderDescription(description) : description,
|
|
8803
8837
|
status === "awaiting_answer" ? " \u2014 \u7B49\u5F85\u56DE\u7B54" : ""
|
|
8804
8838
|
] })
|
|
8805
8839
|
] })
|
|
8806
8840
|
}
|
|
8807
8841
|
),
|
|
8808
|
-
reasoning ? /* @__PURE__ */
|
|
8809
|
-
/* @__PURE__ */
|
|
8842
|
+
reasoning ? /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
8843
|
+
/* @__PURE__ */ jsx30(
|
|
8810
8844
|
Bot,
|
|
8811
8845
|
{
|
|
8812
8846
|
size: 14,
|
|
@@ -8814,14 +8848,14 @@ function AgentLoopBlock({
|
|
|
8814
8848
|
"aria-label": "\u5B50\u667A\u80FD\u4F53"
|
|
8815
8849
|
}
|
|
8816
8850
|
),
|
|
8817
|
-
/* @__PURE__ */
|
|
8851
|
+
/* @__PURE__ */ jsx30(
|
|
8818
8852
|
"button",
|
|
8819
8853
|
{
|
|
8820
8854
|
type: "button",
|
|
8821
8855
|
onClick: toggleExpanded,
|
|
8822
8856
|
"aria-expanded": expanded,
|
|
8823
8857
|
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",
|
|
8824
|
-
children: /* @__PURE__ */
|
|
8858
|
+
children: /* @__PURE__ */ jsx30(
|
|
8825
8859
|
ChevronRight,
|
|
8826
8860
|
{
|
|
8827
8861
|
size: 14,
|
|
@@ -8836,7 +8870,7 @@ function AgentLoopBlock({
|
|
|
8836
8870
|
]
|
|
8837
8871
|
}
|
|
8838
8872
|
),
|
|
8839
|
-
!expanded ? /* @__PURE__ */
|
|
8873
|
+
!expanded ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-1 py-2", children: visibleLoopToolCalls.length > 0 ? visibleLoopToolCalls.slice(-1).map((childToolCall) => /* @__PURE__ */ jsx30(
|
|
8840
8874
|
ToolCallBlock,
|
|
8841
8875
|
{
|
|
8842
8876
|
toolCall: childToolCall,
|
|
@@ -8844,12 +8878,12 @@ function AgentLoopBlock({
|
|
|
8844
8878
|
level: 2
|
|
8845
8879
|
},
|
|
8846
8880
|
childToolCall.id
|
|
8847
|
-
)) : /* @__PURE__ */
|
|
8848
|
-
/* @__PURE__ */
|
|
8849
|
-
/* @__PURE__ */
|
|
8850
|
-
] }) }) : status === "awaiting_answer" ? /* @__PURE__ */
|
|
8851
|
-
] }) : /* @__PURE__ */
|
|
8852
|
-
/* @__PURE__ */
|
|
8881
|
+
)) : /* @__PURE__ */ jsxs28("div", { className: "flex items-center gap-2 px-4 py-1 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
8882
|
+
/* @__PURE__ */ jsx30(LoaderCircle, { size: 12, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]" }),
|
|
8883
|
+
/* @__PURE__ */ jsx30("span", { children: "\u6B63\u5728\u542F\u52A8..." })
|
|
8884
|
+
] }) }) : 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
|
|
8885
|
+
] }) : /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
8886
|
+
/* @__PURE__ */ jsxs28(
|
|
8853
8887
|
"div",
|
|
8854
8888
|
{
|
|
8855
8889
|
className: cn(
|
|
@@ -8857,21 +8891,21 @@ function AgentLoopBlock({
|
|
|
8857
8891
|
cardStyles.headerClass
|
|
8858
8892
|
),
|
|
8859
8893
|
children: [
|
|
8860
|
-
/* @__PURE__ */
|
|
8894
|
+
/* @__PURE__ */ jsx30(
|
|
8861
8895
|
"button",
|
|
8862
8896
|
{
|
|
8863
8897
|
type: "button",
|
|
8864
8898
|
onClick: toggleExpanded,
|
|
8865
8899
|
"aria-expanded": expanded,
|
|
8866
8900
|
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",
|
|
8867
|
-
children: /* @__PURE__ */
|
|
8868
|
-
status === "error" ? /* @__PURE__ */
|
|
8869
|
-
/* @__PURE__ */
|
|
8901
|
+
children: /* @__PURE__ */ jsxs28("span", { className: "min-w-0 flex items-center gap-2", children: [
|
|
8902
|
+
status === "error" ? /* @__PURE__ */ jsx30(X, { size: 14, className: cn("shrink-0", cardStyles.iconClass) }) : status === "cancelled" ? /* @__PURE__ */ jsx30(Ban, { size: 14, className: cn("shrink-0", cardStyles.iconClass) }) : /* @__PURE__ */ jsx30(Check, { size: 14, className: "shrink-0 text-[hsl(var(--swf-success))]" }),
|
|
8903
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate text-sm font-medium text-[hsl(var(--foreground))]", children: renderDescription ? renderDescription(description) : description })
|
|
8870
8904
|
] })
|
|
8871
8905
|
}
|
|
8872
8906
|
),
|
|
8873
|
-
reasoning ? /* @__PURE__ */
|
|
8874
|
-
/* @__PURE__ */
|
|
8907
|
+
reasoning ? /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning, variant: "block" }) : null,
|
|
8908
|
+
/* @__PURE__ */ jsx30(
|
|
8875
8909
|
Bot,
|
|
8876
8910
|
{
|
|
8877
8911
|
size: 14,
|
|
@@ -8879,14 +8913,14 @@ function AgentLoopBlock({
|
|
|
8879
8913
|
"aria-label": "\u5B50\u667A\u80FD\u4F53"
|
|
8880
8914
|
}
|
|
8881
8915
|
),
|
|
8882
|
-
/* @__PURE__ */
|
|
8916
|
+
/* @__PURE__ */ jsx30(
|
|
8883
8917
|
"button",
|
|
8884
8918
|
{
|
|
8885
8919
|
type: "button",
|
|
8886
8920
|
onClick: toggleExpanded,
|
|
8887
8921
|
"aria-expanded": expanded,
|
|
8888
8922
|
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",
|
|
8889
|
-
children: /* @__PURE__ */
|
|
8923
|
+
children: /* @__PURE__ */ jsx30(
|
|
8890
8924
|
ChevronRight,
|
|
8891
8925
|
{
|
|
8892
8926
|
size: 14,
|
|
@@ -8901,20 +8935,20 @@ function AgentLoopBlock({
|
|
|
8901
8935
|
]
|
|
8902
8936
|
}
|
|
8903
8937
|
),
|
|
8904
|
-
!expanded ? /* @__PURE__ */
|
|
8905
|
-
/* @__PURE__ */
|
|
8906
|
-
(item) => item.kind === "file" ? /* @__PURE__ */
|
|
8938
|
+
!expanded ? /* @__PURE__ */ jsxs28(Fragment16, { children: [
|
|
8939
|
+
/* @__PURE__ */ jsx30("div", { className: "flex flex-wrap gap-1.5 px-4 py-2", children: completedToolLabels.length > 0 ? completedToolLabels.map(
|
|
8940
|
+
(item) => item.kind === "file" ? /* @__PURE__ */ jsxs28(
|
|
8907
8941
|
"span",
|
|
8908
8942
|
{
|
|
8909
8943
|
className: "inline-flex min-w-0 items-center gap-1 rounded-[6px] bg-[hsl(var(--muted))] px-2 py-0.5 text-xs font-medium text-[hsl(var(--secondary-foreground))]",
|
|
8910
8944
|
title: item.label,
|
|
8911
8945
|
children: [
|
|
8912
|
-
/* @__PURE__ */
|
|
8913
|
-
/* @__PURE__ */
|
|
8946
|
+
/* @__PURE__ */ jsx30(FileText, { size: 12, className: "shrink-0", "aria-hidden": "true" }),
|
|
8947
|
+
/* @__PURE__ */ jsx30("span", { className: "truncate", children: item.label })
|
|
8914
8948
|
]
|
|
8915
8949
|
},
|
|
8916
8950
|
item.key
|
|
8917
|
-
) : /* @__PURE__ */
|
|
8951
|
+
) : /* @__PURE__ */ jsx30(
|
|
8918
8952
|
"span",
|
|
8919
8953
|
{
|
|
8920
8954
|
className: "inline-flex items-center rounded-[6px] bg-[hsl(var(--muted))] px-2 py-0.5 text-xs font-medium text-[hsl(var(--secondary-foreground))]",
|
|
@@ -8922,20 +8956,20 @@ function AgentLoopBlock({
|
|
|
8922
8956
|
},
|
|
8923
8957
|
item.key
|
|
8924
8958
|
)
|
|
8925
|
-
) : /* @__PURE__ */
|
|
8926
|
-
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */
|
|
8959
|
+
) : /* @__PURE__ */ jsx30("span", { className: "text-xs text-[hsl(var(--muted-foreground))]", children: "\u6682\u65E0\u5DE5\u5177\u8C03\u7528" }) }),
|
|
8960
|
+
inlineToolUiBlocks.length > 0 ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-2 px-4 pb-3", children: inlineToolUiBlocks.map((block) => /* @__PURE__ */ jsx30(ToolUiCard, { card: block.card, sessionId }, block.key)) }) : null
|
|
8927
8961
|
] }) : null
|
|
8928
8962
|
] }),
|
|
8929
|
-
expanded && /* @__PURE__ */
|
|
8963
|
+
expanded && /* @__PURE__ */ jsxs28("div", { className: "border-t border-[hsl(var(--border))] py-2", children: [
|
|
8930
8964
|
(() => {
|
|
8931
8965
|
const taskPrompt = safeParsePrompt(toolCall.arguments);
|
|
8932
|
-
return taskPrompt ? /* @__PURE__ */
|
|
8933
|
-
/* @__PURE__ */
|
|
8934
|
-
/* @__PURE__ */
|
|
8966
|
+
return taskPrompt ? /* @__PURE__ */ jsxs28("details", { className: "mx-3 mb-2 rounded-md bg-[hsl(var(--muted))]/40", children: [
|
|
8967
|
+
/* @__PURE__ */ jsx30("summary", { className: "cursor-pointer px-3 py-1.5 text-[11px] font-medium text-[hsl(var(--muted-foreground))]", children: "\u4EFB\u52A1" }),
|
|
8968
|
+
/* @__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 }) })
|
|
8935
8969
|
] }) : null;
|
|
8936
8970
|
})(),
|
|
8937
|
-
childMessages.length > 0 ? /* @__PURE__ */
|
|
8938
|
-
(message, index) => message.role === "assistant" ? /* @__PURE__ */
|
|
8971
|
+
childMessages.length > 0 ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-3 px-3", children: childMessages.map(
|
|
8972
|
+
(message, index) => message.role === "assistant" ? /* @__PURE__ */ jsx30(
|
|
8939
8973
|
ExpandedChildAssistantMessage,
|
|
8940
8974
|
{
|
|
8941
8975
|
message,
|
|
@@ -8945,13 +8979,13 @@ function AgentLoopBlock({
|
|
|
8945
8979
|
hideAskUserQuestions
|
|
8946
8980
|
},
|
|
8947
8981
|
message.entry_id ?? `${message.timestamp ?? "child"}-${index}`
|
|
8948
|
-
) : message.role === "user" ? /* @__PURE__ */
|
|
8982
|
+
) : message.role === "user" ? /* @__PURE__ */ jsx30(
|
|
8949
8983
|
ExpandedChildUserMessage,
|
|
8950
8984
|
{
|
|
8951
8985
|
message
|
|
8952
8986
|
},
|
|
8953
8987
|
message.entry_id ?? `${message.timestamp ?? "user"}-${index}`
|
|
8954
|
-
) : message.role === "error" ? /* @__PURE__ */
|
|
8988
|
+
) : message.role === "error" ? /* @__PURE__ */ jsx30(
|
|
8955
8989
|
"div",
|
|
8956
8990
|
{
|
|
8957
8991
|
className: "border-l-[2px] border-l-[hsl(var(--border))] px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]",
|
|
@@ -8959,17 +8993,17 @@ function AgentLoopBlock({
|
|
|
8959
8993
|
},
|
|
8960
8994
|
message.entry_id ?? `${message.timestamp ?? "error"}-${index}`
|
|
8961
8995
|
) : null
|
|
8962
|
-
) }) : status === "running" ? /* @__PURE__ */
|
|
8963
|
-
/* @__PURE__ */
|
|
8996
|
+
) }) : status === "running" ? /* @__PURE__ */ jsxs28("div", { className: "px-3 py-2 text-[11px] text-[hsl(var(--muted-foreground))]", children: [
|
|
8997
|
+
/* @__PURE__ */ jsx30(LoaderCircle, { size: 12, className: "mr-1.5 inline animate-spin" }),
|
|
8964
8998
|
"\u6B63\u5728\u542F\u52A8..."
|
|
8965
|
-
] }) : toolCall.result ? /* @__PURE__ */
|
|
8999
|
+
] }) : 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
|
|
8966
9000
|
] })
|
|
8967
9001
|
]
|
|
8968
9002
|
}
|
|
8969
9003
|
);
|
|
8970
9004
|
}
|
|
8971
9005
|
function ExpandedChildUserMessage({ message }) {
|
|
8972
|
-
return /* @__PURE__ */
|
|
9006
|
+
return /* @__PURE__ */ jsx30("div", { className: "pl-8", children: /* @__PURE__ */ jsx30(UserMessageBubble, { message }) });
|
|
8973
9007
|
}
|
|
8974
9008
|
function ExpandedChildAssistantMessage({
|
|
8975
9009
|
message,
|
|
@@ -8986,12 +9020,12 @@ function ExpandedChildAssistantMessage({
|
|
|
8986
9020
|
if (!text && !hasToolCalls && !(showReasoning && message.reasoning) && !message.blocks?.some((block) => block.type === "tool_ui")) {
|
|
8987
9021
|
return null;
|
|
8988
9022
|
}
|
|
8989
|
-
return /* @__PURE__ */
|
|
8990
|
-
showReasoning && message.reasoning && /* @__PURE__ */
|
|
8991
|
-
/* @__PURE__ */
|
|
8992
|
-
/* @__PURE__ */
|
|
9023
|
+
return /* @__PURE__ */ jsxs28("div", { className: "flex flex-col gap-2", children: [
|
|
9024
|
+
showReasoning && message.reasoning && /* @__PURE__ */ jsxs28(Reasoning, { isStreaming, children: [
|
|
9025
|
+
/* @__PURE__ */ jsx30(ReasoningTrigger, { wordCount: message.reasoning.length }),
|
|
9026
|
+
/* @__PURE__ */ jsx30(ReasoningContent, { children: message.reasoning })
|
|
8993
9027
|
] }),
|
|
8994
|
-
text ? /* @__PURE__ */
|
|
9028
|
+
text ? /* @__PURE__ */ jsx30(
|
|
8995
9029
|
ChildText,
|
|
8996
9030
|
{
|
|
8997
9031
|
text,
|
|
@@ -9000,8 +9034,8 @@ function ExpandedChildAssistantMessage({
|
|
|
9000
9034
|
reasoning: void 0
|
|
9001
9035
|
}
|
|
9002
9036
|
) : null,
|
|
9003
|
-
hasToolCalls && /* @__PURE__ */
|
|
9004
|
-
(toolCall) => formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */
|
|
9037
|
+
hasToolCalls && /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-2", children: toolCalls.map(
|
|
9038
|
+
(toolCall) => formatToolName(toolCall.name) === "Agent" ? /* @__PURE__ */ jsx30(
|
|
9005
9039
|
AgentLoopBlock,
|
|
9006
9040
|
{
|
|
9007
9041
|
toolCall,
|
|
@@ -9010,7 +9044,7 @@ function ExpandedChildAssistantMessage({
|
|
|
9010
9044
|
hideAskUserQuestions
|
|
9011
9045
|
},
|
|
9012
9046
|
toolCall.id
|
|
9013
|
-
) : /* @__PURE__ */
|
|
9047
|
+
) : /* @__PURE__ */ jsx30(
|
|
9014
9048
|
ToolCallBlock,
|
|
9015
9049
|
{
|
|
9016
9050
|
toolCall,
|
|
@@ -9022,8 +9056,8 @@ function ExpandedChildAssistantMessage({
|
|
|
9022
9056
|
toolCall.id
|
|
9023
9057
|
)
|
|
9024
9058
|
) }),
|
|
9025
|
-
message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */
|
|
9026
|
-
(block, index) => block.type === "tool_ui" && block.tool_call_id && isUiMeta(block.content) && block.content.target === "inline" ? /* @__PURE__ */
|
|
9059
|
+
message.blocks?.some((block) => block.type === "tool_ui") ? /* @__PURE__ */ jsx30("div", { className: "flex flex-col gap-2", children: message.blocks.map(
|
|
9060
|
+
(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(ToolUiCard, { card: block.content, sessionId }) }, `${block.tool_call_id}-${index}`) : null
|
|
9027
9061
|
) }) : null
|
|
9028
9062
|
] });
|
|
9029
9063
|
}
|
|
@@ -9033,8 +9067,8 @@ function ChildText({
|
|
|
9033
9067
|
sessionId,
|
|
9034
9068
|
reasoning
|
|
9035
9069
|
}) {
|
|
9036
|
-
return /* @__PURE__ */
|
|
9037
|
-
/* @__PURE__ */
|
|
9070
|
+
return /* @__PURE__ */ jsxs28("div", { className: "pl-8 text-[12px] leading-6 text-[hsl(var(--foreground))]", children: [
|
|
9071
|
+
/* @__PURE__ */ jsx30(
|
|
9038
9072
|
MarkdownContent,
|
|
9039
9073
|
{
|
|
9040
9074
|
mode: isStreaming ? "streaming" : "static",
|
|
@@ -9044,8 +9078,8 @@ function ChildText({
|
|
|
9044
9078
|
children: text
|
|
9045
9079
|
}
|
|
9046
9080
|
),
|
|
9047
|
-
isStreaming && /* @__PURE__ */
|
|
9048
|
-
reasoning ? /* @__PURE__ */
|
|
9081
|
+
isStreaming && /* @__PURE__ */ jsx30("span", { className: "ml-0.5 inline-block h-[1em] w-[3px] animate-pulse rounded-sm bg-current opacity-60" }),
|
|
9082
|
+
reasoning ? /* @__PURE__ */ jsx30(ThinkingBadge, { reasoning }) : null
|
|
9049
9083
|
] });
|
|
9050
9084
|
}
|
|
9051
9085
|
function getLoopCardStyles(status) {
|
|
@@ -9073,7 +9107,7 @@ function getLoopCardStyles(status) {
|
|
|
9073
9107
|
}
|
|
9074
9108
|
|
|
9075
9109
|
// src/chat/WorkflowRunBlock.tsx
|
|
9076
|
-
import { Fragment as
|
|
9110
|
+
import { Fragment as Fragment17, jsx as jsx31, jsxs as jsxs29 } from "react/jsx-runtime";
|
|
9077
9111
|
var EMPTY_ENTRIES = [];
|
|
9078
9112
|
var NO_SKILLS = [];
|
|
9079
9113
|
function workflowTitle(name, argumentsJson, skills) {
|
|
@@ -9128,10 +9162,10 @@ function stepStatus(group, runStatus) {
|
|
|
9128
9162
|
return runStatus === "done" ? "done" : void 0;
|
|
9129
9163
|
}
|
|
9130
9164
|
function StatusIcon({ status }) {
|
|
9131
|
-
if (status === "done") return /* @__PURE__ */
|
|
9132
|
-
if (status === "running") return /* @__PURE__ */
|
|
9133
|
-
if (status === "error") return /* @__PURE__ */
|
|
9134
|
-
if (status === "cancelled") return /* @__PURE__ */
|
|
9165
|
+
if (status === "done") return /* @__PURE__ */ jsx31(Check, { size: 13, className: "shrink-0 text-emerald-600", "aria-label": "\u5B8C\u6210" });
|
|
9166
|
+
if (status === "running") return /* @__PURE__ */ jsx31(LoaderCircle, { size: 13, className: "shrink-0 animate-spin text-[hsl(var(--muted-foreground))]", "aria-label": "\u8FDB\u884C\u4E2D" });
|
|
9167
|
+
if (status === "error") return /* @__PURE__ */ jsx31(X, { size: 13, className: "shrink-0 text-red-600", "aria-label": "\u5931\u8D25" });
|
|
9168
|
+
if (status === "cancelled") return /* @__PURE__ */ jsx31(CircleSlash, { size: 13, className: "shrink-0 text-[hsl(var(--muted-foreground))]", "aria-label": "\u5DF2\u53D6\u6D88" });
|
|
9135
9169
|
return null;
|
|
9136
9170
|
}
|
|
9137
9171
|
var CONTAINER_LABEL = { parallel: "\u5E76\u884C", choice: "\u6761\u4EF6", end: "\u7ED3\u675F" };
|
|
@@ -9144,7 +9178,7 @@ function meaningfulLogs(logs) {
|
|
|
9144
9178
|
}
|
|
9145
9179
|
function LogLines({ logs }) {
|
|
9146
9180
|
if (logs.length === 0) return null;
|
|
9147
|
-
return /* @__PURE__ */
|
|
9181
|
+
return /* @__PURE__ */ jsx31("div", { className: "flex flex-col gap-0.5", children: logs.map((log, index) => /* @__PURE__ */ jsx31(
|
|
9148
9182
|
"div",
|
|
9149
9183
|
{
|
|
9150
9184
|
className: "whitespace-pre-wrap break-words font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]",
|
|
@@ -9175,7 +9209,7 @@ function RefTokenText({ text, refs }) {
|
|
|
9175
9209
|
const id = match[1];
|
|
9176
9210
|
const info = refs.get(id);
|
|
9177
9211
|
parts.push(
|
|
9178
|
-
/* @__PURE__ */
|
|
9212
|
+
/* @__PURE__ */ jsxs29(
|
|
9179
9213
|
"span",
|
|
9180
9214
|
{
|
|
9181
9215
|
title: info?.value ? info.value.slice(0, 300) : "\u5C1A\u65E0\u8F93\u51FA",
|
|
@@ -9191,7 +9225,7 @@ function RefTokenText({ text, refs }) {
|
|
|
9191
9225
|
cursor = match.index + match[0].length;
|
|
9192
9226
|
}
|
|
9193
9227
|
if (cursor < text.length) parts.push(text.slice(cursor));
|
|
9194
|
-
return /* @__PURE__ */
|
|
9228
|
+
return /* @__PURE__ */ jsx31(Fragment17, { children: parts });
|
|
9195
9229
|
}
|
|
9196
9230
|
function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
9197
9231
|
const run = useSessionState(sessionId, (state2) => state2.workflowRuns[toolCall.id]);
|
|
@@ -9239,7 +9273,7 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9239
9273
|
});
|
|
9240
9274
|
return map2;
|
|
9241
9275
|
}, [toolCall.arguments, groups, groupLoops, sessionMessages]);
|
|
9242
|
-
const renderRefText = (text) => /* @__PURE__ */
|
|
9276
|
+
const renderRefText = (text) => /* @__PURE__ */ jsx31(RefTokenText, { text, refs: refInfos });
|
|
9243
9277
|
const finalOutput = useMemo12(
|
|
9244
9278
|
() => output.split("\n").filter((line) => !line.startsWith(LOG_PREFIX)).join("\n").trim(),
|
|
9245
9279
|
[output]
|
|
@@ -9253,8 +9287,8 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9253
9287
|
const title = workflowTitle(run?.name || "\u6280\u80FD", toolCall.arguments, sessionSkills);
|
|
9254
9288
|
const statusSummary = running ? `\u8FDB\u884C\u4E2D \xB7 ${stepCount} \u6B65` : status === "error" ? `\u5931\u8D25 \xB7 ${stepCount} \u6B65` : status === "cancelled" ? `\u5DF2\u53D6\u6D88 \xB7 ${stepCount} \u6B65` : `\u5DF2\u5B8C\u6210 \xB7 ${stepCount} \u6B65`;
|
|
9255
9289
|
const hasStepContent = groups.length > 0 || stepLoops.length > 0;
|
|
9256
|
-
return /* @__PURE__ */
|
|
9257
|
-
/* @__PURE__ */
|
|
9290
|
+
return /* @__PURE__ */ jsxs29("div", { className: "msg-animate overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))]/50", children: [
|
|
9291
|
+
/* @__PURE__ */ jsxs29(
|
|
9258
9292
|
"button",
|
|
9259
9293
|
{
|
|
9260
9294
|
type: "button",
|
|
@@ -9262,16 +9296,16 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9262
9296
|
"aria-expanded": !collapsed,
|
|
9263
9297
|
className: "flex w-full items-center gap-2 border-b border-[hsl(var(--border))] bg-[hsl(var(--primary)/0.06)] px-4 py-2.5 text-left transition-colors hover:bg-[hsl(var(--primary)/0.1)] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
9264
9298
|
children: [
|
|
9265
|
-
/* @__PURE__ */
|
|
9266
|
-
/* @__PURE__ */
|
|
9299
|
+
/* @__PURE__ */ jsx31(Zap, { size: 15, className: "shrink-0 text-violet-600" }),
|
|
9300
|
+
/* @__PURE__ */ jsxs29("span", { className: "min-w-0 truncate text-sm font-semibold text-[hsl(var(--foreground))]", children: [
|
|
9267
9301
|
"\u56FA\u5B9A\u6D41\u7A0B \xB7 ",
|
|
9268
9302
|
title
|
|
9269
9303
|
] }),
|
|
9270
|
-
/* @__PURE__ */
|
|
9271
|
-
running ? /* @__PURE__ */
|
|
9304
|
+
/* @__PURE__ */ jsxs29("span", { className: "ml-auto flex shrink-0 items-center gap-1.5 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
9305
|
+
running ? /* @__PURE__ */ jsx31(LoaderCircle, { size: 12, className: "animate-spin" }) : null,
|
|
9272
9306
|
statusSummary
|
|
9273
9307
|
] }),
|
|
9274
|
-
/* @__PURE__ */
|
|
9308
|
+
/* @__PURE__ */ jsx31(
|
|
9275
9309
|
ChevronRight,
|
|
9276
9310
|
{
|
|
9277
9311
|
size: 15,
|
|
@@ -9284,14 +9318,14 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9284
9318
|
]
|
|
9285
9319
|
}
|
|
9286
9320
|
),
|
|
9287
|
-
!collapsed && /* @__PURE__ */
|
|
9288
|
-
/* @__PURE__ */
|
|
9321
|
+
!collapsed && /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-2 p-3", children: [
|
|
9322
|
+
/* @__PURE__ */ jsx31(LogLines, { logs: meaningfulLogs(prelude) }),
|
|
9289
9323
|
groups.map((group, index) => {
|
|
9290
9324
|
const loop = groupLoops[index];
|
|
9291
9325
|
const logs = meaningfulLogs(group.logs);
|
|
9292
9326
|
if (loop) {
|
|
9293
|
-
return /* @__PURE__ */
|
|
9294
|
-
/* @__PURE__ */
|
|
9327
|
+
return /* @__PURE__ */ jsxs29("div", { className: "flex flex-col gap-1", children: [
|
|
9328
|
+
/* @__PURE__ */ jsx31(
|
|
9295
9329
|
AgentLoopBlock,
|
|
9296
9330
|
{
|
|
9297
9331
|
toolCall: synthToolCall(loop.loopName, loop.info, group.desc),
|
|
@@ -9300,11 +9334,11 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9300
9334
|
renderDescription: renderRefText
|
|
9301
9335
|
}
|
|
9302
9336
|
),
|
|
9303
|
-
/* @__PURE__ */
|
|
9337
|
+
/* @__PURE__ */ jsx31(LogLines, { logs })
|
|
9304
9338
|
] }, group.key);
|
|
9305
9339
|
}
|
|
9306
9340
|
const container = CONTAINER_LABEL[group.stepKind];
|
|
9307
|
-
return /* @__PURE__ */
|
|
9341
|
+
return /* @__PURE__ */ jsxs29(
|
|
9308
9342
|
"div",
|
|
9309
9343
|
{
|
|
9310
9344
|
className: cn(
|
|
@@ -9312,18 +9346,18 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9312
9346
|
container ? "border border-dashed border-violet-400/50 bg-violet-500/5" : "border border-[hsl(var(--border))] bg-[hsl(var(--card))]"
|
|
9313
9347
|
),
|
|
9314
9348
|
children: [
|
|
9315
|
-
/* @__PURE__ */
|
|
9316
|
-
/* @__PURE__ */
|
|
9317
|
-
container ? /* @__PURE__ */
|
|
9318
|
-
/* @__PURE__ */
|
|
9349
|
+
/* @__PURE__ */ jsxs29("div", { className: "flex items-center gap-1.5 text-sm text-[hsl(var(--foreground))]", children: [
|
|
9350
|
+
/* @__PURE__ */ jsx31(StatusIcon, { status: stepStatus(group, status) }),
|
|
9351
|
+
container ? /* @__PURE__ */ jsx31("span", { className: "text-[11px] font-semibold text-violet-600", children: container }) : null,
|
|
9352
|
+
/* @__PURE__ */ jsx31("span", { className: "min-w-0 truncate", children: renderRefText(group.desc || group.stepId) })
|
|
9319
9353
|
] }),
|
|
9320
|
-
/* @__PURE__ */
|
|
9354
|
+
/* @__PURE__ */ jsx31(LogLines, { logs })
|
|
9321
9355
|
]
|
|
9322
9356
|
},
|
|
9323
9357
|
group.key
|
|
9324
9358
|
);
|
|
9325
9359
|
}),
|
|
9326
|
-
leftoverLoops.map((step) => /* @__PURE__ */
|
|
9360
|
+
leftoverLoops.map((step) => /* @__PURE__ */ jsx31(
|
|
9327
9361
|
AgentLoopBlock,
|
|
9328
9362
|
{
|
|
9329
9363
|
toolCall: synthToolCall(step.loopName, step.info),
|
|
@@ -9333,12 +9367,12 @@ function WorkflowRunBlock({ toolCall, sessionId }) {
|
|
|
9333
9367
|
},
|
|
9334
9368
|
step.loopName
|
|
9335
9369
|
)),
|
|
9336
|
-
(!hasStepContent && output || status === "error" && output) && /* @__PURE__ */
|
|
9337
|
-
status === "done" && hasStepContent && finalOutput && /* @__PURE__ */
|
|
9338
|
-
/* @__PURE__ */
|
|
9339
|
-
/* @__PURE__ */
|
|
9370
|
+
(!hasStepContent && output || status === "error" && output) && /* @__PURE__ */ jsx31("pre", { className: "max-h-48 overflow-y-auto whitespace-pre-wrap break-words rounded-lg border border-[hsl(var(--border))] px-3 py-2 font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]", children: output }),
|
|
9371
|
+
status === "done" && hasStepContent && finalOutput && /* @__PURE__ */ jsxs29("details", { className: "rounded-lg border border-[hsl(var(--border))] px-3 py-2", children: [
|
|
9372
|
+
/* @__PURE__ */ jsx31("summary", { className: "cursor-pointer select-none text-xs text-[hsl(var(--muted-foreground))]", children: "\u6700\u7EC8\u8F93\u51FA" }),
|
|
9373
|
+
/* @__PURE__ */ jsx31("pre", { className: "mt-1.5 max-h-48 overflow-y-auto whitespace-pre-wrap break-words font-mono text-[11px] leading-[1.5] text-[hsl(var(--muted-foreground))]", children: finalOutput })
|
|
9340
9374
|
] }),
|
|
9341
|
-
status === "done" && hasStepContent && /* @__PURE__ */
|
|
9375
|
+
status === "done" && hasStepContent && /* @__PURE__ */ jsx31("div", { className: "py-0.5 text-center text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u23F9 \u6D41\u7A0B\u5230\u6B64\u7ED3\u675F" })
|
|
9342
9376
|
] })
|
|
9343
9377
|
] });
|
|
9344
9378
|
}
|
|
@@ -9395,7 +9429,7 @@ function toolCallAnswered(toolCall, sessionStatus, answerData) {
|
|
|
9395
9429
|
}
|
|
9396
9430
|
|
|
9397
9431
|
// src/chat/AssistantTurnBlock.tsx
|
|
9398
|
-
import { jsx as
|
|
9432
|
+
import { jsx as jsx32, jsxs as jsxs30 } from "react/jsx-runtime";
|
|
9399
9433
|
var EMPTY_MESSAGES = [];
|
|
9400
9434
|
var EMPTY_AGENT_LOOPS = {};
|
|
9401
9435
|
var turnDisplayModeMemory = /* @__PURE__ */ new Map();
|
|
@@ -9723,7 +9757,7 @@ function AssistantTurnBlockBase({
|
|
|
9723
9757
|
if (observedMemoryRefs.length > 0) setCachedMemoryRefs(observedMemoryRefs);
|
|
9724
9758
|
}, [observedMemoryRefs]);
|
|
9725
9759
|
const memoryRefs = observedMemoryRefs.length > 0 ? observedMemoryRefs : cachedMemoryRefs;
|
|
9726
|
-
return /* @__PURE__ */
|
|
9760
|
+
return /* @__PURE__ */ jsxs30(
|
|
9727
9761
|
"div",
|
|
9728
9762
|
{
|
|
9729
9763
|
"aria-busy": isStreaming || void 0,
|
|
@@ -9734,21 +9768,21 @@ function AssistantTurnBlockBase({
|
|
|
9734
9768
|
customization?.classNames?.assistantTurn
|
|
9735
9769
|
),
|
|
9736
9770
|
children: [
|
|
9737
|
-
memoryRefs.length > 0 && /* @__PURE__ */
|
|
9738
|
-
!hasExecutionProcess && terminalLabel && /* @__PURE__ */
|
|
9739
|
-
hasInterruptedState && !terminalLabel && /* @__PURE__ */
|
|
9740
|
-
hasFailedWithoutContent && !terminalLabel && /* @__PURE__ */
|
|
9741
|
-
hasExecutionProcess && /* @__PURE__ */
|
|
9742
|
-
/* @__PURE__ */
|
|
9771
|
+
memoryRefs.length > 0 && /* @__PURE__ */ jsx32(MemoryRefsHint, { refs: memoryRefs }),
|
|
9772
|
+
!hasExecutionProcess && terminalLabel && /* @__PURE__ */ jsx32("div", { className: "text-xs text-muted-foreground", children: terminalLabel }),
|
|
9773
|
+
hasInterruptedState && !terminalLabel && /* @__PURE__ */ jsx32("div", { className: "w-fit rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--swf-warning))]", children: "\u5DF2\u4E2D\u65AD" }),
|
|
9774
|
+
hasFailedWithoutContent && !terminalLabel && /* @__PURE__ */ jsx32("div", { className: "w-fit rounded-full border border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--destructive))]", children: "\u751F\u6210\u5931\u8D25" }),
|
|
9775
|
+
hasExecutionProcess && /* @__PURE__ */ jsxs30("div", { className: "flex w-full items-start gap-2.5", children: [
|
|
9776
|
+
/* @__PURE__ */ jsx32(
|
|
9743
9777
|
"span",
|
|
9744
9778
|
{
|
|
9745
9779
|
className: "grid size-[30px] shrink-0 place-items-center rounded-full bg-[hsl(var(--muted)/0.55)] text-[hsl(var(--foreground))]",
|
|
9746
9780
|
"aria-hidden": "true",
|
|
9747
|
-
children: /* @__PURE__ */
|
|
9781
|
+
children: /* @__PURE__ */ jsx32(Bot, { size: 16 })
|
|
9748
9782
|
}
|
|
9749
9783
|
),
|
|
9750
|
-
/* @__PURE__ */
|
|
9751
|
-
/* @__PURE__ */
|
|
9784
|
+
/* @__PURE__ */ jsxs30("div", { className: "min-w-0 flex-1 pt-0.5", children: [
|
|
9785
|
+
/* @__PURE__ */ jsxs30(
|
|
9752
9786
|
"button",
|
|
9753
9787
|
{
|
|
9754
9788
|
type: "button",
|
|
@@ -9763,20 +9797,20 @@ function AssistantTurnBlockBase({
|
|
|
9763
9797
|
"data-testid": "assistant-execution-summary",
|
|
9764
9798
|
className: "-ml-2 inline-flex min-w-0 max-w-full select-none items-center gap-1 rounded-lg bg-transparent px-2 py-0.5 text-left text-xs leading-[22px] text-[hsl(var(--muted-foreground))] transition-colors hover:bg-[hsl(var(--accent)/0.5)] hover:text-[hsl(var(--foreground))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
9765
9799
|
children: [
|
|
9766
|
-
isStreaming ? /* @__PURE__ */
|
|
9800
|
+
isStreaming ? /* @__PURE__ */ jsx32(Shimmer, { as: "span", className: "min-w-0 truncate font-medium", children: executionSummaryLabel({
|
|
9767
9801
|
messages: assistantTurnMessages,
|
|
9768
9802
|
isStreaming,
|
|
9769
9803
|
durationMs: liveExecutionDurationMs,
|
|
9770
9804
|
sessionStatus,
|
|
9771
9805
|
askAnswers
|
|
9772
|
-
}) }) : /* @__PURE__ */
|
|
9806
|
+
}) }) : /* @__PURE__ */ jsx32("span", { className: "min-w-0 truncate", children: executionSummaryLabel({
|
|
9773
9807
|
messages: assistantTurnMessages,
|
|
9774
9808
|
isStreaming,
|
|
9775
9809
|
durationMs: liveExecutionDurationMs,
|
|
9776
9810
|
sessionStatus,
|
|
9777
9811
|
askAnswers
|
|
9778
9812
|
}) }),
|
|
9779
|
-
/* @__PURE__ */
|
|
9813
|
+
/* @__PURE__ */ jsx32(
|
|
9780
9814
|
ChevronRight,
|
|
9781
9815
|
{
|
|
9782
9816
|
size: 14,
|
|
@@ -9794,11 +9828,11 @@ function AssistantTurnBlockBase({
|
|
|
9794
9828
|
]
|
|
9795
9829
|
}
|
|
9796
9830
|
),
|
|
9797
|
-
/* @__PURE__ */
|
|
9831
|
+
/* @__PURE__ */ jsx32("div", { className: "mt-3 h-px w-full bg-[hsl(var(--border)/0.75)]" })
|
|
9798
9832
|
] })
|
|
9799
9833
|
] }),
|
|
9800
|
-
hasExecutionProcess && effectiveMode === "detail" ? /* @__PURE__ */
|
|
9801
|
-
/* @__PURE__ */
|
|
9834
|
+
hasExecutionProcess && effectiveMode === "detail" ? /* @__PURE__ */ jsxs30("div", { className: "ml-10 flex flex-col gap-1", children: [
|
|
9835
|
+
/* @__PURE__ */ jsx32(
|
|
9802
9836
|
AssistantMessages,
|
|
9803
9837
|
{
|
|
9804
9838
|
messages: assistantTurnMessages,
|
|
@@ -9816,7 +9850,7 @@ function AssistantTurnBlockBase({
|
|
|
9816
9850
|
customization
|
|
9817
9851
|
}
|
|
9818
9852
|
),
|
|
9819
|
-
workflowRunToolCalls.map((workflowToolCall) => /* @__PURE__ */
|
|
9853
|
+
workflowRunToolCalls.map((workflowToolCall) => /* @__PURE__ */ jsx32(
|
|
9820
9854
|
WorkflowRunBlock,
|
|
9821
9855
|
{
|
|
9822
9856
|
toolCall: workflowToolCall,
|
|
@@ -9825,9 +9859,9 @@ function AssistantTurnBlockBase({
|
|
|
9825
9859
|
workflowToolCall.id
|
|
9826
9860
|
))
|
|
9827
9861
|
] }) : null,
|
|
9828
|
-
effectiveMode === "compact" && allToolCalls.filter(namedSubagent2).map((tool) => /* @__PURE__ */
|
|
9829
|
-
resourceBlocks.some((block) => !compactOrderedToolIds.has(block.toolCallId)) ? /* @__PURE__ */
|
|
9830
|
-
previewToolCalls.some(({ toolCall }) => !compactOrderedToolIds.has(toolCall.id)) ? /* @__PURE__ */
|
|
9862
|
+
effectiveMode === "compact" && allToolCalls.filter(namedSubagent2).map((tool) => /* @__PURE__ */ jsx32(NamedSubagentCard, { tool, sessionId }, tool.id)),
|
|
9863
|
+
resourceBlocks.some((block) => !compactOrderedToolIds.has(block.toolCallId)) ? /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-3", children: resourceBlocks.filter((block) => !compactOrderedToolIds.has(block.toolCallId)).map((block) => /* @__PURE__ */ jsx32(ToolUiCard, { card: block.card, sessionId }, block.key)) }) : null,
|
|
9864
|
+
previewToolCalls.some(({ toolCall }) => !compactOrderedToolIds.has(toolCall.id)) ? /* @__PURE__ */ jsx32("div", { className: "flex flex-wrap gap-x-3 gap-y-1", children: previewToolCalls.filter(({ toolCall }) => !compactOrderedToolIds.has(toolCall.id)).map(({ key, toolCall, blocks }) => /* @__PURE__ */ jsx32(
|
|
9831
9865
|
ToolPreviewAction,
|
|
9832
9866
|
{
|
|
9833
9867
|
toolCall,
|
|
@@ -9837,7 +9871,7 @@ function AssistantTurnBlockBase({
|
|
|
9837
9871
|
},
|
|
9838
9872
|
key
|
|
9839
9873
|
)) }) : null,
|
|
9840
|
-
isDeveloperMode && fileToolCalls.some((toolCall) => !compactOrderedToolIds.has(toolCall.id)) ? /* @__PURE__ */
|
|
9874
|
+
isDeveloperMode && fileToolCalls.some((toolCall) => !compactOrderedToolIds.has(toolCall.id)) ? /* @__PURE__ */ jsx32("div", { className: "flex flex-wrap gap-x-3 gap-y-1", children: fileToolCalls.filter((toolCall) => !compactOrderedToolIds.has(toolCall.id)).map((toolCall) => /* @__PURE__ */ jsx32(
|
|
9841
9875
|
ToolFilePreviewAction,
|
|
9842
9876
|
{
|
|
9843
9877
|
toolCall,
|
|
@@ -9846,7 +9880,7 @@ function AssistantTurnBlockBase({
|
|
|
9846
9880
|
},
|
|
9847
9881
|
toolCall.id
|
|
9848
9882
|
)) }) : null,
|
|
9849
|
-
effectiveMode === "compact" && finalMessage && finalOrderedParts.length > 0 ? /* @__PURE__ */
|
|
9883
|
+
effectiveMode === "compact" && finalMessage && finalOrderedParts.length > 0 ? /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-3", children: finalOrderedParts.map((part) => part.type === "text" ? /* @__PURE__ */ jsx32(
|
|
9850
9884
|
AssistantMessageContent,
|
|
9851
9885
|
{
|
|
9852
9886
|
message: { ...finalMessage, content: part.content },
|
|
@@ -9857,12 +9891,12 @@ function AssistantTurnBlockBase({
|
|
|
9857
9891
|
toolCalls: turnToolCalls
|
|
9858
9892
|
},
|
|
9859
9893
|
part.key
|
|
9860
|
-
) : /* @__PURE__ */
|
|
9861
|
-
...resourceBlocks.filter((block) => block.toolCallId === toolCall.id).map((block) => /* @__PURE__ */
|
|
9862
|
-
...previewToolCalls.filter((item) => item.toolCall.id === toolCall.id).map(({ key, toolCall: previewToolCall, blocks }) => /* @__PURE__ */
|
|
9863
|
-
...fileToolCalls.filter((fileToolCall) => fileToolCall.id === toolCall.id).map((fileToolCall) => /* @__PURE__ */
|
|
9894
|
+
) : /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-3", children: part.toolCalls.flatMap((toolCall) => [
|
|
9895
|
+
...resourceBlocks.filter((block) => block.toolCallId === toolCall.id).map((block) => /* @__PURE__ */ jsx32(ToolUiCard, { card: block.card, sessionId }, block.key)),
|
|
9896
|
+
...previewToolCalls.filter((item) => item.toolCall.id === toolCall.id).map(({ key, toolCall: previewToolCall, blocks }) => /* @__PURE__ */ jsx32(ToolPreviewAction, { toolCall: previewToolCall, sessionId, turnBlocks: blocks, className: "text-xs leading-[22px]" }, key)),
|
|
9897
|
+
...fileToolCalls.filter((fileToolCall) => fileToolCall.id === toolCall.id).map((fileToolCall) => /* @__PURE__ */ jsx32(ToolFilePreviewAction, { toolCall: fileToolCall, sessionId, className: "max-w-full text-xs leading-[22px] text-[hsl(var(--swf-link-text))]" }, fileToolCall.id))
|
|
9864
9898
|
]) }, part.key)) }) : null,
|
|
9865
|
-
finalMessage && finalOrderedParts.length === 0 ? /* @__PURE__ */
|
|
9899
|
+
finalMessage && finalOrderedParts.length === 0 ? /* @__PURE__ */ jsx32("div", { children: /* @__PURE__ */ jsx32(
|
|
9866
9900
|
AssistantMessageContent,
|
|
9867
9901
|
{
|
|
9868
9902
|
message: finalMessage,
|
|
@@ -9873,7 +9907,7 @@ function AssistantTurnBlockBase({
|
|
|
9873
9907
|
toolCalls: turnToolCalls
|
|
9874
9908
|
}
|
|
9875
9909
|
) }) : null,
|
|
9876
|
-
/* @__PURE__ */
|
|
9910
|
+
/* @__PURE__ */ jsx32(
|
|
9877
9911
|
PersistentAskUserQuestions,
|
|
9878
9912
|
{
|
|
9879
9913
|
questions: persistentAskUserQuestions,
|
|
@@ -9885,7 +9919,7 @@ function AssistantTurnBlockBase({
|
|
|
9885
9919
|
customization
|
|
9886
9920
|
}
|
|
9887
9921
|
),
|
|
9888
|
-
SHOW_FILE_DELIVERY_CARDS && level === 1 && !isStreaming && /* @__PURE__ */
|
|
9922
|
+
SHOW_FILE_DELIVERY_CARDS && level === 1 && !isStreaming && /* @__PURE__ */ jsx32(
|
|
9889
9923
|
FileDeliveryCards,
|
|
9890
9924
|
{
|
|
9891
9925
|
toolCalls: turnToolCalls,
|
|
@@ -9893,7 +9927,7 @@ function AssistantTurnBlockBase({
|
|
|
9893
9927
|
excludePaths: excludeDeliveredPaths
|
|
9894
9928
|
}
|
|
9895
9929
|
),
|
|
9896
|
-
level === 1 && !isStreaming && finalMessageText ? /* @__PURE__ */
|
|
9930
|
+
level === 1 && !isStreaming && finalMessageText ? /* @__PURE__ */ jsx32(MessageActions, { content: finalMessageText, className: "-mt-1.5" }) : null
|
|
9897
9931
|
]
|
|
9898
9932
|
}
|
|
9899
9933
|
);
|
|
@@ -9920,7 +9954,7 @@ function PersistentAskUserQuestions({
|
|
|
9920
9954
|
customization
|
|
9921
9955
|
}) {
|
|
9922
9956
|
return questions.map(
|
|
9923
|
-
({ toolCall, turnBlocks }) => customization?.components?.ToolCall ? /* @__PURE__ */
|
|
9957
|
+
({ toolCall, turnBlocks }) => customization?.components?.ToolCall ? /* @__PURE__ */ jsx32(
|
|
9924
9958
|
customization.components.ToolCall,
|
|
9925
9959
|
{
|
|
9926
9960
|
toolCall,
|
|
@@ -9934,7 +9968,7 @@ function PersistentAskUserQuestions({
|
|
|
9934
9968
|
customization
|
|
9935
9969
|
},
|
|
9936
9970
|
toolCall.id
|
|
9937
|
-
) : /* @__PURE__ */
|
|
9971
|
+
) : /* @__PURE__ */ jsx32(
|
|
9938
9972
|
ToolCallBlock,
|
|
9939
9973
|
{
|
|
9940
9974
|
toolCall,
|
|
@@ -9961,9 +9995,9 @@ function DetailedToolCallList({
|
|
|
9961
9995
|
level,
|
|
9962
9996
|
customization
|
|
9963
9997
|
}) {
|
|
9964
|
-
return /* @__PURE__ */
|
|
9998
|
+
return /* @__PURE__ */ jsx32("div", { className: "flex flex-col gap-1", children: groupDetailedToolCalls(toolCalls).map((item) => {
|
|
9965
9999
|
if (item.kind === "read_group") {
|
|
9966
|
-
return /* @__PURE__ */
|
|
10000
|
+
return /* @__PURE__ */ jsx32(
|
|
9967
10001
|
CompactToolGroupBlock,
|
|
9968
10002
|
{
|
|
9969
10003
|
toolCalls: item.toolCalls,
|
|
@@ -9981,7 +10015,7 @@ function DetailedToolCallList({
|
|
|
9981
10015
|
}
|
|
9982
10016
|
const { toolCall } = item;
|
|
9983
10017
|
if (isWorkflowRunToolName2(toolCall.name)) return null;
|
|
9984
|
-
return customization?.components?.ToolCall ? /* @__PURE__ */
|
|
10018
|
+
return customization?.components?.ToolCall ? /* @__PURE__ */ jsx32(
|
|
9985
10019
|
customization.components.ToolCall,
|
|
9986
10020
|
{
|
|
9987
10021
|
toolCall,
|
|
@@ -9996,7 +10030,7 @@ function DetailedToolCallList({
|
|
|
9996
10030
|
customization
|
|
9997
10031
|
},
|
|
9998
10032
|
toolCall.id
|
|
9999
|
-
) : /* @__PURE__ */
|
|
10033
|
+
) : /* @__PURE__ */ jsx32(
|
|
10000
10034
|
ToolCallBlock,
|
|
10001
10035
|
{
|
|
10002
10036
|
toolCall,
|
|
@@ -10041,32 +10075,32 @@ function AssistantMessages({
|
|
|
10041
10075
|
);
|
|
10042
10076
|
const hasToolCalls = toolCalls.length > 0;
|
|
10043
10077
|
const orderedParts = getOrderedMessageParts(message, toolCalls);
|
|
10044
|
-
return /* @__PURE__ */
|
|
10078
|
+
return /* @__PURE__ */ jsxs30(
|
|
10045
10079
|
"div",
|
|
10046
10080
|
{
|
|
10047
10081
|
className: "flex flex-col gap-1",
|
|
10048
10082
|
children: [
|
|
10049
|
-
showReasoning && /* @__PURE__ */
|
|
10083
|
+
showReasoning && /* @__PURE__ */ jsxs30(
|
|
10050
10084
|
Reasoning,
|
|
10051
10085
|
{
|
|
10052
10086
|
isStreaming: isReasoningStreamingLastMessage,
|
|
10053
10087
|
part: "thinking",
|
|
10054
10088
|
className: "blade-chat-thinking",
|
|
10055
10089
|
children: [
|
|
10056
|
-
/* @__PURE__ */
|
|
10090
|
+
/* @__PURE__ */ jsx32(
|
|
10057
10091
|
ReasoningTrigger,
|
|
10058
10092
|
{
|
|
10059
10093
|
wordCount: reasoning.length,
|
|
10060
10094
|
className: "gap-1 rounded-none p-0 text-xs leading-[22px]",
|
|
10061
|
-
children: /* @__PURE__ */
|
|
10095
|
+
children: /* @__PURE__ */ jsx32("span", { children: isReasoningStreamingLastMessage ? "\u6B63\u5728\u601D\u8003" : "\u5DF2\u601D\u8003" })
|
|
10062
10096
|
}
|
|
10063
10097
|
),
|
|
10064
|
-
/* @__PURE__ */
|
|
10098
|
+
/* @__PURE__ */ jsx32(ReasoningContent, { className: "mt-1.5 rounded-none border-0 bg-transparent px-0 py-0 text-xs leading-[22px]", children: reasoning })
|
|
10065
10099
|
]
|
|
10066
10100
|
}
|
|
10067
10101
|
),
|
|
10068
10102
|
orderedParts.length > 0 ? orderedParts.map(
|
|
10069
|
-
(part) => part.type === "text" ? /* @__PURE__ */
|
|
10103
|
+
(part) => part.type === "text" ? /* @__PURE__ */ jsx32(
|
|
10070
10104
|
AssistantMessageContent,
|
|
10071
10105
|
{
|
|
10072
10106
|
message: { ...message, content: part.content },
|
|
@@ -10081,7 +10115,7 @@ function AssistantMessages({
|
|
|
10081
10115
|
)
|
|
10082
10116
|
},
|
|
10083
10117
|
part.key
|
|
10084
|
-
) : showToolDetails ? /* @__PURE__ */
|
|
10118
|
+
) : showToolDetails ? /* @__PURE__ */ jsx32(
|
|
10085
10119
|
DetailedToolCallList,
|
|
10086
10120
|
{
|
|
10087
10121
|
toolCalls: part.toolCalls,
|
|
@@ -10095,7 +10129,7 @@ function AssistantMessages({
|
|
|
10095
10129
|
},
|
|
10096
10130
|
part.key
|
|
10097
10131
|
) : null
|
|
10098
|
-
) : message !== hideMessageContentFor ? /* @__PURE__ */
|
|
10132
|
+
) : message !== hideMessageContentFor ? /* @__PURE__ */ jsx32(
|
|
10099
10133
|
AssistantMessageContent,
|
|
10100
10134
|
{
|
|
10101
10135
|
message,
|
|
@@ -10110,7 +10144,7 @@ function AssistantMessages({
|
|
|
10110
10144
|
compact: true
|
|
10111
10145
|
}
|
|
10112
10146
|
) : null,
|
|
10113
|
-
orderedParts.length === 0 && hasToolCalls && showToolDetails ? /* @__PURE__ */
|
|
10147
|
+
orderedParts.length === 0 && hasToolCalls && showToolDetails ? /* @__PURE__ */ jsx32(
|
|
10114
10148
|
DetailedToolCallList,
|
|
10115
10149
|
{
|
|
10116
10150
|
toolCalls,
|
|
@@ -10155,11 +10189,11 @@ function CompactToolGroupBlock({
|
|
|
10155
10189
|
level,
|
|
10156
10190
|
customization
|
|
10157
10191
|
}) {
|
|
10158
|
-
return /* @__PURE__ */
|
|
10192
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-1", children: [
|
|
10159
10193
|
toolCalls.map((toolCall) => {
|
|
10160
10194
|
if (isWorkflowRunToolName2(toolCall.name)) return null;
|
|
10161
10195
|
const CustomToolCall = customization?.components?.ToolCall;
|
|
10162
|
-
return CustomToolCall ? /* @__PURE__ */
|
|
10196
|
+
return CustomToolCall ? /* @__PURE__ */ jsx32(
|
|
10163
10197
|
CustomToolCall,
|
|
10164
10198
|
{
|
|
10165
10199
|
toolCall,
|
|
@@ -10173,7 +10207,7 @@ function CompactToolGroupBlock({
|
|
|
10173
10207
|
customization
|
|
10174
10208
|
},
|
|
10175
10209
|
toolCall.id
|
|
10176
|
-
) : /* @__PURE__ */
|
|
10210
|
+
) : /* @__PURE__ */ jsx32(
|
|
10177
10211
|
ToolCallBlock,
|
|
10178
10212
|
{
|
|
10179
10213
|
toolCall,
|
|
@@ -10190,7 +10224,7 @@ function CompactToolGroupBlock({
|
|
|
10190
10224
|
toolCall.id
|
|
10191
10225
|
);
|
|
10192
10226
|
}),
|
|
10193
|
-
reasoning ? /* @__PURE__ */
|
|
10227
|
+
reasoning ? /* @__PURE__ */ jsx32(ThinkingBadge, { reasoning, variant: "block" }) : null
|
|
10194
10228
|
] });
|
|
10195
10229
|
}
|
|
10196
10230
|
function AssistantMessageContent({
|
|
@@ -10216,9 +10250,9 @@ function AssistantMessageContent({
|
|
|
10216
10250
|
if (!text && imageParts.length === 0 && fileParts.length === 0 && !reasoning && !failed) {
|
|
10217
10251
|
return null;
|
|
10218
10252
|
}
|
|
10219
|
-
return /* @__PURE__ */
|
|
10220
|
-
failed ? /* @__PURE__ */
|
|
10221
|
-
imageParts.length > 0 && /* @__PURE__ */
|
|
10253
|
+
return /* @__PURE__ */ jsxs30("div", { className: "flex flex-col gap-3", children: [
|
|
10254
|
+
failed ? /* @__PURE__ */ jsx32("div", { className: "w-fit rounded-full border border-[hsl(var(--destructive)/0.3)] bg-[hsl(var(--destructive)/0.1)] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--destructive))]", children: "\u751F\u6210\u5931\u8D25" }) : null,
|
|
10255
|
+
imageParts.length > 0 && /* @__PURE__ */ jsx32("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx32(
|
|
10222
10256
|
MessageImage,
|
|
10223
10257
|
{
|
|
10224
10258
|
src: part.image_url.url,
|
|
@@ -10229,8 +10263,8 @@ function AssistantMessageContent({
|
|
|
10229
10263
|
},
|
|
10230
10264
|
part.image_url.url
|
|
10231
10265
|
)) }),
|
|
10232
|
-
/* @__PURE__ */
|
|
10233
|
-
text && customText != null ? customText : text ? /* @__PURE__ */
|
|
10266
|
+
/* @__PURE__ */ jsx32(MessageFileAttachmentList, { files: fileParts }),
|
|
10267
|
+
text && customText != null ? customText : text ? /* @__PURE__ */ jsx32(
|
|
10234
10268
|
AssistantText,
|
|
10235
10269
|
{
|
|
10236
10270
|
text,
|
|
@@ -10242,7 +10276,7 @@ function AssistantMessageContent({
|
|
|
10242
10276
|
citations
|
|
10243
10277
|
}
|
|
10244
10278
|
) : null,
|
|
10245
|
-
!text && reasoning ? /* @__PURE__ */
|
|
10279
|
+
!text && reasoning ? /* @__PURE__ */ jsx32(ThinkingBadge, { reasoning, variant: "block" }) : null
|
|
10246
10280
|
] });
|
|
10247
10281
|
}
|
|
10248
10282
|
function AssistantText({
|
|
@@ -10265,13 +10299,13 @@ function AssistantText({
|
|
|
10265
10299
|
() => ({ sessionId, messageId, sendMessage }),
|
|
10266
10300
|
[sessionId, messageId, sendMessage]
|
|
10267
10301
|
);
|
|
10268
|
-
return /* @__PURE__ */
|
|
10302
|
+
return /* @__PURE__ */ jsxs30(
|
|
10269
10303
|
"div",
|
|
10270
10304
|
{
|
|
10271
10305
|
part: "assistant-text",
|
|
10272
10306
|
className: cn("blade-chat-assistant-text text-[15px] leading-8 text-[hsl(var(--foreground))]", className),
|
|
10273
10307
|
children: [
|
|
10274
|
-
/* @__PURE__ */
|
|
10308
|
+
/* @__PURE__ */ jsx32(CardContext.Provider, { value: cardCtx, children: /* @__PURE__ */ jsx32(
|
|
10275
10309
|
MarkdownContent,
|
|
10276
10310
|
{
|
|
10277
10311
|
mode: isStreaming ? "streaming" : "static",
|
|
@@ -10282,7 +10316,7 @@ function AssistantText({
|
|
|
10282
10316
|
children: text
|
|
10283
10317
|
}
|
|
10284
10318
|
) }),
|
|
10285
|
-
reasoning ? /* @__PURE__ */
|
|
10319
|
+
reasoning ? /* @__PURE__ */ jsx32(ThinkingBadge, { reasoning }) : null
|
|
10286
10320
|
]
|
|
10287
10321
|
}
|
|
10288
10322
|
);
|
|
@@ -10300,27 +10334,27 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
|
10300
10334
|
const memoriesHref = useChatEnvironment().memoriesHref;
|
|
10301
10335
|
const hasSkill = refs.some((r) => r.skill_name);
|
|
10302
10336
|
const label = hasSkill ? "\u53C2\u8003\u4E86\u8BE5\u6280\u80FD\u7684\u5386\u53F2\u7ECF\u9A8C" : "\u53C2\u8003\u4E86\u5386\u53F2\u7ECF\u9A8C";
|
|
10303
|
-
return /* @__PURE__ */
|
|
10337
|
+
return /* @__PURE__ */ jsxs30(
|
|
10304
10338
|
"div",
|
|
10305
10339
|
{
|
|
10306
10340
|
part: "memory-refs",
|
|
10307
10341
|
className: cn("blade-chat-memory-refs relative z-[1] ml-1 w-[calc(100%-0.25rem)] max-w-[680px] self-start", className),
|
|
10308
10342
|
children: [
|
|
10309
|
-
/* @__PURE__ */
|
|
10343
|
+
/* @__PURE__ */ jsxs30(
|
|
10310
10344
|
"button",
|
|
10311
10345
|
{
|
|
10312
10346
|
type: "button",
|
|
10313
10347
|
onClick: () => setExpanded(!expanded),
|
|
10314
10348
|
className: "inline-flex h-8 items-center gap-1.5 rounded-lg border border-[hsl(var(--primary)/0.22)] bg-[hsl(var(--primary)/0.07)] px-3 text-xs font-medium text-[hsl(var(--primary))] transition-colors hover:bg-[hsl(var(--primary)/0.12)]",
|
|
10315
10349
|
children: [
|
|
10316
|
-
/* @__PURE__ */
|
|
10317
|
-
/* @__PURE__ */
|
|
10350
|
+
/* @__PURE__ */ jsx32(BookOpen, { size: 12 }),
|
|
10351
|
+
/* @__PURE__ */ jsxs30("span", { children: [
|
|
10318
10352
|
label,
|
|
10319
10353
|
"\uFF08",
|
|
10320
10354
|
refs.length,
|
|
10321
10355
|
"\uFF09"
|
|
10322
10356
|
] }),
|
|
10323
|
-
/* @__PURE__ */
|
|
10357
|
+
/* @__PURE__ */ jsx32(
|
|
10324
10358
|
ChevronRight,
|
|
10325
10359
|
{
|
|
10326
10360
|
size: 10,
|
|
@@ -10330,19 +10364,19 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
|
10330
10364
|
]
|
|
10331
10365
|
}
|
|
10332
10366
|
),
|
|
10333
|
-
expanded && /* @__PURE__ */
|
|
10334
|
-
refs.map((ref) => /* @__PURE__ */
|
|
10367
|
+
expanded && /* @__PURE__ */ jsxs30("div", { className: "mt-2 flex flex-col gap-2 rounded-xl border border-[hsl(var(--border)/0.8)] bg-[hsl(var(--muted)/0.28)] p-2.5", children: [
|
|
10368
|
+
refs.map((ref) => /* @__PURE__ */ jsxs30(
|
|
10335
10369
|
"div",
|
|
10336
10370
|
{
|
|
10337
10371
|
className: "rounded-lg border border-[hsl(var(--border)/0.55)] bg-[hsl(var(--background)/0.72)] px-3 py-2.5",
|
|
10338
10372
|
children: [
|
|
10339
|
-
/* @__PURE__ */
|
|
10340
|
-
ref.skill_name && /* @__PURE__ */
|
|
10373
|
+
/* @__PURE__ */ jsx32("p", { className: "line-clamp-2 break-words text-xs leading-5 text-[hsl(var(--foreground)/0.86)]", children: ref.content_preview }),
|
|
10374
|
+
ref.skill_name && /* @__PURE__ */ jsx32("span", { className: "mt-1.5 inline-flex rounded-md bg-[hsl(var(--primary)/0.09)] px-2 py-0.5 text-[10px] font-medium text-[hsl(var(--primary))]", children: ref.skill_name })
|
|
10341
10375
|
]
|
|
10342
10376
|
},
|
|
10343
10377
|
ref.id
|
|
10344
10378
|
)),
|
|
10345
|
-
memoriesHref ? /* @__PURE__ */
|
|
10379
|
+
memoriesHref ? /* @__PURE__ */ jsxs30(
|
|
10346
10380
|
"a",
|
|
10347
10381
|
{
|
|
10348
10382
|
href: memoriesHref,
|
|
@@ -10351,7 +10385,7 @@ function MemoryRefsHint({ refs: rawRefs, className }) {
|
|
|
10351
10385
|
className: "inline-flex h-7 self-start items-center gap-1 rounded-lg px-2 text-[11px] font-medium text-[hsl(var(--primary))] transition-colors hover:bg-[hsl(var(--primary)/0.08)]",
|
|
10352
10386
|
children: [
|
|
10353
10387
|
"\u67E5\u770B\u5168\u90E8\u7ECF\u9A8C",
|
|
10354
|
-
/* @__PURE__ */
|
|
10388
|
+
/* @__PURE__ */ jsx32(ArrowUpRight, { size: 12, "aria-hidden": "true" })
|
|
10355
10389
|
]
|
|
10356
10390
|
}
|
|
10357
10391
|
) : null
|
|
@@ -10366,16 +10400,16 @@ import {
|
|
|
10366
10400
|
getContextDisplayState,
|
|
10367
10401
|
getContextGroupDisplayState
|
|
10368
10402
|
} from "@blade-hq/agent-client/internal";
|
|
10369
|
-
import { jsx as
|
|
10403
|
+
import { jsx as jsx33, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
10370
10404
|
function ContextCard({ context, className }) {
|
|
10371
10405
|
const display = getContextDisplayState(context);
|
|
10372
|
-
return /* @__PURE__ */
|
|
10406
|
+
return /* @__PURE__ */ jsxs31(
|
|
10373
10407
|
"details",
|
|
10374
10408
|
{
|
|
10375
10409
|
className: `blade-chat-context-card group/context-card overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`,
|
|
10376
10410
|
children: [
|
|
10377
|
-
/* @__PURE__ */
|
|
10378
|
-
/* @__PURE__ */
|
|
10411
|
+
/* @__PURE__ */ jsxs31("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
|
|
10412
|
+
/* @__PURE__ */ jsx33(
|
|
10379
10413
|
Layers,
|
|
10380
10414
|
{
|
|
10381
10415
|
size: 15,
|
|
@@ -10383,11 +10417,11 @@ function ContextCard({ context, className }) {
|
|
|
10383
10417
|
"aria-hidden": "true"
|
|
10384
10418
|
}
|
|
10385
10419
|
),
|
|
10386
|
-
/* @__PURE__ */
|
|
10387
|
-
/* @__PURE__ */
|
|
10388
|
-
/* @__PURE__ */
|
|
10420
|
+
/* @__PURE__ */ jsxs31("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
10421
|
+
/* @__PURE__ */ jsx33("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: display.title }),
|
|
10422
|
+
/* @__PURE__ */ jsx33("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: display.summary })
|
|
10389
10423
|
] }),
|
|
10390
|
-
/* @__PURE__ */
|
|
10424
|
+
/* @__PURE__ */ jsx33(
|
|
10391
10425
|
ChevronDown,
|
|
10392
10426
|
{
|
|
10393
10427
|
size: 14,
|
|
@@ -10396,7 +10430,7 @@ function ContextCard({ context, className }) {
|
|
|
10396
10430
|
}
|
|
10397
10431
|
)
|
|
10398
10432
|
] }),
|
|
10399
|
-
/* @__PURE__ */
|
|
10433
|
+
/* @__PURE__ */ jsx33("div", { className: "blade-chat-context-detail border-t border-[hsl(var(--border))] px-3 py-2.5 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: display.detail })
|
|
10400
10434
|
]
|
|
10401
10435
|
}
|
|
10402
10436
|
);
|
|
@@ -10405,9 +10439,9 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
10405
10439
|
if (contexts.length === 0) return null;
|
|
10406
10440
|
const single = contexts.length === 1 ? getContextDisplayState(contexts[0]) : null;
|
|
10407
10441
|
const group = single ? null : getContextGroupDisplayState(contexts);
|
|
10408
|
-
return /* @__PURE__ */
|
|
10409
|
-
/* @__PURE__ */
|
|
10410
|
-
/* @__PURE__ */
|
|
10442
|
+
return /* @__PURE__ */ jsxs31("details", { className: `blade-chat-context-card group/context-group overflow-hidden rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`, children: [
|
|
10443
|
+
/* @__PURE__ */ jsxs31("summary", { className: "blade-chat-context-summary flex cursor-pointer list-none items-center gap-2 px-3 py-2.5 [&::-webkit-details-marker]:hidden", children: [
|
|
10444
|
+
/* @__PURE__ */ jsx33(
|
|
10411
10445
|
Layers,
|
|
10412
10446
|
{
|
|
10413
10447
|
size: 15,
|
|
@@ -10415,11 +10449,11 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
10415
10449
|
"aria-hidden": "true"
|
|
10416
10450
|
}
|
|
10417
10451
|
),
|
|
10418
|
-
/* @__PURE__ */
|
|
10419
|
-
/* @__PURE__ */
|
|
10420
|
-
/* @__PURE__ */
|
|
10452
|
+
/* @__PURE__ */ jsxs31("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
10453
|
+
/* @__PURE__ */ jsx33("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: single ? single.title : `${group?.title} \xB7 ${group?.count} \u9879` }),
|
|
10454
|
+
/* @__PURE__ */ jsx33("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: single ? single.summary : group?.summary })
|
|
10421
10455
|
] }),
|
|
10422
|
-
/* @__PURE__ */
|
|
10456
|
+
/* @__PURE__ */ jsx33(
|
|
10423
10457
|
ChevronDown,
|
|
10424
10458
|
{
|
|
10425
10459
|
size: 14,
|
|
@@ -10428,7 +10462,7 @@ function ContextGroupCard({ contexts, className }) {
|
|
|
10428
10462
|
}
|
|
10429
10463
|
)
|
|
10430
10464
|
] }),
|
|
10431
|
-
single ? /* @__PURE__ */
|
|
10465
|
+
single ? /* @__PURE__ */ jsx33("div", { className: "blade-chat-context-detail border-t border-[hsl(var(--border))] px-3 py-2.5 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: single.detail }) : /* @__PURE__ */ jsx33("div", { className: "blade-chat-context-group-items flex flex-col gap-1.5 border-t border-[hsl(var(--border))] p-2", children: contexts.map((context) => /* @__PURE__ */ jsx33(
|
|
10432
10466
|
ContextCard,
|
|
10433
10467
|
{
|
|
10434
10468
|
context
|
|
@@ -10443,7 +10477,7 @@ import { useEffect as useEffect21, useRef as useRef19 } from "react";
|
|
|
10443
10477
|
|
|
10444
10478
|
// src/chat/FinalArtifactCards.tsx
|
|
10445
10479
|
import { useEffect as useEffect19, useRef as useRef17, useState as useState26 } from "react";
|
|
10446
|
-
import { Fragment as
|
|
10480
|
+
import { Fragment as Fragment18, jsx as jsx34, jsxs as jsxs32 } from "react/jsx-runtime";
|
|
10447
10481
|
function basename2(path) {
|
|
10448
10482
|
return path.split("/").filter(Boolean).pop() || path;
|
|
10449
10483
|
}
|
|
@@ -10464,10 +10498,10 @@ function LinkCard({
|
|
|
10464
10498
|
const bladeHost = useBladeHost();
|
|
10465
10499
|
const host = hostOf(url);
|
|
10466
10500
|
const local = isLoopbackUrl(url) && Boolean(bladeHost.openPreview);
|
|
10467
|
-
const content = /* @__PURE__ */
|
|
10468
|
-
/* @__PURE__ */
|
|
10469
|
-
/* @__PURE__ */
|
|
10470
|
-
/* @__PURE__ */
|
|
10501
|
+
const content = /* @__PURE__ */ jsxs32(Fragment18, { children: [
|
|
10502
|
+
/* @__PURE__ */ jsx34("span", { className: "flex h-5 w-5 shrink-0 items-center justify-center text-[hsl(var(--primary))]", children: /* @__PURE__ */ jsx34(Globe, { size: 15, "aria-hidden": "true" }) }),
|
|
10503
|
+
/* @__PURE__ */ jsx34("span", { className: "min-w-0 flex-1", children: /* @__PURE__ */ jsx34("span", { className: "block truncate text-xs font-medium leading-5", children: label || host }) }),
|
|
10504
|
+
/* @__PURE__ */ jsx34(
|
|
10471
10505
|
ArrowUpRight,
|
|
10472
10506
|
{
|
|
10473
10507
|
size: 13,
|
|
@@ -10477,7 +10511,7 @@ function LinkCard({
|
|
|
10477
10511
|
)
|
|
10478
10512
|
] });
|
|
10479
10513
|
if (local) {
|
|
10480
|
-
return /* @__PURE__ */
|
|
10514
|
+
return /* @__PURE__ */ jsx34(
|
|
10481
10515
|
"button",
|
|
10482
10516
|
{
|
|
10483
10517
|
type: "button",
|
|
@@ -10493,7 +10527,7 @@ ${url}`,
|
|
|
10493
10527
|
}
|
|
10494
10528
|
);
|
|
10495
10529
|
}
|
|
10496
|
-
return /* @__PURE__ */
|
|
10530
|
+
return /* @__PURE__ */ jsx34(
|
|
10497
10531
|
"a",
|
|
10498
10532
|
{
|
|
10499
10533
|
href: url,
|
|
@@ -10536,8 +10570,8 @@ function FinalArtifactCards({
|
|
|
10536
10570
|
const columnCount = Math.min(artifacts.length, 3);
|
|
10537
10571
|
const gridWidth = columnCount * 180 + Math.max(0, columnCount - 1) * 6;
|
|
10538
10572
|
if (artifacts.length === 0) return null;
|
|
10539
|
-
return /* @__PURE__ */
|
|
10540
|
-
/* @__PURE__ */
|
|
10573
|
+
return /* @__PURE__ */ jsxs32("div", { className: "flex max-w-full flex-col gap-1.5", children: [
|
|
10574
|
+
/* @__PURE__ */ jsx34(
|
|
10541
10575
|
"div",
|
|
10542
10576
|
{
|
|
10543
10577
|
style: {
|
|
@@ -10546,7 +10580,7 @@ function FinalArtifactCards({
|
|
|
10546
10580
|
},
|
|
10547
10581
|
className: expanded && hasMore ? "grid max-h-[144px] max-w-full gap-1.5 overflow-y-auto pr-1" : "grid max-w-full gap-1.5",
|
|
10548
10582
|
children: visibleArtifacts.map(
|
|
10549
|
-
(artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */
|
|
10583
|
+
(artifact, artifactIndex) => artifact.kind === "link" ? /* @__PURE__ */ jsx34(
|
|
10550
10584
|
LinkCard,
|
|
10551
10585
|
{
|
|
10552
10586
|
url: artifact.target,
|
|
@@ -10555,7 +10589,7 @@ function FinalArtifactCards({
|
|
|
10555
10589
|
onOpen: () => reportOpened(artifactIndex, "link")
|
|
10556
10590
|
},
|
|
10557
10591
|
`${artifact.kind}:${artifactIndex}`
|
|
10558
|
-
) : /* @__PURE__ */
|
|
10592
|
+
) : /* @__PURE__ */ jsx34(
|
|
10559
10593
|
DeliveryCard,
|
|
10560
10594
|
{
|
|
10561
10595
|
path: artifact.target,
|
|
@@ -10572,7 +10606,7 @@ function FinalArtifactCards({
|
|
|
10572
10606
|
)
|
|
10573
10607
|
}
|
|
10574
10608
|
),
|
|
10575
|
-
hasMore ? /* @__PURE__ */
|
|
10609
|
+
hasMore ? /* @__PURE__ */ jsxs32(
|
|
10576
10610
|
"button",
|
|
10577
10611
|
{
|
|
10578
10612
|
type: "button",
|
|
@@ -10580,8 +10614,8 @@ function FinalArtifactCards({
|
|
|
10580
10614
|
className: "flex w-fit items-center gap-0.5 text-[11px] leading-4 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))] focus-visible:ring-1 focus-visible:ring-[hsl(var(--ring))] focus:outline-none",
|
|
10581
10615
|
"aria-expanded": expanded,
|
|
10582
10616
|
children: [
|
|
10583
|
-
/* @__PURE__ */
|
|
10584
|
-
/* @__PURE__ */
|
|
10617
|
+
/* @__PURE__ */ jsx34("span", { children: expanded ? "\u6536\u8D77" : `\u5C55\u5F00 ${artifacts.length - 3} \u4E2A` }),
|
|
10618
|
+
/* @__PURE__ */ jsx34(
|
|
10585
10619
|
ChevronDown,
|
|
10586
10620
|
{
|
|
10587
10621
|
size: 13,
|
|
@@ -10597,7 +10631,7 @@ function FinalArtifactCards({
|
|
|
10597
10631
|
|
|
10598
10632
|
// src/chat/ResultFeedback.tsx
|
|
10599
10633
|
import { useCallback as useCallback10, useEffect as useEffect20, useRef as useRef18, useState as useState27 } from "react";
|
|
10600
|
-
import { jsx as
|
|
10634
|
+
import { jsx as jsx35, jsxs as jsxs33 } from "react/jsx-runtime";
|
|
10601
10635
|
var REASONS = [
|
|
10602
10636
|
{ value: "not_solved", label: "\u6CA1\u89E3\u51B3\u95EE\u9898" },
|
|
10603
10637
|
{ value: "inaccurate", label: "\u5185\u5BB9\u4E0D\u51C6\u786E" },
|
|
@@ -10611,17 +10645,17 @@ function reasonLabel(reason) {
|
|
|
10611
10645
|
}
|
|
10612
10646
|
function HistoricalResultFeedback({ feedback }) {
|
|
10613
10647
|
const label = reasonLabel(feedback.reason);
|
|
10614
|
-
return /* @__PURE__ */
|
|
10648
|
+
return /* @__PURE__ */ jsxs33(
|
|
10615
10649
|
"section",
|
|
10616
10650
|
{
|
|
10617
10651
|
"aria-label": "\u5386\u53F2\u7ED3\u679C\u53CD\u9988",
|
|
10618
10652
|
className: "w-fit max-w-full rounded-lg border border-[hsl(var(--border)/0.7)] bg-[hsl(var(--muted)/0.2)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
10619
10653
|
children: [
|
|
10620
|
-
/* @__PURE__ */
|
|
10654
|
+
/* @__PURE__ */ jsxs33("span", { children: [
|
|
10621
10655
|
"\u4F60\u5BF9\u6B64\u8F6E\u7ED3\u679C\u7684\u8BC4\u4EF7\uFF1A",
|
|
10622
10656
|
feedback.helpful ? "\u6709\u5E2E\u52A9" : "\u6CA1\u5E2E\u52A9"
|
|
10623
10657
|
] }),
|
|
10624
|
-
label ? /* @__PURE__ */
|
|
10658
|
+
label ? /* @__PURE__ */ jsxs33("span", { children: [
|
|
10625
10659
|
" \xB7 ",
|
|
10626
10660
|
label
|
|
10627
10661
|
] }) : null
|
|
@@ -10696,15 +10730,15 @@ function ResultFeedback({
|
|
|
10696
10730
|
[client, emit, followup.assistant_entry_id, onSaved, sessionId]
|
|
10697
10731
|
);
|
|
10698
10732
|
if (!visible) return null;
|
|
10699
|
-
return /* @__PURE__ */
|
|
10733
|
+
return /* @__PURE__ */ jsxs33(
|
|
10700
10734
|
"section",
|
|
10701
10735
|
{
|
|
10702
10736
|
"aria-label": "\u7ED3\u679C\u53CD\u9988",
|
|
10703
10737
|
className: "flex flex-col gap-2 border-t border-[hsl(var(--border)/0.7)] pt-3",
|
|
10704
10738
|
children: [
|
|
10705
|
-
/* @__PURE__ */
|
|
10706
|
-
/* @__PURE__ */
|
|
10707
|
-
/* @__PURE__ */
|
|
10739
|
+
/* @__PURE__ */ jsx35("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u76EE\u524D\u7684\u6574\u4F53\u7ED3\u679C\u6709\u5E2E\u52A9\u5417\uFF1F" }),
|
|
10740
|
+
/* @__PURE__ */ jsxs33("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
10741
|
+
/* @__PURE__ */ jsx35(
|
|
10708
10742
|
"button",
|
|
10709
10743
|
{
|
|
10710
10744
|
type: "button",
|
|
@@ -10715,7 +10749,7 @@ function ResultFeedback({
|
|
|
10715
10749
|
children: "\u6709\u5E2E\u52A9"
|
|
10716
10750
|
}
|
|
10717
10751
|
),
|
|
10718
|
-
/* @__PURE__ */
|
|
10752
|
+
/* @__PURE__ */ jsx35(
|
|
10719
10753
|
"button",
|
|
10720
10754
|
{
|
|
10721
10755
|
type: "button",
|
|
@@ -10727,7 +10761,7 @@ function ResultFeedback({
|
|
|
10727
10761
|
}
|
|
10728
10762
|
)
|
|
10729
10763
|
] }),
|
|
10730
|
-
selectedHelpful === false ? /* @__PURE__ */
|
|
10764
|
+
selectedHelpful === false ? /* @__PURE__ */ jsx35("div", { className: "flex max-w-[520px] flex-wrap gap-1.5", "aria-label": "\u6CA1\u5E2E\u52A9\u7684\u4E3B\u8981\u539F\u56E0", children: REASONS.map((reason) => /* @__PURE__ */ jsx35(
|
|
10731
10765
|
"button",
|
|
10732
10766
|
{
|
|
10733
10767
|
type: "button",
|
|
@@ -10739,9 +10773,9 @@ function ResultFeedback({
|
|
|
10739
10773
|
},
|
|
10740
10774
|
reason.value
|
|
10741
10775
|
)) }) : null,
|
|
10742
|
-
saveError ? /* @__PURE__ */
|
|
10743
|
-
/* @__PURE__ */
|
|
10744
|
-
/* @__PURE__ */
|
|
10776
|
+
saveError ? /* @__PURE__ */ jsxs33("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--destructive))]", children: [
|
|
10777
|
+
/* @__PURE__ */ jsx35("span", { children: "\u53CD\u9988\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u91CD\u8BD5" }),
|
|
10778
|
+
/* @__PURE__ */ jsx35(
|
|
10745
10779
|
"button",
|
|
10746
10780
|
{
|
|
10747
10781
|
type: "button",
|
|
@@ -10753,14 +10787,14 @@ function ResultFeedback({
|
|
|
10753
10787
|
children: "\u91CD\u8BD5"
|
|
10754
10788
|
}
|
|
10755
10789
|
)
|
|
10756
|
-
] }) : saved ? /* @__PURE__ */
|
|
10790
|
+
] }) : saved ? /* @__PURE__ */ jsx35("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u968F\u65F6\u4FEE\u6539" }) : null
|
|
10757
10791
|
]
|
|
10758
10792
|
}
|
|
10759
10793
|
);
|
|
10760
10794
|
}
|
|
10761
10795
|
|
|
10762
10796
|
// src/chat/PostChatFollowupBlock.tsx
|
|
10763
|
-
import { jsx as
|
|
10797
|
+
import { jsx as jsx36, jsxs as jsxs34 } from "react/jsx-runtime";
|
|
10764
10798
|
function PostChatFollowupBlock({
|
|
10765
10799
|
sessionId,
|
|
10766
10800
|
followup,
|
|
@@ -10782,14 +10816,14 @@ function PostChatFollowupBlock({
|
|
|
10782
10816
|
}, [assistantEntryId, emit, sessionId, suggestionCount]);
|
|
10783
10817
|
if (!followup || !followup.recaption && followup.suggestions.length === 0 && artifacts.length === 0 && !followup.feedback_eligible)
|
|
10784
10818
|
return null;
|
|
10785
|
-
return /* @__PURE__ */
|
|
10786
|
-
followup.recaption ? /* @__PURE__ */
|
|
10787
|
-
/* @__PURE__ */
|
|
10788
|
-
/* @__PURE__ */
|
|
10819
|
+
return /* @__PURE__ */ jsxs34("div", { part: "followup", className: "blade-chat-followup flex w-fit max-w-full flex-col gap-4 rounded-xl border border-[hsl(var(--border)/0.75)] bg-[hsl(var(--muted)/0.28)] px-3 py-3 sm:min-w-[340px] sm:max-w-[680px]", children: [
|
|
10820
|
+
followup.recaption ? /* @__PURE__ */ jsxs34("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
|
|
10821
|
+
/* @__PURE__ */ jsxs34("div", { className: "mb-1 flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
10822
|
+
/* @__PURE__ */ jsx36(Sparkles, { size: 14, "aria-hidden": "true" }),
|
|
10789
10823
|
"\u672C\u8F6E\u5C0F\u7ED3"
|
|
10790
10824
|
] }),
|
|
10791
|
-
/* @__PURE__ */
|
|
10792
|
-
artifacts.length > 0 ? /* @__PURE__ */
|
|
10825
|
+
/* @__PURE__ */ jsx36("p", { className: "text-[13px] leading-5 text-[hsl(var(--foreground)/0.9)]", children: followup.recaption }),
|
|
10826
|
+
artifacts.length > 0 ? /* @__PURE__ */ jsx36(
|
|
10793
10827
|
FinalArtifactCards,
|
|
10794
10828
|
{
|
|
10795
10829
|
artifacts,
|
|
@@ -10798,7 +10832,7 @@ function PostChatFollowupBlock({
|
|
|
10798
10832
|
}
|
|
10799
10833
|
) : null
|
|
10800
10834
|
] }) : null,
|
|
10801
|
-
!followup.recaption && artifacts.length > 0 ? /* @__PURE__ */
|
|
10835
|
+
!followup.recaption && artifacts.length > 0 ? /* @__PURE__ */ jsx36("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", children: /* @__PURE__ */ jsx36(
|
|
10802
10836
|
FinalArtifactCards,
|
|
10803
10837
|
{
|
|
10804
10838
|
artifacts,
|
|
@@ -10806,9 +10840,9 @@ function PostChatFollowupBlock({
|
|
|
10806
10840
|
assistantEntryId
|
|
10807
10841
|
}
|
|
10808
10842
|
) }) : null,
|
|
10809
|
-
followup.suggestions.length > 0 ? /* @__PURE__ */
|
|
10810
|
-
/* @__PURE__ */
|
|
10811
|
-
/* @__PURE__ */
|
|
10843
|
+
followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs34("section", { className: "flex flex-col items-start gap-1.5", "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", children: [
|
|
10844
|
+
/* @__PURE__ */ jsx36("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
|
|
10845
|
+
/* @__PURE__ */ jsx36("div", { className: "grid w-fit max-w-full gap-1.5 sm:max-w-[680px]", children: followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs34(
|
|
10812
10846
|
"button",
|
|
10813
10847
|
{
|
|
10814
10848
|
type: "button",
|
|
@@ -10823,8 +10857,8 @@ function PostChatFollowupBlock({
|
|
|
10823
10857
|
part: "followup-action",
|
|
10824
10858
|
className: "blade-chat-followup-action group flex w-full items-center gap-2.5 rounded-[14px] bg-[hsl(var(--muted)/0.62)] px-3.5 py-2 text-left text-[13px] font-normal leading-5 text-[hsl(var(--foreground)/0.92)] transition-colors hover:bg-[hsl(var(--muted)/0.88)] disabled:cursor-default disabled:opacity-60",
|
|
10825
10859
|
children: [
|
|
10826
|
-
/* @__PURE__ */
|
|
10827
|
-
/* @__PURE__ */
|
|
10860
|
+
/* @__PURE__ */ jsx36("span", { className: "min-w-0", children: suggestion }),
|
|
10861
|
+
/* @__PURE__ */ jsx36(
|
|
10828
10862
|
ArrowRight,
|
|
10829
10863
|
{
|
|
10830
10864
|
size: 14,
|
|
@@ -10838,7 +10872,7 @@ function PostChatFollowupBlock({
|
|
|
10838
10872
|
suggestion
|
|
10839
10873
|
)) })
|
|
10840
10874
|
] }) : null,
|
|
10841
|
-
/* @__PURE__ */
|
|
10875
|
+
/* @__PURE__ */ jsx36(
|
|
10842
10876
|
ResultFeedback,
|
|
10843
10877
|
{
|
|
10844
10878
|
sessionId,
|
|
@@ -10853,7 +10887,7 @@ function PostChatFollowupBlock({
|
|
|
10853
10887
|
|
|
10854
10888
|
// src/chat/TurnNavRail.tsx
|
|
10855
10889
|
import { useCallback as useCallback11, useEffect as useEffect22, useLayoutEffect as useLayoutEffect5, useRef as useRef20, useState as useState28 } from "react";
|
|
10856
|
-
import { jsx as
|
|
10890
|
+
import { jsx as jsx37, jsxs as jsxs35 } from "react/jsx-runtime";
|
|
10857
10891
|
var PANEL_MAX_HEIGHT = 448;
|
|
10858
10892
|
var PANEL_MARGIN = 16;
|
|
10859
10893
|
function clippingAncestor(element) {
|
|
@@ -10983,7 +11017,7 @@ function TurnNavRail({
|
|
|
10983
11017
|
if (items.length < 2) {
|
|
10984
11018
|
return null;
|
|
10985
11019
|
}
|
|
10986
|
-
return /* @__PURE__ */
|
|
11020
|
+
return /* @__PURE__ */ jsx37(
|
|
10987
11021
|
"nav",
|
|
10988
11022
|
{
|
|
10989
11023
|
"aria-label": "\u56DE\u5408\u5BFC\u822A",
|
|
@@ -10998,8 +11032,8 @@ function TurnNavRail({
|
|
|
10998
11032
|
setPanelOpen(false);
|
|
10999
11033
|
setHoveredTurnId(null);
|
|
11000
11034
|
},
|
|
11001
|
-
children: /* @__PURE__ */
|
|
11002
|
-
/* @__PURE__ */
|
|
11035
|
+
children: /* @__PURE__ */ jsxs35("div", { className: "flex flex-col items-end", children: [
|
|
11036
|
+
/* @__PURE__ */ jsxs35(
|
|
11003
11037
|
"div",
|
|
11004
11038
|
{
|
|
11005
11039
|
ref: markerRef,
|
|
@@ -11014,10 +11048,10 @@ function TurnNavRail({
|
|
|
11014
11048
|
maskImage: "linear-gradient(to bottom, transparent, black 10%, black 90%, transparent)"
|
|
11015
11049
|
},
|
|
11016
11050
|
children: [
|
|
11017
|
-
/* @__PURE__ */
|
|
11051
|
+
/* @__PURE__ */ jsx37("span", { "aria-hidden": true, className: "mt-auto shrink-0" }),
|
|
11018
11052
|
items.map((item, index) => {
|
|
11019
11053
|
const isActive = item.id === activeTurnId;
|
|
11020
|
-
return /* @__PURE__ */
|
|
11054
|
+
return /* @__PURE__ */ jsx37(
|
|
11021
11055
|
"button",
|
|
11022
11056
|
{
|
|
11023
11057
|
type: "button",
|
|
@@ -11027,7 +11061,7 @@ function TurnNavRail({
|
|
|
11027
11061
|
"aria-current": isActive ? "true" : void 0,
|
|
11028
11062
|
"aria-label": item.title || `\u7B2C ${index + 1} \u8F6E`,
|
|
11029
11063
|
className: "flex h-3.5 shrink-0 items-center",
|
|
11030
|
-
children: /* @__PURE__ */
|
|
11064
|
+
children: /* @__PURE__ */ jsx37(
|
|
11031
11065
|
"span",
|
|
11032
11066
|
{
|
|
11033
11067
|
className: cn(
|
|
@@ -11043,18 +11077,18 @@ function TurnNavRail({
|
|
|
11043
11077
|
item.id
|
|
11044
11078
|
);
|
|
11045
11079
|
}),
|
|
11046
|
-
/* @__PURE__ */
|
|
11080
|
+
/* @__PURE__ */ jsx37("span", { "aria-hidden": true, className: "mb-auto shrink-0" })
|
|
11047
11081
|
]
|
|
11048
11082
|
}
|
|
11049
11083
|
),
|
|
11050
|
-
error ? /* @__PURE__ */
|
|
11084
|
+
error ? /* @__PURE__ */ jsxs35(
|
|
11051
11085
|
"div",
|
|
11052
11086
|
{
|
|
11053
11087
|
role: "alert",
|
|
11054
11088
|
className: "absolute right-full top-1/2 mr-2 flex -translate-y-1/2 items-center gap-2 whitespace-nowrap rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)]",
|
|
11055
11089
|
children: [
|
|
11056
|
-
/* @__PURE__ */
|
|
11057
|
-
failedTurnId ? /* @__PURE__ */
|
|
11090
|
+
/* @__PURE__ */ jsx37("span", { children: error }),
|
|
11091
|
+
failedTurnId ? /* @__PURE__ */ jsx37(
|
|
11058
11092
|
"button",
|
|
11059
11093
|
{
|
|
11060
11094
|
type: "button",
|
|
@@ -11065,8 +11099,8 @@ function TurnNavRail({
|
|
|
11065
11099
|
) : null
|
|
11066
11100
|
]
|
|
11067
11101
|
}
|
|
11068
|
-
) : loadingTurnId ? /* @__PURE__ */
|
|
11069
|
-
panelOpen ? /* @__PURE__ */
|
|
11102
|
+
) : loadingTurnId ? /* @__PURE__ */ jsx37("output", { className: "absolute right-full top-1/2 mr-2 -translate-y-1/2 whitespace-nowrap rounded-full border border-[hsl(var(--border))] bg-[hsl(var(--popover))] px-2.5 py-1 text-xs text-[hsl(var(--popover-foreground))] shadow-[var(--swf-shadow-overlay)]", children: "\u6B63\u5728\u5B9A\u4F4D\u5230\u8FD9\u6761\u53D1\u8A00\u2026" }) : null,
|
|
11103
|
+
panelOpen ? /* @__PURE__ */ jsx37("div", { className: "absolute right-full top-1/2 -translate-y-1/2 pr-2", children: /* @__PURE__ */ jsx37(
|
|
11070
11104
|
"div",
|
|
11071
11105
|
{
|
|
11072
11106
|
ref: listRef,
|
|
@@ -11074,7 +11108,7 @@ function TurnNavRail({
|
|
|
11074
11108
|
children: items.map((item, index) => {
|
|
11075
11109
|
const isActive = item.id === activeTurnId;
|
|
11076
11110
|
const isHovered = item.id === hoveredTurnId;
|
|
11077
|
-
return /* @__PURE__ */
|
|
11111
|
+
return /* @__PURE__ */ jsx37(
|
|
11078
11112
|
"button",
|
|
11079
11113
|
{
|
|
11080
11114
|
type: "button",
|
|
@@ -11580,7 +11614,7 @@ function snapshotMessageListRenderPlan(blocks) {
|
|
|
11580
11614
|
}
|
|
11581
11615
|
|
|
11582
11616
|
// src/chat/MessageList.tsx
|
|
11583
|
-
import { Fragment as
|
|
11617
|
+
import { Fragment as Fragment19, jsx as jsx38, jsxs as jsxs36 } from "react/jsx-runtime";
|
|
11584
11618
|
function isReasoningRevealingForMessage(message, isRevealing, isStopping = false) {
|
|
11585
11619
|
if (isStopping) return false;
|
|
11586
11620
|
const hasContent = message?.content != null && message.content.length > 0;
|
|
@@ -12626,15 +12660,15 @@ function MessageListBody({
|
|
|
12626
12660
|
stablePrefixEnd,
|
|
12627
12661
|
virtualizer
|
|
12628
12662
|
]);
|
|
12629
|
-
return /* @__PURE__ */
|
|
12663
|
+
return /* @__PURE__ */ jsxs36(
|
|
12630
12664
|
"div",
|
|
12631
12665
|
{
|
|
12632
12666
|
ref: containerRef,
|
|
12633
12667
|
part: "messages",
|
|
12634
12668
|
className: `blade-chat-messages relative min-h-0 flex-1 ${customization?.classNames?.messageListRoot ?? ""}`,
|
|
12635
12669
|
children: [
|
|
12636
|
-
!isPreparing && (sessionIsStreaming || isRevealingAny) ? /* @__PURE__ */
|
|
12637
|
-
turnNavItems.length > 1 ? /* @__PURE__ */
|
|
12670
|
+
!isPreparing && (sessionIsStreaming || isRevealingAny) ? /* @__PURE__ */ jsx38("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
|
|
12671
|
+
turnNavItems.length > 1 ? /* @__PURE__ */ jsx38(
|
|
12638
12672
|
TurnNavRail,
|
|
12639
12673
|
{
|
|
12640
12674
|
items: turnNavItems,
|
|
@@ -12645,7 +12679,7 @@ function MessageListBody({
|
|
|
12645
12679
|
failedTurnId: navFailedEntryId
|
|
12646
12680
|
}
|
|
12647
12681
|
) : null,
|
|
12648
|
-
/* @__PURE__ */
|
|
12682
|
+
/* @__PURE__ */ jsxs36(
|
|
12649
12683
|
StickToBottom,
|
|
12650
12684
|
{
|
|
12651
12685
|
contextRef: stickContextRef,
|
|
@@ -12654,7 +12688,7 @@ function MessageListBody({
|
|
|
12654
12688
|
resize: stickyTurn ? { damping: 0.8, stiffness: 0.08, mass: 1 } : "instant",
|
|
12655
12689
|
targetScrollTop: shouldAnchorEntry ? getAnchorTargetScrollTop : void 0,
|
|
12656
12690
|
children: [
|
|
12657
|
-
/* @__PURE__ */
|
|
12691
|
+
/* @__PURE__ */ jsxs36(
|
|
12658
12692
|
StickToBottom.Content,
|
|
12659
12693
|
{
|
|
12660
12694
|
part: "messages-scroll",
|
|
@@ -12663,7 +12697,7 @@ function MessageListBody({
|
|
|
12663
12697
|
customization?.classNames?.messageListViewport
|
|
12664
12698
|
),
|
|
12665
12699
|
children: [
|
|
12666
|
-
/* @__PURE__ */
|
|
12700
|
+
/* @__PURE__ */ jsx38(
|
|
12667
12701
|
MessageListContent,
|
|
12668
12702
|
{
|
|
12669
12703
|
askAnswers,
|
|
@@ -12698,12 +12732,12 @@ function MessageListBody({
|
|
|
12698
12732
|
emptyState
|
|
12699
12733
|
}
|
|
12700
12734
|
),
|
|
12701
|
-
isPreparing ? /* @__PURE__ */
|
|
12702
|
-
/* @__PURE__ */
|
|
12735
|
+
isPreparing ? /* @__PURE__ */ jsx38("div", { className: "mx-auto mt-3 max-w-[var(--blade-chat-width,780px)] px-4", children: /* @__PURE__ */ jsx38(ChatLoadingIndicator, { preparing: true, startedAtMs: latestUserStartedAtMs, useRunClock: Boolean(preparingStart) }) }) : null,
|
|
12736
|
+
/* @__PURE__ */ jsx38("div", { ref: newTurnSpacerRef, "aria-hidden": "true", className: "pointer-events-none w-full" })
|
|
12703
12737
|
]
|
|
12704
12738
|
}
|
|
12705
12739
|
),
|
|
12706
|
-
/* @__PURE__ */
|
|
12740
|
+
/* @__PURE__ */ jsx38(ScrollToBottomButton, { onBeforeScroll: releaseNewTurnPin })
|
|
12707
12741
|
]
|
|
12708
12742
|
},
|
|
12709
12743
|
scrollEntryId ?? "latest"
|
|
@@ -12774,47 +12808,47 @@ function MessageListContent({
|
|
|
12774
12808
|
if (block.type === "message") {
|
|
12775
12809
|
if (block.message.kind === "plan_update") {
|
|
12776
12810
|
const plan = readPlanDocument(block.message.blocks?.find((content) => content.type === "plan_update")?.content);
|
|
12777
|
-
return plan ? /* @__PURE__ */
|
|
12811
|
+
return plan ? /* @__PURE__ */ jsx38(PlanHistoryCard, { plan }) : null;
|
|
12778
12812
|
}
|
|
12779
12813
|
if (block.message.kind === "plan_status") {
|
|
12780
|
-
return /* @__PURE__ */
|
|
12814
|
+
return /* @__PURE__ */ jsx38(PlanSummaryCard, { messages: [block.message], isHistorical: true });
|
|
12781
12815
|
}
|
|
12782
12816
|
const sourceTitle = packEventTitle(block.message);
|
|
12783
12817
|
const notice = completionNotice2(block.message.blocks);
|
|
12784
|
-
return /* @__PURE__ */
|
|
12818
|
+
return /* @__PURE__ */ jsxs36(
|
|
12785
12819
|
"div",
|
|
12786
12820
|
{
|
|
12787
12821
|
id: block.anchorId ?? void 0,
|
|
12788
12822
|
"data-entry-id": block.message.entry_id,
|
|
12789
12823
|
className: "msg-animate scroll-mt-6",
|
|
12790
12824
|
children: [
|
|
12791
|
-
sourceTitle && /* @__PURE__ */
|
|
12792
|
-
notice ? /* @__PURE__ */
|
|
12825
|
+
sourceTitle && /* @__PURE__ */ jsx38(PackEventNotice, { title: sourceTitle }),
|
|
12826
|
+
notice ? /* @__PURE__ */ jsx38(CompletionNoticeRow, { notice }) : isBackgroundWakeMessage2(block.message) ? /* @__PURE__ */ jsx38(BackgroundWakeNotice, {}) : isUserMessage(block.message) ? customization?.components?.UserMessage ? /* @__PURE__ */ jsx38(
|
|
12793
12827
|
customization.components.UserMessage,
|
|
12794
12828
|
{
|
|
12795
12829
|
message: block.message,
|
|
12796
12830
|
className: customization.classNames?.userMessage
|
|
12797
12831
|
}
|
|
12798
|
-
) : /* @__PURE__ */
|
|
12832
|
+
) : /* @__PURE__ */ jsx38(
|
|
12799
12833
|
UserMessageBubble,
|
|
12800
12834
|
{
|
|
12801
12835
|
message: block.message,
|
|
12802
12836
|
className: customization?.classNames?.userMessage
|
|
12803
12837
|
}
|
|
12804
|
-
) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */
|
|
12838
|
+
) : isErrorMessage(block.message) ? customization?.components?.ErrorMessage ? /* @__PURE__ */ jsx38(
|
|
12805
12839
|
customization.components.ErrorMessage,
|
|
12806
12840
|
{
|
|
12807
12841
|
message: block.message,
|
|
12808
12842
|
className: customization.classNames?.errorMessage
|
|
12809
12843
|
}
|
|
12810
|
-
) : /* @__PURE__ */
|
|
12844
|
+
) : /* @__PURE__ */ jsx38(
|
|
12811
12845
|
ErrorMessageBlock,
|
|
12812
12846
|
{
|
|
12813
12847
|
message: block.message,
|
|
12814
12848
|
className: customization?.classNames?.errorMessage
|
|
12815
12849
|
}
|
|
12816
12850
|
) : null,
|
|
12817
|
-
block.unansweredLabel && /* @__PURE__ */
|
|
12851
|
+
block.unansweredLabel && /* @__PURE__ */ jsx38("div", { className: "mt-2 text-xs text-muted-foreground", children: block.unansweredLabel })
|
|
12818
12852
|
]
|
|
12819
12853
|
}
|
|
12820
12854
|
);
|
|
@@ -12831,7 +12865,7 @@ function MessageListContent({
|
|
|
12831
12865
|
const excludeDeliveredPaths = isActiveFollowup && finalArtifacts && finalArtifacts.length > 0 ? new Set(
|
|
12832
12866
|
finalArtifacts.filter((artifact) => artifact.kind === "file").map((artifact) => artifact.target)
|
|
12833
12867
|
) : void 0;
|
|
12834
|
-
return /* @__PURE__ */
|
|
12868
|
+
return /* @__PURE__ */ jsxs36(
|
|
12835
12869
|
"div",
|
|
12836
12870
|
{
|
|
12837
12871
|
ref: getTurnElementRef(block.anchorId),
|
|
@@ -12840,13 +12874,13 @@ function MessageListContent({
|
|
|
12840
12874
|
"data-entry-id": block.messages[0]?.entry_id,
|
|
12841
12875
|
className: "msg-animate flex scroll-mt-6 flex-col gap-4",
|
|
12842
12876
|
children: [
|
|
12843
|
-
/* @__PURE__ */
|
|
12877
|
+
/* @__PURE__ */ jsx38(
|
|
12844
12878
|
RenderErrorBoundary,
|
|
12845
12879
|
{
|
|
12846
12880
|
label: "\u52A9\u624B\u6D88\u606F",
|
|
12847
12881
|
details: block.key,
|
|
12848
12882
|
resetKey: getMessagesResetSignature(displayMessages),
|
|
12849
|
-
children: customization?.components?.AssistantTurn ? /* @__PURE__ */
|
|
12883
|
+
children: customization?.components?.AssistantTurn ? /* @__PURE__ */ jsx38(
|
|
12850
12884
|
customization.components.AssistantTurn,
|
|
12851
12885
|
{
|
|
12852
12886
|
turnKey: block.key,
|
|
@@ -12860,7 +12894,7 @@ function MessageListContent({
|
|
|
12860
12894
|
sessionStatus,
|
|
12861
12895
|
customization
|
|
12862
12896
|
}
|
|
12863
|
-
) : /* @__PURE__ */
|
|
12897
|
+
) : /* @__PURE__ */ jsx38(
|
|
12864
12898
|
AssistantTurnBlock,
|
|
12865
12899
|
{
|
|
12866
12900
|
turnKey: block.key,
|
|
@@ -12878,13 +12912,13 @@ function MessageListContent({
|
|
|
12878
12912
|
)
|
|
12879
12913
|
}
|
|
12880
12914
|
),
|
|
12881
|
-
showPlanCard ? /* @__PURE__ */
|
|
12915
|
+
showPlanCard ? /* @__PURE__ */ jsx38(
|
|
12882
12916
|
RenderErrorBoundary,
|
|
12883
12917
|
{
|
|
12884
12918
|
label: "\u89C4\u5212\u6458\u8981",
|
|
12885
12919
|
details: block.key,
|
|
12886
12920
|
resetKey: `${sessionStatus ?? ""}:${layoutSignature}`,
|
|
12887
|
-
children: /* @__PURE__ */
|
|
12921
|
+
children: /* @__PURE__ */ jsx38(
|
|
12888
12922
|
PlanSummaryCard,
|
|
12889
12923
|
{
|
|
12890
12924
|
messages: planMessages.length ? planMessages : block.messages,
|
|
@@ -12896,9 +12930,9 @@ function MessageListContent({
|
|
|
12896
12930
|
)
|
|
12897
12931
|
}
|
|
12898
12932
|
) : null,
|
|
12899
|
-
legacyUpdates.map((call) => /* @__PURE__ */
|
|
12900
|
-
blockFeedback && !isActiveFollowup ? /* @__PURE__ */
|
|
12901
|
-
isActiveFollowup ? /* @__PURE__ */
|
|
12933
|
+
legacyUpdates.map((call) => /* @__PURE__ */ jsx38(PlanUpdateBlock, { toolCall: call }, call.id)),
|
|
12934
|
+
blockFeedback && !isActiveFollowup ? /* @__PURE__ */ jsx38(HistoricalResultFeedback, { feedback: blockFeedback }) : null,
|
|
12935
|
+
isActiveFollowup ? /* @__PURE__ */ jsx38(
|
|
12902
12936
|
PostChatFollowupBlock,
|
|
12903
12937
|
{
|
|
12904
12938
|
sessionId,
|
|
@@ -12915,17 +12949,17 @@ function MessageListContent({
|
|
|
12915
12949
|
if (block.type === "compaction") return null;
|
|
12916
12950
|
if (block.type === "context_group") {
|
|
12917
12951
|
const contexts = block.messages.map((message) => message.context).filter((context) => Boolean(context));
|
|
12918
|
-
return contexts.length > 0 ? /* @__PURE__ */
|
|
12952
|
+
return contexts.length > 0 ? /* @__PURE__ */ jsx38("div", { className: "msg-animate", "data-entry-id": block.messages[0].entry_id, children: /* @__PURE__ */ jsx38(ContextGroupCard, { contexts }) }) : null;
|
|
12919
12953
|
}
|
|
12920
12954
|
if (block.type === "context_divider") {
|
|
12921
|
-
return /* @__PURE__ */
|
|
12955
|
+
return /* @__PURE__ */ jsx38(ContextDivider, {});
|
|
12922
12956
|
}
|
|
12923
|
-
return /* @__PURE__ */
|
|
12957
|
+
return /* @__PURE__ */ jsx38(PlanningDivider, { kind: block.kind });
|
|
12924
12958
|
};
|
|
12925
12959
|
const renderMeasuredRow = (block, globalBlockIndex, virtualItem) => {
|
|
12926
12960
|
const persistentId = getRenderBlockPersistentId(block);
|
|
12927
12961
|
const isVirtual = virtualItem !== void 0;
|
|
12928
|
-
return /* @__PURE__ */
|
|
12962
|
+
return /* @__PURE__ */ jsxs36(
|
|
12929
12963
|
"div",
|
|
12930
12964
|
{
|
|
12931
12965
|
ref: getMeasuredRowRef(block, globalBlockIndex, isVirtual),
|
|
@@ -12945,31 +12979,31 @@ function MessageListContent({
|
|
|
12945
12979
|
},
|
|
12946
12980
|
children: [
|
|
12947
12981
|
RenderBlockView(block, globalBlockIndex),
|
|
12948
|
-
isVirtual && globalBlockIndex < stablePrefixEnd - 1 ? /* @__PURE__ */
|
|
12982
|
+
isVirtual && globalBlockIndex < stablePrefixEnd - 1 ? /* @__PURE__ */ jsx38("div", { "aria-hidden": "true", className: "h-0 shrink-0" }) : null
|
|
12949
12983
|
]
|
|
12950
12984
|
},
|
|
12951
12985
|
block.key
|
|
12952
12986
|
);
|
|
12953
12987
|
};
|
|
12954
|
-
return /* @__PURE__ */
|
|
12988
|
+
return /* @__PURE__ */ jsx38(
|
|
12955
12989
|
"div",
|
|
12956
12990
|
{
|
|
12957
12991
|
part: "messages-content",
|
|
12958
12992
|
className: `blade-chat-messages-content mx-auto max-w-[var(--blade-chat-width,780px)] ${customization?.classNames?.messageListContent ?? ""}`,
|
|
12959
|
-
children: /* @__PURE__ */
|
|
12960
|
-
renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */
|
|
12993
|
+
children: /* @__PURE__ */ jsxs36("div", { className: `min-w-0 flex flex-col gap-9 ${customization?.classNames?.messageListInner ?? ""}`, children: [
|
|
12994
|
+
renderBlocks.length === 0 && isLoadingHistory ? /* @__PURE__ */ jsx38(HistoryLoadingPlaceholder, {}) : renderBlocks.length === 0 ? emptyState ? emptyState : customization?.components?.EmptyState ? /* @__PURE__ */ jsx38(customization.components.EmptyState, {}) : /* @__PURE__ */ jsxs36(
|
|
12961
12995
|
"div",
|
|
12962
12996
|
{
|
|
12963
12997
|
part: "empty",
|
|
12964
12998
|
className: `blade-chat-empty flex flex-col items-center justify-center gap-3 py-24 text-[hsl(var(--muted-foreground))] ${customization?.classNames?.emptyState ?? ""}`,
|
|
12965
12999
|
children: [
|
|
12966
|
-
/* @__PURE__ */
|
|
12967
|
-
/* @__PURE__ */
|
|
12968
|
-
/* @__PURE__ */
|
|
13000
|
+
/* @__PURE__ */ jsx38(MessageSquare, { size: 40, strokeWidth: 1.5 }),
|
|
13001
|
+
/* @__PURE__ */ jsx38("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
|
|
13002
|
+
/* @__PURE__ */ jsx38("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
12969
13003
|
]
|
|
12970
13004
|
}
|
|
12971
|
-
) : /* @__PURE__ */
|
|
12972
|
-
stablePrefixEnd > 0 ? /* @__PURE__ */
|
|
13005
|
+
) : /* @__PURE__ */ jsxs36(Fragment19, { children: [
|
|
13006
|
+
stablePrefixEnd > 0 ? /* @__PURE__ */ jsx38(
|
|
12973
13007
|
"div",
|
|
12974
13008
|
{
|
|
12975
13009
|
ref: virtualPrefixRef,
|
|
@@ -12986,23 +13020,23 @@ function MessageListContent({
|
|
|
12986
13020
|
(block, residentIndex) => renderMeasuredRow(block, stablePrefixEnd + residentIndex)
|
|
12987
13021
|
)
|
|
12988
13022
|
] }),
|
|
12989
|
-
sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */
|
|
13023
|
+
sessionStatus === "interrupted" && !hasInterruptedTurn ? /* @__PURE__ */ jsx38("div", { className: "flex", children: /* @__PURE__ */ jsx38("div", { className: "rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-2.5 py-1 text-[10px] font-medium text-[hsl(var(--swf-warning))]", children: "\u5DF2\u4E2D\u65AD" }) }) : null
|
|
12990
13024
|
] })
|
|
12991
13025
|
}
|
|
12992
13026
|
);
|
|
12993
13027
|
}
|
|
12994
13028
|
function HistoryLoadingPlaceholder() {
|
|
12995
|
-
return /* @__PURE__ */
|
|
12996
|
-
/* @__PURE__ */
|
|
12997
|
-
/* @__PURE__ */
|
|
12998
|
-
/* @__PURE__ */
|
|
13029
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-9", "aria-busy": "true", "aria-live": "polite", children: [
|
|
13030
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex items-center justify-center gap-2 text-sm text-[hsl(var(--muted-foreground))]", children: [
|
|
13031
|
+
/* @__PURE__ */ jsx38("span", { className: "size-3.5 animate-spin rounded-full border-2 border-current border-t-transparent" }),
|
|
13032
|
+
/* @__PURE__ */ jsx38("span", { children: "\u6B63\u5728\u52A0\u8F7D\u5BF9\u8BDD\u8BB0\u5F55\u2026" })
|
|
12999
13033
|
] }),
|
|
13000
|
-
[0, 1].map((index) => /* @__PURE__ */
|
|
13001
|
-
/* @__PURE__ */
|
|
13002
|
-
/* @__PURE__ */
|
|
13003
|
-
/* @__PURE__ */
|
|
13004
|
-
/* @__PURE__ */
|
|
13005
|
-
/* @__PURE__ */
|
|
13034
|
+
[0, 1].map((index) => /* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-4", children: [
|
|
13035
|
+
/* @__PURE__ */ jsx38("div", { className: "flex justify-end", children: /* @__PURE__ */ jsx38("div", { className: "h-10 w-2/5 animate-pulse rounded-2xl bg-[hsl(var(--muted))]" }) }),
|
|
13036
|
+
/* @__PURE__ */ jsxs36("div", { className: "flex flex-col gap-2.5", children: [
|
|
13037
|
+
/* @__PURE__ */ jsx38("div", { className: "h-4 w-1/3 animate-pulse rounded bg-[hsl(var(--muted))]" }),
|
|
13038
|
+
/* @__PURE__ */ jsx38("div", { className: "h-4 w-4/5 animate-pulse rounded bg-[hsl(var(--muted))]" }),
|
|
13039
|
+
/* @__PURE__ */ jsx38("div", { className: "h-4 w-3/5 animate-pulse rounded bg-[hsl(var(--muted))]" })
|
|
13006
13040
|
] })
|
|
13007
13041
|
] }, index))
|
|
13008
13042
|
] });
|
|
@@ -13010,7 +13044,7 @@ function HistoryLoadingPlaceholder() {
|
|
|
13010
13044
|
function ScrollToBottomButton({ onBeforeScroll }) {
|
|
13011
13045
|
const { isAtBottom, scrollToBottom } = useStickToBottomContext();
|
|
13012
13046
|
if (isAtBottom) return null;
|
|
13013
|
-
return /* @__PURE__ */
|
|
13047
|
+
return /* @__PURE__ */ jsxs36(
|
|
13014
13048
|
"button",
|
|
13015
13049
|
{
|
|
13016
13050
|
type: "button",
|
|
@@ -13022,28 +13056,28 @@ function ScrollToBottomButton({ onBeforeScroll }) {
|
|
|
13022
13056
|
part: "scroll-bottom",
|
|
13023
13057
|
className: "blade-chat-scroll-bottom 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-[var(--swf-shadow-overlay)] transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
13024
13058
|
children: [
|
|
13025
|
-
/* @__PURE__ */
|
|
13026
|
-
/* @__PURE__ */
|
|
13059
|
+
/* @__PURE__ */ jsx38(ChevronDown, { size: 14 }),
|
|
13060
|
+
/* @__PURE__ */ jsx38("span", { className: "blade-chat-scroll-bottom-label", children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
|
|
13027
13061
|
]
|
|
13028
13062
|
}
|
|
13029
13063
|
);
|
|
13030
13064
|
}
|
|
13031
13065
|
function PlanningDivider({ kind }) {
|
|
13032
13066
|
const isEnter = kind === "enter";
|
|
13033
|
-
return /* @__PURE__ */
|
|
13034
|
-
/* @__PURE__ */
|
|
13035
|
-
/* @__PURE__ */
|
|
13036
|
-
/* @__PURE__ */
|
|
13037
|
-
/* @__PURE__ */
|
|
13067
|
+
return /* @__PURE__ */ jsxs36("div", { className: "flex items-center gap-3 py-1", children: [
|
|
13068
|
+
/* @__PURE__ */ jsx38("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
|
|
13069
|
+
/* @__PURE__ */ jsxs36("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-[hsl(var(--swf-warning)/0.3)] bg-[hsl(var(--swf-warning-soft))] px-3 py-1 text-[11px] text-[hsl(var(--swf-warning))]", children: [
|
|
13070
|
+
/* @__PURE__ */ jsx38(Lightbulb, { size: 12 }),
|
|
13071
|
+
/* @__PURE__ */ jsx38("span", { children: isEnter ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
|
|
13038
13072
|
] }),
|
|
13039
|
-
/* @__PURE__ */
|
|
13073
|
+
/* @__PURE__ */ jsx38("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
|
|
13040
13074
|
] });
|
|
13041
13075
|
}
|
|
13042
13076
|
function ContextDivider() {
|
|
13043
|
-
return /* @__PURE__ */
|
|
13077
|
+
return /* @__PURE__ */ jsx38("div", { "aria-hidden": "true", className: "h-px w-full bg-[hsl(var(--border)/0.55)]" });
|
|
13044
13078
|
}
|
|
13045
13079
|
function MessageList(props) {
|
|
13046
|
-
return /* @__PURE__ */
|
|
13080
|
+
return /* @__PURE__ */ jsx38(CurrentChatSessionProvider, { sessionId: props.sessionId || null, children: /* @__PURE__ */ jsx38(MessageListBody, { ...props }) });
|
|
13047
13081
|
}
|
|
13048
13082
|
|
|
13049
13083
|
// src/chat/runtime/use-chat-actions.ts
|
|
@@ -13196,7 +13230,7 @@ function useSessionReplay(sessionId) {
|
|
|
13196
13230
|
}
|
|
13197
13231
|
|
|
13198
13232
|
// src/chat/SessionReplayBar.tsx
|
|
13199
|
-
import { jsx as
|
|
13233
|
+
import { jsx as jsx39 } from "react/jsx-runtime";
|
|
13200
13234
|
function SessionReplayBar({
|
|
13201
13235
|
sessionId,
|
|
13202
13236
|
className,
|
|
@@ -13206,7 +13240,7 @@ function SessionReplayBar({
|
|
|
13206
13240
|
const session = useSessionHandle(sessionId);
|
|
13207
13241
|
const settings = useSessionState(sessionId, (state2) => state2.replay?.settings);
|
|
13208
13242
|
const environment = useChatEnvironment();
|
|
13209
|
-
return /* @__PURE__ */
|
|
13243
|
+
return /* @__PURE__ */ jsx39(
|
|
13210
13244
|
ReplayBar,
|
|
13211
13245
|
{
|
|
13212
13246
|
isReplay,
|
|
@@ -13233,7 +13267,7 @@ function SessionReplayBar({
|
|
|
13233
13267
|
}
|
|
13234
13268
|
|
|
13235
13269
|
// src/chat/ChatPanel.tsx
|
|
13236
|
-
import { Fragment as
|
|
13270
|
+
import { Fragment as Fragment20, jsx as jsx40, jsxs as jsxs37 } from "react/jsx-runtime";
|
|
13237
13271
|
function nextQueuedOrder(items, itemId, delta) {
|
|
13238
13272
|
const pending = items.filter((item) => item.status === "pending");
|
|
13239
13273
|
const index = pending.findIndex((item) => item.id === itemId);
|
|
@@ -13477,7 +13511,7 @@ function ChatPanel({
|
|
|
13477
13511
|
onCommand,
|
|
13478
13512
|
canCreateBoardTask,
|
|
13479
13513
|
canShareSession,
|
|
13480
|
-
planPanel: /* @__PURE__ */
|
|
13514
|
+
planPanel: /* @__PURE__ */ jsx40(CurrentPlanPanel, { sessionId, className: "border-b border-[hsl(var(--border))] px-4" }),
|
|
13481
13515
|
maxWidthClassName: cn("max-w-[var(--blade-chat-width,780px)]", classNames?.chatInputInner),
|
|
13482
13516
|
mergesWithPanelAbove: queuePanelVisible && !composerBanner,
|
|
13483
13517
|
className: classNames?.chatInputRoot,
|
|
@@ -13496,8 +13530,8 @@ function ChatPanel({
|
|
|
13496
13530
|
initialDraft,
|
|
13497
13531
|
initialDraftKey
|
|
13498
13532
|
};
|
|
13499
|
-
return /* @__PURE__ */
|
|
13500
|
-
/* @__PURE__ */
|
|
13533
|
+
return /* @__PURE__ */ jsx40(ChatEnvironmentProvider, { value: scopedEnvironment, children: /* @__PURE__ */ jsx40(CurrentChatSessionProvider, { sessionId: sessionId || null, children: /* @__PURE__ */ jsx40(ReadOnlyChatProvider, { value: isViewer, children: /* @__PURE__ */ jsx40(RelatedWorkContext.Provider, { value: setRelatedWork, children: /* @__PURE__ */ jsx40(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsx40(FollowupInteractionProvider, { value: onFollowupInteraction, children: /* @__PURE__ */ jsxs37(McpAppMessageContext.Provider, { value: handleMcpAppMessage, children: [
|
|
13534
|
+
/* @__PURE__ */ jsxs37(
|
|
13501
13535
|
"div",
|
|
13502
13536
|
{
|
|
13503
13537
|
"data-theme": theme,
|
|
@@ -13505,7 +13539,7 @@ function ChatPanel({
|
|
|
13505
13539
|
style: rootStyle,
|
|
13506
13540
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
|
|
13507
13541
|
children: [
|
|
13508
|
-
isViewer && !readOnly && !isChild && /* @__PURE__ */
|
|
13542
|
+
isViewer && !readOnly && !isChild && /* @__PURE__ */ jsxs37(
|
|
13509
13543
|
"div",
|
|
13510
13544
|
{
|
|
13511
13545
|
className: cn(
|
|
@@ -13513,28 +13547,28 @@ function ChatPanel({
|
|
|
13513
13547
|
classNames?.viewerBanner
|
|
13514
13548
|
),
|
|
13515
13549
|
children: [
|
|
13516
|
-
/* @__PURE__ */
|
|
13550
|
+
/* @__PURE__ */ jsx40(Eye, { size: 14 }),
|
|
13517
13551
|
"\u4F60\u6B63\u5728\u67E5\u770B\u5206\u4EAB\u7684\u4F1A\u8BDD\uFF08\u53EA\u8BFB\uFF09"
|
|
13518
13552
|
]
|
|
13519
13553
|
}
|
|
13520
13554
|
),
|
|
13521
|
-
!isViewer && /* @__PURE__ */
|
|
13555
|
+
!isViewer && /* @__PURE__ */ jsx40(ConnectionBanner, { connection }),
|
|
13522
13556
|
banner,
|
|
13523
|
-
!isViewer && /* @__PURE__ */
|
|
13524
|
-
errorMessage && /* @__PURE__ */
|
|
13557
|
+
!isViewer && /* @__PURE__ */ jsx40(SessionReplayBar, { sessionId, onExit: onExitReplay }),
|
|
13558
|
+
errorMessage && /* @__PURE__ */ jsxs37(
|
|
13525
13559
|
"div",
|
|
13526
13560
|
{
|
|
13527
13561
|
part: "error-bar",
|
|
13528
13562
|
className: "blade-chat-error-bar flex items-start gap-2 border-b border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-4 py-3 text-sm text-[hsl(var(--swf-danger))]",
|
|
13529
13563
|
children: [
|
|
13530
|
-
/* @__PURE__ */
|
|
13531
|
-
/* @__PURE__ */
|
|
13564
|
+
/* @__PURE__ */ jsx40(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
|
|
13565
|
+
/* @__PURE__ */ jsx40("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay2(errorMessage, developer) })
|
|
13532
13566
|
]
|
|
13533
13567
|
}
|
|
13534
13568
|
),
|
|
13535
13569
|
header,
|
|
13536
|
-
/* @__PURE__ */
|
|
13537
|
-
columnsResizable ? /* @__PURE__ */
|
|
13570
|
+
/* @__PURE__ */ jsxs37("div", { ref: messagesAreaRef, className: "relative flex min-h-0 flex-1 flex-col", children: [
|
|
13571
|
+
columnsResizable ? /* @__PURE__ */ jsx40(
|
|
13538
13572
|
ChatColumnResizeRails,
|
|
13539
13573
|
{
|
|
13540
13574
|
containerRef: messagesAreaRef,
|
|
@@ -13543,7 +13577,7 @@ function ChatPanel({
|
|
|
13543
13577
|
onReset: resetChatColumnWidth2
|
|
13544
13578
|
}
|
|
13545
13579
|
) : null,
|
|
13546
|
-
developer && DeveloperMessageList ? /* @__PURE__ */
|
|
13580
|
+
developer && DeveloperMessageList ? /* @__PURE__ */ jsx40(
|
|
13547
13581
|
DeveloperMessageList,
|
|
13548
13582
|
{
|
|
13549
13583
|
sessionId,
|
|
@@ -13564,7 +13598,7 @@ function ChatPanel({
|
|
|
13564
13598
|
isReplay
|
|
13565
13599
|
},
|
|
13566
13600
|
sessionId
|
|
13567
|
-
) : /* @__PURE__ */
|
|
13601
|
+
) : /* @__PURE__ */ jsx40(
|
|
13568
13602
|
MessageList,
|
|
13569
13603
|
{
|
|
13570
13604
|
sessionId,
|
|
@@ -13591,7 +13625,7 @@ function ChatPanel({
|
|
|
13591
13625
|
sessionId
|
|
13592
13626
|
)
|
|
13593
13627
|
] }),
|
|
13594
|
-
isViewer ? /* @__PURE__ */
|
|
13628
|
+
isViewer ? /* @__PURE__ */ jsx40(
|
|
13595
13629
|
CurrentPlanPanel,
|
|
13596
13630
|
{
|
|
13597
13631
|
sessionId,
|
|
@@ -13599,8 +13633,8 @@ function ChatPanel({
|
|
|
13599
13633
|
className: cn("mx-auto w-full max-w-[var(--blade-chat-width,780px)] px-5 pb-3", classNames?.chatInputInner)
|
|
13600
13634
|
}
|
|
13601
13635
|
) : null,
|
|
13602
|
-
!isViewer && /* @__PURE__ */
|
|
13603
|
-
/* @__PURE__ */
|
|
13636
|
+
!isViewer && /* @__PURE__ */ jsxs37(Fragment20, { children: [
|
|
13637
|
+
/* @__PURE__ */ jsx40(
|
|
13604
13638
|
SessionQueuePanel,
|
|
13605
13639
|
{
|
|
13606
13640
|
snapshot: queue,
|
|
@@ -13621,14 +13655,14 @@ function ChatPanel({
|
|
|
13621
13655
|
},
|
|
13622
13656
|
sessionId
|
|
13623
13657
|
),
|
|
13624
|
-
/* @__PURE__ */
|
|
13658
|
+
/* @__PURE__ */ jsx40(Composer, { ...composerProps })
|
|
13625
13659
|
] }),
|
|
13626
|
-
(isChild || readOnly) && /* @__PURE__ */
|
|
13660
|
+
(isChild || readOnly) && /* @__PURE__ */ jsx40("div", { className: "border-t border-[hsl(var(--border))] px-4 py-3 text-center text-xs text-[hsl(var(--muted-foreground))]", children: "\u5982\u9700\u8865\u5145\u8981\u6C42\u6216\u7EE7\u7EED\u63A8\u8FDB\uFF0C\u8BF7\u5728\u4E3B\u5BF9\u8BDD\u4E2D\u56DE\u590D" }),
|
|
13627
13661
|
footer
|
|
13628
13662
|
]
|
|
13629
13663
|
}
|
|
13630
13664
|
),
|
|
13631
|
-
relatedWork && ("taskId" in relatedWork ? /* @__PURE__ */
|
|
13665
|
+
relatedWork && ("taskId" in relatedWork ? /* @__PURE__ */ jsx40(BackgroundLogDialog, { ...relatedWork, onClose: () => setRelatedWork(null) }) : /* @__PURE__ */ jsx40(SessionHistoryDialog, { ...relatedWork, onClose: () => setRelatedWork(null) }, relatedWork.sessionId))
|
|
13632
13666
|
] }) }) }) }) }) }) });
|
|
13633
13667
|
}
|
|
13634
13668
|
function SessionHistoryDialog({
|
|
@@ -13638,14 +13672,14 @@ function SessionHistoryDialog({
|
|
|
13638
13672
|
}) {
|
|
13639
13673
|
const { session, error } = useAgentSession(sessionId);
|
|
13640
13674
|
const source = useSingleSessionSource(session, !session && !error);
|
|
13641
|
-
return /* @__PURE__ */
|
|
13675
|
+
return /* @__PURE__ */ jsx40(Dialog, { open: true, onOpenChange: (open) => {
|
|
13642
13676
|
if (!open) onClose();
|
|
13643
|
-
}, children: /* @__PURE__ */
|
|
13644
|
-
/* @__PURE__ */
|
|
13677
|
+
}, children: /* @__PURE__ */ jsxs37(DialogContent, { "aria-describedby": void 0, className: "flex h-[min(80dvh,52rem)] max-w-3xl flex-col gap-0 overflow-hidden p-0", children: [
|
|
13678
|
+
/* @__PURE__ */ jsxs37(DialogTitle, { className: "truncate border-b border-[hsl(var(--border))] px-4 py-4 pr-14", children: [
|
|
13645
13679
|
title,
|
|
13646
13680
|
" \xB7 \u53EA\u8BFB\u67E5\u770B"
|
|
13647
13681
|
] }),
|
|
13648
|
-
/* @__PURE__ */
|
|
13682
|
+
/* @__PURE__ */ jsx40(SessionSourceProvider, { source, children: /* @__PURE__ */ jsx40(
|
|
13649
13683
|
ChatPanel,
|
|
13650
13684
|
{
|
|
13651
13685
|
sessionId,
|
|
@@ -13659,14 +13693,14 @@ function SessionHistoryDialog({
|
|
|
13659
13693
|
|
|
13660
13694
|
// src/components/SessionPluginSelector.tsx
|
|
13661
13695
|
import { useEffect as useEffect27, useState as useState33 } from "react";
|
|
13662
|
-
import { jsx as
|
|
13696
|
+
import { jsx as jsx41, jsxs as jsxs38 } from "react/jsx-runtime";
|
|
13663
13697
|
function SessionPluginSelector(props) {
|
|
13664
|
-
return /* @__PURE__ */
|
|
13698
|
+
return /* @__PURE__ */ jsx41(PluginSelectorState, { ...props }, props.sessionId);
|
|
13665
13699
|
}
|
|
13666
13700
|
function PluginSelectorState({ client, sessionId, className, side = "bottom", onChange }) {
|
|
13667
13701
|
const [open, setOpen] = useState33(false);
|
|
13668
|
-
return /* @__PURE__ */
|
|
13669
|
-
/* @__PURE__ */
|
|
13702
|
+
return /* @__PURE__ */ jsxs38("div", { className: `relative text-xs ${className ?? ""}`, children: [
|
|
13703
|
+
/* @__PURE__ */ jsx41(
|
|
13670
13704
|
"button",
|
|
13671
13705
|
{
|
|
13672
13706
|
type: "button",
|
|
@@ -13677,7 +13711,7 @@ function PluginSelectorState({ client, sessionId, className, side = "bottom", on
|
|
|
13677
13711
|
children: "\u4F1A\u8BDD\u63D2\u4EF6"
|
|
13678
13712
|
}
|
|
13679
13713
|
),
|
|
13680
|
-
open ? /* @__PURE__ */
|
|
13714
|
+
open ? /* @__PURE__ */ jsx41(PluginSelectorList, { client, sessionId, side, onChange }) : null
|
|
13681
13715
|
] });
|
|
13682
13716
|
}
|
|
13683
13717
|
function PluginSelectorList({
|
|
@@ -13691,13 +13725,13 @@ function PluginSelectorList({
|
|
|
13691
13725
|
useEffect27(() => {
|
|
13692
13726
|
reload();
|
|
13693
13727
|
}, [reload]);
|
|
13694
|
-
return /* @__PURE__ */
|
|
13728
|
+
return /* @__PURE__ */ jsxs38(
|
|
13695
13729
|
"div",
|
|
13696
13730
|
{
|
|
13697
13731
|
className: `absolute left-0 z-40 my-2 max-h-72 w-72 max-w-[calc(100vw-2rem)] overflow-y-auto rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--popover))] p-3 text-[hsl(var(--popover-foreground))] shadow-lg ${side === "top" ? "bottom-full" : "top-full"}`,
|
|
13698
13732
|
children: [
|
|
13699
|
-
controller.listError ? /* @__PURE__ */
|
|
13700
|
-
/* @__PURE__ */
|
|
13733
|
+
controller.listError ? /* @__PURE__ */ jsx41("button", { type: "button", onClick: reload, children: "\u63D2\u4EF6\u5217\u8868\u6682\u4E0D\u53EF\u7528\uFF0C\u70B9\u51FB\u91CD\u8BD5" }) : null,
|
|
13734
|
+
/* @__PURE__ */ jsx41(
|
|
13701
13735
|
PluginConnectorList,
|
|
13702
13736
|
{
|
|
13703
13737
|
client,
|
|
@@ -13721,7 +13755,7 @@ function PluginSelectorList({
|
|
|
13721
13755
|
}
|
|
13722
13756
|
|
|
13723
13757
|
// src/components/AgentChat.tsx
|
|
13724
|
-
import { Fragment as
|
|
13758
|
+
import { Fragment as Fragment21, jsx as jsx42, jsxs as jsxs39 } from "react/jsx-runtime";
|
|
13725
13759
|
function isUnauthorizedError(error) {
|
|
13726
13760
|
return error instanceof BladeApiError2 && error.status === 401;
|
|
13727
13761
|
}
|
|
@@ -13740,11 +13774,11 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
13740
13774
|
setLoggingIn(false);
|
|
13741
13775
|
}
|
|
13742
13776
|
};
|
|
13743
|
-
return /* @__PURE__ */
|
|
13744
|
-
/* @__PURE__ */
|
|
13745
|
-
/* @__PURE__ */
|
|
13746
|
-
/* @__PURE__ */
|
|
13747
|
-
/* @__PURE__ */
|
|
13777
|
+
return /* @__PURE__ */ jsx42("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs39("div", { className: "flex w-full max-w-sm flex-col items-center gap-4 rounded-2xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-6 py-8 text-center", children: [
|
|
13778
|
+
/* @__PURE__ */ jsx42(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
|
|
13779
|
+
/* @__PURE__ */ jsx42("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
|
|
13780
|
+
/* @__PURE__ */ jsx42("div", { className: "text-sm text-[hsl(var(--muted-foreground))]", children: "\u767B\u5F55\u540E\u5373\u53EF\u4E0E\u667A\u80FD\u4F53\u5BF9\u8BDD\uFF0C\u4F60\u7684\u4F1A\u8BDD\u5185\u5BB9\u4EC5\u81EA\u5DF1\u53EF\u89C1\u3002" }),
|
|
13781
|
+
/* @__PURE__ */ jsx42(
|
|
13748
13782
|
"button",
|
|
13749
13783
|
{
|
|
13750
13784
|
type: "button",
|
|
@@ -13754,7 +13788,7 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
13754
13788
|
children: loggingIn ? "\u767B\u5F55\u4E2D\u2026" : "\u767B\u5F55"
|
|
13755
13789
|
}
|
|
13756
13790
|
),
|
|
13757
|
-
loginError && /* @__PURE__ */
|
|
13791
|
+
loginError && /* @__PURE__ */ jsx42("div", { className: "text-xs text-[hsl(var(--destructive))]", children: loginError })
|
|
13758
13792
|
] }) });
|
|
13759
13793
|
}
|
|
13760
13794
|
function AgentChat(props) {
|
|
@@ -13762,13 +13796,13 @@ function AgentChat(props) {
|
|
|
13762
13796
|
const [attempt, setAttempt] = useState34(0);
|
|
13763
13797
|
const [needLogin, setNeedLogin] = useState34(() => !client.hasToken());
|
|
13764
13798
|
if (needLogin) {
|
|
13765
|
-
return /* @__PURE__ */
|
|
13799
|
+
return /* @__PURE__ */ jsx42(
|
|
13766
13800
|
"div",
|
|
13767
13801
|
{
|
|
13768
13802
|
"data-theme": props.theme,
|
|
13769
13803
|
part: "root",
|
|
13770
13804
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col", props.classNames?.root),
|
|
13771
|
-
children: /* @__PURE__ */
|
|
13805
|
+
children: /* @__PURE__ */ jsx42(
|
|
13772
13806
|
LoginCard,
|
|
13773
13807
|
{
|
|
13774
13808
|
client,
|
|
@@ -13781,7 +13815,7 @@ function AgentChat(props) {
|
|
|
13781
13815
|
}
|
|
13782
13816
|
);
|
|
13783
13817
|
}
|
|
13784
|
-
return /* @__PURE__ */
|
|
13818
|
+
return /* @__PURE__ */ jsx42(ChatSessionView, { ...props, onUnauthorized: () => setNeedLogin(true) }, attempt);
|
|
13785
13819
|
}
|
|
13786
13820
|
function ChatSessionView({
|
|
13787
13821
|
sessionId,
|
|
@@ -13796,11 +13830,14 @@ function ChatSessionView({
|
|
|
13796
13830
|
theme,
|
|
13797
13831
|
onFollowupInteraction,
|
|
13798
13832
|
sessionPluginControls,
|
|
13833
|
+
connectorSections,
|
|
13799
13834
|
planAgentActions,
|
|
13800
13835
|
onUnauthorized
|
|
13801
13836
|
}) {
|
|
13802
13837
|
const client = useBladeClient();
|
|
13803
13838
|
const host = useBladeHost();
|
|
13839
|
+
const inputServices = useRichInputServices();
|
|
13840
|
+
const services = useMemo16(() => connectorSections ? { ...inputServices, connectorSections } : inputServices, [inputServices, connectorSections]);
|
|
13804
13841
|
const { session, state: state2, error } = useAgentSession(sessionId, {
|
|
13805
13842
|
createOptions,
|
|
13806
13843
|
onSessionCreated
|
|
@@ -13852,7 +13889,7 @@ function ChatSessionView({
|
|
|
13852
13889
|
);
|
|
13853
13890
|
const connectError = error && !isUnauthorizedError(error) ? error.message || "\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u7A0D\u540E\u91CD\u8BD5" : null;
|
|
13854
13891
|
const sessionClient = resolvedSessionId && createOptions?.anonymous && !client.options.anonymousSessionId ? client.forAnonymousSession(resolvedSessionId) : client;
|
|
13855
|
-
return /* @__PURE__ */
|
|
13892
|
+
return /* @__PURE__ */ jsx42(BladeProvider, { client: sessionClient, host, children: /* @__PURE__ */ jsx42(SessionSourceProvider, { source, children: /* @__PURE__ */ jsx42(ChatEnvironmentProvider, { value: environment, children: /* @__PURE__ */ jsx42(RichInputServicesProvider, { value: services, children: /* @__PURE__ */ jsx42(
|
|
13856
13893
|
ChatPanel,
|
|
13857
13894
|
{
|
|
13858
13895
|
sessionId: resolvedSessionId ?? "",
|
|
@@ -13866,12 +13903,12 @@ function ChatSessionView({
|
|
|
13866
13903
|
onFollowupInteraction,
|
|
13867
13904
|
errorMessage: connectError ?? replay.error?.message ?? notice,
|
|
13868
13905
|
onExitReplay: () => void replay.exitToAutonomous(),
|
|
13869
|
-
banner: /* @__PURE__ */
|
|
13870
|
-
resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */
|
|
13871
|
-
/* @__PURE__ */
|
|
13906
|
+
banner: /* @__PURE__ */ jsxs39(Fragment21, { children: [
|
|
13907
|
+
resolvedSessionId && !isViewer && (sessionPluginControls ? sessionPluginControls(resolvedSessionId) : client.options.anonymousSessionId || createOptions?.anonymous ? null : /* @__PURE__ */ jsx42(SessionPluginSelector, { client, sessionId: resolvedSessionId })),
|
|
13908
|
+
/* @__PURE__ */ jsx42(ReplayMismatchPrompt, { mismatch: replay.mismatch })
|
|
13872
13909
|
] })
|
|
13873
13910
|
}
|
|
13874
|
-
) }) }) });
|
|
13911
|
+
) }) }) }) });
|
|
13875
13912
|
}
|
|
13876
13913
|
|
|
13877
13914
|
// src/components/LlmChat.tsx
|
|
@@ -14236,7 +14273,7 @@ function toToolCallInfo(call, results, failedToolIds) {
|
|
|
14236
14273
|
|
|
14237
14274
|
// src/components/LlmAdvancedSettings.tsx
|
|
14238
14275
|
import { useState as useState36 } from "react";
|
|
14239
|
-
import { jsx as
|
|
14276
|
+
import { jsx as jsx43, jsxs as jsxs40 } from "react/jsx-runtime";
|
|
14240
14277
|
var FIELDS = [
|
|
14241
14278
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
14242
14279
|
{ id: "model", label: "\u6A21\u578B", placeholder: "\u6A21\u578B\u540D\u79F0" },
|
|
@@ -14287,8 +14324,8 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
14287
14324
|
if (!normalized) return null;
|
|
14288
14325
|
const fields = FIELDS.filter((field) => normalized[field.id]);
|
|
14289
14326
|
const dirty = Object.keys(override).length > 0;
|
|
14290
|
-
return /* @__PURE__ */
|
|
14291
|
-
/* @__PURE__ */
|
|
14327
|
+
return /* @__PURE__ */ jsxs40("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
|
|
14328
|
+
/* @__PURE__ */ jsxs40(
|
|
14292
14329
|
"button",
|
|
14293
14330
|
{
|
|
14294
14331
|
type: "button",
|
|
@@ -14298,16 +14335,16 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
14298
14335
|
},
|
|
14299
14336
|
className: "flex items-center gap-1.5 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
14300
14337
|
children: [
|
|
14301
|
-
/* @__PURE__ */
|
|
14338
|
+
/* @__PURE__ */ jsx43(Settings2, { size: 13 }),
|
|
14302
14339
|
"\u9AD8\u7EA7\u8BBE\u7F6E",
|
|
14303
|
-
dirty && /* @__PURE__ */
|
|
14340
|
+
dirty && /* @__PURE__ */ jsx43("span", { className: "text-[hsl(var(--primary))]", children: "\uFF08\u5DF2\u81EA\u5B9A\u4E49\uFF09" })
|
|
14304
14341
|
]
|
|
14305
14342
|
}
|
|
14306
14343
|
),
|
|
14307
|
-
open && /* @__PURE__ */
|
|
14308
|
-
fields.map((field) => /* @__PURE__ */
|
|
14309
|
-
/* @__PURE__ */
|
|
14310
|
-
/* @__PURE__ */
|
|
14344
|
+
open && /* @__PURE__ */ jsxs40("div", { className: "mt-2 flex flex-col gap-2", children: [
|
|
14345
|
+
fields.map((field) => /* @__PURE__ */ jsxs40("label", { className: "flex flex-col gap-1", children: [
|
|
14346
|
+
/* @__PURE__ */ jsx43("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
|
|
14347
|
+
/* @__PURE__ */ jsx43(
|
|
14311
14348
|
"input",
|
|
14312
14349
|
{
|
|
14313
14350
|
type: field.secret ? "password" : "text",
|
|
@@ -14318,9 +14355,9 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
14318
14355
|
}
|
|
14319
14356
|
)
|
|
14320
14357
|
] }, field.id)),
|
|
14321
|
-
normalized.apiKey && /* @__PURE__ */
|
|
14322
|
-
/* @__PURE__ */
|
|
14323
|
-
/* @__PURE__ */
|
|
14358
|
+
normalized.apiKey && /* @__PURE__ */ jsx43("p", { className: "text-[hsl(var(--muted-foreground))]", children: "\u5BC6\u94A5\u4F1A\u5B58\u5728\u8FD9\u53F0\u6D4F\u89C8\u5668\u91CC\u3002\u53EA\u5728\u4F60\u4FE1\u5F97\u8FC7\u8FD9\u53F0\u673A\u5668\u65F6\u586B\u3002" }),
|
|
14359
|
+
/* @__PURE__ */ jsxs40("div", { className: "flex gap-2", children: [
|
|
14360
|
+
/* @__PURE__ */ jsx43(
|
|
14324
14361
|
"button",
|
|
14325
14362
|
{
|
|
14326
14363
|
type: "button",
|
|
@@ -14335,7 +14372,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
14335
14372
|
children: "\u4FDD\u5B58"
|
|
14336
14373
|
}
|
|
14337
14374
|
),
|
|
14338
|
-
/* @__PURE__ */
|
|
14375
|
+
/* @__PURE__ */ jsx43(
|
|
14339
14376
|
"button",
|
|
14340
14377
|
{
|
|
14341
14378
|
type: "button",
|
|
@@ -14354,7 +14391,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
14354
14391
|
}
|
|
14355
14392
|
|
|
14356
14393
|
// src/components/LlmChat.tsx
|
|
14357
|
-
import { jsx as
|
|
14394
|
+
import { jsx as jsx44, jsxs as jsxs41 } from "react/jsx-runtime";
|
|
14358
14395
|
function LlmChat({
|
|
14359
14396
|
classNames,
|
|
14360
14397
|
renderers,
|
|
@@ -14386,26 +14423,26 @@ ${text}` : text),
|
|
|
14386
14423
|
onReady?.(handle);
|
|
14387
14424
|
}, [handle, onReady]);
|
|
14388
14425
|
const customization = useMemo18(() => ({ classNames, renderers }), [classNames, renderers]);
|
|
14389
|
-
return /* @__PURE__ */
|
|
14426
|
+
return /* @__PURE__ */ jsx44(ChatCustomizationProvider, { value: customization, children: /* @__PURE__ */ jsxs41(
|
|
14390
14427
|
"div",
|
|
14391
14428
|
{
|
|
14392
14429
|
"data-theme": theme,
|
|
14393
14430
|
part: "root",
|
|
14394
14431
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col overflow-hidden", classNames?.root),
|
|
14395
14432
|
children: [
|
|
14396
|
-
error ? /* @__PURE__ */
|
|
14433
|
+
error ? /* @__PURE__ */ jsxs41(
|
|
14397
14434
|
"div",
|
|
14398
14435
|
{
|
|
14399
14436
|
part: "error-bar",
|
|
14400
14437
|
className: "blade-chat-error-bar flex items-start gap-2 border-b border-[hsl(var(--swf-danger)/0.3)] bg-[hsl(var(--swf-danger-soft))] px-4 py-3 text-sm text-[hsl(var(--swf-danger))]",
|
|
14401
14438
|
children: [
|
|
14402
|
-
/* @__PURE__ */
|
|
14403
|
-
/* @__PURE__ */
|
|
14439
|
+
/* @__PURE__ */ jsx44(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
|
|
14440
|
+
/* @__PURE__ */ jsx44("span", { className: "min-w-0 whitespace-pre-wrap break-words [overflow-wrap:anywhere]", children: chatErrorForDisplay3(error) })
|
|
14404
14441
|
]
|
|
14405
14442
|
}
|
|
14406
14443
|
) : null,
|
|
14407
14444
|
slots?.header,
|
|
14408
|
-
/* @__PURE__ */
|
|
14445
|
+
/* @__PURE__ */ jsx44(
|
|
14409
14446
|
MessageList,
|
|
14410
14447
|
{
|
|
14411
14448
|
sessionId: "",
|
|
@@ -14417,7 +14454,7 @@ ${text}` : text),
|
|
|
14417
14454
|
onRevealingChange: setIsRevealing
|
|
14418
14455
|
}
|
|
14419
14456
|
),
|
|
14420
|
-
advanced ? /* @__PURE__ */
|
|
14457
|
+
advanced ? /* @__PURE__ */ jsx44(
|
|
14421
14458
|
LlmAdvancedSettingsBar,
|
|
14422
14459
|
{
|
|
14423
14460
|
settings: advanced,
|
|
@@ -14430,7 +14467,7 @@ ${text}` : text),
|
|
|
14430
14467
|
}
|
|
14431
14468
|
}
|
|
14432
14469
|
) : null,
|
|
14433
|
-
/* @__PURE__ */
|
|
14470
|
+
/* @__PURE__ */ jsx44(
|
|
14434
14471
|
ChatInput,
|
|
14435
14472
|
{
|
|
14436
14473
|
value: inputText,
|
|
@@ -14459,14 +14496,14 @@ ${text}` : text),
|
|
|
14459
14496
|
}
|
|
14460
14497
|
|
|
14461
14498
|
// src/components/ChatView.tsx
|
|
14462
|
-
import { jsx as
|
|
14499
|
+
import { jsx as jsx45 } from "react/jsx-runtime";
|
|
14463
14500
|
function ChatView(props) {
|
|
14464
14501
|
const { mode, llm, onLlmReady, ...rest } = props;
|
|
14465
14502
|
if (mode === "llm") {
|
|
14466
14503
|
if (!llm) {
|
|
14467
14504
|
throw new Error('ChatView: mode="llm" \u9700\u8981\u540C\u65F6\u4F20 llm={{ baseURL, model }}');
|
|
14468
14505
|
}
|
|
14469
|
-
return /* @__PURE__ */
|
|
14506
|
+
return /* @__PURE__ */ jsx45(
|
|
14470
14507
|
LlmChat,
|
|
14471
14508
|
{
|
|
14472
14509
|
...llm,
|
|
@@ -14479,12 +14516,12 @@ function ChatView(props) {
|
|
|
14479
14516
|
}
|
|
14480
14517
|
);
|
|
14481
14518
|
}
|
|
14482
|
-
return /* @__PURE__ */
|
|
14519
|
+
return /* @__PURE__ */ jsx45(AgentChat, { ...rest });
|
|
14483
14520
|
}
|
|
14484
14521
|
|
|
14485
14522
|
// src/components/TopicAssetSubmitDialog.tsx
|
|
14486
14523
|
import { useRef as useRef26, useState as useState38 } from "react";
|
|
14487
|
-
import { jsx as
|
|
14524
|
+
import { jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
|
|
14488
14525
|
function useTopicAssetSubmissionAccess(sessionId) {
|
|
14489
14526
|
const client = useBladeClient();
|
|
14490
14527
|
return useAsyncValue(sessionId, async (signal) => {
|
|
@@ -14540,36 +14577,36 @@ function TopicAssetSubmitDialog({ sessionId, topicId, path, onClose, onSubmitted
|
|
|
14540
14577
|
setBusy(false);
|
|
14541
14578
|
}
|
|
14542
14579
|
};
|
|
14543
|
-
return /* @__PURE__ */
|
|
14580
|
+
return /* @__PURE__ */ jsx46(Dialog, { open: true, onOpenChange: (open) => {
|
|
14544
14581
|
if (!open && !busy) onClose();
|
|
14545
|
-
}, children: /* @__PURE__ */
|
|
14546
|
-
/* @__PURE__ */
|
|
14547
|
-
/* @__PURE__ */
|
|
14548
|
-
/* @__PURE__ */
|
|
14582
|
+
}, children: /* @__PURE__ */ jsxs42(DialogContent, { className: "max-w-md", children: [
|
|
14583
|
+
/* @__PURE__ */ jsx46(DialogTitle, { children: "\u63D0\u4EA4\u5230\u8D44\u4EA7" }),
|
|
14584
|
+
/* @__PURE__ */ jsx46(DialogDescription, { children: "\u5C06\u6587\u4EF6\u590D\u5236\u5230\u5DE5\u4F5C\u7A7A\u95F4\u4F9B\u6210\u5458\u4F7F\u7528\uFF0C\u5DE5\u4F5C\u533A\u539F\u6587\u4EF6\u4F1A\u4FDD\u7559\u3002\u540C\u540D\u8D44\u4EA7\u4F1A\u88AB\u66FF\u6362\u3002" }),
|
|
14585
|
+
/* @__PURE__ */ jsxs42("form", { onSubmit: (event) => {
|
|
14549
14586
|
event.preventDefault();
|
|
14550
14587
|
void submit();
|
|
14551
14588
|
}, className: "flex flex-col gap-4", children: [
|
|
14552
|
-
/* @__PURE__ */
|
|
14553
|
-
/* @__PURE__ */
|
|
14589
|
+
/* @__PURE__ */ jsx46("p", { className: "break-all text-sm text-secondary-foreground", children: path }),
|
|
14590
|
+
/* @__PURE__ */ jsxs42("label", { className: "flex flex-col gap-1 text-sm", children: [
|
|
14554
14591
|
"\u76EE\u6807\u6587\u4EF6\u5939",
|
|
14555
|
-
/* @__PURE__ */
|
|
14556
|
-
/* @__PURE__ */
|
|
14557
|
-
assets.data?.map((item) => /* @__PURE__ */
|
|
14592
|
+
/* @__PURE__ */ jsxs42("select", { "aria-label": "\u76EE\u6807\u6587\u4EF6\u5939", value: folder, onChange: (event) => setFolder(event.target.value), disabled: busy || !assets.data, className: "rounded-md border border-border bg-background p-2", children: [
|
|
14593
|
+
/* @__PURE__ */ jsx46("option", { value: "", children: "\u8D44\u4EA7\u6839\u76EE\u5F55" }),
|
|
14594
|
+
assets.data?.map((item) => /* @__PURE__ */ jsx46("option", { value: item, children: item }, item))
|
|
14558
14595
|
] })
|
|
14559
14596
|
] }),
|
|
14560
|
-
/* @__PURE__ */
|
|
14597
|
+
/* @__PURE__ */ jsxs42("label", { className: "flex flex-col gap-1 text-sm", children: [
|
|
14561
14598
|
"\u8BF4\u660E\uFF08\u53EF\u9009\uFF09",
|
|
14562
|
-
/* @__PURE__ */
|
|
14599
|
+
/* @__PURE__ */ jsx46("textarea", { "aria-label": "\u63D0\u4EA4\u8BF4\u660E", value: message, onChange: (event) => setMessage(event.target.value), maxLength: 1e3, disabled: busy, className: "min-h-20 rounded-md border border-border bg-background p-2" })
|
|
14563
14600
|
] }),
|
|
14564
|
-
assets.error ? /* @__PURE__ */
|
|
14601
|
+
assets.error ? /* @__PURE__ */ jsxs42("div", { role: "alert", className: "text-sm text-muted-foreground", children: [
|
|
14565
14602
|
assets.error instanceof Error ? assets.error.message : "\u8D44\u4EA7\u52A0\u8F7D\u5931\u8D25",
|
|
14566
14603
|
" ",
|
|
14567
|
-
/* @__PURE__ */
|
|
14568
|
-
] }) : !assets.data ? /* @__PURE__ */
|
|
14569
|
-
error ? /* @__PURE__ */
|
|
14570
|
-
/* @__PURE__ */
|
|
14571
|
-
/* @__PURE__ */
|
|
14572
|
-
/* @__PURE__ */
|
|
14604
|
+
/* @__PURE__ */ jsx46("button", { type: "button", onClick: () => setRevision((n) => n + 1), className: "underline", children: "\u91CD\u8BD5" })
|
|
14605
|
+
] }) : !assets.data ? /* @__PURE__ */ jsx46("output", { className: "text-sm text-muted-foreground", children: "\u6B63\u5728\u52A0\u8F7D\u8D44\u4EA7\u2026" }) : null,
|
|
14606
|
+
error ? /* @__PURE__ */ jsx46("p", { role: "alert", className: "text-sm text-muted-foreground", children: error }) : null,
|
|
14607
|
+
/* @__PURE__ */ jsxs42("div", { className: "flex justify-end gap-2", children: [
|
|
14608
|
+
/* @__PURE__ */ jsx46("button", { type: "button", disabled: busy, onClick: onClose, className: "rounded-md border border-border px-3 py-2 text-sm", children: "\u53D6\u6D88" }),
|
|
14609
|
+
/* @__PURE__ */ jsx46("button", { type: "submit", disabled: busy || !assets.data, className: "rounded-md bg-primary px-3 py-2 text-sm text-primary-foreground disabled:opacity-50", children: busy ? "\u63D0\u4EA4\u4E2D\u2026" : "\u63D0\u4EA4" })
|
|
14573
14610
|
] })
|
|
14574
14611
|
] })
|
|
14575
14612
|
] }) });
|
|
@@ -14611,11 +14648,64 @@ function useCapabilities(client) {
|
|
|
14611
14648
|
return state2.value;
|
|
14612
14649
|
}
|
|
14613
14650
|
|
|
14651
|
+
// src/components/CaseDemoPlayer.tsx
|
|
14652
|
+
import { useEffect as useEffect31, useState as useState40 } from "react";
|
|
14653
|
+
import { jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
|
|
14654
|
+
function CaseDemoPlayer({ events }) {
|
|
14655
|
+
const [count, setCount] = useState40(1);
|
|
14656
|
+
const [playing, setPlaying] = useState40(true);
|
|
14657
|
+
const [speed, setSpeed] = useState40(2);
|
|
14658
|
+
useEffect31(() => {
|
|
14659
|
+
if (!playing || count >= events.length) return;
|
|
14660
|
+
const timer = window.setTimeout(() => setCount((current) => current + 1), 1e3 / speed);
|
|
14661
|
+
return () => window.clearTimeout(timer);
|
|
14662
|
+
}, [count, events.length, playing, speed]);
|
|
14663
|
+
if (!events.length) return /* @__PURE__ */ jsx47("p", { className: "p-4 text-sm text-muted-foreground", children: "\u6682\u65E0\u6F14\u793A\u8BB0\u5F55" });
|
|
14664
|
+
const finished = count >= events.length;
|
|
14665
|
+
return /* @__PURE__ */ jsxs43("div", { className: "flex min-h-0 flex-col", children: [
|
|
14666
|
+
/* @__PURE__ */ jsx47("ol", { "aria-label": "\u6F14\u793A\u8BB0\u5F55", className: "max-h-[50vh] space-y-3 overflow-auto px-1 py-3", children: events.slice(0, count).map((event, index) => (
|
|
14667
|
+
// The recording order is fixed for this mounted player.
|
|
14668
|
+
/* @__PURE__ */ jsxs43("li", { className: event.role === "user" ? "ml-8 rounded-lg bg-muted p-3" : "mr-8 px-3", children: [
|
|
14669
|
+
/* @__PURE__ */ jsx47("span", { className: "text-xs font-medium text-muted-foreground", children: event.role === "user" ? "\u7528\u6237" : "\u667A\u80FD\u4F53" }),
|
|
14670
|
+
event.step && /* @__PURE__ */ jsx47("p", { className: "mt-1 text-sm text-muted-foreground", children: event.step }),
|
|
14671
|
+
event.content && /* @__PURE__ */ jsx47("p", { className: "mt-1 whitespace-pre-wrap break-words text-sm", children: event.content })
|
|
14672
|
+
] }, index)
|
|
14673
|
+
)) }),
|
|
14674
|
+
/* @__PURE__ */ jsxs43("div", { className: "flex flex-wrap items-center gap-3 border-t px-1 pt-3 text-xs", children: [
|
|
14675
|
+
/* @__PURE__ */ jsx47("button", { type: "button", disabled: finished, onClick: () => setPlaying(!playing), children: playing && !finished ? "\u6682\u505C" : "\u7EE7\u7EED" }),
|
|
14676
|
+
/* @__PURE__ */ jsx47("button", { type: "button", onClick: () => {
|
|
14677
|
+
setCount(1);
|
|
14678
|
+
setPlaying(true);
|
|
14679
|
+
}, children: "\u91CD\u64AD" }),
|
|
14680
|
+
/* @__PURE__ */ jsxs43("span", { children: [
|
|
14681
|
+
Math.min(count, events.length),
|
|
14682
|
+
" / ",
|
|
14683
|
+
events.length
|
|
14684
|
+
] }),
|
|
14685
|
+
[1, 2, 5].map((value) => /* @__PURE__ */ jsxs43(
|
|
14686
|
+
"button",
|
|
14687
|
+
{
|
|
14688
|
+
type: "button",
|
|
14689
|
+
className: "rounded px-1 py-0.5 aria-pressed:bg-muted",
|
|
14690
|
+
"aria-pressed": speed === value,
|
|
14691
|
+
onClick: () => setSpeed(value),
|
|
14692
|
+
children: [
|
|
14693
|
+
value,
|
|
14694
|
+
"\xD7"
|
|
14695
|
+
]
|
|
14696
|
+
},
|
|
14697
|
+
value
|
|
14698
|
+
))
|
|
14699
|
+
] })
|
|
14700
|
+
] });
|
|
14701
|
+
}
|
|
14702
|
+
|
|
14614
14703
|
export {
|
|
14615
14704
|
useAgentSession,
|
|
14616
14705
|
useReplay,
|
|
14617
14706
|
ReplayBar,
|
|
14618
14707
|
ReplayMismatchPrompt,
|
|
14708
|
+
UserMessageText,
|
|
14619
14709
|
isQueuePanelVisible,
|
|
14620
14710
|
SessionQueuePanel,
|
|
14621
14711
|
ConnectionBanner,
|
|
@@ -14760,7 +14850,8 @@ export {
|
|
|
14760
14850
|
ChatView,
|
|
14761
14851
|
useTopicAssetSubmissionAccess,
|
|
14762
14852
|
TopicAssetSubmitDialog,
|
|
14763
|
-
useCapabilities
|
|
14853
|
+
useCapabilities,
|
|
14854
|
+
CaseDemoPlayer
|
|
14764
14855
|
};
|
|
14765
14856
|
/*! Bundled license information:
|
|
14766
14857
|
|
|
@@ -14771,4 +14862,4 @@ use-stick-to-bottom/dist/StickToBottom.js:
|
|
|
14771
14862
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
14772
14863
|
*--------------------------------------------------------------------------------------------*)
|
|
14773
14864
|
*/
|
|
14774
|
-
//# sourceMappingURL=chunk-
|
|
14865
|
+
//# sourceMappingURL=chunk-ND476ANG.js.map
|