@google/gemini-cli-a2a-server 0.28.0-preview.2 → 0.29.0-nightly.20260205.a3af4a8ca
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 +156 -64
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
package/dist/a2a-server.mjs
CHANGED
|
@@ -92114,7 +92114,7 @@ function isValidToolName(name4, options = {}) {
|
|
|
92114
92114
|
}
|
|
92115
92115
|
return false;
|
|
92116
92116
|
}
|
|
92117
|
-
var GLOB_TOOL_NAME, WRITE_TODOS_TOOL_NAME, WRITE_FILE_TOOL_NAME, WEB_SEARCH_TOOL_NAME, WEB_FETCH_TOOL_NAME, EDIT_TOOL_NAME, SHELL_TOOL_NAME, GREP_TOOL_NAME, READ_MANY_FILES_TOOL_NAME, READ_FILE_TOOL_NAME, LS_TOOL_NAME, MEMORY_TOOL_NAME, GET_INTERNAL_DOCS_TOOL_NAME, ACTIVATE_SKILL_TOOL_NAME, EDIT_TOOL_NAMES, ASK_USER_TOOL_NAME, ASK_USER_DISPLAY_NAME, EXIT_PLAN_MODE_TOOL_NAME, TOOL_LEGACY_ALIASES, DISCOVERED_TOOL_PREFIX, ALL_BUILTIN_TOOL_NAMES, PLAN_MODE_TOOLS;
|
|
92117
|
+
var GLOB_TOOL_NAME, WRITE_TODOS_TOOL_NAME, WRITE_FILE_TOOL_NAME, WEB_SEARCH_TOOL_NAME, WEB_FETCH_TOOL_NAME, EDIT_TOOL_NAME, SHELL_TOOL_NAME, GREP_TOOL_NAME, READ_MANY_FILES_TOOL_NAME, READ_FILE_TOOL_NAME, LS_TOOL_NAME, MEMORY_TOOL_NAME, GET_INTERNAL_DOCS_TOOL_NAME, ACTIVATE_SKILL_TOOL_NAME, EDIT_TOOL_NAMES, ASK_USER_TOOL_NAME, ASK_USER_DISPLAY_NAME, EXIT_PLAN_MODE_TOOL_NAME, ENTER_PLAN_MODE_TOOL_NAME, TOOL_LEGACY_ALIASES, DISCOVERED_TOOL_PREFIX, ALL_BUILTIN_TOOL_NAMES, PLAN_MODE_TOOLS;
|
|
92118
92118
|
var init_tool_names = __esm({
|
|
92119
92119
|
"packages/core/dist/src/tools/tool-names.js"() {
|
|
92120
92120
|
"use strict";
|
|
@@ -92136,6 +92136,7 @@ var init_tool_names = __esm({
|
|
|
92136
92136
|
ASK_USER_TOOL_NAME = "ask_user";
|
|
92137
92137
|
ASK_USER_DISPLAY_NAME = "Ask User";
|
|
92138
92138
|
EXIT_PLAN_MODE_TOOL_NAME = "exit_plan_mode";
|
|
92139
|
+
ENTER_PLAN_MODE_TOOL_NAME = "enter_plan_mode";
|
|
92139
92140
|
TOOL_LEGACY_ALIASES = {
|
|
92140
92141
|
// Add future renames here, e.g.:
|
|
92141
92142
|
search_file_content: GREP_TOOL_NAME
|
|
@@ -122543,13 +122544,13 @@ var require_path = __commonJS({
|
|
|
122543
122544
|
"node_modules/@protobufjs/path/index.js"(exports2) {
|
|
122544
122545
|
"use strict";
|
|
122545
122546
|
var path82 = exports2;
|
|
122546
|
-
var
|
|
122547
|
+
var isAbsolute6 = (
|
|
122547
122548
|
/**
|
|
122548
122549
|
* Tests if the specified path is absolute.
|
|
122549
122550
|
* @param {string} path Path to test
|
|
122550
122551
|
* @returns {boolean} `true` if path is absolute
|
|
122551
122552
|
*/
|
|
122552
|
-
path82.isAbsolute = function
|
|
122553
|
+
path82.isAbsolute = function isAbsolute7(path83) {
|
|
122553
122554
|
return /^(?:\/|\w+:)/.test(path83);
|
|
122554
122555
|
}
|
|
122555
122556
|
);
|
|
@@ -122561,7 +122562,7 @@ var require_path = __commonJS({
|
|
|
122561
122562
|
*/
|
|
122562
122563
|
path82.normalize = function normalize6(path83) {
|
|
122563
122564
|
path83 = path83.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
|
|
122564
|
-
var parts2 = path83.split("/"), absolute =
|
|
122565
|
+
var parts2 = path83.split("/"), absolute = isAbsolute6(path83), prefix = "";
|
|
122565
122566
|
if (absolute)
|
|
122566
122567
|
prefix = parts2.shift() + "/";
|
|
122567
122568
|
for (var i4 = 0; i4 < parts2.length; ) {
|
|
@@ -122583,7 +122584,7 @@ var require_path = __commonJS({
|
|
|
122583
122584
|
path82.resolve = function resolve15(originPath, includePath, alreadyNormalized) {
|
|
122584
122585
|
if (!alreadyNormalized)
|
|
122585
122586
|
includePath = normalize5(includePath);
|
|
122586
|
-
if (
|
|
122587
|
+
if (isAbsolute6(includePath))
|
|
122587
122588
|
return includePath;
|
|
122588
122589
|
if (!alreadyNormalized)
|
|
122589
122590
|
originPath = normalize5(originPath);
|
|
@@ -327581,7 +327582,7 @@ var __filename = fileURLToPath5(import.meta.url);
|
|
|
327581
327582
|
var __dirname3 = path20.dirname(__filename);
|
|
327582
327583
|
async function getVersion() {
|
|
327583
327584
|
const pkgJson = await getPackageJson(__dirname3);
|
|
327584
|
-
return "0.
|
|
327585
|
+
return "0.29.0-nightly.20260205.a3af4a8ca";
|
|
327585
327586
|
}
|
|
327586
327587
|
|
|
327587
327588
|
// packages/core/dist/src/code_assist/experiments/client_metadata.js
|
|
@@ -331005,8 +331006,8 @@ var Float64Vector = import_vector.default.Float64Vector;
|
|
|
331005
331006
|
var PointerVector = import_vector.default.PointerVector;
|
|
331006
331007
|
|
|
331007
331008
|
// packages/core/dist/src/generated/git-commit.js
|
|
331008
|
-
var GIT_COMMIT_INFO = "
|
|
331009
|
-
var CLI_VERSION = "0.
|
|
331009
|
+
var GIT_COMMIT_INFO = "a3af4a8ca";
|
|
331010
|
+
var CLI_VERSION = "0.29.0-nightly.20260205.a3af4a8ca";
|
|
331010
331011
|
|
|
331011
331012
|
// packages/core/dist/src/ide/detect-ide.js
|
|
331012
331013
|
var IDE_DEFINITIONS = {
|
|
@@ -382369,8 +382370,8 @@ var AskUserTool = class extends BaseDeclarativeTool {
|
|
|
382369
382370
|
},
|
|
382370
382371
|
header: {
|
|
382371
382372
|
type: "string",
|
|
382372
|
-
maxLength:
|
|
382373
|
-
description: 'Very short label displayed as a chip/tag (max
|
|
382373
|
+
maxLength: 16,
|
|
382374
|
+
description: 'Very short label displayed as a chip/tag (max 16 chars). Examples: "Auth method", "Library", "Approach".'
|
|
382374
382375
|
},
|
|
382375
382376
|
type: {
|
|
382376
382377
|
type: "string",
|
|
@@ -382657,6 +382658,7 @@ var ExitPlanModeInvocation = class extends BaseToolInvocation {
|
|
|
382657
382658
|
if (payload?.approved) {
|
|
382658
382659
|
const newMode = payload.approvalMode ?? ApprovalMode.DEFAULT;
|
|
382659
382660
|
this.config.setApprovalMode(newMode);
|
|
382661
|
+
this.config.setApprovedPlanPath(resolvedPlanPath);
|
|
382660
382662
|
const description = getApprovalModeDescription(newMode);
|
|
382661
382663
|
return {
|
|
382662
382664
|
llmContent: `Plan approved. Switching to ${description}.
|
|
@@ -382688,6 +382690,71 @@ Ask the user for specific feedback on how to improve the plan.`,
|
|
|
382688
382690
|
}
|
|
382689
382691
|
};
|
|
382690
382692
|
|
|
382693
|
+
// packages/core/dist/src/tools/enter-plan-mode.js
|
|
382694
|
+
init_tools();
|
|
382695
|
+
init_tool_names();
|
|
382696
|
+
init_types2();
|
|
382697
|
+
var EnterPlanModeTool = class extends BaseDeclarativeTool {
|
|
382698
|
+
config;
|
|
382699
|
+
constructor(config3, messageBus) {
|
|
382700
|
+
super(ENTER_PLAN_MODE_TOOL_NAME, "Enter Plan Mode", "Switch to Plan Mode to safely research, design, and plan complex changes using read-only tools.", Kind.Plan, {
|
|
382701
|
+
type: "object",
|
|
382702
|
+
properties: {
|
|
382703
|
+
reason: {
|
|
382704
|
+
type: "string",
|
|
382705
|
+
description: "Short reason explaining why you are entering plan mode."
|
|
382706
|
+
}
|
|
382707
|
+
}
|
|
382708
|
+
}, messageBus);
|
|
382709
|
+
this.config = config3;
|
|
382710
|
+
}
|
|
382711
|
+
createInvocation(params, messageBus, toolName, toolDisplayName) {
|
|
382712
|
+
return new EnterPlanModeInvocation(params, messageBus, toolName, toolDisplayName, this.config);
|
|
382713
|
+
}
|
|
382714
|
+
};
|
|
382715
|
+
var EnterPlanModeInvocation = class extends BaseToolInvocation {
|
|
382716
|
+
config;
|
|
382717
|
+
confirmationOutcome = null;
|
|
382718
|
+
constructor(params, messageBus, toolName, toolDisplayName, config3) {
|
|
382719
|
+
super(params, messageBus, toolName, toolDisplayName);
|
|
382720
|
+
this.config = config3;
|
|
382721
|
+
}
|
|
382722
|
+
getDescription() {
|
|
382723
|
+
return this.params.reason || "Initiating Plan Mode";
|
|
382724
|
+
}
|
|
382725
|
+
async shouldConfirmExecute(abortSignal) {
|
|
382726
|
+
const decision = await this.getMessageBusDecision(abortSignal);
|
|
382727
|
+
if (decision === "ALLOW") {
|
|
382728
|
+
return false;
|
|
382729
|
+
}
|
|
382730
|
+
if (decision === "DENY") {
|
|
382731
|
+
throw new Error(`Tool execution for "${this._toolDisplayName || this._toolName}" denied by policy.`);
|
|
382732
|
+
}
|
|
382733
|
+
return {
|
|
382734
|
+
type: "info",
|
|
382735
|
+
title: "Enter Plan Mode",
|
|
382736
|
+
prompt: "This will restrict the agent to read-only tools to allow for safe planning.",
|
|
382737
|
+
onConfirm: async (outcome) => {
|
|
382738
|
+
this.confirmationOutcome = outcome;
|
|
382739
|
+
await this.publishPolicyUpdate(outcome);
|
|
382740
|
+
}
|
|
382741
|
+
};
|
|
382742
|
+
}
|
|
382743
|
+
async execute(_signal) {
|
|
382744
|
+
if (this.confirmationOutcome === ToolConfirmationOutcome.Cancel) {
|
|
382745
|
+
return {
|
|
382746
|
+
llmContent: "User cancelled entering Plan Mode.",
|
|
382747
|
+
returnDisplay: "Cancelled"
|
|
382748
|
+
};
|
|
382749
|
+
}
|
|
382750
|
+
this.config.setApprovalMode(ApprovalMode.PLAN);
|
|
382751
|
+
return {
|
|
382752
|
+
llmContent: "Switching to Plan mode.",
|
|
382753
|
+
returnDisplay: this.params.reason ? `Switching to Plan mode: ${this.params.reason}` : "Switching to Plan mode"
|
|
382754
|
+
};
|
|
382755
|
+
}
|
|
382756
|
+
};
|
|
382757
|
+
|
|
382691
382758
|
// packages/core/dist/src/core/client.js
|
|
382692
382759
|
init_node();
|
|
382693
382760
|
|
|
@@ -385465,7 +385532,7 @@ ${renderAgentSkills(options.agentSkills)}
|
|
|
385465
385532
|
|
|
385466
385533
|
${renderHookContext(options.hookContext)}
|
|
385467
385534
|
|
|
385468
|
-
${renderPrimaryWorkflows(options.primaryWorkflows)}
|
|
385535
|
+
${options.planningWorkflow ? renderPlanningWorkflow(options.planningWorkflow) : renderPrimaryWorkflows(options.primaryWorkflows)}
|
|
385469
385536
|
|
|
385470
385537
|
${renderOperationalGuidelines(options.operationalGuidelines)}
|
|
385471
385538
|
|
|
@@ -385476,13 +385543,11 @@ ${renderGitRepo(options.gitRepo)}
|
|
|
385476
385543
|
${renderFinalReminder(options.finalReminder)}
|
|
385477
385544
|
`.trim();
|
|
385478
385545
|
}
|
|
385479
|
-
function renderFinalShell(basePrompt, userMemory
|
|
385546
|
+
function renderFinalShell(basePrompt, userMemory) {
|
|
385480
385547
|
return `
|
|
385481
385548
|
${basePrompt.trim()}
|
|
385482
385549
|
|
|
385483
385550
|
${renderUserMemory(userMemory)}
|
|
385484
|
-
|
|
385485
|
-
${renderApprovalModePlan(planOptions)}
|
|
385486
385551
|
`.trim();
|
|
385487
385552
|
}
|
|
385488
385553
|
function renderPreamble(options) {
|
|
@@ -385549,7 +385614,7 @@ function renderPrimaryWorkflows(options) {
|
|
|
385549
385614
|
When requested to perform tasks like fixing bugs, adding features, refactoring, or explaining code, follow this sequence:
|
|
385550
385615
|
${workflowStepUnderstand(options)}
|
|
385551
385616
|
${workflowStepPlan(options)}
|
|
385552
|
-
3. **Implement:** Use the available tools (e.g., '${EDIT_TOOL_NAME}', '${WRITE_FILE_TOOL_NAME}' '${SHELL_TOOL_NAME}' ...) to act on the plan
|
|
385617
|
+
3. **Implement:** Use the available tools (e.g., '${EDIT_TOOL_NAME}', '${WRITE_FILE_TOOL_NAME}' '${SHELL_TOOL_NAME}' ...) to act on the plan. Strictly adhere to the project's established conventions (detailed under 'Core Mandates'). Before making manual code changes, check if an ecosystem tool (like 'eslint --fix', 'prettier --write', 'go fmt', 'cargo fmt') is available in the project to perform the task automatically.
|
|
385553
385618
|
4. **Verify (Tests):** If applicable and feasible, verify the changes using the project's testing procedures. Identify the correct test commands and frameworks by examining 'README' files, build/package configuration (e.g., 'package.json'), or existing test execution patterns. NEVER assume standard test commands. When executing test commands, prefer "run once" or "CI" modes to ensure the command terminates after completion.
|
|
385554
385619
|
5. **Verify (Standards):** VERY IMPORTANT: After making code changes, execute the project-specific build, linting and type-checking commands (e.g., 'tsc', 'npm run lint', 'ruff check .') that you have identified for this project (or obtained from the user). This ensures code quality and adherence to standards.${workflowVerifyStandardsSuffix(options.interactive)}
|
|
385555
385620
|
6. **Finalize:** After all verification passes, consider the task complete. Do not remove or revert any changes or created files (like tests). Await the user's next instruction.
|
|
@@ -385643,7 +385708,7 @@ function renderUserMemory(memory) {
|
|
|
385643
385708
|
|
|
385644
385709
|
${memory.trim()}`;
|
|
385645
385710
|
}
|
|
385646
|
-
function
|
|
385711
|
+
function renderPlanningWorkflow(options) {
|
|
385647
385712
|
if (!options)
|
|
385648
385713
|
return "";
|
|
385649
385714
|
return `
|
|
@@ -385791,11 +385856,11 @@ function toolUsageInteractive(interactive) {
|
|
|
385791
385856
|
if (interactive) {
|
|
385792
385857
|
return `
|
|
385793
385858
|
- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`. If unsure, ask the user.
|
|
385794
|
-
- **Interactive Commands:**
|
|
385859
|
+
- **Interactive Commands:** Never use interactive shell commands unless absolutely necessary. **ALWAYS** use arguments to bypass prompts for **EVERY** tool in use that supports it, even if that command is part of a chain or larger command. For example: 'git --no-pager', 'vitest run', and 'npx --yes' to bypass interactive prompts.`;
|
|
385795
385860
|
}
|
|
385796
385861
|
return `
|
|
385797
385862
|
- **Background Processes:** Use background processes (via \`&\`) for commands that are unlikely to stop on their own, e.g. \`node server.js &\`.
|
|
385798
|
-
- **Interactive Commands:**
|
|
385863
|
+
- **Interactive Commands:** Never use interactive shell commands. **ALWAYS** use arguments to bypass prompts for **EVERY** tool in use that supports it, even if that command is part of a chain or larger command. For example: 'git --no-pager', 'vitest run', and 'npx --yes' to bypass interactive prompts.`;
|
|
385799
385864
|
}
|
|
385800
385865
|
function toolUsageRememberingFacts(options) {
|
|
385801
385866
|
const base = `
|
|
@@ -386084,10 +386149,6 @@ var PromptProvider = class {
|
|
|
386084
386149
|
const toolNames = config3.getToolRegistry().getAllToolNames();
|
|
386085
386150
|
const desiredModel = resolveModel(config3.getActiveModel(), config3.getPreviewFeatures());
|
|
386086
386151
|
const isGemini3 = isPreviewModel(desiredModel);
|
|
386087
|
-
const planOptions = isPlanMode ? {
|
|
386088
|
-
planModeToolsList: PLAN_MODE_TOOLS.filter((t3) => new Set(toolNames).has(t3)).map((t3) => `- \`${t3}\``).join("\n"),
|
|
386089
|
-
plansDir: config3.storage.getProjectTempPlansDir()
|
|
386090
|
-
} : void 0;
|
|
386091
386152
|
let basePrompt;
|
|
386092
386153
|
if (systemMdResolution.value && !systemMdResolution.isDisabled) {
|
|
386093
386154
|
let systemMdPath = path60.resolve(path60.join(GEMINI_DIR, "system.md"));
|
|
@@ -386126,6 +386187,10 @@ var PromptProvider = class {
|
|
|
386126
386187
|
enableCodebaseInvestigator: toolNames.includes(CodebaseInvestigatorAgent.name),
|
|
386127
386188
|
enableWriteTodosTool: toolNames.includes(WRITE_TODOS_TOOL_NAME)
|
|
386128
386189
|
}), !isPlanMode),
|
|
386190
|
+
planningWorkflow: this.withSection("planningWorkflow", () => ({
|
|
386191
|
+
planModeToolsList: PLAN_MODE_TOOLS.filter((t3) => new Set(toolNames).has(t3)).map((t3) => `- \`${t3}\``).join("\n"),
|
|
386192
|
+
plansDir: config3.storage.getProjectTempPlansDir()
|
|
386193
|
+
}), isPlanMode),
|
|
386129
386194
|
operationalGuidelines: this.withSection("operationalGuidelines", () => ({
|
|
386130
386195
|
interactive: interactiveMode,
|
|
386131
386196
|
isGemini3,
|
|
@@ -386139,7 +386204,7 @@ var PromptProvider = class {
|
|
|
386139
386204
|
};
|
|
386140
386205
|
basePrompt = getCoreSystemPrompt(options);
|
|
386141
386206
|
}
|
|
386142
|
-
const finalPrompt = renderFinalShell(basePrompt, userMemory
|
|
386207
|
+
const finalPrompt = renderFinalShell(basePrompt, userMemory);
|
|
386143
386208
|
const sanitizedPrompt = finalPrompt.replace(/\n{3,}/g, "\n\n");
|
|
386144
386209
|
this.maybeWriteSystemMd(sanitizedPrompt, systemMdResolution, path60.resolve(path60.join(GEMINI_DIR, "system.md")));
|
|
386145
386210
|
return sanitizedPrompt;
|
|
@@ -394157,7 +394222,7 @@ var HookRegistry = class {
|
|
|
394157
394222
|
async initialize() {
|
|
394158
394223
|
this.entries = [];
|
|
394159
394224
|
this.processHooksFromConfig();
|
|
394160
|
-
debugLogger.
|
|
394225
|
+
debugLogger.debug(`Hook registry initialized with ${this.entries.length} hook entries`);
|
|
394161
394226
|
}
|
|
394162
394227
|
/**
|
|
394163
394228
|
* Get all hook entries for a specific event
|
|
@@ -398087,6 +398152,22 @@ var jsYaml = {
|
|
|
398087
398152
|
import * as fs58 from "node:fs/promises";
|
|
398088
398153
|
import * as path67 from "node:path";
|
|
398089
398154
|
import * as crypto21 from "node:crypto";
|
|
398155
|
+
|
|
398156
|
+
// packages/core/dist/src/agents/types.js
|
|
398157
|
+
var AgentTerminateMode;
|
|
398158
|
+
(function(AgentTerminateMode2) {
|
|
398159
|
+
AgentTerminateMode2["ERROR"] = "ERROR";
|
|
398160
|
+
AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
|
|
398161
|
+
AgentTerminateMode2["GOAL"] = "GOAL";
|
|
398162
|
+
AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
|
|
398163
|
+
AgentTerminateMode2["ABORTED"] = "ABORTED";
|
|
398164
|
+
AgentTerminateMode2["ERROR_NO_COMPLETE_TASK_CALL"] = "ERROR_NO_COMPLETE_TASK_CALL";
|
|
398165
|
+
})(AgentTerminateMode || (AgentTerminateMode = {}));
|
|
398166
|
+
var DEFAULT_QUERY_STRING = "Get Started!";
|
|
398167
|
+
var DEFAULT_MAX_TURNS = 15;
|
|
398168
|
+
var DEFAULT_MAX_TIME_MINUTES = 5;
|
|
398169
|
+
|
|
398170
|
+
// packages/core/dist/src/agents/agentLoader.js
|
|
398090
398171
|
init_tool_names();
|
|
398091
398172
|
|
|
398092
398173
|
// packages/core/dist/src/skills/skillLoader.js
|
|
@@ -398149,10 +398230,12 @@ async function loadSkillsFromDir(dir) {
|
|
|
398149
398230
|
if (!stats || !stats.isDirectory()) {
|
|
398150
398231
|
return [];
|
|
398151
398232
|
}
|
|
398152
|
-
const
|
|
398233
|
+
const pattern = ["SKILL.md", "*/SKILL.md"];
|
|
398234
|
+
const skillFiles = await glob(pattern, {
|
|
398153
398235
|
cwd: absoluteSearchPath,
|
|
398154
398236
|
absolute: true,
|
|
398155
|
-
nodir: true
|
|
398237
|
+
nodir: true,
|
|
398238
|
+
ignore: ["**/node_modules/**", "**/.git/**"]
|
|
398156
398239
|
});
|
|
398157
398240
|
for (const skillFile of skillFiles) {
|
|
398158
398241
|
const metadata2 = await loadSkillFromFile(skillFile);
|
|
@@ -398182,8 +398265,9 @@ async function loadSkillFromFile(filePath) {
|
|
|
398182
398265
|
if (!frontmatter) {
|
|
398183
398266
|
return null;
|
|
398184
398267
|
}
|
|
398268
|
+
const sanitizedName = frontmatter.name.replace(/[:\\/<>*?"|]/g, "-");
|
|
398185
398269
|
return {
|
|
398186
|
-
name:
|
|
398270
|
+
name: sanitizedName,
|
|
398187
398271
|
description: frontmatter.description,
|
|
398188
398272
|
location: filePath,
|
|
398189
398273
|
body: match2[2]?.trim() ?? ""
|
|
@@ -398343,8 +398427,8 @@ function markdownToAgentDefinition(markdown, metadata2) {
|
|
|
398343
398427
|
}
|
|
398344
398428
|
},
|
|
398345
398429
|
runConfig: {
|
|
398346
|
-
maxTurns: markdown.max_turns,
|
|
398347
|
-
maxTimeMinutes: markdown.timeout_mins
|
|
398430
|
+
maxTurns: markdown.max_turns ?? DEFAULT_MAX_TURNS,
|
|
398431
|
+
maxTimeMinutes: markdown.timeout_mins ?? DEFAULT_MAX_TIME_MINUTES
|
|
398348
398432
|
},
|
|
398349
398433
|
toolConfig: markdown.tools ? {
|
|
398350
398434
|
tools: markdown.tools
|
|
@@ -399865,18 +399949,6 @@ var A2AClientManager = class _A2AClientManager {
|
|
|
399865
399949
|
// packages/core/dist/src/agents/remote-invocation.js
|
|
399866
399950
|
init_tools();
|
|
399867
399951
|
|
|
399868
|
-
// packages/core/dist/src/agents/types.js
|
|
399869
|
-
var AgentTerminateMode;
|
|
399870
|
-
(function(AgentTerminateMode2) {
|
|
399871
|
-
AgentTerminateMode2["ERROR"] = "ERROR";
|
|
399872
|
-
AgentTerminateMode2["TIMEOUT"] = "TIMEOUT";
|
|
399873
|
-
AgentTerminateMode2["GOAL"] = "GOAL";
|
|
399874
|
-
AgentTerminateMode2["MAX_TURNS"] = "MAX_TURNS";
|
|
399875
|
-
AgentTerminateMode2["ABORTED"] = "ABORTED";
|
|
399876
|
-
AgentTerminateMode2["ERROR_NO_COMPLETE_TASK_CALL"] = "ERROR_NO_COMPLETE_TASK_CALL";
|
|
399877
|
-
})(AgentTerminateMode || (AgentTerminateMode = {}));
|
|
399878
|
-
var DEFAULT_QUERY_STRING = "Get Started!";
|
|
399879
|
-
|
|
399880
399952
|
// packages/core/dist/src/agents/a2aUtils.js
|
|
399881
399953
|
function extractMessageText(message) {
|
|
399882
399954
|
if (!message) {
|
|
@@ -401463,7 +401535,8 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
|
|
|
401463
401535
|
let turnCounter = 0;
|
|
401464
401536
|
let terminateReason = AgentTerminateMode.ERROR;
|
|
401465
401537
|
let finalResult = null;
|
|
401466
|
-
const
|
|
401538
|
+
const maxTimeMinutes = this.definition.runConfig.maxTimeMinutes ?? DEFAULT_MAX_TIME_MINUTES;
|
|
401539
|
+
const maxTurns = this.definition.runConfig.maxTurns ?? DEFAULT_MAX_TURNS;
|
|
401467
401540
|
const timeoutController = new AbortController();
|
|
401468
401541
|
const timeoutId = setTimeout(() => timeoutController.abort(new Error("Agent timed out.")), maxTimeMinutes * 60 * 1e3);
|
|
401469
401542
|
const combinedSignal = AbortSignal.any([signal, timeoutController.signal]);
|
|
@@ -401482,7 +401555,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
|
|
|
401482
401555
|
const query = this.definition.promptConfig.query ? templateString(this.definition.promptConfig.query, augmentedInputs) : DEFAULT_QUERY_STRING;
|
|
401483
401556
|
let currentMessage = { role: "user", parts: [{ text: query }] };
|
|
401484
401557
|
while (true) {
|
|
401485
|
-
const reason = this.checkTermination(
|
|
401558
|
+
const reason = this.checkTermination(turnCounter, maxTurns);
|
|
401486
401559
|
if (reason) {
|
|
401487
401560
|
terminateReason = reason;
|
|
401488
401561
|
break;
|
|
@@ -401514,13 +401587,13 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
|
|
|
401514
401587
|
finalResult = recoveryResult;
|
|
401515
401588
|
} else {
|
|
401516
401589
|
if (terminateReason === AgentTerminateMode.TIMEOUT) {
|
|
401517
|
-
finalResult = `Agent timed out after ${
|
|
401590
|
+
finalResult = `Agent timed out after ${maxTimeMinutes} minutes.`;
|
|
401518
401591
|
this.emitActivity("ERROR", {
|
|
401519
401592
|
error: finalResult,
|
|
401520
401593
|
context: "timeout"
|
|
401521
401594
|
});
|
|
401522
401595
|
} else if (terminateReason === AgentTerminateMode.MAX_TURNS) {
|
|
401523
|
-
finalResult = `Agent reached max turns limit (${
|
|
401596
|
+
finalResult = `Agent reached max turns limit (${maxTurns}).`;
|
|
401524
401597
|
this.emitActivity("ERROR", {
|
|
401525
401598
|
error: finalResult,
|
|
401526
401599
|
context: "max_turns"
|
|
@@ -401564,7 +401637,7 @@ var LocalAgentExecutor = class _LocalAgentExecutor {
|
|
|
401564
401637
|
};
|
|
401565
401638
|
}
|
|
401566
401639
|
}
|
|
401567
|
-
finalResult = `Agent timed out after ${
|
|
401640
|
+
finalResult = `Agent timed out after ${maxTimeMinutes} minutes.`;
|
|
401568
401641
|
this.emitActivity("ERROR", {
|
|
401569
401642
|
error: finalResult,
|
|
401570
401643
|
context: "timeout"
|
|
@@ -401973,9 +402046,8 @@ Important Rules:
|
|
|
401973
402046
|
*
|
|
401974
402047
|
* @returns The reason for termination, or `null` if execution can continue.
|
|
401975
402048
|
*/
|
|
401976
|
-
checkTermination(
|
|
401977
|
-
|
|
401978
|
-
if (runConfig.maxTurns && turnCounter >= runConfig.maxTurns) {
|
|
402049
|
+
checkTermination(turnCounter, maxTurns) {
|
|
402050
|
+
if (turnCounter >= maxTurns) {
|
|
401979
402051
|
return AgentTerminateMode.MAX_TURNS;
|
|
401980
402052
|
}
|
|
401981
402053
|
return null;
|
|
@@ -402167,9 +402239,6 @@ var SubAgentInvocation = class extends BaseToolInvocation {
|
|
|
402167
402239
|
return `Delegating to agent '${this.definition.name}'`;
|
|
402168
402240
|
}
|
|
402169
402241
|
async shouldConfirmExecute(abortSignal) {
|
|
402170
|
-
if (this.definition.kind !== "remote") {
|
|
402171
|
-
return false;
|
|
402172
|
-
}
|
|
402173
402242
|
const invocation = this.buildSubInvocation(this.definition, this.params);
|
|
402174
402243
|
return invocation.shouldConfirmExecute(abortSignal);
|
|
402175
402244
|
}
|
|
@@ -404494,10 +404563,12 @@ var McpClient = class {
|
|
|
404494
404563
|
}
|
|
404495
404564
|
this.updateStatus(MCPServerStatus.CONNECTING);
|
|
404496
404565
|
try {
|
|
404497
|
-
|
|
404566
|
+
const { client, transport } = await connectToMcpServer(this.clientVersion, this.serverName, this.serverConfig, this.debugMode, this.workspaceContext, this.cliConfig.sanitizationConfig);
|
|
404567
|
+
this.client = client;
|
|
404568
|
+
this.transport = transport;
|
|
404498
404569
|
this.registerNotificationHandlers();
|
|
404499
404570
|
const originalOnError = this.client.onerror;
|
|
404500
|
-
this.client.onerror = (error2) => {
|
|
404571
|
+
this.client.onerror = async (error2) => {
|
|
404501
404572
|
if (this.status !== MCPServerStatus.CONNECTED) {
|
|
404502
404573
|
return;
|
|
404503
404574
|
}
|
|
@@ -404505,6 +404576,12 @@ var McpClient = class {
|
|
|
404505
404576
|
originalOnError(error2);
|
|
404506
404577
|
coreEvents.emitFeedback("error", `MCP ERROR (${this.serverName})`, error2);
|
|
404507
404578
|
this.updateStatus(MCPServerStatus.DISCONNECTED);
|
|
404579
|
+
if (this.transport) {
|
|
404580
|
+
try {
|
|
404581
|
+
await this.transport.close();
|
|
404582
|
+
} catch {
|
|
404583
|
+
}
|
|
404584
|
+
}
|
|
404508
404585
|
};
|
|
404509
404586
|
this.updateStatus(MCPServerStatus.CONNECTED);
|
|
404510
404587
|
} catch (error2) {
|
|
@@ -405060,6 +405137,7 @@ async function connectWithSSETransport(client, config3, accessToken) {
|
|
|
405060
405137
|
await client.connect(transport, {
|
|
405061
405138
|
timeout: config3.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC
|
|
405062
405139
|
});
|
|
405140
|
+
return transport;
|
|
405063
405141
|
}
|
|
405064
405142
|
async function showAuthRequiredMessage(serverName) {
|
|
405065
405143
|
const hasRejectedToken = !!await getStoredOAuthToken(serverName);
|
|
@@ -405070,9 +405148,9 @@ async function showAuthRequiredMessage(serverName) {
|
|
|
405070
405148
|
async function retryWithOAuth(client, serverName, config3, accessToken, httpReturned404) {
|
|
405071
405149
|
if (httpReturned404) {
|
|
405072
405150
|
debugLogger.log(`Retrying SSE connection to '${serverName}' with OAuth token...`);
|
|
405073
|
-
await connectWithSSETransport(client, config3, accessToken);
|
|
405151
|
+
const transport = await connectWithSSETransport(client, config3, accessToken);
|
|
405074
405152
|
debugLogger.log(`Successfully connected to '${serverName}' using SSE with OAuth.`);
|
|
405075
|
-
return;
|
|
405153
|
+
return transport;
|
|
405076
405154
|
}
|
|
405077
405155
|
debugLogger.log(`Retrying connection to '${serverName}' with OAuth token...`);
|
|
405078
405156
|
const httpTransport = await createTransportWithOAuth(serverName, config3, accessToken);
|
|
@@ -405084,12 +405162,14 @@ async function retryWithOAuth(client, serverName, config3, accessToken, httpRetu
|
|
|
405084
405162
|
timeout: config3.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC
|
|
405085
405163
|
});
|
|
405086
405164
|
debugLogger.log(`Successfully connected to '${serverName}' using HTTP with OAuth.`);
|
|
405165
|
+
return httpTransport;
|
|
405087
405166
|
} catch (httpError) {
|
|
405088
405167
|
await httpTransport.close();
|
|
405089
405168
|
if (String(httpError).includes("404") && config3.url && !config3.type && !config3.httpUrl) {
|
|
405090
405169
|
debugLogger.log(`HTTP with OAuth returned 404, trying SSE with OAuth...`);
|
|
405091
|
-
await connectWithSSETransport(client, config3, accessToken);
|
|
405170
|
+
const sseTransport = await connectWithSSETransport(client, config3, accessToken);
|
|
405092
405171
|
debugLogger.log(`Successfully connected to '${serverName}' using SSE with OAuth.`);
|
|
405172
|
+
return sseTransport;
|
|
405093
405173
|
} else {
|
|
405094
405174
|
throw httpError;
|
|
405095
405175
|
}
|
|
@@ -405145,7 +405225,7 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
405145
405225
|
await mcpClient.connect(transport, {
|
|
405146
405226
|
timeout: mcpServerConfig.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC
|
|
405147
405227
|
});
|
|
405148
|
-
return mcpClient;
|
|
405228
|
+
return { client: mcpClient, transport };
|
|
405149
405229
|
} catch (error2) {
|
|
405150
405230
|
await transport.close();
|
|
405151
405231
|
firstAttemptError = error2;
|
|
@@ -405162,9 +405242,9 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
405162
405242
|
const logMessage = httpReturned404 ? `HTTP returned 404, trying SSE transport...` : `HTTP connection failed, attempting SSE fallback...`;
|
|
405163
405243
|
debugLogger.log(`MCP server '${mcpServerName}': ${logMessage}`);
|
|
405164
405244
|
try {
|
|
405165
|
-
await connectWithSSETransport(mcpClient, mcpServerConfig, await getStoredOAuthToken(mcpServerName));
|
|
405245
|
+
const sseTransport = await connectWithSSETransport(mcpClient, mcpServerConfig, await getStoredOAuthToken(mcpServerName));
|
|
405166
405246
|
debugLogger.log(`MCP server '${mcpServerName}': Successfully connected using SSE transport.`);
|
|
405167
|
-
return mcpClient;
|
|
405247
|
+
return { client: mcpClient, transport: sseTransport };
|
|
405168
405248
|
} catch (sseFallbackError) {
|
|
405169
405249
|
sseError = sseFallbackError;
|
|
405170
405250
|
if (isAuthenticationError(sseError)) {
|
|
@@ -405225,8 +405305,8 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
405225
405305
|
if (!accessToken) {
|
|
405226
405306
|
throw new Error(`Failed to get OAuth token for server '${mcpServerName}'`);
|
|
405227
405307
|
}
|
|
405228
|
-
await retryWithOAuth(mcpClient, mcpServerName, mcpServerConfig, accessToken, httpReturned404);
|
|
405229
|
-
return mcpClient;
|
|
405308
|
+
const oauthTransport = await retryWithOAuth(mcpClient, mcpServerName, mcpServerConfig, accessToken, httpReturned404);
|
|
405309
|
+
return { client: mcpClient, transport: oauthTransport };
|
|
405230
405310
|
} else {
|
|
405231
405311
|
throw new Error(`Failed to handle automatic OAuth for server '${mcpServerName}'`);
|
|
405232
405312
|
}
|
|
@@ -405263,7 +405343,7 @@ async function connectToMcpServer(clientVersion, mcpServerName, mcpServerConfig,
|
|
|
405263
405343
|
await mcpClient.connect(oauthTransport, {
|
|
405264
405344
|
timeout: mcpServerConfig.timeout ?? MCP_DEFAULT_TIMEOUT_MSEC
|
|
405265
405345
|
});
|
|
405266
|
-
return mcpClient;
|
|
405346
|
+
return { client: mcpClient, transport: oauthTransport };
|
|
405267
405347
|
} else {
|
|
405268
405348
|
throw new Error(`OAuth configuration failed for '${mcpServerName}'. Please authenticate manually with /mcp auth ${mcpServerName}`);
|
|
405269
405349
|
}
|
|
@@ -405837,9 +405917,11 @@ var Config = class {
|
|
|
405837
405917
|
remoteAdminSettings;
|
|
405838
405918
|
latestApiRequest;
|
|
405839
405919
|
lastModeSwitchTime = Date.now();
|
|
405920
|
+
approvedPlanPath;
|
|
405840
405921
|
constructor(params) {
|
|
405841
405922
|
this.sessionId = params.sessionId;
|
|
405842
405923
|
this.clientVersion = params.clientVersion ?? "unknown";
|
|
405924
|
+
this.approvedPlanPath = void 0;
|
|
405843
405925
|
this.embeddingModel = params.embeddingModel ?? DEFAULT_GEMINI_EMBEDDING_MODEL;
|
|
405844
405926
|
this.fileSystemService = new StandardFileSystemService();
|
|
405845
405927
|
this.sandbox = params.sandbox;
|
|
@@ -406128,7 +406210,7 @@ var Config = class {
|
|
|
406128
406210
|
return this.contentGenerator?.userTier;
|
|
406129
406211
|
}
|
|
406130
406212
|
getUserTierName() {
|
|
406131
|
-
return
|
|
406213
|
+
return this.contentGenerator?.userTierName;
|
|
406132
406214
|
}
|
|
406133
406215
|
/**
|
|
406134
406216
|
* Provides access to the BaseLlmClient for stateless LLM operations.
|
|
@@ -406626,6 +406708,12 @@ var Config = class {
|
|
|
406626
406708
|
isPlanEnabled() {
|
|
406627
406709
|
return this.planEnabled;
|
|
406628
406710
|
}
|
|
406711
|
+
getApprovedPlanPath() {
|
|
406712
|
+
return this.approvedPlanPath;
|
|
406713
|
+
}
|
|
406714
|
+
setApprovedPlanPath(path82) {
|
|
406715
|
+
this.approvedPlanPath = path82;
|
|
406716
|
+
}
|
|
406629
406717
|
isAgentsEnabled() {
|
|
406630
406718
|
return this.enableAgents;
|
|
406631
406719
|
}
|
|
@@ -406681,6 +406769,9 @@ var Config = class {
|
|
|
406681
406769
|
* @returns true if the path is allowed, false otherwise.
|
|
406682
406770
|
*/
|
|
406683
406771
|
isPathAllowed(absolutePath) {
|
|
406772
|
+
if (this.interactive && path72.isAbsolute(absolutePath)) {
|
|
406773
|
+
return true;
|
|
406774
|
+
}
|
|
406684
406775
|
const realpath3 = (p) => {
|
|
406685
406776
|
let resolved;
|
|
406686
406777
|
try {
|
|
@@ -406946,6 +407037,7 @@ var Config = class {
|
|
|
406946
407037
|
}
|
|
406947
407038
|
if (this.isPlanEnabled()) {
|
|
406948
407039
|
registerCoreTool(ExitPlanModeTool, this);
|
|
407040
|
+
registerCoreTool(EnterPlanModeTool, this);
|
|
406949
407041
|
}
|
|
406950
407042
|
this.registerSubAgentTools(registry2);
|
|
406951
407043
|
await registry2.discoverAllTools();
|