@google/gemini-cli 0.57.0 → 0.58.0

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 (58) hide show
  1. package/bundle/{chunk-GAROUUGQ.js → chunk-34DO53P3.js} +1 -1
  2. package/bundle/{chunk-RLDNVR77.js → chunk-3TOVOKCT.js} +1 -1
  3. package/bundle/{chunk-4H4K2RBL.js → chunk-5HDR3XAI.js} +3 -3
  4. package/bundle/{chunk-AOE6E7MU.js → chunk-6NU6H3UJ.js} +2 -2
  5. package/bundle/{chunk-ISXOUBN5.js → chunk-7AZ2H37B.js} +2 -2
  6. package/bundle/{chunk-GPOBVDAD.js → chunk-AZBTZOQY.js} +1 -1
  7. package/bundle/{chunk-XG56CL6B.js → chunk-DT2UHOVP.js} +1 -1
  8. package/bundle/{chunk-LQJHQ4BU.js → chunk-DZUS6ANM.js} +2 -2
  9. package/bundle/{chunk-IKHAM2LG.js → chunk-EEUDLSXB.js} +7 -7
  10. package/bundle/{chunk-7ZGWPQVZ.js → chunk-EUYLTRDS.js} +1 -1
  11. package/bundle/{chunk-FYAMITQ2.js → chunk-FOHKEBIA.js} +1 -1
  12. package/bundle/{chunk-DFPYJMVX.js → chunk-FQCNOBUR.js} +242 -106
  13. package/bundle/{chunk-O7TOZUUB.js → chunk-GIBWJBUL.js} +3 -3
  14. package/bundle/{chunk-TAWZWX2B.js → chunk-LQVMPRRK.js} +1 -1
  15. package/bundle/{chunk-7HKQGPWB.js → chunk-MFLFXOVQ.js} +181 -45
  16. package/bundle/{chunk-MNBBUQQS.js → chunk-MPJ66UCC.js} +3 -3
  17. package/bundle/{chunk-HY6GN2F7.js → chunk-NI56QRLL.js} +1 -1
  18. package/bundle/{chunk-S3MXVTTY.js → chunk-RTL6OG34.js} +242 -106
  19. package/bundle/{chunk-ASZFEU6C.js → chunk-SU3CRXG4.js} +7 -7
  20. package/bundle/{chunk-YW7SDLZQ.js → chunk-UMIJZZYQ.js} +1 -1
  21. package/bundle/{chunk-FVC4WCSP.js → chunk-UOO6KFLK.js} +1 -1
  22. package/bundle/{chunk-GAS2GAYB.js → chunk-VR4KVJQS.js} +1 -1
  23. package/bundle/{chunk-QJ33O2NH.js → chunk-YRBEL3RW.js} +7 -7
  24. package/bundle/{chunk-7IKUWYZO.js → chunk-ZQYHXQTP.js} +1 -1
  25. package/bundle/{cleanup-2HUWGXK6.js → cleanup-7SDB5CYC.js} +2 -2
  26. package/bundle/{cleanup-7N2HFE2E.js → cleanup-LHBLIJIU.js} +2 -2
  27. package/bundle/{cleanup-DA7OSZS5.js → cleanup-NRCY53BO.js} +2 -2
  28. package/bundle/{core-CFPIDJ4Z.js → core-HFK4X27E.js} +3 -1
  29. package/bundle/{dist-AMP5W5P2.js → core-NQBBA557.js} +3 -1
  30. package/bundle/{devtoolsService-7YYOUGVF.js → devtoolsService-272REBFX.js} +2 -2
  31. package/bundle/{devtoolsService-VQSLUOYF.js → devtoolsService-57FNRLLJ.js} +2 -2
  32. package/bundle/{devtoolsService-WMEEEXY6.js → devtoolsService-ZBZO7WJL.js} +2 -2
  33. package/bundle/{core-2NMRPWUN.js → dist-LTIGO7GG.js} +3 -1
  34. package/bundle/docs/changelogs/preview.md +78 -94
  35. package/bundle/{gemini-OYYGXMHL.js → gemini-CKAAKWBN.js} +266 -20
  36. package/bundle/{gemini-5LF4JAP7.js → gemini-NWMPE3QX.js} +266 -20
  37. package/bundle/{gemini-PSRJNVY5.js → gemini-P6EV2O3S.js} +266 -20
  38. package/bundle/gemini.js +7 -7
  39. package/bundle/{interactiveCli-PP7WTUZL.js → interactiveCli-AYFQ6SKM.js} +8 -9
  40. package/bundle/{interactiveCli-5O6FZS57.js → interactiveCli-COQ6GM4I.js} +8 -9
  41. package/bundle/{interactiveCli-5E2C3XOC.js → interactiveCli-IWOGYE5O.js} +8 -9
  42. package/bundle/{liteRtServerManager-LK6HOSMO.js → liteRtServerManager-2W4ZSFNJ.js} +4 -4
  43. package/bundle/{liteRtServerManager-ZPDALIDY.js → liteRtServerManager-B6JUP2JR.js} +4 -4
  44. package/bundle/{liteRtServerManager-5QBFCLBK.js → liteRtServerManager-NDS4QOEU.js} +4 -4
  45. package/bundle/{oauth2-provider-CO22I6UM.js → oauth2-provider-AMXXR72B.js} +1 -1
  46. package/bundle/{oauth2-provider-BGMEA7RS.js → oauth2-provider-OBYR2RQV.js} +1 -1
  47. package/bundle/{oauth2-provider-BYKBBEKI.js → oauth2-provider-YDONBTSO.js} +1 -1
  48. package/bundle/policies/write.toml +10 -2
  49. package/bundle/sandbox-macos-permissive-open.sb +50 -0
  50. package/bundle/sandbox-macos-permissive-proxied.sb +50 -0
  51. package/bundle/sandbox-macos-restrictive-open.sb +50 -1
  52. package/bundle/sandbox-macos-restrictive-proxied.sb +50 -0
  53. package/bundle/sandbox-macos-strict-open.sb +50 -0
  54. package/bundle/sandbox-macos-strict-proxied.sb +50 -0
  55. package/bundle/{start-KH6WSP5C.js → start-74JBXZ5X.js} +6 -6
  56. package/bundle/{start-O6LWZY6K.js → start-N5HXRVMU.js} +6 -6
  57. package/bundle/{start-JRTTCV3K.js → start-VYXQJII2.js} +6 -6
  58. package/package.json +1 -1
@@ -48566,13 +48566,13 @@ var require_path = __commonJS({
48566
48566
  "node_modules/@protobufjs/path/index.js"(exports2) {
48567
48567
  "use strict";
48568
48568
  var path114 = exports2;
48569
- var isAbsolute10 = (
48569
+ var isAbsolute11 = (
48570
48570
  /**
48571
48571
  * Tests if the specified path is absolute.
48572
48572
  * @param {string} path Path to test
48573
48573
  * @returns {boolean} `true` if path is absolute
48574
48574
  */
48575
- path114.isAbsolute = function isAbsolute11(path115) {
48575
+ path114.isAbsolute = function isAbsolute12(path115) {
48576
48576
  return /^(?:\/|\w+:)/.test(path115);
48577
48577
  }
48578
48578
  );
@@ -48584,7 +48584,7 @@ var require_path = __commonJS({
48584
48584
  */
48585
48585
  path114.normalize = function normalize7(path115) {
48586
48586
  path115 = path115.replace(/\\/g, "/").replace(/\/{2,}/g, "/");
48587
- var parts2 = path115.split("/"), absolute = isAbsolute10(path115), prefix = "";
48587
+ var parts2 = path115.split("/"), absolute = isAbsolute11(path115), prefix = "";
48588
48588
  if (absolute)
48589
48589
  prefix = parts2.shift() + "/";
48590
48590
  for (var i3 = 0; i3 < parts2.length; ) {
@@ -48606,7 +48606,7 @@ var require_path = __commonJS({
48606
48606
  path114.resolve = function resolve29(originPath, includePath, alreadyNormalized) {
48607
48607
  if (!alreadyNormalized)
48608
48608
  includePath = normalize6(includePath);
48609
- if (isAbsolute10(includePath))
48609
+ if (isAbsolute11(includePath))
48610
48610
  return includePath;
48611
48611
  if (!alreadyNormalized)
48612
48612
  originPath = normalize6(originPath);
@@ -253732,11 +253732,38 @@ function getSupportedAudioMimeTypeForFile(filePath) {
253732
253732
  }
253733
253733
  return extensionMimeType;
253734
253734
  }
253735
+ function canonicalizeMacosPath(p) {
253736
+ if (process.platform === "darwin") {
253737
+ if (p === "/var" || p.startsWith("/var/")) {
253738
+ return "/private" + p;
253739
+ }
253740
+ if (p === "/tmp" || p.startsWith("/tmp/")) {
253741
+ return "/private" + p;
253742
+ }
253743
+ if (p === "/etc" || p.startsWith("/etc/")) {
253744
+ return "/private" + p;
253745
+ }
253746
+ }
253747
+ return p;
253748
+ }
253735
253749
  function isWithinRoot(pathToCheck, rootDirectory) {
253736
- const normalizedPathToCheck = path7.resolve(pathToCheck);
253737
- const normalizedRootDirectory = path7.resolve(rootDirectory);
253750
+ const normalizedPathToCheck = canonicalizeMacosPath(path7.resolve(pathToCheck));
253751
+ const normalizedRootDirectory = canonicalizeMacosPath(path7.resolve(rootDirectory));
253738
253752
  const rootWithSeparator = normalizedRootDirectory === path7.sep || normalizedRootDirectory.endsWith(path7.sep) ? normalizedRootDirectory : normalizedRootDirectory + path7.sep;
253739
- return normalizedPathToCheck === normalizedRootDirectory || normalizedPathToCheck.startsWith(rootWithSeparator);
253753
+ if (normalizedPathToCheck === normalizedRootDirectory || normalizedPathToCheck.startsWith(rootWithSeparator)) {
253754
+ return true;
253755
+ }
253756
+ if (process.platform === "darwin") {
253757
+ try {
253758
+ const realPathToCheck = resolveToRealPath(normalizedPathToCheck);
253759
+ const realRootDirectory = resolveToRealPath(normalizedRootDirectory);
253760
+ const realRootWithSeparator = realRootDirectory === path7.sep || realRootDirectory.endsWith(path7.sep) ? realRootDirectory : realRootDirectory + path7.sep;
253761
+ return realPathToCheck === realRootDirectory || realPathToCheck.startsWith(realRootWithSeparator);
253762
+ } catch {
253763
+ return false;
253764
+ }
253765
+ }
253766
+ return false;
253740
253767
  }
253741
253768
  function getRealPath(filePath) {
253742
253769
  try {
@@ -256237,6 +256264,54 @@ var BASE_SEATBELT_PROFILE = `(version 1)
256237
256264
  (subpath "/dev")
256238
256265
  )
256239
256266
 
256267
+ ; Block Docker & container daemon UNIX domain sockets (read & write)
256268
+ (deny file-read* file-write*
256269
+ (literal "/var/run/docker.sock")
256270
+ (literal "/var/run/docker.sock.raw")
256271
+ (literal "/private/var/run/docker.sock")
256272
+ (literal "/private/var/run/docker.sock.raw")
256273
+ (subpath "/var/run/docker")
256274
+ (subpath "/private/var/run/docker")
256275
+ (subpath "/Users/Shared/.docker")
256276
+ (regex #"^/Users/[^/]+/\\.docker/run/")
256277
+ (regex #"^/Users/[^/]+/\\.docker/desktop/")
256278
+ (regex #"^/Users/[^/]+/\\.colima/")
256279
+ (regex #"^/Users/[^/]+/\\.orbstack/run/")
256280
+ (regex #"^/Users/[^/]+/\\.rd/")
256281
+ )
256282
+
256283
+ ; Block container CLI and daemon binaries from execution
256284
+ (deny process-exec
256285
+ (literal "/usr/local/bin/docker")
256286
+ (literal "/usr/local/bin/dockerd")
256287
+ (literal "/usr/local/bin/docker-compose")
256288
+ (literal "/usr/bin/docker")
256289
+ (literal "/opt/homebrew/bin/docker")
256290
+ (literal "/opt/homebrew/bin/dockerd")
256291
+ (literal "/opt/homebrew/bin/docker-compose")
256292
+ (literal "/opt/homebrew/bin/podman")
256293
+ (literal "/usr/local/bin/podman")
256294
+ (literal "/opt/homebrew/bin/colima")
256295
+ (literal "/usr/local/bin/colima")
256296
+ (literal "/opt/homebrew/bin/orb")
256297
+ (literal "/Applications/Docker.app/Contents/Resources/bin/docker")
256298
+ (subpath "/Applications/Docker.app/Contents/MacOS/")
256299
+ (subpath "/Applications/OrbStack.app/Contents/MacOS/")
256300
+ (subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
256301
+ )
256302
+
256303
+ ; Block com.docker.* and container manager Mach lookup / XPC services
256304
+ (deny mach-lookup
256305
+ (xpc-service-name-prefix "com.docker.")
256306
+ (global-name-prefix "com.docker.")
256307
+ (global-name-prefix "dev.kdrag0n.OrbStack")
256308
+ )
256309
+
256310
+ ; Block Docker POSIX Shared Memory
256311
+ (deny ipc-posix-shm*
256312
+ (ipc-posix-name-prefix "docker")
256313
+ (ipc-posix-name-prefix "com.docker.")
256314
+ )
256240
256315
  `;
256241
256316
  var NETWORK_SEATBELT_PROFILE = `
256242
256317
  ; Network Access
@@ -282559,8 +282634,8 @@ function isValidToolName(name3, options = {}) {
282559
282634
  }
282560
282635
 
282561
282636
  // packages/core/dist/src/generated/git-commit.js
282562
- var GIT_COMMIT_INFO = "1110ce8bc";
282563
- var CLI_VERSION = "0.57.0";
282637
+ var GIT_COMMIT_INFO = "49b6e5d46";
282638
+ var CLI_VERSION = "0.58.0";
282564
282639
 
282565
282640
  // packages/core/dist/src/ide/detect-ide.js
282566
282641
  var IDE_DEFINITIONS = {
@@ -305854,7 +305929,7 @@ function getVersion() {
305854
305929
  }
305855
305930
  versionPromise = (async () => {
305856
305931
  const pkgJson = await getPackageJson(__dirname4);
305857
- return "0.57.0";
305932
+ return "0.58.0";
305858
305933
  })();
305859
305934
  return versionPromise;
305860
305935
  }
@@ -311975,7 +312050,18 @@ function getNormalizedRelativePath(projectRoot, filePath, isDirectory) {
311975
312050
  if (!isWithinRoot(absoluteFilePath, projectRoot)) {
311976
312051
  return null;
311977
312052
  }
311978
- const relativePath = path45.relative(projectRoot, absoluteFilePath);
312053
+ const canonicalRoot = canonicalizeMacosPath(projectRoot);
312054
+ const canonicalAbs = canonicalizeMacosPath(absoluteFilePath);
312055
+ let relativePath = path45.relative(canonicalRoot, canonicalAbs);
312056
+ if (process.platform === "darwin" && relativePath.startsWith("..")) {
312057
+ try {
312058
+ const crossPlatformRel = path45.relative(resolveToRealPath(projectRoot), resolveToRealPath(absoluteFilePath));
312059
+ if (!crossPlatformRel.startsWith("..")) {
312060
+ relativePath = crossPlatformRel;
312061
+ }
312062
+ } catch {
312063
+ }
312064
+ }
311979
312065
  let normalized2 = relativePath.replace(/\\/g, "/");
311980
312066
  if (isDirectory && !normalized2.endsWith("/") && normalized2 !== "") {
311981
312067
  normalized2 += "/";
@@ -312296,14 +312382,18 @@ var FileDiscoveryService = class {
312296
312382
  }
312297
312383
  await Promise.all(dirEntries.map(async (entry) => {
312298
312384
  const fullPath = path49.join(currentDir, entry.name);
312385
+ const entryOptions = {
312386
+ ...options,
312387
+ isSymbolicLink: entry.isSymbolicLink()
312388
+ };
312299
312389
  if (entry.isDirectory()) {
312300
- if (this.shouldIgnoreDirectory(fullPath, options)) {
312390
+ if (this.shouldIgnoreDirectory(fullPath, entryOptions)) {
312301
312391
  ignoredPaths.push(fullPath);
312302
312392
  } else {
312303
312393
  await walk(fullPath);
312304
312394
  }
312305
312395
  } else {
312306
- if (this.shouldIgnoreFile(fullPath, options)) {
312396
+ if (this.shouldIgnoreFile(fullPath, entryOptions)) {
312307
312397
  ignoredPaths.push(fullPath);
312308
312398
  }
312309
312399
  }
@@ -312364,10 +312454,7 @@ var FileDiscoveryService = class {
312364
312454
  shouldIgnoreDirectory(dirPath, options = {}) {
312365
312455
  return this._shouldIgnore(dirPath, true, options);
312366
312456
  }
312367
- /**
312368
- * Internal unified check for paths.
312369
- */
312370
- _shouldIgnore(filePath, isDirectory, options = {}) {
312457
+ _checkIgnoreFilters(filePath, isDirectory, options = {}) {
312371
312458
  const { respectGitIgnore = this.defaultFilterFileOptions.respectGitIgnore, respectGeminiIgnore = this.defaultFilterFileOptions.respectGeminiIgnore } = options;
312372
312459
  if (respectGitIgnore && respectGeminiIgnore && this.combinedIgnoreFilter) {
312373
312460
  return this.combinedIgnoreFilter.isIgnored(filePath, isDirectory);
@@ -312383,6 +312470,31 @@ var FileDiscoveryService = class {
312383
312470
  }
312384
312471
  return false;
312385
312472
  }
312473
+ /**
312474
+ * Internal unified check for paths.
312475
+ */
312476
+ _shouldIgnore(filePath, isDirectory, options = {}) {
312477
+ if (this._checkIgnoreFilters(filePath, isDirectory, options)) {
312478
+ return true;
312479
+ }
312480
+ try {
312481
+ const absolutePath = path49.isAbsolute(filePath) ? filePath : path49.resolve(this.projectRoot, filePath);
312482
+ const isSymlink = options.isSymbolicLink ?? fs42.lstatSync(absolutePath, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
312483
+ if (isSymlink) {
312484
+ const realPath = resolveToRealPath(absolutePath);
312485
+ let targetIsDir = isDirectory;
312486
+ try {
312487
+ targetIsDir = fs42.statSync(realPath).isDirectory();
312488
+ } catch {
312489
+ }
312490
+ if (this._checkIgnoreFilters(realPath, targetIsDir, options)) {
312491
+ return true;
312492
+ }
312493
+ }
312494
+ } catch {
312495
+ }
312496
+ return false;
312497
+ }
312386
312498
  /**
312387
312499
  * Returns the list of ignore files being used (e.g. .geminiignore) excluding .gitignore.
312388
312500
  */
@@ -312535,7 +312647,7 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
312535
312647
  return "start_line cannot be greater than end_line";
312536
312648
  }
312537
312649
  const fileFilteringOptions = this.config.getFileFilteringOptions();
312538
- if (this.fileDiscoveryService.shouldIgnoreFile(resolvedPath, fileFilteringOptions)) {
312650
+ if (this.fileDiscoveryService.shouldIgnoreFile(sanitizedPath, fileFilteringOptions) || this.fileDiscoveryService.shouldIgnoreFile(resolvedPath, fileFilteringOptions)) {
312539
312651
  return `File path '${resolvedPath}' is ignored by configured ignore patterns.`;
312540
312652
  }
312541
312653
  return null;
@@ -322672,6 +322784,8 @@ ${truncated}`;
322672
322784
  }
322673
322785
  let spawnedPty;
322674
322786
  let cmdCleanup;
322787
+ let headlessTerminal;
322788
+ const disposables = [];
322675
322789
  try {
322676
322790
  const cols = shellExecutionConfig.terminalWidth ?? 80;
322677
322791
  const rows = shellExecutionConfig.terminalHeight ?? 30;
@@ -322697,17 +322811,18 @@ ${truncated}`;
322697
322811
  ...isWindowsPlatform ? { useConpty: true } : {}
322698
322812
  });
322699
322813
  spawnedPty = ptyProcess;
322700
- const ptyPid = Number(ptyProcess.pid);
322701
- const headlessTerminal = new Terminal({
322814
+ const pty = spawnedPty;
322815
+ const ptyPid = Number(pty.pid);
322816
+ headlessTerminal = new Terminal({
322702
322817
  allowProposedApi: true,
322703
322818
  cols,
322704
322819
  rows,
322705
322820
  scrollback: shellExecutionConfig.scrollback ?? SCROLLBACK_LIMIT
322706
322821
  });
322707
322822
  headlessTerminal.scrollToTop();
322823
+ const terminal = headlessTerminal;
322708
322824
  this.activePtys.set(ptyPid, {
322709
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
322710
- ptyProcess,
322825
+ ptyProcess: pty,
322711
322826
  headlessTerminal,
322712
322827
  maxSerializedLines: shellExecutionConfig.maxSerializedLines,
322713
322828
  command: shellExecutionConfig.originalCommand ?? commandToExecute,
@@ -322719,13 +322834,12 @@ ${truncated}`;
322719
322834
  if (!ExecutionLifecycleService.isActive(ptyPid)) {
322720
322835
  return;
322721
322836
  }
322722
- ptyProcess.write(input);
322837
+ pty.write(input);
322723
322838
  },
322724
322839
  kill: () => {
322725
322840
  killProcessGroup({
322726
322841
  pid: ptyPid,
322727
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
322728
- pty: ptyProcess
322842
+ pty
322729
322843
  }).catch(() => {
322730
322844
  });
322731
322845
  },
@@ -322739,11 +322853,11 @@ ${truncated}`;
322739
322853
  return false;
322740
322854
  }
322741
322855
  },
322742
- getBackgroundOutput: () => getFullBufferText(headlessTerminal),
322856
+ getBackgroundOutput: () => getFullBufferText(terminal),
322743
322857
  getSubscriptionSnapshot: () => {
322744
- const endLine = headlessTerminal.buffer.active.length;
322858
+ const endLine = terminal.buffer.active.length;
322745
322859
  const startLine = Math.max(0, endLine - (shellExecutionConfig.maxSerializedLines ?? 2e3));
322746
- const bufferData = serializeTerminalToObject(headlessTerminal, startLine, endLine);
322860
+ const bufferData = serializeTerminalToObject(terminal, startLine, endLine);
322747
322861
  return bufferData.length > 0 ? bufferData : void 0;
322748
322862
  },
322749
322863
  formatInjection: (output2, error41) => _ShellExecutionService.formatShellBackgroundCompletion(ptyPid, shellExecutionConfig.backgroundCompletionBehavior || "silent", output2, error41 ?? void 0),
@@ -322769,21 +322883,21 @@ ${truncated}`;
322769
322883
  }
322770
322884
  if (!shellExecutionConfig.disableDynamicLineTrimming) {
322771
322885
  if (!hasStartedOutput) {
322772
- const bufferText = getFullBufferText(headlessTerminal);
322886
+ const bufferText = getFullBufferText(terminal);
322773
322887
  if (bufferText.trim().length === 0) {
322774
322888
  return;
322775
322889
  }
322776
322890
  hasStartedOutput = true;
322777
322891
  }
322778
322892
  }
322779
- const buffer = headlessTerminal.buffer.active;
322893
+ const buffer = terminal.buffer.active;
322780
322894
  const endLine = buffer.length;
322781
322895
  const startLine = Math.max(0, endLine - (shellExecutionConfig.maxSerializedLines ?? 2e3));
322782
322896
  let newOutput;
322783
322897
  if (shellExecutionConfig.showColor) {
322784
- newOutput = serializeTerminalToObject(headlessTerminal, startLine, endLine);
322898
+ newOutput = serializeTerminalToObject(terminal, startLine, endLine);
322785
322899
  } else {
322786
- newOutput = (serializeTerminalToObject(headlessTerminal, startLine, endLine) || []).map((line) => line.map((token2) => {
322900
+ newOutput = (serializeTerminalToObject(terminal, startLine, endLine) || []).map((line) => line.map((token2) => {
322787
322901
  token2.fg = "";
322788
322902
  token2.bg = "";
322789
322903
  return token2;
@@ -322866,7 +322980,7 @@ ${truncated}`;
322866
322980
  _ShellExecutionService.syncBackgroundLog(ptyPid, decodedChunk);
322867
322981
  }
322868
322982
  isWriting = true;
322869
- headlessTerminal.write(decodedChunk, () => {
322983
+ terminal.write(decodedChunk, () => {
322870
322984
  render3();
322871
322985
  isWriting = false;
322872
322986
  resolveChunk();
@@ -322883,17 +322997,24 @@ ${truncated}`;
322883
322997
  }
322884
322998
  }));
322885
322999
  };
322886
- ptyProcess.onData((data) => {
323000
+ const dataListener = pty.onData((data) => {
322887
323001
  const bufferData = Buffer.from(data, "utf-8");
322888
323002
  handleOutput(bufferData);
322889
323003
  });
322890
- ptyProcess.onExit(({ exitCode, signal }) => {
323004
+ disposables.push(dataListener);
323005
+ const exitListener = pty.onExit(({ exitCode, signal }) => {
322891
323006
  exited = true;
322892
323007
  abortSignal.removeEventListener("abort", abortHandler);
322893
- _ShellExecutionService.destroyPtyProcess(ptyProcess);
323008
+ _ShellExecutionService.destroyPtyProcess(pty);
322894
323009
  const finalize = () => {
322895
323010
  render3(true);
322896
323011
  cmdCleanup?.();
323012
+ disposables.forEach((d) => {
323013
+ try {
323014
+ d.dispose();
323015
+ } catch {
323016
+ }
323017
+ });
322897
323018
  const event = {
322898
323019
  type: "exit",
322899
323020
  exitCode,
@@ -322909,12 +323030,12 @@ ${truncated}`;
322909
323030
  historyItem.endTime = Date.now();
322910
323031
  }
322911
323032
  onOutputEvent(event);
322912
- const endLine = headlessTerminal.buffer.active.length;
323033
+ const endLine = headlessTerminal ? headlessTerminal.buffer.active.length : 0;
322913
323034
  const startLine = Math.max(0, endLine - (shellExecutionConfig.maxSerializedLines ?? 2e3));
322914
- const ansiOutputSnapshot = serializeTerminalToObject(headlessTerminal, startLine, endLine);
322915
- const finalOutput = getFullBufferText(headlessTerminal);
323035
+ const ansiOutputSnapshot = headlessTerminal ? serializeTerminalToObject(headlessTerminal, startLine, endLine) : [];
323036
+ const finalOutput = headlessTerminal ? getFullBufferText(headlessTerminal) : "";
322916
323037
  try {
322917
- headlessTerminal.dispose();
323038
+ headlessTerminal?.dispose();
322918
323039
  } catch {
322919
323040
  }
322920
323041
  _ShellExecutionService.cleanupLogStream(ptyPid).then(() => {
@@ -322950,6 +323071,7 @@ ${truncated}`;
322950
323071
  finalize();
322951
323072
  });
322952
323073
  });
323074
+ disposables.push(exitListener);
322953
323075
  const abortHandler = async () => {
322954
323076
  if (ptyProcess.pid && !exited) {
322955
323077
  await killProcessGroup({
@@ -322969,10 +323091,23 @@ ${truncated}`;
322969
323091
  if (spawnedPty) {
322970
323092
  _ShellExecutionService.destroyPtyProcess(spawnedPty);
322971
323093
  }
322972
- if (error40?.message?.includes("posix_spawnp failed")) {
323094
+ if (headlessTerminal) {
323095
+ try {
323096
+ headlessTerminal.dispose();
323097
+ } catch {
323098
+ }
323099
+ }
323100
+ disposables.forEach((d) => {
323101
+ try {
323102
+ d.dispose();
323103
+ } catch {
323104
+ }
323105
+ });
323106
+ const isPtyCreationFailure = error40?.message?.includes("posix_spawnp failed") || error40?.message?.includes("ENXIO") || isNodeError(error40) && error40.code === "ENXIO" || error40?.message?.includes("Device not configured");
323107
+ if (isPtyCreationFailure) {
322973
323108
  onOutputEvent({
322974
323109
  type: "data",
322975
- chunk: "[GEMINI_CLI_WARNING] PTY execution failed, falling back to child_process. This may be due to sandbox restrictions.\n"
323110
+ chunk: "[GEMINI_CLI_WARNING] PTY execution failed, falling back to child_process. This may be due to terminal exhaustion or sandbox restrictions.\n"
322976
323111
  });
322977
323112
  throw e2;
322978
323113
  } else {
@@ -331554,13 +331689,13 @@ function stripToolCallIdPrefixes(contents) {
331554
331689
  };
331555
331690
  }
331556
331691
  }
331557
- const hasOtherKeys = Object.keys(newPart).some((key) => key !== "text" && key !== "thought" && key !== "callIndex" && newPart[key] !== void 0);
331692
+ const hasOtherKeys = Object.keys(newPart).some((key) => key !== "text" && key !== "thought" && key !== "callIndex");
331558
331693
  if (newPart.text !== void 0 && newPart.text === "" && hasOtherKeys) {
331559
331694
  delete newPart.text;
331560
331695
  }
331561
331696
  return newPart;
331562
331697
  }).filter((part) => {
331563
- const hasOtherKeys = Object.keys(part).some((key) => key !== "text" && key !== "thought" && key !== "callIndex" && part[key] !== void 0);
331698
+ const hasOtherKeys = Object.keys(part).some((key) => key !== "text" && key !== "thought" && key !== "callIndex");
331564
331699
  if (part.text !== void 0 && part.text === "" && !hasOtherKeys) {
331565
331700
  return false;
331566
331701
  }
@@ -338785,7 +338920,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
338785
338920
  return provider;
338786
338921
  }
338787
338922
  case "oauth2": {
338788
- const { OAuth2AuthProvider } = await import("./oauth2-provider-BYKBBEKI.js");
338923
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-YDONBTSO.js");
338789
338924
  const provider = new OAuth2AuthProvider(authConfig, options.agentName ?? "unknown", agentCard, options.agentCardUrl);
338790
338925
  await provider.initialize();
338791
338926
  return provider;
@@ -395932,6 +396067,7 @@ export {
395932
396067
  detectBOM,
395933
396068
  readFileWithEncoding,
395934
396069
  getSpecificMimeType,
396070
+ canonicalizeMacosPath,
395935
396071
  isWithinRoot,
395936
396072
  getRealPath,
395937
396073
  isEmpty,
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  exitCli,
4
4
  require_source
5
- } from "./chunk-HY6GN2F7.js";
5
+ } from "./chunk-NI56QRLL.js";
6
6
  import {
7
7
  DEFAULT_PORT,
8
8
  SERVER_START_WAIT_MS,
@@ -14,10 +14,10 @@ import {
14
14
  isServerRunning,
15
15
  resolveGemmaConfig,
16
16
  writeServerProcessInfo
17
- } from "./chunk-GPOBVDAD.js";
17
+ } from "./chunk-34DO53P3.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-DFPYJMVX.js";
20
+ } from "./chunk-MFLFXOVQ.js";
21
21
  import {
22
22
  __toESM
23
23
  } from "./chunk-34MYV7JD.js";
@@ -1,7 +1,7 @@
1
1
  const require = (await import('node:module')).createRequire(import.meta.url); const __chunk_filename = (await import('node:url')).fileURLToPath(import.meta.url); const __chunk_dirname = (await import('node:path')).dirname(__chunk_filename);
2
2
  import {
3
3
  runExitCleanup
4
- } from "./chunk-RLDNVR77.js";
4
+ } from "./chunk-VR4KVJQS.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require