reasonix 0.47.2 → 0.48.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 (129) hide show
  1. package/README.md +14 -26
  2. package/README.zh-CN.md +5 -26
  3. package/dist/cli/{acp-GEOAKSTU.js → acp-QJGGHQLA.js} +52 -135
  4. package/dist/cli/acp-QJGGHQLA.js.map +1 -0
  5. package/dist/cli/{chat-YTPATMMG.js → chat-ZXF227MP.js} +25 -25
  6. package/dist/cli/{chunk-DN4B5S6Y.js → chunk-3FULTFRB.js} +2 -2
  7. package/dist/cli/chunk-43ROGEX2.js +5190 -0
  8. package/dist/cli/chunk-43ROGEX2.js.map +1 -0
  9. package/dist/cli/{chunk-DQ6K5ZQ7.js → chunk-4E2BHJU4.js} +4 -4
  10. package/dist/cli/chunk-4E2BHJU4.js.map +1 -0
  11. package/dist/cli/{chunk-T5A7EY6B.js → chunk-5AW6NIHU.js} +2 -2
  12. package/dist/cli/{chunk-DWPAKZTY.js → chunk-5U5LMMFF.js} +2 -2
  13. package/dist/cli/{chunk-TRSAHHCL.js → chunk-6FRNXWDZ.js} +321 -76
  14. package/dist/cli/chunk-6FRNXWDZ.js.map +1 -0
  15. package/dist/cli/{chunk-KYQVQ5X4.js → chunk-B5CZL2SE.js} +9 -4
  16. package/dist/cli/chunk-B5CZL2SE.js.map +1 -0
  17. package/dist/cli/{chunk-XMHP7BEE.js → chunk-DABAOQSV.js} +2273 -2517
  18. package/dist/cli/chunk-DABAOQSV.js.map +1 -0
  19. package/dist/cli/chunk-EO6RPTJG.js +831 -0
  20. package/dist/cli/chunk-EO6RPTJG.js.map +1 -0
  21. package/dist/cli/{chunk-BQ6HC66J.js → chunk-FD7SNDWW.js} +4 -14
  22. package/dist/cli/chunk-FD7SNDWW.js.map +1 -0
  23. package/dist/cli/chunk-FPME5QOO.js +17747 -0
  24. package/dist/cli/chunk-FPME5QOO.js.map +1 -0
  25. package/dist/cli/{chunk-6QC5RQLE.js → chunk-H2F4LDNH.js} +2 -2
  26. package/dist/cli/{chunk-QCFLPSPH.js → chunk-IKSYVBBZ.js} +2 -2
  27. package/dist/cli/{chunk-5QCB62C4.js → chunk-J2TQAWOM.js} +135 -18
  28. package/dist/cli/{chunk-5QCB62C4.js.map → chunk-J2TQAWOM.js.map} +1 -1
  29. package/dist/cli/{chunk-JBH5RM7X.js → chunk-JFBGSWQB.js} +395 -85
  30. package/dist/cli/chunk-JFBGSWQB.js.map +1 -0
  31. package/dist/cli/{chunk-CCJAP7G3.js → chunk-KH5JIJJD.js} +2 -2
  32. package/dist/cli/{chunk-TDHXB2ER.js → chunk-NQZ5U37J.js} +2 -2
  33. package/dist/cli/{chunk-CNG32VAB.js → chunk-O3AGYTG2.js} +2 -2
  34. package/dist/cli/{chunk-NRQ5UP5T.js → chunk-PIC5HJRD.js} +234 -40
  35. package/dist/cli/chunk-PIC5HJRD.js.map +1 -0
  36. package/dist/cli/{chunk-GH7DC2Y5.js → chunk-PJIQIYTV.js} +6 -3
  37. package/dist/cli/chunk-PJIQIYTV.js.map +1 -0
  38. package/dist/cli/{chunk-KVZZ5U75.js → chunk-R7U44O3Y.js} +2 -2
  39. package/dist/cli/{chunk-ZXSCAODE.js → chunk-RCLS63KE.js} +71 -3
  40. package/dist/cli/chunk-RCLS63KE.js.map +1 -0
  41. package/dist/cli/{chunk-FY4S7TJZ.js → chunk-SLAFMXAZ.js} +10 -2
  42. package/dist/cli/chunk-SLAFMXAZ.js.map +1 -0
  43. package/dist/cli/{chunk-TRWHTFG7.js → chunk-SWUMD2LX.js} +2 -2
  44. package/dist/cli/{chunk-2XY77LW7.js → chunk-TIJ4ZHD6.js} +56 -24
  45. package/dist/cli/chunk-TIJ4ZHD6.js.map +1 -0
  46. package/dist/cli/{chunk-4MFCAZ2W.js → chunk-WKOXKCF3.js} +3 -3
  47. package/dist/cli/{chunk-HUILPCYX.js → chunk-XMR2VCGT.js} +3 -3
  48. package/dist/cli/{code-Q4NRVEDG.js → code-OKA5YPOH.js} +31 -32
  49. package/dist/cli/code-OKA5YPOH.js.map +1 -0
  50. package/dist/cli/{commands-4CDI4GFM.js → commands-3U6PUVSS.js} +4 -4
  51. package/dist/cli/{commit-GW7LDQP5.js → commit-HFB7SRBU.js} +3 -3
  52. package/dist/cli/{desktop-EG6P5SF2.js → desktop-G7UMW3CJ.js} +503 -48
  53. package/dist/cli/desktop-G7UMW3CJ.js.map +1 -0
  54. package/dist/cli/{diff-VI2YX4FN.js → diff-PGXW4YZD.js} +8 -8
  55. package/dist/cli/{doctor-CQTTZP27.js → doctor-WWJFLVCB.js} +9 -9
  56. package/dist/cli/index.js +53 -41
  57. package/dist/cli/index.js.map +1 -1
  58. package/dist/cli/{mcp-J2UCD4RZ.js → mcp-Y3VKIK3T.js} +2 -2
  59. package/dist/cli/{mcp-browse-GSX34JEK.js → mcp-browse-4IN2QIFR.js} +2 -2
  60. package/dist/cli/{mcp-inspect-RRFYF4ZV.js → mcp-inspect-BUXFXDHB.js} +2 -2
  61. package/dist/cli/{prompt-5TQPIVHV.js → prompt-US57R6BA.js} +5 -4
  62. package/dist/cli/{replay-MJCEMODU.js → replay-EQJMZRB3.js} +8 -8
  63. package/dist/cli/{run-P4D5VDYE.js → run-KVEI66TR.js} +14 -14
  64. package/dist/cli/{server-C25JNNZV.js → server-D6C4GHWN.js} +18 -15
  65. package/dist/cli/server-D6C4GHWN.js.map +1 -0
  66. package/dist/cli/{sessions-QIONZJQ6.js → sessions-TGVS2RQZ.js} +13 -13
  67. package/dist/cli/{setup-NLQ6G5G4.js → setup-WLKX6GGG.js} +5 -5
  68. package/dist/cli/{stats-DFZEXHP4.js → stats-TCD7Q6MB.js} +6 -6
  69. package/dist/cli/{version-GR3X3MPI.js → version-BCWWS2OU.js} +13 -13
  70. package/dist/grammars/tree-sitter-go.wasm +0 -0
  71. package/dist/grammars/tree-sitter-java.wasm +0 -0
  72. package/dist/grammars/tree-sitter-javascript.wasm +0 -0
  73. package/dist/grammars/tree-sitter-python.wasm +0 -0
  74. package/dist/grammars/tree-sitter-rust.wasm +0 -0
  75. package/dist/grammars/tree-sitter-tsx.wasm +0 -0
  76. package/dist/grammars/tree-sitter-typescript.wasm +0 -0
  77. package/dist/grammars/web-tree-sitter.wasm +0 -0
  78. package/dist/index.d.ts +46 -12
  79. package/dist/index.js +684 -129
  80. package/dist/index.js.map +1 -1
  81. package/package.json +16 -4
  82. package/dist/cli/acp-GEOAKSTU.js.map +0 -1
  83. package/dist/cli/chunk-2XY77LW7.js.map +0 -1
  84. package/dist/cli/chunk-6CRPCJAU.js +0 -3141
  85. package/dist/cli/chunk-6CRPCJAU.js.map +0 -1
  86. package/dist/cli/chunk-BQ6HC66J.js.map +0 -1
  87. package/dist/cli/chunk-DQ6K5ZQ7.js.map +0 -1
  88. package/dist/cli/chunk-FY4S7TJZ.js.map +0 -1
  89. package/dist/cli/chunk-GH7DC2Y5.js.map +0 -1
  90. package/dist/cli/chunk-JBH5RM7X.js.map +0 -1
  91. package/dist/cli/chunk-KYQVQ5X4.js.map +0 -1
  92. package/dist/cli/chunk-NRQ5UP5T.js.map +0 -1
  93. package/dist/cli/chunk-TRSAHHCL.js.map +0 -1
  94. package/dist/cli/chunk-XD6P7AFH.js +0 -375
  95. package/dist/cli/chunk-XD6P7AFH.js.map +0 -1
  96. package/dist/cli/chunk-XMHP7BEE.js.map +0 -1
  97. package/dist/cli/chunk-YFP3MYMY.js +0 -323
  98. package/dist/cli/chunk-YFP3MYMY.js.map +0 -1
  99. package/dist/cli/chunk-ZXSCAODE.js.map +0 -1
  100. package/dist/cli/code-Q4NRVEDG.js.map +0 -1
  101. package/dist/cli/desktop-EG6P5SF2.js.map +0 -1
  102. package/dist/cli/server-C25JNNZV.js.map +0 -1
  103. /package/dist/cli/{chat-YTPATMMG.js.map → chat-ZXF227MP.js.map} +0 -0
  104. /package/dist/cli/{chunk-DN4B5S6Y.js.map → chunk-3FULTFRB.js.map} +0 -0
  105. /package/dist/cli/{chunk-T5A7EY6B.js.map → chunk-5AW6NIHU.js.map} +0 -0
  106. /package/dist/cli/{chunk-DWPAKZTY.js.map → chunk-5U5LMMFF.js.map} +0 -0
  107. /package/dist/cli/{chunk-6QC5RQLE.js.map → chunk-H2F4LDNH.js.map} +0 -0
  108. /package/dist/cli/{chunk-QCFLPSPH.js.map → chunk-IKSYVBBZ.js.map} +0 -0
  109. /package/dist/cli/{chunk-CCJAP7G3.js.map → chunk-KH5JIJJD.js.map} +0 -0
  110. /package/dist/cli/{chunk-TDHXB2ER.js.map → chunk-NQZ5U37J.js.map} +0 -0
  111. /package/dist/cli/{chunk-CNG32VAB.js.map → chunk-O3AGYTG2.js.map} +0 -0
  112. /package/dist/cli/{chunk-KVZZ5U75.js.map → chunk-R7U44O3Y.js.map} +0 -0
  113. /package/dist/cli/{chunk-TRWHTFG7.js.map → chunk-SWUMD2LX.js.map} +0 -0
  114. /package/dist/cli/{chunk-4MFCAZ2W.js.map → chunk-WKOXKCF3.js.map} +0 -0
  115. /package/dist/cli/{chunk-HUILPCYX.js.map → chunk-XMR2VCGT.js.map} +0 -0
  116. /package/dist/cli/{commands-4CDI4GFM.js.map → commands-3U6PUVSS.js.map} +0 -0
  117. /package/dist/cli/{commit-GW7LDQP5.js.map → commit-HFB7SRBU.js.map} +0 -0
  118. /package/dist/cli/{diff-VI2YX4FN.js.map → diff-PGXW4YZD.js.map} +0 -0
  119. /package/dist/cli/{doctor-CQTTZP27.js.map → doctor-WWJFLVCB.js.map} +0 -0
  120. /package/dist/cli/{mcp-J2UCD4RZ.js.map → mcp-Y3VKIK3T.js.map} +0 -0
  121. /package/dist/cli/{mcp-browse-GSX34JEK.js.map → mcp-browse-4IN2QIFR.js.map} +0 -0
  122. /package/dist/cli/{mcp-inspect-RRFYF4ZV.js.map → mcp-inspect-BUXFXDHB.js.map} +0 -0
  123. /package/dist/cli/{prompt-5TQPIVHV.js.map → prompt-US57R6BA.js.map} +0 -0
  124. /package/dist/cli/{replay-MJCEMODU.js.map → replay-EQJMZRB3.js.map} +0 -0
  125. /package/dist/cli/{run-P4D5VDYE.js.map → run-KVEI66TR.js.map} +0 -0
  126. /package/dist/cli/{sessions-QIONZJQ6.js.map → sessions-TGVS2RQZ.js.map} +0 -0
  127. /package/dist/cli/{setup-NLQ6G5G4.js.map → setup-WLKX6GGG.js.map} +0 -0
  128. /package/dist/cli/{stats-DFZEXHP4.js.map → stats-TCD7Q6MB.js.map} +0 -0
  129. /package/dist/cli/{version-GR3X3MPI.js.map → version-BCWWS2OU.js.map} +0 -0
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
3
  import {
4
4
  computeReplayStats
5
- } from "./chunk-HUILPCYX.js";
5
+ } from "./chunk-XMR2VCGT.js";
6
6
 
7
7
  // src/transcript/diff.ts
8
8
  function findNextDivergence(pairs, fromIdx) {
@@ -305,4 +305,4 @@ export {
305
305
  renderSummaryTable,
306
306
  renderMarkdown
307
307
  };
308
- //# sourceMappingURL=chunk-6QC5RQLE.js.map
308
+ //# sourceMappingURL=chunk-H2F4LDNH.js.map
@@ -2,7 +2,7 @@
2
2
  import { createRequire as __cr } from 'node:module'; if (typeof globalThis.require === 'undefined') { globalThis.require = __cr(import.meta.url); }
3
3
  import {
4
4
  loadPricingOverride
5
- } from "./chunk-6CRPCJAU.js";
5
+ } from "./chunk-FPME5QOO.js";
6
6
 
7
7
  // src/telemetry/stats.ts
8
8
  var DEEPSEEK_PRICING = {
@@ -160,4 +160,4 @@ export {
160
160
  claudeEquivalentCost,
161
161
  SessionStats
162
162
  };
163
- //# sourceMappingURL=chunk-QCFLPSPH.js.map
163
+ //# sourceMappingURL=chunk-IKSYVBBZ.js.map
@@ -9659,7 +9659,7 @@ var require_agent = __commonJS({
9659
9659
  function defaultFactory(origin, opts) {
9660
9660
  return opts && opts.connections === 1 ? new Client(origin, opts) : new Pool(origin, opts);
9661
9661
  }
9662
- var Agent = class extends DispatcherBase {
9662
+ var Agent2 = class extends DispatcherBase {
9663
9663
  constructor({ factory = defaultFactory, maxOrigins = Infinity, connect, ...options } = {}) {
9664
9664
  if (typeof factory !== "function") {
9665
9665
  throw new InvalidArgumentError("factory must be a function.");
@@ -9773,7 +9773,7 @@ var require_agent = __commonJS({
9773
9773
  return allClientStats;
9774
9774
  }
9775
9775
  };
9776
- module.exports = Agent;
9776
+ module.exports = Agent2;
9777
9777
  }
9778
9778
  });
9779
9779
 
@@ -10559,7 +10559,7 @@ var require_proxy_agent = __commonJS({
10559
10559
  "node_modules/undici/lib/dispatcher/proxy-agent.js"(exports, module) {
10560
10560
  "use strict";
10561
10561
  var { kProxy, kClose, kDestroy, kDispatch } = require_symbols();
10562
- var Agent = require_agent();
10562
+ var Agent2 = require_agent();
10563
10563
  var Pool = require_pool();
10564
10564
  var DispatcherBase = require_dispatcher_base();
10565
10565
  var { InvalidArgumentError, RequestAbortedError, SecureProxyConnectionError } = require_errors();
@@ -10693,7 +10693,7 @@ var require_proxy_agent = __commonJS({
10693
10693
  } else {
10694
10694
  this[kClient] = clientFactory(url, { connect });
10695
10695
  }
10696
- this[kAgent] = new Agent({
10696
+ this[kAgent] = new Agent2({
10697
10697
  ...opts,
10698
10698
  factory,
10699
10699
  connect: async (opts2, callback) => {
@@ -10822,7 +10822,7 @@ var require_env_http_proxy_agent = __commonJS({
10822
10822
  var DispatcherBase = require_dispatcher_base();
10823
10823
  var { kClose, kDestroy, kClosed, kDestroyed, kDispatch, kNoProxyAgent, kHttpProxyAgent, kHttpsProxyAgent } = require_symbols();
10824
10824
  var ProxyAgent2 = require_proxy_agent();
10825
- var Agent = require_agent();
10825
+ var Agent2 = require_agent();
10826
10826
  var DEFAULT_PORTS = {
10827
10827
  "http:": 80,
10828
10828
  "https:": 443
@@ -10835,7 +10835,7 @@ var require_env_http_proxy_agent = __commonJS({
10835
10835
  super();
10836
10836
  this.#opts = opts;
10837
10837
  const { httpProxy, httpsProxy, noProxy, ...agentOpts } = opts;
10838
- this[kNoProxyAgent] = new Agent(agentOpts);
10838
+ this[kNoProxyAgent] = new Agent2(agentOpts);
10839
10839
  const HTTP_PROXY = httpProxy ?? process.env.http_proxy ?? process.env.HTTP_PROXY;
10840
10840
  if (HTTP_PROXY) {
10841
10841
  this[kHttpProxyAgent] = new ProxyAgent2({ ...agentOpts, uri: HTTP_PROXY });
@@ -13543,7 +13543,7 @@ var require_mock_agent = __commonJS({
13543
13543
  "node_modules/undici/lib/mock/mock-agent.js"(exports, module) {
13544
13544
  "use strict";
13545
13545
  var { kClients } = require_symbols();
13546
- var Agent = require_agent();
13546
+ var Agent2 = require_agent();
13547
13547
  var {
13548
13548
  kAgent,
13549
13549
  kMockAgentSet,
@@ -13581,7 +13581,7 @@ var require_mock_agent = __commonJS({
13581
13581
  if (opts?.agent && typeof opts.agent.dispatch !== "function") {
13582
13582
  throw new InvalidArgumentError("Argument opts.agent must implement Agent");
13583
13583
  }
13584
- const agent = opts?.agent ? opts.agent : new Agent(opts);
13584
+ const agent = opts?.agent ? opts.agent : new Agent2(opts);
13585
13585
  this[kAgent] = agent;
13586
13586
  this[kClients] = agent[kClients];
13587
13587
  this[kOptions] = mockOptions;
@@ -14188,7 +14188,7 @@ var require_snapshot_recorder = __commonJS({
14188
14188
  var require_snapshot_agent = __commonJS({
14189
14189
  "node_modules/undici/lib/mock/snapshot-agent.js"(exports, module) {
14190
14190
  "use strict";
14191
- var Agent = require_agent();
14191
+ var Agent2 = require_agent();
14192
14192
  var MockAgent = require_mock_agent();
14193
14193
  var { SnapshotRecorder } = require_snapshot_recorder();
14194
14194
  var { InvalidArgumentError, UndiciError } = require_errors();
@@ -14239,7 +14239,7 @@ var require_snapshot_agent = __commonJS({
14239
14239
  });
14240
14240
  this[kSnapshotLoaded] = false;
14241
14241
  if (this[kSnapshotMode] === "record" || this[kSnapshotMode] === "update" || this[kSnapshotMode] === "playback" && opts.excludeUrls && opts.excludeUrls.length > 0) {
14242
- this[kRealAgent] = new Agent(opts);
14242
+ this[kRealAgent] = new Agent2(opts);
14243
14243
  }
14244
14244
  if ((this[kSnapshotMode] === "playback" || this[kSnapshotMode] === "update") && this[kSnapshotPath]) {
14245
14245
  this.loadSnapshots().catch(() => {
@@ -14484,10 +14484,10 @@ var require_global2 = __commonJS({
14484
14484
  var globalDispatcher = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.2");
14485
14485
  var legacyGlobalDispatcher = /* @__PURE__ */ Symbol.for("undici.globalDispatcher.1");
14486
14486
  var { InvalidArgumentError } = require_errors();
14487
- var Agent = require_agent();
14487
+ var Agent2 = require_agent();
14488
14488
  var Dispatcher1Wrapper = require_dispatcher1_wrapper();
14489
14489
  if (getGlobalDispatcher() === void 0) {
14490
- setGlobalDispatcher2(new Agent());
14490
+ setGlobalDispatcher2(new Agent2());
14491
14491
  }
14492
14492
  function setGlobalDispatcher2(agent) {
14493
14493
  if (!agent || typeof agent.dispatch !== "function") {
@@ -25061,7 +25061,7 @@ var require_undici = __commonJS({
25061
25061
  var Pool = require_pool();
25062
25062
  var BalancedPool = require_balanced_pool();
25063
25063
  var RoundRobinPool = require_round_robin_pool();
25064
- var Agent = require_agent();
25064
+ var Agent2 = require_agent();
25065
25065
  var Dispatcher1Wrapper = require_dispatcher1_wrapper();
25066
25066
  var ProxyAgent2 = require_proxy_agent();
25067
25067
  var Socks5ProxyAgent = require_socks5_proxy_agent();
@@ -25089,7 +25089,7 @@ var require_undici = __commonJS({
25089
25089
  module.exports.Pool = Pool;
25090
25090
  module.exports.BalancedPool = BalancedPool;
25091
25091
  module.exports.RoundRobinPool = RoundRobinPool;
25092
- module.exports.Agent = Agent;
25092
+ module.exports.Agent = Agent2;
25093
25093
  module.exports.Dispatcher1Wrapper = Dispatcher1Wrapper;
25094
25094
  module.exports.ProxyAgent = ProxyAgent2;
25095
25095
  module.exports.Socks5ProxyAgent = Socks5ProxyAgent;
@@ -25259,6 +25259,14 @@ var PROXY_ENV_KEYS = [
25259
25259
  "ALL_PROXY",
25260
25260
  "all_proxy"
25261
25261
  ];
25262
+ var NO_PROXY_ENV_KEYS = ["NO_PROXY", "no_proxy"];
25263
+ var DEFAULT_NO_PROXY = [
25264
+ "api.deepseek.com",
25265
+ "*.deepseek.com",
25266
+ "localhost",
25267
+ "127.0.0.1",
25268
+ "::1"
25269
+ ];
25262
25270
  function detectProxyUrl(env = process.env) {
25263
25271
  for (const key of PROXY_ENV_KEYS) {
25264
25272
  const raw = env[key];
@@ -25268,6 +25276,15 @@ function detectProxyUrl(env = process.env) {
25268
25276
  }
25269
25277
  return null;
25270
25278
  }
25279
+ function detectNoProxyRaw(env = process.env) {
25280
+ for (const key of NO_PROXY_ENV_KEYS) {
25281
+ const raw = env[key];
25282
+ if (typeof raw !== "string") continue;
25283
+ const trimmed = raw.trim();
25284
+ if (trimmed) return trimmed;
25285
+ }
25286
+ return null;
25287
+ }
25271
25288
  function normalizeProxyUrl(raw) {
25272
25289
  const trimmed = raw.trim();
25273
25290
  if (!trimmed) return null;
@@ -25278,8 +25295,102 @@ function normalizeProxyUrl(raw) {
25278
25295
  return null;
25279
25296
  }
25280
25297
  }
25298
+ function parseNoProxy(raw) {
25299
+ if (!raw) return [];
25300
+ const out = [];
25301
+ for (const segment of raw.split(",")) {
25302
+ const trimmed = segment.trim();
25303
+ if (!trimmed) continue;
25304
+ out.push(buildPattern(trimmed));
25305
+ }
25306
+ return out;
25307
+ }
25308
+ function buildPattern(raw) {
25309
+ const colon = raw.lastIndexOf(":");
25310
+ const hostPart = colon !== -1 && /^\d+$/.test(raw.slice(colon + 1)) ? raw.slice(0, colon) : raw;
25311
+ const normalized = hostPart.toLowerCase();
25312
+ if (normalized === "*") {
25313
+ return { raw, matches: () => true };
25314
+ }
25315
+ if (normalized.startsWith("*.")) {
25316
+ const suffix = normalized.slice(1);
25317
+ const bare = normalized.slice(2);
25318
+ return {
25319
+ raw,
25320
+ matches: (host) => {
25321
+ const h = host.toLowerCase();
25322
+ return h === bare || h.endsWith(suffix);
25323
+ }
25324
+ };
25325
+ }
25326
+ if (normalized.startsWith(".")) {
25327
+ return {
25328
+ raw,
25329
+ matches: (host) => host.toLowerCase().endsWith(normalized)
25330
+ };
25331
+ }
25332
+ return {
25333
+ raw,
25334
+ matches: (host) => {
25335
+ const h = host.toLowerCase();
25336
+ return h === normalized || h.endsWith(`.${normalized}`);
25337
+ }
25338
+ };
25339
+ }
25340
+ function matchesNoProxy(host, patterns) {
25341
+ for (const p of patterns) {
25342
+ if (p.matches(host)) return true;
25343
+ }
25344
+ return false;
25345
+ }
25346
+ var SelectiveProxyDispatcher = class {
25347
+ direct;
25348
+ proxied;
25349
+ patterns;
25350
+ constructor(proxyUrl, patterns) {
25351
+ this.direct = new import_undici.Agent();
25352
+ this.proxied = new import_undici.ProxyAgent(proxyUrl);
25353
+ this.patterns = patterns;
25354
+ }
25355
+ dispatch(opts, handler) {
25356
+ const origin = opts.origin;
25357
+ let host = "";
25358
+ try {
25359
+ if (typeof origin === "string") {
25360
+ host = new URL(origin).hostname;
25361
+ } else if (origin instanceof URL) {
25362
+ host = origin.hostname;
25363
+ }
25364
+ } catch {
25365
+ }
25366
+ const target = host && matchesNoProxy(host, this.patterns) ? this.direct : this.proxied;
25367
+ return target.dispatch(opts, handler);
25368
+ }
25369
+ async close() {
25370
+ await Promise.allSettled([this.direct.close(), this.proxied.close()]);
25371
+ }
25372
+ async destroy() {
25373
+ await Promise.allSettled([this.direct.destroy(), this.proxied.destroy()]);
25374
+ }
25375
+ };
25281
25376
  var installed = false;
25282
- function installProxyIfConfigured(env = process.env) {
25377
+ function resolveNoProxy(env = process.env, opts = {}) {
25378
+ const defaults = parseNoProxy(DEFAULT_NO_PROXY.join(","));
25379
+ const envSystem = parseNoProxy(detectNoProxyRaw(env));
25380
+ const envReasonix = parseNoProxy(
25381
+ typeof env.REASONIX_NO_PROXY === "string" ? env.REASONIX_NO_PROXY : null
25382
+ );
25383
+ const extra = parseNoProxy((opts.extraNoProxy ?? []).join(","));
25384
+ return {
25385
+ defaults,
25386
+ envSystem,
25387
+ envReasonix,
25388
+ extra,
25389
+ all: [...defaults, ...envSystem, ...envReasonix, ...extra]
25390
+ };
25391
+ }
25392
+ function installProxyIfConfigured(env = process.env, opts = {}) {
25393
+ if (opts.disabled) return null;
25283
25394
  const raw = detectProxyUrl(env);
25284
25395
  if (!raw) return null;
25285
25396
  const url = normalizeProxyUrl(raw);
@@ -25290,11 +25401,15 @@ function installProxyIfConfigured(env = process.env) {
25290
25401
  );
25291
25402
  return null;
25292
25403
  }
25404
+ const { all: patterns } = resolveNoProxy(env, { extraNoProxy: opts.extraNoProxy });
25293
25405
  try {
25294
25406
  const reinstalled = installed;
25295
- (0, import_undici.setGlobalDispatcher)(new import_undici.ProxyAgent(url));
25407
+ (0, import_undici.setGlobalDispatcher)(new SelectiveProxyDispatcher(url, patterns));
25296
25408
  installed = true;
25297
- return { url, reinstalled };
25409
+ const bypassList = patterns.map((p) => p.raw).join(",");
25410
+ process.stderr.write(`[proxy] using ${url} (NO_PROXY: ${bypassList})
25411
+ `);
25412
+ return { url, reinstalled, noProxy: patterns };
25298
25413
  } catch (err) {
25299
25414
  process.stderr.write(
25300
25415
  `\u25B2 proxy install failed (${err.message}); continuing without proxy.
@@ -25306,6 +25421,8 @@ function installProxyIfConfigured(env = process.env) {
25306
25421
 
25307
25422
  export {
25308
25423
  detectProxyUrl,
25424
+ matchesNoProxy,
25425
+ resolveNoProxy,
25309
25426
  installProxyIfConfigured
25310
25427
  };
25311
25428
  /*! Bundled license information:
@@ -25316,4 +25433,4 @@ undici/lib/web/fetch/body.js:
25316
25433
  undici/lib/web/websocket/frame.js:
25317
25434
  (*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
25318
25435
  */
25319
- //# sourceMappingURL=chunk-5QCB62C4.js.map
25436
+ //# sourceMappingURL=chunk-J2TQAWOM.js.map