@qwen-code/qwen-code 0.20.0 → 0.20.1-preview.7215

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 (169) hide show
  1. package/chunks/{MaxSizedBox-B5YGZSYE.js → MaxSizedBox-EH6G5AEH.js} +15 -12
  2. package/chunks/{StandaloneSessionPicker-CEGO2AZX.js → StandaloneSessionPicker-264A3TEA.js} +33 -30
  3. package/chunks/{acpAgent-YUR43TLG.js → acpAgent-6RBIJFDI.js} +79 -71
  4. package/chunks/{agent-H4JIDL7S.js → agent-QURXGAA3.js} +15 -12
  5. package/chunks/{agent-headless-TTBEREQV.js → agent-headless-CRGX4ICQ.js} +15 -12
  6. package/chunks/{anthropicContentGenerator-HVKLXOOU.js → anthropicContentGenerator-BWBAZGTW.js} +3 -2
  7. package/chunks/{artifact-tool-WBCAMD3O.js → artifact-tool-IUJ7QWCX.js} +1 -1
  8. package/chunks/{askUserQuestion-6DZC4UV5.js → askUserQuestion-IUMUUTDQ.js} +1 -1
  9. package/chunks/{bridge-VL7ITBU5.js → bridge-MNFVKPMI.js} +18 -15
  10. package/chunks/{chunk-FLSVD6BS.js → chunk-26LLB6FM.js} +1 -1
  11. package/chunks/{chunk-TKLLK6XQ.js → chunk-2DXOIVUI.js} +1 -1
  12. package/chunks/{chunk-HZPN55E5.js → chunk-3EUZWNWA.js} +1 -1
  13. package/chunks/{chunk-EZVDJFZ7.js → chunk-467G3SV5.js} +1 -1
  14. package/chunks/{chunk-4XNLIGVA.js → chunk-4SLLEAQP.js} +43 -26
  15. package/chunks/{chunk-O3OCNYY5.js → chunk-4WUAQ2DO.js} +1 -1
  16. package/chunks/{chunk-4ILMYHEI.js → chunk-5NWV4NFB.js} +3 -3
  17. package/chunks/{chunk-CV63PP6U.js → chunk-6GUTHAN7.js} +1 -1
  18. package/chunks/{chunk-KX6UK4VJ.js → chunk-6OH6A5EX.js} +117 -165
  19. package/chunks/{chunk-NDMQLV4Y.js → chunk-7KDI2IB2.js} +3 -3
  20. package/chunks/{chunk-6AFUCL3D.js → chunk-ANHT55MR.js} +1 -1
  21. package/chunks/{chunk-OYZWQNWG.js → chunk-AR27OPIU.js} +1 -1
  22. package/chunks/{chunk-IR46U7RB.js → chunk-B453NMZJ.js} +1 -1
  23. package/chunks/{chunk-4EP2PYYL.js → chunk-BAIEQKR5.js} +3 -3
  24. package/chunks/{chunk-AJSJ5TTU.js → chunk-BF32GYSY.js} +1 -1
  25. package/chunks/{chunk-O3Z73NBP.js → chunk-BRXIO5WY.js} +4 -4
  26. package/chunks/{chunk-D22SX43D.js → chunk-CVDW42JT.js} +1 -1
  27. package/chunks/{chunk-KG3XV6FH.js → chunk-DA7OOKVN.js} +1 -1
  28. package/chunks/{chunk-OEO2ERWK.js → chunk-E5GIFWE3.js} +3 -3
  29. package/chunks/{chunk-CPCVCKKF.js → chunk-ETD6K42I.js} +1 -1
  30. package/chunks/{chunk-AKX4WPPP.js → chunk-EVSTCA7S.js} +4 -4
  31. package/chunks/{chunk-DP5GXXNZ.js → chunk-FLTN6NRU.js} +1 -1
  32. package/chunks/{chunk-XVVH63JG.js → chunk-FNGK2Z5B.js} +2 -2
  33. package/chunks/{chunk-FEOZBUMT.js → chunk-FODK6UMO.js} +0 -27
  34. package/chunks/{chunk-PGEPSDJI.js → chunk-FVS747N7.js} +7 -7
  35. package/chunks/{chunk-333CXMNJ.js → chunk-GA7VRJVN.js} +4 -4
  36. package/chunks/chunk-GLNBDYUX.js +38 -0
  37. package/chunks/{chunk-SEKHYHMS.js → chunk-I5NLVPZJ.js} +1 -1
  38. package/chunks/{chunk-S2PD3EZD.js → chunk-IB35C3IL.js} +1 -1
  39. package/chunks/{chunk-DBE4QFZS.js → chunk-IE4JSQ5L.js} +10 -10
  40. package/chunks/{chunk-ANPINBOF.js → chunk-IKP5DXZY.js} +3 -3
  41. package/chunks/{chunk-OWCALFEG.js → chunk-IUSNI6IX.js} +1 -1
  42. package/chunks/{chunk-EAUYY7SS.js → chunk-JDI67JFB.js} +1 -1
  43. package/chunks/{chunk-MJ6S23WZ.js → chunk-JVTCARQ6.js} +4 -4
  44. package/chunks/{chunk-33XUAINQ.js → chunk-KPZNOZPC.js} +46 -6
  45. package/chunks/{chunk-CB2HFGRV.js → chunk-KXEGCGUG.js} +4 -4
  46. package/chunks/{chunk-S2W2LVDU.js → chunk-LZYWWWCZ.js} +2 -2
  47. package/chunks/{chunk-I2PYAYFM.js → chunk-MC2DOZS7.js} +1 -1
  48. package/chunks/{chunk-VZQUV7VK.js → chunk-MKLKHZAK.js} +1 -1
  49. package/chunks/{chunk-KOR3XKCA.js → chunk-N6YTEVLV.js} +3 -3
  50. package/chunks/{chunk-A5LYNIW7.js → chunk-NOWTNYC7.js} +4 -4
  51. package/chunks/{chunk-TIH2ZTOC.js → chunk-OF2BBLYQ.js} +1 -1
  52. package/chunks/chunk-OKWRU4NO.js +391 -0
  53. package/chunks/{chunk-ZFKNWQGQ.js → chunk-ONWW74X6.js} +7 -7
  54. package/chunks/{chunk-VEXFOTEO.js → chunk-P2YAOGJD.js} +2 -2
  55. package/chunks/chunk-PWVTCGBP.js +1768 -0
  56. package/chunks/{chunk-4N3KMAIL.js → chunk-Q3ZBFXK4.js} +13 -13
  57. package/chunks/{chunk-PF4CHQOJ.js → chunk-Q4RBU7WX.js} +4 -4
  58. package/chunks/{chunk-KDC6GNQR.js → chunk-QOK6RMIP.js} +4 -4
  59. package/chunks/{chunk-542SK7KV.js → chunk-RELYEO3R.js} +4 -4
  60. package/chunks/{chunk-OP4MOGXF.js → chunk-S35ZDXOS.js} +6 -0
  61. package/chunks/{chunk-KQNM4EO7.js → chunk-SDXIH6OA.js} +1 -1
  62. package/chunks/{chunk-7RMOXZTC.js → chunk-T7DDD7CZ.js} +4 -4
  63. package/chunks/{chunk-NGFEPAE6.js → chunk-TCKTNY66.js} +6 -4
  64. package/chunks/{chunk-5JBR5XIK.js → chunk-TTSKHF43.js} +2 -2
  65. package/chunks/{chunk-AQIEINAY.js → chunk-UJEZQ562.js} +25 -1763
  66. package/chunks/{chunk-BRRF37CO.js → chunk-UQES76OO.js} +1 -1
  67. package/chunks/{chunk-7SXZC7ID.js → chunk-V25Z5UUB.js} +4 -4
  68. package/chunks/{chunk-PBWEWI4N.js → chunk-VFAE4AGH.js} +29 -27
  69. package/chunks/{chunk-S2XVRHDN.js → chunk-WAX3ITOA.js} +1 -1
  70. package/chunks/chunk-WBTZGWQ6.js +121 -0
  71. package/chunks/{chunk-SJMV7ZBK.js → chunk-WKRXIHD6.js} +6 -6
  72. package/chunks/{chunk-2LL7TXB4.js → chunk-WOT64EP2.js} +2 -2
  73. package/chunks/{chunk-VDWBQ5AW.js → chunk-WXAXH7IJ.js} +1 -1
  74. package/chunks/{chunk-FQD7GFSV.js → chunk-X4CGDBKA.js} +3 -3
  75. package/chunks/{chunk-BMWMT5Y2.js → chunk-XNP57UDV.js} +2 -372
  76. package/chunks/{chunk-7PZ2ATFZ.js → chunk-Y4CRUWFZ.js} +13 -13
  77. package/chunks/{chunk-CZF3E5GF.js → chunk-Z5Q65RVH.js} +1 -1
  78. package/chunks/{chunk-IVPSS6EL.js → chunk-Z5R4JMOL.js} +3 -3
  79. package/chunks/{chunk-TMQ6XQCX.js → chunk-Z6UEAQTP.js} +36 -36
  80. package/chunks/{computer-use-NIWQNUZF.js → computer-use-R7KA6UJ6.js} +15 -12
  81. package/chunks/{config-utils-AHQ6YZ66.js → config-utils-6FXFJUYB.js} +1 -1
  82. package/chunks/{contextCommand-L2COEUHS.js → contextCommand-KAQQPHZ4.js} +17 -14
  83. package/chunks/{create-sub-session-MGNX52P3.js → create-sub-session-TDPDBU4K.js} +15 -12
  84. package/chunks/{create-sub-session-P26FE5GG.js → create-sub-session-X5RVIHCK.js} +1 -1
  85. package/chunks/{cron-create-JWFHBDRQ.js → cron-create-AC5FFLN7.js} +1 -1
  86. package/chunks/{cron-delete-GDX4E26G.js → cron-delete-JEB3FAHA.js} +1 -1
  87. package/chunks/{cron-list-USMAIWPT.js → cron-list-NBYPCNIB.js} +1 -1
  88. package/chunks/{daemon-status-provider-NL4IAG7B.js → daemon-status-provider-LVTVJGAD.js} +22 -19
  89. package/chunks/{earlyInputCapture-L6I2A22T.js → earlyInputCapture-WC7RI5HV.js} +15 -12
  90. package/chunks/{edit-3QV3JZJL.js → edit-6MHKCJCM.js} +16 -13
  91. package/chunks/{enter-worktree-4GMMF7EG.js → enter-worktree-O7VJ2E7A.js} +15 -12
  92. package/chunks/{enterPlanMode-L5UWBAUC.js → enterPlanMode-5XYAALIO.js} +15 -12
  93. package/chunks/{environment-3OV7UQOT.js → environment-LSKFNLBU.js} +17 -14
  94. package/chunks/{errors-LEOF5QG4.js → errors-ZFVCY6HG.js} +17 -14
  95. package/chunks/{exit-worktree-DDP57JLV.js → exit-worktree-MYIK66T7.js} +15 -12
  96. package/chunks/{exitPlanMode-CJBLGPIP.js → exitPlanMode-7MBNU76O.js} +15 -12
  97. package/chunks/{fast-path-M6RP2ING.js → fast-path-RNLIB64C.js} +2 -2
  98. package/chunks/{gemini-H4PHBJTL.js → gemini-WK5ISEAQ.js} +56 -53
  99. package/chunks/{geminiContentGenerator-VURJYPWP.js → geminiContentGenerator-NUJQBZBW.js} +1 -1
  100. package/chunks/{glob-2KUSRAVQ.js → glob-7P6RYY4L.js} +15 -12
  101. package/chunks/{grep-B5RXVESV.js → grep-V3QHNP2J.js} +15 -12
  102. package/chunks/{handleAutoUpdate-QQVIWXKT.js → handleAutoUpdate-AAQ6PL3E.js} +19 -16
  103. package/chunks/{i18n-N6OBDORT.js → i18n-B7IO7WQT.js} +16 -13
  104. package/chunks/{initializer-6WCFNDLL.js → initializer-E5TIC3CW.js} +20 -17
  105. package/chunks/{installationInfo-6J3WPXNS.js → installationInfo-XLPNAISK.js} +16 -13
  106. package/chunks/{list-HOWQSWP6.js → list-3CZR5I42.js} +23 -20
  107. package/chunks/{loadedSettingsAdapter-AO4YBRXZ.js → loadedSettingsAdapter-X5BSC6CE.js} +20 -17
  108. package/chunks/{loop-wakeup-5GLTUBHA.js → loop-wakeup-HMHCT5GU.js} +2 -2
  109. package/chunks/{ls-FHBY3Y7I.js → ls-IW5HYDG4.js} +1 -1
  110. package/chunks/{lsp-B6VMEW6Y.js → lsp-4RL52YIZ.js} +1 -1
  111. package/chunks/{mcp-QH7QNXOH.js → mcp-4C4HWXAR.js} +20 -17
  112. package/chunks/{monitor-GLJZDNPS.js → monitor-3CJDNZB2.js} +15 -12
  113. package/chunks/{nonInteractiveCli-TI7EMPXD.js → nonInteractiveCli-QTEHDDFH.js} +47 -44
  114. package/chunks/{notebook-edit-AVCIWS4F.js → notebook-edit-MX366HCT.js} +16 -13
  115. package/chunks/{openaiContentGenerator-B7W24G3D.js → openaiContentGenerator-KRPNNJGZ.js} +10 -7
  116. package/chunks/{pidfile-UEHAT6DH.js → pidfile-K7T2JLUJ.js} +15 -12
  117. package/chunks/{processUtils-XZPY2PBB.js → processUtils-YXL3VIBR.js} +2 -2
  118. package/chunks/{qwenContentGenerator-6GUTWJIC.js → qwenContentGenerator-GJVXFZ3U.js} +20 -15
  119. package/chunks/{qwenOAuth2-GASEEWGU.js → qwenOAuth2-UZTIBQLY.js} +6 -5
  120. package/chunks/{read-file-SQJONF6A.js → read-file-S5XQSYOW.js} +3 -3
  121. package/chunks/{read-mcp-resource-AKCL7I43.js → read-mcp-resource-OIBCNIX7.js} +1 -1
  122. package/chunks/{record-artifact-PEUB7727.js → record-artifact-HDMK4LHG.js} +1 -1
  123. package/chunks/{resumeHistoryUtils-PFQ2A23X.js → resumeHistoryUtils-IKR6XD2S.js} +19 -16
  124. package/chunks/{ripGrep-QCK22GDU.js → ripGrep-H65GRSQX.js} +15 -12
  125. package/chunks/{run-qwen-serve-OZGR3FQA.js → run-qwen-serve-7SKAQOAA.js} +24 -24
  126. package/chunks/{runtime-SNVAP6EH.js → runtime-I2STBGPR.js} +22 -19
  127. package/chunks/{scheduler-Z7QLMUWA.js → scheduler-6F7HETNO.js} +15 -12
  128. package/chunks/{send-message-3RHE7HSM.js → send-message-WXVVK4DB.js} +2 -2
  129. package/chunks/{serve-BT7KS6SC.js → serve-4ATEWSEA.js} +20 -17
  130. package/chunks/{server-SO64U3X5.js → server-YPUPFV2O.js} +70 -67
  131. package/chunks/{session-2KL2WQAH.js → session-AZFIERIY.js} +48 -45
  132. package/chunks/{settings-KITVOUSV.js → settings-EFQHLTM3.js} +19 -16
  133. package/chunks/{shell-BITUVH2R.js → shell-FWXWBJ4Q.js} +15 -12
  134. package/chunks/{skill-SOQHY455.js → skill-A634MNCD.js} +3 -3
  135. package/chunks/{spawnChannel-2BU3AULL.js → spawnChannel-KKBGGR47.js} +17 -14
  136. package/chunks/{src-43LM7JLB.js → src-BVROLD6N.js} +50 -46
  137. package/chunks/{standalone-update-YG5JUYCM.js → standalone-update-ERLA3BDC.js} +17 -14
  138. package/chunks/{startInteractiveUI-3RGTGEX5.js → startInteractiveUI-3VZ23WAY.js} +144 -140
  139. package/chunks/{syntheticOutput-FG5PQKIR.js → syntheticOutput-HCUFXSIA.js} +2 -2
  140. package/chunks/{task-create-HX32YXO7.js → task-create-RIY5JTFC.js} +3 -3
  141. package/chunks/{task-list-QWSY4ZIU.js → task-list-XBUCV3CO.js} +1 -1
  142. package/chunks/{task-stop-GWC6UWAL.js → task-stop-QDFCCYR5.js} +1 -1
  143. package/chunks/{task-update-NCTAB73Q.js → task-update-7PXKJQOI.js} +3 -3
  144. package/chunks/{team-create-FXN3PEBP.js → team-create-ZZO7QFQ7.js} +18 -15
  145. package/chunks/{team-delete-KK37HTOG.js → team-delete-TNSSE2S5.js} +1 -1
  146. package/chunks/{team-plan-approval-GEIZ356Q.js → team-plan-approval-3BZBJ46K.js} +15 -12
  147. package/chunks/{theme-manager-IAETOI25.js → theme-manager-FSFWNXFJ.js} +15 -12
  148. package/chunks/{todoWrite-ERCAMLFS.js → todoWrite-OMAIGB6V.js} +1 -1
  149. package/chunks/{tool-search-XKK7DNOK.js → tool-search-VYXAAIDW.js} +4 -4
  150. package/chunks/{total-session-admission-BJLDHKJN.js → total-session-admission-PSMLQICS.js} +18 -15
  151. package/chunks/{trustedFolders-5XCVNEUU.js → trustedFolders-QA3RK2NV.js} +16 -13
  152. package/chunks/{update-relaunch-FMVZK6XF.js → update-relaunch-LNLZFX3J.js} +5 -5
  153. package/chunks/{updateCheck-YZZB7YBU.js → updateCheck-JJEUQ54U.js} +18 -15
  154. package/chunks/{useAutoAcceptIndicator-ZSQX4I2H.js → useAutoAcceptIndicator-DIWN27LT.js} +23 -20
  155. package/chunks/{validateNonInterActiveAuth-PRVEB6GG.js → validateNonInterActiveAuth-LOEOFCAF.js} +44 -41
  156. package/chunks/{version-AZMG6KWL.js → version-HBF2VBLE.js} +1 -1
  157. package/chunks/{web-fetch-EPGJ5OQQ.js → web-fetch-BWGSD2BD.js} +5 -4
  158. package/chunks/web-search-OOHTCVR3.js +680 -0
  159. package/chunks/{workflow-UTNVPW22.js → workflow-LJAJBOR4.js} +16 -13
  160. package/chunks/{workspace-providers-status-EADV364W.js → workspace-providers-status-FYV7TTHA.js} +23 -20
  161. package/chunks/{workspace-registration-store-F3ZX3YHT.js → workspace-registration-store-4EHGQW4Y.js} +1 -1
  162. package/chunks/{workspace-registry-W6VMFYZU.js → workspace-registry-BKD7VC4Y.js} +18 -15
  163. package/chunks/{workspace-service-F3KIN2UN.js → workspace-service-75RHX6KR.js} +25 -22
  164. package/chunks/{workspace-skills-status-YVICUR5Y.js → workspace-skills-status-WBZBZI6A.js} +21 -18
  165. package/chunks/{write-file-CVGF2OKV.js → write-file-M2DTFILF.js} +16 -13
  166. package/cli.js +11 -11
  167. package/package.json +3 -3
  168. package/chunks/{chunk-B3KGZCQN.js → chunk-7YBZGNEC.js} +3 -3
  169. /package/chunks/{chunk-YWEW33JY.js → chunk-OMH3276Y.js} +0 -0
@@ -0,0 +1,391 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ delay
5
+ } from "./chunk-XNP57UDV.js";
6
+ import {
7
+ isTlsVerificationDisabled
8
+ } from "./chunk-6EFTQYW7.js";
9
+ import {
10
+ getErrorMessage
11
+ } from "./chunk-C27BYUX6.js";
12
+ import {
13
+ init_esbuild_shims
14
+ } from "./chunk-5O2XNYP6.js";
15
+ import {
16
+ __name
17
+ } from "./chunk-J2S4EL5Y.js";
18
+
19
+ // packages/core/src/utils/fetch.ts
20
+ init_esbuild_shims();
21
+ import { URL } from "node:url";
22
+ var PRIVATE_IP_RANGES = [
23
+ /^10\./,
24
+ /^127\./,
25
+ /^172\.(1[6-9]|2[0-9]|3[0-1])\./,
26
+ /^192\.168\./,
27
+ // IPv4 link-local (incl. cloud metadata endpoints) and CGNAT 100.64.0.0/10.
28
+ /^169\.254\./,
29
+ /^100\.(6[4-9]|[7-9][0-9]|1[01][0-9]|12[0-7])\./,
30
+ /^0\.0\.0\.0$/,
31
+ /^::1$/,
32
+ /^::$/,
33
+ // ULA fc00::/7 covers fc00: through fdff: (fd00: is the common prefix in
34
+ // practice); link-local fe80::/10 covers fe80: through febf:.
35
+ /^f[cd][0-9a-f]{2}:/i,
36
+ /^fe[89ab][0-9a-f]:/i
37
+ ];
38
+ var TLS_ERROR_CODES = /* @__PURE__ */ new Set([
39
+ "UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
40
+ "UNABLE_TO_VERIFY_LEAF_SIGNATURE",
41
+ "SELF_SIGNED_CERT_IN_CHAIN",
42
+ "DEPTH_ZERO_SELF_SIGNED_CERT",
43
+ "CERT_HAS_EXPIRED",
44
+ "ERR_TLS_CERT_ALTNAME_INVALID"
45
+ ]);
46
+ var FETCH_TROUBLESHOOTING_ERROR_CODES = /* @__PURE__ */ new Set([
47
+ ...TLS_ERROR_CODES,
48
+ "ECONNRESET",
49
+ "ETIMEDOUT",
50
+ "ECONNREFUSED",
51
+ "ENOTFOUND",
52
+ "EAI_AGAIN",
53
+ "EHOSTUNREACH",
54
+ "ENETUNREACH"
55
+ ]);
56
+ var FetchError = class extends Error {
57
+ constructor(message, code) {
58
+ super(message);
59
+ this.code = code;
60
+ this.name = "FetchError";
61
+ }
62
+ static {
63
+ __name(this, "FetchError");
64
+ }
65
+ };
66
+ var CONNECTION_LEVEL_ERROR_CODES = /* @__PURE__ */ new Set([
67
+ ...TLS_ERROR_CODES,
68
+ "ECONNREFUSED",
69
+ "EPROTO",
70
+ "ERR_SSL_WRONG_VERSION_NUMBER",
71
+ // Servers that don't speak TLS on 443 often reset during the handshake
72
+ // rather than refusing the connection. Safe to include: the http fallback
73
+ // only ever fires for URLs the caller requested as http.
74
+ "ECONNRESET",
75
+ "UND_ERR_SOCKET",
76
+ // Filtered port 443 (silent drop): undici's own bounded connect timeout.
77
+ // Deliberately NOT the full-budget ETIMEDOUT — that can fire mid-body on
78
+ // a healthy https server, and a fallback there would double a worst-case
79
+ // 60s wait for an ambiguous gain.
80
+ "UND_ERR_CONNECT_TIMEOUT"
81
+ ]);
82
+ function isConnectionLevelError(error) {
83
+ return error instanceof FetchError && error.code !== void 0 && CONNECTION_LEVEL_ERROR_CODES.has(error.code);
84
+ }
85
+ __name(isConnectionLevelError, "isConnectionLevelError");
86
+ function mappedIpv4(hostname) {
87
+ const match = /^::ffff:(.+)$/i.exec(hostname);
88
+ if (!match) return void 0;
89
+ const tail = match[1];
90
+ if (tail.includes(".")) return tail;
91
+ const groups = tail.split(":");
92
+ if (groups.length !== 2) return void 0;
93
+ const hi = Number.parseInt(groups[0], 16);
94
+ const lo = Number.parseInt(groups[1], 16);
95
+ if (Number.isNaN(hi) || Number.isNaN(lo)) return void 0;
96
+ return `${hi >> 8}.${hi & 255}.${lo >> 8}.${lo & 255}`;
97
+ }
98
+ __name(mappedIpv4, "mappedIpv4");
99
+ function isPrivateIp(url) {
100
+ try {
101
+ const hostname = new URL(url).hostname.replace(/^\[|\]$/g, "");
102
+ const target = mappedIpv4(hostname) ?? hostname;
103
+ return PRIVATE_IP_RANGES.some((range) => range.test(target));
104
+ } catch (_e) {
105
+ return false;
106
+ }
107
+ }
108
+ __name(isPrivateIp, "isPrivateIp");
109
+ var INTERNAL_HOST_SUFFIXES = [".local", ".internal", ".lan", ".home.arpa"];
110
+ function isPrivateHost(url) {
111
+ try {
112
+ const hostname = new URL(url).hostname.toLowerCase();
113
+ return hostname === "localhost" || hostname.endsWith(".localhost") || hostname === "host.docker.internal" || // Single-label hostnames (intranet, ci, printserver) are never public.
114
+ // IPv6 literals are bracketed and dot-free but CAN be public — they
115
+ // are classified by isPrivateIp below, not by this heuristic.
116
+ !hostname.includes(".") && !hostname.startsWith("[") || INTERNAL_HOST_SUFFIXES.some((suffix) => hostname.endsWith(suffix)) || isPrivateIp(url);
117
+ } catch {
118
+ return false;
119
+ }
120
+ }
121
+ __name(isPrivateHost, "isPrivateHost");
122
+ var REDIRECT_STATUSES = /* @__PURE__ */ new Set([301, 302, 303, 307, 308]);
123
+ function isPermittedRedirect(originalUrl, redirectUrl) {
124
+ try {
125
+ const original = new URL(originalUrl);
126
+ const redirect = new URL(redirectUrl);
127
+ if (redirect.protocol !== original.protocol) return false;
128
+ if (redirect.port !== original.port) return false;
129
+ if (redirect.username || redirect.password) return false;
130
+ const stripWww = /* @__PURE__ */ __name((hostname) => hostname.replace(/^www\./, ""), "stripWww");
131
+ return stripWww(original.hostname) === stripWww(redirect.hostname);
132
+ } catch {
133
+ return false;
134
+ }
135
+ }
136
+ __name(isPermittedRedirect, "isPermittedRedirect");
137
+ var RETRYABLE_STATUSES = /* @__PURE__ */ new Set([403, 429]);
138
+ var RETRYABLE_ERROR_CODES = /* @__PURE__ */ new Set([
139
+ "ECONNRESET",
140
+ "EAI_AGAIN",
141
+ "UND_ERR_SOCKET"
142
+ ]);
143
+ var RETRY_DELAY_MS = 500;
144
+ async function fetchWithPolicy(url, options) {
145
+ const timeoutSignal = AbortSignal.timeout(options.timeoutMs);
146
+ const signal = options.signal ? AbortSignal.any([options.signal, timeoutSignal]) : timeoutSignal;
147
+ const abortError = /* @__PURE__ */ __name(() => {
148
+ if (options.signal?.aborted) {
149
+ return options.signal.reason instanceof Error ? options.signal.reason : new FetchError("Request aborted", "ABORT_ERR");
150
+ }
151
+ if (timeoutSignal.aborted) {
152
+ return new FetchError(
153
+ `Request timed out after ${options.timeoutMs}ms`,
154
+ "ETIMEDOUT"
155
+ );
156
+ }
157
+ return void 0;
158
+ }, "abortError");
159
+ let first;
160
+ try {
161
+ first = await fetchPolicyAttempt(url, options, signal, timeoutSignal);
162
+ } catch (error) {
163
+ if (error instanceof FetchError && error.code !== void 0 && RETRYABLE_ERROR_CODES.has(error.code) && !signal.aborted) {
164
+ try {
165
+ await delay(RETRY_DELAY_MS, signal);
166
+ } catch {
167
+ throw abortError() ?? error;
168
+ }
169
+ return fetchPolicyAttempt(url, options, signal, timeoutSignal);
170
+ }
171
+ throw error;
172
+ }
173
+ if (first.kind === "response" && RETRYABLE_STATUSES.has(first.status) && !signal.aborted) {
174
+ try {
175
+ await delay(RETRY_DELAY_MS, signal);
176
+ return await fetchPolicyAttempt(url, options, signal, timeoutSignal);
177
+ } catch {
178
+ const aborted = abortError();
179
+ if (aborted) throw aborted;
180
+ return first;
181
+ }
182
+ }
183
+ return first;
184
+ }
185
+ __name(fetchWithPolicy, "fetchWithPolicy");
186
+ async function fetchPolicyAttempt(url, options, signal, timeoutSignal) {
187
+ const wrapAbort = /* @__PURE__ */ __name((error) => {
188
+ if (options.signal?.aborted) {
189
+ throw options.signal.reason instanceof Error ? options.signal.reason : new FetchError("Request aborted", "ABORT_ERR");
190
+ }
191
+ if (timeoutSignal.aborted) {
192
+ throw new FetchError(
193
+ `Request timed out after ${options.timeoutMs}ms`,
194
+ "ETIMEDOUT"
195
+ );
196
+ }
197
+ if (error instanceof FetchError) throw error;
198
+ const code = getErrorCode(error) ?? (error instanceof Error ? getErrorCode(error.cause) : void 0);
199
+ throw new FetchError(getErrorMessage(error), code);
200
+ }, "wrapAbort");
201
+ let currentUrl = url;
202
+ for (let hop = 0; hop <= options.maxRedirects; hop++) {
203
+ let response;
204
+ try {
205
+ response = await fetch(currentUrl, {
206
+ signal,
207
+ headers: options.headers,
208
+ redirect: "manual"
209
+ });
210
+ } catch (error) {
211
+ return wrapAbort(error);
212
+ }
213
+ if (REDIRECT_STATUSES.has(response.status)) {
214
+ const location = response.headers.get("location");
215
+ await response.body?.cancel().catch(() => {
216
+ });
217
+ if (!location) {
218
+ throw new FetchError("Redirect response missing Location header");
219
+ }
220
+ let redirectUrl;
221
+ try {
222
+ redirectUrl = new URL(location, currentUrl).toString();
223
+ } catch {
224
+ throw new FetchError(
225
+ `Redirect response has a malformed Location header: ${location}`
226
+ );
227
+ }
228
+ if (!isPermittedRedirect(currentUrl, redirectUrl)) {
229
+ return {
230
+ kind: "cross-host-redirect",
231
+ originalUrl: currentUrl,
232
+ redirectUrl,
233
+ status: response.status
234
+ };
235
+ }
236
+ currentUrl = redirectUrl;
237
+ continue;
238
+ }
239
+ if (response.status < 200 || response.status >= 300) {
240
+ await response.body?.cancel().catch(() => {
241
+ });
242
+ return {
243
+ kind: "response",
244
+ status: response.status,
245
+ statusText: response.statusText,
246
+ contentType: response.headers.get("content-type") ?? "",
247
+ contentDisposition: response.headers.get("content-disposition") ?? "",
248
+ body: Buffer.alloc(0),
249
+ finalUrl: currentUrl
250
+ };
251
+ }
252
+ const contentLength = Number(response.headers.get("content-length"));
253
+ if (Number.isFinite(contentLength) && contentLength > options.maxBytes) {
254
+ await response.body?.cancel().catch(() => {
255
+ });
256
+ throw new FetchError(
257
+ `Response too large: ${contentLength} bytes exceeds the ${options.maxBytes}-byte limit`,
258
+ "EMSGSIZE"
259
+ );
260
+ }
261
+ const chunks = [];
262
+ let total = 0;
263
+ if (response.body) {
264
+ const reader = response.body.getReader();
265
+ try {
266
+ for (; ; ) {
267
+ const { done, value } = await reader.read();
268
+ if (done) break;
269
+ total += value.byteLength;
270
+ if (total > options.maxBytes) {
271
+ throw new FetchError(
272
+ `Response too large: exceeded the ${options.maxBytes}-byte limit while streaming`,
273
+ "EMSGSIZE"
274
+ );
275
+ }
276
+ chunks.push(value);
277
+ }
278
+ } catch (error) {
279
+ await reader.cancel().catch(() => {
280
+ });
281
+ if (error instanceof FetchError) throw error;
282
+ return wrapAbort(error);
283
+ } finally {
284
+ reader.releaseLock();
285
+ }
286
+ }
287
+ return {
288
+ kind: "response",
289
+ status: response.status,
290
+ statusText: response.statusText,
291
+ contentType: response.headers.get("content-type") ?? "",
292
+ contentDisposition: response.headers.get("content-disposition") ?? "",
293
+ body: Buffer.concat(chunks, total),
294
+ finalUrl: currentUrl
295
+ };
296
+ }
297
+ throw new FetchError(
298
+ `Too many redirects (exceeded ${options.maxRedirects})`,
299
+ "EMAXREDIRECTS"
300
+ );
301
+ }
302
+ __name(fetchPolicyAttempt, "fetchPolicyAttempt");
303
+ function getErrorCode(error) {
304
+ if (!error || typeof error !== "object") {
305
+ return void 0;
306
+ }
307
+ if ("code" in error && typeof error["code"] === "string") {
308
+ return error["code"];
309
+ }
310
+ return void 0;
311
+ }
312
+ __name(getErrorCode, "getErrorCode");
313
+ function formatUnknownErrorMessage(error) {
314
+ if (typeof error === "string") {
315
+ return error;
316
+ }
317
+ if (typeof error === "number" || typeof error === "boolean" || typeof error === "bigint") {
318
+ return String(error);
319
+ }
320
+ if (error instanceof Error) {
321
+ return error.message;
322
+ }
323
+ if (!error || typeof error !== "object") {
324
+ return void 0;
325
+ }
326
+ const message = error["message"];
327
+ if (typeof message === "string") {
328
+ return message;
329
+ }
330
+ return void 0;
331
+ }
332
+ __name(formatUnknownErrorMessage, "formatUnknownErrorMessage");
333
+ function formatErrorCause(error) {
334
+ if (!(error instanceof Error)) {
335
+ return void 0;
336
+ }
337
+ const cause = error.cause;
338
+ if (!cause) {
339
+ return void 0;
340
+ }
341
+ const causeCode = getErrorCode(cause);
342
+ const causeMessage = formatUnknownErrorMessage(cause);
343
+ if (!causeCode && !causeMessage) {
344
+ return void 0;
345
+ }
346
+ if (causeCode && causeMessage && !causeMessage.includes(causeCode)) {
347
+ return `${causeCode}: ${causeMessage}`;
348
+ }
349
+ return causeMessage ?? causeCode;
350
+ }
351
+ __name(formatErrorCause, "formatErrorCause");
352
+ function formatFetchErrorForUser(error, options = {}) {
353
+ const errorMessage = getErrorMessage(error);
354
+ const code = error instanceof Error ? getErrorCode(error.cause) ?? getErrorCode(error) : getErrorCode(error);
355
+ const cause = formatErrorCause(error);
356
+ const fullErrorMessage = [
357
+ errorMessage,
358
+ cause ? `(cause: ${cause})` : void 0
359
+ ].filter(Boolean).join(" ");
360
+ const shouldShowFetchHints = errorMessage.toLowerCase().includes("fetch failed") || code != null && FETCH_TROUBLESHOOTING_ERROR_CODES.has(code);
361
+ const shouldShowTlsHint = code != null && TLS_ERROR_CODES.has(code);
362
+ if (!shouldShowFetchHints) {
363
+ return fullErrorMessage;
364
+ }
365
+ const hintLines = [
366
+ "",
367
+ "Troubleshooting:",
368
+ ...options.url ? [`- Confirm you can reach ${options.url} from this machine.`] : [],
369
+ "- If you are behind a proxy, pass `--proxy <url>` (or set `proxy` in settings).",
370
+ ...shouldShowTlsHint ? isTlsVerificationDisabled() ? [
371
+ "- TLS verification is already disabled (`--insecure` / `QWEN_TLS_INSECURE`), so this is likely a network or protocol issue rather than a certificate trust problem."
372
+ ] : [
373
+ "- If your network uses a corporate TLS inspection CA, set `NODE_EXTRA_CA_CERTS` to your CA bundle.",
374
+ "- For a trusted self-signed endpoint, pass `--insecure` (or set `QWEN_TLS_INSECURE=1`) to skip certificate verification."
375
+ ] : []
376
+ ];
377
+ return `${fullErrorMessage}${hintLines.join("\n")}`;
378
+ }
379
+ __name(formatFetchErrorForUser, "formatFetchErrorForUser");
380
+
381
+ export {
382
+ isConnectionLevelError,
383
+ isPrivateHost,
384
+ fetchWithPolicy,
385
+ formatFetchErrorForUser
386
+ };
387
+ /**
388
+ * @license
389
+ * Copyright 2025 Google LLC
390
+ * SPDX-License-Identifier: Apache-2.0
391
+ */
@@ -29,14 +29,14 @@ import {
29
29
  } from "./chunk-BDBMYST4.js";
30
30
  import {
31
31
  STRUCTURED_OUTPUT_REDACTED_ARGS
32
- } from "./chunk-EZVDJFZ7.js";
32
+ } from "./chunk-467G3SV5.js";
33
33
  import {
34
34
  BaseDeclarativeTool,
35
35
  BaseToolInvocation,
36
36
  SchemaValidator,
37
37
  ToolDisplayNames,
38
38
  ToolNames
39
- } from "./chunk-OP4MOGXF.js";
39
+ } from "./chunk-S35ZDXOS.js";
40
40
  import {
41
41
  convertSchema,
42
42
  estimateTextTokens,
@@ -70662,11 +70662,11 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
70662
70662
  let baseGenerator;
70663
70663
  try {
70664
70664
  if (authType === "openai" /* USE_OPENAI */) {
70665
- const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-B7W24G3D.js");
70665
+ const { createOpenAIContentGenerator } = await import("./openaiContentGenerator-KRPNNJGZ.js");
70666
70666
  baseGenerator = createOpenAIContentGenerator(generatorConfig, config);
70667
70667
  } else if (authType === "qwen-oauth" /* QWEN_OAUTH */) {
70668
- const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-GASEEWGU.js");
70669
- const { QwenContentGenerator } = await import("./qwenContentGenerator-6GUTWJIC.js");
70668
+ const { getQwenOAuthClient: getQwenOauthClient } = await import("./qwenOAuth2-UZTIBQLY.js");
70669
+ const { QwenContentGenerator } = await import("./qwenContentGenerator-GJVXFZ3U.js");
70670
70670
  try {
70671
70671
  const qwenClient = await getQwenOauthClient(
70672
70672
  config,
@@ -70684,10 +70684,10 @@ async function createContentGenerator(generatorConfig, config, isInitialAuth) {
70684
70684
  throw new Error(error instanceof Error ? error.message : String(error));
70685
70685
  }
70686
70686
  } else if (authType === "anthropic" /* USE_ANTHROPIC */) {
70687
- const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-HVKLXOOU.js");
70687
+ const { createAnthropicContentGenerator } = await import("./anthropicContentGenerator-BWBAZGTW.js");
70688
70688
  baseGenerator = createAnthropicContentGenerator(generatorConfig, config);
70689
70689
  } else if (authType === "gemini" /* USE_GEMINI */ || authType === "vertex-ai" /* USE_VERTEX_AI */) {
70690
- const { createGeminiContentGenerator } = await import("./geminiContentGenerator-VURJYPWP.js");
70690
+ const { createGeminiContentGenerator } = await import("./geminiContentGenerator-NUJQBZBW.js");
70691
70691
  baseGenerator = createGeminiContentGenerator(generatorConfig, config);
70692
70692
  } else {
70693
70693
  throw new Error(
@@ -6,7 +6,7 @@ import {
6
6
  import {
7
7
  JsonFormatter,
8
8
  parseAndFormatApiError
9
- } from "./chunk-KX6UK4VJ.js";
9
+ } from "./chunk-6OH6A5EX.js";
10
10
  import {
11
11
  FatalBudgetExceededError,
12
12
  FatalCancellationError,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-C27BYUX6.js";
16
16
  import {
17
17
  runExitCleanup
18
- } from "./chunk-DP5GXXNZ.js";
18
+ } from "./chunk-FLTN6NRU.js";
19
19
  import {
20
20
  init_esbuild_shims
21
21
  } from "./chunk-5O2XNYP6.js";