@rdmind/rdmind 0.0.24-alpha.0 → 0.0.24-alpha.1
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 +406 -188
- package/package.json +2 -2
package/cli.js
CHANGED
|
@@ -113679,7 +113679,7 @@ function hasCycleInSchema(schema) {
|
|
|
113679
113679
|
__name(traverse, "traverse");
|
|
113680
113680
|
return traverse(schema, /* @__PURE__ */ new Set(), /* @__PURE__ */ new Set());
|
|
113681
113681
|
}
|
|
113682
|
-
var BaseToolInvocation, DeclarativeTool, BaseDeclarativeTool, ToolConfirmationOutcome
|
|
113682
|
+
var BaseToolInvocation, DeclarativeTool, BaseDeclarativeTool, ToolConfirmationOutcome;
|
|
113683
113683
|
var init_tools = __esm({
|
|
113684
113684
|
"packages/core/src/tools/tools.ts"() {
|
|
113685
113685
|
"use strict";
|
|
@@ -113829,12 +113829,6 @@ var init_tools = __esm({
|
|
|
113829
113829
|
ToolConfirmationOutcome2["Cancel"] = "cancel";
|
|
113830
113830
|
return ToolConfirmationOutcome2;
|
|
113831
113831
|
})(ToolConfirmationOutcome || {});
|
|
113832
|
-
MUTATOR_KINDS = [
|
|
113833
|
-
"edit" /* Edit */,
|
|
113834
|
-
"delete" /* Delete */,
|
|
113835
|
-
"move" /* Move */,
|
|
113836
|
-
"execute" /* Execute */
|
|
113837
|
-
];
|
|
113838
113832
|
}
|
|
113839
113833
|
});
|
|
113840
113834
|
|
|
@@ -183770,7 +183764,7 @@ function createContentGeneratorConfig(config, authType, generationConfig) {
|
|
|
183770
183764
|
};
|
|
183771
183765
|
}
|
|
183772
183766
|
async function createContentGenerator(config, gcConfig, sessionId2) {
|
|
183773
|
-
const version2 = "0.0.24-alpha.
|
|
183767
|
+
const version2 = "0.0.24-alpha.1";
|
|
183774
183768
|
const userAgent2 = `QwenCode/${version2} (${process.platform}; ${process.arch})`;
|
|
183775
183769
|
const baseHeaders = {
|
|
183776
183770
|
"User-Agent": userAgent2
|
|
@@ -185672,7 +185666,9 @@ var init_tool_names = __esm({
|
|
|
185672
185666
|
TODO_WRITE: "todo_write",
|
|
185673
185667
|
MEMORY: "save_memory",
|
|
185674
185668
|
TASK: "task",
|
|
185675
|
-
EXIT_PLAN_MODE: "exit_plan_mode"
|
|
185669
|
+
EXIT_PLAN_MODE: "exit_plan_mode",
|
|
185670
|
+
WEB_FETCH: "web_fetch",
|
|
185671
|
+
WEB_SEARCH: "web_search"
|
|
185676
185672
|
};
|
|
185677
185673
|
}
|
|
185678
185674
|
});
|
|
@@ -198655,10 +198651,7 @@ async function truncateAndSaveToFile(content, callId, projectTempDir, threshold,
|
|
|
198655
198651
|
return {
|
|
198656
198652
|
content: `Tool output was too large and has been truncated.
|
|
198657
198653
|
The full output has been saved to: ${outputFile}
|
|
198658
|
-
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
198659
|
-
- ${ReadFileTool.Name} tool with offset=0, limit=100 to see the first 100 lines
|
|
198660
|
-
- ${ReadFileTool.Name} tool with offset=N to skip N lines from the beginning
|
|
198661
|
-
- ${ReadFileTool.Name} tool with limit=M to read only M lines at a time
|
|
198654
|
+
To read the complete output, use the ${ReadFileTool.Name} tool with the absolute file path above.
|
|
198662
198655
|
The truncated output below shows the beginning and end of the content. The marker '... [CONTENT TRUNCATED] ...' indicates where content was removed.
|
|
198663
198656
|
This allows you to efficiently examine different parts of the output without loading the entire file.
|
|
198664
198657
|
Truncated part of the output:
|
|
@@ -199112,7 +199105,7 @@ var init_coreToolScheduler = __esm({
|
|
|
199112
199105
|
);
|
|
199113
199106
|
}
|
|
199114
199107
|
}
|
|
199115
|
-
this.attemptExecutionOfScheduledCalls(signal);
|
|
199108
|
+
await this.attemptExecutionOfScheduledCalls(signal);
|
|
199116
199109
|
void this.checkAndNotifyCompletion();
|
|
199117
199110
|
} finally {
|
|
199118
199111
|
this.isScheduling = false;
|
|
@@ -199171,7 +199164,7 @@ var init_coreToolScheduler = __esm({
|
|
|
199171
199164
|
}
|
|
199172
199165
|
this.setStatusInternal(callId, "scheduled");
|
|
199173
199166
|
}
|
|
199174
|
-
this.attemptExecutionOfScheduledCalls(signal);
|
|
199167
|
+
await this.attemptExecutionOfScheduledCalls(signal);
|
|
199175
199168
|
}
|
|
199176
199169
|
/**
|
|
199177
199170
|
* Applies user-provided content changes to a tool call that is awaiting confirmation.
|
|
@@ -199205,7 +199198,7 @@ var init_coreToolScheduler = __esm({
|
|
|
199205
199198
|
fileDiff: updatedDiff
|
|
199206
199199
|
});
|
|
199207
199200
|
}
|
|
199208
|
-
attemptExecutionOfScheduledCalls(signal) {
|
|
199201
|
+
async attemptExecutionOfScheduledCalls(signal) {
|
|
199209
199202
|
const allCallsFinalOrScheduled = this.toolCalls.every(
|
|
199210
199203
|
(call) => call.status === "scheduled" || call.status === "cancelled" || call.status === "success" || call.status === "error"
|
|
199211
199204
|
);
|
|
@@ -199213,8 +199206,8 @@ var init_coreToolScheduler = __esm({
|
|
|
199213
199206
|
const callsToExecute = this.toolCalls.filter(
|
|
199214
199207
|
(call) => call.status === "scheduled"
|
|
199215
199208
|
);
|
|
199216
|
-
|
|
199217
|
-
if (toolCall.status !== "scheduled")
|
|
199209
|
+
for (const toolCall of callsToExecute) {
|
|
199210
|
+
if (toolCall.status !== "scheduled") continue;
|
|
199218
199211
|
const scheduledCall = toolCall;
|
|
199219
199212
|
const { callId, name: toolName } = scheduledCall.request;
|
|
199220
199213
|
const invocation = scheduledCall.invocation;
|
|
@@ -199250,14 +199243,15 @@ var init_coreToolScheduler = __esm({
|
|
|
199250
199243
|
shellExecutionConfig
|
|
199251
199244
|
);
|
|
199252
199245
|
}
|
|
199253
|
-
|
|
199246
|
+
try {
|
|
199247
|
+
const toolResult = await promise;
|
|
199254
199248
|
if (signal.aborted) {
|
|
199255
199249
|
this.setStatusInternal(
|
|
199256
199250
|
callId,
|
|
199257
199251
|
"cancelled",
|
|
199258
199252
|
"User cancelled tool execution."
|
|
199259
199253
|
);
|
|
199260
|
-
|
|
199254
|
+
continue;
|
|
199261
199255
|
}
|
|
199262
199256
|
if (toolResult.error === void 0) {
|
|
199263
199257
|
let content = toolResult.llmContent;
|
|
@@ -199316,7 +199310,7 @@ var init_coreToolScheduler = __esm({
|
|
|
199316
199310
|
);
|
|
199317
199311
|
this.setStatusInternal(callId, "error", errorResponse);
|
|
199318
199312
|
}
|
|
199319
|
-
}
|
|
199313
|
+
} catch (executionError) {
|
|
199320
199314
|
if (signal.aborted) {
|
|
199321
199315
|
this.setStatusInternal(
|
|
199322
199316
|
callId,
|
|
@@ -199334,8 +199328,8 @@ var init_coreToolScheduler = __esm({
|
|
|
199334
199328
|
)
|
|
199335
199329
|
);
|
|
199336
199330
|
}
|
|
199337
|
-
}
|
|
199338
|
-
}
|
|
199331
|
+
}
|
|
199332
|
+
}
|
|
199339
199333
|
}
|
|
199340
199334
|
}
|
|
199341
199335
|
async checkAndNotifyCompletion() {
|
|
@@ -200266,7 +200260,7 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
200266
200260
|
const modelResponseParts = [];
|
|
200267
200261
|
let hasToolCall = false;
|
|
200268
200262
|
let hasFinishReason = false;
|
|
200269
|
-
for await (const chunk of
|
|
200263
|
+
for await (const chunk of streamResponse2) {
|
|
200270
200264
|
hasFinishReason = chunk?.candidates?.some((candidate) => candidate.finishReason) ?? false;
|
|
200271
200265
|
if (isValidResponse2(chunk)) {
|
|
200272
200266
|
const content = chunk.candidates?.[0]?.content;
|
|
@@ -200349,55 +200343,6 @@ This error was probably caused by cyclic schema references in one of the followi
|
|
|
200349
200343
|
});
|
|
200350
200344
|
}
|
|
200351
200345
|
}
|
|
200352
|
-
/**
|
|
200353
|
-
* Truncates the chunkStream right before the second function call to a
|
|
200354
|
-
* function that mutates state. This may involve trimming parts from a chunk
|
|
200355
|
-
* as well as omtting some chunks altogether.
|
|
200356
|
-
*
|
|
200357
|
-
* We do this because it improves tool call quality if the model gets
|
|
200358
|
-
* feedback from one mutating function call before it makes the next one.
|
|
200359
|
-
*/
|
|
200360
|
-
async *stopBeforeSecondMutator(chunkStream) {
|
|
200361
|
-
let foundMutatorFunctionCall = false;
|
|
200362
|
-
for await (const chunk of chunkStream) {
|
|
200363
|
-
const candidate = chunk.candidates?.[0];
|
|
200364
|
-
const content = candidate?.content;
|
|
200365
|
-
if (!candidate || !content?.parts) {
|
|
200366
|
-
yield chunk;
|
|
200367
|
-
continue;
|
|
200368
|
-
}
|
|
200369
|
-
const truncatedParts = [];
|
|
200370
|
-
for (const part of content.parts) {
|
|
200371
|
-
if (this.isMutatorFunctionCall(part)) {
|
|
200372
|
-
if (foundMutatorFunctionCall) {
|
|
200373
|
-
const newChunk = new GenerateContentResponse();
|
|
200374
|
-
newChunk.candidates = [
|
|
200375
|
-
{
|
|
200376
|
-
...candidate,
|
|
200377
|
-
content: {
|
|
200378
|
-
...content,
|
|
200379
|
-
parts: truncatedParts
|
|
200380
|
-
},
|
|
200381
|
-
finishReason: FinishReason.STOP
|
|
200382
|
-
}
|
|
200383
|
-
];
|
|
200384
|
-
yield newChunk;
|
|
200385
|
-
return;
|
|
200386
|
-
}
|
|
200387
|
-
foundMutatorFunctionCall = true;
|
|
200388
|
-
}
|
|
200389
|
-
truncatedParts.push(part);
|
|
200390
|
-
}
|
|
200391
|
-
yield chunk;
|
|
200392
|
-
}
|
|
200393
|
-
}
|
|
200394
|
-
isMutatorFunctionCall(part) {
|
|
200395
|
-
if (!part?.functionCall?.name) {
|
|
200396
|
-
return false;
|
|
200397
|
-
}
|
|
200398
|
-
const tool = this.config.getToolRegistry().getTool(part.functionCall.name);
|
|
200399
|
-
return !!tool && MUTATOR_KINDS.includes(tool.kind);
|
|
200400
|
-
}
|
|
200401
200346
|
};
|
|
200402
200347
|
__name(isSchemaDepthError, "isSchemaDepthError");
|
|
200403
200348
|
__name(isInvalidArgumentError, "isInvalidArgumentError");
|
|
@@ -200859,6 +200804,9 @@ ${result.llmContent}`
|
|
|
200859
200804
|
return initialParts;
|
|
200860
200805
|
}
|
|
200861
200806
|
async function getInitialChatHistory(config, extraHistory) {
|
|
200807
|
+
if (config.getSkipStartupContext()) {
|
|
200808
|
+
return extraHistory ? [...extraHistory] : [];
|
|
200809
|
+
}
|
|
200862
200810
|
const envParts = await getEnvironmentContext(config);
|
|
200863
200811
|
const envContextString = envParts.map((part) => part.text || "").join("\n\n");
|
|
200864
200812
|
return [
|
|
@@ -200932,7 +200880,8 @@ var init_chatCompressionService = __esm({
|
|
|
200932
200880
|
}
|
|
200933
200881
|
async compress(chat, promptId, force, model, config, hasFailedCompressionAttempt) {
|
|
200934
200882
|
const curatedHistory = chat.getHistory(true);
|
|
200935
|
-
|
|
200883
|
+
const threshold = config.getChatCompression()?.contextPercentageThreshold ?? COMPRESSION_TOKEN_THRESHOLD;
|
|
200884
|
+
if (curatedHistory.length === 0 || threshold <= 0 || hasFailedCompressionAttempt && !force) {
|
|
200936
200885
|
return {
|
|
200937
200886
|
newHistory: null,
|
|
200938
200887
|
info: {
|
|
@@ -200943,9 +200892,7 @@ var init_chatCompressionService = __esm({
|
|
|
200943
200892
|
};
|
|
200944
200893
|
}
|
|
200945
200894
|
const originalTokenCount = uiTelemetryService.getLastPromptTokenCount();
|
|
200946
|
-
const contextPercentageThreshold = config.getChatCompression()?.contextPercentageThreshold;
|
|
200947
200895
|
if (!force) {
|
|
200948
|
-
const threshold = contextPercentageThreshold ?? COMPRESSION_TOKEN_THRESHOLD;
|
|
200949
200896
|
if (originalTokenCount < threshold * tokenLimit(model)) {
|
|
200950
200897
|
return {
|
|
200951
200898
|
newHistory: null,
|
|
@@ -220946,7 +220893,8 @@ async function detectFileType(filePath) {
|
|
|
220946
220893
|
}
|
|
220947
220894
|
return "text";
|
|
220948
220895
|
}
|
|
220949
|
-
async function processSingleFileContent(filePath,
|
|
220896
|
+
async function processSingleFileContent(filePath, config, offset, limit2) {
|
|
220897
|
+
const rootDirectory = config.getTargetDir();
|
|
220950
220898
|
try {
|
|
220951
220899
|
if (!fs30.existsSync(filePath)) {
|
|
220952
220900
|
return {
|
|
@@ -220999,39 +220947,61 @@ async function processSingleFileContent(filePath, rootDirectory, fileSystemServi
|
|
|
220999
220947
|
}
|
|
221000
220948
|
case "text": {
|
|
221001
220949
|
const content = await readFileWithEncoding(filePath);
|
|
221002
|
-
const lines = content.split("\n");
|
|
220950
|
+
const lines = content.split("\n").map((line) => line.trimEnd());
|
|
221003
220951
|
const originalLineCount = lines.length;
|
|
221004
220952
|
const startLine = offset || 0;
|
|
221005
|
-
const
|
|
220953
|
+
const configLineLimit = config.getTruncateToolOutputLines();
|
|
220954
|
+
const configCharLimit = config.getTruncateToolOutputThreshold();
|
|
220955
|
+
const effectiveLimit = limit2 === void 0 ? configLineLimit : limit2;
|
|
221006
220956
|
const endLine = Math.min(startLine + effectiveLimit, originalLineCount);
|
|
221007
220957
|
const actualStartLine = Math.min(startLine, originalLineCount);
|
|
221008
220958
|
const selectedLines = lines.slice(actualStartLine, endLine);
|
|
221009
|
-
let
|
|
221010
|
-
|
|
221011
|
-
|
|
221012
|
-
|
|
221013
|
-
|
|
220959
|
+
let llmContent = "";
|
|
220960
|
+
let contentLengthTruncated = false;
|
|
220961
|
+
let linesIncluded = 0;
|
|
220962
|
+
if (Number.isFinite(configCharLimit)) {
|
|
220963
|
+
const formattedLines = [];
|
|
220964
|
+
let currentLength = 0;
|
|
220965
|
+
for (const line of selectedLines) {
|
|
220966
|
+
const sep7 = linesIncluded > 0 ? 1 : 0;
|
|
220967
|
+
linesIncluded++;
|
|
220968
|
+
const projectedLength = currentLength + line.length + sep7;
|
|
220969
|
+
if (projectedLength <= configCharLimit) {
|
|
220970
|
+
formattedLines.push(line);
|
|
220971
|
+
currentLength = projectedLength;
|
|
220972
|
+
} else {
|
|
220973
|
+
const remaining = Math.max(
|
|
220974
|
+
configCharLimit - currentLength - sep7,
|
|
220975
|
+
10
|
|
220976
|
+
);
|
|
220977
|
+
formattedLines.push(
|
|
220978
|
+
line.substring(0, remaining) + "... [truncated]"
|
|
220979
|
+
);
|
|
220980
|
+
contentLengthTruncated = true;
|
|
220981
|
+
break;
|
|
220982
|
+
}
|
|
221014
220983
|
}
|
|
221015
|
-
|
|
221016
|
-
}
|
|
221017
|
-
|
|
221018
|
-
|
|
221019
|
-
|
|
220984
|
+
llmContent = formattedLines.join("\n");
|
|
220985
|
+
} else {
|
|
220986
|
+
llmContent = selectedLines.join("\n");
|
|
220987
|
+
linesIncluded = selectedLines.length;
|
|
220988
|
+
}
|
|
220989
|
+
const actualEndLine = contentLengthTruncated ? actualStartLine + linesIncluded : endLine;
|
|
220990
|
+
const contentRangeTruncated = startLine > 0 || actualEndLine < originalLineCount;
|
|
220991
|
+
const isTruncated = contentRangeTruncated || contentLengthTruncated;
|
|
221020
220992
|
let returnDisplay = "";
|
|
221021
|
-
if (
|
|
221022
|
-
returnDisplay = `Read lines ${actualStartLine + 1}-${
|
|
221023
|
-
if (
|
|
221024
|
-
returnDisplay += " (
|
|
220993
|
+
if (isTruncated) {
|
|
220994
|
+
returnDisplay = `Read lines ${actualStartLine + 1}-${actualEndLine} of ${originalLineCount} from ${relativePathForDisplay}`;
|
|
220995
|
+
if (contentLengthTruncated) {
|
|
220996
|
+
returnDisplay += " (truncated)";
|
|
221025
220997
|
}
|
|
221026
|
-
} else if (linesWereTruncatedInLength) {
|
|
221027
|
-
returnDisplay = `Read all ${originalLineCount} lines from ${relativePathForDisplay} (some lines were shortened)`;
|
|
221028
220998
|
}
|
|
221029
220999
|
return {
|
|
221030
221000
|
llmContent,
|
|
221031
221001
|
returnDisplay,
|
|
221032
221002
|
isTruncated,
|
|
221033
221003
|
originalLineCount,
|
|
221034
|
-
linesShown: [actualStartLine + 1,
|
|
221004
|
+
linesShown: [actualStartLine + 1, actualEndLine]
|
|
221035
221005
|
};
|
|
221036
221006
|
}
|
|
221037
221007
|
case "image":
|
|
@@ -221078,7 +221048,7 @@ async function fileExists(filePath) {
|
|
|
221078
221048
|
return false;
|
|
221079
221049
|
}
|
|
221080
221050
|
}
|
|
221081
|
-
var
|
|
221051
|
+
var DEFAULT_ENCODING;
|
|
221082
221052
|
var init_fileUtils = __esm({
|
|
221083
221053
|
"packages/core/src/utils/fileUtils.ts"() {
|
|
221084
221054
|
"use strict";
|
|
@@ -221086,8 +221056,6 @@ var init_fileUtils = __esm({
|
|
|
221086
221056
|
init_index_lite();
|
|
221087
221057
|
init_tool_error();
|
|
221088
221058
|
init_ignorePatterns();
|
|
221089
|
-
DEFAULT_MAX_LINES_TEXT_FILE = 2e3;
|
|
221090
|
-
MAX_LINE_LENGTH_TEXT_FILE = 2e3;
|
|
221091
221059
|
DEFAULT_ENCODING = "utf-8";
|
|
221092
221060
|
__name(detectBOM, "detectBOM");
|
|
221093
221061
|
__name(decodeUTF16BE, "decodeUTF16BE");
|
|
@@ -221260,8 +221228,7 @@ var init_read_file = __esm({
|
|
|
221260
221228
|
async execute() {
|
|
221261
221229
|
const result = await processSingleFileContent(
|
|
221262
221230
|
this.params.absolute_path,
|
|
221263
|
-
this.config
|
|
221264
|
-
this.config.getFileSystemService(),
|
|
221231
|
+
this.config,
|
|
221265
221232
|
this.params.offset,
|
|
221266
221233
|
this.params.limit
|
|
221267
221234
|
);
|
|
@@ -221279,13 +221246,10 @@ var init_read_file = __esm({
|
|
|
221279
221246
|
if (result.isTruncated) {
|
|
221280
221247
|
const [start, end] = result.linesShown;
|
|
221281
221248
|
const total = result.originalLineCount;
|
|
221282
|
-
|
|
221283
|
-
|
|
221284
|
-
|
|
221285
|
-
Status: Showing lines ${start}-${end} of ${total} total lines.
|
|
221286
|
-
Action: To read more of the file, you can use the 'offset' and 'limit' parameters in a subsequent 'read_file' call. For example, to read the next section of the file, use offset: ${nextOffset}.
|
|
221249
|
+
llmContent = `Showing lines ${start}-${end} of ${total} total lines.
|
|
221250
|
+
|
|
221251
|
+
---
|
|
221287
221252
|
|
|
221288
|
-
--- FILE CONTENT (truncated) ---
|
|
221289
221253
|
${result.llmContent}`;
|
|
221290
221254
|
} else {
|
|
221291
221255
|
llmContent = result.llmContent || "";
|
|
@@ -221412,7 +221376,7 @@ function verifyVSCode(ide, ideProcessInfo) {
|
|
|
221412
221376
|
if (ide.name !== IDE_DEFINITIONS.vscode.name) {
|
|
221413
221377
|
return ide;
|
|
221414
221378
|
}
|
|
221415
|
-
if (ideProcessInfo.command.toLowerCase().includes("code")) {
|
|
221379
|
+
if (ideProcessInfo.command && ideProcessInfo.command.toLowerCase().includes("code")) {
|
|
221416
221380
|
return IDE_DEFINITIONS.vscode;
|
|
221417
221381
|
}
|
|
221418
221382
|
return IDE_DEFINITIONS.vscodefork;
|
|
@@ -232708,8 +232672,12 @@ var init_glob2 = __esm({
|
|
|
232708
232672
|
oneDayInMs
|
|
232709
232673
|
);
|
|
232710
232674
|
const totalFileCount = sortedEntries.length;
|
|
232711
|
-
const
|
|
232712
|
-
|
|
232675
|
+
const fileLimit = Math.min(
|
|
232676
|
+
MAX_FILE_COUNT,
|
|
232677
|
+
this.config.getTruncateToolOutputLines()
|
|
232678
|
+
);
|
|
232679
|
+
const truncated = totalFileCount > fileLimit;
|
|
232680
|
+
const entriesToShow = truncated ? sortedEntries.slice(0, fileLimit) : sortedEntries;
|
|
232713
232681
|
const sortedAbsolutePaths = entriesToShow.map(
|
|
232714
232682
|
(entry) => entry.fullpath()
|
|
232715
232683
|
);
|
|
@@ -232719,7 +232687,7 @@ var init_glob2 = __esm({
|
|
|
232719
232687
|
---
|
|
232720
232688
|
${fileListDescription}`;
|
|
232721
232689
|
if (truncated) {
|
|
232722
|
-
const omittedFiles = totalFileCount -
|
|
232690
|
+
const omittedFiles = totalFileCount - fileLimit;
|
|
232723
232691
|
const fileTerm = omittedFiles === 1 ? "file" : "files";
|
|
232724
232692
|
resultMessage += `
|
|
232725
232693
|
---
|
|
@@ -232807,7 +232775,7 @@ import fsPromises2 from "node:fs/promises";
|
|
|
232807
232775
|
import path36 from "node:path";
|
|
232808
232776
|
import { EOL as EOL2 } from "node:os";
|
|
232809
232777
|
import { spawn as spawn5 } from "node:child_process";
|
|
232810
|
-
var
|
|
232778
|
+
var GrepToolInvocation, GrepTool;
|
|
232811
232779
|
var init_grep2 = __esm({
|
|
232812
232780
|
"packages/core/src/tools/grep.ts"() {
|
|
232813
232781
|
"use strict";
|
|
@@ -232819,7 +232787,6 @@ var init_grep2 = __esm({
|
|
|
232819
232787
|
init_errors();
|
|
232820
232788
|
init_gitUtils();
|
|
232821
232789
|
init_tool_error();
|
|
232822
|
-
MAX_LLM_CONTENT_LENGTH = 2e4;
|
|
232823
232790
|
GrepToolInvocation = class extends BaseToolInvocation {
|
|
232824
232791
|
constructor(config, params) {
|
|
232825
232792
|
super(params);
|
|
@@ -232849,10 +232816,15 @@ var init_grep2 = __esm({
|
|
|
232849
232816
|
const noMatchMsg = `No matches found for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}.`;
|
|
232850
232817
|
return { llmContent: noMatchMsg, returnDisplay: `No matches found` };
|
|
232851
232818
|
}
|
|
232819
|
+
const charLimit = this.config.getTruncateToolOutputThreshold();
|
|
232820
|
+
const lineLimit = Math.min(
|
|
232821
|
+
this.config.getTruncateToolOutputLines(),
|
|
232822
|
+
this.params.limit ?? Number.POSITIVE_INFINITY
|
|
232823
|
+
);
|
|
232852
232824
|
let truncatedByLineLimit = false;
|
|
232853
232825
|
let matchesToInclude = rawMatches;
|
|
232854
|
-
if (
|
|
232855
|
-
matchesToInclude = rawMatches.slice(0,
|
|
232826
|
+
if (rawMatches.length > lineLimit) {
|
|
232827
|
+
matchesToInclude = rawMatches.slice(0, lineLimit);
|
|
232856
232828
|
truncatedByLineLimit = true;
|
|
232857
232829
|
}
|
|
232858
232830
|
const totalMatches = rawMatches.length;
|
|
@@ -232884,8 +232856,8 @@ var init_grep2 = __esm({
|
|
|
232884
232856
|
grepOutput += "---\n";
|
|
232885
232857
|
}
|
|
232886
232858
|
let truncatedByCharLimit = false;
|
|
232887
|
-
if (grepOutput.length >
|
|
232888
|
-
grepOutput = grepOutput.slice(0,
|
|
232859
|
+
if (Number.isFinite(charLimit) && grepOutput.length > charLimit) {
|
|
232860
|
+
grepOutput = grepOutput.slice(0, charLimit) + "...";
|
|
232889
232861
|
truncatedByCharLimit = true;
|
|
232890
232862
|
}
|
|
232891
232863
|
const finalLines = grepOutput.split("\n").filter(
|
|
@@ -233627,7 +233599,8 @@ ${getErrorMessage(error)}
|
|
|
233627
233599
|
};
|
|
233628
233600
|
}
|
|
233629
233601
|
const sortedFiles = Array.from(filesToConsider).sort();
|
|
233630
|
-
const
|
|
233602
|
+
const truncateToolOutputLines = this.config.getTruncateToolOutputLines();
|
|
233603
|
+
const file_line_limit = Number.isFinite(truncateToolOutputLines) ? Math.floor(truncateToolOutputLines / Math.max(1, sortedFiles.length)) : void 0;
|
|
233631
233604
|
const fileProcessingPromises = sortedFiles.map(
|
|
233632
233605
|
async (filePath) => {
|
|
233633
233606
|
try {
|
|
@@ -233653,8 +233626,7 @@ ${getErrorMessage(error)}
|
|
|
233653
233626
|
}
|
|
233654
233627
|
const fileReadResult = await processSingleFileContent(
|
|
233655
233628
|
filePath,
|
|
233656
|
-
this.config
|
|
233657
|
-
this.config.getFileSystemService(),
|
|
233629
|
+
this.config,
|
|
233658
233630
|
0,
|
|
233659
233631
|
file_line_limit
|
|
233660
233632
|
);
|
|
@@ -233701,11 +233673,14 @@ ${getErrorMessage(error)}
|
|
|
233701
233673
|
);
|
|
233702
233674
|
let fileContentForLlm = "";
|
|
233703
233675
|
if (fileReadResult.isTruncated) {
|
|
233704
|
-
|
|
233705
|
-
|
|
233706
|
-
|
|
233676
|
+
const [start, end] = fileReadResult.linesShown;
|
|
233677
|
+
const total = fileReadResult.originalLineCount;
|
|
233678
|
+
fileContentForLlm = `Showing lines ${start}-${end} of ${total} total lines.
|
|
233679
|
+
---
|
|
233680
|
+
${fileReadResult.llmContent}`;
|
|
233681
|
+
} else {
|
|
233682
|
+
fileContentForLlm = fileReadResult.llmContent;
|
|
233707
233683
|
}
|
|
233708
|
-
fileContentForLlm += fileReadResult.llmContent;
|
|
233709
233684
|
contentParts.push(`${separator}
|
|
233710
233685
|
|
|
233711
233686
|
${fileContentForLlm}
|
|
@@ -233983,7 +233958,7 @@ import fs36 from "node:fs";
|
|
|
233983
233958
|
import path40 from "node:path";
|
|
233984
233959
|
import { EOL as EOL3 } from "node:os";
|
|
233985
233960
|
import { spawn as spawn6 } from "node:child_process";
|
|
233986
|
-
var
|
|
233961
|
+
var GrepToolInvocation2, RipGrepTool;
|
|
233987
233962
|
var init_ripGrep = __esm({
|
|
233988
233963
|
"packages/core/src/tools/ripGrep.ts"() {
|
|
233989
233964
|
"use strict";
|
|
@@ -233995,7 +233970,6 @@ var init_ripGrep = __esm({
|
|
|
233995
233970
|
init_ripgrepUtils();
|
|
233996
233971
|
init_schemaValidator();
|
|
233997
233972
|
init_constants3();
|
|
233998
|
-
MAX_LLM_CONTENT_LENGTH2 = 2e4;
|
|
233999
233973
|
GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
234000
233974
|
constructor(config, params) {
|
|
234001
233975
|
super(params);
|
|
@@ -234030,33 +234004,42 @@ var init_ripGrep = __esm({
|
|
|
234030
234004
|
const header = `Found ${totalMatches} ${matchTerm} for pattern "${this.params.pattern}" ${searchLocationDescription}${filterDescription}:
|
|
234031
234005
|
---
|
|
234032
234006
|
`;
|
|
234007
|
+
const charLimit = this.config.getTruncateToolOutputThreshold();
|
|
234008
|
+
const lineLimit = Math.min(
|
|
234009
|
+
this.config.getTruncateToolOutputLines(),
|
|
234010
|
+
this.params.limit ?? Number.POSITIVE_INFINITY
|
|
234011
|
+
);
|
|
234033
234012
|
let truncatedByLineLimit = false;
|
|
234034
234013
|
let linesToInclude = allLines;
|
|
234035
|
-
if (
|
|
234036
|
-
linesToInclude = allLines.slice(0,
|
|
234014
|
+
if (allLines.length > lineLimit) {
|
|
234015
|
+
linesToInclude = allLines.slice(0, lineLimit);
|
|
234037
234016
|
truncatedByLineLimit = true;
|
|
234038
234017
|
}
|
|
234039
|
-
|
|
234040
|
-
let includedLines = 0;
|
|
234018
|
+
let grepOutput = "";
|
|
234041
234019
|
let truncatedByCharLimit = false;
|
|
234042
|
-
let
|
|
234043
|
-
|
|
234044
|
-
const
|
|
234045
|
-
|
|
234046
|
-
|
|
234047
|
-
|
|
234048
|
-
|
|
234049
|
-
|
|
234050
|
-
|
|
234051
|
-
|
|
234052
|
-
|
|
234053
|
-
|
|
234054
|
-
|
|
234055
|
-
|
|
234056
|
-
|
|
234020
|
+
let includedLines = 0;
|
|
234021
|
+
if (Number.isFinite(charLimit)) {
|
|
234022
|
+
const parts = [];
|
|
234023
|
+
let currentLength = 0;
|
|
234024
|
+
for (const line of linesToInclude) {
|
|
234025
|
+
const sep7 = includedLines > 0 ? 1 : 0;
|
|
234026
|
+
includedLines++;
|
|
234027
|
+
const projectedLength = currentLength + line.length + sep7;
|
|
234028
|
+
if (projectedLength <= charLimit) {
|
|
234029
|
+
parts.push(line);
|
|
234030
|
+
currentLength = projectedLength;
|
|
234031
|
+
} else {
|
|
234032
|
+
const remaining = Math.max(charLimit - currentLength - sep7, 10);
|
|
234033
|
+
parts.push(line.slice(0, remaining) + "...");
|
|
234034
|
+
truncatedByCharLimit = true;
|
|
234035
|
+
break;
|
|
234036
|
+
}
|
|
234057
234037
|
}
|
|
234038
|
+
grepOutput = parts.join("\n");
|
|
234039
|
+
} else {
|
|
234040
|
+
grepOutput = linesToInclude.join("\n");
|
|
234041
|
+
includedLines = linesToInclude.length;
|
|
234058
234042
|
}
|
|
234059
|
-
const grepOutput = parts.join("\n");
|
|
234060
234043
|
let llmContent = header + grepOutput;
|
|
234061
234044
|
if (truncatedByLineLimit || truncatedByCharLimit) {
|
|
234062
234045
|
const omittedMatches = totalMatches - includedLines;
|
|
@@ -244681,6 +244664,7 @@ var init_web_fetch = __esm({
|
|
|
244681
244664
|
init_tool_error();
|
|
244682
244665
|
init_tools();
|
|
244683
244666
|
init_models();
|
|
244667
|
+
init_tool_names();
|
|
244684
244668
|
URL_FETCH_TIMEOUT_MS = 1e4;
|
|
244685
244669
|
MAX_CONTENT_LENGTH = 1e5;
|
|
244686
244670
|
WebFetchToolInvocation = class extends BaseToolInvocation {
|
|
@@ -244837,7 +244821,7 @@ Usage notes:
|
|
|
244837
244821
|
static {
|
|
244838
244822
|
__name(this, "WebFetchTool");
|
|
244839
244823
|
}
|
|
244840
|
-
static Name =
|
|
244824
|
+
static Name = ToolNames.WEB_FETCH;
|
|
244841
244825
|
validateToolParamValues(params) {
|
|
244842
244826
|
if (!params.url || params.url.trim() === "") {
|
|
244843
244827
|
return "The 'url' parameter cannot be empty.";
|
|
@@ -245384,6 +245368,7 @@ var init_web_search = __esm({
|
|
|
245384
245368
|
init_tavily_provider();
|
|
245385
245369
|
init_google_provider();
|
|
245386
245370
|
init_dashscope_provider();
|
|
245371
|
+
init_tool_names();
|
|
245387
245372
|
WebSearchToolInvocation = class extends BaseToolInvocation {
|
|
245388
245373
|
constructor(config, params) {
|
|
245389
245374
|
super(params);
|
|
@@ -245585,7 +245570,7 @@ ${content}`,
|
|
|
245585
245570
|
static {
|
|
245586
245571
|
__name(this, "WebSearchTool");
|
|
245587
245572
|
}
|
|
245588
|
-
static Name =
|
|
245573
|
+
static Name = ToolNames.WEB_SEARCH;
|
|
245589
245574
|
/**
|
|
245590
245575
|
* Validates the parameters for the WebSearchTool.
|
|
245591
245576
|
* @param params The parameters to validate
|
|
@@ -247415,7 +247400,7 @@ var init_config3 = __esm({
|
|
|
247415
247400
|
return ApprovalMode2;
|
|
247416
247401
|
})(ApprovalMode || {});
|
|
247417
247402
|
APPROVAL_MODES = Object.values(ApprovalMode);
|
|
247418
|
-
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD =
|
|
247403
|
+
DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD = 25e3;
|
|
247419
247404
|
DEFAULT_TRUNCATE_TOOL_OUTPUT_LINES = 1e3;
|
|
247420
247405
|
MCPServerConfig = class {
|
|
247421
247406
|
constructor(command2, args, env7, cwd7, url2, httpUrl, headers, tcp, timeout2, trust, description, includeTools, excludeTools, extensionName, oauth, authProviderType, targetAudience, targetServiceAccount) {
|
|
@@ -247514,6 +247499,7 @@ var init_config3 = __esm({
|
|
|
247514
247499
|
extensionManagement = true;
|
|
247515
247500
|
enablePromptCompletion = false;
|
|
247516
247501
|
skipLoopDetection;
|
|
247502
|
+
skipStartupContext;
|
|
247517
247503
|
vlmSwitchMode;
|
|
247518
247504
|
initialized = false;
|
|
247519
247505
|
storage;
|
|
@@ -247599,6 +247585,7 @@ var init_config3 = __esm({
|
|
|
247599
247585
|
this.interactive = params.interactive ?? false;
|
|
247600
247586
|
this.trustedFolder = params.trustedFolder;
|
|
247601
247587
|
this.skipLoopDetection = params.skipLoopDetection ?? false;
|
|
247588
|
+
this.skipStartupContext = params.skipStartupContext ?? false;
|
|
247602
247589
|
this.webSearch = params.webSearch;
|
|
247603
247590
|
this.useRipgrep = params.useRipgrep ?? true;
|
|
247604
247591
|
this.useBuiltinRipgrep = params.useBuiltinRipgrep ?? true;
|
|
@@ -248013,6 +248000,9 @@ var init_config3 = __esm({
|
|
|
248013
248000
|
getSkipLoopDetection() {
|
|
248014
248001
|
return this.skipLoopDetection;
|
|
248015
248002
|
}
|
|
248003
|
+
getSkipStartupContext() {
|
|
248004
|
+
return this.skipStartupContext;
|
|
248005
|
+
}
|
|
248016
248006
|
getVlmSwitchMode() {
|
|
248017
248007
|
return this.vlmSwitchMode;
|
|
248018
248008
|
}
|
|
@@ -248020,6 +248010,9 @@ var init_config3 = __esm({
|
|
|
248020
248010
|
return this.enableToolOutputTruncation;
|
|
248021
248011
|
}
|
|
248022
248012
|
getTruncateToolOutputThreshold() {
|
|
248013
|
+
if (!this.enableToolOutputTruncation || this.truncateToolOutputThreshold <= 0) {
|
|
248014
|
+
return Number.POSITIVE_INFINITY;
|
|
248015
|
+
}
|
|
248023
248016
|
return Math.min(
|
|
248024
248017
|
// Estimate remaining context window in characters (1 token ~= 4 chars).
|
|
248025
248018
|
4 * (tokenLimit(this.getModel()) - uiTelemetryService.getLastPromptTokenCount()),
|
|
@@ -248027,6 +248020,9 @@ var init_config3 = __esm({
|
|
|
248027
248020
|
);
|
|
248028
248021
|
}
|
|
248029
248022
|
getTruncateToolOutputLines() {
|
|
248023
|
+
if (!this.enableToolOutputTruncation || this.truncateToolOutputLines <= 0) {
|
|
248024
|
+
return Number.POSITIVE_INFINITY;
|
|
248025
|
+
}
|
|
248030
248026
|
return this.truncateToolOutputLines;
|
|
248031
248027
|
}
|
|
248032
248028
|
getUseSmartEdit() {
|
|
@@ -255858,6 +255854,8 @@ var init_src = __esm({
|
|
|
255858
255854
|
init_read_many_files();
|
|
255859
255855
|
init_mcp_client();
|
|
255860
255856
|
init_mcp_tool();
|
|
255857
|
+
init_task();
|
|
255858
|
+
init_todoWrite();
|
|
255861
255859
|
init_oauth_provider();
|
|
255862
255860
|
init_oauth_token_storage();
|
|
255863
255861
|
init_oauth_utils();
|
|
@@ -255937,11 +255935,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
255937
255935
|
const relativePathForDisplay = path59.relative(absolutePath, filePath);
|
|
255938
255936
|
allParts.push({ text: `--- ${relativePathForDisplay} ---
|
|
255939
255937
|
` });
|
|
255940
|
-
const result = await processSingleFileContent(
|
|
255941
|
-
filePath,
|
|
255942
|
-
config.getTargetDir(),
|
|
255943
|
-
config.getFileSystemService()
|
|
255944
|
-
);
|
|
255938
|
+
const result = await processSingleFileContent(filePath, config);
|
|
255945
255939
|
allParts.push(result.llmContent);
|
|
255946
255940
|
allParts.push({ text: "\n" });
|
|
255947
255941
|
}
|
|
@@ -255956,11 +255950,7 @@ async function readPathFromWorkspace(pathStr, config) {
|
|
|
255956
255950
|
if (filtered.length === 0) {
|
|
255957
255951
|
return [];
|
|
255958
255952
|
}
|
|
255959
|
-
const result = await processSingleFileContent(
|
|
255960
|
-
absolutePath,
|
|
255961
|
-
config.getTargetDir(),
|
|
255962
|
-
config.getFileSystemService()
|
|
255963
|
-
);
|
|
255953
|
+
const result = await processSingleFileContent(absolutePath, config);
|
|
255964
255954
|
return [result.llmContent];
|
|
255965
255955
|
}
|
|
255966
255956
|
}
|
|
@@ -322764,6 +322754,15 @@ var SETTINGS_SCHEMA = {
|
|
|
322764
322754
|
description: "Disable all loop detection checks (streaming and LLM).",
|
|
322765
322755
|
showInDialog: true
|
|
322766
322756
|
},
|
|
322757
|
+
skipStartupContext: {
|
|
322758
|
+
type: "boolean",
|
|
322759
|
+
label: "Skip Startup Context",
|
|
322760
|
+
category: "Model",
|
|
322761
|
+
requiresRestart: true,
|
|
322762
|
+
default: false,
|
|
322763
|
+
description: "Avoid sending the workspace startup context at the beginning of each session.",
|
|
322764
|
+
showInDialog: true
|
|
322765
|
+
},
|
|
322767
322766
|
enableOpenAILogging: {
|
|
322768
322767
|
type: "boolean",
|
|
322769
322768
|
label: "Enable OpenAI Logging",
|
|
@@ -329897,6 +329896,7 @@ var MIGRATION_MAP = {
|
|
|
329897
329896
|
sessionTokenLimit: "model.sessionTokenLimit",
|
|
329898
329897
|
contentGenerator: "model.generationConfig",
|
|
329899
329898
|
skipLoopDetection: "model.skipLoopDetection",
|
|
329899
|
+
skipStartupContext: "model.skipStartupContext",
|
|
329900
329900
|
enableOpenAILogging: "model.enableOpenAILogging",
|
|
329901
329901
|
tavilyApiKey: "advanced.tavilyApiKey",
|
|
329902
329902
|
vlmSwitchMode: "experimental.vlmSwitchMode",
|
|
@@ -342366,7 +342366,7 @@ __name(getPackageJson, "getPackageJson");
|
|
|
342366
342366
|
// packages/cli/src/utils/version.ts
|
|
342367
342367
|
async function getCliVersion() {
|
|
342368
342368
|
const pkgJson = await getPackageJson();
|
|
342369
|
-
return "0.0.24-alpha.
|
|
342369
|
+
return "0.0.24-alpha.1";
|
|
342370
342370
|
}
|
|
342371
342371
|
__name(getCliVersion, "getCliVersion");
|
|
342372
342372
|
|
|
@@ -343334,6 +343334,7 @@ async function loadCliConfig(settings, extensions, extensionEnablementManager, s
|
|
|
343334
343334
|
skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
|
|
343335
343335
|
enablePromptCompletion: settings.general?.enablePromptCompletion ?? false,
|
|
343336
343336
|
skipLoopDetection: settings.model?.skipLoopDetection ?? false,
|
|
343337
|
+
skipStartupContext: settings.model?.skipStartupContext ?? false,
|
|
343337
343338
|
vlmSwitchMode,
|
|
343338
343339
|
truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
|
|
343339
343340
|
truncateToolOutputLines: settings.tools?.truncateToolOutputLines,
|
|
@@ -344366,7 +344367,7 @@ init_core2();
|
|
|
344366
344367
|
|
|
344367
344368
|
// packages/cli/src/generated/git-commit.ts
|
|
344368
344369
|
init_esbuild_shims();
|
|
344369
|
-
var GIT_COMMIT_INFO2 = "
|
|
344370
|
+
var GIT_COMMIT_INFO2 = "df5102f8";
|
|
344370
344371
|
|
|
344371
344372
|
// packages/cli/src/utils/systemInfo.ts
|
|
344372
344373
|
async function getNpmVersion() {
|
|
@@ -358383,6 +358384,9 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
358383
358384
|
},
|
|
358384
358385
|
[visionSwitchResolver]
|
|
358385
358386
|
);
|
|
358387
|
+
const onDebugMessage = (0, import_react132.useCallback)((message) => {
|
|
358388
|
+
console.debug(message);
|
|
358389
|
+
}, []);
|
|
358386
358390
|
const performMemoryRefresh = (0, import_react132.useCallback)(async () => {
|
|
358387
358391
|
historyManager.addItem(
|
|
358388
358392
|
{
|
|
@@ -358452,7 +358456,7 @@ var AppContainer = /* @__PURE__ */ __name((props) => {
|
|
|
358452
358456
|
historyManager.addItem,
|
|
358453
358457
|
config,
|
|
358454
358458
|
settings,
|
|
358455
|
-
|
|
358459
|
+
onDebugMessage,
|
|
358456
358460
|
handleSlashCommand2,
|
|
358457
358461
|
shellModeActive,
|
|
358458
358462
|
() => settings.merged.general?.preferredEditor,
|
|
@@ -360346,7 +360350,6 @@ init_core2();
|
|
|
360346
360350
|
// packages/cli/src/zed-integration/acp.ts
|
|
360347
360351
|
init_esbuild_shims();
|
|
360348
360352
|
init_zod();
|
|
360349
|
-
import { EOL as EOL4 } from "node:os";
|
|
360350
360353
|
|
|
360351
360354
|
// packages/cli/src/zed-integration/schema.ts
|
|
360352
360355
|
init_esbuild_shims();
|
|
@@ -360752,7 +360755,7 @@ var Connection = class {
|
|
|
360752
360755
|
const decoder = new TextDecoder();
|
|
360753
360756
|
for await (const chunk of output) {
|
|
360754
360757
|
content += decoder.decode(chunk, { stream: true });
|
|
360755
|
-
const lines = content.split(
|
|
360758
|
+
const lines = content.split("\n");
|
|
360756
360759
|
content = lines.pop() || "";
|
|
360757
360760
|
for (const line of lines) {
|
|
360758
360761
|
const trimmedLine = line.trim();
|
|
@@ -361205,13 +361208,23 @@ var Session2 = class {
|
|
|
361205
361208
|
new Error(`Tool "${fc.name}" not found in registry.`)
|
|
361206
361209
|
);
|
|
361207
361210
|
}
|
|
361211
|
+
const isTodoWriteTool = fc.name === TodoWriteTool.Name || tool.name === TodoWriteTool.Name;
|
|
361212
|
+
let subAgentToolEventListeners = [];
|
|
361208
361213
|
try {
|
|
361209
361214
|
const invocation = tool.build(args);
|
|
361215
|
+
const isTaskTool = tool.name === TaskTool.Name;
|
|
361216
|
+
if (isTaskTool && "eventEmitter" in invocation) {
|
|
361217
|
+
const taskEventEmitter = invocation.eventEmitter;
|
|
361218
|
+
subAgentToolEventListeners = this.setupSubAgentToolTracking(
|
|
361219
|
+
taskEventEmitter,
|
|
361220
|
+
abortSignal
|
|
361221
|
+
);
|
|
361222
|
+
}
|
|
361210
361223
|
const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
|
|
361211
361224
|
if (confirmationDetails) {
|
|
361212
|
-
const
|
|
361225
|
+
const content = [];
|
|
361213
361226
|
if (confirmationDetails.type === "edit") {
|
|
361214
|
-
|
|
361227
|
+
content.push({
|
|
361215
361228
|
type: "diff",
|
|
361216
361229
|
path: confirmationDetails.fileName,
|
|
361217
361230
|
oldText: confirmationDetails.originalContent,
|
|
@@ -361225,7 +361238,7 @@ var Session2 = class {
|
|
|
361225
361238
|
toolCallId: callId,
|
|
361226
361239
|
status: "pending",
|
|
361227
361240
|
title: invocation.getDescription(),
|
|
361228
|
-
content
|
|
361241
|
+
content,
|
|
361229
361242
|
locations: invocation.toolLocations(),
|
|
361230
361243
|
kind: tool.kind
|
|
361231
361244
|
}
|
|
@@ -361249,7 +361262,7 @@ var Session2 = class {
|
|
|
361249
361262
|
throw new Error(`Unexpected: ${resultOutcome}`);
|
|
361250
361263
|
}
|
|
361251
361264
|
}
|
|
361252
|
-
} else {
|
|
361265
|
+
} else if (!isTodoWriteTool) {
|
|
361253
361266
|
await this.sendUpdate({
|
|
361254
361267
|
sessionUpdate: "tool_call",
|
|
361255
361268
|
toolCallId: callId,
|
|
@@ -361261,13 +361274,31 @@ var Session2 = class {
|
|
|
361261
361274
|
});
|
|
361262
361275
|
}
|
|
361263
361276
|
const toolResult = await invocation.execute(abortSignal);
|
|
361264
|
-
|
|
361265
|
-
|
|
361266
|
-
|
|
361267
|
-
|
|
361268
|
-
|
|
361269
|
-
|
|
361270
|
-
|
|
361277
|
+
subAgentToolEventListeners.forEach((cleanup) => cleanup());
|
|
361278
|
+
if (isTodoWriteTool) {
|
|
361279
|
+
let todos = [];
|
|
361280
|
+
if (Array.isArray(args["todos"])) {
|
|
361281
|
+
todos = args["todos"];
|
|
361282
|
+
}
|
|
361283
|
+
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)) {
|
|
361284
|
+
todos = toolResult.returnDisplay.todos;
|
|
361285
|
+
}
|
|
361286
|
+
if (todos.length > 0 || Array.isArray(args["todos"])) {
|
|
361287
|
+
const planEntries = convertTodosToPlanEntries(todos);
|
|
361288
|
+
await this.sendUpdate({
|
|
361289
|
+
sessionUpdate: "plan",
|
|
361290
|
+
entries: planEntries
|
|
361291
|
+
});
|
|
361292
|
+
}
|
|
361293
|
+
} else {
|
|
361294
|
+
const content = toToolCallContent(toolResult);
|
|
361295
|
+
await this.sendUpdate({
|
|
361296
|
+
sessionUpdate: "tool_call_update",
|
|
361297
|
+
toolCallId: callId,
|
|
361298
|
+
status: "completed",
|
|
361299
|
+
content: content ? [content] : []
|
|
361300
|
+
});
|
|
361301
|
+
}
|
|
361271
361302
|
const durationMs = Date.now() - startTime;
|
|
361272
361303
|
logToolCall(this.config, {
|
|
361273
361304
|
"event.name": "tool_call",
|
|
@@ -361282,6 +361313,7 @@ var Session2 = class {
|
|
|
361282
361313
|
});
|
|
361283
361314
|
return convertToFunctionResponse(fc.name, callId, toolResult.llmContent);
|
|
361284
361315
|
} catch (e2) {
|
|
361316
|
+
subAgentToolEventListeners.forEach((cleanup) => cleanup());
|
|
361285
361317
|
const error = e2 instanceof Error ? e2 : new Error(String(e2));
|
|
361286
361318
|
await this.sendUpdate({
|
|
361287
361319
|
sessionUpdate: "tool_call_update",
|
|
@@ -361294,6 +361326,196 @@ var Session2 = class {
|
|
|
361294
361326
|
return errorResponse(error);
|
|
361295
361327
|
}
|
|
361296
361328
|
}
|
|
361329
|
+
/**
|
|
361330
|
+
* Sets up event listeners to track sub-agent tool calls within a TaskTool execution.
|
|
361331
|
+
* Converts subagent tool call events into zedIntegration session updates.
|
|
361332
|
+
*
|
|
361333
|
+
* @param eventEmitter - The SubAgentEventEmitter from TaskTool
|
|
361334
|
+
* @param abortSignal - Signal to abort tracking if parent is cancelled
|
|
361335
|
+
* @returns Array of cleanup functions to remove event listeners
|
|
361336
|
+
*/
|
|
361337
|
+
setupSubAgentToolTracking(eventEmitter, abortSignal) {
|
|
361338
|
+
const cleanupFunctions2 = [];
|
|
361339
|
+
const toolRegistry = this.config.getToolRegistry();
|
|
361340
|
+
const subAgentToolStates = /* @__PURE__ */ new Map();
|
|
361341
|
+
const onToolCall = /* @__PURE__ */ __name((...args) => {
|
|
361342
|
+
const event = args[0];
|
|
361343
|
+
if (abortSignal.aborted) return;
|
|
361344
|
+
const subAgentTool = toolRegistry.getTool(event.name);
|
|
361345
|
+
let subAgentInvocation;
|
|
361346
|
+
let toolKind = "other";
|
|
361347
|
+
let locations = [];
|
|
361348
|
+
if (subAgentTool) {
|
|
361349
|
+
try {
|
|
361350
|
+
subAgentInvocation = subAgentTool.build(event.args);
|
|
361351
|
+
toolKind = this.mapToolKind(subAgentTool.kind);
|
|
361352
|
+
locations = subAgentInvocation.toolLocations().map((loc) => ({
|
|
361353
|
+
path: loc.path,
|
|
361354
|
+
line: loc.line ?? null
|
|
361355
|
+
}));
|
|
361356
|
+
} catch (e2) {
|
|
361357
|
+
console.warn(`Failed to build subagent tool ${event.name}:`, e2);
|
|
361358
|
+
}
|
|
361359
|
+
}
|
|
361360
|
+
subAgentToolStates.set(event.callId, {
|
|
361361
|
+
tool: subAgentTool,
|
|
361362
|
+
invocation: subAgentInvocation,
|
|
361363
|
+
args: event.args
|
|
361364
|
+
});
|
|
361365
|
+
if (event.name === TodoWriteTool.Name) {
|
|
361366
|
+
return;
|
|
361367
|
+
}
|
|
361368
|
+
void this.sendUpdate({
|
|
361369
|
+
sessionUpdate: "tool_call",
|
|
361370
|
+
toolCallId: event.callId,
|
|
361371
|
+
status: "in_progress",
|
|
361372
|
+
title: event.description || event.name,
|
|
361373
|
+
content: [],
|
|
361374
|
+
locations,
|
|
361375
|
+
kind: toolKind,
|
|
361376
|
+
rawInput: event.args
|
|
361377
|
+
});
|
|
361378
|
+
}, "onToolCall");
|
|
361379
|
+
const onToolResult = /* @__PURE__ */ __name((...args) => {
|
|
361380
|
+
const event = args[0];
|
|
361381
|
+
if (abortSignal.aborted) return;
|
|
361382
|
+
const state = subAgentToolStates.get(event.callId);
|
|
361383
|
+
if (event.name === TodoWriteTool.Name) {
|
|
361384
|
+
let todos;
|
|
361385
|
+
if (event.resultDisplay) {
|
|
361386
|
+
try {
|
|
361387
|
+
const parsed = typeof event.resultDisplay === "string" ? JSON.parse(event.resultDisplay) : event.resultDisplay;
|
|
361388
|
+
if (typeof parsed === "object" && parsed !== null && "type" in parsed && parsed.type === "todo_list" && "todos" in parsed && Array.isArray(parsed.todos)) {
|
|
361389
|
+
todos = parsed.todos;
|
|
361390
|
+
}
|
|
361391
|
+
} catch {
|
|
361392
|
+
}
|
|
361393
|
+
}
|
|
361394
|
+
if (!todos && state?.args && Array.isArray(state.args["todos"])) {
|
|
361395
|
+
todos = state.args["todos"];
|
|
361396
|
+
}
|
|
361397
|
+
if (todos) {
|
|
361398
|
+
const planEntries = convertTodosToPlanEntries(todos);
|
|
361399
|
+
void this.sendUpdate({
|
|
361400
|
+
sessionUpdate: "plan",
|
|
361401
|
+
entries: planEntries
|
|
361402
|
+
});
|
|
361403
|
+
}
|
|
361404
|
+
subAgentToolStates.delete(event.callId);
|
|
361405
|
+
return;
|
|
361406
|
+
}
|
|
361407
|
+
let content = [];
|
|
361408
|
+
if (event.resultDisplay && state?.invocation) {
|
|
361409
|
+
if (typeof event.resultDisplay === "string") {
|
|
361410
|
+
content = [
|
|
361411
|
+
{
|
|
361412
|
+
type: "content",
|
|
361413
|
+
content: {
|
|
361414
|
+
type: "text",
|
|
361415
|
+
text: event.resultDisplay
|
|
361416
|
+
}
|
|
361417
|
+
}
|
|
361418
|
+
];
|
|
361419
|
+
}
|
|
361420
|
+
}
|
|
361421
|
+
void this.sendUpdate({
|
|
361422
|
+
sessionUpdate: "tool_call_update",
|
|
361423
|
+
toolCallId: event.callId,
|
|
361424
|
+
status: event.success ? "completed" : "failed",
|
|
361425
|
+
content: content.length > 0 ? content : [],
|
|
361426
|
+
title: state?.invocation?.getDescription() ?? event.name,
|
|
361427
|
+
kind: state?.tool ? this.mapToolKind(state.tool.kind) : null,
|
|
361428
|
+
locations: state?.invocation?.toolLocations().map((loc) => ({
|
|
361429
|
+
path: loc.path,
|
|
361430
|
+
line: loc.line ?? null
|
|
361431
|
+
})) ?? null,
|
|
361432
|
+
rawInput: state?.args
|
|
361433
|
+
});
|
|
361434
|
+
subAgentToolStates.delete(event.callId);
|
|
361435
|
+
}, "onToolResult");
|
|
361436
|
+
const onToolWaitingApproval = /* @__PURE__ */ __name(async (...args) => {
|
|
361437
|
+
const event = args[0];
|
|
361438
|
+
if (abortSignal.aborted) return;
|
|
361439
|
+
const state = subAgentToolStates.get(event.callId);
|
|
361440
|
+
const content = [];
|
|
361441
|
+
if (event.confirmationDetails.type === "edit") {
|
|
361442
|
+
const editDetails = event.confirmationDetails;
|
|
361443
|
+
content.push({
|
|
361444
|
+
type: "diff",
|
|
361445
|
+
path: editDetails.fileName,
|
|
361446
|
+
oldText: editDetails.originalContent ?? "",
|
|
361447
|
+
newText: editDetails.newContent
|
|
361448
|
+
});
|
|
361449
|
+
}
|
|
361450
|
+
const fullConfirmationDetails = {
|
|
361451
|
+
...event.confirmationDetails,
|
|
361452
|
+
onConfirm: /* @__PURE__ */ __name(async () => {
|
|
361453
|
+
}, "onConfirm")
|
|
361454
|
+
};
|
|
361455
|
+
const params = {
|
|
361456
|
+
sessionId: this.id,
|
|
361457
|
+
options: toPermissionOptions(fullConfirmationDetails),
|
|
361458
|
+
toolCall: {
|
|
361459
|
+
toolCallId: event.callId,
|
|
361460
|
+
status: "pending",
|
|
361461
|
+
title: event.description || event.name,
|
|
361462
|
+
content,
|
|
361463
|
+
locations: state?.invocation?.toolLocations().map((loc) => ({
|
|
361464
|
+
path: loc.path,
|
|
361465
|
+
line: loc.line ?? null
|
|
361466
|
+
})) ?? [],
|
|
361467
|
+
kind: state?.tool ? this.mapToolKind(state.tool.kind) : "other",
|
|
361468
|
+
rawInput: state?.args
|
|
361469
|
+
}
|
|
361470
|
+
};
|
|
361471
|
+
try {
|
|
361472
|
+
const output = await this.client.requestPermission(params);
|
|
361473
|
+
const outcome = output.outcome.outcome === "cancelled" ? "cancel" /* Cancel */ : external_exports.nativeEnum(ToolConfirmationOutcome).parse(output.outcome.optionId);
|
|
361474
|
+
await event.respond(outcome);
|
|
361475
|
+
} catch (error) {
|
|
361476
|
+
console.error(
|
|
361477
|
+
`Permission request failed for subagent tool ${event.name}:`,
|
|
361478
|
+
error
|
|
361479
|
+
);
|
|
361480
|
+
await event.respond("cancel" /* Cancel */);
|
|
361481
|
+
}
|
|
361482
|
+
}, "onToolWaitingApproval");
|
|
361483
|
+
eventEmitter.on("tool_call" /* TOOL_CALL */, onToolCall);
|
|
361484
|
+
eventEmitter.on("tool_result" /* TOOL_RESULT */, onToolResult);
|
|
361485
|
+
eventEmitter.on(
|
|
361486
|
+
"tool_waiting_approval" /* TOOL_WAITING_APPROVAL */,
|
|
361487
|
+
onToolWaitingApproval
|
|
361488
|
+
);
|
|
361489
|
+
cleanupFunctions2.push(() => {
|
|
361490
|
+
eventEmitter.off("tool_call" /* TOOL_CALL */, onToolCall);
|
|
361491
|
+
eventEmitter.off("tool_result" /* TOOL_RESULT */, onToolResult);
|
|
361492
|
+
eventEmitter.off(
|
|
361493
|
+
"tool_waiting_approval" /* TOOL_WAITING_APPROVAL */,
|
|
361494
|
+
onToolWaitingApproval
|
|
361495
|
+
);
|
|
361496
|
+
});
|
|
361497
|
+
return cleanupFunctions2;
|
|
361498
|
+
}
|
|
361499
|
+
/**
|
|
361500
|
+
* Maps core Tool Kind enum to ACP ToolKind string literals.
|
|
361501
|
+
*
|
|
361502
|
+
* @param kind - The core Kind enum value
|
|
361503
|
+
* @returns The corresponding ACP ToolKind string literal
|
|
361504
|
+
*/
|
|
361505
|
+
mapToolKind(kind) {
|
|
361506
|
+
const kindMap = {
|
|
361507
|
+
["read" /* Read */]: "read",
|
|
361508
|
+
["edit" /* Edit */]: "edit",
|
|
361509
|
+
["delete" /* Delete */]: "delete",
|
|
361510
|
+
["move" /* Move */]: "move",
|
|
361511
|
+
["search" /* Search */]: "search",
|
|
361512
|
+
["execute" /* Execute */]: "execute",
|
|
361513
|
+
["think" /* Think */]: "think",
|
|
361514
|
+
["fetch" /* Fetch */]: "fetch",
|
|
361515
|
+
["other" /* Other */]: "other"
|
|
361516
|
+
};
|
|
361517
|
+
return kindMap[kind] ?? "other";
|
|
361518
|
+
}
|
|
361297
361519
|
async #resolvePrompt(message, abortSignal) {
|
|
361298
361520
|
const FILE_URI_SCHEME = "file://";
|
|
361299
361521
|
const embeddedContext = [];
|
|
@@ -361582,6 +361804,15 @@ Content from @${contextPart.uri}:
|
|
|
361582
361804
|
}
|
|
361583
361805
|
}
|
|
361584
361806
|
};
|
|
361807
|
+
function convertTodosToPlanEntries(todos) {
|
|
361808
|
+
return todos.map((todo) => ({
|
|
361809
|
+
content: todo.content,
|
|
361810
|
+
priority: "medium",
|
|
361811
|
+
// Default priority since todos don't have priority
|
|
361812
|
+
status: todo.status
|
|
361813
|
+
}));
|
|
361814
|
+
}
|
|
361815
|
+
__name(convertTodosToPlanEntries, "convertTodosToPlanEntries");
|
|
361585
361816
|
function toToolCallContent(toolResult) {
|
|
361586
361817
|
if (toolResult.error?.message) {
|
|
361587
361818
|
throw new Error(toolResult.error.message);
|
|
@@ -361592,19 +361823,6 @@ function toToolCallContent(toolResult) {
|
|
|
361592
361823
|
type: "content",
|
|
361593
361824
|
content: { type: "text", text: toolResult.returnDisplay }
|
|
361594
361825
|
};
|
|
361595
|
-
} else if ("type" in toolResult.returnDisplay && toolResult.returnDisplay.type === "todo_list") {
|
|
361596
|
-
const todoText = toolResult.returnDisplay.todos.map((todo) => {
|
|
361597
|
-
const statusIcon = {
|
|
361598
|
-
pending: "\u25CB",
|
|
361599
|
-
in_progress: "\u25D0",
|
|
361600
|
-
completed: "\u25CF"
|
|
361601
|
-
}[todo.status];
|
|
361602
|
-
return `${statusIcon} ${todo.content}`;
|
|
361603
|
-
}).join("\n");
|
|
361604
|
-
return {
|
|
361605
|
-
type: "content",
|
|
361606
|
-
content: { type: "text", text: todoText }
|
|
361607
|
-
};
|
|
361608
361826
|
} else if ("type" in toolResult.returnDisplay && toolResult.returnDisplay.type === "plan_summary") {
|
|
361609
361827
|
const planDisplay = toolResult.returnDisplay;
|
|
361610
361828
|
const planText = `${planDisplay.message}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rdmind/rdmind",
|
|
3
|
-
"version": "0.0.24-alpha.
|
|
3
|
+
"version": "0.0.24-alpha.1",
|
|
4
4
|
"description": "RDMind - AI-powered coding assistant",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "cli.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"LICENSE"
|
|
20
20
|
],
|
|
21
21
|
"config": {
|
|
22
|
-
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.24-alpha.
|
|
22
|
+
"sandboxImageUri": "ghcr.io/qwenlm/qwen-code:0.0.24-alpha.1"
|
|
23
23
|
},
|
|
24
24
|
"publishConfig": {
|
|
25
25
|
"access": "public"
|