@blade-hq/agent-react 2612.0.0-beta.57 → 2612.0.0-beta.59
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 +4 -0
- package/dist/chat/ImageLightbox.d.ts +1 -1
- package/dist/{chunk-ILB77TUM.js → chunk-2E6DQCXM.js} +3 -3
- package/dist/chunk-HBMFIJG2.js +13622 -0
- package/dist/chunk-HBMFIJG2.js.map +1 -0
- package/dist/{chunk-FLNFZVZF.js → chunk-MAFNMG2O.js} +2 -2
- package/dist/{chunk-WA2DQEKV.js → chunk-UC7SY3G5.js} +1968 -15552
- package/dist/chunk-UC7SY3G5.js.map +1 -0
- package/dist/{chunk-PMNUGFTJ.js → chunk-VSIUEXGV.js} +222 -219
- package/dist/chunk-VSIUEXGV.js.map +1 -0
- package/dist/{chunk-2U5HZ3PG.js → chunk-XV6AO37F.js} +2 -2
- package/dist/index.js +5 -4
- package/dist/internal.js +10 -8
- package/dist/internal.js.map +1 -1
- package/dist/questions.js +2 -2
- package/dist/rich-input.js +3 -3
- package/dist/tool-details.d.ts +8 -0
- package/dist/tool-details.js +24 -0
- package/dist/tool-details.js.map +1 -0
- package/package.json +6 -2
- package/dist/chunk-PMNUGFTJ.js.map +0 -1
- package/dist/chunk-WA2DQEKV.js.map +0 -1
- /package/dist/{chunk-ILB77TUM.js.map → chunk-2E6DQCXM.js.map} +0 -0
- /package/dist/{chunk-FLNFZVZF.js.map → chunk-MAFNMG2O.js.map} +0 -0
- /package/dist/{chunk-2U5HZ3PG.js.map → chunk-XV6AO37F.js.map} +0 -0
|
@@ -29,6 +29,227 @@ function useBladeHost() {
|
|
|
29
29
|
return useContext(BladeHostContext);
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
+
// src/chat/display-utils.ts
|
|
33
|
+
var TOOL_NAME_ALIASES = {
|
|
34
|
+
agent: "Agent",
|
|
35
|
+
ask_user_question: "AskUserQuestion",
|
|
36
|
+
bash: "Bash",
|
|
37
|
+
bg_bash: "BgBash",
|
|
38
|
+
code_mode_run: "CodeMode",
|
|
39
|
+
edit: "Edit",
|
|
40
|
+
exit_plan_mode: "ExitPlanMode",
|
|
41
|
+
file_edit: "Edit",
|
|
42
|
+
file_read: "Read",
|
|
43
|
+
file_write: "Write",
|
|
44
|
+
finish_task: "FinishTask",
|
|
45
|
+
glob: "Glob",
|
|
46
|
+
grep: "Grep",
|
|
47
|
+
ls: "Ls",
|
|
48
|
+
multi_edit: "MultiEdit",
|
|
49
|
+
read: "Read",
|
|
50
|
+
read_skill: "ReadSkill",
|
|
51
|
+
update_plan: "UpdatePlan",
|
|
52
|
+
web_fetch: "WebFetch",
|
|
53
|
+
web_search: "WebSearch",
|
|
54
|
+
write: "Write"
|
|
55
|
+
};
|
|
56
|
+
var TOOL_DISPLAY_LABELS = {
|
|
57
|
+
Bash: "\u6267\u884C\u547D\u4EE4",
|
|
58
|
+
BgBash: "\u540E\u53F0\u6267\u884C\u547D\u4EE4",
|
|
59
|
+
CodeMode: "\u6267\u884C\u7A0B\u5E8F",
|
|
60
|
+
Read: "\u8BFB\u53D6\u6587\u4EF6",
|
|
61
|
+
Write: "\u5199\u5165\u6587\u4EF6",
|
|
62
|
+
Edit: "\u7F16\u8F91\u6587\u4EF6",
|
|
63
|
+
MultiEdit: "\u7F16\u8F91\u6587\u4EF6",
|
|
64
|
+
Ls: "\u5217\u51FA\u76EE\u5F55",
|
|
65
|
+
Glob: "\u5339\u914D\u6587\u4EF6",
|
|
66
|
+
Grep: "\u641C\u7D22\u6587\u672C",
|
|
67
|
+
WebSearch: "\u641C\u7D22\u7F51\u9875",
|
|
68
|
+
WebFetch: "\u6574\u7406\u7F51\u9875\u5185\u5BB9",
|
|
69
|
+
Agent: "\u6D3E\u751F\u5B50\u667A\u80FD\u4F53",
|
|
70
|
+
AskUserQuestion: "\u5411\u7528\u6237\u63D0\u95EE",
|
|
71
|
+
ReadSkill: "\u8BFB\u53D6\u6280\u80FD",
|
|
72
|
+
UpdatePlan: "\u66F4\u65B0\u4EFB\u52A1\u8FDB\u5EA6",
|
|
73
|
+
FinishTask: "\u4EFB\u52A1\u5B8C\u6210",
|
|
74
|
+
ExitPlanMode: "\u63D0\u4EA4\u8BA1\u5212",
|
|
75
|
+
CD: "\u5207\u6362\u5DE5\u4F5C\u76EE\u5F55",
|
|
76
|
+
RenderHtml: "\u751F\u6210\u9875\u9762",
|
|
77
|
+
submit_result: "\u63D0\u4EA4\u7ED3\u679C",
|
|
78
|
+
ListSessions: "\u5217\u51FA\u5386\u53F2\u4F1A\u8BDD",
|
|
79
|
+
GetSessionHistory: "\u8BFB\u53D6\u4F1A\u8BDD\u5386\u53F2"
|
|
80
|
+
};
|
|
81
|
+
var OUTPUT_TOOL_ICONS = {
|
|
82
|
+
Write: "\u{1F4C4}",
|
|
83
|
+
Edit: "\u{1F4DD}",
|
|
84
|
+
MultiEdit: "\u{1F4DD}"
|
|
85
|
+
};
|
|
86
|
+
var PRIORITY_FILE_KEYS = [
|
|
87
|
+
"file_path",
|
|
88
|
+
"filePath",
|
|
89
|
+
"output_file",
|
|
90
|
+
"outputFile",
|
|
91
|
+
"output_path",
|
|
92
|
+
"outputPath",
|
|
93
|
+
"path",
|
|
94
|
+
"filepath",
|
|
95
|
+
"target_file",
|
|
96
|
+
"destination",
|
|
97
|
+
"filename"
|
|
98
|
+
];
|
|
99
|
+
function safeParseJson(value) {
|
|
100
|
+
if (!value) return null;
|
|
101
|
+
try {
|
|
102
|
+
return JSON.parse(value);
|
|
103
|
+
} catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function isPlainObject(value) {
|
|
108
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
109
|
+
}
|
|
110
|
+
function getStringArgValue(args, key) {
|
|
111
|
+
const value = args?.[key];
|
|
112
|
+
return typeof value === "string" ? value.trim() : "";
|
|
113
|
+
}
|
|
114
|
+
function getCommandDescription(args) {
|
|
115
|
+
return getStringArgValue(args, "description");
|
|
116
|
+
}
|
|
117
|
+
function getToolDescription(toolCall) {
|
|
118
|
+
const args = safeParseJson(toolCall.arguments);
|
|
119
|
+
if (!isPlainObject(args)) return null;
|
|
120
|
+
return getCommandDescription(args) || null;
|
|
121
|
+
}
|
|
122
|
+
function formatFileName(filePath) {
|
|
123
|
+
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
124
|
+
}
|
|
125
|
+
var SKILL_ENTRY_FILE_NAMES = /* @__PURE__ */ new Set(["skill.md", "command.md"]);
|
|
126
|
+
var NON_SKILL_DIR_NAMES = /* @__PURE__ */ new Set([".", "..", ".agent", ".agents", ".claude", "skill_data", "skills"]);
|
|
127
|
+
function getSkillNameFromFilePath(filePath) {
|
|
128
|
+
if (!filePath) return null;
|
|
129
|
+
const segments = filePath.split(/[\\/]+/).filter(Boolean);
|
|
130
|
+
const fileName = segments.pop();
|
|
131
|
+
if (!fileName || !SKILL_ENTRY_FILE_NAMES.has(fileName.toLowerCase())) return null;
|
|
132
|
+
const dirName = segments.pop();
|
|
133
|
+
if (!dirName || NON_SKILL_DIR_NAMES.has(dirName.toLowerCase())) return null;
|
|
134
|
+
return dirName;
|
|
135
|
+
}
|
|
136
|
+
function formatToolFileName(filePath) {
|
|
137
|
+
return getSkillNameFromFilePath(filePath) ?? formatFileName(filePath);
|
|
138
|
+
}
|
|
139
|
+
function isInternalStatusFile(filePath) {
|
|
140
|
+
const fileName = formatFileName(filePath).toLowerCase();
|
|
141
|
+
return fileName === "phase.json";
|
|
142
|
+
}
|
|
143
|
+
function formatToolName(name) {
|
|
144
|
+
const trimmed = name.trim();
|
|
145
|
+
if (!trimmed) return name;
|
|
146
|
+
if (trimmed === "code:run" || trimmed === "code__run") return "CodeMode";
|
|
147
|
+
const stripped = trimmed.split(":").pop()?.split("/").pop()?.split(".").pop()?.trim() || trimmed;
|
|
148
|
+
const normalized = stripped.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
149
|
+
return TOOL_NAME_ALIASES[normalized] ?? stripped;
|
|
150
|
+
}
|
|
151
|
+
function getToolDisplayLabel(toolCall) {
|
|
152
|
+
const normalized = formatToolName(toolCall.name);
|
|
153
|
+
const args = safeParseJson(toolCall.arguments);
|
|
154
|
+
const displayName = toolCall.display_name?.trim() ?? "";
|
|
155
|
+
const explicitLabel = displayName === toolCall.name ? "" : displayName;
|
|
156
|
+
const baseLabel = explicitLabel || TOOL_DISPLAY_LABELS[normalized] || displayName || normalized;
|
|
157
|
+
const metaDisplayName = getStringArgValue(args, "_meta_display_name");
|
|
158
|
+
if (metaDisplayName) {
|
|
159
|
+
return metaDisplayName;
|
|
160
|
+
}
|
|
161
|
+
const description = getCommandDescription(args);
|
|
162
|
+
if (normalized === "BgBash") {
|
|
163
|
+
return description ? `\u540E\u53F0\u6267\u884C\uFF1A${description}` : "\u540E\u53F0\u6267\u884C\u547D\u4EE4";
|
|
164
|
+
}
|
|
165
|
+
if (normalized === "ReadSkill") {
|
|
166
|
+
const skillName = getStringArgValue(args, "skill") || getStringArgValue(args, "skill_name");
|
|
167
|
+
return skillName ? `${baseLabel}\u300C${skillName}\u300D` : baseLabel;
|
|
168
|
+
}
|
|
169
|
+
if (normalized === "Read") {
|
|
170
|
+
const skillName = getSkillNameFromFilePath(
|
|
171
|
+
getStringArgValue(args, "file_path") || getStringArgValue(args, "path")
|
|
172
|
+
);
|
|
173
|
+
if (skillName) return `\u8BFB\u53D6\u6280\u80FD\u300C${skillName}\u300D`;
|
|
174
|
+
}
|
|
175
|
+
if (normalized === "FinishTask") {
|
|
176
|
+
const title = args && typeof args.title === "string" ? args.title : "";
|
|
177
|
+
return title ? `${baseLabel}\uFF1A${title}` : baseLabel;
|
|
178
|
+
}
|
|
179
|
+
return description || baseLabel;
|
|
180
|
+
}
|
|
181
|
+
function getToolTone(status) {
|
|
182
|
+
if (status === "error" || status === "cancelled") return "failed";
|
|
183
|
+
if (status === "awaiting_answer") return "awaiting";
|
|
184
|
+
if (status === "pending") return "running";
|
|
185
|
+
return "done";
|
|
186
|
+
}
|
|
187
|
+
function getToolStatusLabel(status) {
|
|
188
|
+
if (status === "pending") return "\u8FD0\u884C\u4E2D";
|
|
189
|
+
if (status === "awaiting_answer") return "\u7B49\u5F85\u56DE\u7B54";
|
|
190
|
+
if (status === "error") return "\u9519\u8BEF";
|
|
191
|
+
if (status === "cancelled") return "\u5DF2\u53D6\u6D88";
|
|
192
|
+
return "\u5B8C\u6210";
|
|
193
|
+
}
|
|
194
|
+
function extractToolFilePath(toolCall) {
|
|
195
|
+
return extractToolFilePaths(toolCall)[0] ?? null;
|
|
196
|
+
}
|
|
197
|
+
function extractToolFilePaths(toolCall) {
|
|
198
|
+
const formattedName = formatToolName(toolCall.name);
|
|
199
|
+
const argsValue = safeParseJson(toolCall.arguments);
|
|
200
|
+
if (formattedName === "Read" || formattedName === "Write" || formattedName === "Edit" || formattedName === "MultiEdit") {
|
|
201
|
+
const paths = [];
|
|
202
|
+
const collect = (value, depth = 0, allowPlainString = false) => {
|
|
203
|
+
if (depth > 4) return;
|
|
204
|
+
if (typeof value === "string") {
|
|
205
|
+
const path = value.trim();
|
|
206
|
+
if (path && (allowPlainString || path.includes("/") || path.includes("\\") || /\.[a-z0-9]{1,8}$/i.test(path))) {
|
|
207
|
+
if (!isInternalStatusFile(path) && !paths.includes(path)) paths.push(path);
|
|
208
|
+
}
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
if (Array.isArray(value)) {
|
|
212
|
+
for (const item of value) collect(item, depth + 1, allowPlainString);
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (!isPlainObject(value)) return;
|
|
216
|
+
for (const key of PRIORITY_FILE_KEYS) collect(value[key], depth + 1, true);
|
|
217
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
218
|
+
if (!PRIORITY_FILE_KEYS.includes(key) && nested && typeof nested === "object") collect(nested, depth + 1, false);
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
collect(argsValue);
|
|
222
|
+
const collectPatchHeaders = (value) => {
|
|
223
|
+
if (typeof value === "string") {
|
|
224
|
+
for (const match of value.matchAll(/^\*\*\*\s+(?:Update|Delete|Add) File:\s*(.+)$/gm)) {
|
|
225
|
+
const path = match[1].trim();
|
|
226
|
+
if (path && !isInternalStatusFile(path) && !paths.includes(path)) paths.push(path);
|
|
227
|
+
}
|
|
228
|
+
} else if (Array.isArray(value)) {
|
|
229
|
+
for (const item of value) collectPatchHeaders(item);
|
|
230
|
+
} else if (isPlainObject(value)) {
|
|
231
|
+
for (const [key, nested] of Object.entries(value)) {
|
|
232
|
+
if (key.toLowerCase().includes("patch") || key.toLowerCase().includes("diff")) collectPatchHeaders(nested);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
collectPatchHeaders(argsValue);
|
|
237
|
+
return paths;
|
|
238
|
+
}
|
|
239
|
+
return [];
|
|
240
|
+
}
|
|
241
|
+
function getToolOutputTag(toolCall) {
|
|
242
|
+
const toolName = formatToolName(toolCall.name);
|
|
243
|
+
const filePath = extractToolFilePath(toolCall);
|
|
244
|
+
const icon = OUTPUT_TOOL_ICONS[toolName];
|
|
245
|
+
if (!icon || !filePath) return null;
|
|
246
|
+
return {
|
|
247
|
+
key: `${toolCall.id}-${filePath}`,
|
|
248
|
+
label: `${icon} ${filePath.split("/").pop() ?? filePath}`,
|
|
249
|
+
tone: "file"
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
32
253
|
// ../../node_modules/.pnpm/lucide-react@0.468.0_react@19.2.4/node_modules/lucide-react/dist/esm/createLucideIcon.js
|
|
33
254
|
import { forwardRef as forwardRef2, createElement as createElement2 } from "react";
|
|
34
255
|
|
|
@@ -4025,224 +4246,6 @@ async function copyToClipboard(text) {
|
|
|
4025
4246
|
}
|
|
4026
4247
|
}
|
|
4027
4248
|
|
|
4028
|
-
// src/chat/display-utils.ts
|
|
4029
|
-
var TOOL_NAME_ALIASES = {
|
|
4030
|
-
agent: "Agent",
|
|
4031
|
-
ask_user_question: "AskUserQuestion",
|
|
4032
|
-
bash: "Bash",
|
|
4033
|
-
bg_bash: "BgBash",
|
|
4034
|
-
code_mode_run: "CodeMode",
|
|
4035
|
-
edit: "Edit",
|
|
4036
|
-
exit_plan_mode: "ExitPlanMode",
|
|
4037
|
-
file_edit: "Edit",
|
|
4038
|
-
file_read: "Read",
|
|
4039
|
-
file_write: "Write",
|
|
4040
|
-
finish_task: "FinishTask",
|
|
4041
|
-
glob: "Glob",
|
|
4042
|
-
grep: "Grep",
|
|
4043
|
-
ls: "Ls",
|
|
4044
|
-
multi_edit: "MultiEdit",
|
|
4045
|
-
read: "Read",
|
|
4046
|
-
read_skill: "ReadSkill",
|
|
4047
|
-
update_plan: "UpdatePlan",
|
|
4048
|
-
web_fetch: "WebFetch",
|
|
4049
|
-
web_search: "WebSearch",
|
|
4050
|
-
write: "Write"
|
|
4051
|
-
};
|
|
4052
|
-
var TOOL_DISPLAY_LABELS = {
|
|
4053
|
-
Bash: "\u6267\u884C\u547D\u4EE4",
|
|
4054
|
-
BgBash: "\u540E\u53F0\u6267\u884C\u547D\u4EE4",
|
|
4055
|
-
CodeMode: "\u6267\u884C\u7A0B\u5E8F",
|
|
4056
|
-
Read: "\u8BFB\u53D6\u6587\u4EF6",
|
|
4057
|
-
Write: "\u5199\u5165\u6587\u4EF6",
|
|
4058
|
-
Edit: "\u7F16\u8F91\u6587\u4EF6",
|
|
4059
|
-
MultiEdit: "\u7F16\u8F91\u6587\u4EF6",
|
|
4060
|
-
Ls: "\u5217\u51FA\u76EE\u5F55",
|
|
4061
|
-
Glob: "\u5339\u914D\u6587\u4EF6",
|
|
4062
|
-
Grep: "\u641C\u7D22\u6587\u672C",
|
|
4063
|
-
WebSearch: "\u641C\u7D22\u7F51\u9875",
|
|
4064
|
-
WebFetch: "\u6574\u7406\u7F51\u9875\u5185\u5BB9",
|
|
4065
|
-
Agent: "\u6D3E\u751F\u5B50\u667A\u80FD\u4F53",
|
|
4066
|
-
AskUserQuestion: "\u5411\u7528\u6237\u63D0\u95EE",
|
|
4067
|
-
ReadSkill: "\u8BFB\u53D6\u6280\u80FD",
|
|
4068
|
-
UpdatePlan: "\u66F4\u65B0\u4EFB\u52A1\u8FDB\u5EA6",
|
|
4069
|
-
FinishTask: "\u4EFB\u52A1\u5B8C\u6210",
|
|
4070
|
-
ExitPlanMode: "\u63D0\u4EA4\u8BA1\u5212",
|
|
4071
|
-
ListSessions: "\u5217\u51FA\u5386\u53F2\u4F1A\u8BDD",
|
|
4072
|
-
GetSessionHistory: "\u8BFB\u53D6\u4F1A\u8BDD\u5386\u53F2"
|
|
4073
|
-
};
|
|
4074
|
-
var OUTPUT_TOOL_ICONS = {
|
|
4075
|
-
Write: "\u{1F4C4}",
|
|
4076
|
-
Edit: "\u{1F4DD}",
|
|
4077
|
-
MultiEdit: "\u{1F4DD}"
|
|
4078
|
-
};
|
|
4079
|
-
var PRIORITY_FILE_KEYS = [
|
|
4080
|
-
"file_path",
|
|
4081
|
-
"filePath",
|
|
4082
|
-
"output_file",
|
|
4083
|
-
"outputFile",
|
|
4084
|
-
"output_path",
|
|
4085
|
-
"outputPath",
|
|
4086
|
-
"path",
|
|
4087
|
-
"filepath",
|
|
4088
|
-
"target_file",
|
|
4089
|
-
"destination",
|
|
4090
|
-
"filename"
|
|
4091
|
-
];
|
|
4092
|
-
function safeParseJson(value) {
|
|
4093
|
-
if (!value) return null;
|
|
4094
|
-
try {
|
|
4095
|
-
return JSON.parse(value);
|
|
4096
|
-
} catch {
|
|
4097
|
-
return null;
|
|
4098
|
-
}
|
|
4099
|
-
}
|
|
4100
|
-
function isPlainObject(value) {
|
|
4101
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
4102
|
-
}
|
|
4103
|
-
function getStringArgValue(args, key) {
|
|
4104
|
-
const value = args?.[key];
|
|
4105
|
-
return typeof value === "string" ? value.trim() : "";
|
|
4106
|
-
}
|
|
4107
|
-
function getCommandDescription(args) {
|
|
4108
|
-
return getStringArgValue(args, "description");
|
|
4109
|
-
}
|
|
4110
|
-
function getToolDescription(toolCall) {
|
|
4111
|
-
const args = safeParseJson(toolCall.arguments);
|
|
4112
|
-
if (!isPlainObject(args)) return null;
|
|
4113
|
-
return getCommandDescription(args) || null;
|
|
4114
|
-
}
|
|
4115
|
-
function formatFileName(filePath) {
|
|
4116
|
-
return filePath.split(/[\\/]/).pop() ?? filePath;
|
|
4117
|
-
}
|
|
4118
|
-
var SKILL_ENTRY_FILE_NAMES = /* @__PURE__ */ new Set(["skill.md", "command.md"]);
|
|
4119
|
-
var NON_SKILL_DIR_NAMES = /* @__PURE__ */ new Set([".", "..", ".agent", ".agents", ".claude", "skill_data", "skills"]);
|
|
4120
|
-
function getSkillNameFromFilePath(filePath) {
|
|
4121
|
-
if (!filePath) return null;
|
|
4122
|
-
const segments = filePath.split(/[\\/]+/).filter(Boolean);
|
|
4123
|
-
const fileName = segments.pop();
|
|
4124
|
-
if (!fileName || !SKILL_ENTRY_FILE_NAMES.has(fileName.toLowerCase())) return null;
|
|
4125
|
-
const dirName = segments.pop();
|
|
4126
|
-
if (!dirName || NON_SKILL_DIR_NAMES.has(dirName.toLowerCase())) return null;
|
|
4127
|
-
return dirName;
|
|
4128
|
-
}
|
|
4129
|
-
function formatToolFileName(filePath) {
|
|
4130
|
-
return getSkillNameFromFilePath(filePath) ?? formatFileName(filePath);
|
|
4131
|
-
}
|
|
4132
|
-
function isInternalStatusFile(filePath) {
|
|
4133
|
-
const fileName = formatFileName(filePath).toLowerCase();
|
|
4134
|
-
return fileName === "phase.json";
|
|
4135
|
-
}
|
|
4136
|
-
function formatToolName(name) {
|
|
4137
|
-
const trimmed = name.trim();
|
|
4138
|
-
if (!trimmed) return name;
|
|
4139
|
-
if (trimmed === "code:run" || trimmed === "code__run") return "CodeMode";
|
|
4140
|
-
const stripped = trimmed.split(":").pop()?.split("/").pop()?.split(".").pop()?.trim() || trimmed;
|
|
4141
|
-
const normalized = stripped.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^a-zA-Z0-9]+/g, "_").replace(/^_+|_+$/g, "").toLowerCase();
|
|
4142
|
-
return TOOL_NAME_ALIASES[normalized] ?? stripped;
|
|
4143
|
-
}
|
|
4144
|
-
function getToolDisplayLabel(toolCall) {
|
|
4145
|
-
const normalized = formatToolName(toolCall.name);
|
|
4146
|
-
const args = safeParseJson(toolCall.arguments);
|
|
4147
|
-
const displayName = toolCall.display_name?.trim() ?? "";
|
|
4148
|
-
const explicitLabel = displayName === toolCall.name ? "" : displayName;
|
|
4149
|
-
const baseLabel = explicitLabel || TOOL_DISPLAY_LABELS[normalized] || displayName || normalized;
|
|
4150
|
-
const metaDisplayName = getStringArgValue(args, "_meta_display_name");
|
|
4151
|
-
if (metaDisplayName) {
|
|
4152
|
-
return metaDisplayName;
|
|
4153
|
-
}
|
|
4154
|
-
const description = getCommandDescription(args);
|
|
4155
|
-
if (normalized === "BgBash") {
|
|
4156
|
-
return description ? `\u540E\u53F0\u6267\u884C\uFF1A${description}` : "\u540E\u53F0\u6267\u884C\u547D\u4EE4";
|
|
4157
|
-
}
|
|
4158
|
-
if (normalized === "ReadSkill") {
|
|
4159
|
-
const skillName = getStringArgValue(args, "skill") || getStringArgValue(args, "skill_name");
|
|
4160
|
-
return skillName ? `${baseLabel}\u300C${skillName}\u300D` : baseLabel;
|
|
4161
|
-
}
|
|
4162
|
-
if (normalized === "Read") {
|
|
4163
|
-
const skillName = getSkillNameFromFilePath(
|
|
4164
|
-
getStringArgValue(args, "file_path") || getStringArgValue(args, "path")
|
|
4165
|
-
);
|
|
4166
|
-
if (skillName) return `\u8BFB\u53D6\u6280\u80FD\u300C${skillName}\u300D`;
|
|
4167
|
-
}
|
|
4168
|
-
if (normalized === "FinishTask") {
|
|
4169
|
-
const title = args && typeof args.title === "string" ? args.title : "";
|
|
4170
|
-
return title ? `${baseLabel}\uFF1A${title}` : baseLabel;
|
|
4171
|
-
}
|
|
4172
|
-
return description || baseLabel;
|
|
4173
|
-
}
|
|
4174
|
-
function getToolTone(status) {
|
|
4175
|
-
if (status === "error" || status === "cancelled") return "failed";
|
|
4176
|
-
if (status === "awaiting_answer") return "awaiting";
|
|
4177
|
-
if (status === "pending") return "running";
|
|
4178
|
-
return "done";
|
|
4179
|
-
}
|
|
4180
|
-
function getToolStatusLabel(status) {
|
|
4181
|
-
if (status === "pending") return "\u8FD0\u884C\u4E2D";
|
|
4182
|
-
if (status === "awaiting_answer") return "\u7B49\u5F85\u56DE\u7B54";
|
|
4183
|
-
if (status === "error") return "\u9519\u8BEF";
|
|
4184
|
-
if (status === "cancelled") return "\u5DF2\u53D6\u6D88";
|
|
4185
|
-
return "\u5B8C\u6210";
|
|
4186
|
-
}
|
|
4187
|
-
function extractToolFilePath(toolCall) {
|
|
4188
|
-
return extractToolFilePaths(toolCall)[0] ?? null;
|
|
4189
|
-
}
|
|
4190
|
-
function extractToolFilePaths(toolCall) {
|
|
4191
|
-
const formattedName = formatToolName(toolCall.name);
|
|
4192
|
-
const argsValue = safeParseJson(toolCall.arguments);
|
|
4193
|
-
if (formattedName === "Read" || formattedName === "Write" || formattedName === "Edit" || formattedName === "MultiEdit") {
|
|
4194
|
-
const paths = [];
|
|
4195
|
-
const collect = (value, depth = 0, allowPlainString = false) => {
|
|
4196
|
-
if (depth > 4) return;
|
|
4197
|
-
if (typeof value === "string") {
|
|
4198
|
-
const path = value.trim();
|
|
4199
|
-
if (path && (allowPlainString || path.includes("/") || path.includes("\\") || /\.[a-z0-9]{1,8}$/i.test(path))) {
|
|
4200
|
-
if (!isInternalStatusFile(path) && !paths.includes(path)) paths.push(path);
|
|
4201
|
-
}
|
|
4202
|
-
return;
|
|
4203
|
-
}
|
|
4204
|
-
if (Array.isArray(value)) {
|
|
4205
|
-
for (const item of value) collect(item, depth + 1, allowPlainString);
|
|
4206
|
-
return;
|
|
4207
|
-
}
|
|
4208
|
-
if (!isPlainObject(value)) return;
|
|
4209
|
-
for (const key of PRIORITY_FILE_KEYS) collect(value[key], depth + 1, true);
|
|
4210
|
-
for (const [key, nested] of Object.entries(value)) {
|
|
4211
|
-
if (!PRIORITY_FILE_KEYS.includes(key) && nested && typeof nested === "object") collect(nested, depth + 1, false);
|
|
4212
|
-
}
|
|
4213
|
-
};
|
|
4214
|
-
collect(argsValue);
|
|
4215
|
-
const collectPatchHeaders = (value) => {
|
|
4216
|
-
if (typeof value === "string") {
|
|
4217
|
-
for (const match of value.matchAll(/^\*\*\*\s+(?:Update|Delete|Add) File:\s*(.+)$/gm)) {
|
|
4218
|
-
const path = match[1].trim();
|
|
4219
|
-
if (path && !isInternalStatusFile(path) && !paths.includes(path)) paths.push(path);
|
|
4220
|
-
}
|
|
4221
|
-
} else if (Array.isArray(value)) {
|
|
4222
|
-
for (const item of value) collectPatchHeaders(item);
|
|
4223
|
-
} else if (isPlainObject(value)) {
|
|
4224
|
-
for (const [key, nested] of Object.entries(value)) {
|
|
4225
|
-
if (key.toLowerCase().includes("patch") || key.toLowerCase().includes("diff")) collectPatchHeaders(nested);
|
|
4226
|
-
}
|
|
4227
|
-
}
|
|
4228
|
-
};
|
|
4229
|
-
collectPatchHeaders(argsValue);
|
|
4230
|
-
return paths;
|
|
4231
|
-
}
|
|
4232
|
-
return [];
|
|
4233
|
-
}
|
|
4234
|
-
function getToolOutputTag(toolCall) {
|
|
4235
|
-
const toolName = formatToolName(toolCall.name);
|
|
4236
|
-
const filePath = extractToolFilePath(toolCall);
|
|
4237
|
-
const icon = OUTPUT_TOOL_ICONS[toolName];
|
|
4238
|
-
if (!icon || !filePath) return null;
|
|
4239
|
-
return {
|
|
4240
|
-
key: `${toolCall.id}-${filePath}`,
|
|
4241
|
-
label: `${icon} ${filePath.split("/").pop() ?? filePath}`,
|
|
4242
|
-
tone: "file"
|
|
4243
|
-
};
|
|
4244
|
-
}
|
|
4245
|
-
|
|
4246
4249
|
// src/components/PlanUpdateBlock.tsx
|
|
4247
4250
|
import { jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
4248
4251
|
var PLAN_STEP_STATUSES = /* @__PURE__ */ new Set(["pending", "in_progress", "completed"]);
|
|
@@ -4975,4 +4978,4 @@ lucide-react/dist/esm/lucide-react.js:
|
|
|
4975
4978
|
* See the LICENSE file in the root directory of this source tree.
|
|
4976
4979
|
*)
|
|
4977
4980
|
*/
|
|
4978
|
-
//# sourceMappingURL=chunk-
|
|
4981
|
+
//# sourceMappingURL=chunk-VSIUEXGV.js.map
|