@qwen-code/qwen-code 0.18.5-nightly.20260622.6bc3f853e → 0.18.5-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 (165) hide show
  1. package/bundled/qc-helper/SKILL.md +13 -5
  2. package/bundled/qc-helper/docs/configuration/_meta.ts +1 -0
  3. package/bundled/qc-helper/docs/configuration/auth.md +68 -48
  4. package/bundled/qc-helper/docs/configuration/model-providers.md +217 -195
  5. package/bundled/qc-helper/docs/configuration/qwen-ignore.md +31 -15
  6. package/bundled/qc-helper/docs/configuration/settings.md +44 -27
  7. package/bundled/qc-helper/docs/configuration/themes.md +7 -4
  8. package/bundled/qc-helper/docs/extension/extension-releasing.md +1 -1
  9. package/bundled/qc-helper/docs/extension/introduction.md +27 -21
  10. package/bundled/qc-helper/docs/features/arena.md +3 -3
  11. package/bundled/qc-helper/docs/features/channels/overview.md +1 -1
  12. package/bundled/qc-helper/docs/features/channels/plugins.md +1 -1
  13. package/bundled/qc-helper/docs/features/commands.md +6 -1
  14. package/bundled/qc-helper/docs/features/headless.md +1 -1
  15. package/bundled/qc-helper/docs/features/mcp.md +33 -14
  16. package/bundled/qc-helper/docs/features/sandbox.md +2 -2
  17. package/bundled/qc-helper/docs/features/tool-use-summaries.md +1 -1
  18. package/bundled/qc-helper/docs/integration-github-action.md +2 -2
  19. package/bundled/qc-helper/docs/overview.md +1 -1
  20. package/bundled/qc-helper/docs/quickstart.md +9 -5
  21. package/bundled/qc-helper/docs/qwen-serve.md +14 -2
  22. package/bundled/qc-helper/docs/support/tos-privacy.md +1 -1
  23. package/chunks/{agent-WFLPE5MW.js → agent-P4KSTVXX.js} +24 -22
  24. package/chunks/{agent-headless-Q27MG73I.js → agent-headless-QUAPWF55.js} +24 -22
  25. package/chunks/{anthropicContentGenerator-5S4OMMNL.js → anthropicContentGenerator-7352A7I5.js} +12 -11
  26. package/chunks/artifact-tool-5J4HUZAV.js +675 -0
  27. package/chunks/{askUserQuestion-WHVYL2S2.js → askUserQuestion-HF7HCWDD.js} +20 -7
  28. package/chunks/chunk-22IFUCVR.js +291 -0
  29. package/chunks/{chunk-26ZYKTYZ.js → chunk-2BIF2NVV.js} +2 -2
  30. package/chunks/{chunk-VKILGMZQ.js → chunk-2QDQTWCI.js} +1 -1
  31. package/chunks/{chunk-XGU3ETVO.js → chunk-3BR4OIOE.js} +3 -3
  32. package/chunks/{chunk-LTN3VYMZ.js → chunk-3UALQ56H.js} +1 -1
  33. package/chunks/{chunk-QBUR6J4B.js → chunk-BC5POO46.js} +8 -7
  34. package/chunks/{chunk-MSJ2MXJ6.js → chunk-BGUDAULQ.js} +11 -290
  35. package/chunks/{chunk-FH4P6RQA.js → chunk-BNXANYLH.js} +1 -1
  36. package/chunks/{chunk-WE6TNQJU.js → chunk-C4K3FEQ2.js} +36 -0
  37. package/chunks/{chunk-G4BUMVEY.js → chunk-CGEGHF2C.js} +2 -217
  38. package/chunks/chunk-EEEZIVFJ.js +908 -0
  39. package/chunks/{chunk-7Z2O7IBO.js → chunk-EIJYMXXX.js} +619 -135
  40. package/chunks/chunk-EJYJYJZ2.js +3703 -0
  41. package/chunks/{chunk-ATLUHLZE.js → chunk-EW6C27XX.js} +1 -1
  42. package/chunks/{chunk-42HGOMED.js → chunk-F6XNTYNE.js} +216 -1
  43. package/chunks/{chunk-C6MI2ASN.js → chunk-GZCJS5WH.js} +2 -2
  44. package/chunks/{chunk-KGV3F6UF.js → chunk-HGNSRCRB.js} +1 -1
  45. package/chunks/{chunk-CX3SGIPK.js → chunk-KBXLIVWQ.js} +2 -2
  46. package/chunks/{chunk-GOMVJKBL.js → chunk-L7U2RI5O.js} +59 -57
  47. package/chunks/{chunk-GBN55AWZ.js → chunk-NKJ6LRCR.js} +2 -2
  48. package/chunks/{chunk-2O3NAOJG.js → chunk-NWLUISRA.js} +1 -1
  49. package/chunks/{chunk-ID533GA3.js → chunk-OTBK43JR.js} +1 -1
  50. package/chunks/{chunk-AE6RQU6F.js → chunk-PRYMDRBV.js} +1 -1
  51. package/chunks/{chunk-KQIKOTQJ.js → chunk-RYLJU2DY.js} +60 -5
  52. package/chunks/{chunk-CTHZVIMD.js → chunk-T2VDEFUU.js} +2 -2
  53. package/chunks/{chunk-SWGPABMH.js → chunk-T336V435.js} +80 -83
  54. package/chunks/{chunk-LF6BKGZT.js → chunk-TXVGVZYR.js} +3 -3
  55. package/chunks/{chunk-GM3LTU6K.js → chunk-UMRZ7XCR.js} +170 -5015
  56. package/chunks/{chunk-XU7BKR3B.js → chunk-XU5P23GN.js} +3 -3
  57. package/chunks/{chunk-EJ6NFQ2L.js → chunk-ZC675NGC.js} +5 -5
  58. package/chunks/{chunk-CXZV4Q4J.js → chunk-ZXNEOCW2.js} +7118 -5113
  59. package/chunks/{computer-use-F5O56FVW.js → computer-use-4TLHI3UR.js} +24 -22
  60. package/chunks/contextCommand-HFEITKSR.js +56 -0
  61. package/chunks/{cron-create-THNDTYXU.js → cron-create-A5637KCI.js} +12 -9
  62. package/chunks/{cron-delete-BS5H6TFJ.js → cron-delete-AADOSEOZ.js} +4 -4
  63. package/chunks/{cron-list-7OBVHT7K.js → cron-list-OFCPTT2Y.js} +4 -4
  64. package/chunks/{dist-GKRNVFBH.js → dist-ZBX7LPJZ.js} +2 -1
  65. package/chunks/{edit-UV7MBOJU.js → edit-B7H73V6O.js} +24 -22
  66. package/chunks/{en-S3OQBISC.js → en-7OGNWWME.js} +48 -0
  67. package/chunks/{enter-worktree-TSCHZMJ3.js → enter-worktree-GG7ZHYPS.js} +24 -22
  68. package/chunks/{enterPlanMode-LKS7VIUG.js → enterPlanMode-RHTAKG52.js} +27 -23
  69. package/chunks/{exit-worktree-Q6EWFLZU.js → exit-worktree-U7VQZRMG.js} +24 -22
  70. package/chunks/{exitPlanMode-HS6I4D2O.js → exitPlanMode-S35A36II.js} +36 -28
  71. package/chunks/{geminiContentGenerator-GEZ63VSW.js → geminiContentGenerator-W7KVATBA.js} +4 -4
  72. package/chunks/{glob-ZN5LKB7E.js → glob-WOFF7ECI.js} +26 -23
  73. package/chunks/{grep-NIKBBYBU.js → grep-MWNYWYWQ.js} +24 -22
  74. package/chunks/{keychain-token-storage-YHXIWXIB.js → keychain-token-storage-CSYMNRPP.js} +2 -2
  75. package/chunks/{loop-wakeup-SSBWZ64K.js → loop-wakeup-DGSMT4N6.js} +5 -5
  76. package/chunks/{ls-YPFUHZRQ.js → ls-UGRZ4ZOM.js} +6 -6
  77. package/chunks/{lsp-FD6DNVAF.js → lsp-72IJURW3.js} +2 -2
  78. package/chunks/{monitor-A25XKPU5.js → monitor-AYUINLYN.js} +24 -22
  79. package/chunks/{notebook-edit-E72AIOUS.js → notebook-edit-EP4D4WFD.js} +25 -23
  80. package/chunks/{openaiContentGenerator-ZDLZDXLU.js → openaiContentGenerator-SLYYF7AM.js} +12 -15
  81. package/chunks/{qwenContentGenerator-HVJPPMTT.js → qwenContentGenerator-VZ7JYU4A.js} +26 -24
  82. package/chunks/{qwenOAuth2-WZ54YZ4J.js → qwenOAuth2-K4AASPCV.js} +5 -4
  83. package/chunks/{read-file-L6FM3KUX.js → read-file-65EQ53KS.js} +9 -8
  84. package/chunks/{ripGrep-YRJCUISE.js → ripGrep-5XLHJDDM.js} +24 -22
  85. package/chunks/{scheduler-M3742P2I.js → scheduler-5GLJSA2H.js} +73 -27
  86. package/chunks/{send-message-FWFTX62Q.js → send-message-URUZ7PLA.js} +24 -4
  87. package/chunks/{serve-ZIP2GDFY.js → serve-MUROZGCG.js} +618 -92
  88. package/chunks/{shell-T5VSPJLU.js → shell-ET3BQWKB.js} +24 -22
  89. package/chunks/{skill-ETTFYDOV.js → skill-YEYABCAF.js} +11 -10
  90. package/chunks/{src-UKOPSYDK.js → src-POVOI65Y.js} +140 -67
  91. package/chunks/{syntheticOutput-JY5NEDTV.js → syntheticOutput-65FRJGWM.js} +3 -3
  92. package/chunks/{task-create-IGILDV25.js → task-create-IH45HOFT.js} +6 -6
  93. package/chunks/{task-list-KBEJVAAG.js → task-list-FUB6JWSX.js} +5 -5
  94. package/chunks/{task-stop-WFTMQ6AC.js → task-stop-P6IOHQM3.js} +2 -2
  95. package/chunks/{task-update-UIVX7ZEV.js → task-update-RTUT7LJV.js} +6 -6
  96. package/chunks/{team-create-DRKUVGBN.js → team-create-EFZFKQFP.js} +28 -26
  97. package/chunks/{team-delete-LPOXDPVB.js → team-delete-RXGYRMHC.js} +5 -5
  98. package/chunks/{todoWrite-R4RIJKOD.js → todoWrite-O6JK24G6.js} +4 -4
  99. package/chunks/{tool-search-EIIK27ON.js → tool-search-BRJC42TE.js} +9 -8
  100. package/chunks/{web-fetch-JU7SS6KE.js → web-fetch-KUMBROUI.js} +4 -4
  101. package/chunks/{workflow-4RGAYFSJ.js → workflow-UDRBNFTT.js} +557 -97
  102. package/chunks/{write-file-GLQYJFEZ.js → write-file-F7TAHAHF.js} +24 -22
  103. package/chunks/{zh-QXLZV2PX.js → zh-3RMSEO5M.js} +48 -0
  104. package/chunks/{zh-TW-3OKU7LDA.js → zh-TW-R7WRLTJS.js} +48 -0
  105. package/cli.js +8473 -5091
  106. package/locales/en.js +69 -0
  107. package/locales/zh-TW.js +66 -0
  108. package/locales/zh.js +66 -0
  109. package/package.json +3 -2
  110. package/web-shell/assets/{arc-CRFN10gD.js → arc-DHUeMnnj.js} +1 -1
  111. package/web-shell/assets/{architectureDiagram-3BPJPVTR-IRlu1CpH.js → architectureDiagram-3BPJPVTR-DlX12yyj.js} +1 -1
  112. package/web-shell/assets/{blockDiagram-GPEHLZMM-htIZ6iw8.js → blockDiagram-GPEHLZMM-DTFUXMUT.js} +1 -1
  113. package/web-shell/assets/{c4Diagram-AAUBKEIU-A2GoRq3O.js → c4Diagram-AAUBKEIU-CWdB54fk.js} +1 -1
  114. package/web-shell/assets/channel-C3WhMjjP.js +1 -0
  115. package/web-shell/assets/{chunk-2J33WTMH-CdP2AC6u.js → chunk-2J33WTMH-CF5C5jNR.js} +1 -1
  116. package/web-shell/assets/{chunk-4BX2VUAB-DrA07nW2.js → chunk-4BX2VUAB-Cw7Ydfji.js} +1 -1
  117. package/web-shell/assets/{chunk-55IACEB6-CFGnVU2f.js → chunk-55IACEB6-CnbI1ZCw.js} +1 -1
  118. package/web-shell/assets/{chunk-727SXJPM-BTMkq3Tk.js → chunk-727SXJPM-DmSy00Pe.js} +1 -1
  119. package/web-shell/assets/{chunk-AQP2D5EJ-C9sYg04Z.js → chunk-AQP2D5EJ-DgNgXqBu.js} +1 -1
  120. package/web-shell/assets/{chunk-FMBD7UC4-Cag-cj6I.js → chunk-FMBD7UC4-tz2IvOXv.js} +1 -1
  121. package/web-shell/assets/{chunk-ND2GUHAM-CDSTFoR7.js → chunk-ND2GUHAM-DaBLEBPa.js} +1 -1
  122. package/web-shell/assets/{chunk-QZHKN3VN-CN9Z6oOs.js → chunk-QZHKN3VN-DVCQST3O.js} +1 -1
  123. package/web-shell/assets/classDiagram-4FO5ZUOK-CQ6TXPif.js +1 -0
  124. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CQ6TXPif.js +1 -0
  125. package/web-shell/assets/{cose-bilkent-S5V4N54A-DuN9j8Du.js → cose-bilkent-S5V4N54A-CAKTcdCQ.js} +1 -1
  126. package/web-shell/assets/{dagre-BM42HDAG-ByCWe45f.js → dagre-BM42HDAG-BdkBwlKg.js} +1 -1
  127. package/web-shell/assets/{diagram-2AECGRRQ-eWyU_pKZ.js → diagram-2AECGRRQ-DYt3G65F.js} +1 -1
  128. package/web-shell/assets/{diagram-5GNKFQAL-0Bfu3Fq5.js → diagram-5GNKFQAL-BWvROWjY.js} +1 -1
  129. package/web-shell/assets/{diagram-KO2AKTUF-B6KBKkQP.js → diagram-KO2AKTUF-BvvgwIaQ.js} +1 -1
  130. package/web-shell/assets/{diagram-LMA3HP47-TToDmeA_.js → diagram-LMA3HP47-E7NLSNKg.js} +1 -1
  131. package/web-shell/assets/{diagram-OG6HWLK6-CQCkC2Yx.js → diagram-OG6HWLK6-CYmUBgpE.js} +1 -1
  132. package/web-shell/assets/{erDiagram-TEJ5UH35-Cm9ls1iB.js → erDiagram-TEJ5UH35-BU5gY30h.js} +1 -1
  133. package/web-shell/assets/{flowDiagram-I6XJVG4X-Dyoz80Pv.js → flowDiagram-I6XJVG4X-V_ZssSZ9.js} +1 -1
  134. package/web-shell/assets/{ganttDiagram-6RSMTGT7-Cfut9yaU.js → ganttDiagram-6RSMTGT7-QIShlsdI.js} +1 -1
  135. package/web-shell/assets/{gitGraphDiagram-PVQCEYII-BCuJdlfD.js → gitGraphDiagram-PVQCEYII-DJxdu2YS.js} +1 -1
  136. package/web-shell/assets/index-BPnhI7gl.css +1 -0
  137. package/web-shell/assets/index-De4rqTsW.js +706 -0
  138. package/web-shell/assets/{infoDiagram-5YYISTIA-CXKxF2VL.js → infoDiagram-5YYISTIA-BqjdrFeO.js} +1 -1
  139. package/web-shell/assets/{ishikawaDiagram-YF4QCWOH-DE7HWSU8.js → ishikawaDiagram-YF4QCWOH-BP_a2YZ2.js} +1 -1
  140. package/web-shell/assets/{journeyDiagram-JHISSGLW-D__YUfds.js → journeyDiagram-JHISSGLW-BXg-S3Lk.js} +1 -1
  141. package/web-shell/assets/{kanban-definition-UN3LZRKU-D82R169M.js → kanban-definition-UN3LZRKU-BksAkdEJ.js} +1 -1
  142. package/web-shell/assets/{linear-DpyMbKqT.js → linear-D2m9-ODE.js} +1 -1
  143. package/web-shell/assets/{mermaid.core-D1KEFDhn.js → mermaid.core-dTtkZp2F.js} +5 -5
  144. package/web-shell/assets/{mindmap-definition-RKZ34NQL-BwVUFGFE.js → mindmap-definition-RKZ34NQL-Bft9my8O.js} +1 -1
  145. package/web-shell/assets/{pieDiagram-4H26LBE5-BO_qoEGx.js → pieDiagram-4H26LBE5-Cw8S-alZ.js} +1 -1
  146. package/web-shell/assets/{quadrantDiagram-W4KKPZXB-Cx0ZaWPo.js → quadrantDiagram-W4KKPZXB-DaDoTMts.js} +1 -1
  147. package/web-shell/assets/{requirementDiagram-4Y6WPE33-BJPXejOA.js → requirementDiagram-4Y6WPE33-Cp5kSpwj.js} +1 -1
  148. package/web-shell/assets/{sankeyDiagram-5OEKKPKP-C1xeIL9i.js → sankeyDiagram-5OEKKPKP-CW8RsJJZ.js} +1 -1
  149. package/web-shell/assets/{sequenceDiagram-3UESZ5HK-CSYKQUjf.js → sequenceDiagram-3UESZ5HK-DTfpIiJK.js} +1 -1
  150. package/web-shell/assets/{stateDiagram-AJRCARHV-d9hiHlAW.js → stateDiagram-AJRCARHV-DixFVzEs.js} +1 -1
  151. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DZgE04s3.js +1 -0
  152. package/web-shell/assets/{timeline-definition-PNZ67QCA-BhCBkq8k.js → timeline-definition-PNZ67QCA-DYsbXn5l.js} +1 -1
  153. package/web-shell/assets/{vennDiagram-CIIHVFJN-DPPFWp_y.js → vennDiagram-CIIHVFJN-HUpRpuUp.js} +1 -1
  154. package/web-shell/assets/{wardley-L42UT6IY-CcOUIgXY.js → wardley-L42UT6IY-cT3nQH_T.js} +1 -1
  155. package/web-shell/assets/{wardleyDiagram-YWT4CUSO-p7oR5X7r.js → wardleyDiagram-YWT4CUSO-Dmm7J6Qc.js} +1 -1
  156. package/web-shell/assets/{xychartDiagram-2RQKCTM6-Dfr7-SEy.js → xychartDiagram-2RQKCTM6-CX0L5p9C.js} +1 -1
  157. package/web-shell/index.html +3 -3
  158. package/chunks/chunk-77WXWU44.js +0 -26
  159. package/chunks/contextCommand-WBVNKL2C.js +0 -54
  160. package/web-shell/assets/channel-WwImfsc7.js +0 -1
  161. package/web-shell/assets/classDiagram-4FO5ZUOK-CJKQYFeJ.js +0 -1
  162. package/web-shell/assets/classDiagram-v2-Q7XG4LA2-CJKQYFeJ.js +0 -1
  163. package/web-shell/assets/index-BDZiTAkl.css +0 -1
  164. package/web-shell/assets/index-DaebdpHq.js +0 -516
  165. package/web-shell/assets/stateDiagram-v2-BHNVJYJU-DgReoybQ.js +0 -1
@@ -9,10 +9,10 @@ import {
9
9
  BaseToolInvocation,
10
10
  ToolDisplayNames,
11
11
  ToolNames
12
- } from "./chunk-GOMVJKBL.js";
12
+ } from "./chunk-L7U2RI5O.js";
13
13
  import {
14
14
  createDebugLogger
15
- } from "./chunk-WE6TNQJU.js";
15
+ } from "./chunk-C4K3FEQ2.js";
16
16
  import "./chunk-Z2Z3GUXZ.js";
17
17
  import {
18
18
  init_esbuild_shims
@@ -24,6 +24,14 @@ import {
24
24
  // packages/core/src/tools/askUserQuestion.ts
25
25
  init_esbuild_shims();
26
26
  var debugLogger = createDebugLogger("ASK_USER_QUESTION");
27
+ function parseAnswerQuestionIndex(key, questionCount) {
28
+ const index = Number(key);
29
+ if (!Number.isSafeInteger(index) || index < 0 || index >= questionCount || String(index) !== key) {
30
+ return void 0;
31
+ }
32
+ return index;
33
+ }
34
+ __name(parseAnswerQuestionIndex, "parseAnswerQuestionIndex");
27
35
  var askUserQuestionToolDescription = `Use this tool when you need to ask the user questions during execution. This allows you to:
28
36
  1. Gather user preferences or requirements
29
37
  2. Clarify ambiguous instructions
@@ -175,18 +183,23 @@ var AskUserQuestionToolInvocation = class extends BaseToolInvocation {
175
183
  returnDisplay: cancellationMessage
176
184
  };
177
185
  }
178
- const answersContent = Object.entries(this.userAnswers).map(([key, value]) => {
179
- const questionIndex = parseInt(key, 10);
186
+ const answersContent = Object.entries(this.userAnswers).flatMap(([key, value]) => {
187
+ const questionIndex = parseAnswerQuestionIndex(
188
+ key,
189
+ this.params.questions.length
190
+ );
191
+ if (questionIndex === void 0) return [];
180
192
  const question = this.params.questions[questionIndex];
181
- return `**${question?.header || `Question ${questionIndex + 1}`}**: ${value}`;
193
+ return `**${question.header || `Question ${questionIndex + 1}`}**: ${value}`;
182
194
  }).join("\n");
183
195
  this.applyPlanGateMetadata();
196
+ const messageBody = answersContent.length > 0 ? answersContent : "No valid answers were provided.";
184
197
  const llmMessage = `User has provided the following answers:
185
198
 
186
- ${answersContent}`;
199
+ ${messageBody}`;
187
200
  const displayMessage = `User has provided the following answers:
188
201
 
189
- ${answersContent}`;
202
+ ${messageBody}`;
190
203
  return {
191
204
  llmContent: llmMessage,
192
205
  returnDisplay: displayMessage
@@ -0,0 +1,291 @@
1
+ // Force strict mode and setup for ESM
2
+ "use strict";
3
+ import {
4
+ init_esbuild_shims
5
+ } from "./chunk-A4BMJM77.js";
6
+ import {
7
+ __name
8
+ } from "./chunk-J2S4EL5Y.js";
9
+
10
+ // packages/core/src/utils/browser.ts
11
+ init_esbuild_shims();
12
+ var browserBlocklist = ["www-browser"];
13
+ function isBrowserCommandBlocked(command) {
14
+ const commandName = command.replace(/\\/g, "/").split("/").pop();
15
+ return !!commandName && browserBlocklist.includes(commandName);
16
+ }
17
+ __name(isBrowserCommandBlocked, "isBrowserCommandBlocked");
18
+ function shouldAttemptBrowserLaunch(options = {}) {
19
+ const browserEnv = process.env["BROWSER"]?.trim();
20
+ const browserCommand = browserEnv?.match(/^\S+/)?.[0];
21
+ if (!options.ignoreBrowserBlocklist && process.platform !== "win32" && browserCommand && isBrowserCommandBlocked(browserCommand)) {
22
+ return false;
23
+ }
24
+ if (process.env["CI"] || process.env["DEBIAN_FRONTEND"] === "noninteractive") {
25
+ return false;
26
+ }
27
+ const isSSH = !!process.env["SSH_CONNECTION"];
28
+ if (process.platform === "linux") {
29
+ const displayVariables = ["DISPLAY", "WAYLAND_DISPLAY", "MIR_SOCKET"];
30
+ const hasDisplay = displayVariables.some((v) => !!process.env[v]);
31
+ if (!hasDisplay) {
32
+ return false;
33
+ }
34
+ }
35
+ if (isSSH && process.platform !== "linux") {
36
+ return false;
37
+ }
38
+ return true;
39
+ }
40
+ __name(shouldAttemptBrowserLaunch, "shouldAttemptBrowserLaunch");
41
+
42
+ // packages/core/src/utils/secure-browser-launcher.ts
43
+ init_esbuild_shims();
44
+ import { execFile, spawn } from "node:child_process";
45
+ import { promisify } from "node:util";
46
+ import { platform } from "node:os";
47
+ import { resolve } from "node:path";
48
+ import { URL, fileURLToPath } from "node:url";
49
+ var execFileAsync = promisify(execFile);
50
+ function validateUrl(url, { allowFile = false, allowedFilePaths } = {}) {
51
+ let parsedUrl;
52
+ try {
53
+ parsedUrl = new URL(url);
54
+ } catch (_error) {
55
+ throw new Error(`Invalid URL: ${url}`);
56
+ }
57
+ const allowedProtocols = allowFile ? ["http:", "https:", "file:"] : ["http:", "https:"];
58
+ if (!allowedProtocols.includes(parsedUrl.protocol)) {
59
+ throw new Error(
60
+ `Unsafe protocol: ${parsedUrl.protocol}. Only ${allowedProtocols.join(
61
+ ", "
62
+ )} are allowed.`
63
+ );
64
+ }
65
+ if (parsedUrl.protocol === "file:" && allowFile) {
66
+ if (!allowedFilePaths?.length) {
67
+ throw new Error("allowedFilePaths is required when allowFile is true");
68
+ }
69
+ const requestedPath = resolve(fileURLToPath(parsedUrl));
70
+ const allowed = allowedFilePaths.map((filePath) => resolve(filePath));
71
+ if (!allowed.includes(requestedPath)) {
72
+ throw new Error("File URL is not in the allowed file set");
73
+ }
74
+ }
75
+ if (/[\r\n\x00-\x1f]/.test(url)) {
76
+ throw new Error("URL contains invalid characters");
77
+ }
78
+ }
79
+ __name(validateUrl, "validateUrl");
80
+ async function openBrowserSecurely(url, browserOptions = {}) {
81
+ validateUrl(url, browserOptions);
82
+ const platformName = platform();
83
+ let command;
84
+ let args;
85
+ const browserEnv = process.env["BROWSER"]?.trim();
86
+ const browserCommand = platformName === "win32" ? void 0 : buildBrowserCommand(browserEnv, url);
87
+ if (browserCommand) {
88
+ try {
89
+ await launchDetached(browserCommand.command, browserCommand.args);
90
+ return;
91
+ } catch (_error) {
92
+ console.warn(
93
+ `Failed to open BROWSER command ${browserCommand.command}: ${formatLaunchError(
94
+ _error
95
+ )}. Falling back to the platform browser opener.`
96
+ );
97
+ }
98
+ }
99
+ if (!shouldAttemptBrowserLaunch({ ignoreBrowserBlocklist: true })) {
100
+ console.warn(
101
+ `Browser launch is not available in this environment. Please open this URL manually: ${url}`
102
+ );
103
+ return;
104
+ }
105
+ {
106
+ switch (platformName) {
107
+ case "darwin":
108
+ command = "open";
109
+ args = [url];
110
+ break;
111
+ case "win32":
112
+ command = "powershell.exe";
113
+ args = [
114
+ "-NoProfile",
115
+ "-NonInteractive",
116
+ "-WindowStyle",
117
+ "Hidden",
118
+ "-Command",
119
+ `Start-Process '${url.replace(/'/g, "''")}'`
120
+ ];
121
+ break;
122
+ case "linux":
123
+ case "freebsd":
124
+ case "openbsd":
125
+ command = "xdg-open";
126
+ args = [url];
127
+ break;
128
+ default:
129
+ throw new Error(`Unsupported platform: ${platformName}`);
130
+ }
131
+ }
132
+ const execOptions = {
133
+ // Don't inherit parent's environment to avoid potential issues
134
+ env: {
135
+ ...process.env,
136
+ // Ensure we're not in a shell that might interpret special characters
137
+ SHELL: void 0
138
+ },
139
+ // Detach the browser process so it doesn't block
140
+ detached: true,
141
+ stdio: "ignore"
142
+ };
143
+ try {
144
+ await execFileAsync(command, args, execOptions);
145
+ } catch (_error) {
146
+ if ((platformName === "linux" || platformName === "freebsd" || platformName === "openbsd") && command === "xdg-open") {
147
+ const fallbackCommands = [
148
+ { command: "gnome-open", detached: false },
149
+ { command: "kde-open", detached: false },
150
+ { command: "firefox", detached: true },
151
+ { command: "chromium", detached: true },
152
+ { command: "google-chrome", detached: true },
153
+ { command: "microsoft-edge", detached: true }
154
+ ];
155
+ for (const { command: fallbackCommand, detached } of fallbackCommands) {
156
+ try {
157
+ if (detached) {
158
+ await launchDetached(fallbackCommand, [url]);
159
+ } else {
160
+ await execFileAsync(fallbackCommand, [url], execOptions);
161
+ }
162
+ return;
163
+ } catch {
164
+ continue;
165
+ }
166
+ }
167
+ }
168
+ console.warn(
169
+ `Failed to open browser automatically. Please open this URL manually: ${url}`
170
+ );
171
+ return;
172
+ }
173
+ }
174
+ __name(openBrowserSecurely, "openBrowserSecurely");
175
+ async function launchDetached(command, args) {
176
+ const spawnOptions = {
177
+ env: {
178
+ ...process.env,
179
+ SHELL: void 0
180
+ },
181
+ detached: true,
182
+ stdio: "ignore"
183
+ };
184
+ await new Promise((resolve2, reject) => {
185
+ const child = spawn(command, args, spawnOptions);
186
+ let settled = false;
187
+ child.once("error", (error) => {
188
+ if (settled) {
189
+ return;
190
+ }
191
+ settled = true;
192
+ reject(error);
193
+ });
194
+ child.once("spawn", () => {
195
+ if (settled) {
196
+ return;
197
+ }
198
+ settled = true;
199
+ child.unref();
200
+ resolve2();
201
+ });
202
+ });
203
+ }
204
+ __name(launchDetached, "launchDetached");
205
+ function formatLaunchError(error) {
206
+ return error instanceof Error ? error.message : String(error);
207
+ }
208
+ __name(formatLaunchError, "formatLaunchError");
209
+ function buildBrowserCommand(browserEnv, url) {
210
+ if (!browserEnv) {
211
+ return void 0;
212
+ }
213
+ const browserCommand = parseBrowserCommand(browserEnv);
214
+ if (!browserCommand) {
215
+ console.warn(
216
+ "Invalid BROWSER environment variable, falling back to platform default."
217
+ );
218
+ return void 0;
219
+ }
220
+ if (isBrowserCommandBlocked(browserCommand.command)) {
221
+ return void 0;
222
+ }
223
+ let usedPlaceholder = false;
224
+ const args = browserCommand.args.map((arg) => {
225
+ if (!arg.includes("%s")) {
226
+ return arg;
227
+ }
228
+ usedPlaceholder = true;
229
+ return arg.replace(/%s/g, () => url);
230
+ });
231
+ if (!usedPlaceholder) {
232
+ args.push(url);
233
+ }
234
+ return { command: browserCommand.command, args };
235
+ }
236
+ __name(buildBrowserCommand, "buildBrowserCommand");
237
+ function parseBrowserCommand(browserEnv) {
238
+ const parts = [];
239
+ let current = "";
240
+ let quote;
241
+ for (const char of browserEnv) {
242
+ if (quote) {
243
+ if (char === quote) {
244
+ quote = void 0;
245
+ } else {
246
+ current += char;
247
+ }
248
+ continue;
249
+ }
250
+ if (char === '"' || char === "'") {
251
+ quote = char;
252
+ continue;
253
+ }
254
+ if (/\s/.test(char)) {
255
+ if (current) {
256
+ parts.push(current);
257
+ current = "";
258
+ }
259
+ continue;
260
+ }
261
+ current += char;
262
+ }
263
+ if (quote) {
264
+ return void 0;
265
+ }
266
+ if (current) {
267
+ parts.push(current);
268
+ }
269
+ const [command, ...args] = parts;
270
+ if (!command) {
271
+ return void 0;
272
+ }
273
+ return { command, args };
274
+ }
275
+ __name(parseBrowserCommand, "parseBrowserCommand");
276
+ function shouldLaunchBrowser() {
277
+ return shouldAttemptBrowserLaunch();
278
+ }
279
+ __name(shouldLaunchBrowser, "shouldLaunchBrowser");
280
+
281
+ export {
282
+ isBrowserCommandBlocked,
283
+ shouldAttemptBrowserLaunch,
284
+ openBrowserSecurely,
285
+ shouldLaunchBrowser
286
+ };
287
+ /**
288
+ * @license
289
+ * Copyright 2025 Google LLC
290
+ * SPDX-License-Identifier: Apache-2.0
291
+ */
@@ -10,11 +10,11 @@ import {
10
10
  } from "./chunk-LD2XBG6Z.js";
11
11
  import {
12
12
  atomicWriteJSON
13
- } from "./chunk-LTN3VYMZ.js";
13
+ } from "./chunk-3UALQ56H.js";
14
14
  import {
15
15
  Storage,
16
16
  isNodeError
17
- } from "./chunk-WE6TNQJU.js";
17
+ } from "./chunk-C4K3FEQ2.js";
18
18
  import {
19
19
  init_esbuild_shims
20
20
  } from "./chunk-A4BMJM77.js";
@@ -5,7 +5,7 @@ import {
5
5
  BaseToolInvocation,
6
6
  ToolDisplayNames,
7
7
  ToolNames
8
- } from "./chunk-GOMVJKBL.js";
8
+ } from "./chunk-L7U2RI5O.js";
9
9
  import {
10
10
  init_esbuild_shims
11
11
  } from "./chunk-A4BMJM77.js";
@@ -15,15 +15,15 @@ import {
15
15
  readCronTasks,
16
16
  removeCronTasks,
17
17
  updateCronTasks
18
- } from "./chunk-C6MI2ASN.js";
18
+ } from "./chunk-GZCJS5WH.js";
19
19
  import {
20
20
  ToolNames
21
- } from "./chunk-GOMVJKBL.js";
21
+ } from "./chunk-L7U2RI5O.js";
22
22
  import {
23
23
  Storage,
24
24
  createDebugLogger,
25
25
  getProjectHash
26
- } from "./chunk-WE6TNQJU.js";
26
+ } from "./chunk-C4K3FEQ2.js";
27
27
  import {
28
28
  init_esbuild_shims
29
29
  } from "./chunk-A4BMJM77.js";
@@ -3,7 +3,7 @@
3
3
  import {
4
4
  createDebugLogger,
5
5
  isNodeError
6
- } from "./chunk-WE6TNQJU.js";
6
+ } from "./chunk-C4K3FEQ2.js";
7
7
  import {
8
8
  init_esbuild_shims
9
9
  } from "./chunk-A4BMJM77.js";
@@ -2,24 +2,24 @@
2
2
  "use strict";
3
3
  import {
4
4
  t
5
- } from "./chunk-EJ6NFQ2L.js";
5
+ } from "./chunk-ZC675NGC.js";
6
6
  import {
7
7
  computeThresholds,
8
8
  getCoreSystemPrompt
9
- } from "./chunk-CXZV4Q4J.js";
9
+ } from "./chunk-ZXNEOCW2.js";
10
10
  import {
11
11
  buildSkillLlmContent
12
- } from "./chunk-ID533GA3.js";
12
+ } from "./chunk-OTBK43JR.js";
13
13
  import {
14
14
  DiscoveredMCPTool,
15
15
  uiTelemetryService
16
- } from "./chunk-GM3LTU6K.js";
16
+ } from "./chunk-UMRZ7XCR.js";
17
17
  import {
18
18
  ToolNames
19
- } from "./chunk-GOMVJKBL.js";
19
+ } from "./chunk-L7U2RI5O.js";
20
20
  import {
21
21
  DEFAULT_TOKEN_LIMIT
22
- } from "./chunk-G4BUMVEY.js";
22
+ } from "./chunk-F6XNTYNE.js";
23
23
  import {
24
24
  init_esbuild_shims
25
25
  } from "./chunk-A4BMJM77.js";
@@ -568,7 +568,8 @@ async function collectContextData(config, showDetails) {
568
568
  const modelName = config.getModel() || "unknown";
569
569
  const contentGeneratorConfig = config.getContentGeneratorConfig();
570
570
  const contextWindowSize = contentGeneratorConfig.contextWindowSize ?? DEFAULT_TOKEN_LIMIT;
571
- const apiTotalTokens = uiTelemetryService.getLastPromptTokenCount();
571
+ const geminiClient = config.getGeminiClient?.();
572
+ const apiTotalTokens = geminiClient?.isInitialized?.() ? geminiClient.getChat().getLastPromptTokenCount() : uiTelemetryService.getLastPromptTokenCount();
572
573
  const apiCachedTokens = uiTelemetryService.getLastCachedContentTokenCount();
573
574
  const systemPromptText = getCoreSystemPrompt(void 0, modelName);
574
575
  const systemPromptTokens = estimateTokens(systemPromptText);