@google/gemini-cli-a2a-server 0.11.0-nightly.20251020.a96f0659 → 0.11.0-nightly.20251021.e72c00cf
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 +405 -230
- package/dist/src/agent/task.d.ts +3 -3
- package/dist/src/agent/task.js +15 -11
- package/dist/src/agent/task.js.map +1 -1
- package/dist/src/agent/task.test.js +26 -0
- package/dist/src/agent/task.test.js.map +1 -1
- package/dist/src/config/config.js +1 -2
- package/dist/src/config/config.js.map +1 -1
- package/dist/src/http/app.test.js +23 -0
- package/dist/src/http/app.test.js.map +1 -1
- package/dist/src/persistence/gcs.js +9 -0
- package/dist/src/persistence/gcs.js.map +1 -1
- package/dist/src/persistence/gcs.test.js +31 -0
- package/dist/src/persistence/gcs.test.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -223680,7 +223680,7 @@ var require_proxy_agent = __commonJS({
|
|
|
223680
223680
|
return this.#client.destroy(err2);
|
|
223681
223681
|
}
|
|
223682
223682
|
};
|
|
223683
|
-
var
|
|
223683
|
+
var ProxyAgent2 = class extends DispatcherBase {
|
|
223684
223684
|
constructor(opts) {
|
|
223685
223685
|
if (!opts || typeof opts === "object" && !(opts instanceof URL) && !opts.uri) {
|
|
223686
223686
|
throw new InvalidArgumentError("Proxy uri is mandatory");
|
|
@@ -223821,7 +223821,7 @@ var require_proxy_agent = __commonJS({
|
|
|
223821
223821
|
throw new InvalidArgumentError("Proxy-Authorization should be sent in ProxyAgent constructor");
|
|
223822
223822
|
}
|
|
223823
223823
|
}
|
|
223824
|
-
module2.exports =
|
|
223824
|
+
module2.exports = ProxyAgent2;
|
|
223825
223825
|
}
|
|
223826
223826
|
});
|
|
223827
223827
|
|
|
@@ -223831,7 +223831,7 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
223831
223831
|
"use strict";
|
|
223832
223832
|
var DispatcherBase = require_dispatcher_base();
|
|
223833
223833
|
var { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = require_symbols();
|
|
223834
|
-
var
|
|
223834
|
+
var ProxyAgent2 = require_proxy_agent();
|
|
223835
223835
|
var Agent3 = require_agent4();
|
|
223836
223836
|
var DEFAULT_PORTS = {
|
|
223837
223837
|
"http:": 80,
|
|
@@ -223848,13 +223848,13 @@ var require_env_http_proxy_agent = __commonJS({
|
|
|
223848
223848
|
this[kNoProxyAgent] = new Agent3(agentOpts);
|
|
223849
223849
|
const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY;
|
|
223850
223850
|
if (HTTP_PROXY) {
|
|
223851
|
-
this[kHttpProxyAgent] = new
|
|
223851
|
+
this[kHttpProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTP_PROXY });
|
|
223852
223852
|
} else {
|
|
223853
223853
|
this[kHttpProxyAgent] = this[kNoProxyAgent];
|
|
223854
223854
|
}
|
|
223855
223855
|
const HTTPS_PROXY = httpsProxy ?? process.env.https_proxy ?? process.env.HTTPS_PROXY;
|
|
223856
223856
|
if (HTTPS_PROXY) {
|
|
223857
|
-
this[kHttpsProxyAgent] = new
|
|
223857
|
+
this[kHttpsProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTPS_PROXY });
|
|
223858
223858
|
} else {
|
|
223859
223859
|
this[kHttpsProxyAgent] = this[kHttpProxyAgent];
|
|
223860
223860
|
}
|
|
@@ -227433,9 +227433,9 @@ var require_global2 = __commonJS({
|
|
|
227433
227433
|
var { InvalidArgumentError } = require_errors6();
|
|
227434
227434
|
var Agent3 = require_agent4();
|
|
227435
227435
|
if (getGlobalDispatcher() === void 0) {
|
|
227436
|
-
|
|
227436
|
+
setGlobalDispatcher2(new Agent3());
|
|
227437
227437
|
}
|
|
227438
|
-
function
|
|
227438
|
+
function setGlobalDispatcher2(agent) {
|
|
227439
227439
|
if (!agent || typeof agent.dispatch !== "function") {
|
|
227440
227440
|
throw new InvalidArgumentError("Argument agent must implement Agent");
|
|
227441
227441
|
}
|
|
@@ -227450,7 +227450,7 @@ var require_global2 = __commonJS({
|
|
|
227450
227450
|
return globalThis[globalDispatcher];
|
|
227451
227451
|
}
|
|
227452
227452
|
module2.exports = {
|
|
227453
|
-
setGlobalDispatcher:
|
|
227453
|
+
setGlobalDispatcher: setGlobalDispatcher2,
|
|
227454
227454
|
getGlobalDispatcher
|
|
227455
227455
|
};
|
|
227456
227456
|
}
|
|
@@ -236675,7 +236675,7 @@ var require_undici = __commonJS({
|
|
|
236675
236675
|
var Pool = require_pool2();
|
|
236676
236676
|
var BalancedPool = require_balanced_pool();
|
|
236677
236677
|
var Agent3 = require_agent4();
|
|
236678
|
-
var
|
|
236678
|
+
var ProxyAgent2 = require_proxy_agent();
|
|
236679
236679
|
var EnvHttpProxyAgent2 = require_env_http_proxy_agent();
|
|
236680
236680
|
var RetryAgent = require_retry_agent();
|
|
236681
236681
|
var H2CClient = require_h2c_client();
|
|
@@ -236691,7 +236691,7 @@ var require_undici = __commonJS({
|
|
|
236691
236691
|
var SnapshotAgent = require_snapshot_agent();
|
|
236692
236692
|
var mockErrors = require_mock_errors();
|
|
236693
236693
|
var RetryHandler = require_retry_handler();
|
|
236694
|
-
var { getGlobalDispatcher, setGlobalDispatcher:
|
|
236694
|
+
var { getGlobalDispatcher, setGlobalDispatcher: setGlobalDispatcher2 } = require_global2();
|
|
236695
236695
|
var DecoratorHandler = require_decorator_handler();
|
|
236696
236696
|
var RedirectHandler = require_redirect_handler();
|
|
236697
236697
|
Object.assign(Dispatcher.prototype, api);
|
|
@@ -236700,7 +236700,7 @@ var require_undici = __commonJS({
|
|
|
236700
236700
|
module2.exports.Pool = Pool;
|
|
236701
236701
|
module2.exports.BalancedPool = BalancedPool;
|
|
236702
236702
|
module2.exports.Agent = Agent3;
|
|
236703
|
-
module2.exports.ProxyAgent =
|
|
236703
|
+
module2.exports.ProxyAgent = ProxyAgent2;
|
|
236704
236704
|
module2.exports.EnvHttpProxyAgent = EnvHttpProxyAgent2;
|
|
236705
236705
|
module2.exports.RetryAgent = RetryAgent;
|
|
236706
236706
|
module2.exports.H2CClient = H2CClient;
|
|
@@ -236766,7 +236766,7 @@ var require_undici = __commonJS({
|
|
|
236766
236766
|
}, handler);
|
|
236767
236767
|
};
|
|
236768
236768
|
}
|
|
236769
|
-
module2.exports.setGlobalDispatcher =
|
|
236769
|
+
module2.exports.setGlobalDispatcher = setGlobalDispatcher2;
|
|
236770
236770
|
module2.exports.getGlobalDispatcher = getGlobalDispatcher;
|
|
236771
236771
|
var fetchImpl = require_fetch2().fetch;
|
|
236772
236772
|
module2.exports.fetch = async function fetch2(init3, options2 = void 0) {
|
|
@@ -285847,6 +285847,7 @@ function fromGenerateContentResponse(res) {
|
|
|
285847
285847
|
out2.promptFeedback = inres.promptFeedback;
|
|
285848
285848
|
out2.usageMetadata = inres.usageMetadata;
|
|
285849
285849
|
out2.modelVersion = inres.modelVersion;
|
|
285850
|
+
out2.responseId = res.traceId;
|
|
285850
285851
|
return out2;
|
|
285851
285852
|
}
|
|
285852
285853
|
function toVertexGenerateContentRequest(req, sessionId2) {
|
|
@@ -286303,24 +286304,53 @@ var MessageBusType;
|
|
|
286303
286304
|
MessageBusType2["TOOL_POLICY_REJECTION"] = "tool-policy-rejection";
|
|
286304
286305
|
MessageBusType2["TOOL_EXECUTION_SUCCESS"] = "tool-execution-success";
|
|
286305
286306
|
MessageBusType2["TOOL_EXECUTION_FAILURE"] = "tool-execution-failure";
|
|
286307
|
+
MessageBusType2["UPDATE_POLICY"] = "update-policy";
|
|
286306
286308
|
})(MessageBusType || (MessageBusType = {}));
|
|
286307
286309
|
|
|
286308
286310
|
// packages/core/dist/src/tools/tools.js
|
|
286309
286311
|
var BaseToolInvocation = class {
|
|
286310
286312
|
params;
|
|
286311
286313
|
messageBus;
|
|
286312
|
-
|
|
286314
|
+
_toolName;
|
|
286315
|
+
_toolDisplayName;
|
|
286316
|
+
constructor(params, messageBus, _toolName, _toolDisplayName) {
|
|
286313
286317
|
this.params = params;
|
|
286314
286318
|
this.messageBus = messageBus;
|
|
286315
|
-
|
|
286316
|
-
|
|
286317
|
-
}
|
|
286319
|
+
this._toolName = _toolName;
|
|
286320
|
+
this._toolDisplayName = _toolDisplayName;
|
|
286318
286321
|
}
|
|
286319
286322
|
toolLocations() {
|
|
286320
286323
|
return [];
|
|
286321
286324
|
}
|
|
286322
|
-
shouldConfirmExecute(
|
|
286323
|
-
|
|
286325
|
+
async shouldConfirmExecute(abortSignal) {
|
|
286326
|
+
if (this.messageBus) {
|
|
286327
|
+
const decision = await this.getMessageBusDecision(abortSignal);
|
|
286328
|
+
if (decision === "ALLOW") {
|
|
286329
|
+
return false;
|
|
286330
|
+
}
|
|
286331
|
+
if (decision === "DENY") {
|
|
286332
|
+
throw new Error(`Tool execution for "${this._toolDisplayName || this._toolName}" denied by policy.`);
|
|
286333
|
+
}
|
|
286334
|
+
if (decision === "ASK_USER") {
|
|
286335
|
+
const confirmationDetails = {
|
|
286336
|
+
type: "info",
|
|
286337
|
+
title: `Confirm: ${this._toolDisplayName || this._toolName}`,
|
|
286338
|
+
prompt: this.getDescription(),
|
|
286339
|
+
onConfirm: async (outcome) => {
|
|
286340
|
+
if (outcome === ToolConfirmationOutcome.ProceedAlways) {
|
|
286341
|
+
if (this.messageBus && this._toolName) {
|
|
286342
|
+
this.messageBus.publish({
|
|
286343
|
+
type: MessageBusType.UPDATE_POLICY,
|
|
286344
|
+
toolName: this._toolName
|
|
286345
|
+
});
|
|
286346
|
+
}
|
|
286347
|
+
}
|
|
286348
|
+
}
|
|
286349
|
+
};
|
|
286350
|
+
return confirmationDetails;
|
|
286351
|
+
}
|
|
286352
|
+
}
|
|
286353
|
+
return false;
|
|
286324
286354
|
}
|
|
286325
286355
|
getMessageBusDecision(abortSignal) {
|
|
286326
286356
|
if (!this.messageBus) {
|
|
@@ -286328,7 +286358,7 @@ var BaseToolInvocation = class {
|
|
|
286328
286358
|
}
|
|
286329
286359
|
const correlationId = randomUUID3();
|
|
286330
286360
|
const toolCall = {
|
|
286331
|
-
name: this.constructor.name,
|
|
286361
|
+
name: this._toolName || this.constructor.name,
|
|
286332
286362
|
args: this.params
|
|
286333
286363
|
};
|
|
286334
286364
|
return new Promise((resolve13) => {
|
|
@@ -286489,7 +286519,7 @@ var BaseDeclarativeTool = class extends DeclarativeTool {
|
|
|
286489
286519
|
if (validationError) {
|
|
286490
286520
|
throw new Error(validationError);
|
|
286491
286521
|
}
|
|
286492
|
-
return this.createInvocation(params, this.messageBus);
|
|
286522
|
+
return this.createInvocation(params, this.messageBus, this.name, this.displayName);
|
|
286493
286523
|
}
|
|
286494
286524
|
validateToolParams(params) {
|
|
286495
286525
|
const errors = SchemaValidator.validate(this.schema.parametersJsonSchema, params);
|
|
@@ -288435,8 +288465,8 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
288435
288465
|
var PointerVector = import_vector.default.PointerVector;
|
|
288436
288466
|
|
|
288437
288467
|
// packages/core/dist/src/generated/git-commit.js
|
|
288438
|
-
var GIT_COMMIT_INFO = "
|
|
288439
|
-
var CLI_VERSION = "0.11.0-nightly.
|
|
288468
|
+
var GIT_COMMIT_INFO = "e72c00cf";
|
|
288469
|
+
var CLI_VERSION = "0.11.0-nightly.20251021.e72c00cf";
|
|
288440
288470
|
|
|
288441
288471
|
// packages/core/dist/src/ide/detect-ide.js
|
|
288442
288472
|
var IDE_DEFINITIONS = {
|
|
@@ -290913,7 +290943,7 @@ function createContentGeneratorConfig(config2, authType) {
|
|
|
290913
290943
|
return contentGeneratorConfig;
|
|
290914
290944
|
}
|
|
290915
290945
|
async function createContentGenerator(config2, gcConfig, sessionId2) {
|
|
290916
|
-
const version3 = "0.11.0-nightly.
|
|
290946
|
+
const version3 = "0.11.0-nightly.20251021.e72c00cf";
|
|
290917
290947
|
const userAgent = `GeminiCLI/${version3} (${process.platform}; ${process.arch})`;
|
|
290918
290948
|
const baseHeaders = {
|
|
290919
290949
|
"User-Agent": userAgent
|
|
@@ -300031,21 +300061,11 @@ function isEnabled(funcDecl, mcpServerName, mcpServerConfig) {
|
|
|
300031
300061
|
// packages/core/dist/src/tools/mcp-client-manager.js
|
|
300032
300062
|
var McpClientManager = class {
|
|
300033
300063
|
clients = /* @__PURE__ */ new Map();
|
|
300034
|
-
mcpServers;
|
|
300035
|
-
mcpServerCommand;
|
|
300036
300064
|
toolRegistry;
|
|
300037
|
-
promptRegistry;
|
|
300038
|
-
debugMode;
|
|
300039
|
-
workspaceContext;
|
|
300040
300065
|
discoveryState = MCPDiscoveryState.NOT_STARTED;
|
|
300041
300066
|
eventEmitter;
|
|
300042
|
-
constructor(
|
|
300043
|
-
this.mcpServers = mcpServers;
|
|
300044
|
-
this.mcpServerCommand = mcpServerCommand;
|
|
300067
|
+
constructor(toolRegistry, eventEmitter) {
|
|
300045
300068
|
this.toolRegistry = toolRegistry;
|
|
300046
|
-
this.promptRegistry = promptRegistry;
|
|
300047
|
-
this.debugMode = debugMode;
|
|
300048
|
-
this.workspaceContext = workspaceContext;
|
|
300049
300069
|
this.eventEmitter = eventEmitter;
|
|
300050
300070
|
}
|
|
300051
300071
|
/**
|
|
@@ -300058,11 +300078,11 @@ var McpClientManager = class {
|
|
|
300058
300078
|
return;
|
|
300059
300079
|
}
|
|
300060
300080
|
await this.stop();
|
|
300061
|
-
const servers = populateMcpServerCommand(
|
|
300081
|
+
const servers = populateMcpServerCommand(cliConfig.getMcpServers() || {}, cliConfig.getMcpServerCommand());
|
|
300062
300082
|
this.discoveryState = MCPDiscoveryState.IN_PROGRESS;
|
|
300063
300083
|
this.eventEmitter?.emit("mcp-client-update", this.clients);
|
|
300064
|
-
const discoveryPromises = Object.entries(servers).map(async ([name4, config2]) => {
|
|
300065
|
-
const client = new McpClient(name4, config2, this.toolRegistry,
|
|
300084
|
+
const discoveryPromises = Object.entries(servers).filter(([_, config2]) => !config2.extension || config2.extension.isActive).map(async ([name4, config2]) => {
|
|
300085
|
+
const client = new McpClient(name4, config2, this.toolRegistry, cliConfig.getPromptRegistry(), cliConfig.getWorkspaceContext(), cliConfig.getDebugMode());
|
|
300066
300086
|
this.clients.set(name4, client);
|
|
300067
300087
|
this.eventEmitter?.emit("mcp-client-update", this.clients);
|
|
300068
300088
|
try {
|
|
@@ -300221,7 +300241,7 @@ var ToolRegistry = class {
|
|
|
300221
300241
|
mcpClientManager;
|
|
300222
300242
|
constructor(config2, eventEmitter) {
|
|
300223
300243
|
this.config = config2;
|
|
300224
|
-
this.mcpClientManager = new McpClientManager(this
|
|
300244
|
+
this.mcpClientManager = new McpClientManager(this, eventEmitter);
|
|
300225
300245
|
}
|
|
300226
300246
|
/**
|
|
300227
300247
|
* Registers a tool definition.
|
|
@@ -300477,8 +300497,8 @@ var MEMORY_TOOL_NAME = "save_memory";
|
|
|
300477
300497
|
// packages/core/dist/src/tools/ls.js
|
|
300478
300498
|
var LSToolInvocation = class extends BaseToolInvocation {
|
|
300479
300499
|
config;
|
|
300480
|
-
constructor(config2, params) {
|
|
300481
|
-
super(params);
|
|
300500
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
300501
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
300482
300502
|
this.config = config2;
|
|
300483
300503
|
}
|
|
300484
300504
|
/**
|
|
@@ -300602,10 +300622,11 @@ ${directoryContent}`;
|
|
|
300602
300622
|
}
|
|
300603
300623
|
}
|
|
300604
300624
|
};
|
|
300605
|
-
var LSTool = class extends BaseDeclarativeTool {
|
|
300625
|
+
var LSTool = class _LSTool extends BaseDeclarativeTool {
|
|
300606
300626
|
config;
|
|
300607
|
-
|
|
300608
|
-
|
|
300627
|
+
static Name = LS_TOOL_NAME;
|
|
300628
|
+
constructor(config2, messageBus) {
|
|
300629
|
+
super(_LSTool.Name, "ReadFolder", "Lists the names of files and subdirectories directly within a specified directory path. Can optionally ignore entries matching provided glob patterns.", Kind.Search, {
|
|
300609
300630
|
properties: {
|
|
300610
300631
|
path: {
|
|
300611
300632
|
description: "The absolute path to the directory to list (must be absolute, not relative)",
|
|
@@ -300635,7 +300656,7 @@ var LSTool = class extends BaseDeclarativeTool {
|
|
|
300635
300656
|
},
|
|
300636
300657
|
required: ["path"],
|
|
300637
300658
|
type: "object"
|
|
300638
|
-
});
|
|
300659
|
+
}, true, false, messageBus);
|
|
300639
300660
|
this.config = config2;
|
|
300640
300661
|
}
|
|
300641
300662
|
/**
|
|
@@ -300654,8 +300675,8 @@ var LSTool = class extends BaseDeclarativeTool {
|
|
|
300654
300675
|
}
|
|
300655
300676
|
return null;
|
|
300656
300677
|
}
|
|
300657
|
-
createInvocation(params) {
|
|
300658
|
-
return new LSToolInvocation(this.config, params);
|
|
300678
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
300679
|
+
return new LSToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
300659
300680
|
}
|
|
300660
300681
|
};
|
|
300661
300682
|
|
|
@@ -302163,9 +302184,10 @@ var MemoryToolInvocation = class _MemoryToolInvocation extends BaseToolInvocatio
|
|
|
302163
302184
|
}
|
|
302164
302185
|
}
|
|
302165
302186
|
};
|
|
302166
|
-
var MemoryTool = class extends BaseDeclarativeTool {
|
|
302187
|
+
var MemoryTool = class _MemoryTool extends BaseDeclarativeTool {
|
|
302188
|
+
static Name = MEMORY_TOOL_NAME;
|
|
302167
302189
|
constructor() {
|
|
302168
|
-
super(
|
|
302190
|
+
super(_MemoryTool.Name, "Save Memory", memoryToolDescription, Kind.Think, memoryToolSchemaData.parametersJsonSchema);
|
|
302169
302191
|
}
|
|
302170
302192
|
validateToolParamValues(params) {
|
|
302171
302193
|
if (params.fact.trim() === "") {
|
|
@@ -302777,8 +302799,8 @@ function getProgrammingLanguage(args2) {
|
|
|
302777
302799
|
// packages/core/dist/src/tools/read-file.js
|
|
302778
302800
|
var ReadFileToolInvocation = class extends BaseToolInvocation {
|
|
302779
302801
|
config;
|
|
302780
|
-
constructor(config2, params) {
|
|
302781
|
-
super(params);
|
|
302802
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
302803
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
302782
302804
|
this.config = config2;
|
|
302783
302805
|
}
|
|
302784
302806
|
getDescription() {
|
|
@@ -302827,10 +302849,11 @@ ${result.llmContent}`;
|
|
|
302827
302849
|
};
|
|
302828
302850
|
}
|
|
302829
302851
|
};
|
|
302830
|
-
var ReadFileTool = class extends BaseDeclarativeTool {
|
|
302852
|
+
var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
|
|
302831
302853
|
config;
|
|
302832
|
-
|
|
302833
|
-
|
|
302854
|
+
static Name = READ_FILE_TOOL_NAME;
|
|
302855
|
+
constructor(config2, messageBus) {
|
|
302856
|
+
super(_ReadFileTool.Name, "ReadFile", `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, {
|
|
302834
302857
|
properties: {
|
|
302835
302858
|
absolute_path: {
|
|
302836
302859
|
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.",
|
|
@@ -302847,7 +302870,7 @@ var ReadFileTool = class extends BaseDeclarativeTool {
|
|
|
302847
302870
|
},
|
|
302848
302871
|
required: ["absolute_path"],
|
|
302849
302872
|
type: "object"
|
|
302850
|
-
});
|
|
302873
|
+
}, true, false, messageBus);
|
|
302851
302874
|
this.config = config2;
|
|
302852
302875
|
}
|
|
302853
302876
|
validateToolParamValues(params) {
|
|
@@ -302879,8 +302902,8 @@ var ReadFileTool = class extends BaseDeclarativeTool {
|
|
|
302879
302902
|
}
|
|
302880
302903
|
return null;
|
|
302881
302904
|
}
|
|
302882
|
-
createInvocation(params) {
|
|
302883
|
-
return new ReadFileToolInvocation(this.config, params);
|
|
302905
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
302906
|
+
return new ReadFileToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
302884
302907
|
}
|
|
302885
302908
|
};
|
|
302886
302909
|
|
|
@@ -308426,8 +308449,8 @@ var debugLogger = new DebugLogger();
|
|
|
308426
308449
|
var GrepToolInvocation = class extends BaseToolInvocation {
|
|
308427
308450
|
config;
|
|
308428
308451
|
fileExclusions;
|
|
308429
|
-
constructor(config2, params) {
|
|
308430
|
-
super(params);
|
|
308452
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
308453
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
308431
308454
|
this.config = config2;
|
|
308432
308455
|
this.fileExclusions = config2.getFileExclusions();
|
|
308433
308456
|
}
|
|
@@ -308799,10 +308822,11 @@ var GrepToolInvocation = class extends BaseToolInvocation {
|
|
|
308799
308822
|
}
|
|
308800
308823
|
}
|
|
308801
308824
|
};
|
|
308802
|
-
var GrepTool = class extends BaseDeclarativeTool {
|
|
308825
|
+
var GrepTool = class _GrepTool extends BaseDeclarativeTool {
|
|
308803
308826
|
config;
|
|
308804
|
-
|
|
308805
|
-
|
|
308827
|
+
static Name = GREP_TOOL_NAME;
|
|
308828
|
+
constructor(config2, messageBus) {
|
|
308829
|
+
super(_GrepTool.Name, "SearchText", "Searches for a regular expression pattern within the content of files in a specified directory (or current working directory). Can filter files by a glob pattern. Returns the lines containing matches, along with their file paths and line numbers.", Kind.Search, {
|
|
308806
308830
|
properties: {
|
|
308807
308831
|
pattern: {
|
|
308808
308832
|
description: "The regular expression (regex) pattern to search for within file contents (e.g., 'function\\s+myFunction', 'import\\s+\\{.*\\}\\s+from\\s+.*').",
|
|
@@ -308819,7 +308843,7 @@ var GrepTool = class extends BaseDeclarativeTool {
|
|
|
308819
308843
|
},
|
|
308820
308844
|
required: ["pattern"],
|
|
308821
308845
|
type: "object"
|
|
308822
|
-
});
|
|
308846
|
+
}, true, false, messageBus);
|
|
308823
308847
|
this.config = config2;
|
|
308824
308848
|
}
|
|
308825
308849
|
/**
|
|
@@ -308871,8 +308895,8 @@ var GrepTool = class extends BaseDeclarativeTool {
|
|
|
308871
308895
|
}
|
|
308872
308896
|
return null;
|
|
308873
308897
|
}
|
|
308874
|
-
createInvocation(params) {
|
|
308875
|
-
return new GrepToolInvocation(this.config, params);
|
|
308898
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
308899
|
+
return new GrepToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
308876
308900
|
}
|
|
308877
308901
|
};
|
|
308878
308902
|
|
|
@@ -321844,26 +321868,51 @@ var rgPath = join9(__dirname4, "..", "bin", `rg${process.platform === "win32" ?
|
|
|
321844
321868
|
|
|
321845
321869
|
// packages/core/dist/src/tools/ripGrep.js
|
|
321846
321870
|
var DEFAULT_TOTAL_MAX_MATCHES = 2e4;
|
|
321847
|
-
function
|
|
321848
|
-
return
|
|
321871
|
+
function getRgCandidateFilenames() {
|
|
321872
|
+
return process.platform === "win32" ? ["rg.exe", "rg"] : ["rg"];
|
|
321849
321873
|
}
|
|
321850
|
-
async function
|
|
321851
|
-
|
|
321852
|
-
|
|
321874
|
+
async function resolveExistingRgPath() {
|
|
321875
|
+
const binDir = Storage2.getGlobalBinDir();
|
|
321876
|
+
for (const fileName of getRgCandidateFilenames()) {
|
|
321877
|
+
const candidatePath = path34.join(binDir, fileName);
|
|
321878
|
+
if (await fileExists(candidatePath)) {
|
|
321879
|
+
return candidatePath;
|
|
321880
|
+
}
|
|
321853
321881
|
}
|
|
321854
|
-
|
|
321855
|
-
|
|
321882
|
+
return null;
|
|
321883
|
+
}
|
|
321884
|
+
var ripgrepAcquisitionPromise = null;
|
|
321885
|
+
async function ensureRipgrepAvailable() {
|
|
321886
|
+
const existingPath = await resolveExistingRgPath();
|
|
321887
|
+
if (existingPath) {
|
|
321888
|
+
return existingPath;
|
|
321889
|
+
}
|
|
321890
|
+
if (!ripgrepAcquisitionPromise) {
|
|
321891
|
+
ripgrepAcquisitionPromise = (async () => {
|
|
321892
|
+
try {
|
|
321893
|
+
await downloadRipGrep(Storage2.getGlobalBinDir());
|
|
321894
|
+
return await resolveExistingRgPath();
|
|
321895
|
+
} finally {
|
|
321896
|
+
ripgrepAcquisitionPromise = null;
|
|
321897
|
+
}
|
|
321898
|
+
})();
|
|
321899
|
+
}
|
|
321900
|
+
return ripgrepAcquisitionPromise;
|
|
321901
|
+
}
|
|
321902
|
+
async function canUseRipgrep() {
|
|
321903
|
+
return await ensureRipgrepAvailable() !== null;
|
|
321856
321904
|
}
|
|
321857
321905
|
async function ensureRgPath() {
|
|
321858
|
-
|
|
321859
|
-
|
|
321906
|
+
const downloadedPath = await ensureRipgrepAvailable();
|
|
321907
|
+
if (downloadedPath) {
|
|
321908
|
+
return downloadedPath;
|
|
321860
321909
|
}
|
|
321861
321910
|
throw new Error("Cannot use ripgrep.");
|
|
321862
321911
|
}
|
|
321863
321912
|
var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
321864
321913
|
config;
|
|
321865
|
-
constructor(config2, params) {
|
|
321866
|
-
super(params);
|
|
321914
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
321915
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
321867
321916
|
this.config = config2;
|
|
321868
321917
|
}
|
|
321869
321918
|
/**
|
|
@@ -322112,27 +322161,39 @@ var GrepToolInvocation2 = class extends BaseToolInvocation {
|
|
|
322112
322161
|
return description;
|
|
322113
322162
|
}
|
|
322114
322163
|
};
|
|
322115
|
-
var RipGrepTool = class extends BaseDeclarativeTool {
|
|
322164
|
+
var RipGrepTool = class _RipGrepTool extends BaseDeclarativeTool {
|
|
322116
322165
|
config;
|
|
322117
|
-
|
|
322118
|
-
|
|
322119
|
-
|
|
322120
|
-
|
|
322121
|
-
|
|
322122
|
-
|
|
322123
|
-
|
|
322124
|
-
|
|
322125
|
-
|
|
322126
|
-
|
|
322166
|
+
static Name = GREP_TOOL_NAME;
|
|
322167
|
+
constructor(config2, messageBus) {
|
|
322168
|
+
super(
|
|
322169
|
+
_RipGrepTool.Name,
|
|
322170
|
+
"SearchText",
|
|
322171
|
+
"Searches for a regular expression pattern within the content of files in a specified directory (or current working directory). Can filter files by a glob pattern. Returns the lines containing matches, along with their file paths and line numbers. Total results limited to 20,000 matches like VSCode.",
|
|
322172
|
+
Kind.Search,
|
|
322173
|
+
{
|
|
322174
|
+
properties: {
|
|
322175
|
+
pattern: {
|
|
322176
|
+
description: "The regular expression (regex) pattern to search for within file contents (e.g., 'function\\s+myFunction', 'import\\s+\\{.*\\}\\s+from\\s+.*').",
|
|
322177
|
+
type: "string"
|
|
322178
|
+
},
|
|
322179
|
+
path: {
|
|
322180
|
+
description: "Optional: The absolute path to the directory to search within. If omitted, searches the current working directory.",
|
|
322181
|
+
type: "string"
|
|
322182
|
+
},
|
|
322183
|
+
include: {
|
|
322184
|
+
description: "Optional: A glob pattern to filter which files are searched (e.g., '*.js', '*.{ts,tsx}', 'src/**'). If omitted, searches all files (respecting potential global ignores).",
|
|
322185
|
+
type: "string"
|
|
322186
|
+
}
|
|
322127
322187
|
},
|
|
322128
|
-
|
|
322129
|
-
|
|
322130
|
-
type: "string"
|
|
322131
|
-
}
|
|
322188
|
+
required: ["pattern"],
|
|
322189
|
+
type: "object"
|
|
322132
322190
|
},
|
|
322133
|
-
|
|
322134
|
-
|
|
322135
|
-
|
|
322191
|
+
true,
|
|
322192
|
+
// isOutputMarkdown
|
|
322193
|
+
false,
|
|
322194
|
+
// canUpdateOutput
|
|
322195
|
+
messageBus
|
|
322196
|
+
);
|
|
322136
322197
|
this.config = config2;
|
|
322137
322198
|
}
|
|
322138
322199
|
/**
|
|
@@ -322183,8 +322244,8 @@ var RipGrepTool = class extends BaseDeclarativeTool {
|
|
|
322183
322244
|
}
|
|
322184
322245
|
return null;
|
|
322185
322246
|
}
|
|
322186
|
-
createInvocation(params) {
|
|
322187
|
-
return new GrepToolInvocation2(this.config, params);
|
|
322247
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
322248
|
+
return new GrepToolInvocation2(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
322188
322249
|
}
|
|
322189
322250
|
};
|
|
322190
322251
|
|
|
@@ -322212,8 +322273,8 @@ function sortFileEntries(entries2, nowTimestamp, recencyThresholdMs) {
|
|
|
322212
322273
|
}
|
|
322213
322274
|
var GlobToolInvocation = class extends BaseToolInvocation {
|
|
322214
322275
|
config;
|
|
322215
|
-
constructor(config2, params) {
|
|
322216
|
-
super(params);
|
|
322276
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
322277
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
322217
322278
|
this.config = config2;
|
|
322218
322279
|
}
|
|
322219
322280
|
getDescription() {
|
|
@@ -322332,10 +322393,11 @@ ${fileListDescription}`;
|
|
|
322332
322393
|
}
|
|
322333
322394
|
}
|
|
322334
322395
|
};
|
|
322335
|
-
var GlobTool = class extends BaseDeclarativeTool {
|
|
322396
|
+
var GlobTool = class _GlobTool extends BaseDeclarativeTool {
|
|
322336
322397
|
config;
|
|
322337
|
-
|
|
322338
|
-
|
|
322398
|
+
static Name = GLOB_TOOL_NAME;
|
|
322399
|
+
constructor(config2, messageBus) {
|
|
322400
|
+
super(_GlobTool.Name, "FindFiles", "Efficiently finds files matching specific glob patterns (e.g., `src/**/*.ts`, `**/*.md`), returning absolute paths sorted by modification time (newest first). Ideal for quickly locating files based on their name or path structure, especially in large codebases.", Kind.Search, {
|
|
322339
322401
|
properties: {
|
|
322340
322402
|
pattern: {
|
|
322341
322403
|
description: "The glob pattern to match against (e.g., '**/*.py', 'docs/*.md').",
|
|
@@ -322360,7 +322422,7 @@ var GlobTool = class extends BaseDeclarativeTool {
|
|
|
322360
322422
|
},
|
|
322361
322423
|
required: ["pattern"],
|
|
322362
322424
|
type: "object"
|
|
322363
|
-
});
|
|
322425
|
+
}, true, false, messageBus);
|
|
322364
322426
|
this.config = config2;
|
|
322365
322427
|
}
|
|
322366
322428
|
/**
|
|
@@ -322389,8 +322451,8 @@ var GlobTool = class extends BaseDeclarativeTool {
|
|
|
322389
322451
|
}
|
|
322390
322452
|
return null;
|
|
322391
322453
|
}
|
|
322392
|
-
createInvocation(params) {
|
|
322393
|
-
return new GlobToolInvocation(this.config, params);
|
|
322454
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
322455
|
+
return new GlobToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
322394
322456
|
}
|
|
322395
322457
|
};
|
|
322396
322458
|
|
|
@@ -324148,10 +324210,11 @@ var EditToolInvocation = class {
|
|
|
324148
324210
|
}
|
|
324149
324211
|
}
|
|
324150
324212
|
};
|
|
324151
|
-
var EditTool = class extends BaseDeclarativeTool {
|
|
324213
|
+
var EditTool = class _EditTool extends BaseDeclarativeTool {
|
|
324152
324214
|
config;
|
|
324215
|
+
static Name = EDIT_TOOL_NAME;
|
|
324153
324216
|
constructor(config2) {
|
|
324154
|
-
super(
|
|
324217
|
+
super(_EditTool.Name, "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 ${READ_FILE_TOOL_NAME} tool to examine the file's current content before attempting a text replacement.
|
|
324155
324218
|
|
|
324156
324219
|
The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
|
|
324157
324220
|
|
|
@@ -324333,47 +324396,42 @@ function getDiffCommand(oldPath, newPath, editor) {
|
|
|
324333
324396
|
async function openDiff(oldPath, newPath, editor, onEditorClose) {
|
|
324334
324397
|
const diffCommand = getDiffCommand(oldPath, newPath, editor);
|
|
324335
324398
|
if (!diffCommand) {
|
|
324336
|
-
|
|
324399
|
+
debugLogger.error("No diff tool available. Install a supported editor.");
|
|
324337
324400
|
return;
|
|
324338
324401
|
}
|
|
324339
|
-
|
|
324340
|
-
|
|
324341
|
-
|
|
324342
|
-
|
|
324343
|
-
|
|
324344
|
-
|
|
324345
|
-
|
|
324346
|
-
|
|
324347
|
-
throw result.error;
|
|
324348
|
-
}
|
|
324349
|
-
if (result.status !== 0) {
|
|
324350
|
-
throw new Error(`${editor} exited with code ${result.status}`);
|
|
324351
|
-
}
|
|
324352
|
-
} finally {
|
|
324353
|
-
onEditorClose();
|
|
324402
|
+
const isTerminalEditor = ["vim", "emacs", "neovim"].includes(editor);
|
|
324403
|
+
if (isTerminalEditor) {
|
|
324404
|
+
try {
|
|
324405
|
+
const result = spawnSync2(diffCommand.command, diffCommand.args, {
|
|
324406
|
+
stdio: "inherit"
|
|
324407
|
+
});
|
|
324408
|
+
if (result.error) {
|
|
324409
|
+
throw result.error;
|
|
324354
324410
|
}
|
|
324355
|
-
|
|
324411
|
+
if (result.status !== 0) {
|
|
324412
|
+
throw new Error(`${editor} exited with code ${result.status}`);
|
|
324413
|
+
}
|
|
324414
|
+
} finally {
|
|
324415
|
+
onEditorClose();
|
|
324356
324416
|
}
|
|
324357
|
-
return
|
|
324358
|
-
const childProcess2 = spawn6(diffCommand.command, diffCommand.args, {
|
|
324359
|
-
stdio: "inherit",
|
|
324360
|
-
shell: process.platform === "win32"
|
|
324361
|
-
});
|
|
324362
|
-
childProcess2.on("close", (code2) => {
|
|
324363
|
-
if (code2 === 0) {
|
|
324364
|
-
resolve13();
|
|
324365
|
-
} else {
|
|
324366
|
-
reject(new Error(`${editor} exited with code ${code2}`));
|
|
324367
|
-
}
|
|
324368
|
-
});
|
|
324369
|
-
childProcess2.on("error", (error) => {
|
|
324370
|
-
reject(error);
|
|
324371
|
-
});
|
|
324372
|
-
});
|
|
324373
|
-
} catch (error) {
|
|
324374
|
-
console.error(error);
|
|
324375
|
-
throw error;
|
|
324417
|
+
return;
|
|
324376
324418
|
}
|
|
324419
|
+
return new Promise((resolve13, reject) => {
|
|
324420
|
+
const childProcess2 = spawn6(diffCommand.command, diffCommand.args, {
|
|
324421
|
+
stdio: "inherit",
|
|
324422
|
+
shell: process.platform === "win32"
|
|
324423
|
+
});
|
|
324424
|
+
childProcess2.on("close", (code2) => {
|
|
324425
|
+
if (code2 === 0) {
|
|
324426
|
+
resolve13();
|
|
324427
|
+
} else {
|
|
324428
|
+
reject(new Error(`${editor} exited with code ${code2}`));
|
|
324429
|
+
}
|
|
324430
|
+
});
|
|
324431
|
+
childProcess2.on("error", (error) => {
|
|
324432
|
+
reject(error);
|
|
324433
|
+
});
|
|
324434
|
+
});
|
|
324377
324435
|
}
|
|
324378
324436
|
|
|
324379
324437
|
// packages/core/dist/src/tools/modifiable-tool.js
|
|
@@ -325499,10 +325557,11 @@ var EditToolInvocation2 = class {
|
|
|
325499
325557
|
}
|
|
325500
325558
|
}
|
|
325501
325559
|
};
|
|
325502
|
-
var SmartEditTool = class extends BaseDeclarativeTool {
|
|
325560
|
+
var SmartEditTool = class _SmartEditTool extends BaseDeclarativeTool {
|
|
325503
325561
|
config;
|
|
325562
|
+
static Name = EDIT_TOOL_NAME;
|
|
325504
325563
|
constructor(config2) {
|
|
325505
|
-
super(
|
|
325564
|
+
super(_SmartEditTool.Name, "Edit", `Replaces text within a file. Replaces a single occurrence. This tool requires providing significant context around the change to ensure precise targeting. Always use the ${READ_FILE_TOOL_NAME} tool to examine the file's current content before attempting a text replacement.
|
|
325506
325565
|
|
|
325507
325566
|
The user has the ability to modify the \`new_string\` content. If modified, this will be stated in the response.
|
|
325508
325567
|
|
|
@@ -330197,6 +330256,37 @@ function isCommandAllowed(command, config2) {
|
|
|
330197
330256
|
}
|
|
330198
330257
|
return { allowed: false, reason: blockReason };
|
|
330199
330258
|
}
|
|
330259
|
+
function isShellInvocationAllowlisted(invocation, allowedPatterns) {
|
|
330260
|
+
if (!allowedPatterns.length) {
|
|
330261
|
+
return false;
|
|
330262
|
+
}
|
|
330263
|
+
const hasShellWildcard = allowedPatterns.some((pattern) => SHELL_TOOL_NAMES.includes(pattern));
|
|
330264
|
+
const hasShellSpecificPattern = allowedPatterns.some((pattern) => SHELL_TOOL_NAMES.some((name4) => pattern.startsWith(`${name4}(`)));
|
|
330265
|
+
if (!hasShellWildcard && !hasShellSpecificPattern) {
|
|
330266
|
+
return false;
|
|
330267
|
+
}
|
|
330268
|
+
if (hasShellWildcard) {
|
|
330269
|
+
return true;
|
|
330270
|
+
}
|
|
330271
|
+
if (!("params" in invocation) || typeof invocation.params !== "object" || invocation.params === null || !("command" in invocation.params)) {
|
|
330272
|
+
return false;
|
|
330273
|
+
}
|
|
330274
|
+
const commandValue = invocation.params.command;
|
|
330275
|
+
if (typeof commandValue !== "string" || !commandValue.trim()) {
|
|
330276
|
+
return false;
|
|
330277
|
+
}
|
|
330278
|
+
const command = commandValue.trim();
|
|
330279
|
+
const parseResult = parseCommandDetails(command);
|
|
330280
|
+
if (!parseResult || parseResult.hasError) {
|
|
330281
|
+
return false;
|
|
330282
|
+
}
|
|
330283
|
+
const normalize5 = (cmd) => cmd.trim().replace(/\s+/g, " ");
|
|
330284
|
+
const commandsToValidate = parseResult.details.map((detail) => normalize5(detail.text)).filter(Boolean);
|
|
330285
|
+
if (commandsToValidate.length === 0) {
|
|
330286
|
+
return false;
|
|
330287
|
+
}
|
|
330288
|
+
return commandsToValidate.every((commandSegment) => doesToolInvocationMatch(SHELL_TOOL_NAMES[0], { params: { command: commandSegment } }, allowedPatterns));
|
|
330289
|
+
}
|
|
330200
330290
|
|
|
330201
330291
|
// packages/core/dist/src/services/shellExecutionService.js
|
|
330202
330292
|
var import_headless = __toESM(require_xterm_headless(), 1);
|
|
@@ -331063,19 +331153,27 @@ var ShellExecutionService = class {
|
|
|
331063
331153
|
return { pid: ptyProcess.pid, result };
|
|
331064
331154
|
} catch (e2) {
|
|
331065
331155
|
const error = e2;
|
|
331066
|
-
|
|
331067
|
-
|
|
331068
|
-
|
|
331069
|
-
|
|
331070
|
-
|
|
331071
|
-
|
|
331072
|
-
|
|
331073
|
-
|
|
331074
|
-
aborted: false,
|
|
331156
|
+
if (error.message.includes("posix_spawnp failed")) {
|
|
331157
|
+
onOutputEvent({
|
|
331158
|
+
type: "data",
|
|
331159
|
+
chunk: "[GEMINI_CLI_WARNING] PTY execution failed, falling back to child_process. This may be due to sandbox restrictions.\n"
|
|
331160
|
+
});
|
|
331161
|
+
throw e2;
|
|
331162
|
+
} else {
|
|
331163
|
+
return {
|
|
331075
331164
|
pid: void 0,
|
|
331076
|
-
|
|
331077
|
-
|
|
331078
|
-
|
|
331165
|
+
result: Promise.resolve({
|
|
331166
|
+
error,
|
|
331167
|
+
rawOutput: Buffer.from(""),
|
|
331168
|
+
output: "",
|
|
331169
|
+
exitCode: 1,
|
|
331170
|
+
signal: null,
|
|
331171
|
+
aborted: false,
|
|
331172
|
+
pid: void 0,
|
|
331173
|
+
executionMethod: "none"
|
|
331174
|
+
})
|
|
331175
|
+
};
|
|
331176
|
+
}
|
|
331079
331177
|
}
|
|
331080
331178
|
}
|
|
331081
331179
|
/**
|
|
@@ -331372,14 +331470,15 @@ function getCommandDescription() {
|
|
|
331372
331470
|
return "Exact bash command to execute as `bash -c <command>`";
|
|
331373
331471
|
}
|
|
331374
331472
|
}
|
|
331375
|
-
var ShellTool = class extends BaseDeclarativeTool {
|
|
331473
|
+
var ShellTool = class _ShellTool extends BaseDeclarativeTool {
|
|
331376
331474
|
config;
|
|
331475
|
+
static Name = SHELL_TOOL_NAME;
|
|
331377
331476
|
allowlist = /* @__PURE__ */ new Set();
|
|
331378
331477
|
constructor(config2) {
|
|
331379
331478
|
void initializeShellParsers().catch(() => {
|
|
331380
331479
|
});
|
|
331381
331480
|
super(
|
|
331382
|
-
|
|
331481
|
+
_ShellTool.Name,
|
|
331383
331482
|
"Shell",
|
|
331384
331483
|
getShellToolDescription(),
|
|
331385
331484
|
Kind.Execute,
|
|
@@ -331619,10 +331718,11 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
|
|
|
331619
331718
|
}
|
|
331620
331719
|
}
|
|
331621
331720
|
};
|
|
331622
|
-
var WriteFileTool = class extends BaseDeclarativeTool {
|
|
331721
|
+
var WriteFileTool = class _WriteFileTool extends BaseDeclarativeTool {
|
|
331623
331722
|
config;
|
|
331723
|
+
static Name = WRITE_FILE_TOOL_NAME;
|
|
331624
331724
|
constructor(config2) {
|
|
331625
|
-
super(
|
|
331725
|
+
super(_WriteFileTool.Name, "WriteFile", `Writes content to a specified file in the local filesystem.
|
|
331626
331726
|
|
|
331627
331727
|
The user has the ability to modify \`content\`. If modified, this will be stated in the response.`, Kind.Edit, {
|
|
331628
331728
|
properties: {
|
|
@@ -331693,6 +331793,7 @@ var WriteFileTool = class extends BaseDeclarativeTool {
|
|
|
331693
331793
|
};
|
|
331694
331794
|
|
|
331695
331795
|
// packages/core/dist/src/utils/fetch.js
|
|
331796
|
+
var import_undici2 = __toESM(require_undici(), 1);
|
|
331696
331797
|
import { URL as URL8 } from "node:url";
|
|
331697
331798
|
var PRIVATE_IP_RANGES = [
|
|
331698
331799
|
/^10\./,
|
|
@@ -331734,6 +331835,13 @@ async function fetchWithTimeout(url4, timeout) {
|
|
|
331734
331835
|
clearTimeout(timeoutId);
|
|
331735
331836
|
}
|
|
331736
331837
|
}
|
|
331838
|
+
function setGlobalProxy(proxy2) {
|
|
331839
|
+
try {
|
|
331840
|
+
(0, import_undici2.setGlobalDispatcher)(new import_undici2.ProxyAgent(proxy2));
|
|
331841
|
+
} catch (e2) {
|
|
331842
|
+
console.error(`Failed to set proxy: ${getErrorMessage(e2)}`);
|
|
331843
|
+
}
|
|
331844
|
+
}
|
|
331737
331845
|
|
|
331738
331846
|
// node_modules/domelementtype/lib/esm/index.js
|
|
331739
331847
|
var ElementType;
|
|
@@ -336674,7 +336782,6 @@ function handleDeprecatedOptions(options2) {
|
|
|
336674
336782
|
}
|
|
336675
336783
|
|
|
336676
336784
|
// packages/core/dist/src/tools/web-fetch.js
|
|
336677
|
-
var import_undici2 = __toESM(require_undici(), 1);
|
|
336678
336785
|
var URL_FETCH_TIMEOUT_MS = 1e4;
|
|
336679
336786
|
var MAX_CONTENT_LENGTH = 1e5;
|
|
336680
336787
|
function parsePrompt(text) {
|
|
@@ -336701,8 +336808,8 @@ function parsePrompt(text) {
|
|
|
336701
336808
|
}
|
|
336702
336809
|
var WebFetchToolInvocation = class extends BaseToolInvocation {
|
|
336703
336810
|
config;
|
|
336704
|
-
constructor(config2, params, messageBus) {
|
|
336705
|
-
super(params, messageBus);
|
|
336811
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
336812
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
336706
336813
|
this.config = config2;
|
|
336707
336814
|
}
|
|
336708
336815
|
async executeFallback(signal) {
|
|
@@ -336889,11 +336996,12 @@ ${sourceListFormatted.join("\n")}`;
|
|
|
336889
336996
|
}
|
|
336890
336997
|
}
|
|
336891
336998
|
};
|
|
336892
|
-
var WebFetchTool = class extends BaseDeclarativeTool {
|
|
336999
|
+
var WebFetchTool = class _WebFetchTool extends BaseDeclarativeTool {
|
|
336893
337000
|
config;
|
|
337001
|
+
static Name = WEB_FETCH_TOOL_NAME;
|
|
336894
337002
|
constructor(config2, messageBus) {
|
|
336895
337003
|
super(
|
|
336896
|
-
|
|
337004
|
+
_WebFetchTool.Name,
|
|
336897
337005
|
"WebFetch",
|
|
336898
337006
|
"Processes content from URL(s), including local and private network addresses (e.g., localhost), embedded in a prompt. Include up to 20 URLs and instructions (e.g., summarize, extract specific data) directly in the 'prompt' parameter.",
|
|
336899
337007
|
Kind.Fetch,
|
|
@@ -336916,7 +337024,7 @@ var WebFetchTool = class extends BaseDeclarativeTool {
|
|
|
336916
337024
|
this.config = config2;
|
|
336917
337025
|
const proxy2 = config2.getProxy();
|
|
336918
337026
|
if (proxy2) {
|
|
336919
|
-
(
|
|
337027
|
+
setGlobalProxy(proxy2);
|
|
336920
337028
|
}
|
|
336921
337029
|
}
|
|
336922
337030
|
validateToolParamValues(params) {
|
|
@@ -336933,8 +337041,8 @@ var WebFetchTool = class extends BaseDeclarativeTool {
|
|
|
336933
337041
|
}
|
|
336934
337042
|
return null;
|
|
336935
337043
|
}
|
|
336936
|
-
createInvocation(params, messageBus) {
|
|
336937
|
-
return new WebFetchToolInvocation(this.config, params, messageBus);
|
|
337044
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
337045
|
+
return new WebFetchToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
336938
337046
|
}
|
|
336939
337047
|
};
|
|
336940
337048
|
|
|
@@ -336948,8 +337056,8 @@ var DEFAULT_OUTPUT_SEPARATOR_FORMAT = "--- {filePath} ---";
|
|
|
336948
337056
|
var DEFAULT_OUTPUT_TERMINATOR = "\n--- End of content ---";
|
|
336949
337057
|
var ReadManyFilesToolInvocation = class extends BaseToolInvocation {
|
|
336950
337058
|
config;
|
|
336951
|
-
constructor(config2, params) {
|
|
336952
|
-
super(params);
|
|
337059
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
337060
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
336953
337061
|
this.config = config2;
|
|
336954
337062
|
}
|
|
336955
337063
|
getDescription() {
|
|
@@ -337200,9 +337308,10 @@ ${fileContentForLlm}
|
|
|
337200
337308
|
};
|
|
337201
337309
|
}
|
|
337202
337310
|
};
|
|
337203
|
-
var ReadManyFilesTool = class extends BaseDeclarativeTool {
|
|
337311
|
+
var ReadManyFilesTool = class _ReadManyFilesTool extends BaseDeclarativeTool {
|
|
337204
337312
|
config;
|
|
337205
|
-
|
|
337313
|
+
static Name = READ_MANY_FILES_TOOL_NAME;
|
|
337314
|
+
constructor(config2, messageBus) {
|
|
337206
337315
|
const parameterSchema = {
|
|
337207
337316
|
type: "object",
|
|
337208
337317
|
properties: {
|
|
@@ -337260,7 +337369,10 @@ var ReadManyFilesTool = class extends BaseDeclarativeTool {
|
|
|
337260
337369
|
},
|
|
337261
337370
|
required: ["paths"]
|
|
337262
337371
|
};
|
|
337263
|
-
super(
|
|
337372
|
+
super(
|
|
337373
|
+
_ReadManyFilesTool.Name,
|
|
337374
|
+
"ReadManyFiles",
|
|
337375
|
+
`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).
|
|
337264
337376
|
|
|
337265
337377
|
This tool is useful when you need to understand or analyze a collection of files, such as:
|
|
337266
337378
|
- Getting an overview of a codebase or parts of it (e.g., all TypeScript files in the 'src' directory).
|
|
@@ -337269,19 +337381,27 @@ This tool is useful when you need to understand or analyze a collection of files
|
|
|
337269
337381
|
- Gathering context from multiple configuration files.
|
|
337270
337382
|
- When the user asks to "read all files in X directory" or "show me the content of all Y files".
|
|
337271
337383
|
|
|
337272
|
-
Use this tool when the user's query implies needing the content of several files simultaneously for context, analysis, or summarization. For text files, it uses default UTF-8 encoding and a '--- {filePath} ---' separator between file contents. The tool inserts a '--- End of content ---' after the last file. Ensure paths are relative to the target directory. Glob patterns like 'src/**/*.js' are supported. Avoid using for single files if a more specific single-file reading tool is available, unless the user specifically requests to process a list containing just one file via this tool. Other binary files (not explicitly requested as image/PDF) are generally skipped. Default excludes apply to common non-text files (except for explicitly requested images/PDFs) and large dependency directories unless 'useDefaultExcludes' is false.`,
|
|
337384
|
+
Use this tool when the user's query implies needing the content of several files simultaneously for context, analysis, or summarization. For text files, it uses default UTF-8 encoding and a '--- {filePath} ---' separator between file contents. The tool inserts a '--- End of content ---' after the last file. Ensure paths are relative to the target directory. Glob patterns like 'src/**/*.js' are supported. Avoid using for single files if a more specific single-file reading tool is available, unless the user specifically requests to process a list containing just one file via this tool. Other binary files (not explicitly requested as image/PDF) are generally skipped. Default excludes apply to common non-text files (except for explicitly requested images/PDFs) and large dependency directories unless 'useDefaultExcludes' is false.`,
|
|
337385
|
+
Kind.Read,
|
|
337386
|
+
parameterSchema,
|
|
337387
|
+
true,
|
|
337388
|
+
// isOutputMarkdown
|
|
337389
|
+
false,
|
|
337390
|
+
// canUpdateOutput
|
|
337391
|
+
messageBus
|
|
337392
|
+
);
|
|
337273
337393
|
this.config = config2;
|
|
337274
337394
|
}
|
|
337275
|
-
createInvocation(params) {
|
|
337276
|
-
return new ReadManyFilesToolInvocation(this.config, params);
|
|
337395
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
337396
|
+
return new ReadManyFilesToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
337277
337397
|
}
|
|
337278
337398
|
};
|
|
337279
337399
|
|
|
337280
337400
|
// packages/core/dist/src/tools/web-search.js
|
|
337281
337401
|
var WebSearchToolInvocation = class extends BaseToolInvocation {
|
|
337282
337402
|
config;
|
|
337283
|
-
constructor(config2, params) {
|
|
337284
|
-
super(params);
|
|
337403
|
+
constructor(config2, params, messageBus, _toolName, _toolDisplayName) {
|
|
337404
|
+
super(params, messageBus, _toolName, _toolDisplayName);
|
|
337285
337405
|
this.config = config2;
|
|
337286
337406
|
}
|
|
337287
337407
|
getDescription() {
|
|
@@ -337366,19 +337486,31 @@ ${modifiedResponseText}`,
|
|
|
337366
337486
|
}
|
|
337367
337487
|
}
|
|
337368
337488
|
};
|
|
337369
|
-
var WebSearchTool = class extends BaseDeclarativeTool {
|
|
337489
|
+
var WebSearchTool = class _WebSearchTool extends BaseDeclarativeTool {
|
|
337370
337490
|
config;
|
|
337371
|
-
|
|
337372
|
-
|
|
337373
|
-
|
|
337374
|
-
|
|
337375
|
-
|
|
337376
|
-
|
|
337377
|
-
|
|
337378
|
-
|
|
337491
|
+
static Name = WEB_SEARCH_TOOL_NAME;
|
|
337492
|
+
constructor(config2, messageBus) {
|
|
337493
|
+
super(
|
|
337494
|
+
_WebSearchTool.Name,
|
|
337495
|
+
"GoogleSearch",
|
|
337496
|
+
"Performs a web search using Google Search (via the Gemini API) and returns the results. This tool is useful for finding information on the internet based on a query.",
|
|
337497
|
+
Kind.Search,
|
|
337498
|
+
{
|
|
337499
|
+
type: "object",
|
|
337500
|
+
properties: {
|
|
337501
|
+
query: {
|
|
337502
|
+
type: "string",
|
|
337503
|
+
description: "The search query to find information on the web."
|
|
337504
|
+
}
|
|
337505
|
+
},
|
|
337506
|
+
required: ["query"]
|
|
337379
337507
|
},
|
|
337380
|
-
|
|
337381
|
-
|
|
337508
|
+
true,
|
|
337509
|
+
// isOutputMarkdown
|
|
337510
|
+
false,
|
|
337511
|
+
// canUpdateOutput
|
|
337512
|
+
messageBus
|
|
337513
|
+
);
|
|
337382
337514
|
this.config = config2;
|
|
337383
337515
|
}
|
|
337384
337516
|
/**
|
|
@@ -337392,8 +337524,8 @@ var WebSearchTool = class extends BaseDeclarativeTool {
|
|
|
337392
337524
|
}
|
|
337393
337525
|
return null;
|
|
337394
337526
|
}
|
|
337395
|
-
createInvocation(params) {
|
|
337396
|
-
return new WebSearchToolInvocation(this.config, params);
|
|
337527
|
+
createInvocation(params, messageBus, _toolName, _toolDisplayName) {
|
|
337528
|
+
return new WebSearchToolInvocation(this.config, params, messageBus, _toolName, _toolDisplayName);
|
|
337397
337529
|
}
|
|
337398
337530
|
};
|
|
337399
337531
|
|
|
@@ -338026,7 +338158,8 @@ var CoreToolScheduler = class {
|
|
|
338026
338158
|
if (toolCall.status !== "validating") {
|
|
338027
338159
|
continue;
|
|
338028
338160
|
}
|
|
338029
|
-
const
|
|
338161
|
+
const validatingCall = toolCall;
|
|
338162
|
+
const { request: reqInfo, invocation } = validatingCall;
|
|
338030
338163
|
try {
|
|
338031
338164
|
if (signal.aborted) {
|
|
338032
338165
|
this.setStatusInternal(reqInfo.callId, "cancelled", "Tool call cancelled by user.");
|
|
@@ -338038,8 +338171,7 @@ var CoreToolScheduler = class {
|
|
|
338038
338171
|
this.setStatusInternal(reqInfo.callId, "scheduled");
|
|
338039
338172
|
continue;
|
|
338040
338173
|
}
|
|
338041
|
-
|
|
338042
|
-
if (this.config.getApprovalMode() === ApprovalMode.YOLO || doesToolInvocationMatch(toolCall.tool, invocation, allowedTools)) {
|
|
338174
|
+
if (this.isAutoApproved(validatingCall)) {
|
|
338043
338175
|
this.setToolCallOutcome(reqInfo.callId, ToolConfirmationOutcome.ProceedAlways);
|
|
338044
338176
|
this.setStatusInternal(reqInfo.callId, "scheduled");
|
|
338045
338177
|
} else {
|
|
@@ -338265,6 +338397,18 @@ var CoreToolScheduler = class {
|
|
|
338265
338397
|
// Use legacy UI confirmation
|
|
338266
338398
|
});
|
|
338267
338399
|
}
|
|
338400
|
+
isAutoApproved(toolCall) {
|
|
338401
|
+
if (this.config.getApprovalMode() === ApprovalMode.YOLO) {
|
|
338402
|
+
return true;
|
|
338403
|
+
}
|
|
338404
|
+
const allowedTools = this.config.getAllowedTools() || [];
|
|
338405
|
+
const { tool, invocation } = toolCall;
|
|
338406
|
+
const toolName = typeof tool === "string" ? tool : tool.name;
|
|
338407
|
+
if (SHELL_TOOL_NAMES.includes(toolName)) {
|
|
338408
|
+
return isShellInvocationAllowlisted(invocation, allowedTools);
|
|
338409
|
+
}
|
|
338410
|
+
return doesToolInvocationMatch(tool, invocation, allowedTools);
|
|
338411
|
+
}
|
|
338268
338412
|
async autoApproveCompatiblePendingTools(signal, triggeringCallId) {
|
|
338269
338413
|
const pendingTools = this.toolCalls.filter((call) => call.status === "awaiting_approval" && call.request.callId !== triggeringCallId);
|
|
338270
338414
|
for (const pendingTool of pendingTools) {
|
|
@@ -339064,18 +339208,20 @@ var Turn = class {
|
|
|
339064
339208
|
if (!resp)
|
|
339065
339209
|
continue;
|
|
339066
339210
|
this.debugResponses.push(resp);
|
|
339211
|
+
const traceId = resp.responseId;
|
|
339067
339212
|
const thoughtPart = resp.candidates?.[0]?.content?.parts?.[0];
|
|
339068
339213
|
if (thoughtPart?.thought) {
|
|
339069
339214
|
const thought = parseThought(thoughtPart.text ?? "");
|
|
339070
339215
|
yield {
|
|
339071
339216
|
type: GeminiEventType.Thought,
|
|
339072
|
-
value: thought
|
|
339217
|
+
value: thought,
|
|
339218
|
+
traceId
|
|
339073
339219
|
};
|
|
339074
339220
|
continue;
|
|
339075
339221
|
}
|
|
339076
339222
|
const text = getResponseText(resp);
|
|
339077
339223
|
if (text) {
|
|
339078
|
-
yield { type: GeminiEventType.Content, value: text };
|
|
339224
|
+
yield { type: GeminiEventType.Content, value: text, traceId };
|
|
339079
339225
|
}
|
|
339080
339226
|
const functionCalls = resp.functionCalls ?? [];
|
|
339081
339227
|
for (const fnCall of functionCalls) {
|
|
@@ -340508,7 +340654,7 @@ var GitIgnoreParser = class {
|
|
|
340508
340654
|
}
|
|
340509
340655
|
const isExcludeFile = patternsFilePath.endsWith(path50.join(".git", "info", "exclude"));
|
|
340510
340656
|
const relativeBaseDir = isExcludeFile ? "." : path50.dirname(path50.relative(this.projectRoot, patternsFilePath)).split(path50.sep).join(path50.posix.sep);
|
|
340511
|
-
return content.split("\n").map((p) => p.
|
|
340657
|
+
return content.split("\n").map((p) => p.trimStart()).filter((p) => p !== "" && !p.startsWith("#")).map((p) => {
|
|
340512
340658
|
const isNegative = p.startsWith("!");
|
|
340513
340659
|
if (isNegative) {
|
|
340514
340660
|
p = p.substring(1);
|
|
@@ -345472,9 +345618,10 @@ ${todoListString}` : "Successfully cleared the todo list.";
|
|
|
345472
345618
|
};
|
|
345473
345619
|
}
|
|
345474
345620
|
};
|
|
345475
|
-
var WriteTodosTool = class extends BaseDeclarativeTool {
|
|
345621
|
+
var WriteTodosTool = class _WriteTodosTool extends BaseDeclarativeTool {
|
|
345622
|
+
static Name = WRITE_TODOS_TOOL_NAME;
|
|
345476
345623
|
constructor() {
|
|
345477
|
-
super(
|
|
345624
|
+
super(_WriteTodosTool.Name, "Write Todos", WRITE_TODOS_DESCRIPTION, Kind.Other, {
|
|
345478
345625
|
type: "object",
|
|
345479
345626
|
properties: {
|
|
345480
345627
|
todos: {
|
|
@@ -346044,9 +346191,12 @@ var PolicyDecision;
|
|
|
346044
346191
|
// packages/core/dist/src/confirmation-bus/message-bus.js
|
|
346045
346192
|
var MessageBus = class extends EventEmitter9 {
|
|
346046
346193
|
policyEngine;
|
|
346047
|
-
|
|
346194
|
+
debug;
|
|
346195
|
+
constructor(policyEngine, debug2 = false) {
|
|
346048
346196
|
super();
|
|
346049
346197
|
this.policyEngine = policyEngine;
|
|
346198
|
+
this.debug = debug2;
|
|
346199
|
+
this.debug = debug2;
|
|
346050
346200
|
}
|
|
346051
346201
|
isValidMessage(message) {
|
|
346052
346202
|
if (!message || !message.type) {
|
|
@@ -346061,6 +346211,9 @@ var MessageBus = class extends EventEmitter9 {
|
|
|
346061
346211
|
this.emit(message.type, message);
|
|
346062
346212
|
}
|
|
346063
346213
|
publish(message) {
|
|
346214
|
+
if (this.debug) {
|
|
346215
|
+
console.debug(`[MESSAGE_BUS] publish: ${safeJsonStringify(message)}`);
|
|
346216
|
+
}
|
|
346064
346217
|
try {
|
|
346065
346218
|
if (!this.isValidMessage(message)) {
|
|
346066
346219
|
throw new Error(`Invalid message structure: ${safeJsonStringify(message)}`);
|
|
@@ -346236,9 +346389,6 @@ var PolicyEngine = class {
|
|
|
346236
346389
|
}
|
|
346237
346390
|
};
|
|
346238
346391
|
|
|
346239
|
-
// packages/core/dist/src/config/config.js
|
|
346240
|
-
var import_undici3 = __toESM(require_undici(), 1);
|
|
346241
|
-
|
|
346242
346392
|
// packages/core/dist/src/agents/registry.js
|
|
346243
346393
|
var AgentRegistry = class {
|
|
346244
346394
|
config;
|
|
@@ -348328,7 +348478,6 @@ var Config = class {
|
|
|
348328
348478
|
cwd;
|
|
348329
348479
|
bugCommand;
|
|
348330
348480
|
model;
|
|
348331
|
-
extensionContextFilePaths;
|
|
348332
348481
|
noBrowser;
|
|
348333
348482
|
folderTrust;
|
|
348334
348483
|
ideMode;
|
|
@@ -348336,6 +348485,7 @@ var Config = class {
|
|
|
348336
348485
|
maxSessionTurns;
|
|
348337
348486
|
listExtensions;
|
|
348338
348487
|
_extensions;
|
|
348488
|
+
_enabledExtensions;
|
|
348339
348489
|
_blockedMcpServers;
|
|
348340
348490
|
fallbackModelHandler;
|
|
348341
348491
|
quotaErrorOccurred = false;
|
|
@@ -348414,11 +348564,11 @@ var Config = class {
|
|
|
348414
348564
|
this.fileDiscoveryService = params.fileDiscoveryService ?? null;
|
|
348415
348565
|
this.bugCommand = params.bugCommand;
|
|
348416
348566
|
this.model = params.model;
|
|
348417
|
-
this.extensionContextFilePaths = params.extensionContextFilePaths ?? [];
|
|
348418
348567
|
this.maxSessionTurns = params.maxSessionTurns ?? -1;
|
|
348419
348568
|
this.experimentalZedIntegration = params.experimentalZedIntegration ?? false;
|
|
348420
348569
|
this.listExtensions = params.listExtensions ?? false;
|
|
348421
348570
|
this._extensions = params.extensions ?? [];
|
|
348571
|
+
this._enabledExtensions = params.enabledExtensions ?? [];
|
|
348422
348572
|
this._blockedMcpServers = params.blockedMcpServers ?? [];
|
|
348423
348573
|
this.noBrowser = params.noBrowser ?? false;
|
|
348424
348574
|
this.summarizeToolOutput = params.summarizeToolOutput;
|
|
@@ -348460,7 +348610,7 @@ var Config = class {
|
|
|
348460
348610
|
this.fileExclusions = new FileExclusions(this);
|
|
348461
348611
|
this.eventEmitter = params.eventEmitter;
|
|
348462
348612
|
this.policyEngine = new PolicyEngine(params.policyEngineConfig);
|
|
348463
|
-
this.messageBus = new MessageBus(this.policyEngine);
|
|
348613
|
+
this.messageBus = new MessageBus(this.policyEngine, this.debugMode);
|
|
348464
348614
|
this.outputSettings = {
|
|
348465
348615
|
format: params.output?.format ?? OutputFormat.TEXT
|
|
348466
348616
|
};
|
|
@@ -348472,7 +348622,7 @@ var Config = class {
|
|
|
348472
348622
|
initializeTelemetry(this);
|
|
348473
348623
|
}
|
|
348474
348624
|
if (this.getProxy()) {
|
|
348475
|
-
(
|
|
348625
|
+
setGlobalProxy(this.getProxy());
|
|
348476
348626
|
}
|
|
348477
348627
|
this.geminiClient = new GeminiClient(this);
|
|
348478
348628
|
this.modelRouterService = new ModelRouterService(this);
|
|
@@ -348724,9 +348874,6 @@ var Config = class {
|
|
|
348724
348874
|
getUsageStatisticsEnabled() {
|
|
348725
348875
|
return this.usageStatisticsEnabled;
|
|
348726
348876
|
}
|
|
348727
|
-
getExtensionContextFilePaths() {
|
|
348728
|
-
return this.extensionContextFilePaths;
|
|
348729
|
-
}
|
|
348730
348877
|
getExperimentalZedIntegration() {
|
|
348731
348878
|
return this.experimentalZedIntegration;
|
|
348732
348879
|
}
|
|
@@ -348739,6 +348886,11 @@ var Config = class {
|
|
|
348739
348886
|
getExtensions() {
|
|
348740
348887
|
return this._extensions;
|
|
348741
348888
|
}
|
|
348889
|
+
// The list of explicitly enabled extensions, if any were given, may contain
|
|
348890
|
+
// the string "none".
|
|
348891
|
+
getEnabledExtensions() {
|
|
348892
|
+
return this._enabledExtensions;
|
|
348893
|
+
}
|
|
348742
348894
|
getBlockedMcpServers() {
|
|
348743
348895
|
return this._blockedMcpServers;
|
|
348744
348896
|
}
|
|
@@ -351448,7 +351600,7 @@ async function findProjectRoot2(startDir) {
|
|
|
351448
351600
|
currentDir = parentDir;
|
|
351449
351601
|
}
|
|
351450
351602
|
}
|
|
351451
|
-
async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, debugMode, fileService,
|
|
351603
|
+
async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, debugMode, fileService, folderTrust, fileFilteringOptions, maxDirs) {
|
|
351452
351604
|
const dirs = /* @__PURE__ */ new Set([
|
|
351453
351605
|
...includeDirectoriesToReadGemini,
|
|
351454
351606
|
currentWorkingDirectory
|
|
@@ -351458,7 +351610,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDire
|
|
|
351458
351610
|
const pathsArrays = [];
|
|
351459
351611
|
for (let i3 = 0; i3 < dirsArray.length; i3 += CONCURRENT_LIMIT) {
|
|
351460
351612
|
const batch = dirsArray.slice(i3, i3 + CONCURRENT_LIMIT);
|
|
351461
|
-
const batchPromises = batch.map((dir) => getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMode, fileService,
|
|
351613
|
+
const batchPromises = batch.map((dir) => getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMode, fileService, folderTrust, fileFilteringOptions, maxDirs));
|
|
351462
351614
|
const batchResults = await Promise.allSettled(batchPromises);
|
|
351463
351615
|
for (const result of batchResults) {
|
|
351464
351616
|
if (result.status === "fulfilled") {
|
|
@@ -351473,7 +351625,7 @@ async function getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDire
|
|
|
351473
351625
|
const paths = pathsArrays.flat();
|
|
351474
351626
|
return Array.from(new Set(paths));
|
|
351475
351627
|
}
|
|
351476
|
-
async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMode, fileService,
|
|
351628
|
+
async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMode, fileService, folderTrust, fileFilteringOptions, maxDirs) {
|
|
351477
351629
|
const allPaths = /* @__PURE__ */ new Set();
|
|
351478
351630
|
const geminiMdFilenames = getAllGeminiMdFilenames();
|
|
351479
351631
|
for (const geminiMdFilename of geminiMdFilenames) {
|
|
@@ -351531,9 +351683,6 @@ async function getGeminiMdFilePathsInternalForEachDir(dir, userHomePath, debugMo
|
|
|
351531
351683
|
}
|
|
351532
351684
|
}
|
|
351533
351685
|
}
|
|
351534
|
-
for (const extensionPath of extensionContextFilePaths) {
|
|
351535
|
-
allPaths.add(extensionPath);
|
|
351536
|
-
}
|
|
351537
351686
|
const finalPaths = Array.from(allPaths);
|
|
351538
351687
|
if (debugMode)
|
|
351539
351688
|
logger5.debug(`Final ordered ${getAllGeminiMdFilenames()} paths to read: ${JSON.stringify(finalPaths)}`);
|
|
@@ -351587,11 +351736,12 @@ ${trimmedContent}
|
|
|
351587
351736
|
--- End of Context from: ${displayPath} ---`;
|
|
351588
351737
|
}).filter((block2) => block2 !== null).join("\n\n");
|
|
351589
351738
|
}
|
|
351590
|
-
async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDirectoriesToReadGemini, debugMode, fileService,
|
|
351739
|
+
async function loadServerHierarchicalMemory(currentWorkingDirectory, includeDirectoriesToReadGemini, debugMode, fileService, extensions, folderTrust, importFormat = "tree", fileFilteringOptions, maxDirs = 200) {
|
|
351591
351740
|
if (debugMode)
|
|
351592
351741
|
logger5.debug(`Loading server hierarchical memory for CWD: ${currentWorkingDirectory} (importFormat: ${importFormat})`);
|
|
351593
351742
|
const userHomePath = homedir4();
|
|
351594
|
-
const filePaths = await getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, debugMode, fileService,
|
|
351743
|
+
const filePaths = await getGeminiMdFilePathsInternal(currentWorkingDirectory, includeDirectoriesToReadGemini, userHomePath, debugMode, fileService, folderTrust, fileFilteringOptions || DEFAULT_MEMORY_FILE_FILTERING_OPTIONS, maxDirs);
|
|
351744
|
+
filePaths.push(...extensions.filter((ext2) => ext2.isActive).flatMap((ext2) => ext2.contextFiles));
|
|
351595
351745
|
if (filePaths.length === 0) {
|
|
351596
351746
|
if (debugMode)
|
|
351597
351747
|
logger5.debug("No GEMINI.md files found in hierarchy of the workspace.");
|
|
@@ -351746,13 +351896,12 @@ async function loadConfig(settings, extensions, taskId) {
|
|
|
351746
351896
|
folderTrust: settings.folderTrust === true
|
|
351747
351897
|
};
|
|
351748
351898
|
const fileService = new FileDiscoveryService(workspaceDir);
|
|
351749
|
-
const extensionContextFilePaths = extensions.flatMap((e2) => e2.contextFiles);
|
|
351750
351899
|
const { memoryContent, fileCount } = await loadServerHierarchicalMemory(
|
|
351751
351900
|
workspaceDir,
|
|
351752
351901
|
[workspaceDir],
|
|
351753
351902
|
false,
|
|
351754
351903
|
fileService,
|
|
351755
|
-
|
|
351904
|
+
extensions,
|
|
351756
351905
|
settings.folderTrust === true
|
|
351757
351906
|
);
|
|
351758
351907
|
configParams.userMemory = memoryContent;
|
|
@@ -351856,6 +352005,10 @@ function findEnvFile(startDir) {
|
|
|
351856
352005
|
|
|
351857
352006
|
// packages/a2a-server/src/persistence/gcs.ts
|
|
351858
352007
|
var getTmpArchiveFilename = (taskId) => `task-${taskId}-workspace-${v4_default2()}.tar.gz`;
|
|
352008
|
+
var isTaskIdValid = (taskId) => {
|
|
352009
|
+
const validTaskIdRegex = /^[a-zA-Z0-9_-]+$/;
|
|
352010
|
+
return validTaskIdRegex.test(taskId);
|
|
352011
|
+
};
|
|
351859
352012
|
var GCSTaskStore = class {
|
|
351860
352013
|
storage;
|
|
351861
352014
|
bucketName;
|
|
@@ -351904,6 +352057,9 @@ var GCSTaskStore = class {
|
|
|
351904
352057
|
await this.bucketInitialized;
|
|
351905
352058
|
}
|
|
351906
352059
|
getObjectPath(taskId, type) {
|
|
352060
|
+
if (!isTaskIdValid(taskId)) {
|
|
352061
|
+
throw new Error(`Invalid taskId: ${taskId}`);
|
|
352062
|
+
}
|
|
351907
352063
|
return `tasks/${taskId}/${type}.tar.gz`;
|
|
351908
352064
|
}
|
|
351909
352065
|
async save(task) {
|
|
@@ -352426,7 +352582,7 @@ var Task = class _Task {
|
|
|
352426
352582
|
contextId: this.contextId
|
|
352427
352583
|
};
|
|
352428
352584
|
}
|
|
352429
|
-
_createStatusUpdateEvent(stateToReport, coderAgentMessage, message, final = false, timestamp, metadataError) {
|
|
352585
|
+
_createStatusUpdateEvent(stateToReport, coderAgentMessage, message, final = false, timestamp, metadataError, traceId) {
|
|
352430
352586
|
const metadata2 = {
|
|
352431
352587
|
coderAgent: coderAgentMessage,
|
|
352432
352588
|
model: this.config.getModel(),
|
|
@@ -352435,6 +352591,9 @@ var Task = class _Task {
|
|
|
352435
352591
|
if (metadataError) {
|
|
352436
352592
|
metadata2.error = metadataError;
|
|
352437
352593
|
}
|
|
352594
|
+
if (traceId) {
|
|
352595
|
+
metadata2.traceId = traceId;
|
|
352596
|
+
}
|
|
352438
352597
|
return {
|
|
352439
352598
|
kind: "status-update",
|
|
352440
352599
|
taskId: this.id,
|
|
@@ -352449,7 +352608,7 @@ var Task = class _Task {
|
|
|
352449
352608
|
metadata: metadata2
|
|
352450
352609
|
};
|
|
352451
352610
|
}
|
|
352452
|
-
setTaskStateAndPublishUpdate(newState, coderAgentMessage, messageText, messageParts, final = false, metadataError) {
|
|
352611
|
+
setTaskStateAndPublishUpdate(newState, coderAgentMessage, messageText, messageParts, final = false, metadataError, traceId) {
|
|
352453
352612
|
this.taskState = newState;
|
|
352454
352613
|
let message;
|
|
352455
352614
|
if (messageText) {
|
|
@@ -352470,7 +352629,8 @@ var Task = class _Task {
|
|
|
352470
352629
|
message,
|
|
352471
352630
|
final,
|
|
352472
352631
|
void 0,
|
|
352473
|
-
metadataError
|
|
352632
|
+
metadataError,
|
|
352633
|
+
traceId
|
|
352474
352634
|
);
|
|
352475
352635
|
this.eventBus?.publish(event);
|
|
352476
352636
|
}
|
|
@@ -352687,10 +352847,11 @@ var Task = class _Task {
|
|
|
352687
352847
|
const stateChange = {
|
|
352688
352848
|
kind: "state-change" /* StateChangeEvent */
|
|
352689
352849
|
};
|
|
352850
|
+
const traceId = "traceId" in event && event.traceId ? event.traceId : void 0;
|
|
352690
352851
|
switch (event.type) {
|
|
352691
352852
|
case GeminiEventType.Content:
|
|
352692
352853
|
logger.info("[Task] Sending agent message content...");
|
|
352693
|
-
this._sendTextContent(event.value);
|
|
352854
|
+
this._sendTextContent(event.value, traceId);
|
|
352694
352855
|
break;
|
|
352695
352856
|
case GeminiEventType.ToolCallRequest:
|
|
352696
352857
|
logger.warn(
|
|
@@ -352721,12 +352882,14 @@ var Task = class _Task {
|
|
|
352721
352882
|
stateChange,
|
|
352722
352883
|
"Task cancelled by user",
|
|
352723
352884
|
void 0,
|
|
352724
|
-
true
|
|
352885
|
+
true,
|
|
352886
|
+
void 0,
|
|
352887
|
+
traceId
|
|
352725
352888
|
);
|
|
352726
352889
|
break;
|
|
352727
352890
|
case GeminiEventType.Thought:
|
|
352728
352891
|
logger.info("[Task] Sending agent thought...");
|
|
352729
|
-
this._sendThought(event.value);
|
|
352892
|
+
this._sendThought(event.value, traceId);
|
|
352730
352893
|
break;
|
|
352731
352894
|
case GeminiEventType.ChatCompressed:
|
|
352732
352895
|
break;
|
|
@@ -352752,7 +352915,8 @@ var Task = class _Task {
|
|
|
352752
352915
|
`Agent Error, unknown agent message: ${errorMessage}`,
|
|
352753
352916
|
void 0,
|
|
352754
352917
|
false,
|
|
352755
|
-
errMessage
|
|
352918
|
+
errMessage,
|
|
352919
|
+
traceId
|
|
352756
352920
|
);
|
|
352757
352921
|
break;
|
|
352758
352922
|
}
|
|
@@ -352949,7 +353113,7 @@ var Task = class _Task {
|
|
|
352949
353113
|
}();
|
|
352950
353114
|
}
|
|
352951
353115
|
}
|
|
352952
|
-
_sendTextContent(content) {
|
|
353116
|
+
_sendTextContent(content, traceId) {
|
|
352953
353117
|
if (content === "") {
|
|
352954
353118
|
return;
|
|
352955
353119
|
}
|
|
@@ -352963,11 +353127,14 @@ var Task = class _Task {
|
|
|
352963
353127
|
this.taskState,
|
|
352964
353128
|
textContent2,
|
|
352965
353129
|
message,
|
|
352966
|
-
false
|
|
353130
|
+
false,
|
|
353131
|
+
void 0,
|
|
353132
|
+
void 0,
|
|
353133
|
+
traceId
|
|
352967
353134
|
)
|
|
352968
353135
|
);
|
|
352969
353136
|
}
|
|
352970
|
-
_sendThought(content) {
|
|
353137
|
+
_sendThought(content, traceId) {
|
|
352971
353138
|
if (!content.subject && !content.description) {
|
|
352972
353139
|
return;
|
|
352973
353140
|
}
|
|
@@ -352989,7 +353156,15 @@ var Task = class _Task {
|
|
|
352989
353156
|
kind: "thought" /* ThoughtEvent */
|
|
352990
353157
|
};
|
|
352991
353158
|
this.eventBus?.publish(
|
|
352992
|
-
this._createStatusUpdateEvent(
|
|
353159
|
+
this._createStatusUpdateEvent(
|
|
353160
|
+
this.taskState,
|
|
353161
|
+
thought,
|
|
353162
|
+
message,
|
|
353163
|
+
false,
|
|
353164
|
+
void 0,
|
|
353165
|
+
void 0,
|
|
353166
|
+
traceId
|
|
353167
|
+
)
|
|
352993
353168
|
);
|
|
352994
353169
|
}
|
|
352995
353170
|
};
|