@qwen-code/qwen-code 0.2.0 → 0.2.1-nightly.20251113.d5d96c72
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/cli.js +432 -129
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -119851,7 +119851,6 @@ var init_qwen_logger = __esm({
|
|
|
119851
119851
|
import_https_proxy_agent = __toESM(require_dist2(), 1);
|
|
119852
119852
|
init_types3();
|
|
119853
119853
|
init_safeJsonStringify();
|
|
119854
|
-
init_retry();
|
|
119855
119854
|
init_installationManager();
|
|
119856
119855
|
init_mnemonist();
|
|
119857
119856
|
init_contentGenerator();
|
|
@@ -120005,52 +120004,39 @@ var init_qwen_logger = __esm({
|
|
|
120005
120004
|
this.events.clear();
|
|
120006
120005
|
const rumPayload = await this.createRumPayload();
|
|
120007
120006
|
rumPayload.events = eventsToSend;
|
|
120008
|
-
const flushFn = /* @__PURE__ */ __name(() => new Promise((resolve24, reject) => {
|
|
120009
|
-
const body = safeJsonStringify(rumPayload);
|
|
120010
|
-
const options2 = {
|
|
120011
|
-
hostname: USAGE_STATS_HOSTNAME,
|
|
120012
|
-
path: USAGE_STATS_PATH,
|
|
120013
|
-
method: "POST",
|
|
120014
|
-
headers: {
|
|
120015
|
-
"Content-Length": Buffer3.byteLength(body),
|
|
120016
|
-
"Content-Type": "text/plain;charset=UTF-8"
|
|
120017
|
-
}
|
|
120018
|
-
};
|
|
120019
|
-
const bufs = [];
|
|
120020
|
-
const req = https.request({
|
|
120021
|
-
...options2,
|
|
120022
|
-
agent: this.getProxyAgent()
|
|
120023
|
-
}, (res) => {
|
|
120024
|
-
if (res.statusCode && (res.statusCode < 200 || res.statusCode >= 300)) {
|
|
120025
|
-
const err = new Error(`Request failed with status ${res.statusCode}`);
|
|
120026
|
-
err.status = res.statusCode;
|
|
120027
|
-
res.resume();
|
|
120028
|
-
return reject(err);
|
|
120029
|
-
}
|
|
120030
|
-
res.on("data", (buf) => bufs.push(buf));
|
|
120031
|
-
res.on("end", () => resolve24(Buffer3.concat(bufs)));
|
|
120032
|
-
});
|
|
120033
|
-
req.on("error", reject);
|
|
120034
|
-
req.end(body);
|
|
120035
|
-
}), "flushFn");
|
|
120036
120007
|
try {
|
|
120037
|
-
await
|
|
120038
|
-
|
|
120039
|
-
|
|
120040
|
-
|
|
120041
|
-
|
|
120042
|
-
|
|
120043
|
-
|
|
120044
|
-
|
|
120045
|
-
|
|
120046
|
-
|
|
120047
|
-
}
|
|
120008
|
+
await new Promise((resolve24, reject) => {
|
|
120009
|
+
const body = safeJsonStringify(rumPayload);
|
|
120010
|
+
const options2 = {
|
|
120011
|
+
hostname: USAGE_STATS_HOSTNAME,
|
|
120012
|
+
path: USAGE_STATS_PATH,
|
|
120013
|
+
method: "POST",
|
|
120014
|
+
headers: {
|
|
120015
|
+
"Content-Length": Buffer3.byteLength(body),
|
|
120016
|
+
"Content-Type": "text/plain;charset=UTF-8"
|
|
120017
|
+
}
|
|
120018
|
+
};
|
|
120019
|
+
const bufs = [];
|
|
120020
|
+
const req = https.request({
|
|
120021
|
+
...options2,
|
|
120022
|
+
agent: this.getProxyAgent()
|
|
120023
|
+
}, (res) => {
|
|
120024
|
+
if (res.statusCode && (res.statusCode < 200 || res.statusCode >= 300)) {
|
|
120025
|
+
const err = new Error(`Request failed with status ${res.statusCode}`);
|
|
120026
|
+
res.resume();
|
|
120027
|
+
return reject(err);
|
|
120028
|
+
}
|
|
120029
|
+
res.on("data", (buf) => bufs.push(buf));
|
|
120030
|
+
res.on("end", () => resolve24(Buffer3.concat(bufs)));
|
|
120031
|
+
});
|
|
120032
|
+
req.on("error", reject);
|
|
120033
|
+
req.end(body);
|
|
120048
120034
|
});
|
|
120049
120035
|
this.lastFlushTime = Date.now();
|
|
120050
120036
|
return {};
|
|
120051
120037
|
} catch (error) {
|
|
120052
120038
|
if (this.config?.getDebugMode()) {
|
|
120053
|
-
console.error("RUM flush failed
|
|
120039
|
+
console.error("RUM flush failed.", error);
|
|
120054
120040
|
}
|
|
120055
120041
|
this.requeueFailedEvents(eventsToSend);
|
|
120056
120042
|
return {};
|
|
@@ -182650,7 +182636,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
182650
182636
|
};
|
|
182651
182637
|
}
|
|
182652
182638
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
182653
|
-
const version2 = "0.2.
|
|
182639
|
+
const version2 = "0.2.1-nightly.20251113.d5d96c72";
|
|
182654
182640
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
182655
182641
|
const baseHeaders = {
|
|
182656
182642
|
"User-Agent": userAgent2
|
|
@@ -184299,7 +184285,77 @@ var init_modifiable_tool = __esm({
|
|
|
184299
184285
|
}
|
|
184300
184286
|
});
|
|
184301
184287
|
|
|
184288
|
+
// packages/core/dist/src/tools/tool-names.js
|
|
184289
|
+
var ToolNames, ToolDisplayNames, ToolNamesMigration, ToolDisplayNamesMigration;
|
|
184290
|
+
var init_tool_names = __esm({
|
|
184291
|
+
"packages/core/dist/src/tools/tool-names.js"() {
|
|
184292
|
+
"use strict";
|
|
184293
|
+
init_esbuild_shims();
|
|
184294
|
+
ToolNames = {
|
|
184295
|
+
EDIT: "edit",
|
|
184296
|
+
WRITE_FILE: "write_file",
|
|
184297
|
+
READ_FILE: "read_file",
|
|
184298
|
+
READ_MANY_FILES: "read_many_files",
|
|
184299
|
+
GREP: "grep_search",
|
|
184300
|
+
GLOB: "glob",
|
|
184301
|
+
SHELL: "run_shell_command",
|
|
184302
|
+
TODO_WRITE: "todo_write",
|
|
184303
|
+
MEMORY: "save_memory",
|
|
184304
|
+
TASK: "task",
|
|
184305
|
+
EXIT_PLAN_MODE: "exit_plan_mode",
|
|
184306
|
+
WEB_FETCH: "web_fetch",
|
|
184307
|
+
WEB_SEARCH: "web_search",
|
|
184308
|
+
LS: "list_directory"
|
|
184309
|
+
};
|
|
184310
|
+
ToolDisplayNames = {
|
|
184311
|
+
EDIT: "Edit",
|
|
184312
|
+
WRITE_FILE: "WriteFile",
|
|
184313
|
+
READ_FILE: "ReadFile",
|
|
184314
|
+
READ_MANY_FILES: "ReadManyFiles",
|
|
184315
|
+
GREP: "Grep",
|
|
184316
|
+
GLOB: "Glob",
|
|
184317
|
+
SHELL: "Shell",
|
|
184318
|
+
TODO_WRITE: "TodoWrite",
|
|
184319
|
+
MEMORY: "SaveMemory",
|
|
184320
|
+
TASK: "Task",
|
|
184321
|
+
EXIT_PLAN_MODE: "ExitPlanMode",
|
|
184322
|
+
WEB_FETCH: "WebFetch",
|
|
184323
|
+
WEB_SEARCH: "WebSearch",
|
|
184324
|
+
LS: "ListFiles"
|
|
184325
|
+
};
|
|
184326
|
+
ToolNamesMigration = {
|
|
184327
|
+
search_file_content: ToolNames.GREP,
|
|
184328
|
+
// Legacy name from grep tool
|
|
184329
|
+
replace: ToolNames.EDIT
|
|
184330
|
+
// Legacy name from edit tool
|
|
184331
|
+
};
|
|
184332
|
+
ToolDisplayNamesMigration = {
|
|
184333
|
+
SearchFiles: ToolDisplayNames.GREP,
|
|
184334
|
+
// Old display name for Grep
|
|
184335
|
+
FindFiles: ToolDisplayNames.GLOB,
|
|
184336
|
+
// Old display name for Glob
|
|
184337
|
+
ReadFolder: ToolDisplayNames.LS
|
|
184338
|
+
// Old display name for ListFiles
|
|
184339
|
+
};
|
|
184340
|
+
}
|
|
184341
|
+
});
|
|
184342
|
+
|
|
184302
184343
|
// packages/core/dist/src/utils/tool-utils.js
|
|
184344
|
+
function isToolEnabled(toolName, coreTools, excludeTools) {
|
|
184345
|
+
const aliasSet = getAliasSetForTool(toolName);
|
|
184346
|
+
const matchesIdentifier = /* @__PURE__ */ __name((value) => aliasSet.has(sanitizeExactIdentifier(value)), "matchesIdentifier");
|
|
184347
|
+
const matchesIdentifierWithArgs = /* @__PURE__ */ __name((value) => aliasSet.has(sanitizePatternIdentifier(value)), "matchesIdentifierWithArgs");
|
|
184348
|
+
const filteredCore = filterList(coreTools);
|
|
184349
|
+
const filteredExclude = filterList(excludeTools);
|
|
184350
|
+
if (filteredCore.length === 0) {
|
|
184351
|
+
return !filteredExclude.some((entry) => matchesIdentifier(entry));
|
|
184352
|
+
}
|
|
184353
|
+
const isExplicitlyEnabled = filteredCore.some((entry) => matchesIdentifier(entry) || matchesIdentifierWithArgs(entry));
|
|
184354
|
+
if (!isExplicitlyEnabled) {
|
|
184355
|
+
return false;
|
|
184356
|
+
}
|
|
184357
|
+
return !filteredExclude.some((entry) => matchesIdentifier(entry));
|
|
184358
|
+
}
|
|
184303
184359
|
function doesToolInvocationMatch(toolOrToolName, invocation, patterns) {
|
|
184304
184360
|
let toolNames;
|
|
184305
184361
|
if (isTool(toolOrToolName)) {
|
|
@@ -184335,12 +184391,61 @@ function doesToolInvocationMatch(toolOrToolName, invocation, patterns) {
|
|
|
184335
184391
|
}
|
|
184336
184392
|
return false;
|
|
184337
184393
|
}
|
|
184338
|
-
var SHELL_TOOL_NAMES;
|
|
184394
|
+
var normalizeIdentifier, toolNameKeys, TOOL_ALIAS_MAP, getAliasSetForTool, sanitizeExactIdentifier, sanitizePatternIdentifier, filterList, SHELL_TOOL_NAMES;
|
|
184339
184395
|
var init_tool_utils = __esm({
|
|
184340
184396
|
"packages/core/dist/src/utils/tool-utils.js"() {
|
|
184341
184397
|
"use strict";
|
|
184342
184398
|
init_esbuild_shims();
|
|
184343
184399
|
init_src();
|
|
184400
|
+
init_tool_names();
|
|
184401
|
+
normalizeIdentifier = /* @__PURE__ */ __name((identifier2) => identifier2.trim().replace(/^_+/, ""), "normalizeIdentifier");
|
|
184402
|
+
toolNameKeys = Object.keys(ToolNames);
|
|
184403
|
+
TOOL_ALIAS_MAP = (() => {
|
|
184404
|
+
const map2 = /* @__PURE__ */ new Map();
|
|
184405
|
+
const addAlias = /* @__PURE__ */ __name((set, alias) => {
|
|
184406
|
+
if (!alias) {
|
|
184407
|
+
return;
|
|
184408
|
+
}
|
|
184409
|
+
set.add(normalizeIdentifier(alias));
|
|
184410
|
+
}, "addAlias");
|
|
184411
|
+
for (const key of toolNameKeys) {
|
|
184412
|
+
const canonicalName = ToolNames[key];
|
|
184413
|
+
const displayName = ToolDisplayNames[key];
|
|
184414
|
+
const aliases = /* @__PURE__ */ new Set();
|
|
184415
|
+
addAlias(aliases, canonicalName);
|
|
184416
|
+
addAlias(aliases, displayName);
|
|
184417
|
+
addAlias(aliases, `${displayName}Tool`);
|
|
184418
|
+
for (const [legacyName, mappedName] of Object.entries(ToolNamesMigration)) {
|
|
184419
|
+
if (mappedName === canonicalName) {
|
|
184420
|
+
addAlias(aliases, legacyName);
|
|
184421
|
+
}
|
|
184422
|
+
}
|
|
184423
|
+
for (const [legacyDisplay, mappedDisplay] of Object.entries(ToolDisplayNamesMigration)) {
|
|
184424
|
+
if (mappedDisplay === displayName) {
|
|
184425
|
+
addAlias(aliases, legacyDisplay);
|
|
184426
|
+
}
|
|
184427
|
+
}
|
|
184428
|
+
map2.set(canonicalName, aliases);
|
|
184429
|
+
}
|
|
184430
|
+
return map2;
|
|
184431
|
+
})();
|
|
184432
|
+
getAliasSetForTool = /* @__PURE__ */ __name((toolName) => {
|
|
184433
|
+
const aliases = TOOL_ALIAS_MAP.get(toolName);
|
|
184434
|
+
if (!aliases) {
|
|
184435
|
+
return /* @__PURE__ */ new Set([normalizeIdentifier(toolName)]);
|
|
184436
|
+
}
|
|
184437
|
+
return aliases;
|
|
184438
|
+
}, "getAliasSetForTool");
|
|
184439
|
+
sanitizeExactIdentifier = /* @__PURE__ */ __name((value) => normalizeIdentifier(value), "sanitizeExactIdentifier");
|
|
184440
|
+
sanitizePatternIdentifier = /* @__PURE__ */ __name((value) => {
|
|
184441
|
+
const openParenIndex = value.indexOf("(");
|
|
184442
|
+
if (openParenIndex === -1) {
|
|
184443
|
+
return normalizeIdentifier(value);
|
|
184444
|
+
}
|
|
184445
|
+
return normalizeIdentifier(value.slice(0, openParenIndex));
|
|
184446
|
+
}, "sanitizePatternIdentifier");
|
|
184447
|
+
filterList = /* @__PURE__ */ __name((list3) => (list3 ?? []).filter((entry) => Boolean(entry && entry.trim())), "filterList");
|
|
184448
|
+
__name(isToolEnabled, "isToolEnabled");
|
|
184344
184449
|
SHELL_TOOL_NAMES = ["run_shell_command", "ShellTool"];
|
|
184345
184450
|
__name(doesToolInvocationMatch, "doesToolInvocationMatch");
|
|
184346
184451
|
}
|
|
@@ -184438,30 +184543,6 @@ var require_levenshtein = __commonJS({
|
|
|
184438
184543
|
}
|
|
184439
184544
|
});
|
|
184440
184545
|
|
|
184441
|
-
// packages/core/dist/src/tools/tool-names.js
|
|
184442
|
-
var ToolNames;
|
|
184443
|
-
var init_tool_names = __esm({
|
|
184444
|
-
"packages/core/dist/src/tools/tool-names.js"() {
|
|
184445
|
-
"use strict";
|
|
184446
|
-
init_esbuild_shims();
|
|
184447
|
-
ToolNames = {
|
|
184448
|
-
EDIT: "edit",
|
|
184449
|
-
WRITE_FILE: "write_file",
|
|
184450
|
-
READ_FILE: "read_file",
|
|
184451
|
-
READ_MANY_FILES: "read_many_files",
|
|
184452
|
-
GREP: "grep_search",
|
|
184453
|
-
GLOB: "glob",
|
|
184454
|
-
SHELL: "run_shell_command",
|
|
184455
|
-
TODO_WRITE: "todo_write",
|
|
184456
|
-
MEMORY: "save_memory",
|
|
184457
|
-
TASK: "task",
|
|
184458
|
-
EXIT_PLAN_MODE: "exit_plan_mode",
|
|
184459
|
-
WEB_FETCH: "web_fetch",
|
|
184460
|
-
WEB_SEARCH: "web_search"
|
|
184461
|
-
};
|
|
184462
|
-
}
|
|
184463
|
-
});
|
|
184464
|
-
|
|
184465
184546
|
// packages/core/dist/src/utils/gitUtils.js
|
|
184466
184547
|
import * as fs18 from "node:fs";
|
|
184467
184548
|
import * as path14 from "node:path";
|
|
@@ -184730,6 +184811,7 @@ var init_memoryTool = __esm({
|
|
|
184730
184811
|
init_lib();
|
|
184731
184812
|
init_diffOptions();
|
|
184732
184813
|
init_paths();
|
|
184814
|
+
init_tool_names();
|
|
184733
184815
|
init_tool_error();
|
|
184734
184816
|
memoryToolSchemaData = {
|
|
184735
184817
|
name: "save_memory",
|
|
@@ -184934,9 +185016,9 @@ Project: ${projectPath} (current project only)`;
|
|
|
184934
185016
|
static {
|
|
184935
185017
|
__name(this, "MemoryTool");
|
|
184936
185018
|
}
|
|
184937
|
-
static Name =
|
|
185019
|
+
static Name = ToolNames.MEMORY;
|
|
184938
185020
|
constructor() {
|
|
184939
|
-
super(_MemoryTool.Name,
|
|
185021
|
+
super(_MemoryTool.Name, ToolDisplayNames.MEMORY, memoryToolDescription, Kind.Think, memoryToolSchemaData.parametersJsonSchema);
|
|
184940
185022
|
}
|
|
184941
185023
|
validateToolParamValues(params) {
|
|
184942
185024
|
if (params.fact.trim() === "") {
|
|
@@ -197171,7 +197253,7 @@ Co-authored-by: ${gitCoAuthorSettings.name} <${gitCoAuthorSettings.email}>`;
|
|
|
197171
197253
|
constructor(config) {
|
|
197172
197254
|
super(
|
|
197173
197255
|
_ShellTool.Name,
|
|
197174
|
-
|
|
197256
|
+
ToolDisplayNames.SHELL,
|
|
197175
197257
|
getShellToolDescription(),
|
|
197176
197258
|
Kind.Execute,
|
|
197177
197259
|
{
|
|
@@ -200472,7 +200554,7 @@ var init_task = __esm({
|
|
|
200472
200554
|
};
|
|
200473
200555
|
super(
|
|
200474
200556
|
_TaskTool.Name,
|
|
200475
|
-
|
|
200557
|
+
ToolDisplayNames.TASK,
|
|
200476
200558
|
"Delegate tasks to specialized subagents. Loading available subagents...",
|
|
200477
200559
|
// Initial description
|
|
200478
200560
|
Kind.Other,
|
|
@@ -219506,7 +219588,7 @@ ${result.llmContent}`;
|
|
|
219506
219588
|
config;
|
|
219507
219589
|
static Name = ToolNames.READ_FILE;
|
|
219508
219590
|
constructor(config) {
|
|
219509
|
-
super(_ReadFileTool.Name,
|
|
219591
|
+
super(_ReadFileTool.Name, ToolDisplayNames.READ_FILE, `Reads and returns the content of a specified file. If the file is large, the content will be truncated. The tool's response will clearly indicate if truncation has occurred and will provide details on how to read more of the file using the 'offset' and 'limit' parameters. Handles text, images (PNG, JPG, GIF, WEBP, SVG, BMP), and PDF files. For text files, it can read specific line ranges.`, Kind.Read, {
|
|
219510
219592
|
properties: {
|
|
219511
219593
|
absolute_path: {
|
|
219512
219594
|
description: "The absolute path to the file to read (e.g., '/home/user/project/file.txt'). Relative paths are not supported. You must provide an absolute path.",
|
|
@@ -230335,7 +230417,7 @@ var init_edit = __esm({
|
|
|
230335
230417
|
config;
|
|
230336
230418
|
static Name = ToolNames.EDIT;
|
|
230337
230419
|
constructor(config) {
|
|
230338
|
-
super(_EditTool.Name,
|
|
230420
|
+
super(_EditTool.Name, ToolDisplayNames.EDIT, `Replaces text within a file. By default, replaces a single occurrence, but can replace multiple occurrences when \`expected_replacements\` is specified. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${ReadFileTool.Name} tool to examine the file's current content before attempting a text replacement.
|
|
230339
230421
|
|
|
230340
230422
|
The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
|
|
230341
230423
|
|
|
@@ -230435,6 +230517,7 @@ var init_exitPlanMode = __esm({
|
|
|
230435
230517
|
init_esbuild_shims();
|
|
230436
230518
|
init_tools();
|
|
230437
230519
|
init_config3();
|
|
230520
|
+
init_tool_names();
|
|
230438
230521
|
exitPlanModeToolDescription = `Use this tool when you are in plan mode and have finished presenting your plan and are ready to code. This will prompt the user to exit plan mode.
|
|
230439
230522
|
IMPORTANT: Only use this tool when the task requires planning the implementation steps of a task that requires writing code. For research tasks where you're gathering information, searching files, reading files or in general trying to understand the codebase - do NOT use this tool.
|
|
230440
230523
|
|
|
@@ -230543,9 +230626,9 @@ Eg.
|
|
|
230543
230626
|
__name(this, "ExitPlanModeTool");
|
|
230544
230627
|
}
|
|
230545
230628
|
config;
|
|
230546
|
-
static Name =
|
|
230629
|
+
static Name = ToolNames.EXIT_PLAN_MODE;
|
|
230547
230630
|
constructor(config) {
|
|
230548
|
-
super(_ExitPlanModeTool.Name,
|
|
230631
|
+
super(_ExitPlanModeTool.Name, ToolDisplayNames.EXIT_PLAN_MODE, exitPlanModeToolDescription, Kind.Think, exitPlanModeToolSchemaData.parametersJsonSchema);
|
|
230549
230632
|
this.config = config;
|
|
230550
230633
|
}
|
|
230551
230634
|
validateToolParams(params) {
|
|
@@ -230698,7 +230781,7 @@ ${fileListDescription}`;
|
|
|
230698
230781
|
config;
|
|
230699
230782
|
static Name = ToolNames.GLOB;
|
|
230700
230783
|
constructor(config) {
|
|
230701
|
-
super(_GlobTool.Name,
|
|
230784
|
+
super(_GlobTool.Name, ToolDisplayNames.GLOB, 'Fast file pattern matching tool that works with any codebase size\n- Supports glob patterns like "**/*.js" or "src/**/*.ts"\n- Returns matching file paths sorted by modification time\n- Use this tool when you need to find files by name patterns\n- When you are doing an open ended search that may require multiple rounds of globbing and grepping, use the Agent tool instead\n- You have the capability to call multiple tools in a single response. It is always better to speculatively perform multiple searches as a batch that are potentially useful.', Kind.Search, {
|
|
230702
230785
|
properties: {
|
|
230703
230786
|
pattern: {
|
|
230704
230787
|
description: "The glob pattern to match files against",
|
|
@@ -231095,7 +231178,7 @@ var init_grep2 = __esm({
|
|
|
231095
231178
|
config;
|
|
231096
231179
|
static Name = ToolNames.GREP;
|
|
231097
231180
|
constructor(config) {
|
|
231098
|
-
super(_GrepTool.Name,
|
|
231181
|
+
super(_GrepTool.Name, ToolDisplayNames.GREP, 'A powerful search tool for finding patterns in files\n\n Usage:\n - ALWAYS use Grep for search tasks. NEVER invoke `grep` or `rg` as a Bash command. The Grep tool has been optimized for correct permissions and access.\n - Supports full regex syntax (e.g., "log.*Error", "function\\s+\\w+")\n - Filter files with glob parameter (e.g., "*.js", "**/*.tsx")\n - Case-insensitive by default\n - Use Task tool for open-ended searches requiring multiple rounds\n', Kind.Search, {
|
|
231099
231182
|
properties: {
|
|
231100
231183
|
pattern: {
|
|
231101
231184
|
type: "string",
|
|
@@ -231158,6 +231241,7 @@ var init_ls = __esm({
|
|
|
231158
231241
|
init_paths();
|
|
231159
231242
|
init_constants3();
|
|
231160
231243
|
init_tool_error();
|
|
231244
|
+
init_tool_names();
|
|
231161
231245
|
LSToolInvocation = class extends BaseToolInvocation {
|
|
231162
231246
|
static {
|
|
231163
231247
|
__name(this, "LSToolInvocation");
|
|
@@ -231293,9 +231377,9 @@ ${directoryContent}`;
|
|
|
231293
231377
|
__name(this, "LSTool");
|
|
231294
231378
|
}
|
|
231295
231379
|
config;
|
|
231296
|
-
static Name =
|
|
231380
|
+
static Name = ToolNames.LS;
|
|
231297
231381
|
constructor(config) {
|
|
231298
|
-
super(_LSTool.Name,
|
|
231382
|
+
super(_LSTool.Name, ToolDisplayNames.LS, "Lists the names of files and subdirectories directly within a specified directory path. Can optionally ignore entries matching provided glob patterns.", Kind.Search, {
|
|
231299
231383
|
properties: {
|
|
231300
231384
|
path: {
|
|
231301
231385
|
description: "The absolute path to the directory to list (must be absolute, not relative)",
|
|
@@ -231702,7 +231786,7 @@ ${fileContentForLlm}
|
|
|
231702
231786
|
},
|
|
231703
231787
|
required: ["paths"]
|
|
231704
231788
|
};
|
|
231705
|
-
super(_ReadManyFilesTool.Name,
|
|
231789
|
+
super(_ReadManyFilesTool.Name, ToolDisplayNames.READ_MANY_FILES, `Reads content from multiple files specified by paths or glob patterns within a configured target directory. For text files, it concatenates their content into a single string. It is primarily designed for text-based files. However, it can also process image (e.g., .png, .jpg) and PDF (.pdf) files if their file names or extensions are explicitly included in the 'paths' argument. For these explicitly requested non-text files, their data is read and included in a format suitable for model consumption (e.g., base64 encoded).
|
|
231706
231790
|
|
|
231707
231791
|
This tool is useful when you need to understand or analyze a collection of files, such as:
|
|
231708
231792
|
- Getting an overview of a codebase or parts of it (e.g., all TypeScript files in the 'src' directory).
|
|
@@ -232911,6 +232995,7 @@ var init_todoWrite = __esm({
|
|
|
232911
232995
|
init_esbuild_shims();
|
|
232912
232996
|
init_tools();
|
|
232913
232997
|
init_paths();
|
|
232998
|
+
init_tool_names();
|
|
232914
232999
|
todoWriteToolSchemaData = {
|
|
232915
233000
|
name: "todo_write",
|
|
232916
233001
|
description: "Creates and manages a structured task list for your current coding session. This helps track progress, organize complex tasks, and demonstrate thoroughness.",
|
|
@@ -233198,9 +233283,9 @@ Todo list modification failed with error: ${errorMessage}. You may need to retry
|
|
|
233198
233283
|
__name(this, "TodoWriteTool");
|
|
233199
233284
|
}
|
|
233200
233285
|
config;
|
|
233201
|
-
static Name =
|
|
233286
|
+
static Name = ToolNames.TODO_WRITE;
|
|
233202
233287
|
constructor(config) {
|
|
233203
|
-
super(_TodoWriteTool.Name,
|
|
233288
|
+
super(_TodoWriteTool.Name, ToolDisplayNames.TODO_WRITE, todoWriteToolDescription, Kind.Think, todoWriteToolSchemaData.parametersJsonSchema);
|
|
233204
233289
|
this.config = config;
|
|
233205
233290
|
}
|
|
233206
233291
|
validateToolParams(params) {
|
|
@@ -241803,7 +241888,7 @@ ${textContent2}
|
|
|
241803
241888
|
config;
|
|
241804
241889
|
static Name = ToolNames.WEB_FETCH;
|
|
241805
241890
|
constructor(config) {
|
|
241806
|
-
super(_WebFetchTool.Name,
|
|
241891
|
+
super(_WebFetchTool.Name, ToolDisplayNames.WEB_FETCH, `Fetches content from a specified URL and processes it using an AI model
|
|
241807
241892
|
- Takes a URL and a prompt as input
|
|
241808
241893
|
- Fetches the URL content, converts HTML to markdown
|
|
241809
241894
|
- Processes the content with the prompt using a small, fast model
|
|
@@ -242319,7 +242404,7 @@ ${content}`,
|
|
|
242319
242404
|
config;
|
|
242320
242405
|
static Name = ToolNames.WEB_SEARCH;
|
|
242321
242406
|
constructor(config) {
|
|
242322
|
-
super(_WebSearchTool.Name,
|
|
242407
|
+
super(_WebSearchTool.Name, ToolDisplayNames.WEB_SEARCH, "Allows searching the web and using results to inform responses. Provides up-to-date information for current events and recent data beyond the training data cutoff. Returns search results formatted with concise answers and source links. Use this tool when accessing information that may be outdated or beyond the knowledge cutoff.", Kind.Search, {
|
|
242323
242408
|
type: "object",
|
|
242324
242409
|
properties: {
|
|
242325
242410
|
query: {
|
|
@@ -242555,7 +242640,7 @@ var init_write_file = __esm({
|
|
|
242555
242640
|
config;
|
|
242556
242641
|
static Name = ToolNames.WRITE_FILE;
|
|
242557
242642
|
constructor(config) {
|
|
242558
|
-
super(_WriteFileTool.Name,
|
|
242643
|
+
super(_WriteFileTool.Name, ToolDisplayNames.WRITE_FILE, `Writes content to a specified file in the local filesystem.
|
|
242559
242644
|
|
|
242560
242645
|
The user has the ability to modify \`content\`. If modified, this will be stated in the response.`, Kind.Edit, {
|
|
242561
242646
|
properties: {
|
|
@@ -243205,6 +243290,7 @@ var init_subagent_manager = __esm({
|
|
|
243205
243290
|
init_validation();
|
|
243206
243291
|
init_subagent();
|
|
243207
243292
|
init_builtin_agents();
|
|
243293
|
+
init_tool_names();
|
|
243208
243294
|
QWEN_CONFIG_DIR2 = ".qwen";
|
|
243209
243295
|
AGENT_CONFIG_DIR = "agents";
|
|
243210
243296
|
SubagentManager = class {
|
|
@@ -243599,7 +243685,7 @@ ${config.systemPrompt}
|
|
|
243599
243685
|
result.push(exactNameMatch.name);
|
|
243600
243686
|
continue;
|
|
243601
243687
|
}
|
|
243602
|
-
const displayNameMatch = allTools.find((tool) => tool.displayName === toolIdentifier);
|
|
243688
|
+
const displayNameMatch = allTools.find((tool) => tool.displayName === toolIdentifier || tool.displayName === ToolDisplayNamesMigration[toolIdentifier]);
|
|
243603
243689
|
if (displayNameMatch) {
|
|
243604
243690
|
result.push(displayNameMatch.name);
|
|
243605
243691
|
continue;
|
|
@@ -243945,6 +244031,7 @@ var init_config3 = __esm({
|
|
|
243945
244031
|
init_browser();
|
|
243946
244032
|
init_ignorePatterns();
|
|
243947
244033
|
init_workspaceContext();
|
|
244034
|
+
init_tool_utils();
|
|
243948
244035
|
init_constants3();
|
|
243949
244036
|
init_models();
|
|
243950
244037
|
init_storage();
|
|
@@ -244607,22 +244694,22 @@ var init_config3 = __esm({
|
|
|
244607
244694
|
}
|
|
244608
244695
|
async createToolRegistry() {
|
|
244609
244696
|
const registry = new ToolRegistry(this, this.eventEmitter);
|
|
244697
|
+
const coreToolsConfig = this.getCoreTools();
|
|
244698
|
+
const excludeToolsConfig = this.getExcludeTools();
|
|
244610
244699
|
const registerCoreTool = /* @__PURE__ */ __name((ToolClass, ...args) => {
|
|
244611
|
-
const
|
|
244612
|
-
const
|
|
244613
|
-
|
|
244614
|
-
|
|
244615
|
-
|
|
244616
|
-
|
|
244617
|
-
if (
|
|
244618
|
-
|
|
244619
|
-
|
|
244620
|
-
|
|
244621
|
-
|
|
244622
|
-
|
|
244623
|
-
|
|
244624
|
-
if (isEnabled2) {
|
|
244625
|
-
registry.registerTool(new ToolClass(...args));
|
|
244700
|
+
const toolName = ToolClass?.Name;
|
|
244701
|
+
const className = ToolClass?.name ?? "UnknownTool";
|
|
244702
|
+
if (!toolName) {
|
|
244703
|
+
console.warn(`[Config] Skipping tool registration: ${className} is missing static Name property. Tools must define a static Name property to be registered. Location: config.ts:registerCoreTool`);
|
|
244704
|
+
return;
|
|
244705
|
+
}
|
|
244706
|
+
if (isToolEnabled(toolName, coreToolsConfig, excludeToolsConfig)) {
|
|
244707
|
+
try {
|
|
244708
|
+
registry.registerTool(new ToolClass(...args));
|
|
244709
|
+
} catch (error) {
|
|
244710
|
+
console.error(`[Config] Failed to register tool ${className} (${toolName}):`, error);
|
|
244711
|
+
throw error;
|
|
244712
|
+
}
|
|
244626
244713
|
}
|
|
244627
244714
|
}, "registerCoreTool");
|
|
244628
244715
|
registerCoreTool(TaskTool, this);
|
|
@@ -252075,6 +252162,8 @@ var init_src = __esm({
|
|
|
252075
252162
|
init_read_many_files();
|
|
252076
252163
|
init_mcp_client();
|
|
252077
252164
|
init_mcp_tool();
|
|
252165
|
+
init_task();
|
|
252166
|
+
init_todoWrite();
|
|
252078
252167
|
init_oauth_provider();
|
|
252079
252168
|
init_oauth_token_storage();
|
|
252080
252169
|
init_oauth_utils();
|
|
@@ -338601,7 +338690,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
338601
338690
|
// packages/cli/src/utils/version.ts
|
|
338602
338691
|
async function getCliVersion() {
|
|
338603
338692
|
const pkgJson = await getPackageJson();
|
|
338604
|
-
return "0.2.
|
|
338693
|
+
return "0.2.1-nightly.20251113.d5d96c72";
|
|
338605
338694
|
}
|
|
338606
338695
|
__name(getCliVersion, "getCliVersion");
|
|
338607
338696
|
|
|
@@ -340212,7 +340301,7 @@ import { execSync as execSync4 } from "node:child_process";
|
|
|
340212
340301
|
|
|
340213
340302
|
// packages/cli/src/generated/git-commit.ts
|
|
340214
340303
|
init_esbuild_shims();
|
|
340215
|
-
var GIT_COMMIT_INFO2 = "
|
|
340304
|
+
var GIT_COMMIT_INFO2 = "1a02e4b7";
|
|
340216
340305
|
|
|
340217
340306
|
// packages/cli/src/utils/systemInfo.ts
|
|
340218
340307
|
async function getNpmVersion() {
|
|
@@ -353781,7 +353870,6 @@ init_esbuild_shims();
|
|
|
353781
353870
|
// packages/cli/src/zed-integration/acp.ts
|
|
353782
353871
|
init_esbuild_shims();
|
|
353783
353872
|
init_zod();
|
|
353784
|
-
import { EOL as EOL4 } from "node:os";
|
|
353785
353873
|
|
|
353786
353874
|
// packages/cli/src/zed-integration/schema.ts
|
|
353787
353875
|
init_esbuild_shims();
|
|
@@ -354187,7 +354275,7 @@ var Connection = class {
|
|
|
354187
354275
|
const decoder = new TextDecoder();
|
|
354188
354276
|
for await (const chunk of output) {
|
|
354189
354277
|
content += decoder.decode(chunk, { stream: true });
|
|
354190
|
-
const lines = content.split(
|
|
354278
|
+
const lines = content.split("\n");
|
|
354191
354279
|
content = lines.pop() || "";
|
|
354192
354280
|
for (const line of lines) {
|
|
354193
354281
|
const trimmedLine = line.trim();
|
|
@@ -354640,13 +354728,23 @@ var Session2 = class {
|
|
|
354640
354728
|
new Error(`Tool "${fc.name}" not found in registry.`)
|
|
354641
354729
|
);
|
|
354642
354730
|
}
|
|
354731
|
+
const isTodoWriteTool = fc.name === TodoWriteTool.Name || tool.name === TodoWriteTool.Name;
|
|
354732
|
+
let subAgentToolEventListeners = [];
|
|
354643
354733
|
try {
|
|
354644
354734
|
const invocation = tool.build(args);
|
|
354735
|
+
const isTaskTool = tool.name === TaskTool.Name;
|
|
354736
|
+
if (isTaskTool && "eventEmitter" in invocation) {
|
|
354737
|
+
const taskEventEmitter = invocation.eventEmitter;
|
|
354738
|
+
subAgentToolEventListeners = this.setupSubAgentToolTracking(
|
|
354739
|
+
taskEventEmitter,
|
|
354740
|
+
abortSignal
|
|
354741
|
+
);
|
|
354742
|
+
}
|
|
354645
354743
|
const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
354646
354744
|
if (confirmationDetails) {
|
|
354647
|
-
const
|
|
354745
|
+
const content = [];
|
|
354648
354746
|
if (confirmationDetails.type === "edit") {
|
|
354649
|
-
|
|
354747
|
+
content.push({
|
|
354650
354748
|
type: "diff",
|
|
354651
354749
|
path: confirmationDetails.fileName,
|
|
354652
354750
|
oldText: confirmationDetails.originalContent,
|
|
@@ -354660,7 +354758,7 @@ var Session2 = class {
|
|
|
354660
354758
|
toolCallId: callId,
|
|
354661
354759
|
status: "pending",
|
|
354662
354760
|
title: invocation.getDescription(),
|
|
354663
|
-
content
|
|
354761
|
+
content,
|
|
354664
354762
|
locations: invocation.toolLocations(),
|
|
354665
354763
|
kind: tool.kind
|
|
354666
354764
|
}
|
|
@@ -354684,7 +354782,7 @@ var Session2 = class {
|
|
|
354684
354782
|
throw new Error(`Unexpected: ${resultOutcome}`);
|
|
354685
354783
|
}
|
|
354686
354784
|
}
|
|
354687
|
-
} else {
|
|
354785
|
+
} else if (!isTodoWriteTool) {
|
|
354688
354786
|
await this.sendUpdate({
|
|
354689
354787
|
sessionUpdate: "tool_call",
|
|
354690
354788
|
toolCallId: callId,
|
|
@@ -354696,13 +354794,31 @@ var Session2 = class {
|
|
|
354696
354794
|
});
|
|
354697
354795
|
}
|
|
354698
354796
|
const toolResult = await invocation.execute(abortSignal);
|
|
354699
|
-
|
|
354700
|
-
|
|
354701
|
-
|
|
354702
|
-
|
|
354703
|
-
|
|
354704
|
-
|
|
354705
|
-
|
|
354797
|
+
subAgentToolEventListeners.forEach((cleanup) => cleanup());
|
|
354798
|
+
if (isTodoWriteTool) {
|
|
354799
|
+
let todos = [];
|
|
354800
|
+
if (Array.isArray(args["todos"])) {
|
|
354801
|
+
todos = args["todos"];
|
|
354802
|
+
}
|
|
354803
|
+
if (toolResult.returnDisplay && typeof toolResult.returnDisplay === "object" && "type" in toolResult.returnDisplay && toolResult.returnDisplay.type === "todo_list" && "todos" in toolResult.returnDisplay && Array.isArray(toolResult.returnDisplay.todos)) {
|
|
354804
|
+
todos = toolResult.returnDisplay.todos;
|
|
354805
|
+
}
|
|
354806
|
+
if (todos.length > 0 || Array.isArray(args["todos"])) {
|
|
354807
|
+
const planEntries = convertTodosToPlanEntries(todos);
|
|
354808
|
+
await this.sendUpdate({
|
|
354809
|
+
sessionUpdate: "plan",
|
|
354810
|
+
entries: planEntries
|
|
354811
|
+
});
|
|
354812
|
+
}
|
|
354813
|
+
} else {
|
|
354814
|
+
const content = toToolCallContent(toolResult);
|
|
354815
|
+
await this.sendUpdate({
|
|
354816
|
+
sessionUpdate: "tool_call_update",
|
|
354817
|
+
toolCallId: callId,
|
|
354818
|
+
status: "completed",
|
|
354819
|
+
content: content ? [content] : []
|
|
354820
|
+
});
|
|
354821
|
+
}
|
|
354706
354822
|
const durationMs = Date.now() - startTime;
|
|
354707
354823
|
logToolCall(this.config, {
|
|
354708
354824
|
"event.name": "tool_call",
|
|
@@ -354717,6 +354833,7 @@ var Session2 = class {
|
|
|
354717
354833
|
});
|
|
354718
354834
|
return convertToFunctionResponse(fc.name, callId, toolResult.llmContent);
|
|
354719
354835
|
} catch (e2) {
|
|
354836
|
+
subAgentToolEventListeners.forEach((cleanup) => cleanup());
|
|
354720
354837
|
const error = e2 instanceof Error ? e2 : new Error(String(e2));
|
|
354721
354838
|
await this.sendUpdate({
|
|
354722
354839
|
sessionUpdate: "tool_call_update",
|
|
@@ -354729,6 +354846,196 @@ var Session2 = class {
|
|
|
354729
354846
|
return errorResponse(error);
|
|
354730
354847
|
}
|
|
354731
354848
|
}
|
|
354849
|
+
/**
|
|
354850
|
+
* Sets up event listeners to track sub-agent tool calls within a TaskTool execution.
|
|
354851
|
+
* Converts subagent tool call events into zedIntegration session updates.
|
|
354852
|
+
*
|
|
354853
|
+
* @param eventEmitter - The SubAgentEventEmitter from TaskTool
|
|
354854
|
+
* @param abortSignal - Signal to abort tracking if parent is cancelled
|
|
354855
|
+
* @returns Array of cleanup functions to remove event listeners
|
|
354856
|
+
*/
|
|
354857
|
+
setupSubAgentToolTracking(eventEmitter, abortSignal) {
|
|
354858
|
+
const cleanupFunctions2 = [];
|
|
354859
|
+
const toolRegistry = this.config.getToolRegistry();
|
|
354860
|
+
const subAgentToolStates = /* @__PURE__ */ new Map();
|
|
354861
|
+
const onToolCall = /* @__PURE__ */ __name((...args) => {
|
|
354862
|
+
const event = args[0];
|
|
354863
|
+
if (abortSignal.aborted) return;
|
|
354864
|
+
const subAgentTool = toolRegistry.getTool(event.name);
|
|
354865
|
+
let subAgentInvocation;
|
|
354866
|
+
let toolKind = "other";
|
|
354867
|
+
let locations = [];
|
|
354868
|
+
if (subAgentTool) {
|
|
354869
|
+
try {
|
|
354870
|
+
subAgentInvocation = subAgentTool.build(event.args);
|
|
354871
|
+
toolKind = this.mapToolKind(subAgentTool.kind);
|
|
354872
|
+
locations = subAgentInvocation.toolLocations().map((loc) => ({
|
|
354873
|
+
path: loc.path,
|
|
354874
|
+
line: loc.line ?? null
|
|
354875
|
+
}));
|
|
354876
|
+
} catch (e2) {
|
|
354877
|
+
console.warn(`Failed to build subagent tool ${event.name}:`, e2);
|
|
354878
|
+
}
|
|
354879
|
+
}
|
|
354880
|
+
subAgentToolStates.set(event.callId, {
|
|
354881
|
+
tool: subAgentTool,
|
|
354882
|
+
invocation: subAgentInvocation,
|
|
354883
|
+
args: event.args
|
|
354884
|
+
});
|
|
354885
|
+
if (event.name === TodoWriteTool.Name) {
|
|
354886
|
+
return;
|
|
354887
|
+
}
|
|
354888
|
+
void this.sendUpdate({
|
|
354889
|
+
sessionUpdate: "tool_call",
|
|
354890
|
+
toolCallId: event.callId,
|
|
354891
|
+
status: "in_progress",
|
|
354892
|
+
title: event.description || event.name,
|
|
354893
|
+
content: [],
|
|
354894
|
+
locations,
|
|
354895
|
+
kind: toolKind,
|
|
354896
|
+
rawInput: event.args
|
|
354897
|
+
});
|
|
354898
|
+
}, "onToolCall");
|
|
354899
|
+
const onToolResult = /* @__PURE__ */ __name((...args) => {
|
|
354900
|
+
const event = args[0];
|
|
354901
|
+
if (abortSignal.aborted) return;
|
|
354902
|
+
const state = subAgentToolStates.get(event.callId);
|
|
354903
|
+
if (event.name === TodoWriteTool.Name) {
|
|
354904
|
+
let todos;
|
|
354905
|
+
if (event.resultDisplay) {
|
|
354906
|
+
try {
|
|
354907
|
+
const parsed = typeof event.resultDisplay === "string" ? JSON.parse(event.resultDisplay) : event.resultDisplay;
|
|
354908
|
+
if (typeof parsed === "object" && parsed !== null && "type" in parsed && parsed.type === "todo_list" && "todos" in parsed && Array.isArray(parsed.todos)) {
|
|
354909
|
+
todos = parsed.todos;
|
|
354910
|
+
}
|
|
354911
|
+
} catch {
|
|
354912
|
+
}
|
|
354913
|
+
}
|
|
354914
|
+
if (!todos && state?.args && Array.isArray(state.args["todos"])) {
|
|
354915
|
+
todos = state.args["todos"];
|
|
354916
|
+
}
|
|
354917
|
+
if (todos) {
|
|
354918
|
+
const planEntries = convertTodosToPlanEntries(todos);
|
|
354919
|
+
void this.sendUpdate({
|
|
354920
|
+
sessionUpdate: "plan",
|
|
354921
|
+
entries: planEntries
|
|
354922
|
+
});
|
|
354923
|
+
}
|
|
354924
|
+
subAgentToolStates.delete(event.callId);
|
|
354925
|
+
return;
|
|
354926
|
+
}
|
|
354927
|
+
let content = [];
|
|
354928
|
+
if (event.resultDisplay && state?.invocation) {
|
|
354929
|
+
if (typeof event.resultDisplay === "string") {
|
|
354930
|
+
content = [
|
|
354931
|
+
{
|
|
354932
|
+
type: "content",
|
|
354933
|
+
content: {
|
|
354934
|
+
type: "text",
|
|
354935
|
+
text: event.resultDisplay
|
|
354936
|
+
}
|
|
354937
|
+
}
|
|
354938
|
+
];
|
|
354939
|
+
}
|
|
354940
|
+
}
|
|
354941
|
+
void this.sendUpdate({
|
|
354942
|
+
sessionUpdate: "tool_call_update",
|
|
354943
|
+
toolCallId: event.callId,
|
|
354944
|
+
status: event.success ? "completed" : "failed",
|
|
354945
|
+
content: content.length > 0 ? content : [],
|
|
354946
|
+
title: state?.invocation?.getDescription() ?? event.name,
|
|
354947
|
+
kind: state?.tool ? this.mapToolKind(state.tool.kind) : null,
|
|
354948
|
+
locations: state?.invocation?.toolLocations().map((loc) => ({
|
|
354949
|
+
path: loc.path,
|
|
354950
|
+
line: loc.line ?? null
|
|
354951
|
+
})) ?? null,
|
|
354952
|
+
rawInput: state?.args
|
|
354953
|
+
});
|
|
354954
|
+
subAgentToolStates.delete(event.callId);
|
|
354955
|
+
}, "onToolResult");
|
|
354956
|
+
const onToolWaitingApproval = /* @__PURE__ */ __name(async (...args) => {
|
|
354957
|
+
const event = args[0];
|
|
354958
|
+
if (abortSignal.aborted) return;
|
|
354959
|
+
const state = subAgentToolStates.get(event.callId);
|
|
354960
|
+
const content = [];
|
|
354961
|
+
if (event.confirmationDetails.type === "edit") {
|
|
354962
|
+
const editDetails = event.confirmationDetails;
|
|
354963
|
+
content.push({
|
|
354964
|
+
type: "diff",
|
|
354965
|
+
path: editDetails.fileName,
|
|
354966
|
+
oldText: editDetails.originalContent ?? "",
|
|
354967
|
+
newText: editDetails.newContent
|
|
354968
|
+
});
|
|
354969
|
+
}
|
|
354970
|
+
const fullConfirmationDetails = {
|
|
354971
|
+
...event.confirmationDetails,
|
|
354972
|
+
onConfirm: /* @__PURE__ */ __name(async () => {
|
|
354973
|
+
}, "onConfirm")
|
|
354974
|
+
};
|
|
354975
|
+
const params = {
|
|
354976
|
+
sessionId: this.id,
|
|
354977
|
+
options: toPermissionOptions(fullConfirmationDetails),
|
|
354978
|
+
toolCall: {
|
|
354979
|
+
toolCallId: event.callId,
|
|
354980
|
+
status: "pending",
|
|
354981
|
+
title: event.description || event.name,
|
|
354982
|
+
content,
|
|
354983
|
+
locations: state?.invocation?.toolLocations().map((loc) => ({
|
|
354984
|
+
path: loc.path,
|
|
354985
|
+
line: loc.line ?? null
|
|
354986
|
+
})) ?? [],
|
|
354987
|
+
kind: state?.tool ? this.mapToolKind(state.tool.kind) : "other",
|
|
354988
|
+
rawInput: state?.args
|
|
354989
|
+
}
|
|
354990
|
+
};
|
|
354991
|
+
try {
|
|
354992
|
+
const output = await this.client.requestPermission(params);
|
|
354993
|
+
const outcome = output.outcome.outcome === "cancelled" ? ToolConfirmationOutcome.Cancel : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
354994
|
+
await event.respond(outcome);
|
|
354995
|
+
} catch (error) {
|
|
354996
|
+
console.error(
|
|
354997
|
+
`Permission request failed for subagent tool ${event.name}:`,
|
|
354998
|
+
error
|
|
354999
|
+
);
|
|
355000
|
+
await event.respond(ToolConfirmationOutcome.Cancel);
|
|
355001
|
+
}
|
|
355002
|
+
}, "onToolWaitingApproval");
|
|
355003
|
+
eventEmitter.on(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
355004
|
+
eventEmitter.on(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
355005
|
+
eventEmitter.on(
|
|
355006
|
+
SubAgentEventType.TOOL_WAITING_APPROVAL,
|
|
355007
|
+
onToolWaitingApproval
|
|
355008
|
+
);
|
|
355009
|
+
cleanupFunctions2.push(() => {
|
|
355010
|
+
eventEmitter.off(SubAgentEventType.TOOL_CALL, onToolCall);
|
|
355011
|
+
eventEmitter.off(SubAgentEventType.TOOL_RESULT, onToolResult);
|
|
355012
|
+
eventEmitter.off(
|
|
355013
|
+
SubAgentEventType.TOOL_WAITING_APPROVAL,
|
|
355014
|
+
onToolWaitingApproval
|
|
355015
|
+
);
|
|
355016
|
+
});
|
|
355017
|
+
return cleanupFunctions2;
|
|
355018
|
+
}
|
|
355019
|
+
/**
|
|
355020
|
+
* Maps core Tool Kind enum to ACP ToolKind string literals.
|
|
355021
|
+
*
|
|
355022
|
+
* @param kind - The core Kind enum value
|
|
355023
|
+
* @returns The corresponding ACP ToolKind string literal
|
|
355024
|
+
*/
|
|
355025
|
+
mapToolKind(kind) {
|
|
355026
|
+
const kindMap = {
|
|
355027
|
+
[Kind.Read]: "read",
|
|
355028
|
+
[Kind.Edit]: "edit",
|
|
355029
|
+
[Kind.Delete]: "delete",
|
|
355030
|
+
[Kind.Move]: "move",
|
|
355031
|
+
[Kind.Search]: "search",
|
|
355032
|
+
[Kind.Execute]: "execute",
|
|
355033
|
+
[Kind.Think]: "think",
|
|
355034
|
+
[Kind.Fetch]: "fetch",
|
|
355035
|
+
[Kind.Other]: "other"
|
|
355036
|
+
};
|
|
355037
|
+
return kindMap[kind] ?? "other";
|
|
355038
|
+
}
|
|
354732
355039
|
async #resolvePrompt(message, abortSignal) {
|
|
354733
355040
|
const FILE_URI_SCHEME = "file://";
|
|
354734
355041
|
const embeddedContext = [];
|
|
@@ -355017,6 +355324,15 @@ Content from @${contextPart.uri}:
|
|
|
355017
355324
|
}
|
|
355018
355325
|
}
|
|
355019
355326
|
};
|
|
355327
|
+
function convertTodosToPlanEntries(todos) {
|
|
355328
|
+
return todos.map((todo) => ({
|
|
355329
|
+
content: todo.content,
|
|
355330
|
+
priority: "medium",
|
|
355331
|
+
// Default priority since todos don't have priority
|
|
355332
|
+
status: todo.status
|
|
355333
|
+
}));
|
|
355334
|
+
}
|
|
355335
|
+
__name(convertTodosToPlanEntries, "convertTodosToPlanEntries");
|
|
355020
355336
|
function toToolCallContent(toolResult) {
|
|
355021
355337
|
if (toolResult.error?.message) {
|
|
355022
355338
|
throw new Error(toolResult.error.message);
|
|
@@ -355027,19 +355343,6 @@ function toToolCallContent(toolResult) {
|
|
|
355027
355343
|
type: "content",
|
|
355028
355344
|
content: { type: "text", text: toolResult.returnDisplay }
|
|
355029
355345
|
};
|
|
355030
|
-
} else if ("type" in toolResult.returnDisplay && toolResult.returnDisplay.type === "todo_list") {
|
|
355031
|
-
const todoText = toolResult.returnDisplay.todos.map((todo) => {
|
|
355032
|
-
const statusIcon = {
|
|
355033
|
-
pending: "\u25CB",
|
|
355034
|
-
in_progress: "\u25D0",
|
|
355035
|
-
completed: "\u25CF"
|
|
355036
|
-
}[todo.status];
|
|
355037
|
-
return `${statusIcon} ${todo.content}`;
|
|
355038
|
-
}).join("\n");
|
|
355039
|
-
return {
|
|
355040
|
-
type: "content",
|
|
355041
|
-
content: { type: "text", text: todoText }
|
|
355042
|
-
};
|
|
355043
355346
|
} else if ("type" in toolResult.returnDisplay && toolResult.returnDisplay.type === "plan_summary") {
|
|
355044
355347
|
const planDisplay = toolResult.returnDisplay;
|
|
355045
355348
|
const planText = `${planDisplay.message}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qwen-code/qwen-code",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-nightly.20251113.d5d96c72",
|
|
4
4
|
"description": "Qwen Code - AI-powered coding assistant",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"config": {
|
|
22
|
-
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.2.
|
|
22
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.2.1-nightly.20251113.d5d96c72"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"tiktoken": "^1.0.21"
|