@google/gemini-cli-a2a-server 0.38.0-preview.0 → 0.39.0-nightly.20260408.a39461718
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/a2a-server.mjs +368 -316
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -112259,7 +112259,7 @@ var init_types2 = __esm({
|
|
|
112259
112259
|
InProcessCheckerType2["ALLOWED_PATH"] = "allowed-path";
|
|
112260
112260
|
InProcessCheckerType2["CONSECA"] = "conseca";
|
|
112261
112261
|
})(InProcessCheckerType || (InProcessCheckerType = {}));
|
|
112262
|
-
PRIORITY_SUBAGENT_TOOL = 1.
|
|
112262
|
+
PRIORITY_SUBAGENT_TOOL = 1.03;
|
|
112263
112263
|
ALWAYS_ALLOW_PRIORITY_FRACTION = 950;
|
|
112264
112264
|
ALWAYS_ALLOW_PRIORITY_OFFSET = ALWAYS_ALLOW_PRIORITY_FRACTION / 1e3;
|
|
112265
112265
|
PRIORITY_YOLO_ALLOW_ALL = 998;
|
|
@@ -120054,88 +120054,94 @@ async function* execStreaming(command, args2, options) {
|
|
|
120054
120054
|
cwd: options?.cwd?.toString() ?? process.cwd(),
|
|
120055
120055
|
env: options?.env ?? process.env
|
|
120056
120056
|
});
|
|
120057
|
-
const { program: finalCommand, args: finalArgs, env: finalEnv } = prepared;
|
|
120058
|
-
const child = spawn(finalCommand, finalArgs, {
|
|
120059
|
-
...options,
|
|
120060
|
-
env: finalEnv,
|
|
120061
|
-
// ensure we don't open a window on windows if possible/relevant
|
|
120062
|
-
windowsHide: true
|
|
120063
|
-
});
|
|
120064
|
-
const rl = readline.createInterface({
|
|
120065
|
-
input: child.stdout,
|
|
120066
|
-
terminal: false
|
|
120067
|
-
});
|
|
120068
|
-
const errorChunks = [];
|
|
120069
|
-
let stderrTotalBytes = 0;
|
|
120070
|
-
const MAX_STDERR_BYTES = 20 * 1024;
|
|
120071
|
-
child.stderr.on("data", (chunk2) => {
|
|
120072
|
-
if (stderrTotalBytes < MAX_STDERR_BYTES) {
|
|
120073
|
-
errorChunks.push(chunk2);
|
|
120074
|
-
stderrTotalBytes += chunk2.length;
|
|
120075
|
-
}
|
|
120076
|
-
});
|
|
120077
|
-
let error2 = null;
|
|
120078
|
-
child.on("error", (err2) => {
|
|
120079
|
-
error2 = err2;
|
|
120080
|
-
});
|
|
120081
|
-
const onAbort = () => {
|
|
120082
|
-
if (!child.killed)
|
|
120083
|
-
child.kill();
|
|
120084
|
-
};
|
|
120085
|
-
if (options?.signal?.aborted) {
|
|
120086
|
-
onAbort();
|
|
120087
|
-
} else {
|
|
120088
|
-
options?.signal?.addEventListener("abort", onAbort);
|
|
120089
|
-
}
|
|
120090
|
-
let finished8 = false;
|
|
120091
120057
|
try {
|
|
120092
|
-
|
|
120093
|
-
|
|
120094
|
-
|
|
120095
|
-
|
|
120096
|
-
|
|
120097
|
-
|
|
120098
|
-
|
|
120099
|
-
rl.
|
|
120100
|
-
|
|
120101
|
-
|
|
120102
|
-
|
|
120103
|
-
|
|
120104
|
-
|
|
120105
|
-
|
|
120058
|
+
const { program: finalCommand, args: finalArgs, env: finalEnv } = prepared;
|
|
120059
|
+
const child = spawn(finalCommand, finalArgs, {
|
|
120060
|
+
...options,
|
|
120061
|
+
env: finalEnv,
|
|
120062
|
+
// ensure we don't open a window on windows if possible/relevant
|
|
120063
|
+
windowsHide: true
|
|
120064
|
+
});
|
|
120065
|
+
const rl = readline.createInterface({
|
|
120066
|
+
input: child.stdout,
|
|
120067
|
+
terminal: false
|
|
120068
|
+
});
|
|
120069
|
+
const errorChunks = [];
|
|
120070
|
+
let stderrTotalBytes = 0;
|
|
120071
|
+
const MAX_STDERR_BYTES = 20 * 1024;
|
|
120072
|
+
child.stderr.on("data", (chunk2) => {
|
|
120073
|
+
if (stderrTotalBytes < MAX_STDERR_BYTES) {
|
|
120074
|
+
errorChunks.push(chunk2);
|
|
120075
|
+
stderrTotalBytes += chunk2.length;
|
|
120106
120076
|
}
|
|
120107
|
-
|
|
120077
|
+
});
|
|
120078
|
+
let error2 = null;
|
|
120079
|
+
child.on("error", (err2) => {
|
|
120080
|
+
error2 = err2;
|
|
120081
|
+
});
|
|
120082
|
+
const onAbort = () => {
|
|
120083
|
+
if (!child.killed)
|
|
120084
|
+
child.kill();
|
|
120085
|
+
};
|
|
120086
|
+
if (options?.signal?.aborted) {
|
|
120087
|
+
onAbort();
|
|
120088
|
+
} else {
|
|
120089
|
+
options?.signal?.addEventListener("abort", onAbort);
|
|
120108
120090
|
}
|
|
120109
|
-
|
|
120110
|
-
|
|
120111
|
-
|
|
120112
|
-
|
|
120091
|
+
let finished8 = false;
|
|
120092
|
+
try {
|
|
120093
|
+
for await (const line of rl) {
|
|
120094
|
+
if (options?.signal?.aborted)
|
|
120095
|
+
break;
|
|
120096
|
+
yield line;
|
|
120113
120097
|
}
|
|
120114
|
-
|
|
120115
|
-
|
|
120116
|
-
|
|
120098
|
+
finished8 = true;
|
|
120099
|
+
} finally {
|
|
120100
|
+
rl.close();
|
|
120101
|
+
options?.signal?.removeEventListener("abort", onAbort);
|
|
120102
|
+
let killedByGenerator = false;
|
|
120103
|
+
if (!finished8 && child.exitCode === null && !child.killed) {
|
|
120104
|
+
try {
|
|
120105
|
+
child.kill();
|
|
120106
|
+
} catch {
|
|
120107
|
+
}
|
|
120108
|
+
killedByGenerator = true;
|
|
120109
|
+
}
|
|
120110
|
+
await new Promise((resolve24, reject) => {
|
|
120111
|
+
if (error2) {
|
|
120112
|
+
reject(error2);
|
|
120117
120113
|
return;
|
|
120118
120114
|
}
|
|
120119
|
-
|
|
120120
|
-
|
|
120121
|
-
|
|
120122
|
-
|
|
120123
|
-
|
|
120124
|
-
|
|
120125
|
-
|
|
120126
|
-
|
|
120127
|
-
|
|
120128
|
-
|
|
120115
|
+
function checkExit(code) {
|
|
120116
|
+
if (options?.signal?.aborted || killedByGenerator) {
|
|
120117
|
+
resolve24();
|
|
120118
|
+
return;
|
|
120119
|
+
}
|
|
120120
|
+
const allowed = options?.allowedExitCodes ?? [0];
|
|
120121
|
+
if (code !== null && allowed.includes(code)) {
|
|
120122
|
+
resolve24();
|
|
120123
|
+
} else {
|
|
120124
|
+
if (error2)
|
|
120125
|
+
reject(error2);
|
|
120126
|
+
else {
|
|
120127
|
+
const stderr = Buffer.concat(errorChunks).toString("utf8");
|
|
120128
|
+
const truncatedMsg = stderrTotalBytes >= MAX_STDERR_BYTES ? "...[truncated]" : "";
|
|
120129
|
+
reject(new Error(`Process exited with code ${code}: ${stderr}${truncatedMsg}`));
|
|
120130
|
+
}
|
|
120129
120131
|
}
|
|
120130
120132
|
}
|
|
120131
|
-
|
|
120132
|
-
|
|
120133
|
-
|
|
120134
|
-
|
|
120135
|
-
|
|
120136
|
-
|
|
120137
|
-
|
|
120138
|
-
|
|
120133
|
+
if (child.exitCode !== null) {
|
|
120134
|
+
checkExit(child.exitCode);
|
|
120135
|
+
} else {
|
|
120136
|
+
child.on("close", (code) => checkExit(code));
|
|
120137
|
+
child.on("error", (err2) => {
|
|
120138
|
+
reject(err2);
|
|
120139
|
+
});
|
|
120140
|
+
}
|
|
120141
|
+
});
|
|
120142
|
+
}
|
|
120143
|
+
} finally {
|
|
120144
|
+
prepared.cleanup?.();
|
|
120139
120145
|
}
|
|
120140
120146
|
}
|
|
120141
120147
|
var import_shell_quote, SHELL_TOOL_NAMES, bashLanguage, treeSitterInitialization, treeSitterInitializationError, ShellParserInitializationError, POWERSHELL_COMMAND_ENV, PARSE_TIMEOUT_MICROS, POWERSHELL_PARSER_SCRIPT, REDIRECTION_NAMES, isWindows, spawnAsync;
|
|
@@ -120218,31 +120224,35 @@ foreach ($commandAst in $commandAsts) {
|
|
|
120218
120224
|
env: options?.env ?? process.env
|
|
120219
120225
|
});
|
|
120220
120226
|
const { program: finalCommand, args: finalArgs, env: finalEnv } = prepared;
|
|
120221
|
-
|
|
120222
|
-
|
|
120223
|
-
|
|
120224
|
-
|
|
120225
|
-
|
|
120226
|
-
|
|
120227
|
-
|
|
120228
|
-
|
|
120229
|
-
stdout
|
|
120230
|
-
|
|
120231
|
-
|
|
120232
|
-
stderr
|
|
120233
|
-
|
|
120234
|
-
|
|
120235
|
-
|
|
120236
|
-
|
|
120237
|
-
|
|
120238
|
-
|
|
120227
|
+
try {
|
|
120228
|
+
return await new Promise((resolve24, reject) => {
|
|
120229
|
+
const child = spawn(finalCommand, finalArgs, {
|
|
120230
|
+
...options,
|
|
120231
|
+
env: finalEnv
|
|
120232
|
+
});
|
|
120233
|
+
let stdout = "";
|
|
120234
|
+
let stderr = "";
|
|
120235
|
+
child.stdout.on("data", (data) => {
|
|
120236
|
+
stdout += data.toString();
|
|
120237
|
+
});
|
|
120238
|
+
child.stderr.on("data", (data) => {
|
|
120239
|
+
stderr += data.toString();
|
|
120240
|
+
});
|
|
120241
|
+
child.on("close", (code) => {
|
|
120242
|
+
if (code === 0) {
|
|
120243
|
+
resolve24({ stdout, stderr });
|
|
120244
|
+
} else {
|
|
120245
|
+
reject(new Error(`Command failed with exit code ${code}:
|
|
120239
120246
|
${stderr}`));
|
|
120240
|
-
|
|
120241
|
-
|
|
120242
|
-
|
|
120243
|
-
|
|
120247
|
+
}
|
|
120248
|
+
});
|
|
120249
|
+
child.on("error", (err2) => {
|
|
120250
|
+
reject(err2);
|
|
120251
|
+
});
|
|
120244
120252
|
});
|
|
120245
|
-
}
|
|
120253
|
+
} finally {
|
|
120254
|
+
prepared.cleanup?.();
|
|
120255
|
+
}
|
|
120246
120256
|
};
|
|
120247
120257
|
}
|
|
120248
120258
|
});
|
|
@@ -208731,8 +208741,8 @@ var GIT_COMMIT_INFO, CLI_VERSION;
|
|
|
208731
208741
|
var init_git_commit = __esm({
|
|
208732
208742
|
"packages/core/dist/src/generated/git-commit.js"() {
|
|
208733
208743
|
"use strict";
|
|
208734
|
-
GIT_COMMIT_INFO = "
|
|
208735
|
-
CLI_VERSION = "0.
|
|
208744
|
+
GIT_COMMIT_INFO = "a39461718";
|
|
208745
|
+
CLI_VERSION = "0.39.0-nightly.20260408.a39461718";
|
|
208736
208746
|
}
|
|
208737
208747
|
});
|
|
208738
208748
|
|
|
@@ -331876,7 +331886,7 @@ function getVersion() {
|
|
|
331876
331886
|
}
|
|
331877
331887
|
versionPromise = (async () => {
|
|
331878
331888
|
const pkgJson = await getPackageJson(__dirname4);
|
|
331879
|
-
return "0.
|
|
331889
|
+
return "0.39.0-nightly.20260408.a39461718";
|
|
331880
331890
|
})();
|
|
331881
331891
|
return versionPromise;
|
|
331882
331892
|
}
|
|
@@ -333493,6 +333503,7 @@ var init_tool_registry = __esm({
|
|
|
333493
333503
|
let finalCommand = callCommand;
|
|
333494
333504
|
let finalArgs = args2;
|
|
333495
333505
|
let finalEnv = process.env;
|
|
333506
|
+
let cleanupFunc;
|
|
333496
333507
|
const sandboxManager = this.config.sandboxManager;
|
|
333497
333508
|
if (sandboxManager) {
|
|
333498
333509
|
const prepared = await sandboxManager.prepareCommand({
|
|
@@ -333504,47 +333515,52 @@ var init_tool_registry = __esm({
|
|
|
333504
333515
|
finalCommand = prepared.program;
|
|
333505
333516
|
finalArgs = prepared.args;
|
|
333506
333517
|
finalEnv = prepared.env;
|
|
333518
|
+
cleanupFunc = prepared.cleanup;
|
|
333507
333519
|
}
|
|
333508
|
-
const child = spawn4(finalCommand, finalArgs, {
|
|
333509
|
-
env: finalEnv
|
|
333510
|
-
});
|
|
333511
|
-
child.stdin.write(JSON.stringify(this.params));
|
|
333512
|
-
child.stdin.end();
|
|
333513
333520
|
let stdout = "";
|
|
333514
333521
|
let stderr = "";
|
|
333515
333522
|
let error2 = null;
|
|
333516
333523
|
let code = null;
|
|
333517
333524
|
let signal = null;
|
|
333518
|
-
|
|
333519
|
-
const
|
|
333520
|
-
|
|
333521
|
-
};
|
|
333522
|
-
|
|
333523
|
-
|
|
333524
|
-
|
|
333525
|
-
|
|
333526
|
-
|
|
333527
|
-
|
|
333528
|
-
|
|
333529
|
-
|
|
333530
|
-
|
|
333531
|
-
|
|
333532
|
-
|
|
333533
|
-
|
|
333534
|
-
|
|
333535
|
-
|
|
333536
|
-
|
|
333537
|
-
|
|
333538
|
-
|
|
333539
|
-
|
|
333540
|
-
|
|
333541
|
-
|
|
333542
|
-
|
|
333543
|
-
|
|
333544
|
-
|
|
333545
|
-
|
|
333546
|
-
|
|
333547
|
-
|
|
333525
|
+
try {
|
|
333526
|
+
const child = spawn4(finalCommand, finalArgs, {
|
|
333527
|
+
env: finalEnv
|
|
333528
|
+
});
|
|
333529
|
+
child.stdin.write(JSON.stringify(this.params));
|
|
333530
|
+
child.stdin.end();
|
|
333531
|
+
await new Promise((resolve24) => {
|
|
333532
|
+
const onStdout = (data) => {
|
|
333533
|
+
stdout += data?.toString();
|
|
333534
|
+
};
|
|
333535
|
+
const onStderr = (data) => {
|
|
333536
|
+
stderr += data?.toString();
|
|
333537
|
+
};
|
|
333538
|
+
const onError2 = (err2) => {
|
|
333539
|
+
error2 = err2;
|
|
333540
|
+
};
|
|
333541
|
+
const onClose = (_code, _signal2) => {
|
|
333542
|
+
code = _code;
|
|
333543
|
+
signal = _signal2;
|
|
333544
|
+
cleanup();
|
|
333545
|
+
resolve24();
|
|
333546
|
+
};
|
|
333547
|
+
const cleanup = () => {
|
|
333548
|
+
child.stdout.removeListener("data", onStdout);
|
|
333549
|
+
child.stderr.removeListener("data", onStderr);
|
|
333550
|
+
child.removeListener("error", onError2);
|
|
333551
|
+
child.removeListener("close", onClose);
|
|
333552
|
+
if (child.connected) {
|
|
333553
|
+
child.disconnect();
|
|
333554
|
+
}
|
|
333555
|
+
};
|
|
333556
|
+
child.stdout.on("data", onStdout);
|
|
333557
|
+
child.stderr.on("data", onStderr);
|
|
333558
|
+
child.on("error", onError2);
|
|
333559
|
+
child.on("close", onClose);
|
|
333560
|
+
});
|
|
333561
|
+
} finally {
|
|
333562
|
+
cleanupFunc?.();
|
|
333563
|
+
}
|
|
333548
333564
|
if (error2 || code !== 0 || signal || stderr) {
|
|
333549
333565
|
const llmContent = [
|
|
333550
333566
|
`Stdout: ${stdout || "(empty)"}`,
|
|
@@ -333732,6 +333748,7 @@ Signal: Signal number or \`(none)\` if no signal was received.
|
|
|
333732
333748
|
let finalCommand = firstPart;
|
|
333733
333749
|
let finalArgs = cmdParts.slice(1).filter((p2) => typeof p2 === "string");
|
|
333734
333750
|
let finalEnv = process.env;
|
|
333751
|
+
let cleanupFunc;
|
|
333735
333752
|
const sandboxManager = this.config.sandboxManager;
|
|
333736
333753
|
if (sandboxManager) {
|
|
333737
333754
|
const prepared = await sandboxManager.prepareCommand({
|
|
@@ -333743,87 +333760,94 @@ Signal: Signal number or \`(none)\` if no signal was received.
|
|
|
333743
333760
|
finalCommand = prepared.program;
|
|
333744
333761
|
finalArgs = prepared.args;
|
|
333745
333762
|
finalEnv = prepared.env;
|
|
333763
|
+
cleanupFunc = prepared.cleanup;
|
|
333746
333764
|
}
|
|
333747
|
-
|
|
333748
|
-
|
|
333749
|
-
|
|
333750
|
-
|
|
333751
|
-
|
|
333752
|
-
|
|
333753
|
-
|
|
333754
|
-
|
|
333755
|
-
|
|
333756
|
-
|
|
333757
|
-
|
|
333758
|
-
|
|
333759
|
-
|
|
333760
|
-
|
|
333761
|
-
|
|
333762
|
-
|
|
333763
|
-
|
|
333764
|
-
|
|
333765
|
-
|
|
333766
|
-
|
|
333767
|
-
stdoutByteLength += data.length;
|
|
333768
|
-
stdout += stdoutDecoder.write(data);
|
|
333769
|
-
});
|
|
333770
|
-
proc2.stderr.on("data", (data) => {
|
|
333771
|
-
if (sizeLimitExceeded)
|
|
333772
|
-
return;
|
|
333773
|
-
if (stderrByteLength + data.length > MAX_STDERR_SIZE) {
|
|
333774
|
-
sizeLimitExceeded = true;
|
|
333775
|
-
proc2.kill();
|
|
333776
|
-
return;
|
|
333777
|
-
}
|
|
333778
|
-
stderrByteLength += data.length;
|
|
333779
|
-
stderr += stderrDecoder.write(data);
|
|
333780
|
-
});
|
|
333781
|
-
await new Promise((resolve24, reject) => {
|
|
333782
|
-
proc2.on("error", reject);
|
|
333783
|
-
proc2.on("close", (code) => {
|
|
333784
|
-
stdout += stdoutDecoder.end();
|
|
333785
|
-
stderr += stderrDecoder.end();
|
|
333786
|
-
if (sizeLimitExceeded) {
|
|
333787
|
-
return reject(new Error(`Tool discovery command output exceeded size limit of ${MAX_STDOUT_SIZE} bytes.`));
|
|
333788
|
-
}
|
|
333789
|
-
if (code !== 0) {
|
|
333790
|
-
coreEvents.emitFeedback("error", `Tool discovery command failed with code ${code}.`, stderr);
|
|
333791
|
-
return reject(new Error(`Tool discovery command failed with exit code ${code}`));
|
|
333765
|
+
try {
|
|
333766
|
+
const proc2 = spawn4(finalCommand, finalArgs, {
|
|
333767
|
+
env: finalEnv
|
|
333768
|
+
});
|
|
333769
|
+
let stdout = "";
|
|
333770
|
+
const stdoutDecoder = new StringDecoder("utf8");
|
|
333771
|
+
let stderr = "";
|
|
333772
|
+
const stderrDecoder = new StringDecoder("utf8");
|
|
333773
|
+
let sizeLimitExceeded = false;
|
|
333774
|
+
const MAX_STDOUT_SIZE = 10 * 1024 * 1024;
|
|
333775
|
+
const MAX_STDERR_SIZE = 10 * 1024 * 1024;
|
|
333776
|
+
let stdoutByteLength = 0;
|
|
333777
|
+
let stderrByteLength = 0;
|
|
333778
|
+
proc2.stdout.on("data", (data) => {
|
|
333779
|
+
if (sizeLimitExceeded)
|
|
333780
|
+
return;
|
|
333781
|
+
if (stdoutByteLength + data.length > MAX_STDOUT_SIZE) {
|
|
333782
|
+
sizeLimitExceeded = true;
|
|
333783
|
+
proc2.kill();
|
|
333784
|
+
return;
|
|
333792
333785
|
}
|
|
333793
|
-
|
|
333786
|
+
stdoutByteLength += data.length;
|
|
333787
|
+
stdout += stdoutDecoder.write(data);
|
|
333794
333788
|
});
|
|
333795
|
-
|
|
333796
|
-
|
|
333797
|
-
|
|
333798
|
-
|
|
333799
|
-
|
|
333800
|
-
|
|
333801
|
-
|
|
333802
|
-
|
|
333803
|
-
|
|
333804
|
-
|
|
333805
|
-
|
|
333806
|
-
|
|
333807
|
-
|
|
333808
|
-
|
|
333789
|
+
proc2.stderr.on("data", (data) => {
|
|
333790
|
+
if (sizeLimitExceeded)
|
|
333791
|
+
return;
|
|
333792
|
+
if (stderrByteLength + data.length > MAX_STDERR_SIZE) {
|
|
333793
|
+
sizeLimitExceeded = true;
|
|
333794
|
+
proc2.kill();
|
|
333795
|
+
return;
|
|
333796
|
+
}
|
|
333797
|
+
stderrByteLength += data.length;
|
|
333798
|
+
stderr += stderrDecoder.write(data);
|
|
333799
|
+
});
|
|
333800
|
+
await new Promise((resolve24, reject) => {
|
|
333801
|
+
proc2.on("error", (err2) => {
|
|
333802
|
+
reject(err2);
|
|
333803
|
+
});
|
|
333804
|
+
proc2.on("close", (code) => {
|
|
333805
|
+
stdout += stdoutDecoder.end();
|
|
333806
|
+
stderr += stderrDecoder.end();
|
|
333807
|
+
if (sizeLimitExceeded) {
|
|
333808
|
+
return reject(new Error(`Tool discovery command output exceeded size limit of ${MAX_STDOUT_SIZE} bytes.`));
|
|
333809
|
+
}
|
|
333810
|
+
if (code !== 0) {
|
|
333811
|
+
coreEvents.emitFeedback("error", `Tool discovery command failed with code ${code}.`, stderr);
|
|
333812
|
+
return reject(new Error(`Tool discovery command failed with exit code ${code}`));
|
|
333813
|
+
}
|
|
333814
|
+
resolve24();
|
|
333815
|
+
});
|
|
333816
|
+
});
|
|
333817
|
+
const functions = [];
|
|
333818
|
+
const discoveredItems = JSON.parse(stdout.trim());
|
|
333819
|
+
if (!discoveredItems || !Array.isArray(discoveredItems)) {
|
|
333820
|
+
throw new Error("Tool discovery command did not return a JSON array of tools.");
|
|
333821
|
+
}
|
|
333822
|
+
for (const tool of discoveredItems) {
|
|
333823
|
+
if (tool && typeof tool === "object") {
|
|
333824
|
+
if (Array.isArray(tool["function_declarations"])) {
|
|
333825
|
+
functions.push(...tool["function_declarations"]);
|
|
333826
|
+
} else if (Array.isArray(tool["functionDeclarations"])) {
|
|
333827
|
+
functions.push(...tool["functionDeclarations"]);
|
|
333828
|
+
} else if (tool["name"]) {
|
|
333829
|
+
functions.push(tool);
|
|
333830
|
+
}
|
|
333809
333831
|
}
|
|
333810
333832
|
}
|
|
333811
|
-
|
|
333812
|
-
|
|
333813
|
-
|
|
333814
|
-
|
|
333815
|
-
|
|
333833
|
+
for (const func2 of functions) {
|
|
333834
|
+
if (!func2.name) {
|
|
333835
|
+
debugLogger.warn("Discovered a tool with no name. Skipping.");
|
|
333836
|
+
continue;
|
|
333837
|
+
}
|
|
333838
|
+
const parameters = func2.parametersJsonSchema && typeof func2.parametersJsonSchema === "object" && !Array.isArray(func2.parametersJsonSchema) ? func2.parametersJsonSchema : {};
|
|
333839
|
+
this.registerTool(new DiscoveredTool(
|
|
333840
|
+
this.config,
|
|
333841
|
+
func2.name,
|
|
333842
|
+
DISCOVERED_TOOL_PREFIX + func2.name,
|
|
333843
|
+
func2.description ?? "",
|
|
333844
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
333845
|
+
parameters,
|
|
333846
|
+
this.messageBus
|
|
333847
|
+
));
|
|
333816
333848
|
}
|
|
333817
|
-
|
|
333818
|
-
|
|
333819
|
-
this.config,
|
|
333820
|
-
func2.name,
|
|
333821
|
-
DISCOVERED_TOOL_PREFIX + func2.name,
|
|
333822
|
-
func2.description ?? "",
|
|
333823
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
|
333824
|
-
parameters,
|
|
333825
|
-
this.messageBus
|
|
333826
|
-
));
|
|
333849
|
+
} finally {
|
|
333850
|
+
cleanupFunc?.();
|
|
333827
333851
|
}
|
|
333828
333852
|
} catch (e3) {
|
|
333829
333853
|
debugLogger.error(`Tool discovery command "${discoveryCmd}" failed:`, e3);
|
|
@@ -342642,6 +342666,7 @@ var init_grep = __esm({
|
|
|
342642
342666
|
let finalCommand = checkCommand;
|
|
342643
342667
|
let finalArgs = checkArgs;
|
|
342644
342668
|
let finalEnv = process.env;
|
|
342669
|
+
let cleanup;
|
|
342645
342670
|
if (sandboxManager) {
|
|
342646
342671
|
try {
|
|
342647
342672
|
const prepared = await sandboxManager.prepareCommand({
|
|
@@ -342653,22 +342678,29 @@ var init_grep = __esm({
|
|
|
342653
342678
|
finalCommand = prepared.program;
|
|
342654
342679
|
finalArgs = prepared.args;
|
|
342655
342680
|
finalEnv = prepared.env;
|
|
342681
|
+
cleanup = prepared.cleanup;
|
|
342656
342682
|
} catch (err2) {
|
|
342657
342683
|
debugLogger.debug(`[GrepTool] Sandbox preparation failed for '${command}':`, err2);
|
|
342658
342684
|
}
|
|
342659
342685
|
}
|
|
342660
|
-
|
|
342661
|
-
|
|
342662
|
-
|
|
342663
|
-
|
|
342664
|
-
|
|
342665
|
-
|
|
342666
|
-
|
|
342667
|
-
|
|
342668
|
-
|
|
342669
|
-
|
|
342686
|
+
try {
|
|
342687
|
+
return await new Promise((resolve24) => {
|
|
342688
|
+
const child = spawn5(finalCommand, finalArgs, {
|
|
342689
|
+
stdio: "ignore",
|
|
342690
|
+
shell: true,
|
|
342691
|
+
env: finalEnv
|
|
342692
|
+
});
|
|
342693
|
+
child.on("close", (code) => {
|
|
342694
|
+
resolve24(code === 0);
|
|
342695
|
+
});
|
|
342696
|
+
child.on("error", (err2) => {
|
|
342697
|
+
debugLogger.debug(`[GrepTool] Failed to start process for '${command}':`, err2.message);
|
|
342698
|
+
resolve24(false);
|
|
342699
|
+
});
|
|
342670
342700
|
});
|
|
342671
|
-
}
|
|
342701
|
+
} finally {
|
|
342702
|
+
cleanup?.();
|
|
342703
|
+
}
|
|
342672
342704
|
} catch {
|
|
342673
342705
|
return false;
|
|
342674
342706
|
}
|
|
@@ -372787,6 +372819,7 @@ ${truncated}`;
|
|
|
372787
372819
|
};
|
|
372788
372820
|
}
|
|
372789
372821
|
static async childProcessFallback(commandToExecute, cwd, onOutputEvent, abortSignal, shellExecutionConfig, isInteractive) {
|
|
372822
|
+
let cmdCleanup;
|
|
372790
372823
|
try {
|
|
372791
372824
|
let cleanup2 = function() {
|
|
372792
372825
|
exited = true;
|
|
@@ -372827,7 +372860,9 @@ ${truncated}`;
|
|
|
372827
372860
|
};
|
|
372828
372861
|
var cleanup = cleanup2;
|
|
372829
372862
|
const isWindows2 = os31.platform() === "win32";
|
|
372830
|
-
const
|
|
372863
|
+
const prepared = await this.prepareExecution(commandToExecute, cwd, shellExecutionConfig, isInteractive);
|
|
372864
|
+
cmdCleanup = prepared.cleanup;
|
|
372865
|
+
const { program: finalExecutable, args: finalArgs, env: finalEnv, cwd: finalCwd } = prepared;
|
|
372831
372866
|
const child = cpSpawn(finalExecutable, finalArgs, {
|
|
372832
372867
|
cwd: finalCwd,
|
|
372833
372868
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -373022,6 +373057,7 @@ ${truncated}`;
|
|
|
373022
373057
|
return { pid: child.pid, result: result2 };
|
|
373023
373058
|
} catch (e3) {
|
|
373024
373059
|
const error2 = e3;
|
|
373060
|
+
cmdCleanup?.();
|
|
373025
373061
|
return {
|
|
373026
373062
|
pid: void 0,
|
|
373027
373063
|
result: Promise.resolve({
|
|
@@ -373042,10 +373078,13 @@ ${truncated}`;
|
|
|
373042
373078
|
throw new Error("PTY implementation not found");
|
|
373043
373079
|
}
|
|
373044
373080
|
let spawnedPty;
|
|
373081
|
+
let cmdCleanup;
|
|
373045
373082
|
try {
|
|
373046
373083
|
const cols = shellExecutionConfig.terminalWidth ?? 80;
|
|
373047
373084
|
const rows = shellExecutionConfig.terminalHeight ?? 30;
|
|
373048
|
-
const
|
|
373085
|
+
const prepared = await this.prepareExecution(commandToExecute, cwd, shellExecutionConfig, true);
|
|
373086
|
+
cmdCleanup = prepared.cleanup;
|
|
373087
|
+
const { program: finalExecutable, args: finalArgs, env: finalEnv, cwd: finalCwd } = prepared;
|
|
373049
373088
|
const ptyProcess = ptyInfo.module.spawn(finalExecutable, finalArgs, {
|
|
373050
373089
|
cwd: finalCwd,
|
|
373051
373090
|
name: "xterm-256color",
|
|
@@ -373328,6 +373367,7 @@ ${truncated}`;
|
|
|
373328
373367
|
return { pid: ptyPid, result: result2 };
|
|
373329
373368
|
} catch (e3) {
|
|
373330
373369
|
const error2 = e3;
|
|
373370
|
+
cmdCleanup?.();
|
|
373331
373371
|
if (spawnedPty) {
|
|
373332
373372
|
try {
|
|
373333
373373
|
spawnedPty.destroy?.();
|
|
@@ -391388,35 +391428,39 @@ var init_sandboxedFileSystemService = __esm({
|
|
|
391388
391428
|
allowedPaths: [safePath]
|
|
391389
391429
|
}
|
|
391390
391430
|
});
|
|
391391
|
-
|
|
391392
|
-
|
|
391393
|
-
|
|
391394
|
-
|
|
391395
|
-
|
|
391396
|
-
|
|
391397
|
-
|
|
391398
|
-
|
|
391399
|
-
|
|
391400
|
-
|
|
391401
|
-
|
|
391402
|
-
|
|
391403
|
-
|
|
391404
|
-
|
|
391405
|
-
|
|
391406
|
-
|
|
391407
|
-
|
|
391408
|
-
|
|
391409
|
-
|
|
391410
|
-
|
|
391411
|
-
|
|
391431
|
+
try {
|
|
391432
|
+
return await new Promise((resolve24, reject) => {
|
|
391433
|
+
const child = spawn8(prepared.program, prepared.args, {
|
|
391434
|
+
cwd: this.cwd,
|
|
391435
|
+
env: prepared.env
|
|
391436
|
+
});
|
|
391437
|
+
let output = "";
|
|
391438
|
+
let error2 = "";
|
|
391439
|
+
child.stdout?.on("data", (data) => {
|
|
391440
|
+
output += data.toString();
|
|
391441
|
+
});
|
|
391442
|
+
child.stderr?.on("data", (data) => {
|
|
391443
|
+
error2 += data.toString();
|
|
391444
|
+
});
|
|
391445
|
+
child.on("close", (code) => {
|
|
391446
|
+
if (code === 0) {
|
|
391447
|
+
resolve24(output);
|
|
391448
|
+
} else {
|
|
391449
|
+
const isEnoent = error2.toLowerCase().includes("no such file or directory") || error2.toLowerCase().includes("enoent") || error2.toLowerCase().includes("could not find file") || error2.toLowerCase().includes("could not find a part of the path");
|
|
391450
|
+
const err2 = new Error(`Sandbox Error: read_file failed for '${filePath}'. Exit code ${code}. ${error2 ? "Details: " + error2 : ""}`);
|
|
391451
|
+
if (isEnoent) {
|
|
391452
|
+
Object.assign(err2, { code: "ENOENT" });
|
|
391453
|
+
}
|
|
391454
|
+
reject(err2);
|
|
391412
391455
|
}
|
|
391413
|
-
|
|
391414
|
-
|
|
391415
|
-
|
|
391416
|
-
|
|
391417
|
-
reject(new Error(`Sandbox Error: Failed to spawn read_file for '${filePath}': ${err2.message}`));
|
|
391456
|
+
});
|
|
391457
|
+
child.on("error", (err2) => {
|
|
391458
|
+
reject(new Error(`Sandbox Error: Failed to spawn read_file for '${filePath}': ${err2.message}`));
|
|
391459
|
+
});
|
|
391418
391460
|
});
|
|
391419
|
-
}
|
|
391461
|
+
} finally {
|
|
391462
|
+
prepared.cleanup?.();
|
|
391463
|
+
}
|
|
391420
391464
|
}
|
|
391421
391465
|
async writeTextFile(filePath, content) {
|
|
391422
391466
|
const safePath = this.sanitizeAndValidatePath(filePath);
|
|
@@ -391434,34 +391478,38 @@ var init_sandboxedFileSystemService = __esm({
|
|
|
391434
391478
|
}
|
|
391435
391479
|
}
|
|
391436
391480
|
});
|
|
391437
|
-
|
|
391438
|
-
|
|
391439
|
-
|
|
391440
|
-
|
|
391441
|
-
|
|
391442
|
-
|
|
391443
|
-
|
|
391444
|
-
|
|
391445
|
-
|
|
391446
|
-
|
|
391447
|
-
|
|
391448
|
-
|
|
391449
|
-
|
|
391450
|
-
|
|
391451
|
-
|
|
391452
|
-
|
|
391453
|
-
|
|
391454
|
-
|
|
391455
|
-
|
|
391456
|
-
|
|
391457
|
-
|
|
391458
|
-
|
|
391459
|
-
|
|
391460
|
-
|
|
391461
|
-
|
|
391462
|
-
|
|
391481
|
+
try {
|
|
391482
|
+
return await new Promise((resolve24, reject) => {
|
|
391483
|
+
const child = spawn8(prepared.program, prepared.args, {
|
|
391484
|
+
cwd: this.cwd,
|
|
391485
|
+
env: prepared.env
|
|
391486
|
+
});
|
|
391487
|
+
child.stdin?.on("error", (err2) => {
|
|
391488
|
+
if (isNodeError(err2) && err2.code === "EPIPE") {
|
|
391489
|
+
return;
|
|
391490
|
+
}
|
|
391491
|
+
debugLogger.error(`Sandbox Error: stdin error for '${filePath}': ${err2 instanceof Error ? err2.message : String(err2)}`);
|
|
391492
|
+
});
|
|
391493
|
+
child.stdin?.write(content);
|
|
391494
|
+
child.stdin?.end();
|
|
391495
|
+
let error2 = "";
|
|
391496
|
+
child.stderr?.on("data", (data) => {
|
|
391497
|
+
error2 += data.toString();
|
|
391498
|
+
});
|
|
391499
|
+
child.on("close", (code) => {
|
|
391500
|
+
if (code === 0) {
|
|
391501
|
+
resolve24();
|
|
391502
|
+
} else {
|
|
391503
|
+
reject(new Error(`Sandbox Error: write_file failed for '${filePath}'. Exit code ${code}. ${error2 ? "Details: " + error2 : ""}`));
|
|
391504
|
+
}
|
|
391505
|
+
});
|
|
391506
|
+
child.on("error", (err2) => {
|
|
391507
|
+
reject(new Error(`Sandbox Error: Failed to spawn write_file for '${filePath}': ${err2.message}`));
|
|
391508
|
+
});
|
|
391463
391509
|
});
|
|
391464
|
-
}
|
|
391510
|
+
} finally {
|
|
391511
|
+
prepared.cleanup?.();
|
|
391512
|
+
}
|
|
391465
391513
|
}
|
|
391466
391514
|
};
|
|
391467
391515
|
}
|
|
@@ -439684,6 +439732,45 @@ var init_init2 = __esm({
|
|
|
439684
439732
|
}
|
|
439685
439733
|
});
|
|
439686
439734
|
|
|
439735
|
+
// packages/core/dist/src/agents/skill-extraction-agent.js
|
|
439736
|
+
var SkillExtractionSchema;
|
|
439737
|
+
var init_skill_extraction_agent = __esm({
|
|
439738
|
+
"packages/core/dist/src/agents/skill-extraction-agent.js"() {
|
|
439739
|
+
"use strict";
|
|
439740
|
+
init_zod();
|
|
439741
|
+
init_tool_names();
|
|
439742
|
+
init_models();
|
|
439743
|
+
SkillExtractionSchema = external_exports.object({
|
|
439744
|
+
response: external_exports.string().describe("A summary of the skills extracted or updated.")
|
|
439745
|
+
});
|
|
439746
|
+
}
|
|
439747
|
+
});
|
|
439748
|
+
|
|
439749
|
+
// packages/core/dist/src/services/memoryService.js
|
|
439750
|
+
var LOCK_STALE_MS, MIN_IDLE_MS;
|
|
439751
|
+
var init_memoryService = __esm({
|
|
439752
|
+
"packages/core/dist/src/services/memoryService.js"() {
|
|
439753
|
+
"use strict";
|
|
439754
|
+
init_chatRecordingService();
|
|
439755
|
+
init_debugLogger();
|
|
439756
|
+
init_events();
|
|
439757
|
+
init_errors2();
|
|
439758
|
+
init_skillLoader();
|
|
439759
|
+
init_local_executor();
|
|
439760
|
+
init_skill_extraction_agent();
|
|
439761
|
+
init_registry();
|
|
439762
|
+
init_executionLifecycleService();
|
|
439763
|
+
init_prompt_registry();
|
|
439764
|
+
init_resource_registry();
|
|
439765
|
+
init_policy_engine();
|
|
439766
|
+
init_types2();
|
|
439767
|
+
init_message_bus();
|
|
439768
|
+
init_storage();
|
|
439769
|
+
LOCK_STALE_MS = 35 * 60 * 1e3;
|
|
439770
|
+
MIN_IDLE_MS = 3 * 60 * 60 * 1e3;
|
|
439771
|
+
}
|
|
439772
|
+
});
|
|
439773
|
+
|
|
439687
439774
|
// packages/core/dist/src/commands/memory.js
|
|
439688
439775
|
function showMemory(config3) {
|
|
439689
439776
|
const memoryContent = flattenMemory(config3.getUserMemory());
|
|
@@ -439763,7 +439850,10 @@ ${filePaths.join("\n")}`;
|
|
|
439763
439850
|
var init_memory2 = __esm({
|
|
439764
439851
|
"packages/core/dist/src/commands/memory.js"() {
|
|
439765
439852
|
"use strict";
|
|
439853
|
+
init_storage();
|
|
439766
439854
|
init_memory();
|
|
439855
|
+
init_skillLoader();
|
|
439856
|
+
init_memoryService();
|
|
439767
439857
|
init_memoryDiscovery();
|
|
439768
439858
|
}
|
|
439769
439859
|
});
|
|
@@ -442368,44 +442458,6 @@ var init_sessionSummaryUtils = __esm({
|
|
|
442368
442458
|
}
|
|
442369
442459
|
});
|
|
442370
442460
|
|
|
442371
|
-
// packages/core/dist/src/agents/skill-extraction-agent.js
|
|
442372
|
-
var SkillExtractionSchema;
|
|
442373
|
-
var init_skill_extraction_agent = __esm({
|
|
442374
|
-
"packages/core/dist/src/agents/skill-extraction-agent.js"() {
|
|
442375
|
-
"use strict";
|
|
442376
|
-
init_zod();
|
|
442377
|
-
init_tool_names();
|
|
442378
|
-
init_models();
|
|
442379
|
-
SkillExtractionSchema = external_exports.object({
|
|
442380
|
-
response: external_exports.string().describe("A summary of the skills extracted or updated.")
|
|
442381
|
-
});
|
|
442382
|
-
}
|
|
442383
|
-
});
|
|
442384
|
-
|
|
442385
|
-
// packages/core/dist/src/services/memoryService.js
|
|
442386
|
-
var LOCK_STALE_MS, MIN_IDLE_MS;
|
|
442387
|
-
var init_memoryService = __esm({
|
|
442388
|
-
"packages/core/dist/src/services/memoryService.js"() {
|
|
442389
|
-
"use strict";
|
|
442390
|
-
init_chatRecordingService();
|
|
442391
|
-
init_debugLogger();
|
|
442392
|
-
init_errors2();
|
|
442393
|
-
init_skillLoader();
|
|
442394
|
-
init_local_executor();
|
|
442395
|
-
init_skill_extraction_agent();
|
|
442396
|
-
init_registry();
|
|
442397
|
-
init_executionLifecycleService();
|
|
442398
|
-
init_prompt_registry();
|
|
442399
|
-
init_resource_registry();
|
|
442400
|
-
init_policy_engine();
|
|
442401
|
-
init_types2();
|
|
442402
|
-
init_message_bus();
|
|
442403
|
-
init_storage();
|
|
442404
|
-
LOCK_STALE_MS = 35 * 60 * 1e3;
|
|
442405
|
-
MIN_IDLE_MS = 3 * 60 * 60 * 1e3;
|
|
442406
|
-
}
|
|
442407
|
-
});
|
|
442408
|
-
|
|
442409
442461
|
// packages/core/dist/src/ide/ide-installer.js
|
|
442410
442462
|
var init_ide_installer = __esm({
|
|
442411
442463
|
"packages/core/dist/src/ide/ide-installer.js"() {
|