@blade-hq/agent-react 2610.0.0-beta.25 → 2610.0.0-beta.27
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 +1 -1
- package/dist/components/AskUserQuestionBlock.d.ts +9 -0
- package/dist/components/ToolCallBlock.d.ts +4 -2
- package/dist/index.js +264 -252
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public-api.md +1 -0
package/dist/index.js
CHANGED
|
@@ -1859,16 +1859,6 @@ var TOOL_DISPLAY_LABELS = {
|
|
|
1859
1859
|
ListSessions: "\u5217\u51FA\u5386\u53F2\u4F1A\u8BDD",
|
|
1860
1860
|
GetSessionHistory: "\u8BFB\u53D6\u4F1A\u8BDD\u5386\u53F2"
|
|
1861
1861
|
};
|
|
1862
|
-
var PRIORITY_FILE_KEYS = [
|
|
1863
|
-
"file_path",
|
|
1864
|
-
"output_file",
|
|
1865
|
-
"output_path",
|
|
1866
|
-
"path",
|
|
1867
|
-
"filepath",
|
|
1868
|
-
"target_file",
|
|
1869
|
-
"destination",
|
|
1870
|
-
"filename"
|
|
1871
|
-
];
|
|
1872
1862
|
function safeParseJson(value) {
|
|
1873
1863
|
if (!value) return null;
|
|
1874
1864
|
try {
|
|
@@ -1877,38 +1867,6 @@ function safeParseJson(value) {
|
|
|
1877
1867
|
return null;
|
|
1878
1868
|
}
|
|
1879
1869
|
}
|
|
1880
|
-
function isPlainObject(value) {
|
|
1881
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
1882
|
-
}
|
|
1883
|
-
function findFileLikeValue(value, depth = 0, allowPlainString = false) {
|
|
1884
|
-
if (depth > 3) return null;
|
|
1885
|
-
if (typeof value === "string") {
|
|
1886
|
-
const trimmed = value.trim();
|
|
1887
|
-
if (!trimmed) return null;
|
|
1888
|
-
if (allowPlainString || trimmed.includes("/") || /\.[a-z0-9]{1,8}$/i.test(trimmed)) {
|
|
1889
|
-
return trimmed;
|
|
1890
|
-
}
|
|
1891
|
-
return null;
|
|
1892
|
-
}
|
|
1893
|
-
if (Array.isArray(value)) {
|
|
1894
|
-
for (const item of value) {
|
|
1895
|
-
const found = findFileLikeValue(item, depth + 1, allowPlainString);
|
|
1896
|
-
if (found) return found;
|
|
1897
|
-
}
|
|
1898
|
-
return null;
|
|
1899
|
-
}
|
|
1900
|
-
if (isPlainObject(value)) {
|
|
1901
|
-
for (const key of PRIORITY_FILE_KEYS) {
|
|
1902
|
-
const direct = findFileLikeValue(value[key], depth + 1, true);
|
|
1903
|
-
if (direct) return direct;
|
|
1904
|
-
}
|
|
1905
|
-
for (const nested of Object.values(value)) {
|
|
1906
|
-
const found = findFileLikeValue(nested, depth + 1, allowPlainString);
|
|
1907
|
-
if (found) return found;
|
|
1908
|
-
}
|
|
1909
|
-
}
|
|
1910
|
-
return null;
|
|
1911
|
-
}
|
|
1912
1870
|
function getStringArgValue(args, key) {
|
|
1913
1871
|
const value = args?.[key];
|
|
1914
1872
|
return typeof value === "string" ? value.trim() : "";
|
|
@@ -1931,15 +1889,6 @@ function formatToolName(name) {
|
|
|
1931
1889
|
const normalized = stripped.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
1932
1890
|
return TOOL_NAME_ALIASES[normalized] ?? stripped;
|
|
1933
1891
|
}
|
|
1934
|
-
function extractToolFilePath(toolCall) {
|
|
1935
|
-
const formattedName = formatToolName(toolCall.name);
|
|
1936
|
-
if (formattedName !== "Read" && formattedName !== "Write" && formattedName !== "Edit" && formattedName !== "MultiEdit") {
|
|
1937
|
-
return null;
|
|
1938
|
-
}
|
|
1939
|
-
const filePath = findFileLikeValue(safeParseJson(toolCall.arguments));
|
|
1940
|
-
if (!filePath || filePath.split("/").pop()?.toLowerCase() === "phase.json") return null;
|
|
1941
|
-
return filePath;
|
|
1942
|
-
}
|
|
1943
1892
|
function getToolDisplayLabel(toolCall) {
|
|
1944
1893
|
const normalized = formatToolName(toolCall.name);
|
|
1945
1894
|
const args = safeParseJson(toolCall.arguments);
|
|
@@ -2541,6 +2490,26 @@ function parseAskUserQuestion(toolResult) {
|
|
|
2541
2490
|
}
|
|
2542
2491
|
return null;
|
|
2543
2492
|
}
|
|
2493
|
+
function parseAskUserQuestionError(toolResult) {
|
|
2494
|
+
if (!toolResult) return null;
|
|
2495
|
+
try {
|
|
2496
|
+
const parsed = JSON.parse(toolResult);
|
|
2497
|
+
let detail = null;
|
|
2498
|
+
if (typeof parsed.error === "string") detail = parsed.error;
|
|
2499
|
+
if (parsed.error && typeof parsed.error === "object") {
|
|
2500
|
+
const message = parsed.error.message;
|
|
2501
|
+
if (typeof message === "string") detail = message;
|
|
2502
|
+
}
|
|
2503
|
+
if (!detail && typeof parsed.message === "string") detail = parsed.message;
|
|
2504
|
+
if (!detail) return null;
|
|
2505
|
+
return {
|
|
2506
|
+
message: parsed.error_code === "invalid_questions" ? "\u63D0\u95EE\u5185\u5BB9\u4E0D\u5B8C\u6574\uFF0C\u5F53\u524D\u6CA1\u6709\u7B49\u5F85\u4F60\u56DE\u7B54\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002" : "\u8FD9\u6B21\u63D0\u95EE\u6CA1\u6709\u6210\u529F\uFF0C\u5F53\u524D\u6CA1\u6709\u7B49\u5F85\u4F60\u56DE\u7B54\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002",
|
|
2507
|
+
detail
|
|
2508
|
+
};
|
|
2509
|
+
} catch {
|
|
2510
|
+
return null;
|
|
2511
|
+
}
|
|
2512
|
+
}
|
|
2544
2513
|
function normalizeQuestionItem(value) {
|
|
2545
2514
|
if (!value || typeof value !== "object") return null;
|
|
2546
2515
|
const item = value;
|
|
@@ -2569,9 +2538,10 @@ import { Fragment, jsx as jsx10, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
|
2569
2538
|
function resolveAskQuestionState({
|
|
2570
2539
|
toolStatus,
|
|
2571
2540
|
hasAnswerData,
|
|
2572
|
-
fallbackAnswered
|
|
2541
|
+
fallbackAnswered,
|
|
2542
|
+
fallbackAwaiting
|
|
2573
2543
|
}) {
|
|
2574
|
-
const awaitingAnswer = !hasAnswerData && toolStatus === "awaiting_answer";
|
|
2544
|
+
const awaitingAnswer = !hasAnswerData && (toolStatus === "awaiting_answer" || toolStatus === "pending" && fallbackAwaiting === true);
|
|
2575
2545
|
return {
|
|
2576
2546
|
awaitingAnswer,
|
|
2577
2547
|
answered: hasAnswerData || !awaitingAnswer && (Boolean(fallbackAnswered) || toolStatus === "done" || toolStatus === "cancelled" || toolStatus === "error")
|
|
@@ -2583,6 +2553,7 @@ function ToolCallBlock({
|
|
|
2583
2553
|
answered,
|
|
2584
2554
|
answerData,
|
|
2585
2555
|
sessionStatus,
|
|
2556
|
+
isActiveQuestion,
|
|
2586
2557
|
renderer
|
|
2587
2558
|
}) {
|
|
2588
2559
|
const [expanded, setExpanded] = useState9(false);
|
|
@@ -2598,7 +2569,8 @@ function ToolCallBlock({
|
|
|
2598
2569
|
const questionState = resolveAskQuestionState({
|
|
2599
2570
|
toolStatus: toolCall.status,
|
|
2600
2571
|
hasAnswerData: Boolean(answerData),
|
|
2601
|
-
fallbackAnswered: answered
|
|
2572
|
+
fallbackAnswered: answered,
|
|
2573
|
+
fallbackAwaiting: isActiveQuestion === true && (sessionStatus === "paused" || sessionStatus === "waiting_for_input")
|
|
2602
2574
|
});
|
|
2603
2575
|
const canAnswer = questionState.awaitingAnswer && Boolean(onAnswer);
|
|
2604
2576
|
if (askData) {
|
|
@@ -2620,9 +2592,16 @@ function ToolCallBlock({
|
|
|
2620
2592
|
/* @__PURE__ */ jsx10("span", { children: "\u6B63\u5728\u51C6\u5907\u95EE\u9898\u2026" })
|
|
2621
2593
|
] });
|
|
2622
2594
|
}
|
|
2595
|
+
const errorDetail = parseAskUserQuestionError(
|
|
2596
|
+
typeof toolCall.result === "string" ? toolCall.result : null
|
|
2597
|
+
);
|
|
2623
2598
|
return /* @__PURE__ */ jsxs8("div", { className: "ml-4 max-w-lg rounded-xl border border-amber-500/35 bg-amber-500/10 p-4 text-sm text-[hsl(var(--foreground))]", children: [
|
|
2624
2599
|
/* @__PURE__ */ jsx10("div", { className: "font-semibold", children: "\u9009\u62E9\u9898\u5185\u5BB9\u6682\u65F6\u65E0\u6CD5\u663E\u793A" }),
|
|
2625
|
-
/* @__PURE__ */ jsx10("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: "\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002" })
|
|
2600
|
+
/* @__PURE__ */ jsx10("div", { className: "mt-1 text-xs leading-5 text-[hsl(var(--muted-foreground))]", children: errorDetail?.message ?? "\u6536\u5230\u7684\u4EA4\u4E92\u6570\u636E\u4E0D\u5B8C\u6574\u3002\u8BF7\u8BA9\u667A\u80FD\u4F53\u91CD\u65B0\u63D0\u95EE\u3002" }),
|
|
2601
|
+
errorDetail?.detail ? /* @__PURE__ */ jsxs8("details", { className: "mt-2 text-xs text-[hsl(var(--muted-foreground))]", children: [
|
|
2602
|
+
/* @__PURE__ */ jsx10("summary", { className: "cursor-pointer", children: "\u67E5\u770B\u5177\u4F53\u539F\u56E0" }),
|
|
2603
|
+
/* @__PURE__ */ jsx10("div", { className: "mt-1 break-words font-mono", children: errorDetail.detail })
|
|
2604
|
+
] }) : null
|
|
2626
2605
|
] });
|
|
2627
2606
|
}
|
|
2628
2607
|
const tone = getToolTone(toolCall.status);
|
|
@@ -2810,11 +2789,70 @@ function executionSummaryLabel({
|
|
|
2810
2789
|
}
|
|
2811
2790
|
return completedLabel;
|
|
2812
2791
|
}
|
|
2792
|
+
function businessToolDisplayName(toolCall) {
|
|
2793
|
+
const displayName = toolCall.display_name?.trim() ?? "";
|
|
2794
|
+
if (!displayName) return "";
|
|
2795
|
+
const rawName = toolCall.name.trim();
|
|
2796
|
+
return displayName !== rawName && formatToolName(displayName) !== formatToolName(rawName) ? displayName : "";
|
|
2797
|
+
}
|
|
2798
|
+
function executionToolTypeLabel(toolCall) {
|
|
2799
|
+
switch (formatToolName(toolCall.name)) {
|
|
2800
|
+
case "WebSearch":
|
|
2801
|
+
case "WebFetch":
|
|
2802
|
+
return "\u7F51\u7EDC\u68C0\u7D22";
|
|
2803
|
+
case "Bash":
|
|
2804
|
+
case "BgBash":
|
|
2805
|
+
return "\u547D\u4EE4\u6267\u884C";
|
|
2806
|
+
case "Read":
|
|
2807
|
+
case "ReadSkill":
|
|
2808
|
+
return "\u5185\u5BB9\u8BFB\u53D6";
|
|
2809
|
+
case "Write":
|
|
2810
|
+
case "Edit":
|
|
2811
|
+
case "MultiEdit":
|
|
2812
|
+
return "\u6587\u4EF6\u5904\u7406";
|
|
2813
|
+
case "Grep":
|
|
2814
|
+
case "Glob":
|
|
2815
|
+
return "\u5185\u5BB9\u641C\u7D22";
|
|
2816
|
+
case "Agent":
|
|
2817
|
+
return "\u5B50\u4EFB\u52A1";
|
|
2818
|
+
case "search_skills":
|
|
2819
|
+
return "\u6280\u80FD\u68C0\u7D22";
|
|
2820
|
+
case "get_skill_content":
|
|
2821
|
+
return "\u8BFB\u53D6\u6280\u80FD";
|
|
2822
|
+
case "run_skill_tool":
|
|
2823
|
+
return "\u6267\u884C\u6280\u80FD";
|
|
2824
|
+
default:
|
|
2825
|
+
return businessToolDisplayName(toolCall) || "\u6267\u884C\u6B65\u9AA4";
|
|
2826
|
+
}
|
|
2827
|
+
}
|
|
2828
|
+
function executionToolIntent(toolCall) {
|
|
2829
|
+
const normalizedName = formatToolName(toolCall.name);
|
|
2830
|
+
let args = null;
|
|
2831
|
+
try {
|
|
2832
|
+
const parsed = JSON.parse(toolCall.arguments);
|
|
2833
|
+
args = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
2834
|
+
} catch {
|
|
2835
|
+
args = null;
|
|
2836
|
+
}
|
|
2837
|
+
const getString = (key) => {
|
|
2838
|
+
const value = args?.[key];
|
|
2839
|
+
return typeof value === "string" ? value.trim() : "";
|
|
2840
|
+
};
|
|
2841
|
+
const explicitIntent = getString("description") || getString("_meta_display_name") || getString("display_name") || "";
|
|
2842
|
+
if (explicitIntent) return explicitIntent;
|
|
2843
|
+
if (normalizedName === "search_skills") return getString("query");
|
|
2844
|
+
if (normalizedName === "get_skill_content" || normalizedName === "ReadSkill") {
|
|
2845
|
+
return getString("skill_name") || getString("skill");
|
|
2846
|
+
}
|
|
2847
|
+
if (normalizedName === "FinishTask") return getString("title");
|
|
2848
|
+
return "";
|
|
2849
|
+
}
|
|
2813
2850
|
function ExecutionToolRow({ toolCall }) {
|
|
2814
2851
|
const normalizedName = formatToolName(toolCall.name);
|
|
2852
|
+
const typeLabel = executionToolTypeLabel(toolCall);
|
|
2853
|
+
const intent = executionToolIntent(toolCall);
|
|
2854
|
+
const label = intent ? `${typeLabel}\uFF1A${intent}` : typeLabel;
|
|
2815
2855
|
const failed = toolCall.status === "error" || toolCall.status === "cancelled";
|
|
2816
|
-
const filePath = toolCall.status === "done" && (normalizedName === "Write" || normalizedName === "Edit" || normalizedName === "MultiEdit") ? extractToolFilePath(toolCall) : null;
|
|
2817
|
-
const [fileOpen, setFileOpen] = useState10(false);
|
|
2818
2856
|
const iconClass = cn(
|
|
2819
2857
|
"size-3.5 shrink-0",
|
|
2820
2858
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
@@ -2824,25 +2862,9 @@ function ExecutionToolRow({ toolCall }) {
|
|
|
2824
2862
|
"flex min-w-0 items-center gap-1 py-1.5 text-xs leading-[22px]",
|
|
2825
2863
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
2826
2864
|
);
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
return /* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
|
|
2831
|
-
/* @__PURE__ */ jsxs9(
|
|
2832
|
-
"button",
|
|
2833
|
-
{
|
|
2834
|
-
type: "button",
|
|
2835
|
-
"data-testid": "execution-tool-intent",
|
|
2836
|
-
className: cn(rowClassName, "w-full text-left"),
|
|
2837
|
-
"aria-expanded": fileOpen,
|
|
2838
|
-
onClick: () => setFileOpen((open) => !open),
|
|
2839
|
-
children: [
|
|
2840
|
-
icon,
|
|
2841
|
-
/* @__PURE__ */ jsx11(ChevronRight, { size: 14, className: cn("shrink-0 transition-transform", fileOpen && "rotate-90"), "aria-hidden": "true" })
|
|
2842
|
-
]
|
|
2843
|
-
}
|
|
2844
|
-
),
|
|
2845
|
-
fileOpen ? /* @__PURE__ */ jsx11("div", { className: "ml-[18px] truncate text-xs leading-[22px] text-[hsl(var(--muted-foreground))]", title: filePath, children: filePath }) : null
|
|
2865
|
+
return /* @__PURE__ */ jsxs9("div", { "data-testid": "execution-tool-intent", className: rowClassName, title: label, children: [
|
|
2866
|
+
icon,
|
|
2867
|
+
/* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate", children: label })
|
|
2846
2868
|
] });
|
|
2847
2869
|
}
|
|
2848
2870
|
function AssistantTurnBlock({
|
|
@@ -2873,6 +2895,7 @@ function AssistantTurnBlock({
|
|
|
2873
2895
|
(toolCall) => formatToolName(toolCall.name) === "AskUserQuestion"
|
|
2874
2896
|
)
|
|
2875
2897
|
);
|
|
2898
|
+
const activeQuestionId = questionToolCalls.filter((toolCall) => toolCall.status === "pending").at(-1)?.id;
|
|
2876
2899
|
const [displayMode, setDisplayMode] = useState10(
|
|
2877
2900
|
() => isStreaming || hasActionableToolCall ? "detail" : "compact"
|
|
2878
2901
|
);
|
|
@@ -3029,6 +3052,7 @@ function AssistantTurnBlock({
|
|
|
3029
3052
|
onAnswer,
|
|
3030
3053
|
answered: sessionStatus !== "waiting_for_input",
|
|
3031
3054
|
sessionStatus,
|
|
3055
|
+
isActiveQuestion: toolCall.id === activeQuestionId,
|
|
3032
3056
|
renderer: toolCallRenderer
|
|
3033
3057
|
},
|
|
3034
3058
|
toolCall.id
|
|
@@ -3100,49 +3124,9 @@ function AssistantMessageContent({
|
|
|
3100
3124
|
] });
|
|
3101
3125
|
}
|
|
3102
3126
|
|
|
3103
|
-
// src/components/ContextCard.tsx
|
|
3104
|
-
import {
|
|
3105
|
-
getContextDisplayState
|
|
3106
|
-
} from "@blade-hq/agent-client";
|
|
3107
|
-
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3108
|
-
function ContextCard({ context, className }) {
|
|
3109
|
-
const display = getContextDisplayState(context);
|
|
3110
|
-
return /* @__PURE__ */ jsxs10(
|
|
3111
|
-
"details",
|
|
3112
|
-
{
|
|
3113
|
-
className: `blade-chat-context-card group rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`,
|
|
3114
|
-
children: [
|
|
3115
|
-
/* @__PURE__ */ jsxs10("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: [
|
|
3116
|
-
/* @__PURE__ */ jsx12(
|
|
3117
|
-
Layers,
|
|
3118
|
-
{
|
|
3119
|
-
size: 15,
|
|
3120
|
-
className: "blade-chat-context-icon shrink-0 text-[hsl(var(--muted-foreground))]",
|
|
3121
|
-
"aria-hidden": "true"
|
|
3122
|
-
}
|
|
3123
|
-
),
|
|
3124
|
-
/* @__PURE__ */ jsxs10("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
3125
|
-
/* @__PURE__ */ jsx12("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: display.title }),
|
|
3126
|
-
/* @__PURE__ */ jsx12("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: display.summary })
|
|
3127
|
-
] }),
|
|
3128
|
-
/* @__PURE__ */ jsx12(
|
|
3129
|
-
ChevronDown,
|
|
3130
|
-
{
|
|
3131
|
-
size: 14,
|
|
3132
|
-
className: "blade-chat-context-chevron shrink-0 text-[hsl(var(--muted-foreground))] transition-transform group-open:rotate-180",
|
|
3133
|
-
"aria-hidden": "true"
|
|
3134
|
-
}
|
|
3135
|
-
)
|
|
3136
|
-
] }),
|
|
3137
|
-
/* @__PURE__ */ jsx12("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 })
|
|
3138
|
-
]
|
|
3139
|
-
}
|
|
3140
|
-
);
|
|
3141
|
-
}
|
|
3142
|
-
|
|
3143
3127
|
// src/components/RenderErrorBoundary.tsx
|
|
3144
3128
|
import { Component } from "react";
|
|
3145
|
-
import { jsx as
|
|
3129
|
+
import { jsx as jsx12, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
3146
3130
|
function getFirstComponentName(componentStack) {
|
|
3147
3131
|
const match = componentStack.match(/\n\s+at\s+([^\s(]+)/);
|
|
3148
3132
|
return match?.[1] ?? null;
|
|
@@ -3175,18 +3159,18 @@ var RenderErrorBoundary = class extends Component {
|
|
|
3175
3159
|
return children;
|
|
3176
3160
|
}
|
|
3177
3161
|
const componentName = getFirstComponentName(componentStack);
|
|
3178
|
-
return /* @__PURE__ */
|
|
3179
|
-
/* @__PURE__ */
|
|
3180
|
-
/* @__PURE__ */
|
|
3181
|
-
/* @__PURE__ */
|
|
3162
|
+
return /* @__PURE__ */ jsx12("div", { className: "blade-chat-render-error rounded-xl border border-amber-500/30 bg-amber-500/8 px-4 py-3 text-sm text-amber-100", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-start gap-2", children: [
|
|
3163
|
+
/* @__PURE__ */ jsx12(TriangleAlert, { className: "mt-0.5 h-4 w-4 shrink-0 text-amber-300" }),
|
|
3164
|
+
/* @__PURE__ */ jsxs10("div", { className: "min-w-0 flex-1", children: [
|
|
3165
|
+
/* @__PURE__ */ jsxs10("div", { className: "font-medium", children: [
|
|
3182
3166
|
label,
|
|
3183
3167
|
"\u6E32\u67D3\u5931\u8D25"
|
|
3184
3168
|
] }),
|
|
3185
|
-
/* @__PURE__ */
|
|
3169
|
+
/* @__PURE__ */ jsxs10("div", { className: "mt-1 break-words text-xs leading-5 text-amber-100/75", children: [
|
|
3186
3170
|
componentName ? `\u7EC4\u4EF6\uFF1A${componentName}\u3002` : null,
|
|
3187
3171
|
error.message || "\u53D1\u751F\u4E86\u672A\u9884\u671F\u7684\u6E32\u67D3\u9519\u8BEF\u3002"
|
|
3188
3172
|
] }),
|
|
3189
|
-
details ? /* @__PURE__ */
|
|
3173
|
+
details ? /* @__PURE__ */ jsx12("div", { className: "mt-1 truncate text-xs text-amber-100/55", children: details }) : null
|
|
3190
3174
|
] })
|
|
3191
3175
|
] }) });
|
|
3192
3176
|
}
|
|
@@ -3194,7 +3178,7 @@ var RenderErrorBoundary = class extends Component {
|
|
|
3194
3178
|
|
|
3195
3179
|
// src/components/PostChatFollowupBlock.tsx
|
|
3196
3180
|
import { useCallback as useCallback6, useEffect as useEffect9, useRef as useRef10, useState as useState11 } from "react";
|
|
3197
|
-
import { Fragment as Fragment2, jsx as
|
|
3181
|
+
import { Fragment as Fragment2, jsx as jsx13, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
3198
3182
|
function emitInteraction(callback, event) {
|
|
3199
3183
|
try {
|
|
3200
3184
|
callback?.(event);
|
|
@@ -3216,7 +3200,7 @@ function ArtifactCard({
|
|
|
3216
3200
|
const [downloading, setDownloading] = useState11(false);
|
|
3217
3201
|
const name = artifact.label || basename(artifact.target);
|
|
3218
3202
|
if (artifact.kind === "link") {
|
|
3219
|
-
return /* @__PURE__ */
|
|
3203
|
+
return /* @__PURE__ */ jsxs11(
|
|
3220
3204
|
"a",
|
|
3221
3205
|
{
|
|
3222
3206
|
href: artifact.target,
|
|
@@ -3227,9 +3211,9 @@ function ArtifactCard({
|
|
|
3227
3211
|
${artifact.target}`,
|
|
3228
3212
|
className: "group relative flex min-w-0 items-center gap-1.5 rounded-md border border-[hsl(var(--border))] bg-[hsl(var(--card))] px-2 py-1.5 text-xs text-[hsl(var(--card-foreground))] hover:bg-[hsl(var(--accent))]",
|
|
3229
3213
|
children: [
|
|
3230
|
-
/* @__PURE__ */
|
|
3231
|
-
/* @__PURE__ */
|
|
3232
|
-
/* @__PURE__ */
|
|
3214
|
+
/* @__PURE__ */ jsx13(Globe, { size: 15, className: "shrink-0 text-[hsl(var(--primary))]" }),
|
|
3215
|
+
/* @__PURE__ */ jsx13("span", { className: "min-w-0 flex-1 truncate font-medium", children: name }),
|
|
3216
|
+
/* @__PURE__ */ jsx13(ArrowUpRight, { size: 13, className: "absolute right-2 opacity-0 group-hover:opacity-100 group-focus-visible:opacity-100" })
|
|
3233
3217
|
]
|
|
3234
3218
|
}
|
|
3235
3219
|
);
|
|
@@ -3264,7 +3248,7 @@ ${artifact.target}`,
|
|
|
3264
3248
|
setDownloading(false);
|
|
3265
3249
|
}
|
|
3266
3250
|
};
|
|
3267
|
-
return /* @__PURE__ */
|
|
3251
|
+
return /* @__PURE__ */ jsx13(
|
|
3268
3252
|
"a",
|
|
3269
3253
|
{
|
|
3270
3254
|
href: downloadUrl,
|
|
@@ -3292,17 +3276,17 @@ function feedbackReasonLabel(reason) {
|
|
|
3292
3276
|
}
|
|
3293
3277
|
function HistoricalResultFeedback({ feedback }) {
|
|
3294
3278
|
const label = feedbackReasonLabel(feedback.reason);
|
|
3295
|
-
return /* @__PURE__ */
|
|
3279
|
+
return /* @__PURE__ */ jsxs11(
|
|
3296
3280
|
"section",
|
|
3297
3281
|
{
|
|
3298
3282
|
"aria-label": "\u5386\u53F2\u7ED3\u679C\u53CD\u9988",
|
|
3299
3283
|
className: "mt-3 w-fit max-w-full rounded-lg border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.2)] px-3 py-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
3300
3284
|
children: [
|
|
3301
|
-
/* @__PURE__ */
|
|
3285
|
+
/* @__PURE__ */ jsxs11("span", { children: [
|
|
3302
3286
|
"\u4F60\u5BF9\u6B64\u8F6E\u7ED3\u679C\u7684\u8BC4\u4EF7\uFF1A",
|
|
3303
3287
|
feedback.helpful ? "\u6709\u5E2E\u52A9" : "\u6CA1\u5E2E\u52A9"
|
|
3304
3288
|
] }),
|
|
3305
|
-
label ? /* @__PURE__ */
|
|
3289
|
+
label ? /* @__PURE__ */ jsxs11("span", { children: [
|
|
3306
3290
|
" \xB7 ",
|
|
3307
3291
|
label
|
|
3308
3292
|
] }) : null
|
|
@@ -3377,15 +3361,15 @@ function ResultFeedback({
|
|
|
3377
3361
|
[client, followup.assistant_entry_id, onFeedbackSaved, onInteraction, sessionId]
|
|
3378
3362
|
);
|
|
3379
3363
|
if (!eligible) return null;
|
|
3380
|
-
return /* @__PURE__ */
|
|
3364
|
+
return /* @__PURE__ */ jsxs11(
|
|
3381
3365
|
"section",
|
|
3382
3366
|
{
|
|
3383
3367
|
"aria-label": "\u7ED3\u679C\u53CD\u9988",
|
|
3384
3368
|
className: "flex flex-col gap-2 border-t border-[hsl(var(--border))] pt-3",
|
|
3385
3369
|
children: [
|
|
3386
|
-
/* @__PURE__ */
|
|
3387
|
-
/* @__PURE__ */
|
|
3388
|
-
/* @__PURE__ */
|
|
3370
|
+
/* @__PURE__ */ jsx13("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u76EE\u524D\u7684\u6574\u4F53\u7ED3\u679C\u6709\u5E2E\u52A9\u5417\uFF1F" }),
|
|
3371
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-wrap gap-1.5", children: [
|
|
3372
|
+
/* @__PURE__ */ jsx13(
|
|
3389
3373
|
"button",
|
|
3390
3374
|
{
|
|
3391
3375
|
type: "button",
|
|
@@ -3396,7 +3380,7 @@ function ResultFeedback({
|
|
|
3396
3380
|
children: "\u6709\u5E2E\u52A9"
|
|
3397
3381
|
}
|
|
3398
3382
|
),
|
|
3399
|
-
/* @__PURE__ */
|
|
3383
|
+
/* @__PURE__ */ jsx13(
|
|
3400
3384
|
"button",
|
|
3401
3385
|
{
|
|
3402
3386
|
type: "button",
|
|
@@ -3408,7 +3392,7 @@ function ResultFeedback({
|
|
|
3408
3392
|
}
|
|
3409
3393
|
)
|
|
3410
3394
|
] }),
|
|
3411
|
-
helpful === false ? /* @__PURE__ */
|
|
3395
|
+
helpful === false ? /* @__PURE__ */ jsx13("div", { className: "flex flex-wrap gap-1.5", "aria-label": "\u6CA1\u5E2E\u52A9\u7684\u4E3B\u8981\u539F\u56E0", children: FEEDBACK_REASONS.map((item) => /* @__PURE__ */ jsx13(
|
|
3412
3396
|
"button",
|
|
3413
3397
|
{
|
|
3414
3398
|
type: "button",
|
|
@@ -3420,9 +3404,9 @@ function ResultFeedback({
|
|
|
3420
3404
|
},
|
|
3421
3405
|
item.value
|
|
3422
3406
|
)) }) : null,
|
|
3423
|
-
saveError ? /* @__PURE__ */
|
|
3424
|
-
/* @__PURE__ */
|
|
3425
|
-
/* @__PURE__ */
|
|
3407
|
+
saveError ? /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 text-xs text-[hsl(var(--destructive))]", children: [
|
|
3408
|
+
/* @__PURE__ */ jsx13("span", { children: "\u53CD\u9988\u6682\u672A\u4FDD\u5B58\uFF0C\u53EF\u91CD\u8BD5" }),
|
|
3409
|
+
/* @__PURE__ */ jsx13(
|
|
3426
3410
|
"button",
|
|
3427
3411
|
{
|
|
3428
3412
|
type: "button",
|
|
@@ -3434,7 +3418,7 @@ function ResultFeedback({
|
|
|
3434
3418
|
children: "\u91CD\u8BD5"
|
|
3435
3419
|
}
|
|
3436
3420
|
)
|
|
3437
|
-
] }) : saved ? /* @__PURE__ */
|
|
3421
|
+
] }) : saved ? /* @__PURE__ */ jsx13("div", { className: "text-[11px] text-[hsl(var(--muted-foreground))]", children: "\u5DF2\u4FDD\u5B58\uFF0C\u53EF\u968F\u65F6\u4FEE\u6539" }) : null
|
|
3438
3422
|
]
|
|
3439
3423
|
}
|
|
3440
3424
|
);
|
|
@@ -3501,15 +3485,15 @@ function PostChatFollowupBlock({
|
|
|
3501
3485
|
);
|
|
3502
3486
|
if (!followup.recaption && artifacts.length === 0 && followup.suggestions.length === 0 && !followup.feedback_eligible)
|
|
3503
3487
|
return null;
|
|
3504
|
-
return /* @__PURE__ */
|
|
3505
|
-
followup.recaption || artifacts.length > 0 ? /* @__PURE__ */
|
|
3506
|
-
/* @__PURE__ */
|
|
3507
|
-
/* @__PURE__ */
|
|
3488
|
+
return /* @__PURE__ */ jsxs11("div", { className: "mt-3 flex w-fit max-w-full flex-col gap-3 rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--muted)/0.28)] p-3 sm:max-w-[680px]", children: [
|
|
3489
|
+
followup.recaption || artifacts.length > 0 ? /* @__PURE__ */ jsxs11("section", { "aria-label": "\u672C\u8F6E\u5C0F\u7ED3", className: "flex flex-col gap-2", children: [
|
|
3490
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1.5 text-xs font-medium text-[hsl(var(--muted-foreground))]", children: [
|
|
3491
|
+
/* @__PURE__ */ jsx13(Sparkles, { size: 14 }),
|
|
3508
3492
|
"\u672C\u8F6E\u5C0F\u7ED3"
|
|
3509
3493
|
] }),
|
|
3510
|
-
followup.recaption ? /* @__PURE__ */
|
|
3511
|
-
artifacts.length > 0 ? /* @__PURE__ */
|
|
3512
|
-
/* @__PURE__ */
|
|
3494
|
+
followup.recaption ? /* @__PURE__ */ jsx13("p", { className: "text-[13px] leading-5", children: followup.recaption }) : null,
|
|
3495
|
+
artifacts.length > 0 ? /* @__PURE__ */ jsxs11(Fragment2, { children: [
|
|
3496
|
+
/* @__PURE__ */ jsx13("div", { className: "grid max-w-full grid-cols-3 gap-1.5", children: visibleArtifacts.map((artifact, artifactIndex) => /* @__PURE__ */ jsx13(
|
|
3513
3497
|
ArtifactCard,
|
|
3514
3498
|
{
|
|
3515
3499
|
artifact,
|
|
@@ -3521,7 +3505,7 @@ function PostChatFollowupBlock({
|
|
|
3521
3505
|
},
|
|
3522
3506
|
`${artifact.kind}:${artifactIndex}`
|
|
3523
3507
|
)) }),
|
|
3524
|
-
artifacts.length > 3 ? /* @__PURE__ */
|
|
3508
|
+
artifacts.length > 3 ? /* @__PURE__ */ jsxs11(
|
|
3525
3509
|
"button",
|
|
3526
3510
|
{
|
|
3527
3511
|
type: "button",
|
|
@@ -3530,15 +3514,15 @@ function PostChatFollowupBlock({
|
|
|
3530
3514
|
className: "flex w-fit items-center gap-0.5 text-[11px] text-[hsl(var(--muted-foreground))]",
|
|
3531
3515
|
children: [
|
|
3532
3516
|
expanded ? "\u6536\u8D77" : `\u5C55\u5F00 ${artifacts.length - 3} \u4E2A`,
|
|
3533
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsx13(ChevronDown, { size: 13, className: expanded ? "rotate-180" : void 0 })
|
|
3534
3518
|
]
|
|
3535
3519
|
}
|
|
3536
3520
|
) : null
|
|
3537
3521
|
] }) : null
|
|
3538
3522
|
] }) : null,
|
|
3539
|
-
followup.suggestions.length > 0 ? /* @__PURE__ */
|
|
3540
|
-
/* @__PURE__ */
|
|
3541
|
-
followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */
|
|
3523
|
+
followup.suggestions.length > 0 ? /* @__PURE__ */ jsxs11("section", { "aria-label": "\u4E0B\u4E00\u6B65\u5EFA\u8BAE", className: "flex flex-col gap-1.5", children: [
|
|
3524
|
+
/* @__PURE__ */ jsx13("div", { className: "text-xs font-medium text-[hsl(var(--muted-foreground))]", children: "\u4E0B\u4E00\u6B65\u53EF\u4EE5" }),
|
|
3525
|
+
followup.suggestions.map((suggestion, suggestionIndex) => /* @__PURE__ */ jsxs11(
|
|
3542
3526
|
"button",
|
|
3543
3527
|
{
|
|
3544
3528
|
type: "button",
|
|
@@ -3557,14 +3541,14 @@ function PostChatFollowupBlock({
|
|
|
3557
3541
|
},
|
|
3558
3542
|
className: "group flex items-center gap-2 rounded-xl bg-[hsl(var(--muted)/0.62)] px-3 py-2 text-left text-[13px] disabled:cursor-default disabled:opacity-60",
|
|
3559
3543
|
children: [
|
|
3560
|
-
/* @__PURE__ */
|
|
3561
|
-
/* @__PURE__ */
|
|
3544
|
+
/* @__PURE__ */ jsx13("span", { children: suggestion }),
|
|
3545
|
+
/* @__PURE__ */ jsx13(ArrowRight, { size: 14, className: "ml-auto shrink-0" })
|
|
3562
3546
|
]
|
|
3563
3547
|
},
|
|
3564
3548
|
suggestion
|
|
3565
3549
|
))
|
|
3566
3550
|
] }) : null,
|
|
3567
|
-
/* @__PURE__ */
|
|
3551
|
+
/* @__PURE__ */ jsx13(
|
|
3568
3552
|
ResultFeedback,
|
|
3569
3553
|
{
|
|
3570
3554
|
followup,
|
|
@@ -3580,7 +3564,7 @@ function PostChatFollowupBlock({
|
|
|
3580
3564
|
|
|
3581
3565
|
// src/components/UserMessageBubble.tsx
|
|
3582
3566
|
import { getFileParts as getFileParts2, getImageParts as getImageParts2, getTextContent as getTextContent2 } from "@blade-hq/agent-client";
|
|
3583
|
-
import { jsx as
|
|
3567
|
+
import { jsx as jsx14, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3584
3568
|
function isUserMessage(message) {
|
|
3585
3569
|
return message.role === "user";
|
|
3586
3570
|
}
|
|
@@ -3592,8 +3576,8 @@ function UserMessageBubble({ message, className }) {
|
|
|
3592
3576
|
const text = getTextContent2(message.content).trim();
|
|
3593
3577
|
const fileParts = getFileParts2(message.content);
|
|
3594
3578
|
const imageParts = getImageParts2(message.content);
|
|
3595
|
-
return /* @__PURE__ */
|
|
3596
|
-
imageParts.length > 0 && /* @__PURE__ */
|
|
3579
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("blade-chat-user-row flex justify-end", className), children: /* @__PURE__ */ jsxs12("div", { className: "blade-chat-user-col flex max-w-[72%] flex-col items-end gap-3", children: [
|
|
3580
|
+
imageParts.length > 0 && /* @__PURE__ */ jsx14("div", { className: "grid gap-2", children: imageParts.map((part) => /* @__PURE__ */ jsx14(
|
|
3597
3581
|
"img",
|
|
3598
3582
|
{
|
|
3599
3583
|
src: part.image_url.url,
|
|
@@ -3602,21 +3586,21 @@ function UserMessageBubble({ message, className }) {
|
|
|
3602
3586
|
},
|
|
3603
3587
|
part.image_url.url
|
|
3604
3588
|
)) }),
|
|
3605
|
-
fileParts.length > 0 && /* @__PURE__ */
|
|
3589
|
+
fileParts.length > 0 && /* @__PURE__ */ jsx14("div", { className: "flex flex-col items-end gap-1.5", children: fileParts.map((part) => /* @__PURE__ */ jsxs12(
|
|
3606
3590
|
"div",
|
|
3607
3591
|
{
|
|
3608
3592
|
className: "flex items-center gap-1.5 rounded-lg border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--muted)/0.3)] px-2.5 py-1.5 text-xs text-[hsl(var(--muted-foreground))]",
|
|
3609
3593
|
children: [
|
|
3610
|
-
/* @__PURE__ */
|
|
3611
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx14(FileText, { size: 12, className: "shrink-0" }),
|
|
3595
|
+
/* @__PURE__ */ jsx14("span", { className: "max-w-56 truncate", title: part.name, children: part.name })
|
|
3612
3596
|
]
|
|
3613
3597
|
},
|
|
3614
3598
|
`${part.name}-${part.data.length}`
|
|
3615
3599
|
)) }),
|
|
3616
|
-
text && /* @__PURE__ */
|
|
3617
|
-
text && isSending(message) && /* @__PURE__ */
|
|
3618
|
-
/* @__PURE__ */
|
|
3619
|
-
/* @__PURE__ */
|
|
3600
|
+
text && /* @__PURE__ */ jsx14("div", { className: "blade-chat-user-bubble max-w-full rounded-[20px] rounded-br-[6px] border border-[hsl(var(--user-msg-border))] bg-[hsl(var(--user-msg-bg))] px-[18px] py-[13px] text-sm leading-[1.65] text-[hsl(var(--user-msg-fg))]", children: /* @__PURE__ */ jsx14(MarkdownContent, { className: "blade-chat-prose", children: text }) }),
|
|
3601
|
+
text && isSending(message) && /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-1 pr-1 text-[11px] font-medium text-[hsl(var(--muted-foreground))/0.85]", children: [
|
|
3602
|
+
/* @__PURE__ */ jsx14(LoaderCircle, { size: 11, className: "animate-spin", "aria-hidden": "true" }),
|
|
3603
|
+
/* @__PURE__ */ jsx14("span", { children: "\u53D1\u9001\u4E2D" })
|
|
3620
3604
|
] })
|
|
3621
3605
|
] }) });
|
|
3622
3606
|
}
|
|
@@ -3625,11 +3609,11 @@ function ErrorMessageBlock({
|
|
|
3625
3609
|
className
|
|
3626
3610
|
}) {
|
|
3627
3611
|
const text = getTextContent2(message.content);
|
|
3628
|
-
return /* @__PURE__ */
|
|
3612
|
+
return /* @__PURE__ */ jsx14("div", { className: cn("blade-chat-error-row flex justify-center", className), children: /* @__PURE__ */ jsx14("div", { className: "blade-chat-error-block max-w-[85%] border-l-[3px] border-[hsl(var(--border))] px-4 py-1 text-sm leading-7 text-[hsl(var(--muted-foreground))]", children: text }) });
|
|
3629
3613
|
}
|
|
3630
3614
|
|
|
3631
3615
|
// src/components/MessageList.tsx
|
|
3632
|
-
import { jsx as
|
|
3616
|
+
import { jsx as jsx15, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3633
3617
|
function parseModeChange(message) {
|
|
3634
3618
|
if (message.kind !== "mode_change" || typeof message.content !== "string") {
|
|
3635
3619
|
return null;
|
|
@@ -3685,7 +3669,7 @@ function MessageList({
|
|
|
3685
3669
|
const visible = messages.filter((message) => {
|
|
3686
3670
|
if ((message.loop_name ?? "root") !== "root") return false;
|
|
3687
3671
|
if (isHiddenInternalMessage(message)) return false;
|
|
3688
|
-
if (message.kind === "context") return
|
|
3672
|
+
if (message.kind === "context") return false;
|
|
3689
3673
|
if (message.kind === "compaction") return true;
|
|
3690
3674
|
return message.role !== "tool" || getPlanningDividerKind(message) !== null;
|
|
3691
3675
|
});
|
|
@@ -3720,15 +3704,6 @@ function MessageList({
|
|
|
3720
3704
|
blocks.push({ type: "compaction", key: message.entry_id ?? `compaction-${blocks.length}` });
|
|
3721
3705
|
continue;
|
|
3722
3706
|
}
|
|
3723
|
-
if (message.kind === "context" && message.context) {
|
|
3724
|
-
flushAssistant();
|
|
3725
|
-
blocks.push({
|
|
3726
|
-
type: "context",
|
|
3727
|
-
message,
|
|
3728
|
-
key: message.entry_id ?? `context-${blocks.length}`
|
|
3729
|
-
});
|
|
3730
|
-
continue;
|
|
3731
|
-
}
|
|
3732
3707
|
if (message.role === "assistant") {
|
|
3733
3708
|
assistantBuffer.push(message);
|
|
3734
3709
|
continue;
|
|
@@ -3764,23 +3739,23 @@ function MessageList({
|
|
|
3764
3739
|
}
|
|
3765
3740
|
return blocks;
|
|
3766
3741
|
}, [messages, isStreaming]);
|
|
3767
|
-
return /* @__PURE__ */
|
|
3768
|
-
isStreaming ? /* @__PURE__ */
|
|
3769
|
-
/* @__PURE__ */
|
|
3742
|
+
return /* @__PURE__ */ jsxs13("div", { className: cn("blade-chat-messages relative min-h-0 flex-1", className), children: [
|
|
3743
|
+
isStreaming ? /* @__PURE__ */ jsx15("output", { className: "sr-only", children: "\u6B63\u5728\u751F\u6210\u56DE\u590D" }) : null,
|
|
3744
|
+
/* @__PURE__ */ jsxs13(
|
|
3770
3745
|
StickToBottom,
|
|
3771
3746
|
{
|
|
3772
3747
|
className: "h-full overflow-y-hidden",
|
|
3773
3748
|
initial: "instant",
|
|
3774
3749
|
resize: "instant",
|
|
3775
3750
|
children: [
|
|
3776
|
-
/* @__PURE__ */
|
|
3777
|
-
renderBlocks.length === 0 ? emptyState ?? /* @__PURE__ */
|
|
3778
|
-
/* @__PURE__ */
|
|
3779
|
-
/* @__PURE__ */
|
|
3780
|
-
/* @__PURE__ */
|
|
3751
|
+
/* @__PURE__ */ jsx15(StickToBottom.Content, { className: "blade-chat-messages-scroll", children: /* @__PURE__ */ jsx15("div", { className: "blade-chat-messages-content mx-auto max-w-[748px]", children: /* @__PURE__ */ jsxs13("div", { className: "flex min-w-0 flex-col", children: [
|
|
3752
|
+
renderBlocks.length === 0 ? emptyState ?? /* @__PURE__ */ jsxs13("div", { className: "blade-chat-empty", children: [
|
|
3753
|
+
/* @__PURE__ */ jsx15(MessageSquare, { size: 40, strokeWidth: 1.5 }),
|
|
3754
|
+
/* @__PURE__ */ jsx15("span", { className: "text-base font-medium", children: "\u5F00\u59CB\u5BF9\u8BDD" }),
|
|
3755
|
+
/* @__PURE__ */ jsx15("span", { className: "text-sm opacity-60", children: "\u5728\u4E0B\u65B9\u8F93\u5165\u6D88\u606F\u5F00\u59CB\u804A\u5929" })
|
|
3781
3756
|
] }) : renderBlocks.map((block) => {
|
|
3782
3757
|
if (block.type === "message") {
|
|
3783
|
-
return /* @__PURE__ */
|
|
3758
|
+
return /* @__PURE__ */ jsx15("div", { "data-entry-id": block.message.entry_id, children: isUserMessage(block.message) ? /* @__PURE__ */ jsx15(UserMessageBubble, { message: block.message }) : isErrorMessage(block.message) ? /* @__PURE__ */ jsx15(ErrorMessageBlock, { message: block.message }) : null }, block.key);
|
|
3784
3759
|
}
|
|
3785
3760
|
if (block.type === "assistant_turn") {
|
|
3786
3761
|
const blockFeedback = block.messages.map(
|
|
@@ -3791,14 +3766,14 @@ function MessageList({
|
|
|
3791
3766
|
(message) => message.entry_id === postChatFollowup.assistant_entry_id
|
|
3792
3767
|
)
|
|
3793
3768
|
);
|
|
3794
|
-
return /* @__PURE__ */
|
|
3769
|
+
return /* @__PURE__ */ jsx15("div", { "data-entry-id": block.messages[0]?.entry_id, children: /* @__PURE__ */ jsxs13(
|
|
3795
3770
|
RenderErrorBoundary,
|
|
3796
3771
|
{
|
|
3797
3772
|
label: "\u52A9\u624B\u6D88\u606F",
|
|
3798
3773
|
details: block.key,
|
|
3799
3774
|
resetKey: getMessageResetSignature(block.messages),
|
|
3800
3775
|
children: [
|
|
3801
|
-
/* @__PURE__ */
|
|
3776
|
+
/* @__PURE__ */ jsx15(
|
|
3802
3777
|
AssistantTurnBlock,
|
|
3803
3778
|
{
|
|
3804
3779
|
messages: block.messages,
|
|
@@ -3810,8 +3785,8 @@ function MessageList({
|
|
|
3810
3785
|
sessionId
|
|
3811
3786
|
}
|
|
3812
3787
|
),
|
|
3813
|
-
blockFeedback && !hasActiveFollowup ? /* @__PURE__ */
|
|
3814
|
-
hasActiveFollowup && postChatFollowup ? /* @__PURE__ */
|
|
3788
|
+
blockFeedback && !hasActiveFollowup ? /* @__PURE__ */ jsx15(HistoricalResultFeedback, { feedback: blockFeedback }) : null,
|
|
3789
|
+
hasActiveFollowup && postChatFollowup ? /* @__PURE__ */ jsx15(
|
|
3815
3790
|
PostChatFollowupBlock,
|
|
3816
3791
|
{
|
|
3817
3792
|
followup: postChatFollowup,
|
|
@@ -3827,27 +3802,24 @@ function MessageList({
|
|
|
3827
3802
|
}
|
|
3828
3803
|
) }, block.key);
|
|
3829
3804
|
}
|
|
3830
|
-
if (block.type === "context") {
|
|
3831
|
-
return /* @__PURE__ */ jsx16("div", { "data-entry-id": block.message.entry_id, children: /* @__PURE__ */ jsx16(ContextCard, { context: block.message.context }) }, block.key);
|
|
3832
|
-
}
|
|
3833
3805
|
if (block.type === "compaction") {
|
|
3834
|
-
return /* @__PURE__ */
|
|
3806
|
+
return /* @__PURE__ */ jsxs13(
|
|
3835
3807
|
"div",
|
|
3836
3808
|
{
|
|
3837
3809
|
className: "flex items-center gap-2 text-xs text-[hsl(var(--muted-foreground))]",
|
|
3838
3810
|
children: [
|
|
3839
|
-
/* @__PURE__ */
|
|
3840
|
-
/* @__PURE__ */
|
|
3811
|
+
/* @__PURE__ */ jsx15(Layers, { size: 12 }),
|
|
3812
|
+
/* @__PURE__ */ jsx15("span", { children: "\u4E0A\u4E0B\u6587\u5DF2\u538B\u7F29" })
|
|
3841
3813
|
]
|
|
3842
3814
|
},
|
|
3843
3815
|
block.key
|
|
3844
3816
|
);
|
|
3845
3817
|
}
|
|
3846
|
-
return /* @__PURE__ */
|
|
3818
|
+
return /* @__PURE__ */ jsx15(PlanningDivider, { kind: block.kind }, block.key);
|
|
3847
3819
|
}),
|
|
3848
|
-
sessionStatus === "interrupted" && !isStreaming ? /* @__PURE__ */
|
|
3820
|
+
sessionStatus === "interrupted" && !isStreaming ? /* @__PURE__ */ jsx15("div", { className: "flex", children: /* @__PURE__ */ jsx15("div", { className: "rounded-full border border-amber-500/30 bg-amber-500/10 px-2.5 py-1 text-[10px] font-medium uppercase tracking-[0.12em] text-amber-300", children: "\u5DF2\u4E2D\u65AD" }) }) : null
|
|
3849
3821
|
] }) }) }),
|
|
3850
|
-
/* @__PURE__ */
|
|
3822
|
+
/* @__PURE__ */ jsx15(
|
|
3851
3823
|
PinLatestUserMessage,
|
|
3852
3824
|
{
|
|
3853
3825
|
userMessageCount: userMessages.length,
|
|
@@ -3856,7 +3828,7 @@ function MessageList({
|
|
|
3856
3828
|
},
|
|
3857
3829
|
sessionId ?? "no-session"
|
|
3858
3830
|
),
|
|
3859
|
-
/* @__PURE__ */
|
|
3831
|
+
/* @__PURE__ */ jsx15(ScrollToBottomButton, {})
|
|
3860
3832
|
]
|
|
3861
3833
|
},
|
|
3862
3834
|
sessionId ?? "no-session"
|
|
@@ -3942,7 +3914,7 @@ function ScrollToBottomButton() {
|
|
|
3942
3914
|
scrollToBottom();
|
|
3943
3915
|
}, [scrollToBottom]);
|
|
3944
3916
|
if (!visible) return null;
|
|
3945
|
-
return /* @__PURE__ */
|
|
3917
|
+
return /* @__PURE__ */ jsxs13(
|
|
3946
3918
|
"button",
|
|
3947
3919
|
{
|
|
3948
3920
|
type: "button",
|
|
@@ -3950,25 +3922,25 @@ function ScrollToBottomButton() {
|
|
|
3950
3922
|
"aria-label": "\u6EDA\u52A8\u5230\u5E95\u90E8",
|
|
3951
3923
|
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-lg transition-colors hover:bg-[hsl(var(--accent))] hover:text-[hsl(var(--foreground))]",
|
|
3952
3924
|
children: [
|
|
3953
|
-
/* @__PURE__ */
|
|
3954
|
-
/* @__PURE__ */
|
|
3925
|
+
/* @__PURE__ */ jsx15(ChevronDown, { size: 14 }),
|
|
3926
|
+
/* @__PURE__ */ jsx15("span", { className: "blade-chat-scroll-bottom-label", children: "\u6EDA\u52A8\u5230\u5E95\u90E8" })
|
|
3955
3927
|
]
|
|
3956
3928
|
}
|
|
3957
3929
|
);
|
|
3958
3930
|
}
|
|
3959
3931
|
function PlanningDivider({ kind }) {
|
|
3960
|
-
return /* @__PURE__ */
|
|
3961
|
-
/* @__PURE__ */
|
|
3962
|
-
/* @__PURE__ */
|
|
3963
|
-
/* @__PURE__ */
|
|
3964
|
-
/* @__PURE__ */
|
|
3932
|
+
return /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3 py-1", children: [
|
|
3933
|
+
/* @__PURE__ */ jsx15("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" }),
|
|
3934
|
+
/* @__PURE__ */ jsxs13("div", { className: "inline-flex items-center gap-1.5 rounded-full border border-amber-500/30 bg-amber-500/10 px-3 py-1 text-[11px] text-amber-300", children: [
|
|
3935
|
+
/* @__PURE__ */ jsx15(Lightbulb, { size: 12 }),
|
|
3936
|
+
/* @__PURE__ */ jsx15("span", { children: kind === "enter" ? "\u8FDB\u5165\u89C4\u5212\u6A21\u5F0F" : "\u89C4\u5212\u5B8C\u6210" })
|
|
3965
3937
|
] }),
|
|
3966
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsx15("div", { className: "h-px flex-1 bg-gradient-to-r from-transparent via-amber-400/40 to-transparent" })
|
|
3967
3939
|
] });
|
|
3968
3940
|
}
|
|
3969
3941
|
|
|
3970
3942
|
// src/components/ChatSurface.tsx
|
|
3971
|
-
import { jsx as
|
|
3943
|
+
import { jsx as jsx16, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3972
3944
|
function themeAttr(theme) {
|
|
3973
3945
|
return theme === "dark" ? "dark" : void 0;
|
|
3974
3946
|
}
|
|
@@ -4000,7 +3972,7 @@ function ChatSurface({
|
|
|
4000
3972
|
beforeInput,
|
|
4001
3973
|
banner
|
|
4002
3974
|
}) {
|
|
4003
|
-
return /* @__PURE__ */
|
|
3975
|
+
return /* @__PURE__ */ jsxs14(
|
|
4004
3976
|
"div",
|
|
4005
3977
|
{
|
|
4006
3978
|
"data-theme": themeAttr(theme),
|
|
@@ -4009,14 +3981,14 @@ function ChatSurface({
|
|
|
4009
3981
|
classNames?.root
|
|
4010
3982
|
),
|
|
4011
3983
|
children: [
|
|
4012
|
-
/* @__PURE__ */
|
|
3984
|
+
/* @__PURE__ */ jsx16(ConnectionBanner, { connection, className: classNames?.banner }),
|
|
4013
3985
|
banner,
|
|
4014
|
-
errorMessage && /* @__PURE__ */
|
|
4015
|
-
/* @__PURE__ */
|
|
4016
|
-
/* @__PURE__ */
|
|
3986
|
+
errorMessage && /* @__PURE__ */ jsxs14("div", { className: "blade-chat-error-bar flex items-start gap-2 border-b px-4 py-3 text-sm", children: [
|
|
3987
|
+
/* @__PURE__ */ jsx16(CircleAlert, { size: 16, className: "mt-0.5 shrink-0" }),
|
|
3988
|
+
/* @__PURE__ */ jsx16("span", { children: errorMessage })
|
|
4017
3989
|
] }),
|
|
4018
3990
|
slots?.header,
|
|
4019
|
-
/* @__PURE__ */
|
|
3991
|
+
/* @__PURE__ */ jsx16(
|
|
4020
3992
|
MessageList,
|
|
4021
3993
|
{
|
|
4022
3994
|
messages,
|
|
@@ -4037,7 +4009,7 @@ function ChatSurface({
|
|
|
4037
4009
|
}
|
|
4038
4010
|
),
|
|
4039
4011
|
beforeInput,
|
|
4040
|
-
/* @__PURE__ */
|
|
4012
|
+
/* @__PURE__ */ jsx16(
|
|
4041
4013
|
ChatInput,
|
|
4042
4014
|
{
|
|
4043
4015
|
value: inputText,
|
|
@@ -4057,7 +4029,7 @@ function ChatSurface({
|
|
|
4057
4029
|
}
|
|
4058
4030
|
|
|
4059
4031
|
// src/components/AgentChat.tsx
|
|
4060
|
-
import { Fragment as Fragment3, jsx as
|
|
4032
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4061
4033
|
function isUnauthorizedError(error) {
|
|
4062
4034
|
return error instanceof BladeApiError && error.status === 401;
|
|
4063
4035
|
}
|
|
@@ -4076,11 +4048,11 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
4076
4048
|
setLoggingIn(false);
|
|
4077
4049
|
}
|
|
4078
4050
|
};
|
|
4079
|
-
return /* @__PURE__ */
|
|
4080
|
-
/* @__PURE__ */
|
|
4081
|
-
/* @__PURE__ */
|
|
4082
|
-
/* @__PURE__ */
|
|
4083
|
-
/* @__PURE__ */
|
|
4051
|
+
return /* @__PURE__ */ jsx17("div", { className: "blade-chat-login flex flex-1 items-center justify-center p-6", children: /* @__PURE__ */ jsxs15("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: [
|
|
4052
|
+
/* @__PURE__ */ jsx17(LockKeyhole, { size: 28, className: "text-[hsl(var(--muted-foreground))]" }),
|
|
4053
|
+
/* @__PURE__ */ jsx17("div", { className: "text-base font-medium text-[hsl(var(--foreground))]", children: "\u9700\u8981\u767B\u5F55\u540E\u4F7F\u7528" }),
|
|
4054
|
+
/* @__PURE__ */ jsx17("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" }),
|
|
4055
|
+
/* @__PURE__ */ jsx17(
|
|
4084
4056
|
"button",
|
|
4085
4057
|
{
|
|
4086
4058
|
type: "button",
|
|
@@ -4090,7 +4062,7 @@ function LoginCard({ client, onLoggedIn }) {
|
|
|
4090
4062
|
children: loggingIn ? "\u767B\u5F55\u4E2D\u2026" : "\u767B\u5F55"
|
|
4091
4063
|
}
|
|
4092
4064
|
),
|
|
4093
|
-
loginError && /* @__PURE__ */
|
|
4065
|
+
loginError && /* @__PURE__ */ jsx17("div", { className: "text-xs text-[hsl(var(--destructive))]", children: loginError })
|
|
4094
4066
|
] }) });
|
|
4095
4067
|
}
|
|
4096
4068
|
function AgentChat(props) {
|
|
@@ -4098,12 +4070,12 @@ function AgentChat(props) {
|
|
|
4098
4070
|
const [attempt, setAttempt] = useState13(0);
|
|
4099
4071
|
const [needLogin, setNeedLogin] = useState13(() => !client.hasToken());
|
|
4100
4072
|
if (needLogin) {
|
|
4101
|
-
return /* @__PURE__ */
|
|
4073
|
+
return /* @__PURE__ */ jsx17(
|
|
4102
4074
|
"div",
|
|
4103
4075
|
{
|
|
4104
4076
|
"data-theme": themeAttr(props.theme),
|
|
4105
4077
|
className: cn("blade-chat flex min-h-0 flex-1 flex-col", props.classNames?.root),
|
|
4106
|
-
children: /* @__PURE__ */
|
|
4078
|
+
children: /* @__PURE__ */ jsx17(
|
|
4107
4079
|
LoginCard,
|
|
4108
4080
|
{
|
|
4109
4081
|
client,
|
|
@@ -4116,7 +4088,7 @@ function AgentChat(props) {
|
|
|
4116
4088
|
}
|
|
4117
4089
|
);
|
|
4118
4090
|
}
|
|
4119
|
-
return /* @__PURE__ */
|
|
4091
|
+
return /* @__PURE__ */ jsx17(ChatSessionView, { ...props, onUnauthorized: () => setNeedLogin(true) }, attempt);
|
|
4120
4092
|
}
|
|
4121
4093
|
function ChatSessionView({
|
|
4122
4094
|
sessionId,
|
|
@@ -4225,7 +4197,7 @@ ${content}`);
|
|
|
4225
4197
|
setStopRequested(true);
|
|
4226
4198
|
void session?.stop();
|
|
4227
4199
|
};
|
|
4228
|
-
return /* @__PURE__ */
|
|
4200
|
+
return /* @__PURE__ */ jsx17(
|
|
4229
4201
|
ChatSurface,
|
|
4230
4202
|
{
|
|
4231
4203
|
theme,
|
|
@@ -4235,8 +4207,8 @@ ${content}`);
|
|
|
4235
4207
|
slots,
|
|
4236
4208
|
placeholder,
|
|
4237
4209
|
connection: state?.connection ?? "connecting",
|
|
4238
|
-
banner: /* @__PURE__ */
|
|
4239
|
-
/* @__PURE__ */
|
|
4210
|
+
banner: /* @__PURE__ */ jsxs15(Fragment3, { children: [
|
|
4211
|
+
/* @__PURE__ */ jsx17(
|
|
4240
4212
|
ReplayBar,
|
|
4241
4213
|
{
|
|
4242
4214
|
isReplay: replay.isReplay,
|
|
@@ -4246,7 +4218,7 @@ ${content}`);
|
|
|
4246
4218
|
onExit: () => void replay.exitToAutonomous()
|
|
4247
4219
|
}
|
|
4248
4220
|
),
|
|
4249
|
-
/* @__PURE__ */
|
|
4221
|
+
/* @__PURE__ */ jsx17(ReplayMismatchPrompt, { mismatch: replay.mismatch })
|
|
4250
4222
|
] }),
|
|
4251
4223
|
errorMessage,
|
|
4252
4224
|
messages: state?.messages ?? [],
|
|
@@ -4279,7 +4251,7 @@ import { useEffect as useEffect12, useMemo as useMemo9, useState as useState15 }
|
|
|
4279
4251
|
|
|
4280
4252
|
// src/components/LlmAdvancedSettings.tsx
|
|
4281
4253
|
import { useState as useState14 } from "react";
|
|
4282
|
-
import { jsx as
|
|
4254
|
+
import { jsx as jsx18, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4283
4255
|
var FIELDS = [
|
|
4284
4256
|
{ id: "baseURL", label: "\u6A21\u578B\u670D\u52A1\u5730\u5740", placeholder: "http://\u5185\u7F51\u5730\u5740/v1" },
|
|
4285
4257
|
{ id: "model", label: "\u6A21\u578B", placeholder: "\u6A21\u578B\u540D\u79F0" },
|
|
@@ -4330,8 +4302,8 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
4330
4302
|
if (!normalized) return null;
|
|
4331
4303
|
const fields = FIELDS.filter((field) => normalized[field.id]);
|
|
4332
4304
|
const dirty = Object.keys(override).length > 0;
|
|
4333
|
-
return /* @__PURE__ */
|
|
4334
|
-
/* @__PURE__ */
|
|
4305
|
+
return /* @__PURE__ */ jsxs16("div", { className: "blade-chat-advanced border-t border-[hsl(var(--border))] px-4 py-2 text-xs", children: [
|
|
4306
|
+
/* @__PURE__ */ jsxs16(
|
|
4335
4307
|
"button",
|
|
4336
4308
|
{
|
|
4337
4309
|
type: "button",
|
|
@@ -4341,16 +4313,16 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
4341
4313
|
},
|
|
4342
4314
|
className: "flex items-center gap-1.5 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
4343
4315
|
children: [
|
|
4344
|
-
/* @__PURE__ */
|
|
4316
|
+
/* @__PURE__ */ jsx18(Settings2, { size: 13 }),
|
|
4345
4317
|
"\u9AD8\u7EA7\u8BBE\u7F6E",
|
|
4346
|
-
dirty && /* @__PURE__ */
|
|
4318
|
+
dirty && /* @__PURE__ */ jsx18("span", { className: "text-[hsl(var(--primary))]", children: "\uFF08\u5DF2\u81EA\u5B9A\u4E49\uFF09" })
|
|
4347
4319
|
]
|
|
4348
4320
|
}
|
|
4349
4321
|
),
|
|
4350
|
-
open && /* @__PURE__ */
|
|
4351
|
-
fields.map((field) => /* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4353
|
-
/* @__PURE__ */
|
|
4322
|
+
open && /* @__PURE__ */ jsxs16("div", { className: "mt-2 flex flex-col gap-2", children: [
|
|
4323
|
+
fields.map((field) => /* @__PURE__ */ jsxs16("label", { className: "flex flex-col gap-1", children: [
|
|
4324
|
+
/* @__PURE__ */ jsx18("span", { className: "text-[hsl(var(--muted-foreground))]", children: field.label }),
|
|
4325
|
+
/* @__PURE__ */ jsx18(
|
|
4354
4326
|
"input",
|
|
4355
4327
|
{
|
|
4356
4328
|
type: field.secret ? "password" : "text",
|
|
@@ -4361,9 +4333,9 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
4361
4333
|
}
|
|
4362
4334
|
)
|
|
4363
4335
|
] }, field.id)),
|
|
4364
|
-
normalized.apiKey && /* @__PURE__ */
|
|
4365
|
-
/* @__PURE__ */
|
|
4366
|
-
/* @__PURE__ */
|
|
4336
|
+
normalized.apiKey && /* @__PURE__ */ jsx18("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" }),
|
|
4337
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex gap-2", children: [
|
|
4338
|
+
/* @__PURE__ */ jsx18(
|
|
4367
4339
|
"button",
|
|
4368
4340
|
{
|
|
4369
4341
|
type: "button",
|
|
@@ -4378,7 +4350,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
4378
4350
|
children: "\u4FDD\u5B58"
|
|
4379
4351
|
}
|
|
4380
4352
|
),
|
|
4381
|
-
/* @__PURE__ */
|
|
4353
|
+
/* @__PURE__ */ jsx18(
|
|
4382
4354
|
"button",
|
|
4383
4355
|
{
|
|
4384
4356
|
type: "button",
|
|
@@ -4397,7 +4369,7 @@ function LlmAdvancedSettingsBar({ settings, defaults, override, onChange }) {
|
|
|
4397
4369
|
}
|
|
4398
4370
|
|
|
4399
4371
|
// src/components/LlmChat.tsx
|
|
4400
|
-
import { jsx as
|
|
4372
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
4401
4373
|
function LlmChat({
|
|
4402
4374
|
classNames,
|
|
4403
4375
|
renderers,
|
|
@@ -4426,7 +4398,7 @@ ${text}` : text),
|
|
|
4426
4398
|
useEffect12(() => {
|
|
4427
4399
|
onReady?.(handle);
|
|
4428
4400
|
}, [handle, onReady]);
|
|
4429
|
-
return /* @__PURE__ */
|
|
4401
|
+
return /* @__PURE__ */ jsx19(
|
|
4430
4402
|
ChatSurface,
|
|
4431
4403
|
{
|
|
4432
4404
|
theme,
|
|
@@ -4451,7 +4423,7 @@ ${text}` : text),
|
|
|
4451
4423
|
setStopRequested(true);
|
|
4452
4424
|
stop();
|
|
4453
4425
|
},
|
|
4454
|
-
beforeInput: advanced ? /* @__PURE__ */
|
|
4426
|
+
beforeInput: advanced ? /* @__PURE__ */ jsx19(
|
|
4455
4427
|
LlmAdvancedSettingsBar,
|
|
4456
4428
|
{
|
|
4457
4429
|
settings: advanced,
|
|
@@ -4469,14 +4441,14 @@ ${text}` : text),
|
|
|
4469
4441
|
}
|
|
4470
4442
|
|
|
4471
4443
|
// src/components/ChatView.tsx
|
|
4472
|
-
import { jsx as
|
|
4444
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
4473
4445
|
function ChatView(props) {
|
|
4474
4446
|
const { mode, llm, onLlmReady, ...rest } = props;
|
|
4475
4447
|
if (mode === "llm") {
|
|
4476
4448
|
if (!llm) {
|
|
4477
4449
|
throw new Error('ChatView: mode="llm" \u9700\u8981\u540C\u65F6\u4F20 llm={{ baseURL, model }}');
|
|
4478
4450
|
}
|
|
4479
|
-
return /* @__PURE__ */
|
|
4451
|
+
return /* @__PURE__ */ jsx20(
|
|
4480
4452
|
LlmChat,
|
|
4481
4453
|
{
|
|
4482
4454
|
...llm,
|
|
@@ -4489,7 +4461,47 @@ function ChatView(props) {
|
|
|
4489
4461
|
}
|
|
4490
4462
|
);
|
|
4491
4463
|
}
|
|
4492
|
-
return /* @__PURE__ */
|
|
4464
|
+
return /* @__PURE__ */ jsx20(AgentChat, { ...rest });
|
|
4465
|
+
}
|
|
4466
|
+
|
|
4467
|
+
// src/components/ContextCard.tsx
|
|
4468
|
+
import {
|
|
4469
|
+
getContextDisplayState
|
|
4470
|
+
} from "@blade-hq/agent-client";
|
|
4471
|
+
import { jsx as jsx21, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4472
|
+
function ContextCard({ context, className }) {
|
|
4473
|
+
const display = getContextDisplayState(context);
|
|
4474
|
+
return /* @__PURE__ */ jsxs17(
|
|
4475
|
+
"details",
|
|
4476
|
+
{
|
|
4477
|
+
className: `blade-chat-context-card group rounded-xl border border-[hsl(var(--border))] bg-[hsl(var(--card))] text-sm ${className ?? ""}`,
|
|
4478
|
+
children: [
|
|
4479
|
+
/* @__PURE__ */ jsxs17("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: [
|
|
4480
|
+
/* @__PURE__ */ jsx21(
|
|
4481
|
+
Layers,
|
|
4482
|
+
{
|
|
4483
|
+
size: 15,
|
|
4484
|
+
className: "blade-chat-context-icon shrink-0 text-[hsl(var(--muted-foreground))]",
|
|
4485
|
+
"aria-hidden": "true"
|
|
4486
|
+
}
|
|
4487
|
+
),
|
|
4488
|
+
/* @__PURE__ */ jsxs17("span", { className: "blade-chat-context-copy min-w-0 flex-1", children: [
|
|
4489
|
+
/* @__PURE__ */ jsx21("span", { className: "blade-chat-context-title block font-medium text-[hsl(var(--foreground))]", children: display.title }),
|
|
4490
|
+
/* @__PURE__ */ jsx21("span", { className: "blade-chat-context-status block truncate text-xs text-[hsl(var(--muted-foreground))]", children: display.summary })
|
|
4491
|
+
] }),
|
|
4492
|
+
/* @__PURE__ */ jsx21(
|
|
4493
|
+
ChevronDown,
|
|
4494
|
+
{
|
|
4495
|
+
size: 14,
|
|
4496
|
+
className: "blade-chat-context-chevron shrink-0 text-[hsl(var(--muted-foreground))] transition-transform group-open:rotate-180",
|
|
4497
|
+
"aria-hidden": "true"
|
|
4498
|
+
}
|
|
4499
|
+
)
|
|
4500
|
+
] }),
|
|
4501
|
+
/* @__PURE__ */ jsx21("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 })
|
|
4502
|
+
]
|
|
4503
|
+
}
|
|
4504
|
+
);
|
|
4493
4505
|
}
|
|
4494
4506
|
|
|
4495
4507
|
// src/lib/agent-computer-command.ts
|