@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);
@@ -253800,11 +253800,42 @@ function getSupportedAudioMimeTypeForFile(filePath) {
253800
253800
  }
253801
253801
  return extensionMimeType;
253802
253802
  }
253803
+ function canonicalizeMacosPath(p) {
253804
+ if (process.platform === "darwin") {
253805
+ if (p === "/var" || p.startsWith("/var/")) {
253806
+ return "/private" + p;
253807
+ }
253808
+ if (p === "/tmp" || p.startsWith("/tmp/")) {
253809
+ return "/private" + p;
253810
+ }
253811
+ if (p === "/etc" || p.startsWith("/etc/")) {
253812
+ return "/private" + p;
253813
+ }
253814
+ }
253815
+ return p;
253816
+ }
253803
253817
  function isWithinRoot(pathToCheck, rootDirectory) {
253804
- const normalizedPathToCheck = path7.resolve(pathToCheck);
253805
- const normalizedRootDirectory = path7.resolve(rootDirectory);
253818
+ const normalizedPathToCheck = canonicalizeMacosPath(
253819
+ path7.resolve(pathToCheck)
253820
+ );
253821
+ const normalizedRootDirectory = canonicalizeMacosPath(
253822
+ path7.resolve(rootDirectory)
253823
+ );
253806
253824
  const rootWithSeparator = normalizedRootDirectory === path7.sep || normalizedRootDirectory.endsWith(path7.sep) ? normalizedRootDirectory : normalizedRootDirectory + path7.sep;
253807
- return normalizedPathToCheck === normalizedRootDirectory || normalizedPathToCheck.startsWith(rootWithSeparator);
253825
+ if (normalizedPathToCheck === normalizedRootDirectory || normalizedPathToCheck.startsWith(rootWithSeparator)) {
253826
+ return true;
253827
+ }
253828
+ if (process.platform === "darwin") {
253829
+ try {
253830
+ const realPathToCheck = resolveToRealPath(normalizedPathToCheck);
253831
+ const realRootDirectory = resolveToRealPath(normalizedRootDirectory);
253832
+ const realRootWithSeparator = realRootDirectory === path7.sep || realRootDirectory.endsWith(path7.sep) ? realRootDirectory : realRootDirectory + path7.sep;
253833
+ return realPathToCheck === realRootDirectory || realPathToCheck.startsWith(realRootWithSeparator);
253834
+ } catch {
253835
+ return false;
253836
+ }
253837
+ }
253838
+ return false;
253808
253839
  }
253809
253840
  function getRealPath(filePath) {
253810
253841
  try {
@@ -256372,6 +256403,54 @@ var BASE_SEATBELT_PROFILE = `(version 1)
256372
256403
  (subpath "/dev")
256373
256404
  )
256374
256405
 
256406
+ ; Block Docker & container daemon UNIX domain sockets (read & write)
256407
+ (deny file-read* file-write*
256408
+ (literal "/var/run/docker.sock")
256409
+ (literal "/var/run/docker.sock.raw")
256410
+ (literal "/private/var/run/docker.sock")
256411
+ (literal "/private/var/run/docker.sock.raw")
256412
+ (subpath "/var/run/docker")
256413
+ (subpath "/private/var/run/docker")
256414
+ (subpath "/Users/Shared/.docker")
256415
+ (regex #"^/Users/[^/]+/\\.docker/run/")
256416
+ (regex #"^/Users/[^/]+/\\.docker/desktop/")
256417
+ (regex #"^/Users/[^/]+/\\.colima/")
256418
+ (regex #"^/Users/[^/]+/\\.orbstack/run/")
256419
+ (regex #"^/Users/[^/]+/\\.rd/")
256420
+ )
256421
+
256422
+ ; Block container CLI and daemon binaries from execution
256423
+ (deny process-exec
256424
+ (literal "/usr/local/bin/docker")
256425
+ (literal "/usr/local/bin/dockerd")
256426
+ (literal "/usr/local/bin/docker-compose")
256427
+ (literal "/usr/bin/docker")
256428
+ (literal "/opt/homebrew/bin/docker")
256429
+ (literal "/opt/homebrew/bin/dockerd")
256430
+ (literal "/opt/homebrew/bin/docker-compose")
256431
+ (literal "/opt/homebrew/bin/podman")
256432
+ (literal "/usr/local/bin/podman")
256433
+ (literal "/opt/homebrew/bin/colima")
256434
+ (literal "/usr/local/bin/colima")
256435
+ (literal "/opt/homebrew/bin/orb")
256436
+ (literal "/Applications/Docker.app/Contents/Resources/bin/docker")
256437
+ (subpath "/Applications/Docker.app/Contents/MacOS/")
256438
+ (subpath "/Applications/OrbStack.app/Contents/MacOS/")
256439
+ (subpath "/Applications/Rancher Desktop.app/Contents/MacOS/")
256440
+ )
256441
+
256442
+ ; Block com.docker.* and container manager Mach lookup / XPC services
256443
+ (deny mach-lookup
256444
+ (xpc-service-name-prefix "com.docker.")
256445
+ (global-name-prefix "com.docker.")
256446
+ (global-name-prefix "dev.kdrag0n.OrbStack")
256447
+ )
256448
+
256449
+ ; Block Docker POSIX Shared Memory
256450
+ (deny ipc-posix-shm*
256451
+ (ipc-posix-name-prefix "docker")
256452
+ (ipc-posix-name-prefix "com.docker.")
256453
+ )
256375
256454
  `;
256376
256455
  var NETWORK_SEATBELT_PROFILE = `
256377
256456
  ; Network Access
@@ -282830,8 +282909,8 @@ function isValidToolName(name3, options = {}) {
282830
282909
  }
282831
282910
 
282832
282911
  // packages/core/src/generated/git-commit.ts
282833
- var GIT_COMMIT_INFO = "1110ce8bc";
282834
- var CLI_VERSION = "0.57.0-preview.1";
282912
+ var GIT_COMMIT_INFO = "49b6e5d46";
282913
+ var CLI_VERSION = "0.58.0";
282835
282914
 
282836
282915
  // packages/core/src/ide/detect-ide.ts
282837
282916
  var IDE_DEFINITIONS = {
@@ -306451,7 +306530,7 @@ function getVersion() {
306451
306530
  }
306452
306531
  versionPromise = (async () => {
306453
306532
  const pkgJson = await getPackageJson(__dirname4);
306454
- return "0.57.0-preview.1";
306533
+ return "0.58.0";
306455
306534
  })();
306456
306535
  return versionPromise;
306457
306536
  }
@@ -313580,7 +313659,21 @@ function getNormalizedRelativePath(projectRoot, filePath, isDirectory) {
313580
313659
  if (!isWithinRoot(absoluteFilePath, projectRoot)) {
313581
313660
  return null;
313582
313661
  }
313583
- const relativePath = path45.relative(projectRoot, absoluteFilePath);
313662
+ const canonicalRoot = canonicalizeMacosPath(projectRoot);
313663
+ const canonicalAbs = canonicalizeMacosPath(absoluteFilePath);
313664
+ let relativePath = path45.relative(canonicalRoot, canonicalAbs);
313665
+ if (process.platform === "darwin" && relativePath.startsWith("..")) {
313666
+ try {
313667
+ const crossPlatformRel = path45.relative(
313668
+ resolveToRealPath(projectRoot),
313669
+ resolveToRealPath(absoluteFilePath)
313670
+ );
313671
+ if (!crossPlatformRel.startsWith("..")) {
313672
+ relativePath = crossPlatformRel;
313673
+ }
313674
+ } catch {
313675
+ }
313676
+ }
313584
313677
  let normalized2 = relativePath.replace(/\\/g, "/");
313585
313678
  if (isDirectory && !normalized2.endsWith("/") && normalized2 !== "") {
313586
313679
  normalized2 += "/";
@@ -313938,14 +314031,18 @@ var FileDiscoveryService = class {
313938
314031
  await Promise.all(
313939
314032
  dirEntries.map(async (entry) => {
313940
314033
  const fullPath = path49.join(currentDir, entry.name);
314034
+ const entryOptions = {
314035
+ ...options,
314036
+ isSymbolicLink: entry.isSymbolicLink()
314037
+ };
313941
314038
  if (entry.isDirectory()) {
313942
- if (this.shouldIgnoreDirectory(fullPath, options)) {
314039
+ if (this.shouldIgnoreDirectory(fullPath, entryOptions)) {
313943
314040
  ignoredPaths.push(fullPath);
313944
314041
  } else {
313945
314042
  await walk(fullPath);
313946
314043
  }
313947
314044
  } else {
313948
- if (this.shouldIgnoreFile(fullPath, options)) {
314045
+ if (this.shouldIgnoreFile(fullPath, entryOptions)) {
313949
314046
  ignoredPaths.push(fullPath);
313950
314047
  }
313951
314048
  }
@@ -314006,10 +314103,7 @@ var FileDiscoveryService = class {
314006
314103
  shouldIgnoreDirectory(dirPath, options = {}) {
314007
314104
  return this._shouldIgnore(dirPath, true, options);
314008
314105
  }
314009
- /**
314010
- * Internal unified check for paths.
314011
- */
314012
- _shouldIgnore(filePath, isDirectory, options = {}) {
314106
+ _checkIgnoreFilters(filePath, isDirectory, options = {}) {
314013
314107
  const {
314014
314108
  respectGitIgnore = this.defaultFilterFileOptions.respectGitIgnore,
314015
314109
  respectGeminiIgnore = this.defaultFilterFileOptions.respectGeminiIgnore
@@ -314028,6 +314122,31 @@ var FileDiscoveryService = class {
314028
314122
  }
314029
314123
  return false;
314030
314124
  }
314125
+ /**
314126
+ * Internal unified check for paths.
314127
+ */
314128
+ _shouldIgnore(filePath, isDirectory, options = {}) {
314129
+ if (this._checkIgnoreFilters(filePath, isDirectory, options)) {
314130
+ return true;
314131
+ }
314132
+ try {
314133
+ const absolutePath = path49.isAbsolute(filePath) ? filePath : path49.resolve(this.projectRoot, filePath);
314134
+ const isSymlink = options.isSymbolicLink ?? fs42.lstatSync(absolutePath, { throwIfNoEntry: false })?.isSymbolicLink() ?? false;
314135
+ if (isSymlink) {
314136
+ const realPath = resolveToRealPath(absolutePath);
314137
+ let targetIsDir = isDirectory;
314138
+ try {
314139
+ targetIsDir = fs42.statSync(realPath).isDirectory();
314140
+ } catch {
314141
+ }
314142
+ if (this._checkIgnoreFilters(realPath, targetIsDir, options)) {
314143
+ return true;
314144
+ }
314145
+ }
314146
+ } catch {
314147
+ }
314148
+ return false;
314149
+ }
314031
314150
  /**
314032
314151
  * Returns the list of ignore files being used (e.g. .geminiignore) excluding .gitignore.
314033
314152
  */
@@ -314229,6 +314348,9 @@ var ReadFileTool = class _ReadFileTool extends BaseDeclarativeTool {
314229
314348
  }
314230
314349
  const fileFilteringOptions = this.config.getFileFilteringOptions();
314231
314350
  if (this.fileDiscoveryService.shouldIgnoreFile(
314351
+ sanitizedPath,
314352
+ fileFilteringOptions
314353
+ ) || this.fileDiscoveryService.shouldIgnoreFile(
314232
314354
  resolvedPath,
314233
314355
  fileFilteringOptions
314234
314356
  )) {
@@ -324658,6 +324780,8 @@ ${truncated}`;
324658
324780
  }
324659
324781
  let spawnedPty;
324660
324782
  let cmdCleanup;
324783
+ let headlessTerminal;
324784
+ const disposables = [];
324661
324785
  try {
324662
324786
  const cols = shellExecutionConfig.terminalWidth ?? 80;
324663
324787
  const rows = shellExecutionConfig.terminalHeight ?? 30;
@@ -324694,17 +324818,18 @@ ${truncated}`;
324694
324818
  ...isWindowsPlatform ? { useConpty: true } : {}
324695
324819
  });
324696
324820
  spawnedPty = ptyProcess;
324697
- const ptyPid = Number(ptyProcess.pid);
324698
- const headlessTerminal = new Terminal({
324821
+ const pty = spawnedPty;
324822
+ const ptyPid = Number(pty.pid);
324823
+ headlessTerminal = new Terminal({
324699
324824
  allowProposedApi: true,
324700
324825
  cols,
324701
324826
  rows,
324702
324827
  scrollback: shellExecutionConfig.scrollback ?? SCROLLBACK_LIMIT
324703
324828
  });
324704
324829
  headlessTerminal.scrollToTop();
324830
+ const terminal = headlessTerminal;
324705
324831
  this.activePtys.set(ptyPid, {
324706
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
324707
- ptyProcess,
324832
+ ptyProcess: pty,
324708
324833
  headlessTerminal,
324709
324834
  maxSerializedLines: shellExecutionConfig.maxSerializedLines,
324710
324835
  command: shellExecutionConfig.originalCommand ?? commandToExecute,
@@ -324716,13 +324841,12 @@ ${truncated}`;
324716
324841
  if (!ExecutionLifecycleService.isActive(ptyPid)) {
324717
324842
  return;
324718
324843
  }
324719
- ptyProcess.write(input);
324844
+ pty.write(input);
324720
324845
  },
324721
324846
  kill: () => {
324722
324847
  killProcessGroup({
324723
324848
  pid: ptyPid,
324724
- // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
324725
- pty: ptyProcess
324849
+ pty
324726
324850
  }).catch(() => {
324727
324851
  });
324728
324852
  },
@@ -324736,15 +324860,15 @@ ${truncated}`;
324736
324860
  return false;
324737
324861
  }
324738
324862
  },
324739
- getBackgroundOutput: () => getFullBufferText(headlessTerminal),
324863
+ getBackgroundOutput: () => getFullBufferText(terminal),
324740
324864
  getSubscriptionSnapshot: () => {
324741
- const endLine = headlessTerminal.buffer.active.length;
324865
+ const endLine = terminal.buffer.active.length;
324742
324866
  const startLine = Math.max(
324743
324867
  0,
324744
324868
  endLine - (shellExecutionConfig.maxSerializedLines ?? 2e3)
324745
324869
  );
324746
324870
  const bufferData = serializeTerminalToObject(
324747
- headlessTerminal,
324871
+ terminal,
324748
324872
  startLine,
324749
324873
  endLine
324750
324874
  );
@@ -324778,14 +324902,14 @@ ${truncated}`;
324778
324902
  }
324779
324903
  if (!shellExecutionConfig.disableDynamicLineTrimming) {
324780
324904
  if (!hasStartedOutput) {
324781
- const bufferText = getFullBufferText(headlessTerminal);
324905
+ const bufferText = getFullBufferText(terminal);
324782
324906
  if (bufferText.trim().length === 0) {
324783
324907
  return;
324784
324908
  }
324785
324909
  hasStartedOutput = true;
324786
324910
  }
324787
324911
  }
324788
- const buffer = headlessTerminal.buffer.active;
324912
+ const buffer = terminal.buffer.active;
324789
324913
  const endLine = buffer.length;
324790
324914
  const startLine = Math.max(
324791
324915
  0,
@@ -324793,13 +324917,9 @@ ${truncated}`;
324793
324917
  );
324794
324918
  let newOutput;
324795
324919
  if (shellExecutionConfig.showColor) {
324796
- newOutput = serializeTerminalToObject(
324797
- headlessTerminal,
324798
- startLine,
324799
- endLine
324800
- );
324920
+ newOutput = serializeTerminalToObject(terminal, startLine, endLine);
324801
324921
  } else {
324802
- newOutput = (serializeTerminalToObject(headlessTerminal, startLine, endLine) || []).map(
324922
+ newOutput = (serializeTerminalToObject(terminal, startLine, endLine) || []).map(
324803
324923
  (line) => line.map((token2) => {
324804
324924
  token2.fg = "";
324805
324925
  token2.bg = "";
@@ -324885,7 +325005,7 @@ ${truncated}`;
324885
325005
  _ShellExecutionService.syncBackgroundLog(ptyPid, decodedChunk);
324886
325006
  }
324887
325007
  isWriting = true;
324888
- headlessTerminal.write(decodedChunk, () => {
325008
+ terminal.write(decodedChunk, () => {
324889
325009
  render3();
324890
325010
  isWriting = false;
324891
325011
  resolveChunk();
@@ -324903,82 +325023,84 @@ ${truncated}`;
324903
325023
  })
324904
325024
  );
324905
325025
  };
324906
- ptyProcess.onData((data) => {
325026
+ const dataListener = pty.onData((data) => {
324907
325027
  const bufferData = Buffer.from(data, "utf-8");
324908
325028
  handleOutput(bufferData);
324909
325029
  });
324910
- ptyProcess.onExit(
324911
- ({ exitCode, signal }) => {
324912
- exited = true;
324913
- abortSignal.removeEventListener("abort", abortHandler);
324914
- _ShellExecutionService.destroyPtyProcess(ptyProcess);
324915
- const finalize = () => {
324916
- render3(true);
324917
- cmdCleanup?.();
324918
- const event = {
324919
- type: "exit",
324920
- exitCode,
324921
- signal: signal ?? null
324922
- };
324923
- const sessionId = shellExecutionConfig.sessionId ?? "default";
324924
- const history = _ShellExecutionService.backgroundProcessHistory.get(sessionId);
324925
- const historyItem = history?.get(ptyPid);
324926
- if (historyItem) {
324927
- historyItem.status = "exited";
324928
- historyItem.exitCode = exitCode;
324929
- historyItem.signal = signal ?? null;
324930
- historyItem.endTime = Date.now();
324931
- }
324932
- onOutputEvent(event);
324933
- const endLine = headlessTerminal.buffer.active.length;
324934
- const startLine = Math.max(
324935
- 0,
324936
- endLine - (shellExecutionConfig.maxSerializedLines ?? 2e3)
324937
- );
324938
- const ansiOutputSnapshot = serializeTerminalToObject(
324939
- headlessTerminal,
324940
- startLine,
324941
- endLine
324942
- );
324943
- const finalOutput = getFullBufferText(headlessTerminal);
325030
+ disposables.push(dataListener);
325031
+ const exitListener = pty.onExit(({ exitCode, signal }) => {
325032
+ exited = true;
325033
+ abortSignal.removeEventListener("abort", abortHandler);
325034
+ _ShellExecutionService.destroyPtyProcess(pty);
325035
+ const finalize = () => {
325036
+ render3(true);
325037
+ cmdCleanup?.();
325038
+ disposables.forEach((d) => {
324944
325039
  try {
324945
- headlessTerminal.dispose();
325040
+ d.dispose();
324946
325041
  } catch {
324947
325042
  }
324948
- _ShellExecutionService.cleanupLogStream(ptyPid).then(() => {
324949
- _ShellExecutionService.activePtys.delete(ptyPid);
324950
- });
324951
- ExecutionLifecycleService.completeWithResult(ptyPid, {
324952
- rawOutput: Buffer.from(""),
324953
- output: finalOutput,
324954
- ansiOutput: ansiOutputSnapshot,
324955
- exitCode,
324956
- signal: signal ?? null,
324957
- error: error40,
324958
- aborted: abortSignal.aborted,
324959
- pid: ptyPid,
324960
- executionMethod: ptyInfo?.name ?? "node-pty"
324961
- });
325043
+ });
325044
+ const event = {
325045
+ type: "exit",
325046
+ exitCode,
325047
+ signal: signal ?? null
324962
325048
  };
324963
- if (abortSignal.aborted) {
324964
- finalize();
324965
- return;
325049
+ const sessionId = shellExecutionConfig.sessionId ?? "default";
325050
+ const history = _ShellExecutionService.backgroundProcessHistory.get(sessionId);
325051
+ const historyItem = history?.get(ptyPid);
325052
+ if (historyItem) {
325053
+ historyItem.status = "exited";
325054
+ historyItem.exitCode = exitCode;
325055
+ historyItem.signal = signal ?? null;
325056
+ historyItem.endTime = Date.now();
324966
325057
  }
324967
- const processingComplete = processingChain.then(() => "processed");
324968
- const abortFired = new Promise((res) => {
324969
- if (abortSignal.aborted) {
324970
- res("aborted");
324971
- return;
324972
- }
324973
- abortSignal.addEventListener("abort", () => res("aborted"), {
324974
- once: true
324975
- });
325058
+ onOutputEvent(event);
325059
+ const endLine = headlessTerminal ? headlessTerminal.buffer.active.length : 0;
325060
+ const startLine = Math.max(
325061
+ 0,
325062
+ endLine - (shellExecutionConfig.maxSerializedLines ?? 2e3)
325063
+ );
325064
+ const ansiOutputSnapshot = headlessTerminal ? serializeTerminalToObject(headlessTerminal, startLine, endLine) : [];
325065
+ const finalOutput = headlessTerminal ? getFullBufferText(headlessTerminal) : "";
325066
+ try {
325067
+ headlessTerminal?.dispose();
325068
+ } catch {
325069
+ }
325070
+ _ShellExecutionService.cleanupLogStream(ptyPid).then(() => {
325071
+ _ShellExecutionService.activePtys.delete(ptyPid);
324976
325072
  });
324977
- Promise.race([processingComplete, abortFired]).then(() => {
324978
- finalize();
325073
+ ExecutionLifecycleService.completeWithResult(ptyPid, {
325074
+ rawOutput: Buffer.from(""),
325075
+ output: finalOutput,
325076
+ ansiOutput: ansiOutputSnapshot,
325077
+ exitCode,
325078
+ signal: signal ?? null,
325079
+ error: error40,
325080
+ aborted: abortSignal.aborted,
325081
+ pid: ptyPid,
325082
+ executionMethod: ptyInfo?.name ?? "node-pty"
324979
325083
  });
325084
+ };
325085
+ if (abortSignal.aborted) {
325086
+ finalize();
325087
+ return;
324980
325088
  }
324981
- );
325089
+ const processingComplete = processingChain.then(() => "processed");
325090
+ const abortFired = new Promise((res) => {
325091
+ if (abortSignal.aborted) {
325092
+ res("aborted");
325093
+ return;
325094
+ }
325095
+ abortSignal.addEventListener("abort", () => res("aborted"), {
325096
+ once: true
325097
+ });
325098
+ });
325099
+ Promise.race([processingComplete, abortFired]).then(() => {
325100
+ finalize();
325101
+ });
325102
+ });
325103
+ disposables.push(exitListener);
324982
325104
  const abortHandler = async () => {
324983
325105
  if (ptyProcess.pid && !exited) {
324984
325106
  await killProcessGroup({
@@ -324998,10 +325120,23 @@ ${truncated}`;
324998
325120
  if (spawnedPty) {
324999
325121
  _ShellExecutionService.destroyPtyProcess(spawnedPty);
325000
325122
  }
325001
- if (error40?.message?.includes("posix_spawnp failed")) {
325123
+ if (headlessTerminal) {
325124
+ try {
325125
+ headlessTerminal.dispose();
325126
+ } catch {
325127
+ }
325128
+ }
325129
+ disposables.forEach((d) => {
325130
+ try {
325131
+ d.dispose();
325132
+ } catch {
325133
+ }
325134
+ });
325135
+ const isPtyCreationFailure = error40?.message?.includes("posix_spawnp failed") || error40?.message?.includes("ENXIO") || isNodeError(error40) && error40.code === "ENXIO" || error40?.message?.includes("Device not configured");
325136
+ if (isPtyCreationFailure) {
325002
325137
  onOutputEvent({
325003
325138
  type: "data",
325004
- chunk: "[GEMINI_CLI_WARNING] PTY execution failed, falling back to child_process. This may be due to sandbox restrictions.\n"
325139
+ chunk: "[GEMINI_CLI_WARNING] PTY execution failed, falling back to child_process. This may be due to terminal exhaustion or sandbox restrictions.\n"
325005
325140
  });
325006
325141
  throw e2;
325007
325142
  } else {
@@ -333969,7 +334104,7 @@ function stripToolCallIdPrefixes(contents) {
333969
334104
  }
333970
334105
  }
333971
334106
  const hasOtherKeys = Object.keys(newPart).some(
333972
- (key) => key !== "text" && key !== "thought" && key !== "callIndex" && newPart[key] !== void 0
334107
+ (key) => key !== "text" && key !== "thought" && key !== "callIndex"
333973
334108
  );
333974
334109
  if (newPart.text !== void 0 && newPart.text === "" && hasOtherKeys) {
333975
334110
  delete newPart.text;
@@ -333977,7 +334112,7 @@ function stripToolCallIdPrefixes(contents) {
333977
334112
  return newPart;
333978
334113
  }).filter((part) => {
333979
334114
  const hasOtherKeys = Object.keys(part).some(
333980
- (key) => key !== "text" && key !== "thought" && key !== "callIndex" && part[key] !== void 0
334115
+ (key) => key !== "text" && key !== "thought" && key !== "callIndex"
333981
334116
  );
333982
334117
  if (part.text !== void 0 && part.text === "" && !hasOtherKeys) {
333983
334118
  return false;
@@ -341495,7 +341630,7 @@ var A2AAuthProviderFactory = class _A2AAuthProviderFactory {
341495
341630
  return provider;
341496
341631
  }
341497
341632
  case "oauth2": {
341498
- const { OAuth2AuthProvider } = await import("./oauth2-provider-CO22I6UM.js");
341633
+ const { OAuth2AuthProvider } = await import("./oauth2-provider-AMXXR72B.js");
341499
341634
  const provider = new OAuth2AuthProvider(
341500
341635
  authConfig,
341501
341636
  options.agentName ?? "unknown",
@@ -402616,6 +402751,7 @@ export {
402616
402751
  detectBOM,
402617
402752
  readFileWithEncoding,
402618
402753
  getSpecificMimeType,
402754
+ canonicalizeMacosPath,
402619
402755
  isWithinRoot,
402620
402756
  getRealPath,
402621
402757
  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-YW7SDLZQ.js";
5
+ } from "./chunk-UMIJZZYQ.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-7ZGWPQVZ.js";
17
+ } from "./chunk-EUYLTRDS.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-S3MXVTTY.js";
20
+ } from "./chunk-RTL6OG34.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
  checkExhaustive
4
- } from "./chunk-S3MXVTTY.js";
4
+ } from "./chunk-FQCNOBUR.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __toESM