@google/gemini-cli 0.66.0-nightly.20261019.ged96faedf → 0.66.0-preview.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 (68) hide show
  1. package/bundle/{chunk-NU74STQ5.js → chunk-3IDBGHHH.js} +9 -1
  2. package/bundle/{chunk-6P5R6RYB.js → chunk-3RUC6ZA6.js} +1 -1
  3. package/bundle/{chunk-R7UPATQC.js → chunk-5ILL3HFF.js} +2 -2
  4. package/bundle/{chunk-L5EUR3NN.js → chunk-7KFTNUNE.js} +9 -1
  5. package/bundle/{chunk-G3S7WMRG.js → chunk-BAGLLEOA.js} +237 -141
  6. package/bundle/{chunk-J5QPCO3J.js → chunk-D4FKL6WQ.js} +7 -7
  7. package/bundle/{chunk-QCWGLPCO.js → chunk-D6WVFS5S.js} +292 -161
  8. package/bundle/{chunk-NAPT3FAL.js → chunk-EONTJM32.js} +7 -7
  9. package/bundle/{chunk-LPQB7ZQE.js → chunk-EZIYD2G6.js} +58 -71
  10. package/bundle/{chunk-ERBSM2HU.js → chunk-GA6BNFA6.js} +3 -3
  11. package/bundle/{chunk-AWUJQFYP.js → chunk-HH6UGBJR.js} +1 -1
  12. package/bundle/{chunk-ZFQ347ZN.js → chunk-I6Q2CIAC.js} +15211 -8012
  13. package/bundle/{chunk-IDCWFZU3.js → chunk-ITTQBJIT.js} +1 -1
  14. package/bundle/{chunk-464WBVYM.js → chunk-LC5SKSCL.js} +1 -1
  15. package/bundle/{chunk-CTWJ3T77.js → chunk-OCM26AU2.js} +2 -2
  16. package/bundle/{chunk-5P6HIACT.js → chunk-OGLIOKXL.js} +3 -3
  17. package/bundle/{chunk-5VQUE3OF.js → chunk-PWTTZOSA.js} +1 -1
  18. package/bundle/{chunk-V5XDOSXJ.js → chunk-RJ3GGOMU.js} +13 -7
  19. package/bundle/{chunk-O5W3WYI5.js → chunk-SZE3LGYD.js} +1 -1
  20. package/bundle/{chunk-RE4V6I3G.js → chunk-TZZ34RGM.js} +1 -1
  21. package/bundle/{chunk-7UDRNCIH.js → chunk-VDKR3AIQ.js} +3 -3
  22. package/bundle/{chunk-YP27UYI4.js → chunk-VN6QPF5Z.js} +1 -1
  23. package/bundle/{chunk-GCW52DLB.js → chunk-XH7KGX2J.js} +2 -2
  24. package/bundle/{chunk-7K5J3ME2.js → chunk-Z3NAT6YU.js} +8 -9
  25. package/bundle/{cleanup-5DK3CVRM.js → cleanup-5UHD34BY.js} +2 -2
  26. package/bundle/{cleanup-6FAZDCL3.js → cleanup-D3DWTLIR.js} +2 -2
  27. package/bundle/{cleanup-WAU2KYGS.js → cleanup-GF4YFJWT.js} +2 -2
  28. package/bundle/{core-AGGXDQOT.js → core-CEUTCQ3Z.js} +3 -1
  29. package/bundle/{dist-2ELAEESC.js → core-GH3VFZSV.js} +3 -1
  30. package/bundle/{devtoolsService-UO6ZB72B.js → devtoolsService-3EKYJHGL.js} +95 -32
  31. package/bundle/{devtoolsService-FBTSVQ57.js → devtoolsService-KQTX22AU.js} +96 -34
  32. package/bundle/{devtoolsService-AWYBM7VP.js → devtoolsService-YPLYVNTF.js} +95 -32
  33. package/bundle/{dist-4PMK5N6W.js → dist-Q63VF7PG.js} +3 -1
  34. package/bundle/docs/cli/plan-mode.md +1 -1
  35. package/bundle/docs/tools/mcp-server.md +6 -0
  36. package/bundle/{gemini-GK2XZNXB.js → gemini-LRDBGCHF.js} +14 -14
  37. package/bundle/{gemini-OUEDCH4P.js → gemini-VE6EAOCY.js} +198 -214
  38. package/bundle/{gemini-DOXUDJDY.js → gemini-WV55NKMQ.js} +13 -13
  39. package/bundle/gemini.js +7 -7
  40. package/bundle/{interactiveCli-7LIKGDTJ.js → interactiveCli-3XUYDTSL.js} +10 -9
  41. package/bundle/{interactiveCli-TG7PGV4V.js → interactiveCli-S5K6P65K.js} +10 -9
  42. package/bundle/{interactiveCli-GZ4N4JS2.js → interactiveCli-U2CP5B64.js} +301 -319
  43. package/bundle/{liteRtServerManager-KAPXZ3EU.js → liteRtServerManager-HYOFIRWR.js} +4 -4
  44. package/bundle/{liteRtServerManager-KJI7ARTA.js → liteRtServerManager-KF2BIFPA.js} +4 -4
  45. package/bundle/{liteRtServerManager-MSJIWMWP.js → liteRtServerManager-RYZUX64K.js} +4 -4
  46. package/bundle/{oauth2-provider-RMF7U2UN.js → oauth2-provider-LVJMV7QY.js} +1 -1
  47. package/bundle/{oauth2-provider-OISPWSWH.js → oauth2-provider-O2MBVTUX.js} +1 -1
  48. package/bundle/{oauth2-provider-ZM5GWCNX.js → oauth2-provider-XAA7HRXL.js} +79 -41
  49. package/bundle/{start-5GIUIER3.js → start-234HHUMV.js} +6 -6
  50. package/bundle/{start-APIVGXZ3.js → start-JWGPML6R.js} +6 -6
  51. package/bundle/{start-GRIS2RDP.js → start-TRMMLCHR.js} +6 -6
  52. package/package.json +1 -1
  53. package/bundle/chunk-5YXWOKC2.js +0 -402181
  54. package/bundle/chunk-CYBHTFCS.js +0 -154
  55. package/bundle/chunk-HDP6V6JI.js +0 -1956
  56. package/bundle/chunk-RACMC24X.js +0 -118
  57. package/bundle/chunk-VGPHCSAB.js +0 -101859
  58. package/bundle/chunk-VXYA6LA4.js +0 -1571
  59. package/bundle/chunk-W6ALEP4H.js +0 -512
  60. package/bundle/chunk-XY2QSBID.js +0 -17603
  61. package/bundle/cleanup-WTTU6IKS.js +0 -32
  62. package/bundle/devtoolsService-TFBVUD5K.js +0 -4359
  63. package/bundle/dist-F22VU44K.js +0 -2280
  64. package/bundle/gemini-XDNOFFX7.js +0 -17970
  65. package/bundle/interactiveCli-MGIJ7GNE.js +0 -35601
  66. package/bundle/liteRtServerManager-OY2ULYPZ.js +0 -65
  67. package/bundle/oauth2-provider-VT6UHLKR.js +0 -273
  68. package/bundle/start-XQGNK32L.js +0 -18
@@ -5,7 +5,7 @@ import {
5
5
  isTelemetrySdkInitialized,
6
6
  resetBrowserSession,
7
7
  shutdownTelemetry
8
- } from "./chunk-ZFQ347ZN.js";
8
+ } from "./chunk-D6WVFS5S.js";
9
9
 
10
10
  // packages/cli/src/utils/cleanup.ts
11
11
  import { promises as fs } from "node:fs";
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  CoreToolCallStatus,
4
4
  checkExhaustive
5
- } from "./chunk-ZFQ347ZN.js";
5
+ } from "./chunk-BAGLLEOA.js";
6
6
  import {
7
7
  __commonJS,
8
8
  __toESM
@@ -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-CYBHTFCS.js";
4
+ } from "./chunk-3RUC6ZA6.js";
5
5
  import {
6
6
  RELEASE_CHANNEL_STABILITY,
7
7
  debugLogger,
@@ -17,7 +17,7 @@ import {
17
17
  require_re,
18
18
  require_semver,
19
19
  require_valid
20
- } from "./chunk-G3S7WMRG.js";
20
+ } from "./chunk-BAGLLEOA.js";
21
21
  import {
22
22
  __commonJS,
23
23
  __toESM
@@ -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-O5W3WYI5.js";
5
+ } from "./chunk-SZE3LGYD.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-V5XDOSXJ.js";
17
+ } from "./chunk-3IDBGHHH.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-G3S7WMRG.js";
20
+ } from "./chunk-D6WVFS5S.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-QCWGLPCO.js";
4
+ } from "./chunk-I6Q2CIAC.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __toESM
@@ -2,8 +2,6 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  AuthProviderType,
4
4
  AuthType,
5
- CoreEvent,
6
- CoreToolCallStatus,
7
5
  DEFAULT_MODEL_CONFIGS,
8
6
  DEFAULT_TRUNCATE_TOOL_OUTPUT_THRESHOLD,
9
7
  EDITOR_OPTIONS,
@@ -33,7 +31,7 @@ import {
33
31
  partListUnionToString,
34
32
  require_strip_json_comments,
35
33
  sanitizeFilenamePart
36
- } from "./chunk-G3S7WMRG.js";
34
+ } from "./chunk-I6Q2CIAC.js";
37
35
  import {
38
36
  __commonJS,
39
37
  __require,
@@ -10291,7 +10289,7 @@ function convertSessionToHistoryFormats(messages) {
10291
10289
  args: tool.args,
10292
10290
  description: tool.description || "",
10293
10291
  renderOutputAsMarkdown: tool.renderOutputAsMarkdown ?? true,
10294
- status: tool.status === "success" ? CoreToolCallStatus.Success : CoreToolCallStatus.Error,
10292
+ status: tool.status === "success" ? "success" /* Success */ : "error" /* Error */,
10295
10293
  resultDisplay: tool.resultDisplay,
10296
10294
  confirmationDetails: void 0
10297
10295
  }))
@@ -15253,6 +15251,10 @@ var SETTINGS_SCHEMA_DEFINITIONS = {
15253
15251
  authorizationResponseIssParameterSupported: {
15254
15252
  type: "boolean",
15255
15253
  description: 'Whether the authorization server returns the "iss" parameter in the authorization response (RFC 9207). When true, callbacks without "iss" are rejected; when false, they are accepted. A provided "iss" is always validated. Overrides the "authorization_response_iss_parameter_supported" value discovered from server metadata.'
15254
+ },
15255
+ allowPrivateNetwork: {
15256
+ type: "boolean",
15257
+ description: "Allow OAuth endpoints on private enterprise networks (RFC 1918, RFC 6598, RFC 4193, .internal, .local)."
15256
15258
  }
15257
15259
  }
15258
15260
  },
@@ -15320,6 +15322,10 @@ var SETTINGS_SCHEMA_DEFINITIONS = {
15320
15322
  authorizationResponseIssParameterSupported: {
15321
15323
  type: "boolean",
15322
15324
  description: 'Whether the authorization server returns the "iss" parameter in the authorization response (RFC 9207). When true, callbacks without "iss" are rejected; when false, they are accepted. A provided "iss" is always validated. Overrides the "authorization_response_iss_parameter_supported" value discovered from server metadata.'
15325
+ },
15326
+ allowPrivateNetwork: {
15327
+ type: "boolean",
15328
+ description: "Allow OAuth endpoints on private enterprise networks (RFC 1918, RFC 6598, RFC 4193, .internal, .local)."
15323
15329
  }
15324
15330
  }
15325
15331
  },
@@ -16454,8 +16460,8 @@ var LoadedSettings = class {
16454
16460
  // React will pass a listener fn into this subscribe fn
16455
16461
  // that listener fn will perform an object identity check on the snapshot and trigger a React re render if the snapshot has changed
16456
16462
  subscribe(listener) {
16457
- coreEvents.on(CoreEvent.SettingsChanged, listener);
16458
- return () => coreEvents.off(CoreEvent.SettingsChanged, listener);
16463
+ coreEvents.on("settings-changed" /* SettingsChanged */, listener);
16464
+ return () => coreEvents.off("settings-changed" /* SettingsChanged */, listener);
16459
16465
  }
16460
16466
  getSnapshot() {
16461
16467
  return this._snapshot;
@@ -16607,7 +16613,7 @@ function setUpCloudShellEnvironment(envFilePath, isTrusted, isSandboxed, selecte
16607
16613
  }
16608
16614
  }
16609
16615
  let value = "cloudshell-gca";
16610
- if (selectedAuthType === AuthType.USE_VERTEX_AI) {
16616
+ if (selectedAuthType === "vertex-ai" /* USE_VERTEX_AI */) {
16611
16617
  value = process2.env[USER_GCP_PROJECT];
16612
16618
  }
16613
16619
  if (envFilePath && fs4.existsSync(envFilePath)) {
@@ -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-CYBHTFCS.js";
4
+ } from "./chunk-ITTQBJIT.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require
@@ -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-YP27UYI4.js";
4
+ } from "./chunk-VN6QPF5Z.js";
5
5
  import {
6
6
  __commonJS,
7
7
  __require
@@ -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-AWUJQFYP.js";
5
+ } from "./chunk-HH6UGBJR.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-L5EUR3NN.js";
17
+ } from "./chunk-7KFTNUNE.js";
18
18
  import {
19
19
  debugLogger
20
- } from "./chunk-5YXWOKC2.js";
20
+ } from "./chunk-BAGLLEOA.js";
21
21
  import {
22
22
  __toESM
23
23
  } from "./chunk-34MYV7JD.js";
@@ -5,7 +5,7 @@ import {
5
5
  isTelemetrySdkInitialized,
6
6
  resetBrowserSession,
7
7
  shutdownTelemetry
8
- } from "./chunk-QCWGLPCO.js";
8
+ } from "./chunk-I6Q2CIAC.js";
9
9
 
10
10
  // packages/cli/src/utils/cleanup.ts
11
11
  import { promises as fs } from "node:fs";
@@ -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-6P5R6RYB.js";
4
+ } from "./chunk-VN6QPF5Z.js";
5
5
  import {
6
6
  RELEASE_CHANNEL_STABILITY,
7
7
  debugLogger,
@@ -17,7 +17,7 @@ import {
17
17
  require_re,
18
18
  require_semver,
19
19
  require_valid
20
- } from "./chunk-5YXWOKC2.js";
20
+ } from "./chunk-I6Q2CIAC.js";
21
21
  import {
22
22
  __commonJS,
23
23
  __toESM
@@ -1,8 +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
- CoreToolCallStatus,
4
3
  checkExhaustive
5
- } from "./chunk-5YXWOKC2.js";
4
+ } from "./chunk-D6WVFS5S.js";
6
5
  import {
7
6
  __commonJS,
8
7
  __toESM
@@ -465,19 +464,19 @@ var require_react = __commonJS({
465
464
  var import_react = __toESM(require_react(), 1);
466
465
  function mapCoreStatusToDisplayStatus(coreStatus) {
467
466
  switch (coreStatus) {
468
- case CoreToolCallStatus.Validating:
467
+ case "validating" /* Validating */:
469
468
  return "Pending" /* Pending */;
470
- case CoreToolCallStatus.AwaitingApproval:
469
+ case "awaiting_approval" /* AwaitingApproval */:
471
470
  return "Confirming" /* Confirming */;
472
- case CoreToolCallStatus.Executing:
471
+ case "executing" /* Executing */:
473
472
  return "Executing" /* Executing */;
474
- case CoreToolCallStatus.Success:
473
+ case "success" /* Success */:
475
474
  return "Success" /* Success */;
476
- case CoreToolCallStatus.Cancelled:
475
+ case "cancelled" /* Cancelled */:
477
476
  return "Canceled" /* Canceled */;
478
- case CoreToolCallStatus.Error:
477
+ case "error" /* Error */:
479
478
  return "Error" /* Error */;
480
- case CoreToolCallStatus.Scheduled:
479
+ case "scheduled" /* Scheduled */:
481
480
  return "Pending" /* Pending */;
482
481
  default:
483
482
  return checkExhaustive(coreStatus);
@@ -11,8 +11,8 @@ import {
11
11
  runSyncCleanup,
12
12
  setupSignalHandlers,
13
13
  setupTtyCheck
14
- } from "./chunk-CYBHTFCS.js";
15
- import "./chunk-G3S7WMRG.js";
14
+ } from "./chunk-ITTQBJIT.js";
15
+ import "./chunk-D6WVFS5S.js";
16
16
  import "./chunk-664ZODQF.js";
17
17
  import "./chunk-IUUIT4SU.js";
18
18
  import "./chunk-L6PII3GR.js";
@@ -11,8 +11,8 @@ import {
11
11
  runSyncCleanup,
12
12
  setupSignalHandlers,
13
13
  setupTtyCheck
14
- } from "./chunk-YP27UYI4.js";
15
- import "./chunk-QCWGLPCO.js";
14
+ } from "./chunk-3RUC6ZA6.js";
15
+ import "./chunk-BAGLLEOA.js";
16
16
  import "./chunk-664ZODQF.js";
17
17
  import "./chunk-IUUIT4SU.js";
18
18
  import "./chunk-L6PII3GR.js";
@@ -11,8 +11,8 @@ import {
11
11
  runSyncCleanup,
12
12
  setupSignalHandlers,
13
13
  setupTtyCheck
14
- } from "./chunk-IDCWFZU3.js";
15
- import "./chunk-ZFQ347ZN.js";
14
+ } from "./chunk-VN6QPF5Z.js";
15
+ import "./chunk-I6Q2CIAC.js";
16
16
  import "./chunk-664ZODQF.js";
17
17
  import "./chunk-IUUIT4SU.js";
18
18
  import "./chunk-L6PII3GR.js";
@@ -831,6 +831,7 @@ import {
831
831
  isEditorAvailableAsync,
832
832
  isEmpty,
833
833
  isEnabled,
834
+ isEnterprisePrivateAddress,
834
835
  isFatalToolError,
835
836
  isFileAndDirectorySecureSync,
836
837
  isFileDiff,
@@ -1133,7 +1134,7 @@ import {
1133
1134
  wrapWithSynchronizedOutput,
1134
1135
  writeToStderr,
1135
1136
  writeToStdout
1136
- } from "./chunk-QCWGLPCO.js";
1137
+ } from "./chunk-D6WVFS5S.js";
1137
1138
  import "./chunk-664ZODQF.js";
1138
1139
  import {
1139
1140
  SpanStatusCode,
@@ -1974,6 +1975,7 @@ export {
1974
1975
  isEditorAvailableAsync,
1975
1976
  isEmpty,
1976
1977
  isEnabled,
1978
+ isEnterprisePrivateAddress,
1977
1979
  isFatalToolError,
1978
1980
  isFileAndDirectorySecureSync,
1979
1981
  isFileDiff,
@@ -831,6 +831,7 @@ import {
831
831
  isEditorAvailableAsync,
832
832
  isEmpty,
833
833
  isEnabled,
834
+ isEnterprisePrivateAddress,
834
835
  isFatalToolError,
835
836
  isFileAndDirectorySecureSync,
836
837
  isFileDiff,
@@ -1133,7 +1134,7 @@ import {
1133
1134
  wrapWithSynchronizedOutput,
1134
1135
  writeToStderr,
1135
1136
  writeToStdout
1136
- } from "./chunk-ZFQ347ZN.js";
1137
+ } from "./chunk-I6Q2CIAC.js";
1137
1138
  import "./chunk-664ZODQF.js";
1138
1139
  import {
1139
1140
  SpanStatusCode,
@@ -1974,6 +1975,7 @@ export {
1974
1975
  isEditorAvailableAsync,
1975
1976
  isEmpty,
1976
1977
  isEnabled,
1978
+ isEnterprisePrivateAddress,
1977
1979
  isFatalToolError,
1978
1980
  isFileAndDirectorySecureSync,
1979
1981
  isFileDiff,
@@ -2,7 +2,7 @@ const require = (await import('node:module')).createRequire(import.meta.url); co
2
2
  import {
3
3
  coreEvents,
4
4
  debugLogger
5
- } from "./chunk-QCWGLPCO.js";
5
+ } from "./chunk-I6Q2CIAC.js";
6
6
  import "./chunk-664ZODQF.js";
7
7
  import "./chunk-IUUIT4SU.js";
8
8
  import "./chunk-L6PII3GR.js";
@@ -3520,6 +3520,7 @@ import zlib from "node:zlib";
3520
3520
  import fs from "node:fs";
3521
3521
  import path from "node:path";
3522
3522
  import { EventEmitter } from "node:events";
3523
+ import { StringDecoder } from "node:string_decoder";
3523
3524
  var ACTIVITY_ID_HEADER = "x-activity-request-id";
3524
3525
  var MAX_BUFFER_SIZE = 100;
3525
3526
  function isHeaderRecord(h) {
@@ -3885,49 +3886,111 @@ var ActivityLogger = class _ActivityLogger extends EventEmitter {
3885
3886
  };
3886
3887
  req.on("response", (res) => {
3887
3888
  const responseChunks = [];
3889
+ const decompressedChunks = [];
3890
+ const decoder = new StringDecoder("utf8");
3888
3891
  let chunkIndex = 0;
3889
- res.on("data", (chunk) => {
3890
- const chunkBuffer = Buffer.from(chunk);
3891
- responseChunks.push(chunkBuffer);
3892
+ const emitChunk = (chunkData) => {
3893
+ if (!chunkData) return;
3892
3894
  self.safeEmitNetwork({
3893
3895
  id,
3894
3896
  pending: true,
3895
3897
  chunk: {
3896
3898
  index: chunkIndex++,
3897
- data: chunkBuffer.toString("utf8"),
3899
+ data: chunkData,
3898
3900
  timestamp: Date.now()
3899
3901
  }
3900
3902
  });
3903
+ };
3904
+ let responseEmitted = false;
3905
+ const processBuffer = (finalBuffer) => {
3906
+ if (responseEmitted) return;
3907
+ responseEmitted = true;
3908
+ const resBody = finalBuffer.toString("utf8");
3909
+ const startTime = self.requestStartTimes.get(id);
3910
+ const durationMs = startTime ? Date.now() - startTime : 0;
3911
+ self.requestStartTimes.delete(id);
3912
+ self.safeEmitNetwork({
3913
+ id,
3914
+ pending: false,
3915
+ response: {
3916
+ status: res.statusCode || 0,
3917
+ headers: self.stringifyHeaders(res.headers),
3918
+ body: resBody,
3919
+ durationMs
3920
+ }
3921
+ });
3922
+ };
3923
+ const rawEncoding = res.headers["content-encoding"];
3924
+ const encoding = typeof rawEncoding === "string" ? rawEncoding.toLowerCase().trim() : "";
3925
+ let decompressor = null;
3926
+ if (encoding === "gzip" || encoding === "x-gzip") {
3927
+ decompressor = zlib.createGunzip({
3928
+ flush: zlib.constants.Z_SYNC_FLUSH
3929
+ });
3930
+ } else if (encoding === "deflate") {
3931
+ decompressor = zlib.createInflate({
3932
+ flush: zlib.constants.Z_SYNC_FLUSH
3933
+ });
3934
+ }
3935
+ let decompressionFailed = false;
3936
+ let responseEnded = false;
3937
+ if (decompressor) {
3938
+ decompressor.on("data", (decompressedChunk) => {
3939
+ if (decompressionFailed || responseEmitted) return;
3940
+ decompressedChunks.push(decompressedChunk);
3941
+ emitChunk(decoder.write(decompressedChunk));
3942
+ });
3943
+ decompressor.on("end", () => {
3944
+ if (decompressionFailed || responseEmitted) return;
3945
+ emitChunk(decoder.end());
3946
+ processBuffer(Buffer.concat(decompressedChunks));
3947
+ });
3948
+ decompressor.on("error", () => {
3949
+ decompressionFailed = true;
3950
+ if (responseEnded) {
3951
+ processBuffer(Buffer.concat(responseChunks));
3952
+ }
3953
+ });
3954
+ decompressor.on("close", () => {
3955
+ if (responseEnded && !responseEmitted) {
3956
+ processBuffer(Buffer.concat(responseChunks));
3957
+ }
3958
+ });
3959
+ }
3960
+ res.on("data", (chunk) => {
3961
+ const chunkBuffer = Buffer.from(chunk);
3962
+ responseChunks.push(chunkBuffer);
3963
+ if (decompressor) {
3964
+ if (!decompressionFailed && !decompressor.destroyed && !decompressor.writableEnded) {
3965
+ try {
3966
+ decompressor.write(chunkBuffer);
3967
+ } catch {
3968
+ decompressionFailed = true;
3969
+ if (responseEnded) {
3970
+ processBuffer(Buffer.concat(responseChunks));
3971
+ }
3972
+ }
3973
+ }
3974
+ } else {
3975
+ emitChunk(decoder.write(chunkBuffer));
3976
+ }
3901
3977
  });
3902
3978
  res.on("end", () => {
3903
- const buffer = Buffer.concat(responseChunks);
3904
- const encoding = res.headers["content-encoding"];
3905
- const processBuffer = (finalBuffer) => {
3906
- const resBody = finalBuffer.toString("utf8");
3907
- const startTime = self.requestStartTimes.get(id);
3908
- const durationMs = startTime ? Date.now() - startTime : 0;
3909
- self.requestStartTimes.delete(id);
3910
- self.safeEmitNetwork({
3911
- id,
3912
- pending: false,
3913
- response: {
3914
- status: res.statusCode || 0,
3915
- headers: self.stringifyHeaders(res.headers),
3916
- body: resBody,
3917
- durationMs
3979
+ responseEnded = true;
3980
+ if (decompressor) {
3981
+ if (decompressionFailed || decompressor.destroyed || decompressor.writableEnded) {
3982
+ processBuffer(Buffer.concat(responseChunks));
3983
+ } else {
3984
+ try {
3985
+ decompressor.end();
3986
+ } catch {
3987
+ decompressionFailed = true;
3988
+ processBuffer(Buffer.concat(responseChunks));
3918
3989
  }
3919
- });
3920
- };
3921
- if (encoding === "gzip") {
3922
- zlib.gunzip(buffer, (err, decompressed) => {
3923
- processBuffer(err ? buffer : decompressed);
3924
- });
3925
- } else if (encoding === "deflate") {
3926
- zlib.inflate(buffer, (err, decompressed) => {
3927
- processBuffer(err ? buffer : decompressed);
3928
- });
3990
+ }
3929
3991
  } else {
3930
- processBuffer(buffer);
3992
+ emitChunk(decoder.end());
3993
+ processBuffer(Buffer.concat(responseChunks));
3931
3994
  }
3932
3995
  });
3933
3996
  });
@@ -4324,7 +4387,7 @@ async function toggleDevToolsPanel(config, isOpen, toggle, setOpen) {
4324
4387
  return;
4325
4388
  }
4326
4389
  try {
4327
- const { openBrowserSecurely, shouldLaunchBrowser } = await import("./core-AGGXDQOT.js");
4390
+ const { openBrowserSecurely, shouldLaunchBrowser } = await import("./core-GH3VFZSV.js");
4328
4391
  const url = await startDevToolsServer(config);
4329
4392
  if (shouldLaunchBrowser()) {
4330
4393
  try {