@google/gemini-cli 0.42.0 → 0.43.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/bundle/{chunk-3IS7GD6D.js → chunk-3BNJIKEP.js} +3 -3
  2. package/bundle/{chunk-EDKX67D6.js → chunk-4G3X2H3F.js} +34 -16
  3. package/bundle/{chunk-FCAODPNO.js → chunk-4SLX6GS6.js} +486 -381
  4. package/bundle/{chunk-COKAF5GM.js → chunk-4ZT3EIBI.js} +2 -2
  5. package/bundle/{chunk-NTOPH4WG.js → chunk-6YMGRLOQ.js} +2 -2
  6. package/bundle/{chunk-QOZSZYL7.js → chunk-CKPZGEE3.js} +3 -3
  7. package/bundle/{chunk-G2VTSEZ6.js → chunk-CZPVSLJF.js} +1 -1
  8. package/bundle/{chunk-PUDLNWHE.js → chunk-DJCG6GWZ.js} +3 -3
  9. package/bundle/{chunk-I7AME6VC.js → chunk-ERQUIEOO.js} +9 -8
  10. package/bundle/{chunk-XUMRUXOT.js → chunk-EWAAFVBK.js} +41 -20
  11. package/bundle/{chunk-LATVEETM.js → chunk-F7PEGIBA.js} +2 -2
  12. package/bundle/{chunk-KVEAHIIV.js → chunk-ICOPZSVB.js} +3 -3
  13. package/bundle/{chunk-BCYBA52D.js → chunk-IF5BAOVJ.js} +34 -16
  14. package/bundle/chunk-KILFUY3Y.js +512 -0
  15. package/bundle/{chunk-CYEIWMZJ.js → chunk-L4LBKMR6.js} +1 -1
  16. package/bundle/{chunk-4SLGT6YD.js → chunk-LTFEPQ67.js} +1 -1
  17. package/bundle/{chunk-7C6GGDK6.js → chunk-LTSFEC7U.js} +3 -3
  18. package/bundle/{chunk-7VVHSNDQ.js → chunk-MRVZNBXY.js} +1907 -716
  19. package/bundle/{chunk-COQP2M4D.js → chunk-N3MLU4IQ.js} +546 -428
  20. package/bundle/{chunk-ECNYAST2.js → chunk-N6QYTC2T.js} +5417 -5376
  21. package/bundle/{chunk-DN4XSYRG.js → chunk-NDSJWRFE.js} +8640 -13347
  22. package/bundle/{chunk-DMWX7UP6.js → chunk-NG2WIKH5.js} +2170 -791
  23. package/bundle/chunk-PLEERNRJ.js +156 -0
  24. package/bundle/{chunk-ZNMQA242.js → chunk-QAQT56LH.js} +3 -3
  25. package/bundle/{chunk-WIXUKOZA.js → chunk-S36EONMM.js} +1 -1
  26. package/bundle/chunk-UB4AWMZC.js +391 -0
  27. package/bundle/{chunk-CHERUG6W.js → chunk-UBCHSKF2.js} +486 -381
  28. package/bundle/{chunk-JEW7ZIWE.js → chunk-UJ26GAE5.js} +5326 -5290
  29. package/bundle/chunk-ULCEBJMK.js +17248 -0
  30. package/bundle/chunk-UUHMEKLA.js +357199 -0
  31. package/bundle/chunk-UW3H4T6A.js +1571 -0
  32. package/bundle/{chunk-GA527JB7.js → chunk-VSTO23O2.js} +1 -1
  33. package/bundle/chunk-XKIM3BNI.js +118 -0
  34. package/bundle/chunk-YIHNW7CC.js +81649 -0
  35. package/bundle/{cleanup-3RILFNVM.js → cleanup-BMLCC7SO.js} +3 -3
  36. package/bundle/{cleanup-SVRKYBR6.js → cleanup-LMJA4J5S.js} +3 -3
  37. package/bundle/{cleanup-XFVHHDVO.js → cleanup-M7RSLDBR.js} +3 -3
  38. package/bundle/cleanup-NMUMRIEF.js +33 -0
  39. package/bundle/{core-FRVSDP2C.js → core-WXTAU5UX.js} +30 -2
  40. package/bundle/{devtoolsService-RUEO5PGP.js → devtoolsService-2L5U47ZQ.js} +3 -3
  41. package/bundle/{devtoolsService-VM2WTHBX.js → devtoolsService-6THA6GNX.js} +3 -3
  42. package/bundle/{devtoolsService-TRDGMQLJ.js → devtoolsService-J2AC6YXM.js} +5 -4
  43. package/bundle/devtoolsService-SRWIME2Q.js +857 -0
  44. package/bundle/{dist-6BN2CJPN.js → dist-DIIMIT2U.js} +30 -2
  45. package/bundle/{core-B5S6HZJT.js → dist-MXL7ZG46.js} +30 -2
  46. package/bundle/dist-POIHCQVM.js +2124 -0
  47. package/bundle/docs/changelogs/index.md +14 -0
  48. package/bundle/docs/changelogs/latest.md +108 -166
  49. package/bundle/docs/changelogs/preview.md +227 -103
  50. package/bundle/docs/cli/auto-memory.md +60 -38
  51. package/bundle/docs/cli/settings.md +1 -1
  52. package/bundle/docs/cli/tutorials/memory-management.md +1 -1
  53. package/bundle/docs/extensions/releasing.md +58 -24
  54. package/bundle/docs/reference/configuration.md +14 -1
  55. package/bundle/docs/reference/keyboard-shortcuts.md +23 -0
  56. package/bundle/{gemini-GHUELHBF.js → gemini-D32FDZXN.js} +160 -60
  57. package/bundle/{gemini-QSTQ2DBG.js → gemini-DLZ2R4X7.js} +160 -60
  58. package/bundle/{gemini-NQPVX5JC.js → gemini-HYQU2RK2.js} +345 -231
  59. package/bundle/gemini-JJG7ZGWB.js +16356 -0
  60. package/bundle/gemini.js +8 -8
  61. package/bundle/{interactiveCli-AG2YWL2O.js → interactiveCli-DHMPW4RS.js} +1704 -1457
  62. package/bundle/{interactiveCli-MZFG35NB.js → interactiveCli-K7ETWJMN.js} +1986 -1721
  63. package/bundle/{interactiveCli-453M2IVE.js → interactiveCli-NR7OUF3G.js} +1703 -1457
  64. package/bundle/interactiveCli-X4AUP7T7.js +34752 -0
  65. package/bundle/{liteRtServerManager-G4Q7OVBX.js → liteRtServerManager-L7C3D5RL.js} +5 -5
  66. package/bundle/{liteRtServerManager-S7WL25VD.js → liteRtServerManager-PKRLUK2P.js} +5 -5
  67. package/bundle/{liteRtServerManager-BXQ6VVWP.js → liteRtServerManager-TEBDIGEN.js} +5 -5
  68. package/bundle/liteRtServerManager-UPCAT7Z2.js +66 -0
  69. package/bundle/{memoryDiscovery-KSYZVCWF.js → memoryDiscovery-LLSKN6HL.js} +1 -1
  70. package/bundle/{memoryDiscovery-FB7MMKTA.js → memoryDiscovery-SJ7P6RCN.js} +1 -1
  71. package/bundle/node_modules/@google/gemini-cli-devtools/package.json +1 -1
  72. package/bundle/{oauth2-provider-H7G6RSFW.js → oauth2-provider-52IJKUJI.js} +2 -2
  73. package/bundle/{oauth2-provider-VR4DL6AL.js → oauth2-provider-OPOTTZ5C.js} +2 -2
  74. package/bundle/{oauth2-provider-5UF5WEE2.js → oauth2-provider-TOAKXOL7.js} +39 -73
  75. package/bundle/oauth2-provider-WN4YIDA4.js +237 -0
  76. package/bundle/{start-CQBSKFYB.js → start-6KIIUSAH.js} +7 -7
  77. package/bundle/{start-NIMXQJYB.js → start-7ZNSGJD6.js} +7 -7
  78. package/bundle/{start-2SKRN43X.js → start-EPIILWLN.js} +7 -7
  79. package/bundle/start-TMFPUYEL.js +19 -0
  80. package/package.json +1 -1
@@ -41,18 +41,18 @@ import {
41
41
  updateAllUpdatableExtensions,
42
42
  updateExtension,
43
43
  validateAuthMethod
44
- } from "./chunk-FCAODPNO.js";
44
+ } from "./chunk-4SLX6GS6.js";
45
45
  import {
46
46
  appEvents
47
47
  } from "./chunk-5PS3AYFU.js";
48
48
  import {
49
49
  startCommand,
50
50
  startServer
51
- } from "./chunk-PUDLNWHE.js";
51
+ } from "./chunk-XKIM3BNI.js";
52
52
  import {
53
53
  exitCli,
54
54
  require_source
55
- } from "./chunk-4SLGT6YD.js";
55
+ } from "./chunk-S36EONMM.js";
56
56
  import {
57
57
  DEFAULT_PORT,
58
58
  GEMMA_MODEL_NAME,
@@ -86,11 +86,11 @@ import {
86
86
  readServerProcessInfo,
87
87
  resolveGemmaConfig,
88
88
  saveModelChange
89
- } from "./chunk-EDKX67D6.js";
89
+ } from "./chunk-4G3X2H3F.js";
90
90
  import {
91
91
  RELAUNCH_EXIT_CODE
92
- } from "./chunk-QOZSZYL7.js";
93
- import "./chunk-G2VTSEZ6.js";
92
+ } from "./chunk-3BNJIKEP.js";
93
+ import "./chunk-KILFUY3Y.js";
94
94
  import {
95
95
  cleanupCheckpoints,
96
96
  registerCleanup,
@@ -99,7 +99,7 @@ import {
99
99
  runExitCleanup,
100
100
  runSyncCleanup,
101
101
  setupSignalHandlers
102
- } from "./chunk-COKAF5GM.js";
102
+ } from "./chunk-F7PEGIBA.js";
103
103
  import {
104
104
  AuthType,
105
105
  ChatRecordingService,
@@ -176,6 +176,7 @@ import {
176
176
  listInboxPatches,
177
177
  listInboxSkills,
178
178
  listMemoryFiles,
179
+ loadConversationRecord,
179
180
  logToolCall,
180
181
  logUserPrompt,
181
182
  parseAndFormatApiError,
@@ -199,7 +200,7 @@ import {
199
200
  updatePolicy,
200
201
  writeToStderr,
201
202
  writeToStdout
202
- } from "./chunk-7VVHSNDQ.js";
203
+ } from "./chunk-MRVZNBXY.js";
203
204
  import {
204
205
  ASK_USER_TOOL_NAME,
205
206
  ApprovalMode,
@@ -241,13 +242,14 @@ import {
241
242
  getDisplayString,
242
243
  getErrorMessage,
243
244
  getErrorType,
245
+ getProjectHash,
244
246
  homedir,
245
247
  isFatalToolError,
246
248
  isNodeError,
247
249
  loadServerHierarchicalMemory,
248
250
  resolveToRealPath,
249
251
  setGeminiMdFilename
250
- } from "./chunk-JEW7ZIWE.js";
252
+ } from "./chunk-UJ26GAE5.js";
251
253
  import "./chunk-664ZODQF.js";
252
254
  import "./chunk-RJTRUG2J.js";
253
255
  import "./chunk-IUUIT4SU.js";
@@ -1532,11 +1534,11 @@ var parser = new YargsParser({
1532
1534
  resolve: resolve2,
1533
1535
  // TODO: figure out a way to combine ESM and CJS coverage, such that
1534
1536
  // we can exercise all the lines below:
1535
- require: (path15) => {
1537
+ require: (path16) => {
1536
1538
  if (typeof __require !== "undefined") {
1537
- return __require(path15);
1538
- } else if (path15.match(/\.json$/)) {
1539
- return JSON.parse(readFileSync(path15, "utf8"));
1539
+ return __require(path16);
1540
+ } else if (path16.match(/\.json$/)) {
1541
+ return JSON.parse(readFileSync(path16, "utf8"));
1540
1542
  } else {
1541
1543
  throw Error("only .json config files are supported in ESM");
1542
1544
  }
@@ -5447,12 +5449,16 @@ async function getServerStatus(serverName, server, isTrusted, activeSettings) {
5447
5449
  }
5448
5450
  return MCPServerStatus.DISABLED;
5449
5451
  }
5452
+ if (!isTrusted) {
5453
+ return MCPServerStatus.DISABLED;
5454
+ }
5450
5455
  return testMCPConnection(serverName, server, isTrusted, activeSettings);
5451
5456
  }
5452
5457
  async function listMcpServers(loadedSettingsArg) {
5453
5458
  const loadedSettings = loadedSettingsArg ?? loadSettings();
5454
5459
  const activeSettings = loadedSettings.merged;
5455
- const { mcpServers, blockedServerNames } = await getMcpServersFromConfig(activeSettings);
5460
+ const allSettings = !loadedSettings.isTrusted ? loadedSettings.getMergedSettingsAsIfTrusted() : activeSettings;
5461
+ const { mcpServers, blockedServerNames } = await getMcpServersFromConfig(allSettings);
5456
5462
  const serverNames = Object.keys(mcpServers);
5457
5463
  if (blockedServerNames.length > 0) {
5458
5464
  const message = getAdminBlockedMcpServersMessage(
@@ -5467,6 +5473,13 @@ async function listMcpServers(loadedSettingsArg) {
5467
5473
  }
5468
5474
  return;
5469
5475
  }
5476
+ if (!loadedSettings.isTrusted) {
5477
+ debugLogger.log(
5478
+ import_chalk.default.yellow(
5479
+ "Warning: MCP servers are configured but disabled because this folder is untrusted.\nUser-level servers are also suppressed in untrusted folders to prevent accidental side-effects.\n"
5480
+ )
5481
+ );
5482
+ }
5470
5483
  debugLogger.log("Configured MCP servers:\n");
5471
5484
  for (const serverName of serverNames) {
5472
5485
  const server = mcpServers[serverName];
@@ -6306,27 +6319,27 @@ import { fileURLToPath as fileURLToPath2 } from "node:url";
6306
6319
  var __filename = fileURLToPath2(import.meta.url);
6307
6320
  var __dirname2 = dirname3(__filename);
6308
6321
  var EXAMPLES_PATH = join(__dirname2, "examples");
6309
- async function pathExists(path15) {
6322
+ async function pathExists(path16) {
6310
6323
  try {
6311
- await access(path15);
6324
+ await access(path16);
6312
6325
  return true;
6313
6326
  } catch {
6314
6327
  return false;
6315
6328
  }
6316
6329
  }
6317
- async function createDirectory(path15) {
6318
- if (await pathExists(path15)) {
6319
- throw new Error(`Path already exists: ${path15}`);
6330
+ async function createDirectory(path16) {
6331
+ if (await pathExists(path16)) {
6332
+ throw new Error(`Path already exists: ${path16}`);
6320
6333
  }
6321
- await mkdir(path15, { recursive: true });
6334
+ await mkdir(path16, { recursive: true });
6322
6335
  }
6323
- async function copyDirectory(template, path15) {
6324
- await createDirectory(path15);
6336
+ async function copyDirectory(template, path16) {
6337
+ await createDirectory(path16);
6325
6338
  const examplePath = join(EXAMPLES_PATH, template);
6326
6339
  const entries = await readdir(examplePath, { withFileTypes: true });
6327
6340
  for (const entry of entries) {
6328
6341
  const srcPath = join(examplePath, entry.name);
6329
- const destPath = join(path15, entry.name);
6342
+ const destPath = join(path16, entry.name);
6330
6343
  await cp(srcPath, destPath, { recursive: true });
6331
6344
  }
6332
6345
  }
@@ -6601,7 +6614,7 @@ async function handleEnable3(args) {
6601
6614
  const result = enableSkill(settings, name);
6602
6615
  const feedback = renderSkillActionFeedback(
6603
6616
  result,
6604
- (label, path15) => `${import_chalk5.default.bold(label)} (${import_chalk5.default.dim(path15)})`
6617
+ (label, path16) => `${import_chalk5.default.bold(label)} (${import_chalk5.default.dim(path16)})`
6605
6618
  );
6606
6619
  debugLogger.log(feedback);
6607
6620
  }
@@ -6631,7 +6644,7 @@ async function handleDisable3(args) {
6631
6644
  const result = disableSkill(settings, name, scope);
6632
6645
  const feedback = renderSkillActionFeedback(
6633
6646
  result,
6634
- (label, path15) => `${import_chalk6.default.bold(label)} (${import_chalk6.default.dim(path15)})`
6647
+ (label, path16) => `${import_chalk6.default.bold(label)} (${import_chalk6.default.dim(path16)})`
6635
6648
  );
6636
6649
  debugLogger.log(feedback);
6637
6650
  }
@@ -7826,7 +7839,7 @@ async function loadSandboxConfig(settings, argv) {
7826
7839
  }
7827
7840
  const command2 = getSandboxCommand(sandboxValue);
7828
7841
  const packageJson = await getPackageJson(__dirname3);
7829
- const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.42.0" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7842
+ const image = process.env["GEMINI_SANDBOX_IMAGE"] ?? "us-docker.pkg.dev/gemini-code-dev/gemini-cli/sandbox:0.43.0-preview.1" ?? customImage ?? packageJson?.config?.sandboxImageUri;
7830
7843
  const isNative = command2 === "windows-native" || command2 === "sandbox-exec" || command2 === "lxc";
7831
7844
  return command2 && (image || isNative) ? { enabled: true, allowedPaths, networkAccess, command: command2, image } : void 0;
7832
7845
  }
@@ -7994,8 +8007,13 @@ async function parseArguments(settings) {
7994
8007
  const queryArg2 = argv["query"];
7995
8008
  const query = typeof queryArg2 === "string" || Array.isArray(queryArg2) ? queryArg2 : void 0;
7996
8009
  const hasPositionalQuery = Array.isArray(query) ? query.length > 0 : !!query;
7997
- if (argv["resume"] !== void 0 && argv["session-id"] !== void 0) {
7998
- return "Cannot use both --resume (-r) and --session-id together";
8010
+ const sessionFlags = [
8011
+ argv["resume"] !== void 0,
8012
+ argv["session-id"] !== void 0,
8013
+ argv["session-file"] !== void 0
8014
+ ].filter(Boolean).length;
8015
+ if (sessionFlags > 1) {
8016
+ return "The flags --resume, --session-id, and --session-file are mutually exclusive. Please provide only one.";
7999
8017
  }
8000
8018
  if (argv["prompt"] && hasPositionalQuery) {
8001
8019
  return "Cannot use both a positional prompt and the --prompt (-p) flag together";
@@ -8126,6 +8144,10 @@ async function parseArguments(settings) {
8126
8144
  }
8127
8145
  return trimmed;
8128
8146
  }
8147
+ }).option("session-file", {
8148
+ type: "string",
8149
+ nargs: 1,
8150
+ description: "Load a session from a JSON file"
8129
8151
  }).option("session-id", {
8130
8152
  type: "string",
8131
8153
  nargs: 1,
@@ -8610,7 +8632,11 @@ async function loadCliConfig(settings, sessionId, argv, options = {}) {
8610
8632
  shellBackgroundCompletionBehavior: settings.tools?.shell?.backgroundCompletionBehavior,
8611
8633
  shellToolInactivityTimeout: settings.tools?.shell?.inactivityTimeout,
8612
8634
  enableShellOutputEfficiency: settings.tools?.shell?.enableShellOutputEfficiency ?? true,
8613
- skipNextSpeakerCheck: settings.model?.skipNextSpeakerCheck,
8635
+ // In ACP mode, always skip the next-speaker check. This check triggers
8636
+ // recursive continuation turns inside GeminiClient.processTurn() that
8637
+ // conflict with ACP's explicit turn management via session/prompt,
8638
+ // causing infinite agent_thought_chunk loops.
8639
+ skipNextSpeakerCheck: isAcpMode || settings.model?.skipNextSpeakerCheck,
8614
8640
  truncateToolOutputThreshold: settings.tools?.truncateToolOutputThreshold,
8615
8641
  eventEmitter: coreEvents,
8616
8642
  useWriteTodos: argv.useWriteTodos ?? settings.useWriteTodos,
@@ -8769,6 +8795,8 @@ import { createHash as createHash2 } from "node:crypto";
8769
8795
  import v8 from "node:v8";
8770
8796
  import os6 from "node:os";
8771
8797
  import dns from "node:dns";
8798
+ import * as path15 from "node:path";
8799
+ import * as fsPromises from "node:fs/promises";
8772
8800
 
8773
8801
  // packages/cli/src/utils/sandbox.ts
8774
8802
  var import_shell_quote2 = __toESM(require_shell_quote(), 1);
@@ -9229,21 +9257,11 @@ async function start_sandbox(config, nodeArgs = [], cliConfig, cliArgs = []) {
9229
9257
  }
9230
9258
  const imageName = parseImageName(image);
9231
9259
  const isIntegrationTest = process.env["GEMINI_CLI_INTEGRATION_TEST"] === "true";
9232
- let containerName;
9233
- if (isIntegrationTest) {
9234
- containerName = `gemini-cli-integration-test-${randomBytes(4).toString(
9235
- "hex"
9236
- )}`;
9237
- debugLogger.log(`ContainerName: ${containerName}`);
9238
- } else {
9239
- let index = 0;
9240
- const containerNameCheck = (await execAsync(`${command2} ps -a --format "{{.Names}}"`)).stdout.trim();
9241
- while (containerNameCheck.includes(`${imageName}-${index}`)) {
9242
- index++;
9243
- }
9244
- containerName = `${imageName}-${index}`;
9245
- debugLogger.log(`ContainerName (regular): ${containerName}`);
9246
- }
9260
+ const containerNamePrefix = isIntegrationTest ? "gemini-cli-integration-test" : imageName;
9261
+ const containerName = `${containerNamePrefix}-${randomBytes(6).toString(
9262
+ "hex"
9263
+ )}`;
9264
+ debugLogger.log(`ContainerName: ${containerName}`);
9247
9265
  args.push("--name", containerName, "--hostname", containerName);
9248
9266
  if (process.env["GEMINI_CLI_TEST_VAR"]) {
9249
9267
  args.push(
@@ -10229,7 +10247,7 @@ async function runNonInteractive({
10229
10247
  }
10230
10248
  });
10231
10249
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10232
- const { setupInitialActivityLogger } = await import("./devtoolsService-VM2WTHBX.js");
10250
+ const { setupInitialActivityLogger } = await import("./devtoolsService-6THA6GNX.js");
10233
10251
  setupInitialActivityLogger(config);
10234
10252
  }
10235
10253
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10684,6 +10702,9 @@ async function runNonInteractive({
10684
10702
  async function runNonInteractive2(params) {
10685
10703
  const useAgentSession = params.config.getAgentSessionNoninteractiveEnabled();
10686
10704
  if (useAgentSession) {
10705
+ debugLogger.debug(
10706
+ "[ADK] Running non-interactive mode with ADK agent session"
10707
+ );
10687
10708
  return runNonInteractive(params);
10688
10709
  }
10689
10710
  const { config, settings, input, prompt_id, resumedSessionData } = params;
@@ -10697,7 +10718,7 @@ async function runNonInteractive2(params) {
10697
10718
  }
10698
10719
  });
10699
10720
  if (process.env["GEMINI_CLI_ACTIVITY_LOG_TARGET"]) {
10700
- const { setupInitialActivityLogger } = await import("./devtoolsService-VM2WTHBX.js");
10721
+ const { setupInitialActivityLogger } = await import("./devtoolsService-6THA6GNX.js");
10701
10722
  setupInitialActivityLogger(config);
10702
10723
  }
10703
10724
  const { stdout: workingStdout } = createWorkingStdio();
@@ -10931,6 +10952,20 @@ async function runNonInteractive2(params) {
10931
10952
  durationMs
10932
10953
  )
10933
10954
  });
10955
+ } else if (config.getOutputFormat() === OutputFormat.JSON) {
10956
+ const formatter = new JsonFormatter();
10957
+ const stats = uiTelemetryService.getMetrics();
10958
+ textOutput.write(
10959
+ formatter.format(
10960
+ config.getSessionId(),
10961
+ responseText,
10962
+ stats,
10963
+ void 0,
10964
+ [...warnings, stopMessage]
10965
+ )
10966
+ );
10967
+ } else {
10968
+ textOutput.ensureTrailingNewline();
10934
10969
  }
10935
10970
  return;
10936
10971
  } else if (event.type === GeminiEventType.AgentExecutionBlocked) {
@@ -14193,12 +14228,6 @@ ${event.value.description}`;
14193
14228
  const invocation = tool.build(args);
14194
14229
  const displayTitle = typeof invocation.getDisplayTitle === "function" ? invocation.getDisplayTitle() : invocation.getDescription();
14195
14230
  const explanation = typeof invocation.getExplanation === "function" ? invocation.getExplanation() : "";
14196
- if (explanation) {
14197
- await this.sendUpdate({
14198
- sessionUpdate: "agent_thought_chunk",
14199
- content: { type: "text", text: explanation }
14200
- });
14201
- }
14202
14231
  const confirmationDetails = await invocation.shouldConfirmExecute(abortSignal);
14203
14232
  if (confirmationDetails) {
14204
14233
  const content2 = [];
@@ -14213,6 +14242,12 @@ ${event.value.description}`;
14213
14242
  }
14214
14243
  });
14215
14244
  }
14245
+ if (content2.length === 0 && explanation) {
14246
+ content2.push({
14247
+ type: "content",
14248
+ content: { type: "text", text: explanation }
14249
+ });
14250
+ }
14216
14251
  const params = {
14217
14252
  sessionId: this.id,
14218
14253
  options: toPermissionOptions(
@@ -14261,6 +14296,12 @@ ${event.value.description}`;
14261
14296
  }
14262
14297
  } else {
14263
14298
  const content2 = [];
14299
+ if (explanation) {
14300
+ content2.push({
14301
+ type: "content",
14302
+ content: { type: "text", text: explanation }
14303
+ });
14304
+ }
14264
14305
  await this.sendUpdate({
14265
14306
  sessionUpdate: "tool_call",
14266
14307
  toolCallId: callId,
@@ -15720,13 +15761,69 @@ ${reason.stack}` : ""}`;
15720
15761
  }
15721
15762
  });
15722
15763
  }
15723
- async function resolveSessionId(resumeArg, sessionIdArg) {
15724
- if (!resumeArg && !sessionIdArg) {
15764
+ async function resolveSessionId(resumeArg, sessionIdArg, sessionFileArg) {
15765
+ if (!resumeArg && !sessionIdArg && !sessionFileArg) {
15725
15766
  return { sessionId: createSessionId() };
15726
15767
  }
15727
15768
  const storage = new Storage(process.cwd());
15728
15769
  await storage.initialize();
15729
15770
  const sessionSelector = new SessionSelector(storage);
15771
+ if (sessionFileArg) {
15772
+ try {
15773
+ const sessionData = await loadConversationRecord(sessionFileArg);
15774
+ if (!sessionData) {
15775
+ throw new Error(`File not found or invalid format: ${sessionFileArg}`);
15776
+ }
15777
+ const now = Date.now();
15778
+ const isoNow = new Date(now).toISOString();
15779
+ sessionData.messages = (sessionData.messages || []).filter(
15780
+ (m) => typeof m === "object" && m !== null && (m.type === "user" || m.type === "gemini") && m.content !== void 0
15781
+ );
15782
+ sessionData.messages.unshift({
15783
+ id: `import-${now}`,
15784
+ type: "info",
15785
+ content: `Imported session from ${sessionFileArg}`,
15786
+ timestamp: isoNow
15787
+ });
15788
+ const newSessionId = createSessionId();
15789
+ sessionData.sessionId = newSessionId;
15790
+ sessionData.projectHash = getProjectHash(storage.getProjectRoot());
15791
+ sessionData.startTime = isoNow;
15792
+ sessionData.lastUpdated = isoNow;
15793
+ const chatsDir = path15.join(storage.getProjectTempDir(), "chats");
15794
+ const newSessionPath = path15.join(
15795
+ chatsDir,
15796
+ `session-${now}-${newSessionId.slice(0, 8)}.jsonl`
15797
+ );
15798
+ const { messages: _messages, ...initialMetadata } = sessionData;
15799
+ const lines = [JSON.stringify(initialMetadata)];
15800
+ if (sessionData.messages) {
15801
+ for (const msg of sessionData.messages) {
15802
+ lines.push(JSON.stringify(msg));
15803
+ }
15804
+ }
15805
+ await fsPromises.mkdir(chatsDir, { recursive: true });
15806
+ await fsPromises.writeFile(
15807
+ newSessionPath,
15808
+ lines.join("\n") + "\n",
15809
+ "utf-8"
15810
+ );
15811
+ return {
15812
+ sessionId: newSessionId,
15813
+ resumedSessionData: {
15814
+ conversation: sessionData,
15815
+ filePath: newSessionPath
15816
+ }
15817
+ };
15818
+ } catch (error) {
15819
+ coreEvents.emitFeedback(
15820
+ "error",
15821
+ `Error importing session from file: ${error instanceof Error ? error.message : "Unknown error"}`
15822
+ );
15823
+ await runExitCleanup();
15824
+ process.exit(ExitCodes.FATAL_INPUT_ERROR);
15825
+ }
15826
+ }
15730
15827
  if (sessionIdArg) {
15731
15828
  if (await sessionSelector.sessionExists(sessionIdArg)) {
15732
15829
  coreEvents.emitFeedback(
@@ -15748,8 +15845,10 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
15748
15845
  };
15749
15846
  } catch (error) {
15750
15847
  if (error instanceof SessionError && error.code === "NO_SESSIONS_FOUND") {
15751
- coreEvents.emitFeedback("warning", error.message);
15752
- return { sessionId: createSessionId() };
15848
+ if (resumeArg === RESUME_LATEST) {
15849
+ coreEvents.emitFeedback("warning", error.message);
15850
+ return { sessionId: createSessionId() };
15851
+ }
15753
15852
  }
15754
15853
  coreEvents.emitFeedback(
15755
15854
  "error",
@@ -15760,7 +15859,7 @@ async function resolveSessionId(resumeArg, sessionIdArg) {
15760
15859
  }
15761
15860
  }
15762
15861
  async function startInteractiveUI(config, settings, startupWarnings, workspaceRoot = process.cwd(), resumedSessionData, initializationResult) {
15763
- const { startInteractiveUI: doStartUI } = await import("./interactiveCli-AG2YWL2O.js");
15862
+ const { startInteractiveUI: doStartUI } = await import("./interactiveCli-DHMPW4RS.js");
15764
15863
  await doStartUI(
15765
15864
  config,
15766
15865
  settings,
@@ -15823,7 +15922,8 @@ async function main() {
15823
15922
  const argv = await argvPromise;
15824
15923
  const { sessionId, resumedSessionData } = await resolveSessionId(
15825
15924
  argv.resume,
15826
- argv.sessionId
15925
+ argv.sessionId,
15926
+ argv.sessionFile
15827
15927
  );
15828
15928
  if (argv.allowedTools && argv.allowedTools.length > 0 || settings.merged.tools?.allowed && settings.merged.tools.allowed.length > 0) {
15829
15929
  coreEvents.emitFeedback(
@@ -15967,7 +16067,7 @@ ${finalArgs[promptIndex + 1]}`;
15967
16067
  await config.storage.initialize();
15968
16068
  adminControlsListner.setConfig(config);
15969
16069
  if (config.isInteractive() && settings.merged.general.devtools) {
15970
- const { setupInitialActivityLogger } = await import("./devtoolsService-VM2WTHBX.js");
16070
+ const { setupInitialActivityLogger } = await import("./devtoolsService-6THA6GNX.js");
15971
16071
  setupInitialActivityLogger(config);
15972
16072
  }
15973
16073
  registerTelemetryConfig(config);
@@ -16026,7 +16126,7 @@ ${finalArgs[promptIndex + 1]}`;
16026
16126
  const initAppHandle = startupProfiler.start("initialize_app");
16027
16127
  const initializationResult = await initializeApp(config, settings);
16028
16128
  initAppHandle?.end();
16029
- import("./liteRtServerManager-BXQ6VVWP.js").then(({ LiteRtServerManager }) => {
16129
+ import("./liteRtServerManager-TEBDIGEN.js").then(({ LiteRtServerManager }) => {
16030
16130
  const mergedGemma = settings.merged.experimental?.gemmaModelRouter;
16031
16131
  if (!mergedGemma) return;
16032
16132
  const userGemma = settings.forScope("User" /* User */).settings.experimental?.gemmaModelRouter;