@blade-hq/agent-react 2610.0.0-beta.21 → 2610.0.0-beta.22
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 +8 -86
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/public-api.md +0 -1
package/dist/index.js
CHANGED
|
@@ -1831,7 +1831,6 @@ var TOOL_NAME_ALIASES = {
|
|
|
1831
1831
|
finish_task: "FinishTask",
|
|
1832
1832
|
glob: "Glob",
|
|
1833
1833
|
grep: "Grep",
|
|
1834
|
-
kb_search: "KbSearch",
|
|
1835
1834
|
ls: "Ls",
|
|
1836
1835
|
multi_edit: "MultiEdit",
|
|
1837
1836
|
read: "Read",
|
|
@@ -1850,7 +1849,6 @@ var TOOL_DISPLAY_LABELS = {
|
|
|
1850
1849
|
Ls: "\u5217\u51FA\u76EE\u5F55",
|
|
1851
1850
|
Glob: "\u5339\u914D\u6587\u4EF6",
|
|
1852
1851
|
Grep: "\u641C\u7D22\u6587\u672C",
|
|
1853
|
-
KbSearch: "\u68C0\u7D22\u77E5\u8BC6\u5E93",
|
|
1854
1852
|
WebSearch: "\u641C\u7D22\u7F51\u9875",
|
|
1855
1853
|
WebFetch: "\u6574\u7406\u7F51\u9875\u5185\u5BB9",
|
|
1856
1854
|
Agent: "\u6D3E\u751F\u5B50\u667A\u80FD\u4F53",
|
|
@@ -2690,6 +2688,7 @@ function buildAskUserPayload(argumentsJson) {
|
|
|
2690
2688
|
import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2691
2689
|
function ThinkingBlock({ reasoning, isStreaming }) {
|
|
2692
2690
|
const [open, setOpen] = useState10(false);
|
|
2691
|
+
if (!isStreaming) return null;
|
|
2693
2692
|
return /* @__PURE__ */ jsxs9("div", { className: "blade-chat-thinking text-xs", children: [
|
|
2694
2693
|
/* @__PURE__ */ jsxs9(
|
|
2695
2694
|
"button",
|
|
@@ -2699,7 +2698,7 @@ function ThinkingBlock({ reasoning, isStreaming }) {
|
|
|
2699
2698
|
"aria-expanded": open,
|
|
2700
2699
|
className: "group/thinking inline-flex items-center gap-1 text-[hsl(var(--muted-foreground))] transition-colors hover:text-[hsl(var(--foreground))]",
|
|
2701
2700
|
children: [
|
|
2702
|
-
|
|
2701
|
+
/* @__PURE__ */ jsx11(Shimmer, { className: "text-xs", children: "\u6B63\u5728\u601D\u8003" }),
|
|
2703
2702
|
/* @__PURE__ */ jsx11(
|
|
2704
2703
|
ChevronRight,
|
|
2705
2704
|
{
|
|
@@ -2713,7 +2712,7 @@ function ThinkingBlock({ reasoning, isStreaming }) {
|
|
|
2713
2712
|
]
|
|
2714
2713
|
}
|
|
2715
2714
|
),
|
|
2716
|
-
open
|
|
2715
|
+
open ? /* @__PURE__ */ jsx11("div", { className: "mt-1.5 whitespace-pre-wrap text-xs leading-[22px] text-[hsl(var(--muted-foreground))]", children: reasoning }) : null
|
|
2717
2716
|
] });
|
|
2718
2717
|
}
|
|
2719
2718
|
function getMessageText(message) {
|
|
@@ -2811,63 +2810,8 @@ function executionSummaryLabel({
|
|
|
2811
2810
|
}
|
|
2812
2811
|
return completedLabel;
|
|
2813
2812
|
}
|
|
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
|
-
}
|
|
2866
2813
|
function ExecutionToolRow({ toolCall }) {
|
|
2867
2814
|
const normalizedName = formatToolName(toolCall.name);
|
|
2868
|
-
const typeLabel = executionToolTypeLabel(toolCall);
|
|
2869
|
-
const intent = executionToolIntent(toolCall);
|
|
2870
|
-
const label = intent ? `${typeLabel}\uFF1A${intent}` : typeLabel;
|
|
2871
2815
|
const failed = toolCall.status === "error" || toolCall.status === "cancelled";
|
|
2872
2816
|
const filePath = toolCall.status === "done" && (normalizedName === "Write" || normalizedName === "Edit" || normalizedName === "MultiEdit") ? extractToolFilePath(toolCall) : null;
|
|
2873
2817
|
const [fileOpen, setFileOpen] = useState10(false);
|
|
@@ -2875,16 +2819,13 @@ function ExecutionToolRow({ toolCall }) {
|
|
|
2875
2819
|
"size-3.5 shrink-0",
|
|
2876
2820
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
2877
2821
|
);
|
|
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 === "
|
|
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" || normalizedName === "get_skill_content" ? /* @__PURE__ */ jsx11(BookOpen, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Grep" || normalizedName === "Glob" || normalizedName === "search_skills" ? /* @__PURE__ */ jsx11(Search, { className: iconClass, "aria-hidden": "true" }) : normalizedName === "Agent" ? /* @__PURE__ */ jsx11(Bot, { className: iconClass, "aria-hidden": "true" }) : /* @__PURE__ */ jsx11(Wrench, { className: iconClass, "aria-hidden": "true" });
|
|
2879
2823
|
const rowClassName = cn(
|
|
2880
2824
|
"flex min-w-0 items-center gap-1 py-1.5 text-xs leading-[22px]",
|
|
2881
2825
|
failed ? "text-red-500" : "text-[hsl(var(--muted-foreground))]"
|
|
2882
2826
|
);
|
|
2883
2827
|
if (!filePath) {
|
|
2884
|
-
return /* @__PURE__ */
|
|
2885
|
-
icon,
|
|
2886
|
-
/* @__PURE__ */ jsx11("span", { className: "min-w-0 truncate", children: label })
|
|
2887
|
-
] });
|
|
2828
|
+
return /* @__PURE__ */ jsx11("div", { "data-testid": "execution-tool-intent", className: rowClassName, children: icon });
|
|
2888
2829
|
}
|
|
2889
2830
|
return /* @__PURE__ */ jsxs9("div", { className: "min-w-0", children: [
|
|
2890
2831
|
/* @__PURE__ */ jsxs9(
|
|
@@ -2893,34 +2834,15 @@ function ExecutionToolRow({ toolCall }) {
|
|
|
2893
2834
|
type: "button",
|
|
2894
2835
|
"data-testid": "execution-tool-intent",
|
|
2895
2836
|
className: cn(rowClassName, "w-full text-left"),
|
|
2896
|
-
title: label,
|
|
2897
2837
|
"aria-expanded": fileOpen,
|
|
2898
2838
|
onClick: () => setFileOpen((open) => !open),
|
|
2899
2839
|
children: [
|
|
2900
2840
|
icon,
|
|
2901
|
-
/* @__PURE__ */ jsx11(
|
|
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
|
-
)
|
|
2841
|
+
/* @__PURE__ */ jsx11(ChevronRight, { size: 14, className: cn("shrink-0 transition-transform", fileOpen && "rotate-90"), "aria-hidden": "true" })
|
|
2910
2842
|
]
|
|
2911
2843
|
}
|
|
2912
2844
|
),
|
|
2913
|
-
fileOpen ? /* @__PURE__ */
|
|
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
|
|
2845
|
+
fileOpen ? /* @__PURE__ */ jsx11("div", { className: "ml-[18px] truncate text-xs leading-[22px] text-[hsl(var(--muted-foreground))]", title: filePath, children: filePath }) : null
|
|
2924
2846
|
] });
|
|
2925
2847
|
}
|
|
2926
2848
|
function AssistantTurnBlock({
|
|
@@ -3055,7 +2977,7 @@ function AssistantTurnBlock({
|
|
|
3055
2977
|
const toolCalls = (message.tool_calls ?? []).filter(
|
|
3056
2978
|
(toolCall) => formatToolName(toolCall.name) !== "AskUserQuestion"
|
|
3057
2979
|
);
|
|
3058
|
-
const showReasoning = !!message.reasoning &&
|
|
2980
|
+
const showReasoning = !!message.reasoning && isStreaming && index === latestReasoningIndex;
|
|
3059
2981
|
return /* @__PURE__ */ jsxs9(
|
|
3060
2982
|
"div",
|
|
3061
2983
|
{
|