@blade-hq/agent-react 2610.0.0-beta.22 → 2610.0.0-beta.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +86 -8
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public-api.md +1 -0
package/dist/index.js
CHANGED
|
@@ -1831,6 +1831,7 @@ var TOOL_NAME_ALIASES = {
|
|
|
1831
1831
|
finish_task: "FinishTask",
|
|
1832
1832
|
glob: "Glob",
|
|
1833
1833
|
grep: "Grep",
|
|
1834
|
+
kb_search: "KbSearch",
|
|
1834
1835
|
ls: "Ls",
|
|
1835
1836
|
multi_edit: "MultiEdit",
|
|
1836
1837
|
read: "Read",
|
|
@@ -1849,6 +1850,7 @@ var TOOL_DISPLAY_LABELS = {
|
|
|
1849
1850
|
Ls: "\u5217\u51FA\u76EE\u5F55",
|
|
1850
1851
|
Glob: "\u5339\u914D\u6587\u4EF6",
|
|
1851
1852
|
Grep: "\u641C\u7D22\u6587\u672C",
|
|
1853
|
+
KbSearch: "\u68C0\u7D22\u77E5\u8BC6\u5E93",
|
|
1852
1854
|
WebSearch: "\u641C\u7D22\u7F51\u9875",
|
|
1853
1855
|
WebFetch: "\u6574\u7406\u7F51\u9875\u5185\u5BB9",
|
|
1854
1856
|
Agent: "\u6D3E\u751F\u5B50\u667A\u80FD\u4F53",
|
|
@@ -2688,7 +2690,6 @@ function buildAskUserPayload(argumentsJson) {
|
|
|
2688
2690
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2689
2691
|
function ThinkingBlock({ reasoning, isStreaming }) {
|
|
2690
2692
|
const [open, setOpen] = useState10(false);
|
|
2691
|
-
if (!isStreaming) return null;
|
|
2692
2693
|
return /* @__PURE__ */ jsxs9("div", { className: "blade-chat-thinking text-xs", children: [
|
|
2693
2694
|
/* @__PURE__ */ jsxs9(
|
|
2694
2695
|
"button",
|
|
@@ -2698,7 +2699,7 @@ function ThinkingBlock({ reasoning, isStreaming }) {
|
|
|
2698
2699
|
"aria-expanded": open,
|
|
2699
2700
|
className: "group/thinking inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
2700
2701
|
children: [
|
|
2701
|
-
/* @__PURE__ */ jsx11(Shimmer, { className: "text-xs", children: "\u6B63\u5728\u601D\u8003" }),
|
|
2702
|
+
isStreaming ? /* @__PURE__ */ jsx11(Shimmer, { className: "text-xs", children: "\u6B63\u5728\u601D\u8003" }) : /* @__PURE__ */ jsx11("span", { children: "\u5DF2\u601D\u8003" }),
|
|
2702
2703
|
/* @__PURE__ */ jsx11(
|
|
2703
2704
|
ChevronRight,
|
|
2704
2705
|
{
|
|
@@ -2712,7 +2713,7 @@ function ThinkingBlock({ reasoning, isStreaming }) {
|
|
|
2712
2713
|
]
|
|
2713
2714
|
}
|
|
2714
2715
|
),
|
|
2715
|
-
open
|
|
2716
|
+
open && /* @__PURE__ */ jsx11("div", { className: "mt-1.5 whitespace-pre-wrap text-xs leading-[22px] text-[hsl(var(--muted-foreground))]", children: reasoning })
|
|
2716
2717
|
] });
|
|
2717
2718
|
}
|
|
2718
2719
|
function getMessageText(message) {
|
|
@@ -2810,8 +2811,63 @@ function executionSummaryLabel({
|
|
|
2810
2811
|
}
|
|
2811
2812
|
return completedLabel;
|
|
2812
2813
|
}
|
|
2814
|
+
function executionToolTypeLabel(toolCall) {
|
|
2815
|
+
switch (formatToolName(toolCall.name)) {
|
|
2816
|
+
case "WebSearch":
|
|
2817
|
+
case "WebFetch":
|
|
2818
|
+
return "\u7F51\u7EDC\u68C0\u7D22";
|
|
2819
|
+
case "Bash":
|
|
2820
|
+
case "BgBash":
|
|
2821
|
+
return "\u547D\u4EE4\u6267\u884C";
|
|
2822
|
+
case "Read":
|
|
2823
|
+
case "ReadSkill":
|
|
2824
|
+
return "\u5185\u5BB9\u8BFB\u53D6";
|
|
2825
|
+
case "Write":
|
|
2826
|
+
case "Edit":
|
|
2827
|
+
case "MultiEdit":
|
|
2828
|
+
return "\u6587\u4EF6\u5904\u7406";
|
|
2829
|
+
case "Grep":
|
|
2830
|
+
case "Glob":
|
|
2831
|
+
return "\u5185\u5BB9\u641C\u7D22";
|
|
2832
|
+
case "Agent":
|
|
2833
|
+
return "\u5B50\u4EFB\u52A1";
|
|
2834
|
+
case "search_skills":
|
|
2835
|
+
return "\u6280\u80FD\u68C0\u7D22";
|
|
2836
|
+
case "get_skill_content":
|
|
2837
|
+
return "\u8BFB\u53D6\u6280\u80FD";
|
|
2838
|
+
case "run_skill_tool":
|
|
2839
|
+
return "\u6267\u884C\u6280\u80FD";
|
|
2840
|
+
default:
|
|
2841
|
+
return toolCall.display_name?.trim() || "\u6267\u884C\u6B65\u9AA4";
|
|
2842
|
+
}
|
|
2843
|
+
}
|
|
2844
|
+
function executionToolIntent(toolCall) {
|
|
2845
|
+
const normalizedName = formatToolName(toolCall.name);
|
|
2846
|
+
let args = null;
|
|
2847
|
+
try {
|
|
2848
|
+
const parsed = JSON.parse(toolCall.arguments);
|
|
2849
|
+
args = parsed && typeof parsed === "object" && !Array.isArray(parsed) ? parsed : null;
|
|
2850
|
+
} catch {
|
|
2851
|
+
args = null;
|
|
2852
|
+
}
|
|
2853
|
+
const getString = (key) => {
|
|
2854
|
+
const value = args?.[key];
|
|
2855
|
+
return typeof value === "string" ? value.trim() : "";
|
|
2856
|
+
};
|
|
2857
|
+
const explicitIntent = getString("description") || getString("_meta_display_name") || getString("display_name") || toolCall.display_name?.trim() || "";
|
|
2858
|
+
if (explicitIntent) return explicitIntent;
|
|
2859
|
+
if (normalizedName === "search_skills") return getString("query");
|
|
2860
|
+
if (normalizedName === "get_skill_content" || normalizedName === "ReadSkill") {
|
|
2861
|
+
return getString("skill_name") || getString("skill");
|
|
2862
|
+
}
|
|
2863
|
+
if (normalizedName === "FinishTask") return getString("title");
|
|
2864
|
+
return "";
|
|
2865
|
+
}
|
|
2813
2866
|
function ExecutionToolRow({ toolCall }) {
|
|
2814
2867
|
const normalizedName = formatToolName(toolCall.name);
|
|
2868
|
+
const typeLabel = executionToolTypeLabel(toolCall);
|
|
2869
|
+
const intent = executionToolIntent(toolCall);
|
|
2870
|
+
const label = intent ? `${typeLabel}\uFF1A${intent}` : typeLabel;
|
|
2815
2871
|
const failed = toolCall.status === "error" || toolCall.status === "cancelled";
|
|
2816
2872
|
const filePath = toolCall.status === "done" && (normalizedName === "Write" || normalizedName === "Edit" || normalizedName === "MultiEdit") ? extractToolFilePath(toolCall) : null;
|
|
2817
2873
|
const [fileOpen, setFileOpen] = useState10(false);
|
|
@@ -2819,13 +2875,16 @@ function ExecutionToolRow({ toolCall }) {
|
|
|
2819
2875
|
"size-3.5 shrink-0",
|
|
2820
2876
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
2821
2877
|
);
|
|
2822
|
-
const icon = toolCall.status === "pending" ? /* @__PURE__ */ jsx11(LoaderCircle, { className: cn(iconClass, "animate-spin"), "aria-hidden": "true" }) : toolCall.status === "error" ? /* @__PURE__ */ jsx11(CircleAlert, { className: iconClass, "aria-hidden": "true" }) : toolCall.status === "cancelled" ? /* @__PURE__ */ jsx11(X, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "WebSearch" || normalizedName === "WebFetch" ? /* @__PURE__ */ jsx11(Earth, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Bash" || normalizedName === "BgBash" ? /* @__PURE__ */ jsx11(Terminal, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Write" || normalizedName === "Edit" || normalizedName === "MultiEdit" ? /* @__PURE__ */ jsx11(FilePenLine, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Read" || normalizedName === "ReadSkill"
|
|
2878
|
+
const icon = toolCall.status === "pending" ? /* @__PURE__ */ jsx11(LoaderCircle, { className: cn(iconClass, "animate-spin"), "aria-hidden": "true" }) : toolCall.status === "error" ? /* @__PURE__ */ jsx11(CircleAlert, { className: iconClass, "aria-hidden": "true" }) : toolCall.status === "cancelled" ? /* @__PURE__ */ jsx11(X, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "WebSearch" || normalizedName === "WebFetch" ? /* @__PURE__ */ jsx11(Earth, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Bash" || normalizedName === "BgBash" ? /* @__PURE__ */ jsx11(Terminal, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Write" || normalizedName === "Edit" || normalizedName === "MultiEdit" ? /* @__PURE__ */ jsx11(FilePenLine, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Read" || normalizedName === "ReadSkill" ? /* @__PURE__ */ jsx11(BookOpen, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Grep" || normalizedName === "Glob" || normalizedName === "search_skills" ? /* @__PURE__ */ jsx11(Search, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "get_skill_content" ? /* @__PURE__ */ jsx11(BookOpen, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Agent" ? /* @__PURE__ */ jsx11(Bot, { className: iconClass, "aria-hidden": "true" }) : /* @__PURE__ */ jsx11(Wrench, { className: iconClass, "aria-hidden": "true" });
|
|
2823
2879
|
const rowClassName = cn(
|
|
2824
2880
|
"flex min-w-0 items-center gap-1 py-1.5 text-xs leading-[22px]",
|
|
2825
2881
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
2826
2882
|
);
|
|
2827
2883
|
if (!filePath) {
|
|
2828
|
-
return /* @__PURE__ */
|
|
2884
|
+
return /* @__PURE__ */ jsxs9("div", { "data-testid": "execution-tool-intent", className: rowClassName, title: label, children: [
|
|
2885
|
+
icon,
|
|
2886
|
+
/* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate", children: label })
|
|
2887
|
+
] });
|
|
2829
2888
|
}
|
|
2830
2889
|
return /* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
|
|
2831
2890
|
/* @__PURE__ */ jsxs9(
|
|
@@ -2834,15 +2893,34 @@ function ExecutionToolRow({ toolCall }) {
|
|
|
2834
2893
|
type: "button",
|
|
2835
2894
|
"data-testid": "execution-tool-intent",
|
|
2836
2895
|
className: cn(rowClassName, "w-full text-left"),
|
|
2896
|
+
title: label,
|
|
2837
2897
|
"aria-expanded": fileOpen,
|
|
2838
2898
|
onClick: () => setFileOpen((open) => !open),
|
|
2839
2899
|
children: [
|
|
2840
2900
|
icon,
|
|
2841
|
-
/* @__PURE__ */ jsx11(
|
|
2901
|
+
/* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate", children: label }),
|
|
2902
|
+
/* @__PURE__ */ jsx11(
|
|
2903
|
+
ChevronRight,
|
|
2904
|
+
{
|
|
2905
|
+
size: 14,
|
|
2906
|
+
className: cn("shrink-0 transition-transform", fileOpen && "rotate-90"),
|
|
2907
|
+
"aria-hidden": "true"
|
|
2908
|
+
}
|
|
2909
|
+
)
|
|
2842
2910
|
]
|
|
2843
2911
|
}
|
|
2844
2912
|
),
|
|
2845
|
-
fileOpen ? /* @__PURE__ */
|
|
2913
|
+
fileOpen ? /* @__PURE__ */ jsxs9(
|
|
2914
|
+
"div",
|
|
2915
|
+
{
|
|
2916
|
+
className: "ml-[18px] truncate text-xs leading-[22px] text-[hsl(var(--muted-foreground))]",
|
|
2917
|
+
title: filePath,
|
|
2918
|
+
children: [
|
|
2919
|
+
"\u6587\u4EF6\uFF1A",
|
|
2920
|
+
filePath
|
|
2921
|
+
]
|
|
2922
|
+
}
|
|
2923
|
+
) : null
|
|
2846
2924
|
] });
|
|
2847
2925
|
}
|
|
2848
2926
|
function AssistantTurnBlock({
|
|
@@ -2977,7 +3055,7 @@ function AssistantTurnBlock({
|
|
|
2977
3055
|
const toolCalls = (message.tool_calls ?? []).filter(
|
|
2978
3056
|
(toolCall) => formatToolName(toolCall.name) !== "AskUserQuestion"
|
|
2979
3057
|
);
|
|
2980
|
-
const showReasoning = !!message.reasoning && isStreaming
|
|
3058
|
+
const showReasoning = !!message.reasoning && (!isStreaming || index === latestReasoningIndex);
|
|
2981
3059
|
return /* @__PURE__ */ jsxs9(
|
|
2982
3060
|
"div",
|
|
2983
3061
|
{
|