@google/gemini-cli-a2a-server 0.22.0 → 0.22.2

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.
@@ -311904,8 +311904,8 @@ var Float64Vector = import_vector.default.Float64Vector;
311904
311904
  var PointerVector = import_vector.default.PointerVector;
311905
311905
 
311906
311906
  // packages/core/dist/src/generated/git-commit.js
311907
- var GIT_COMMIT_INFO = "f9331b160";
311908
- var CLI_VERSION = "0.22.0";
311907
+ var GIT_COMMIT_INFO = "9bc9a3192";
311908
+ var CLI_VERSION = "0.22.2";
311909
311909
 
311910
311910
  // packages/core/dist/src/ide/detect-ide.js
311911
311911
  var IDE_DEFINITIONS = {
@@ -314076,7 +314076,7 @@ var StartupProfiler = class _StartupProfiler {
314076
314076
  * Flushes buffered metrics to the telemetry system.
314077
314077
  */
314078
314078
  flush(config3) {
314079
- debugLogger.log("[STARTUP] StartupProfiler.flush() called with", this.phases.size, "phases");
314079
+ debugLogger.debug("[STARTUP] StartupProfiler.flush() called with", this.phases.size, "phases");
314080
314080
  const commonDetails = {
314081
314081
  os_platform: os6.platform(),
314082
314082
  os_arch: os6.arch(),
@@ -314097,13 +314097,13 @@ var StartupProfiler = class _StartupProfiler {
314097
314097
  cpu_usage_system: phase.cpuUsage.system,
314098
314098
  ...phase.details
314099
314099
  };
314100
- debugLogger.log("[STARTUP] Recording metric for phase:", phase.name, "duration:", measure.duration);
314100
+ debugLogger.debug("[STARTUP] Recording metric for phase:", phase.name, "duration:", measure.duration);
314101
314101
  recordStartupPerformance(config3, measure.duration, {
314102
314102
  phase: phase.name,
314103
314103
  details
314104
314104
  });
314105
314105
  } else {
314106
- debugLogger.log("[STARTUP] Skipping phase without measure:", phase.name);
314106
+ debugLogger.debug("[STARTUP] Skipping phase without measure:", phase.name);
314107
314107
  }
314108
314108
  }
314109
314109
  const startupPhases = [];
@@ -352148,8 +352148,9 @@ var EditToolInvocation = class extends BaseToolInvocation {
352148
352148
  onConfirm: async (outcome) => {
352149
352149
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
352150
352150
  this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
352151
+ } else {
352152
+ await this.publishPolicyUpdate(outcome);
352151
352153
  }
352152
- await this.publishPolicyUpdate(outcome);
352153
352154
  if (ideConfirmation) {
352154
352155
  const result = await ideConfirmation;
352155
352156
  if (result.status === "accepted" && result.content) {
@@ -354377,8 +354378,9 @@ var EditToolInvocation2 = class extends BaseToolInvocation {
354377
354378
  onConfirm: async (outcome) => {
354378
354379
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
354379
354380
  this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
354381
+ } else {
354382
+ await this.publishPolicyUpdate(outcome);
354380
354383
  }
354381
- await this.publishPolicyUpdate(outcome);
354382
354384
  if (ideConfirmation) {
354383
354385
  const result = await ideConfirmation;
354384
354386
  if (result.status === "accepted" && result.content) {
@@ -360734,8 +360736,9 @@ var WriteFileToolInvocation = class extends BaseToolInvocation {
360734
360736
  onConfirm: async (outcome) => {
360735
360737
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
360736
360738
  this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
360739
+ } else {
360740
+ await this.publishPolicyUpdate(outcome);
360737
360741
  }
360738
- await this.publishPolicyUpdate(outcome);
360739
360742
  if (ideConfirmation) {
360740
360743
  const result = await ideConfirmation;
360741
360744
  if (result.status === "accepted" && result.content) {
@@ -366003,8 +366006,9 @@ ${textContent2}
366003
366006
  onConfirm: async (outcome) => {
366004
366007
  if (outcome === ToolConfirmationOutcome.ProceedAlways) {
366005
366008
  this.config.setApprovalMode(ApprovalMode.AUTO_EDIT);
366009
+ } else {
366010
+ await this.publishPolicyUpdate(outcome);
366006
366011
  }
366007
- await this.publishPolicyUpdate(outcome);
366008
366012
  }
366009
366013
  };
366010
366014
  return confirmationDetails;
@@ -379554,7 +379558,12 @@ var SafetyCheckDecision;
379554
379558
  })(SafetyCheckDecision || (SafetyCheckDecision = {}));
379555
379559
 
379556
379560
  // packages/core/dist/src/policy/policy-engine.js
379557
- function ruleMatches(rule, toolCall, stringifiedArgs, serverName) {
379561
+ function ruleMatches(rule, toolCall, stringifiedArgs, serverName, currentApprovalMode) {
379562
+ if (rule.modes && rule.modes.length > 0) {
379563
+ if (!rule.modes.includes(currentApprovalMode)) {
379564
+ return false;
379565
+ }
379566
+ }
379558
379567
  if (rule.toolName) {
379559
379568
  if (rule.toolName.endsWith("__*")) {
379560
379569
  const prefix = rule.toolName.slice(0, -3);
@@ -379597,6 +379606,7 @@ var PolicyEngine = class {
379597
379606
  nonInteractive;
379598
379607
  checkerRunner;
379599
379608
  allowHooks;
379609
+ approvalMode;
379600
379610
  constructor(config3 = {}, checkerRunner) {
379601
379611
  this.rules = (config3.rules ?? []).sort((a2, b) => (b.priority ?? 0) - (a2.priority ?? 0));
379602
379612
  this.checkers = (config3.checkers ?? []).sort((a2, b) => (b.priority ?? 0) - (a2.priority ?? 0));
@@ -379605,6 +379615,19 @@ var PolicyEngine = class {
379605
379615
  this.nonInteractive = config3.nonInteractive ?? false;
379606
379616
  this.checkerRunner = checkerRunner;
379607
379617
  this.allowHooks = config3.allowHooks ?? true;
379618
+ this.approvalMode = config3.approvalMode ?? ApprovalMode.DEFAULT;
379619
+ }
379620
+ /**
379621
+ * Update the current approval mode.
379622
+ */
379623
+ setApprovalMode(mode) {
379624
+ this.approvalMode = mode;
379625
+ }
379626
+ /**
379627
+ * Get the current approval mode.
379628
+ */
379629
+ getApprovalMode() {
379630
+ return this.approvalMode;
379608
379631
  }
379609
379632
  /**
379610
379633
  * Check if a tool call is allowed based on the configured policies.
@@ -379619,7 +379642,7 @@ var PolicyEngine = class {
379619
379642
  let matchedRule;
379620
379643
  let decision;
379621
379644
  for (const rule of this.rules) {
379622
- if (ruleMatches(rule, toolCall, stringifiedArgs, serverName)) {
379645
+ if (ruleMatches(rule, toolCall, stringifiedArgs, serverName, this.approvalMode)) {
379623
379646
  debugLogger.debug(`[PolicyEngine.check] MATCHED rule: toolName=${rule.toolName}, decision=${rule.decision}, priority=${rule.priority}, argsPattern=${rule.argsPattern?.source || "none"}`);
379624
379647
  if (toolCall.name && SHELL_TOOL_NAMES.includes(toolCall.name) && rule.decision === PolicyDecision.ALLOW) {
379625
379648
  const command = toolCall.args?.command;
@@ -379665,7 +379688,7 @@ var PolicyEngine = class {
379665
379688
  }
379666
379689
  if (decision !== PolicyDecision.DENY && this.checkerRunner) {
379667
379690
  for (const checkerRule of this.checkers) {
379668
- if (ruleMatches(checkerRule, toolCall, stringifiedArgs, serverName)) {
379691
+ if (ruleMatches(checkerRule, toolCall, stringifiedArgs, serverName, this.approvalMode)) {
379669
379692
  debugLogger.debug(`[PolicyEngine.check] Running safety checker: ${checkerRule.checker.name}`);
379670
379693
  try {
379671
379694
  const result = await this.checkerRunner.runChecker(toolCall, checkerRule.checker);
@@ -382255,7 +382278,7 @@ var __filename = fileURLToPath10(import.meta.url);
382255
382278
  var __dirname5 = path60.dirname(__filename);
382256
382279
  async function getVersion() {
382257
382280
  const pkgJson = await getPackageJson(__dirname5);
382258
- return "0.22.0";
382281
+ return "0.22.2";
382259
382282
  }
382260
382283
 
382261
382284
  // packages/core/dist/src/code_assist/experiments/client_metadata.js
@@ -385338,7 +385361,6 @@ var Config = class {
385338
385361
  userMemory;
385339
385362
  geminiMdFileCount;
385340
385363
  geminiMdFilePaths;
385341
- approvalMode;
385342
385364
  showMemoryUsage;
385343
385365
  accessibility;
385344
385366
  telemetrySettings;
@@ -385443,7 +385465,6 @@ var Config = class {
385443
385465
  this.userMemory = params.userMemory ?? "";
385444
385466
  this.geminiMdFileCount = params.geminiMdFileCount ?? 0;
385445
385467
  this.geminiMdFilePaths = params.geminiMdFilePaths ?? [];
385446
- this.approvalMode = params.approvalMode ?? ApprovalMode.DEFAULT;
385447
385468
  this.showMemoryUsage = params.showMemoryUsage ?? false;
385448
385469
  this.accessibility = params.accessibility ?? {};
385449
385470
  this.telemetrySettings = {
@@ -385530,7 +385551,10 @@ var Config = class {
385530
385551
  this.enablePromptCompletion = params.enablePromptCompletion ?? false;
385531
385552
  this.fileExclusions = new FileExclusions(this);
385532
385553
  this.eventEmitter = params.eventEmitter;
385533
- this.policyEngine = new PolicyEngine(params.policyEngineConfig);
385554
+ this.policyEngine = new PolicyEngine({
385555
+ ...params.policyEngineConfig,
385556
+ approvalMode: params.approvalMode ?? params.policyEngineConfig?.approvalMode
385557
+ });
385534
385558
  this.messageBus = new MessageBus(this.policyEngine, this.debugMode);
385535
385559
  this.outputSettings = {
385536
385560
  format: params.output?.format ?? OutputFormat.TEXT
@@ -385909,13 +385933,13 @@ var Config = class {
385909
385933
  this.geminiMdFilePaths = paths;
385910
385934
  }
385911
385935
  getApprovalMode() {
385912
- return this.approvalMode;
385936
+ return this.policyEngine.getApprovalMode();
385913
385937
  }
385914
385938
  setApprovalMode(mode) {
385915
385939
  if (!this.isTrustedFolder() && mode !== ApprovalMode.DEFAULT) {
385916
385940
  throw new Error("Cannot enable privileged approval modes in an untrusted folder.");
385917
385941
  }
385918
- this.approvalMode = mode;
385942
+ this.policyEngine.setApprovalMode(mode);
385919
385943
  }
385920
385944
  isYoloModeDisabled() {
385921
385945
  return this.disableYoloMode || !this.isTrustedFolder();
@@ -386379,7 +386403,7 @@ var PolicyRuleSchema = external_exports.object({
386379
386403
  }).int({ message: "priority must be an integer" }).min(0, { message: "priority must be >= 0" }).max(999, {
386380
386404
  message: "priority must be <= 999 to prevent tier overflow. Priorities >= 1000 would jump to the next tier."
386381
386405
  }),
386382
- modes: external_exports.array(external_exports.string()).optional()
386406
+ modes: external_exports.array(external_exports.nativeEnum(ApprovalMode)).optional()
386383
386407
  });
386384
386408
  var SafetyCheckerRuleSchema = external_exports.object({
386385
386409
  toolName: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
@@ -386388,7 +386412,7 @@ var SafetyCheckerRuleSchema = external_exports.object({
386388
386412
  commandPrefix: external_exports.union([external_exports.string(), external_exports.array(external_exports.string())]).optional(),
386389
386413
  commandRegex: external_exports.string().optional(),
386390
386414
  priority: external_exports.number().int().default(0),
386391
- modes: external_exports.array(external_exports.string()).optional(),
386415
+ modes: external_exports.array(external_exports.nativeEnum(ApprovalMode)).optional(),
386392
386416
  checker: external_exports.discriminatedUnion("type", [
386393
386417
  external_exports.object({
386394
386418
  type: external_exports.literal("in-process"),