@nervekit/desktop 0.40.0 → 0.40.2

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 (114) hide show
  1. package/THIRD-PARTY-LICENSES.txt +5087 -485
  2. package/dist/{chunk-KSZJ3HGD.js → chunk-2BKMOJYJ.js} +1 -1
  3. package/dist/{chunk-5UT23MT6.js → chunk-3JJN36GV.js} +70 -71
  4. package/dist/{chunk-2Z5FLMLE.js → chunk-3SSNDIQT.js} +1 -1
  5. package/dist/{chunk-PUM6UCBT.js → chunk-3VZR3ZUY.js} +55 -8
  6. package/dist/{chunk-BXVRC3HF.js → chunk-4H3WR7IT.js} +1 -1
  7. package/dist/{chunk-QVHYARC2.js → chunk-4VPX67B7.js} +3 -1
  8. package/dist/chunk-5NN7JAJ2.js +258 -0
  9. package/dist/{chunk-BPOIFVQO.js → chunk-6FSDDGFZ.js} +731 -605
  10. package/dist/chunk-6PACEIUY.js +183 -0
  11. package/dist/{chunk-XNYZEQ3U.js → chunk-6TAN6WG6.js} +1 -1
  12. package/dist/{chunk-RWLLVZ7I.js → chunk-7FLZA2BD.js} +31 -15
  13. package/dist/{chunk-WTHP3VH6.js → chunk-7JQBECUL.js} +1 -1
  14. package/dist/{chunk-5Y3NEEOK.js → chunk-AAEIGAGD.js} +9 -9
  15. package/dist/{chunk-UN3GLM4U.js → chunk-ANI6J75M.js} +68 -65
  16. package/dist/chunk-B4IE2GAM.js +14 -0
  17. package/dist/chunk-BNVMNV4O.js +69 -0
  18. package/dist/{chunk-L3YB2QLN.js → chunk-C6RO4LP3.js} +2 -2
  19. package/dist/chunk-DTGL5P2V.js +250 -0
  20. package/dist/{chunk-U4DBQKHO.js → chunk-E4JNHQGT.js} +11 -9
  21. package/dist/chunk-EJM4HMEL.js +45 -0
  22. package/dist/chunk-ER2ES2RH.js +64 -0
  23. package/dist/{chunk-SQ7CWNIT.js → chunk-EX63VKXY.js} +1 -1
  24. package/dist/{chunk-JDI4D5EM.js → chunk-F3MHINI6.js} +19 -23
  25. package/dist/chunk-FGZX4Q7W.js +22828 -0
  26. package/dist/{chunk-LPCHTKEK.js → chunk-FZ5N6WXF.js} +31 -160
  27. package/dist/chunk-H2G55ZPG.js +783 -0
  28. package/dist/chunk-HDBDYGJQ.js +40 -0
  29. package/dist/{chunk-RU6S57LK.js → chunk-HOCODVKL.js} +22 -24
  30. package/dist/chunk-JCF3ZRP4.js +481 -0
  31. package/dist/chunk-K2J2VZXO.js +142 -0
  32. package/dist/chunk-KBNEZR7T.js +135 -0
  33. package/dist/chunk-KSSM6LUI.js +340 -0
  34. package/dist/{chunk-HHUSIAK3.js → chunk-KTGSBL6T.js} +14 -17
  35. package/dist/chunk-L2DHKP5C.js +42 -0
  36. package/dist/{chunk-DBXMYYPJ.js → chunk-M3ELKCNA.js} +1 -1
  37. package/dist/chunk-M7WTH5K5.js +822 -0
  38. package/dist/{chunk-LZRPWVVJ.js → chunk-MWIKZIAI.js} +9 -8
  39. package/dist/{chunk-AON37AL2.js → chunk-O2652RWY.js} +29 -4
  40. package/dist/chunk-O6U226AI.js +249 -0
  41. package/dist/{chunk-5R3UAHXF.js → chunk-OAEV22IW.js} +48 -26
  42. package/dist/chunk-OANTMDXI.js +29 -0
  43. package/dist/{chunk-UGDIHDAR.js → chunk-ODS5QROC.js} +1 -1
  44. package/dist/{chunk-Q7LPOIKN.js → chunk-OQC3F6JA.js} +3 -471
  45. package/dist/{chunk-YA2WJRUO.js → chunk-PST63OUS.js} +5 -5
  46. package/dist/{chunk-S2PITDVA.js → chunk-QBAIDKF6.js} +1 -1
  47. package/dist/chunk-RPLBWENJ.js +224 -0
  48. package/dist/{chunk-GCSWN326.js → chunk-S62LLS4I.js} +33 -55
  49. package/dist/chunk-SHEU5KLD.js +32 -0
  50. package/dist/{chunk-FESN7DND.js → chunk-SU2USXTD.js} +1 -1
  51. package/dist/chunk-T6NRMNLQ.js +22 -0
  52. package/dist/{chunk-NSA42OOT.js → chunk-TGKIV3F4.js} +53 -65
  53. package/dist/{chunk-MN7PZ2PH.js → chunk-TSV3PFU2.js} +2 -2
  54. package/dist/{chunk-D5WJKB4R.js → chunk-UDC7NPQJ.js} +4 -3
  55. package/dist/{chunk-CEX2GWGZ.js → chunk-VBM7TD3X.js} +1 -1
  56. package/dist/chunk-VC6TX2Y2.js +359 -0
  57. package/dist/{chunk-7FI3LC3O.js → chunk-VTDI5KP7.js} +241 -104
  58. package/dist/{chunk-P2GSKP6N.js → chunk-WIN7KHMV.js} +15 -18
  59. package/dist/chunk-WJULIJOU.js +168 -0
  60. package/dist/{chunk-HKLAYK2Z.js → chunk-WRTA5G57.js} +23 -0
  61. package/dist/{chunk-4ZNLXHTH.js → chunk-WYPVD3HW.js} +10 -9
  62. package/dist/{chunk-V7EAFXAX.js → chunk-XE2E2KBP.js} +10 -9
  63. package/dist/chunk-XY53EFK3.js +39 -0
  64. package/dist/chunk-XZYFB566.js +153 -0
  65. package/dist/{chunk-H4CDZRIE.js → chunk-YJT4NXMV.js} +5 -5
  66. package/dist/{chunk-ET5RYBGZ.js → chunk-YQFENES6.js} +3 -3
  67. package/dist/chunk-YUO5V75X.js +128 -0
  68. package/dist/chunk-YYLKI74V.js +8778 -0
  69. package/dist/daemon.js +15 -10
  70. package/dist/git-isolated-reader-helper.js +1 -1
  71. package/dist/main.js +14 -9
  72. package/dist/web/assets/{AsyncBashCenterHost-HGsdxUJ3.js → AsyncBashCenterHost-BvXKoCVr.js} +1 -1
  73. package/dist/web/assets/{ConversationsWorkbenchPanel-B6dzWkG1.js → ConversationsWorkbenchPanel-CIfK_e3I.js} +1 -1
  74. package/dist/web/assets/{DiscoverCenterHost-B186WBRA.js → DiscoverCenterHost-Ep8EN9iJ.js} +1 -1
  75. package/dist/web/assets/{FileCenterHost-DigJOU5M.js → FileCenterHost-C_7XZAFZ.js} +1 -1
  76. package/dist/web/assets/{FilesWorkbenchPanel-VPvx3Bmi.js → FilesWorkbenchPanel-CtXo7ywG.js} +1 -1
  77. package/dist/web/assets/{GitDiffCenterHost-IuZfF3hG.js → GitDiffCenterHost-Cr7lqGI_.js} +1 -1
  78. package/dist/web/assets/{GitWorkbenchPanel-CScC0CfH.js → GitWorkbenchPanel-BFbwUgIN.js} +1 -1
  79. package/dist/web/assets/{LaunchConfigurationNotice-5yb4cH27.js → LaunchConfigurationNotice-CJjWkMhv.js} +1 -1
  80. package/dist/web/assets/{LaunchesWorkbenchPanel-Vy0Gm7gg.js → LaunchesWorkbenchPanel-BqzJvsrj.js} +1 -1
  81. package/dist/web/assets/{LogsCenterHost-BXBozCYw.js → LogsCenterHost-BI1fSxFW.js} +1 -1
  82. package/dist/web/assets/{MermaidCenterHost-DDh4ArdK.js → MermaidCenterHost-DVsZB8nB.js} +1 -1
  83. package/dist/web/assets/{MobileFilesBody-Cda_7gDp.js → MobileFilesBody-BJMoaP9I.js} +1 -1
  84. package/dist/web/assets/{MobileFilesHost-C1jev2Un.js → MobileFilesHost-D843vkDF.js} +1 -1
  85. package/dist/web/assets/{MobileLaunchOutputHost-Bsv12o2H.js → MobileLaunchOutputHost-vpltMcar.js} +1 -1
  86. package/dist/web/assets/{MobileLaunchesHost-C9VH-2bn.js → MobileLaunchesHost-CdDrKASg.js} +1 -1
  87. package/dist/web/assets/{MobileLogsHost-BMDXc-WC.js → MobileLogsHost-qK7N-C1y.js} +1 -1
  88. package/dist/web/assets/{MobileNoteEditorHost-BA6WIY1Y.js → MobileNoteEditorHost-Bg1N8o54.js} +1 -1
  89. package/dist/web/assets/{MobileNotesHost-BZeYpK9H.js → MobileNotesHost-meLV39Yw.js} +1 -1
  90. package/dist/web/assets/{MobileProjectSettingsHost-U3Mx3EN8.js → MobileProjectSettingsHost-A49Fdn54.js} +1 -1
  91. package/dist/web/assets/{MobileProjectSettingsPageHost-CMvxbjfs.js → MobileProjectSettingsPageHost-BXpUqS_N.js} +1 -1
  92. package/dist/web/assets/{MobileSettingsHost-CP8Z_-gH.js → MobileSettingsHost-DPKPajzI.js} +1 -1
  93. package/dist/web/assets/{MobileSettingsPageHost-BPjXKTMV.js → MobileSettingsPageHost-izNWGN0i.js} +1 -1
  94. package/dist/web/assets/{MobileSettingsPageScreen-C5rHdrUU.js → MobileSettingsPageScreen-DWMg4fDo.js} +1 -1
  95. package/dist/web/assets/{ProjectSettingsCenterHost-BVXpBixy.js → ProjectSettingsCenterHost-DHeb274m.js} +1 -1
  96. package/dist/web/assets/{PullRequestCenterHost-CZhXfCX2.js → PullRequestCenterHost-BYkWxXQe.js} +1 -1
  97. package/dist/web/assets/{PullRequestsWorkbenchPanel-BBnZJVnI.js → PullRequestsWorkbenchPanel-ZvGbi1Cr.js} +1 -1
  98. package/dist/web/assets/{SearchWorkbenchPanel-qLgszneN.js → SearchWorkbenchPanel-DaC0smfe.js} +1 -1
  99. package/dist/web/assets/{SettingsCenter-7BfrBfiy.js → SettingsCenter-C_NLBsi6.js} +1 -1
  100. package/dist/web/assets/{SettingsCenterHost-Ck5uHILP.js → SettingsCenterHost-jP8MULEj.js} +1 -1
  101. package/dist/web/assets/{SystemPromptCenterHost-ya5AvXsd.js → SystemPromptCenterHost-B1hfsfAn.js} +1 -1
  102. package/dist/web/assets/{discover-B3I5g1_G.js → discover-B-aZ504j.js} +1 -1
  103. package/dist/web/assets/{index-FJEmK_L5.js → index-TZ1KAAsX.js} +34 -34
  104. package/dist/web/assets/{settings-page-controllers.svelte-CU0i08wo.js → settings-page-controllers.svelte-D_ydJF8u.js} +1 -1
  105. package/dist/web/assets/{shell-layout.svelte-BT2508sa.js → shell-layout.svelte-OoLFwzzJ.js} +2 -2
  106. package/dist/web/assets/{views-Z-n-GTYY.js → views-ByPCKDiZ.js} +1 -1
  107. package/dist/web/index.html +3 -3
  108. package/dist/web/sw.js +1 -1
  109. package/dist/worker.js +14 -9
  110. package/package.json +8 -9
  111. package/dist/chunk-RUZ2UAYH.js +0 -365
  112. package/dist/resize-worker.js +0 -168
  113. /package/dist/{chunk-PUM6UCBT.js.LEGAL.txt → chunk-3VZR3ZUY.js.LEGAL.txt} +0 -0
  114. /package/dist/{chunk-YA2WJRUO.js.LEGAL.txt → chunk-PST63OUS.js.LEGAL.txt} +0 -0
@@ -0,0 +1,40 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+
4
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/utils/openrouter-cost.js
5
+ function isValidCost(value) {
6
+ return typeof value === "number" && Number.isFinite(value) && value >= 0;
7
+ }
8
+ function isOpenRouterModel(model) {
9
+ return model.provider === "openrouter" || model.baseUrl.includes("openrouter.ai");
10
+ }
11
+ function applyOpenRouterReportedCost(usage, reported) {
12
+ if (!isValidCost(reported.cost))
13
+ return;
14
+ if (reported.is_byok === false) {
15
+ usage.cost.total = reported.cost;
16
+ usage.cost.totalFromProvider = true;
17
+ return;
18
+ }
19
+ if (reported.is_byok === true) {
20
+ const details = reported.cost_details;
21
+ if (!details)
22
+ return;
23
+ let upstreamCost = details.upstream_inference_cost;
24
+ if (upstreamCost === null) {
25
+ if (!isValidCost(details.upstream_inference_prompt_cost) || !isValidCost(details.upstream_inference_completions_cost)) {
26
+ return;
27
+ }
28
+ upstreamCost = details.upstream_inference_prompt_cost + details.upstream_inference_completions_cost;
29
+ }
30
+ if (!isValidCost(upstreamCost))
31
+ return;
32
+ usage.cost.total = reported.cost + upstreamCost;
33
+ usage.cost.totalFromProvider = true;
34
+ }
35
+ }
36
+
37
+ export {
38
+ isOpenRouterModel,
39
+ applyOpenRouterReportedCost
40
+ };
@@ -5,53 +5,54 @@ import {
5
5
  convertResponsesTools,
6
6
  getResponsesToolSupport,
7
7
  processResponsesStream
8
- } from "./chunk-UN3GLM4U.js";
8
+ } from "./chunk-ANI6J75M.js";
9
9
  import {
10
10
  buildCopilotDynamicHeaders,
11
11
  hasCopilotVisionInput
12
- } from "./chunk-S2PITDVA.js";
12
+ } from "./chunk-QBAIDKF6.js";
13
13
  import {
14
14
  clampOpenAIPromptCacheKey
15
- } from "./chunk-UGDIHDAR.js";
16
- import "./chunk-KSZJ3HGD.js";
15
+ } from "./chunk-ODS5QROC.js";
17
16
  import {
18
17
  OpenAI
19
18
  } from "./chunk-NW3DH7IK.js";
20
- import "./chunk-RUZ2UAYH.js";
19
+ import "./chunk-2BKMOJYJ.js";
21
20
  import {
22
21
  buildBaseOptions,
23
22
  createGrammarToolInputProperties,
24
23
  resolveSamplingParams
25
- } from "./chunk-5R3UAHXF.js";
26
- import "./chunk-2Z5FLMLE.js";
24
+ } from "./chunk-OAEV22IW.js";
25
+ import "./chunk-3SSNDIQT.js";
26
+ import {
27
+ retryProviderRequest
28
+ } from "./chunk-EX63VKXY.js";
27
29
  import {
28
30
  formatProviderError,
29
31
  normalizeProviderError
30
- } from "./chunk-AON37AL2.js";
31
- import {
32
- retryProviderRequest
33
- } from "./chunk-SQ7CWNIT.js";
32
+ } from "./chunk-O2652RWY.js";
34
33
  import {
35
34
  headersToRecord
36
- } from "./chunk-CEX2GWGZ.js";
35
+ } from "./chunk-VBM7TD3X.js";
37
36
  import {
38
37
  getProviderEnvValue
39
- } from "./chunk-FESN7DND.js";
38
+ } from "./chunk-SU2USXTD.js";
39
+ import "./chunk-H2G55ZPG.js";
40
40
  import {
41
41
  clampThinkingLevel,
42
42
  getDeclaredTools,
43
43
  resolveTranscript,
44
44
  resolveTranscriptTools
45
- } from "./chunk-NSA42OOT.js";
45
+ } from "./chunk-TGKIV3F4.js";
46
46
  import {
47
47
  AssistantMessageEventStream
48
- } from "./chunk-MN7PZ2PH.js";
48
+ } from "./chunk-TSV3PFU2.js";
49
49
  import {
50
50
  getIdentityHeaders
51
- } from "./chunk-D5WJKB4R.js";
51
+ } from "./chunk-UDC7NPQJ.js";
52
+ import "./chunk-XY53EFK3.js";
52
53
  import "./chunk-CWESUMYQ.js";
53
54
 
54
- // node_modules/.pnpm/@earendil-works+pi-ai@1.4.0_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_c4dd529f1cf5cdf12d9a6e2070ccac62/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js
55
+ // node_modules/.pnpm/@earendil-works+pi-ai@1.5.1_@aws-sdk+credential-provider-node@3.972.83_@smithy+signatur_e7d72008f907c45a36788e380ed24019/node_modules/@earendil-works/pi-ai/dist/api/openai-responses.js
55
56
  var OPENAI_TOOL_CALL_PROVIDERS = /* @__PURE__ */ new Set(["openai", "openai-codex", "opencode"]);
56
57
  var OPENAI_RESPONSES_MIN_OUTPUT_TOKENS = 16;
57
58
  var CHATGPT_USAGE_URL = "https://chatgpt.com/settings/usage";
@@ -94,6 +95,7 @@ function getCompat(model) {
94
95
  supportsDeveloperRole: model.compat?.supportsDeveloperRole ?? true,
95
96
  supportsMidConvoSystemMessages: model.compat?.supportsMidConvoSystemMessages ?? false,
96
97
  sessionAffinityFormat: model.compat?.sessionAffinityFormat ?? detectSessionAffinityFormat(model),
98
+ promptCacheKeyMode: model.compat?.promptCacheKeyMode ?? "auto",
97
99
  supportsLongCacheRetention: model.compat?.supportsLongCacheRetention ?? true,
98
100
  supportsStrictMode: model.compat?.supportsStrictMode ?? false,
99
101
  supportsOpenAIGrammarTools: model.compat?.supportsOpenAIGrammarTools ?? false,
@@ -188,11 +190,6 @@ var stream = (model, context, options) => {
188
190
  stream2.push({ type: "done", reason: output.stopReason, message: output });
189
191
  stream2.end();
190
192
  } catch (error) {
191
- for (const block of output.content) {
192
- delete block.index;
193
- delete block.partialJson;
194
- delete block.customInput;
195
- }
196
193
  output.stopReason = options?.signal?.aborted ? "aborted" : "error";
197
194
  const errorMessage = formatProviderError(normalizeProviderError(error), `${model.provider === "openai" ? "OpenAI" : model.provider} API error`);
198
195
  if (errorMessage.includes("subscription_sharing_usage_limit_exceeded")) {
@@ -239,7 +236,7 @@ function createClient(model, context, apiKey, optionsHeaders, identity, fetch, s
239
236
  headers["x-session-id"] = sessionId;
240
237
  } else {
241
238
  if (compat.sessionAffinityFormat === "openai") {
242
- headers.session_id = sessionId;
239
+ headers["session-id"] = sessionId;
243
240
  }
244
241
  headers["x-client-request-id"] = sessionId;
245
242
  }
@@ -269,12 +266,13 @@ function buildParams(model, context, options, compat, grammarToolInputProperties
269
266
  configurationUpdateEffort
270
267
  });
271
268
  const cacheRetention = resolveCacheRetention(options?.cacheRetention, options?.env);
269
+ const sendPromptCacheKey = cacheRetention !== "none" && compat.promptCacheKeyMode !== "disabled";
272
270
  const omitUnsupportedFields = isChatGPTSignIn(model, options?.apiKey);
273
271
  const params = {
274
272
  model: model.id,
275
273
  input: messages,
276
274
  stream: true,
277
- prompt_cache_key: cacheRetention === "none" ? void 0 : clampOpenAIPromptCacheKey(options?.sessionId),
275
+ prompt_cache_key: sendPromptCacheKey ? clampOpenAIPromptCacheKey(options?.sessionId) : void 0,
278
276
  prompt_cache_retention: omitUnsupportedFields ? void 0 : getPromptCacheRetention(compat, cacheRetention),
279
277
  prompt_cache_options: omitUnsupportedFields ? void 0 : getPromptCacheOptions(compat, cacheRetention),
280
278
  store: false
@@ -0,0 +1,481 @@
1
+ import { createRequire as __nerveCreateRequire } from "node:module";
2
+ const require = __nerveCreateRequire(import.meta.url);
3
+ import {
4
+ require_src
5
+ } from "./chunk-OQC3F6JA.js";
6
+ import {
7
+ __commonJS,
8
+ __require
9
+ } from "./chunk-CWESUMYQ.js";
10
+
11
+ // node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js
12
+ var require_helpers = __commonJS({
13
+ "node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/helpers.js"(exports) {
14
+ "use strict";
15
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
16
+ if (k2 === void 0) k2 = k;
17
+ var desc = Object.getOwnPropertyDescriptor(m, k);
18
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
19
+ desc = { enumerable: true, get: function() {
20
+ return m[k];
21
+ } };
22
+ }
23
+ Object.defineProperty(o, k2, desc);
24
+ }) : (function(o, m, k, k2) {
25
+ if (k2 === void 0) k2 = k;
26
+ o[k2] = m[k];
27
+ }));
28
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
29
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
30
+ }) : function(o, v) {
31
+ o["default"] = v;
32
+ });
33
+ var __importStar = exports && exports.__importStar || function(mod) {
34
+ if (mod && mod.__esModule) return mod;
35
+ var result = {};
36
+ if (mod != null) {
37
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
38
+ }
39
+ __setModuleDefault(result, mod);
40
+ return result;
41
+ };
42
+ Object.defineProperty(exports, "__esModule", { value: true });
43
+ exports.req = exports.json = exports.toBuffer = void 0;
44
+ var http = __importStar(__require("http"));
45
+ var https = __importStar(__require("https"));
46
+ async function toBuffer(stream) {
47
+ let length = 0;
48
+ const chunks = [];
49
+ for await (const chunk of stream) {
50
+ length += chunk.length;
51
+ chunks.push(chunk);
52
+ }
53
+ return Buffer.concat(chunks, length);
54
+ }
55
+ exports.toBuffer = toBuffer;
56
+ async function json(stream) {
57
+ const buf = await toBuffer(stream);
58
+ const str = buf.toString("utf8");
59
+ try {
60
+ return JSON.parse(str);
61
+ } catch (_err) {
62
+ const err = _err;
63
+ err.message += ` (input: ${str})`;
64
+ throw err;
65
+ }
66
+ }
67
+ exports.json = json;
68
+ function req(url, opts = {}) {
69
+ const href = typeof url === "string" ? url : url.href;
70
+ const req2 = (href.startsWith("https:") ? https : http).request(url, opts);
71
+ const promise = new Promise((resolve, reject) => {
72
+ req2.once("response", resolve).once("error", reject).end();
73
+ });
74
+ req2.then = promise.then.bind(promise);
75
+ return req2;
76
+ }
77
+ exports.req = req;
78
+ }
79
+ });
80
+
81
+ // node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js
82
+ var require_dist = __commonJS({
83
+ "node_modules/.pnpm/agent-base@7.1.4/node_modules/agent-base/dist/index.js"(exports) {
84
+ "use strict";
85
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
86
+ if (k2 === void 0) k2 = k;
87
+ var desc = Object.getOwnPropertyDescriptor(m, k);
88
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
89
+ desc = { enumerable: true, get: function() {
90
+ return m[k];
91
+ } };
92
+ }
93
+ Object.defineProperty(o, k2, desc);
94
+ }) : (function(o, m, k, k2) {
95
+ if (k2 === void 0) k2 = k;
96
+ o[k2] = m[k];
97
+ }));
98
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
99
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
100
+ }) : function(o, v) {
101
+ o["default"] = v;
102
+ });
103
+ var __importStar = exports && exports.__importStar || function(mod) {
104
+ if (mod && mod.__esModule) return mod;
105
+ var result = {};
106
+ if (mod != null) {
107
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
108
+ }
109
+ __setModuleDefault(result, mod);
110
+ return result;
111
+ };
112
+ var __exportStar = exports && exports.__exportStar || function(m, exports2) {
113
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p)) __createBinding(exports2, m, p);
114
+ };
115
+ Object.defineProperty(exports, "__esModule", { value: true });
116
+ exports.Agent = void 0;
117
+ var net = __importStar(__require("net"));
118
+ var http = __importStar(__require("http"));
119
+ var https_1 = __require("https");
120
+ __exportStar(require_helpers(), exports);
121
+ var INTERNAL = /* @__PURE__ */ Symbol("AgentBaseInternalState");
122
+ var Agent = class extends http.Agent {
123
+ constructor(opts) {
124
+ super(opts);
125
+ this[INTERNAL] = {};
126
+ }
127
+ /**
128
+ * Determine whether this is an `http` or `https` request.
129
+ */
130
+ isSecureEndpoint(options) {
131
+ if (options) {
132
+ if (typeof options.secureEndpoint === "boolean") {
133
+ return options.secureEndpoint;
134
+ }
135
+ if (typeof options.protocol === "string") {
136
+ return options.protocol === "https:";
137
+ }
138
+ }
139
+ const { stack } = new Error();
140
+ if (typeof stack !== "string")
141
+ return false;
142
+ return stack.split("\n").some((l) => l.indexOf("(https.js:") !== -1 || l.indexOf("node:https:") !== -1);
143
+ }
144
+ // In order to support async signatures in `connect()` and Node's native
145
+ // connection pooling in `http.Agent`, the array of sockets for each origin
146
+ // has to be updated synchronously. This is so the length of the array is
147
+ // accurate when `addRequest()` is next called. We achieve this by creating a
148
+ // fake socket and adding it to `sockets[origin]` and incrementing
149
+ // `totalSocketCount`.
150
+ incrementSockets(name) {
151
+ if (this.maxSockets === Infinity && this.maxTotalSockets === Infinity) {
152
+ return null;
153
+ }
154
+ if (!this.sockets[name]) {
155
+ this.sockets[name] = [];
156
+ }
157
+ const fakeSocket = new net.Socket({ writable: false });
158
+ this.sockets[name].push(fakeSocket);
159
+ this.totalSocketCount++;
160
+ return fakeSocket;
161
+ }
162
+ decrementSockets(name, socket) {
163
+ if (!this.sockets[name] || socket === null) {
164
+ return;
165
+ }
166
+ const sockets = this.sockets[name];
167
+ const index = sockets.indexOf(socket);
168
+ if (index !== -1) {
169
+ sockets.splice(index, 1);
170
+ this.totalSocketCount--;
171
+ if (sockets.length === 0) {
172
+ delete this.sockets[name];
173
+ }
174
+ }
175
+ }
176
+ // In order to properly update the socket pool, we need to call `getName()` on
177
+ // the core `https.Agent` if it is a secureEndpoint.
178
+ getName(options) {
179
+ const secureEndpoint = this.isSecureEndpoint(options);
180
+ if (secureEndpoint) {
181
+ return https_1.Agent.prototype.getName.call(this, options);
182
+ }
183
+ return super.getName(options);
184
+ }
185
+ createSocket(req, options, cb) {
186
+ const connectOpts = {
187
+ ...options,
188
+ secureEndpoint: this.isSecureEndpoint(options)
189
+ };
190
+ const name = this.getName(connectOpts);
191
+ const fakeSocket = this.incrementSockets(name);
192
+ Promise.resolve().then(() => this.connect(req, connectOpts)).then((socket) => {
193
+ this.decrementSockets(name, fakeSocket);
194
+ if (socket instanceof http.Agent) {
195
+ try {
196
+ return socket.addRequest(req, connectOpts);
197
+ } catch (err) {
198
+ return cb(err);
199
+ }
200
+ }
201
+ this[INTERNAL].currentSocket = socket;
202
+ super.createSocket(req, options, cb);
203
+ }, (err) => {
204
+ this.decrementSockets(name, fakeSocket);
205
+ cb(err);
206
+ });
207
+ }
208
+ createConnection() {
209
+ const socket = this[INTERNAL].currentSocket;
210
+ this[INTERNAL].currentSocket = void 0;
211
+ if (!socket) {
212
+ throw new Error("No socket was returned in the `connect()` function");
213
+ }
214
+ return socket;
215
+ }
216
+ get defaultPort() {
217
+ return this[INTERNAL].defaultPort ?? (this.protocol === "https:" ? 443 : 80);
218
+ }
219
+ set defaultPort(v) {
220
+ if (this[INTERNAL]) {
221
+ this[INTERNAL].defaultPort = v;
222
+ }
223
+ }
224
+ get protocol() {
225
+ return this[INTERNAL].protocol ?? (this.isSecureEndpoint() ? "https:" : "http:");
226
+ }
227
+ set protocol(v) {
228
+ if (this[INTERNAL]) {
229
+ this[INTERNAL].protocol = v;
230
+ }
231
+ }
232
+ };
233
+ exports.Agent = Agent;
234
+ }
235
+ });
236
+
237
+ // node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/parse-proxy-response.js
238
+ var require_parse_proxy_response = __commonJS({
239
+ "node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/parse-proxy-response.js"(exports) {
240
+ "use strict";
241
+ var __importDefault = exports && exports.__importDefault || function(mod) {
242
+ return mod && mod.__esModule ? mod : { "default": mod };
243
+ };
244
+ Object.defineProperty(exports, "__esModule", { value: true });
245
+ exports.parseProxyResponse = void 0;
246
+ var debug_1 = __importDefault(require_src());
247
+ var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
248
+ function parseProxyResponse(socket) {
249
+ return new Promise((resolve, reject) => {
250
+ let buffersLength = 0;
251
+ const buffers = [];
252
+ function read() {
253
+ const b = socket.read();
254
+ if (b)
255
+ ondata(b);
256
+ else
257
+ socket.once("readable", read);
258
+ }
259
+ function cleanup() {
260
+ socket.removeListener("end", onend);
261
+ socket.removeListener("error", onerror);
262
+ socket.removeListener("readable", read);
263
+ }
264
+ function onend() {
265
+ cleanup();
266
+ debug("onend");
267
+ reject(new Error("Proxy connection ended before receiving CONNECT response"));
268
+ }
269
+ function onerror(err) {
270
+ cleanup();
271
+ debug("onerror %o", err);
272
+ reject(err);
273
+ }
274
+ function ondata(b) {
275
+ buffers.push(b);
276
+ buffersLength += b.length;
277
+ const buffered = Buffer.concat(buffers, buffersLength);
278
+ const endOfHeaders = buffered.indexOf("\r\n\r\n");
279
+ if (endOfHeaders === -1) {
280
+ debug("have not received end of HTTP headers yet...");
281
+ read();
282
+ return;
283
+ }
284
+ const headerParts = buffered.slice(0, endOfHeaders).toString("ascii").split("\r\n");
285
+ const firstLine = headerParts.shift();
286
+ if (!firstLine) {
287
+ socket.destroy();
288
+ return reject(new Error("No header received from proxy CONNECT response"));
289
+ }
290
+ const firstLineParts = firstLine.split(" ");
291
+ const statusCode = +firstLineParts[1];
292
+ const statusText = firstLineParts.slice(2).join(" ");
293
+ const headers = {};
294
+ for (const header of headerParts) {
295
+ if (!header)
296
+ continue;
297
+ const firstColon = header.indexOf(":");
298
+ if (firstColon === -1) {
299
+ socket.destroy();
300
+ return reject(new Error(`Invalid header from proxy CONNECT response: "${header}"`));
301
+ }
302
+ const key = header.slice(0, firstColon).toLowerCase();
303
+ const value = header.slice(firstColon + 1).trimStart();
304
+ const current = headers[key];
305
+ if (typeof current === "string") {
306
+ headers[key] = [current, value];
307
+ } else if (Array.isArray(current)) {
308
+ current.push(value);
309
+ } else {
310
+ headers[key] = value;
311
+ }
312
+ }
313
+ debug("got proxy server response: %o %o", firstLine, headers);
314
+ cleanup();
315
+ resolve({
316
+ connect: {
317
+ statusCode,
318
+ statusText,
319
+ headers
320
+ },
321
+ buffered
322
+ });
323
+ }
324
+ socket.on("error", onerror);
325
+ socket.on("end", onend);
326
+ read();
327
+ });
328
+ }
329
+ exports.parseProxyResponse = parseProxyResponse;
330
+ }
331
+ });
332
+
333
+ // node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/index.js
334
+ var require_dist2 = __commonJS({
335
+ "node_modules/.pnpm/https-proxy-agent@7.0.6_supports-color@7.2.0/node_modules/https-proxy-agent/dist/index.js"(exports) {
336
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
337
+ if (k2 === void 0) k2 = k;
338
+ var desc = Object.getOwnPropertyDescriptor(m, k);
339
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
340
+ desc = { enumerable: true, get: function() {
341
+ return m[k];
342
+ } };
343
+ }
344
+ Object.defineProperty(o, k2, desc);
345
+ }) : (function(o, m, k, k2) {
346
+ if (k2 === void 0) k2 = k;
347
+ o[k2] = m[k];
348
+ }));
349
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
350
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
351
+ }) : function(o, v) {
352
+ o["default"] = v;
353
+ });
354
+ var __importStar = exports && exports.__importStar || function(mod) {
355
+ if (mod && mod.__esModule) return mod;
356
+ var result = {};
357
+ if (mod != null) {
358
+ for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
359
+ }
360
+ __setModuleDefault(result, mod);
361
+ return result;
362
+ };
363
+ var __importDefault = exports && exports.__importDefault || function(mod) {
364
+ return mod && mod.__esModule ? mod : { "default": mod };
365
+ };
366
+ Object.defineProperty(exports, "__esModule", { value: true });
367
+ exports.HttpsProxyAgent = void 0;
368
+ var net = __importStar(__require("net"));
369
+ var tls = __importStar(__require("tls"));
370
+ var assert_1 = __importDefault(__require("assert"));
371
+ var debug_1 = __importDefault(require_src());
372
+ var agent_base_1 = require_dist();
373
+ var url_1 = __require("url");
374
+ var parse_proxy_response_1 = require_parse_proxy_response();
375
+ var debug = (0, debug_1.default)("https-proxy-agent");
376
+ var setServernameFromNonIpHost = (options) => {
377
+ if (options.servername === void 0 && options.host && !net.isIP(options.host)) {
378
+ return {
379
+ ...options,
380
+ servername: options.host
381
+ };
382
+ }
383
+ return options;
384
+ };
385
+ var HttpsProxyAgent = class extends agent_base_1.Agent {
386
+ constructor(proxy, opts) {
387
+ super(opts);
388
+ this.options = { path: void 0 };
389
+ this.proxy = typeof proxy === "string" ? new url_1.URL(proxy) : proxy;
390
+ this.proxyHeaders = opts?.headers ?? {};
391
+ debug("Creating new HttpsProxyAgent instance: %o", this.proxy.href);
392
+ const host = (this.proxy.hostname || this.proxy.host).replace(/^\[|\]$/g, "");
393
+ const port = this.proxy.port ? parseInt(this.proxy.port, 10) : this.proxy.protocol === "https:" ? 443 : 80;
394
+ this.connectOpts = {
395
+ // Attempt to negotiate http/1.1 for proxy servers that support http/2
396
+ ALPNProtocols: ["http/1.1"],
397
+ ...opts ? omit(opts, "headers") : null,
398
+ host,
399
+ port
400
+ };
401
+ }
402
+ /**
403
+ * Called when the node-core HTTP client library is creating a
404
+ * new HTTP request.
405
+ */
406
+ async connect(req, opts) {
407
+ const { proxy } = this;
408
+ if (!opts.host) {
409
+ throw new TypeError('No "host" provided');
410
+ }
411
+ let socket;
412
+ if (proxy.protocol === "https:") {
413
+ debug("Creating `tls.Socket`: %o", this.connectOpts);
414
+ socket = tls.connect(setServernameFromNonIpHost(this.connectOpts));
415
+ } else {
416
+ debug("Creating `net.Socket`: %o", this.connectOpts);
417
+ socket = net.connect(this.connectOpts);
418
+ }
419
+ const headers = typeof this.proxyHeaders === "function" ? this.proxyHeaders() : { ...this.proxyHeaders };
420
+ const host = net.isIPv6(opts.host) ? `[${opts.host}]` : opts.host;
421
+ let payload = `CONNECT ${host}:${opts.port} HTTP/1.1\r
422
+ `;
423
+ if (proxy.username || proxy.password) {
424
+ const auth = `${decodeURIComponent(proxy.username)}:${decodeURIComponent(proxy.password)}`;
425
+ headers["Proxy-Authorization"] = `Basic ${Buffer.from(auth).toString("base64")}`;
426
+ }
427
+ headers.Host = `${host}:${opts.port}`;
428
+ if (!headers["Proxy-Connection"]) {
429
+ headers["Proxy-Connection"] = this.keepAlive ? "Keep-Alive" : "close";
430
+ }
431
+ for (const name of Object.keys(headers)) {
432
+ payload += `${name}: ${headers[name]}\r
433
+ `;
434
+ }
435
+ const proxyResponsePromise = (0, parse_proxy_response_1.parseProxyResponse)(socket);
436
+ socket.write(`${payload}\r
437
+ `);
438
+ const { connect, buffered } = await proxyResponsePromise;
439
+ req.emit("proxyConnect", connect);
440
+ this.emit("proxyConnect", connect, req);
441
+ if (connect.statusCode === 200) {
442
+ req.once("socket", resume);
443
+ if (opts.secureEndpoint) {
444
+ debug("Upgrading socket connection to TLS");
445
+ return tls.connect({
446
+ ...omit(setServernameFromNonIpHost(opts), "host", "path", "port"),
447
+ socket
448
+ });
449
+ }
450
+ return socket;
451
+ }
452
+ socket.destroy();
453
+ const fakeSocket = new net.Socket({ writable: false });
454
+ fakeSocket.readable = true;
455
+ req.once("socket", (s) => {
456
+ debug("Replaying proxy buffer for failed request");
457
+ (0, assert_1.default)(s.listenerCount("data") > 0);
458
+ s.push(buffered);
459
+ s.push(null);
460
+ });
461
+ return fakeSocket;
462
+ }
463
+ };
464
+ HttpsProxyAgent.protocols = ["http", "https"];
465
+ exports.HttpsProxyAgent = HttpsProxyAgent;
466
+ function resume(socket) {
467
+ socket.resume();
468
+ }
469
+ function omit(obj, ...keys) {
470
+ const ret = {};
471
+ let key;
472
+ for (key in obj) {
473
+ if (!keys.includes(key)) {
474
+ ret[key] = obj[key];
475
+ }
476
+ }
477
+ return ret;
478
+ }
479
+ }
480
+ });
481
+ export default require_dist2();