@hostclubeos/miraos 0.0.7-beta → 0.0.9-beta

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 (239) hide show
  1. package/chunks/{MaxSizedBox-CBUPHLMW.js → MaxSizedBox-6CGCRBRO.js} +1 -1
  2. package/chunks/{StandaloneSessionPicker-EXZJQKTK.js → StandaloneSessionPicker-7VQOS4TU.js} +1 -1
  3. package/chunks/{acp-subagent-executor-BMIXP52W.js → acp-subagent-executor-BFQRCU7R.js} +1 -1
  4. package/chunks/{acpAgent-JC4KGTLW.js → acpAgent-PCXQRPNU.js} +3 -3
  5. package/chunks/{advisor-5RUG3VFZ.js → advisor-WDZ5N5ZP.js} +1 -1
  6. package/chunks/{agent-SGQ7AEZI.js → agent-I7Q3IPSS.js} +1 -1
  7. package/chunks/{agent-headless-ZGCZ2DA7.js → agent-headless-6LOYWI5T.js} +1 -1
  8. package/chunks/{agent-host-client-HY5GPSHM.js → agent-host-client-PZZKCNQF.js} +1 -1
  9. package/chunks/{agent-host-connections-KGTBS37X.js → agent-host-connections-TWWSRTKJ.js} +1 -1
  10. package/chunks/{autofix-pr-E62FC67X.js → autofix-pr-RQPGPQ4D.js} +1 -1
  11. package/chunks/{batch-OUC6FGCQ.js → batch-UJD5TSBN.js} +1 -1
  12. package/chunks/{bridge-FLEIBB5V.js → bridge-4TYLRPXZ.js} +1 -1
  13. package/chunks/{channel-settings-store-QG6HREVH.js → channel-settings-store-RENJMOQ5.js} +1 -1
  14. package/chunks/{chunk-K7VOBDFT.js → chunk-24PHAWM3.js} +1 -1
  15. package/chunks/{chunk-7F5IYTVE.js → chunk-26JPBN6V.js} +1 -1
  16. package/chunks/{chunk-V5Z6OEKJ.js → chunk-2MQH3J4U.js} +1 -1
  17. package/chunks/{chunk-UOYXBAN7.js → chunk-2RXOWQSQ.js} +1 -1
  18. package/chunks/{chunk-H2QXWIRZ.js → chunk-323HUW2T.js} +1 -1
  19. package/chunks/{chunk-KNW2OD46.js → chunk-3BHXE7CB.js} +1 -1
  20. package/chunks/{chunk-RWFOQXPU.js → chunk-3GYAEXAA.js} +1 -1
  21. package/chunks/{chunk-W6IOHGWW.js → chunk-3YBZW4HP.js} +1 -1
  22. package/chunks/{chunk-23543L6E.js → chunk-4RJ2RRGZ.js} +1 -1
  23. package/chunks/{chunk-2PB6TEZU.js → chunk-5DIW4X4P.js} +1 -1
  24. package/chunks/{chunk-4346FNTB.js → chunk-5GB6JNJX.js} +1 -1
  25. package/chunks/{chunk-VRAHMOQQ.js → chunk-5HSNCG73.js} +2 -2
  26. package/chunks/{chunk-PQOQONLN.js → chunk-6HDMM7TJ.js} +1 -1
  27. package/chunks/{chunk-K7KY7FIB.js → chunk-6STNGEYC.js} +1 -1
  28. package/chunks/{chunk-7VP4KALB.js → chunk-7EFWNFJJ.js} +1 -1
  29. package/chunks/{chunk-ATVRF62A.js → chunk-7EWIKIJI.js} +1 -1
  30. package/chunks/{chunk-T5PDEAU5.js → chunk-7TB6VG72.js} +1 -1
  31. package/chunks/{chunk-4WYKHP7Q.js → chunk-7TLL4JLR.js} +1 -1
  32. package/chunks/{chunk-JDABSS6M.js → chunk-AOMXZNMX.js} +1 -1
  33. package/chunks/{chunk-FK5L2WVV.js → chunk-AUM57JI2.js} +1 -1
  34. package/chunks/{chunk-KK6SQPYG.js → chunk-AW5UCOZO.js} +1 -1
  35. package/chunks/{chunk-WC72OWF2.js → chunk-C6HVNDQT.js} +2 -2
  36. package/chunks/{chunk-BSLIVO6O.js → chunk-CC6E5CQV.js} +1 -1
  37. package/chunks/{chunk-AIAYQAPA.js → chunk-CLKUQP27.js} +1 -1
  38. package/chunks/{chunk-2QYFSBJY.js → chunk-DFMQQM4M.js} +1 -1
  39. package/chunks/{chunk-MMGNOY3U.js → chunk-DP7LJTG2.js} +5 -5
  40. package/chunks/{chunk-MYS5NQXO.js → chunk-DQT5VL7G.js} +1 -1
  41. package/chunks/{chunk-FC7SJIAS.js → chunk-E4QOAV5O.js} +1 -1
  42. package/chunks/{chunk-3MBYQYPC.js → chunk-E4REGDEZ.js} +1 -1
  43. package/chunks/{chunk-WCLAVBNR.js → chunk-EAG7VZJJ.js} +1 -1
  44. package/chunks/{chunk-GQ24VFGQ.js → chunk-EFO6J22W.js} +1 -1
  45. package/chunks/{chunk-6RDYPRV6.js → chunk-EMR4QK2F.js} +1 -1
  46. package/chunks/{chunk-WZTO3EYG.js → chunk-EYECE2PH.js} +1 -1
  47. package/chunks/{chunk-UWMLSAQY.js → chunk-EZDXHUHB.js} +1 -1
  48. package/chunks/{chunk-T3A53XMM.js → chunk-FJFTKA4H.js} +1 -1
  49. package/chunks/{chunk-W2ZVZ6LS.js → chunk-FSLDNLNU.js} +1 -1
  50. package/chunks/{chunk-O6Z3KO6R.js → chunk-FSRXTX3N.js} +1 -1
  51. package/chunks/{chunk-TFITRCIC.js → chunk-FWSXFRIQ.js} +1 -1
  52. package/chunks/{chunk-TU5QHOJC.js → chunk-G4ATLMDH.js} +1 -1
  53. package/chunks/{chunk-DF6TBGS2.js → chunk-GAS3HKRX.js} +1 -1
  54. package/chunks/{chunk-YVN32EUM.js → chunk-GFFL2LR2.js} +1 -1
  55. package/chunks/{chunk-TLZM3DMY.js → chunk-GYFIY7TD.js} +1 -1
  56. package/chunks/{chunk-PGKFDR73.js → chunk-GYXRI4P5.js} +1 -1
  57. package/chunks/{chunk-3KFLO5W3.js → chunk-H3U7DXIU.js} +1 -1
  58. package/chunks/{chunk-YN6WXB6B.js → chunk-HEDVPRMD.js} +1 -1
  59. package/chunks/{chunk-JJDF5FHA.js → chunk-HI3644FQ.js} +1 -1
  60. package/chunks/{chunk-HASJX2YS.js → chunk-HTHYLMBO.js} +1 -1
  61. package/chunks/{chunk-4MGTY3CJ.js → chunk-IW7RPDV2.js} +1 -1
  62. package/chunks/{chunk-SCHCTQCG.js → chunk-IXQI4K6O.js} +1 -1
  63. package/chunks/chunk-IYH3IZL4.js +13 -0
  64. package/chunks/{chunk-EF3HUB7S.js → chunk-J52J35K4.js} +1 -1
  65. package/chunks/{chunk-TXL535SJ.js → chunk-J7L5IHLG.js} +1 -1
  66. package/chunks/{chunk-N7WQH6L4.js → chunk-JHS5B4N7.js} +2 -2
  67. package/chunks/{chunk-P5543CFV.js → chunk-JRSO5ZGU.js} +1 -1
  68. package/chunks/{chunk-G35E5UB3.js → chunk-JS6VAGRQ.js} +1 -1
  69. package/chunks/{chunk-Z4JY3HGO.js → chunk-KAFPULGU.js} +1 -1
  70. package/chunks/{chunk-RNPVWQ3V.js → chunk-LDP47G5M.js} +1 -1
  71. package/chunks/{chunk-EW3EVEYN.js → chunk-LMZZWPKA.js} +1 -1
  72. package/chunks/{chunk-5RYDKYIR.js → chunk-LNCELICB.js} +1 -1
  73. package/chunks/{chunk-JDHMSERR.js → chunk-LY2DRNTZ.js} +1 -1
  74. package/chunks/{chunk-7W5DOBKY.js → chunk-MMGGGYSJ.js} +1 -1
  75. package/chunks/{chunk-CUY6CVSL.js → chunk-MTBU2ZIM.js} +1 -1
  76. package/chunks/{chunk-TWJ4XBED.js → chunk-N27KICJQ.js} +1 -1
  77. package/chunks/{chunk-JQOLNQQN.js → chunk-NHYFTK4O.js} +1 -1
  78. package/chunks/{chunk-NGH27AWP.js → chunk-NRDHXSEE.js} +1 -1
  79. package/chunks/{chunk-3GJ56V2J.js → chunk-NV5VVTYQ.js} +1 -1
  80. package/chunks/{chunk-VJUTDS6C.js → chunk-OEDMFKZL.js} +1 -1
  81. package/chunks/{chunk-PVHBBTAU.js → chunk-OQAVMR6K.js} +1 -1
  82. package/chunks/{chunk-IF3SWUYT.js → chunk-OY3Y6EMV.js} +1 -1
  83. package/chunks/{chunk-SOCXRMZM.js → chunk-OZL4ZMGQ.js} +2 -2
  84. package/chunks/{chunk-GLQWA4W2.js → chunk-PKSPKVFH.js} +1 -1
  85. package/chunks/{chunk-KYK53GFP.js → chunk-PNFKCYZT.js} +1 -1
  86. package/chunks/{chunk-7SAR6NXA.js → chunk-PTWHFVGG.js} +2 -2
  87. package/chunks/{chunk-RBA3TP7L.js → chunk-QJ6ZTZFC.js} +1 -1
  88. package/chunks/{chunk-PFECH6U6.js → chunk-QRGWB7IX.js} +1 -1
  89. package/chunks/{chunk-VBJV7T47.js → chunk-QRP2GXQD.js} +1 -1
  90. package/chunks/{chunk-WJLHLFIR.js → chunk-RES5ET63.js} +1 -1
  91. package/chunks/{chunk-GY4ID3EB.js → chunk-ROSJCTWB.js} +1 -1
  92. package/chunks/{chunk-4KIFAVR2.js → chunk-RR3NFNWL.js} +1 -1
  93. package/chunks/{chunk-2ZWVSKPK.js → chunk-RYQDRFLW.js} +1 -1
  94. package/chunks/{chunk-NVD63O5H.js → chunk-S7CWSAUQ.js} +1 -1
  95. package/chunks/{chunk-66DZADDA.js → chunk-SAJKF4WS.js} +1 -1
  96. package/chunks/chunk-SINRWOVD.js +36 -0
  97. package/chunks/{chunk-HSN5QUS7.js → chunk-SJNQ6I23.js} +1 -1
  98. package/chunks/{chunk-3NB3FFLR.js → chunk-T2GM4S4G.js} +3 -3
  99. package/chunks/{chunk-GN7ODRDE.js → chunk-TCQJO42E.js} +1 -1
  100. package/chunks/{chunk-67PM7M5R.js → chunk-TIIDF23U.js} +2 -2
  101. package/chunks/{chunk-USR2Y7B3.js → chunk-TKH5R7RZ.js} +1 -1
  102. package/chunks/{chunk-GTQULDIL.js → chunk-TSRTZD3X.js} +1 -1
  103. package/chunks/{chunk-GXNGLDUN.js → chunk-UXSXKLRH.js} +1 -1
  104. package/chunks/{chunk-JJQJFMPL.js → chunk-UYI5AMPI.js} +1 -1
  105. package/chunks/{chunk-SHKSVOTG.js → chunk-VO6SPDH4.js} +1 -1
  106. package/chunks/{chunk-AE6E2YKY.js → chunk-VRIHYTDI.js} +1 -1
  107. package/chunks/{chunk-6T25QVBX.js → chunk-VT47A26Q.js} +1 -1
  108. package/chunks/{chunk-2VW4HXVF.js → chunk-VZOZUCZX.js} +1 -1
  109. package/chunks/{chunk-724YPZRX.js → chunk-WLEGTKGA.js} +1 -1
  110. package/chunks/{chunk-ZOWMHZWO.js → chunk-XHCJN4A2.js} +1 -1
  111. package/chunks/{chunk-J773THNP.js → chunk-XTRZ5PHG.js} +1 -1
  112. package/chunks/{chunk-H65ZVST6.js → chunk-Y4GZOZWD.js} +1 -1
  113. package/chunks/{chunk-E6LRCLLE.js → chunk-YUCAGV52.js} +2 -2
  114. package/chunks/{chunk-FS67DOZQ.js → chunk-YWQM4TSO.js} +1 -1
  115. package/chunks/{chunk-P42MFWO2.js → chunk-YYTOHY4V.js} +1 -1
  116. package/chunks/{chunk-PSSJDUZB.js → chunk-Z25W2S5N.js} +1 -1
  117. package/chunks/{chunk-VF2UWWI2.js → chunk-Z6GECBAJ.js} +1 -1
  118. package/chunks/{chunk-HZ4L4MDM.js → chunk-ZJU4B4WX.js} +1 -1
  119. package/chunks/{chunk-RRMTSVGU.js → chunk-ZSHDQPAO.js} +1 -1
  120. package/chunks/{chunk-PFKTTUGS.js → chunk-ZUWLTGSR.js} +6 -6
  121. package/chunks/{codex-subagent-executor-UCDGQFTR.js → codex-subagent-executor-2V4NB7IR.js} +1 -1
  122. package/chunks/{config-utils-Z6F4DVLG.js → config-utils-5B2LYCON.js} +1 -1
  123. package/chunks/{contextCommand-HMVZT56Y.js → contextCommand-UPQGRXWK.js} +1 -1
  124. package/chunks/{core-runtime-AV7CJXOL.js → core-runtime-DPMH2BXK.js} +1 -1
  125. package/chunks/{create-sub-session-NNKVHZKT.js → create-sub-session-EJVB3FE5.js} +1 -1
  126. package/chunks/{cron-create-HWZDFVPA.js → cron-create-V2A7PMQC.js} +1 -1
  127. package/chunks/{daemon-git-worktree-guard-Q3C45X7T.js → daemon-git-worktree-guard-YEIMR2X7.js} +1 -1
  128. package/chunks/{daemon-status-provider-UX574XBB.js → daemon-status-provider-6BRB5TG3.js} +1 -1
  129. package/chunks/{daemon-trust-policy-6D4KJANB.js → daemon-trust-policy-BEXVFO4M.js} +1 -1
  130. package/chunks/{daemon-trust-policy-monitor-BZ46W4IA.js → daemon-trust-policy-monitor-BVS6LXBX.js} +1 -1
  131. package/chunks/{deferred-core-runtime-YC5XIWEI.js → deferred-core-runtime-NTKFHL5J.js} +1 -1
  132. package/chunks/{edit-LOWDEKPX.js → edit-LRG3TMHP.js} +1 -1
  133. package/chunks/{enterPlanMode-NGSATDRH.js → enterPlanMode-KOUSHJHR.js} +1 -1
  134. package/chunks/{environment-CVIB5DW4.js → environment-54CM3OXE.js} +1 -1
  135. package/chunks/{errors-USKSVZFO.js → errors-D6XR3NH4.js} +1 -1
  136. package/chunks/{execution-tool-QSJLRU5N.js → execution-tool-7RZ2JLEK.js} +1 -1
  137. package/chunks/{execution-worker-TQEIC4AJ.js → execution-worker-LXQ7WAFG.js} +1 -1
  138. package/chunks/{exitPlanMode-AW2HOTIK.js → exitPlanMode-4FGFA2QC.js} +1 -1
  139. package/chunks/{fast-path-OQWHYDXC.js → fast-path-4B7OKPYK.js} +1 -1
  140. package/chunks/{glob-7U6FQSWZ.js → glob-N2D7SY23.js} +1 -1
  141. package/chunks/{goal-tools-5ZB6GPCJ.js → goal-tools-7RNSDRFO.js} +1 -1
  142. package/chunks/{handleAutoUpdate-MLUFTWFP.js → handleAutoUpdate-PKKJQAKG.js} +1 -1
  143. package/chunks/{i18n-QAPQLOC3.js → i18n-F3OAHCLJ.js} +1 -1
  144. package/chunks/{initializer-B27IZ7K4.js → initializer-OL3DDWR7.js} +1 -1
  145. package/chunks/{installationInfo-SAMHABWV.js → installationInfo-D2L743RV.js} +1 -1
  146. package/chunks/{interactive-mod-session-7LQ5CYUR.js → interactive-mod-session-2GXRCQKR.js} +1 -1
  147. package/chunks/{list-TDMJQDQO.js → list-PU7ZXBY5.js} +1 -1
  148. package/chunks/{llm-R2RFT63S.js → llm-V42HGUVH.js} +4 -4
  149. package/chunks/{loadedSettingsAdapter-ZQK5KMEW.js → loadedSettingsAdapter-KAEVWWRX.js} +1 -1
  150. package/chunks/{local-AONDQYFL.js → local-KM5F5RAB.js} +1 -1
  151. package/chunks/{local-execution-environment-WJVCE26F.js → local-execution-environment-OEO2KW3M.js} +1 -1
  152. package/chunks/{loggingContentGenerator-ALSG42YA.js → loggingContentGenerator-DQLXSDZR.js} +1 -1
  153. package/chunks/{loop-wakeup-LFU4LDJM.js → loop-wakeup-CJICM24Y.js} +1 -1
  154. package/chunks/{manage-memory-FBL6CHX2.js → manage-memory-7CV6LF4C.js} +1 -1
  155. package/chunks/{managed-execution-engine-FX7FDAWW.js → managed-execution-engine-JEAIQ7L4.js} +1 -1
  156. package/chunks/{managed-local-serve-DRNC6PTL.js → managed-local-serve-KA37YWRW.js} +1 -1
  157. package/chunks/{managed-npm-update-2MKV7UOI.js → managed-npm-update-TSUUH3NN.js} +1 -1
  158. package/chunks/{managed-runtime-attestation-worker-DBAHM5MN.js → managed-runtime-attestation-worker-PUZ2ECM5.js} +1 -1
  159. package/chunks/{managed-runtime-bootstrap-K3GRKDNQ.js → managed-runtime-bootstrap-SERIRKPD.js} +1 -1
  160. package/chunks/{managed-runtime-session-worker-YN4KML7A.js → managed-runtime-session-worker-UOXK63YX.js} +1 -1
  161. package/chunks/{managed-runtime-ssh-worker-AVNBWFYC.js → managed-runtime-ssh-worker-VKZYIX6R.js} +1 -1
  162. package/chunks/{managed-session-authority-MFEINLXC.js → managed-session-authority-5FYS3G3M.js} +1 -1
  163. package/chunks/{mcp-TS5PX5FY.js → mcp-TRPV3K74.js} +1 -1
  164. package/chunks/{memory-JVT5LAWJ.js → memory-5CMNRPM2.js} +1 -1
  165. package/chunks/{model-call-collection-TNBMD3YL.js → model-call-collection-S4JKVFUO.js} +1 -1
  166. package/chunks/{model-configuration-6KTQQTMO.js → model-configuration-NEIDLKWQ.js} +1 -1
  167. package/chunks/{modelConfigUtils-LCZZ3EQU.js → modelConfigUtils-LZLQOZKJ.js} +1 -1
  168. package/chunks/{monitor-KCCNIKLE.js → monitor-5MNKK5AO.js} +1 -1
  169. package/chunks/{nonInteractiveCli-2GHQYHGW.js → nonInteractiveCli-DDTGU2ER.js} +1 -1
  170. package/chunks/{nonInteractiveToolExecutor-R5CTTWKD.js → nonInteractiveToolExecutor-N7PCYCKO.js} +1 -1
  171. package/chunks/{notebook-edit-KIWE2XOA.js → notebook-edit-7HIBTFFW.js} +1 -1
  172. package/chunks/{omni-IFTMWBMU.js → omni-MX7BMOL5.js} +1 -1
  173. package/chunks/{openaiContentGenerator-XP3VPU6C.js → openaiContentGenerator-NOIIZNRX.js} +1 -1
  174. package/chunks/{openaiResponsesContentGenerator-ZJ6C22EA.js → openaiResponsesContentGenerator-5JJ6G7RS.js} +1 -1
  175. package/chunks/{pidfile-42P24JIA.js → pidfile-OHAGZOTV.js} +1 -1
  176. package/chunks/{processUtils-I2XOO5U2.js → processUtils-TCDNCYVB.js} +1 -1
  177. package/chunks/{prompt-terminal-ledger-7EW46VQ4.js → prompt-terminal-ledger-4ZUOCMOS.js} +1 -1
  178. package/chunks/{reactive-degrade-O4JO7MOX.js → reactive-degrade-C7CGUJNP.js} +1 -1
  179. package/chunks/{read-file-VGC4O7F2.js → read-file-L4ZF6VDG.js} +1 -1
  180. package/chunks/{resumeHistoryUtils-QMVIHQRW.js → resumeHistoryUtils-WK3I4OIL.js} +1 -1
  181. package/chunks/{review-NDK2B7XI.js → review-F6JGI2LP.js} +1 -1
  182. package/chunks/{ripGrep-JY4PZABK.js → ripGrep-L6M2GPCM.js} +1 -1
  183. package/chunks/{run-qwen-serve-P5X5OZUH.js → run-qwen-serve-D5HB55SC.js} +1 -1
  184. package/chunks/{runtime-OL7B72CH.js → runtime-CH3RAOQL.js} +1 -1
  185. package/chunks/{sandboxConfig-EJTMWZHD.js → sandboxConfig-EADWCO37.js} +1 -1
  186. package/chunks/{scheduled-tasks-XQSZWZXG.js → scheduled-tasks-PBKD4BHY.js} +1 -1
  187. package/chunks/{scheduler-3TIRZEVB.js → scheduler-U5K3523K.js} +1 -1
  188. package/chunks/{search-memory-P5KOTUVV.js → search-memory-Y2IPKBDP.js} +1 -1
  189. package/chunks/{send-message-KFSKFXLX.js → send-message-JJQG2S6D.js} +1 -1
  190. package/chunks/{serve-UHEH433U.js → serve-2ZYS47MO.js} +1 -1
  191. package/chunks/{server-ARYDETSZ.js → server-5GMO4IHU.js} +3 -3
  192. package/chunks/{session-HKWGCZF2.js → session-LLOOVSHK.js} +1 -1
  193. package/chunks/{session-attachments-root-O3YQ7HWD.js → session-attachments-root-XCLXH2XO.js} +1 -1
  194. package/chunks/{session-execution-engine-selector-LZBHS3UO.js → session-execution-engine-selector-5QPWJZSF.js} +1 -1
  195. package/chunks/{session-pr-refresh-L5Z5WCXS.js → session-pr-refresh-MDBOAN3R.js} +1 -1
  196. package/chunks/{sessionService-MMPZUN5X.js → sessionService-VKAHCTCC.js} +1 -1
  197. package/chunks/{settings-7PYHXPN4.js → settings-ULEB2IYZ.js} +1 -1
  198. package/chunks/{shell-E6QLKRVU.js → shell-RBEKIYKU.js} +1 -1
  199. package/chunks/{skill-55IZUUM5.js → skill-GEVOEFMZ.js} +1 -1
  200. package/chunks/{skill-settings-A2M5BPH7.js → skill-settings-4IMGLYJW.js} +1 -1
  201. package/chunks/{spawnChannel-KWU26CB7.js → spawnChannel-B7L5PWQ6.js} +1 -1
  202. package/chunks/{standalone-update-32WYZ3BJ.js → standalone-update-SYQM6NOC.js} +1 -1
  203. package/chunks/{start-opentui-ui-S7A4FBGP.js → start-opentui-ui-N427PLF4.js} +2 -2
  204. package/chunks/{startInteractiveUI-DY6DWFW7.js → startInteractiveUI-AS6GZKJJ.js} +1 -1
  205. package/chunks/{team-create-ARICYIQB.js → team-create-MN6FHUHU.js} +1 -1
  206. package/chunks/{team-plan-approval-JPRE6Q3R.js → team-plan-approval-OUYBIT7H.js} +1 -1
  207. package/chunks/{terminal-image-renderer-HVIZ2VNE.js → terminal-image-renderer-MXZDUEOS.js} +1 -1
  208. package/chunks/{theme-manager-UEPLIBUP.js → theme-manager-QOYSKWFK.js} +1 -1
  209. package/chunks/{tool-call-EFJKXI3Z.js → tool-call-Q5NLEQFD.js} +1 -1
  210. package/chunks/{tool-result-media-LMIYNXSD.js → tool-result-media-NZJZTOBQ.js} +1 -1
  211. package/chunks/{tool-search-D7HQTRQG.js → tool-search-D6Y45RNQ.js} +1 -1
  212. package/chunks/{total-session-admission-67QMR44O.js → total-session-admission-36W7MDHP.js} +1 -1
  213. package/chunks/{trustedFolders-HARYVS3F.js → trustedFolders-XW5VH6HK.js} +1 -1
  214. package/chunks/{update-relaunch-NVNPOK5J.js → update-relaunch-KQPR2HAP.js} +1 -1
  215. package/chunks/{updateCheck-7NMXUCTN.js → updateCheck-SRW67WAX.js} +1 -1
  216. package/chunks/{upload-config-W2SICJ32.js → upload-config-BTJNYMRX.js} +1 -1
  217. package/chunks/{useAutoAcceptIndicator-ELMIP4TJ.js → useAutoAcceptIndicator-N3RRUBSL.js} +1 -1
  218. package/chunks/{validateNonInterActiveAuth-P2F6MYO6.js → validateNonInterActiveAuth-SWNH4FY4.js} +1 -1
  219. package/chunks/{version-2ZFKVIIW.js → version-6R6LSGXO.js} +1 -1
  220. package/chunks/{web-fetch-537RS6IX.js → web-fetch-Y7LBAU3R.js} +1 -1
  221. package/chunks/{web-search-O27MYFSW.js → web-search-IB4NYYUH.js} +1 -1
  222. package/chunks/{workflow-6QF4RMYM.js → workflow-TR4YIPJO.js} +1 -1
  223. package/chunks/{workflow-ancestor-trust-CABLU3VV.js → workflow-ancestor-trust-AHDUBOR7.js} +1 -1
  224. package/chunks/{workspace-agents-5WP3PY7W.js → workspace-agents-MY2NFL6A.js} +1 -1
  225. package/chunks/{workspace-providers-status-7G2EJJEO.js → workspace-providers-status-DNCCKFVE.js} +1 -1
  226. package/chunks/{workspace-recovery-worker-ICCIDEWU.js → workspace-recovery-worker-22VK4T4R.js} +1 -1
  227. package/chunks/{workspace-registration-store-WHXMNQQQ.js → workspace-registration-store-64TGRRGC.js} +1 -1
  228. package/chunks/{workspace-registry-NXBODLYH.js → workspace-registry-E6LFL5GL.js} +1 -1
  229. package/chunks/{workspace-runtime-coordinator-CJXS273B.js → workspace-runtime-coordinator-UHJHBIQT.js} +1 -1
  230. package/chunks/{workspace-service-HUDE2RXN.js → workspace-service-OVEYIQOC.js} +1 -1
  231. package/chunks/{workspace-skills-status-FJC6U62F.js → workspace-skills-status-3NKXA5SK.js} +1 -1
  232. package/chunks/{workspace-trust-reconciler-ZIQ3A5ZB.js → workspace-trust-reconciler-JF7YHR52.js} +1 -1
  233. package/chunks/{write-file-652YGG7I.js → write-file-FSTHYKKZ.js} +1 -1
  234. package/chunks/{zoom-image-YEH4O74G.js → zoom-image-JP3EUDXE.js} +1 -1
  235. package/cli.js +2 -2
  236. package/execution-worker.js +1 -1
  237. package/package.json +2 -2
  238. package/chunks/chunk-56PVVXUG.js +0 -8
  239. package/chunks/chunk-AJ75BPTA.js +0 -31
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{captureEnvironmentBeforeLoad,publishPendingCompileCache,resetEnvironmentSnapshotForTesting}from"./chunk-PKK2D2W4.js";import{DEFAULT_EXCLUDED_ENV_VARS,HOME_ENV_BOOTSTRAP_KEYS,PROJECT_ENV_HARDCODED_EXCLUSIONS,VERIFY_PR_COORDINATE_ENV,isHardcodedProjectEnvExclusion,isLoaderEnvKey,isPrivateProvenanceEnvKey,keepsEmptyHomeEnvValue,reportRejectedLoaderKeys,resetLoaderKeyRejectionReportingForTesting}from"./chunk-AJTR5LAF.js";import{isWorkspaceTrusted}from"./chunk-WZTO3EYG.js";import{isWithinRoot}from"./chunk-IDXJIDME.js";import{require_main}from"./chunk-HW7ZRPZU.js";import{PRIVATE_RELAUNCH_ENV_PROVENANCE}from"./chunk-3ITJ3AIN.js";import{writeStderrLineSafe}from"./chunk-M4ECEHLX.js";import{Storage}from"./chunk-5VB4YX3Z.js";import{QWEN_DIR}from"./chunk-2ZK2FGZQ.js";import{getErrorMessage}from"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var dotenv=__toESM(require_main(),1);import*as fs from"node:fs";import*as path from"node:path";import*as os from"node:os";var SETTINGS_DIRECTORY_NAME=QWEN_DIR;var RELOAD_EXCLUDED_KEYS=new Set([...PROJECT_ENV_HARDCODED_EXCLUSIONS,"LD_LIBRARY_PATH","DYLD_LIBRARY_PATH","ENV","PATH","HOME"]);var RELOAD_EXCLUDED_KEYS_CASEFOLDED=new Set([...RELOAD_EXCLUDED_KEYS].map(key=>key.toLowerCase()));function isReloadExcludedKey(key){return RELOAD_EXCLUDED_KEYS_CASEFOLDED.has(key.toLowerCase())||isHardcodedProjectEnvExclusion(key)}__name(isReloadExcludedKey,"isReloadExcludedKey");var dotEnvSourcedKeys=new Set;var settingsEnvSourcedKeys=new Set;var inheritedDotEnvKeys=new Set;var inheritedSettingsEnvKeys=new Set;var inheritedProvenance=process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];if(inheritedProvenance){const sources=JSON.parse(inheritedProvenance);if(!sources||typeof sources!=="object"||!("dotEnv"in sources)||!("settingsEnv"in sources)||!Array.isArray(sources.dotEnv)||!Array.isArray(sources.settingsEnv)||!sources.dotEnv.every(key=>typeof key==="string")||!sources.settingsEnv.every(key=>typeof key==="string")){throw new Error("Invalid inherited environment provenance.")}for(const key of sources.dotEnv)inheritedDotEnvKeys.add(key);for(const key of sources.settingsEnv)inheritedSettingsEnvKeys.add(key);Object.assign(process.env,getRelaunchEnvProvenance())}var DOCUMENTED_MODEL_ENV_KEYS=["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","QWEN_MODEL","ANTHROPIC_API_KEY","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","GEMINI_API_KEY","GEMINI_MODEL","GOOGLE_API_KEY","GOOGLE_MODEL"];var requestTimeEnvKeys=new Set;function rememberRequestTimeEnvKeys(settings){requestTimeEnvKeys.clear();for(const key of DOCUMENTED_MODEL_ENV_KEYS)requestTimeEnvKeys.add(key);for(const models of Object.values(settings.modelProviders??{})){if(!Array.isArray(models))continue;for(const model of models){const envKey=model?.envKey;if(typeof envKey==="string"&&envKey&&!isHardcodedProjectEnvExclusion(envKey)&&!isLoaderEnvKey(envKey)){requestTimeEnvKeys.add(envKey)}}}}__name(rememberRequestTimeEnvKeys,"rememberRequestTimeEnvKeys");function hasLoadedEnvironmentValues(){for(const keys of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of keys){if(!requestTimeEnvKeys.has(key))return true}}return false}__name(hasLoadedEnvironmentValues,"hasLoadedEnvironmentValues");function getRelaunchEnvProvenance(){return{[PRIVATE_RELAUNCH_ENV_PROVENANCE]:JSON.stringify({dotEnv:[...new Set([...inheritedDotEnvKeys,...dotEnvSourcedKeys])],settingsEnv:[...new Set([...inheritedSettingsEnvKeys,...settingsEnvSourcedKeys])]})}}__name(getRelaunchEnvProvenance,"getRelaunchEnvProvenance");var lastReloadSnapshot=new Map;var lastReloadSnapshotSeeded=false;function getUserLevelEnvPaths(){const homeDir=os.homedir();const globalQwenDir=Storage.getGlobalQwenDir();const paths=new Set([path.normalize(path.join(homeDir,".env")),path.normalize(path.join(globalQwenDir,".env"))]);const legacyQwenEnv=path.normalize(path.join(homeDir,QWEN_DIR,".env"));paths.add(legacyQwenEnv);return paths}__name(getUserLevelEnvPaths,"getUserLevelEnvPaths");var homeEnvBootstrapped=false;function preResolveHomeEnvOverrides(){if(homeEnvBootstrapped){return}homeEnvBootstrapped=true;if(HOME_ENV_BOOTSTRAP_KEYS.every(key=>process.env[key])){return}const initialQwenHome=process.env["QWEN_HOME"];const initialQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(initialQwenDir,".env")];if(!initialQwenHome){candidates.push(path.join(path.dirname(initialQwenDir),".env"))}for(const candidate of candidates){readHomeEnvInto(candidate)}const discoveredQwenHome=process.env["QWEN_HOME"];if(discoveredQwenHome&&discoveredQwenHome!==initialQwenHome){const discoveredDir=Storage.getGlobalQwenDir();if(discoveredDir!==initialQwenDir){readHomeEnvInto(path.join(discoveredDir,".env"))}}}__name(preResolveHomeEnvOverrides,"preResolveHomeEnvOverrides");function readHomeEnvInto(file){if(!fs.existsSync(file)){return}try{const parsed=dotenv.parse(fs.readFileSync(file,"utf-8"));for(const key of HOME_ENV_BOOTSTRAP_KEYS){if((parsed[key]||keepsEmptyHomeEnvValue(key)&&parsed[key]!==void 0)&&!Object.hasOwn(process.env,key)){process.env[key]=parsed[key]}}}catch(_e){}}__name(readHomeEnvInto,"readHomeEnvInto");function resetHomeEnvBootstrapForTesting(){homeEnvBootstrapped=false}__name(resetHomeEnvBootstrapForTesting,"resetHomeEnvBootstrapForTesting");function resetEnvironmentTrackingForTesting(){resetLoaderKeyRejectionReportingForTesting();resetEnvironmentSnapshotForTesting();dotEnvSourcedKeys.clear();settingsEnvSourcedKeys.clear();inheritedDotEnvKeys.clear();inheritedSettingsEnvKeys.clear();requestTimeEnvKeys.clear();delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];lastReloadSnapshot.clear();lastReloadSnapshotSeeded=false}__name(resetEnvironmentTrackingForTesting,"resetEnvironmentTrackingForTesting");function isFileSourcedEnvKey(key){const sources=[dotEnvSourcedKeys,settingsEnvSourcedKeys,inheritedDotEnvKeys,inheritedSettingsEnvKeys];if(sources.some(keys=>keys.has(key))){return true}if(process.platform!=="win32")return false;const lower=key.toLowerCase();for(const keys of sources){for(const tracked of keys){if(tracked.toLowerCase()===lower)return true}}return false}__name(isFileSourcedEnvKey,"isFileSourcedEnvKey");function getHomeEnvFallbackVars(onReadError){const globalQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(globalQwenDir,".env")];if(!process.env["QWEN_HOME"]){candidates.push(path.join(path.dirname(globalQwenDir),".env"))}const result={};for(const candidate of candidates){if(!fs.existsSync(candidate)){continue}try{const parsed=dotenv.parse(fs.readFileSync(candidate,"utf-8"));for(const key in parsed){if(Object.hasOwn(parsed,key)&&!Object.hasOwn(process.env,key)){result[key]??=parsed[key]}}}catch(e){onReadError?.(`Failed to read home .env candidate ${candidate}: ${getErrorMessage(e)}`)}}return result}__name(getHomeEnvFallbackVars,"getHomeEnvFallbackVars");function findEnvFiles(settings,startDir,userLevelPaths=getUserLevelEnvPaths(),workspaceTrusted){const homeDir=os.homedir();let realStartDir=path.resolve(startDir);try{realStartDir=fs.realpathSync(realStartDir)}catch{}const globalQwenDir=Storage.getGlobalQwenDir();const legacyQwenDir=path.normalize(path.join(homeDir,QWEN_DIR));const hasCustomConfigDir=path.normalize(globalQwenDir)!==legacyQwenDir;const found=[];const seen=new Set;const workspaceIsTrusted=workspaceTrusted??isWorkspaceTrusted(settings,void 0,realStartDir).isTrusted===true;const canUseEnvFile=__name(filePath=>{const normalized=path.normalize(filePath);if(userLevelPaths.has(normalized))return true;if(!workspaceIsTrusted)return false;const dirPath=path.dirname(normalized);const workspaceDir=path.basename(dirPath)===SETTINGS_DIRECTORY_NAME?path.dirname(dirPath):dirPath;if(workspaceDir===realStartDir)return true;return isWorkspaceTrusted(settings,void 0,workspaceDir).isTrusted!==false},"canUseEnvFile");const pushCandidate=__name(filePath=>{const normalized=path.normalize(filePath);if(!seen.has(normalized)&&fs.existsSync(filePath)&&canUseEnvFile(filePath)){seen.add(normalized);found.push(filePath);return true}return false},"pushCandidate");const pushHomeCandidates=__name(()=>{const candidates=[path.join(globalQwenDir,".env")];if(hasCustomConfigDir){candidates.push(path.join(legacyQwenDir,".env"))}candidates.push(path.join(homeDir,".env"));for(const candidate of candidates){pushCandidate(candidate)}},"pushHomeCandidates");if(path.resolve(startDir)===path.resolve(homeDir)){pushHomeCandidates();return found}let currentDir=realStartDir;let visitedHomeDir=false;while(true){if(currentDir===homeDir){visitedHomeDir=true;pushHomeCandidates();return found}else{const geminiEnvPath=path.join(currentDir,QWEN_DIR,".env");if(pushCandidate(geminiEnvPath)){pushHomeCandidates();return found}const envPath=path.join(currentDir,".env");if(pushCandidate(envPath)){pushHomeCandidates();return found}}const parentDir=path.dirname(currentDir);if(parentDir===currentDir||!parentDir){if(!visitedHomeDir){pushHomeCandidates()}return found}currentDir=parentDir}}__name(findEnvFiles,"findEnvFiles");function setUpCloudShellEnvironment(envFilePath){if(envFilePath&&fs.existsSync(envFilePath)){const envFileContent=fs.readFileSync(envFilePath);const parsedEnv=dotenv.parse(envFileContent);if(parsedEnv["GOOGLE_CLOUD_PROJECT"]){process.env["GOOGLE_CLOUD_PROJECT"]=parsedEnv["GOOGLE_CLOUD_PROJECT"]}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}__name(setUpCloudShellEnvironment,"setUpCloudShellEnvironment");function setUpCloudShellEnvironmentInEnv(env,envFiles){for(const envFile of envFiles){if(envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"]){env["GOOGLE_CLOUD_PROJECT"]=envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"];return}}env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}__name(setUpCloudShellEnvironmentInEnv,"setUpCloudShellEnvironmentInEnv");function readProjectEnvFiles(settings,startDir,workspaceTrusted){const userLevelPaths=getUserLevelEnvPaths();let workspaceRoot=path.resolve(startDir);try{workspaceRoot=fs.realpathSync(workspaceRoot)}catch{}const isInsideWorkspace=__name(filePath=>{let resolved;try{resolved=fs.realpathSync(filePath)}catch{return false}return isWithinRoot(resolved,workspaceRoot)},"isInsideWorkspace");const files={};for(const file of findEnvFiles(settings,startDir,userLevelPaths,workspaceTrusted)){if(userLevelPaths.has(path.normalize(file)))continue;if(!isInsideWorkspace(file))continue;try{files[file]=dotenv.parse(fs.readFileSync(file,"utf-8"))}catch{files[file]=null}}return files}__name(readProjectEnvFiles,"readProjectEnvFiles");function parseEnvFiles(envFilePaths,userLevelPaths){const files=[];const readFailures=[];for(const envFilePath of envFilePaths){try{const envFileContent=fs.readFileSync(envFilePath,"utf-8");const parsedEnv=dotenv.parse(envFileContent);const normalizedEnvFilePath=path.normalize(envFilePath);const isHomeScopedEnvFile=userLevelPaths.has(normalizedEnvFilePath);const isQwenScopedEnvFile=isHomeScopedEnvFile||path.basename(path.dirname(normalizedEnvFilePath))===QWEN_DIR;files.push({path:envFilePath,parsedEnv,isHomeScopedEnvFile,isQwenScopedEnvFile})}catch(err){readFailures.push({path:envFilePath,error:getErrorMessage(err)})}}return{files,readFailed:readFailures.length>0,readFailures}}__name(parseEnvFiles,"parseEnvFiles");function canApplyParsedEnvKey(envFile,key,excludedVars,options={}){if(!Object.hasOwn(envFile.parsedEnv,key))return false;if(isLoaderEnvKey(key))return false;if(isPrivateProvenanceEnvKey(key))return false;if(options.reload&&isReloadExcludedKey(key))return false;if(!envFile.isHomeScopedEnvFile&&isHardcodedProjectEnvExclusion(key)){return false}return envFile.isQwenScopedEnvFile||!excludedVars.includes(key)}__name(canApplyParsedEnvKey,"canApplyParsedEnvKey");function isEffectivelyUnset(env,key){const existingValue=env[key];return!Object.hasOwn(env,key)||existingValue===""}__name(isEffectivelyUnset,"isEffectivelyUnset");function setRuntimeEnvIfUnset(env,key,value){if(isEffectivelyUnset(env,key)){env[key]=value}}__name(setRuntimeEnvIfUnset,"setRuntimeEnvIfUnset");function reportRejectedSettingsEnv(env,startDir){const source=`settings.env (${startDir})`;reportRejectedLoaderKeys(source,Object.keys(env));if(Object.entries(env).some(([key,value])=>key.toUpperCase()==="QWEN_AGENT_EXECUTION_BACKEND"&&typeof value==="string"&&value.trim()!=="")){writeStderrLineSafe(`qwen: ${source} cannot set QWEN_AGENT_EXECUTION_BACKEND; ignored. Export it in the launch environment instead.`)}for(const[setting,key]of Object.entries(VERIFY_PR_COORDINATE_ENV)){const entry=Object.entries(env).find(([candidate,value])=>candidate.toUpperCase()===key&&typeof value==="string"&&value.trim()!=="");if(!entry)continue;writeStderrLineSafe(`qwen: ${source} cannot set ${entry[0]}; ignored. Set verifyPr.${setting} at user scope in settings.json, or export it in the launch environment.`)}}__name(reportRejectedSettingsEnv,"reportRejectedSettingsEnv");function buildRuntimeEnvironment(settings,startDir=process.cwd(),baseEnv=process.env,workspaceTrusted){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);const effectiveEnv={...baseEnv};if(baseEnv["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(effectiveEnv,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}setRuntimeEnvIfUnset(effectiveEnv,key,envFile.parsedEnv[key])}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(excludedVars.includes(key))continue;if(typeof value!=="string")continue;setRuntimeEnvIfUnset(effectiveEnv,key,value)}reportRejectedSettingsEnv(settings.env,startDir)}const overlayKeys=Object.keys(effectiveEnv).filter(key=>effectiveEnv[key]!==baseEnv[key]).sort();return{effectiveEnv:Object.freeze({...effectiveEnv}),overlayKeys:Object.freeze(overlayKeys),envFilePaths:Object.freeze([...envFilePaths]),envFileReadFailed:parsedEnvFiles.readFailed,envFileReadFailures:Object.freeze([...parsedEnvFiles.readFailures])}}__name(buildRuntimeEnvironment,"buildRuntimeEnvironment");function loadEnvironment(settings,startDir=process.cwd()){captureEnvironmentBeforeLoad();rememberRequestTimeEnvKeys(settings);const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars))continue;const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue===""&&!keepsEmptyHomeEnvValue(key);if(isEffectivelyUnset2){process.env[key]=envFile.parsedEnv[key];dotEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key)){continue}if(isReloadExcludedKey(key)){continue}if(isHardcodedProjectEnvExclusion(key)){continue}const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue==="";if(isEffectivelyUnset2&&typeof value==="string"){process.env[key]=value;settingsEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&typeof value==="string"&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,value)}}reportRejectedSettingsEnv(settings.env,startDir)}lastReloadSnapshotSeeded=true;Object.assign(process.env,getRelaunchEnvProvenance());publishPendingCompileCache()}__name(loadEnvironment,"loadEnvironment");function reloadEnvironment(settings,workspaceCwd,workspaceTrusted,options={}){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,workspaceCwd,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(parsedEnvFiles.readFailed&&options.failClosedOnEnvFileReadError){return{updatedKeys:[],removedKeys:[],envFileReadFailed:true}}if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}const dotEnvReadFailed=parsedEnvFiles.readFailed;const newDotEnvKeys=new Map;const newSettingsEnvKeys=new Map;for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}if(!newDotEnvKeys.has(key)){newDotEnvKeys.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(typeof value!=="string")continue;const dotEnvValue=newDotEnvKeys.get(key);if(dotEnvValue!==void 0&&dotEnvValue!=="")continue;if(dotEnvReadFailed&&lastReloadSnapshot.has(key))continue;newSettingsEnvKeys.set(key,value)}reportRejectedSettingsEnv(settings.env,workspaceCwd)}const allNewKeys=new Set([...newDotEnvKeys.keys(),...newSettingsEnvKeys.keys()]);const updatedKeys=[];const removedKeys=[];if(!dotEnvReadFailed){const previouslyKnown=new Set([...lastReloadSnapshot.keys(),...dotEnvSourcedKeys,...settingsEnvSourcedKeys]);for(const key of previouslyKnown){if(!allNewKeys.has(key)&&!isReloadExcludedKey(key)){delete process.env[key];inheritedDotEnvKeys.delete(key);inheritedSettingsEnvKeys.delete(key);removedKeys.push(key)}}}for(const[key,value]of newDotEnvKeys){if(value===""&&newSettingsEnvKeys.has(key))continue;if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}for(const[key,value]of newSettingsEnvKeys){if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}if(!dotEnvReadFailed){for(const sources of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of sources){if(!isReloadExcludedKey(key))sources.delete(key)}}lastReloadSnapshot.clear();for(const[key,value]of newDotEnvKeys){lastReloadSnapshot.set(key,value)}for(const[key,value]of newSettingsEnvKeys){lastReloadSnapshot.set(key,value)}}for(const key of newDotEnvKeys.keys()){dotEnvSourcedKeys.add(key)}for(const key of newSettingsEnvKeys.keys()){settingsEnvSourcedKeys.add(key)}Object.assign(process.env,getRelaunchEnvProvenance());return{updatedKeys,removedKeys,...dotEnvReadFailed?{envFileReadFailed:true}:{}}}__name(reloadEnvironment,"reloadEnvironment");export{SETTINGS_DIRECTORY_NAME,hasLoadedEnvironmentValues,getRelaunchEnvProvenance,preResolveHomeEnvOverrides,resetHomeEnvBootstrapForTesting,resetEnvironmentTrackingForTesting,isFileSourcedEnvKey,getHomeEnvFallbackVars,findEnvFiles,setUpCloudShellEnvironment,readProjectEnvFiles,buildRuntimeEnvironment,loadEnvironment,reloadEnvironment};
3
+ import{captureEnvironmentBeforeLoad,publishPendingCompileCache,resetEnvironmentSnapshotForTesting}from"./chunk-PKK2D2W4.js";import{DEFAULT_EXCLUDED_ENV_VARS,HOME_ENV_BOOTSTRAP_KEYS,PROJECT_ENV_HARDCODED_EXCLUSIONS,VERIFY_PR_COORDINATE_ENV,isHardcodedProjectEnvExclusion,isLoaderEnvKey,isPrivateProvenanceEnvKey,keepsEmptyHomeEnvValue,reportRejectedLoaderKeys,resetLoaderKeyRejectionReportingForTesting}from"./chunk-AJTR5LAF.js";import{isWorkspaceTrusted}from"./chunk-EYECE2PH.js";import{isWithinRoot}from"./chunk-IDXJIDME.js";import{require_main}from"./chunk-HW7ZRPZU.js";import{PRIVATE_RELAUNCH_ENV_PROVENANCE}from"./chunk-3ITJ3AIN.js";import{writeStderrLineSafe}from"./chunk-M4ECEHLX.js";import{Storage}from"./chunk-5VB4YX3Z.js";import{QWEN_DIR}from"./chunk-2ZK2FGZQ.js";import{getErrorMessage}from"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var dotenv=__toESM(require_main(),1);import*as fs from"node:fs";import*as path from"node:path";import*as os from"node:os";var SETTINGS_DIRECTORY_NAME=QWEN_DIR;var RELOAD_EXCLUDED_KEYS=new Set([...PROJECT_ENV_HARDCODED_EXCLUSIONS,"LD_LIBRARY_PATH","DYLD_LIBRARY_PATH","ENV","PATH","HOME"]);var RELOAD_EXCLUDED_KEYS_CASEFOLDED=new Set([...RELOAD_EXCLUDED_KEYS].map(key=>key.toLowerCase()));function isReloadExcludedKey(key){return RELOAD_EXCLUDED_KEYS_CASEFOLDED.has(key.toLowerCase())||isHardcodedProjectEnvExclusion(key)}__name(isReloadExcludedKey,"isReloadExcludedKey");var dotEnvSourcedKeys=new Set;var settingsEnvSourcedKeys=new Set;var inheritedDotEnvKeys=new Set;var inheritedSettingsEnvKeys=new Set;var inheritedProvenance=process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];if(inheritedProvenance){const sources=JSON.parse(inheritedProvenance);if(!sources||typeof sources!=="object"||!("dotEnv"in sources)||!("settingsEnv"in sources)||!Array.isArray(sources.dotEnv)||!Array.isArray(sources.settingsEnv)||!sources.dotEnv.every(key=>typeof key==="string")||!sources.settingsEnv.every(key=>typeof key==="string")){throw new Error("Invalid inherited environment provenance.")}for(const key of sources.dotEnv)inheritedDotEnvKeys.add(key);for(const key of sources.settingsEnv)inheritedSettingsEnvKeys.add(key);Object.assign(process.env,getRelaunchEnvProvenance())}var DOCUMENTED_MODEL_ENV_KEYS=["OPENAI_API_KEY","OPENAI_BASE_URL","OPENAI_MODEL","QWEN_MODEL","ANTHROPIC_API_KEY","ANTHROPIC_BASE_URL","ANTHROPIC_MODEL","GEMINI_API_KEY","GEMINI_MODEL","GOOGLE_API_KEY","GOOGLE_MODEL"];var requestTimeEnvKeys=new Set;function rememberRequestTimeEnvKeys(settings){requestTimeEnvKeys.clear();for(const key of DOCUMENTED_MODEL_ENV_KEYS)requestTimeEnvKeys.add(key);for(const models of Object.values(settings.modelProviders??{})){if(!Array.isArray(models))continue;for(const model of models){const envKey=model?.envKey;if(typeof envKey==="string"&&envKey&&!isHardcodedProjectEnvExclusion(envKey)&&!isLoaderEnvKey(envKey)){requestTimeEnvKeys.add(envKey)}}}}__name(rememberRequestTimeEnvKeys,"rememberRequestTimeEnvKeys");function hasLoadedEnvironmentValues(){for(const keys of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of keys){if(!requestTimeEnvKeys.has(key))return true}}return false}__name(hasLoadedEnvironmentValues,"hasLoadedEnvironmentValues");function getRelaunchEnvProvenance(){return{[PRIVATE_RELAUNCH_ENV_PROVENANCE]:JSON.stringify({dotEnv:[...new Set([...inheritedDotEnvKeys,...dotEnvSourcedKeys])],settingsEnv:[...new Set([...inheritedSettingsEnvKeys,...settingsEnvSourcedKeys])]})}}__name(getRelaunchEnvProvenance,"getRelaunchEnvProvenance");var lastReloadSnapshot=new Map;var lastReloadSnapshotSeeded=false;function getUserLevelEnvPaths(){const homeDir=os.homedir();const globalQwenDir=Storage.getGlobalQwenDir();const paths=new Set([path.normalize(path.join(homeDir,".env")),path.normalize(path.join(globalQwenDir,".env"))]);const legacyQwenEnv=path.normalize(path.join(homeDir,QWEN_DIR,".env"));paths.add(legacyQwenEnv);return paths}__name(getUserLevelEnvPaths,"getUserLevelEnvPaths");var homeEnvBootstrapped=false;function preResolveHomeEnvOverrides(){if(homeEnvBootstrapped){return}homeEnvBootstrapped=true;if(HOME_ENV_BOOTSTRAP_KEYS.every(key=>process.env[key])){return}const initialQwenHome=process.env["QWEN_HOME"];const initialQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(initialQwenDir,".env")];if(!initialQwenHome){candidates.push(path.join(path.dirname(initialQwenDir),".env"))}for(const candidate of candidates){readHomeEnvInto(candidate)}const discoveredQwenHome=process.env["QWEN_HOME"];if(discoveredQwenHome&&discoveredQwenHome!==initialQwenHome){const discoveredDir=Storage.getGlobalQwenDir();if(discoveredDir!==initialQwenDir){readHomeEnvInto(path.join(discoveredDir,".env"))}}}__name(preResolveHomeEnvOverrides,"preResolveHomeEnvOverrides");function readHomeEnvInto(file){if(!fs.existsSync(file)){return}try{const parsed=dotenv.parse(fs.readFileSync(file,"utf-8"));for(const key of HOME_ENV_BOOTSTRAP_KEYS){if((parsed[key]||keepsEmptyHomeEnvValue(key)&&parsed[key]!==void 0)&&!Object.hasOwn(process.env,key)){process.env[key]=parsed[key]}}}catch(_e){}}__name(readHomeEnvInto,"readHomeEnvInto");function resetHomeEnvBootstrapForTesting(){homeEnvBootstrapped=false}__name(resetHomeEnvBootstrapForTesting,"resetHomeEnvBootstrapForTesting");function resetEnvironmentTrackingForTesting(){resetLoaderKeyRejectionReportingForTesting();resetEnvironmentSnapshotForTesting();dotEnvSourcedKeys.clear();settingsEnvSourcedKeys.clear();inheritedDotEnvKeys.clear();inheritedSettingsEnvKeys.clear();requestTimeEnvKeys.clear();delete process.env[PRIVATE_RELAUNCH_ENV_PROVENANCE];lastReloadSnapshot.clear();lastReloadSnapshotSeeded=false}__name(resetEnvironmentTrackingForTesting,"resetEnvironmentTrackingForTesting");function isFileSourcedEnvKey(key){const sources=[dotEnvSourcedKeys,settingsEnvSourcedKeys,inheritedDotEnvKeys,inheritedSettingsEnvKeys];if(sources.some(keys=>keys.has(key))){return true}if(process.platform!=="win32")return false;const lower=key.toLowerCase();for(const keys of sources){for(const tracked of keys){if(tracked.toLowerCase()===lower)return true}}return false}__name(isFileSourcedEnvKey,"isFileSourcedEnvKey");function getHomeEnvFallbackVars(onReadError){const globalQwenDir=Storage.getGlobalQwenDir();const candidates=[path.join(globalQwenDir,".env")];if(!process.env["QWEN_HOME"]){candidates.push(path.join(path.dirname(globalQwenDir),".env"))}const result={};for(const candidate of candidates){if(!fs.existsSync(candidate)){continue}try{const parsed=dotenv.parse(fs.readFileSync(candidate,"utf-8"));for(const key in parsed){if(Object.hasOwn(parsed,key)&&!Object.hasOwn(process.env,key)){result[key]??=parsed[key]}}}catch(e){onReadError?.(`Failed to read home .env candidate ${candidate}: ${getErrorMessage(e)}`)}}return result}__name(getHomeEnvFallbackVars,"getHomeEnvFallbackVars");function findEnvFiles(settings,startDir,userLevelPaths=getUserLevelEnvPaths(),workspaceTrusted){const homeDir=os.homedir();let realStartDir=path.resolve(startDir);try{realStartDir=fs.realpathSync(realStartDir)}catch{}const globalQwenDir=Storage.getGlobalQwenDir();const legacyQwenDir=path.normalize(path.join(homeDir,QWEN_DIR));const hasCustomConfigDir=path.normalize(globalQwenDir)!==legacyQwenDir;const found=[];const seen=new Set;const workspaceIsTrusted=workspaceTrusted??isWorkspaceTrusted(settings,void 0,realStartDir).isTrusted===true;const canUseEnvFile=__name(filePath=>{const normalized=path.normalize(filePath);if(userLevelPaths.has(normalized))return true;if(!workspaceIsTrusted)return false;const dirPath=path.dirname(normalized);const workspaceDir=path.basename(dirPath)===SETTINGS_DIRECTORY_NAME?path.dirname(dirPath):dirPath;if(workspaceDir===realStartDir)return true;return isWorkspaceTrusted(settings,void 0,workspaceDir).isTrusted!==false},"canUseEnvFile");const pushCandidate=__name(filePath=>{const normalized=path.normalize(filePath);if(!seen.has(normalized)&&fs.existsSync(filePath)&&canUseEnvFile(filePath)){seen.add(normalized);found.push(filePath);return true}return false},"pushCandidate");const pushHomeCandidates=__name(()=>{const candidates=[path.join(globalQwenDir,".env")];if(hasCustomConfigDir){candidates.push(path.join(legacyQwenDir,".env"))}candidates.push(path.join(homeDir,".env"));for(const candidate of candidates){pushCandidate(candidate)}},"pushHomeCandidates");if(path.resolve(startDir)===path.resolve(homeDir)){pushHomeCandidates();return found}let currentDir=realStartDir;let visitedHomeDir=false;while(true){if(currentDir===homeDir){visitedHomeDir=true;pushHomeCandidates();return found}else{const geminiEnvPath=path.join(currentDir,QWEN_DIR,".env");if(pushCandidate(geminiEnvPath)){pushHomeCandidates();return found}const envPath=path.join(currentDir,".env");if(pushCandidate(envPath)){pushHomeCandidates();return found}}const parentDir=path.dirname(currentDir);if(parentDir===currentDir||!parentDir){if(!visitedHomeDir){pushHomeCandidates()}return found}currentDir=parentDir}}__name(findEnvFiles,"findEnvFiles");function setUpCloudShellEnvironment(envFilePath){if(envFilePath&&fs.existsSync(envFilePath)){const envFileContent=fs.readFileSync(envFilePath);const parsedEnv=dotenv.parse(envFileContent);if(parsedEnv["GOOGLE_CLOUD_PROJECT"]){process.env["GOOGLE_CLOUD_PROJECT"]=parsedEnv["GOOGLE_CLOUD_PROJECT"]}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}else{process.env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}}__name(setUpCloudShellEnvironment,"setUpCloudShellEnvironment");function setUpCloudShellEnvironmentInEnv(env,envFiles){for(const envFile of envFiles){if(envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"]){env["GOOGLE_CLOUD_PROJECT"]=envFile.parsedEnv["GOOGLE_CLOUD_PROJECT"];return}}env["GOOGLE_CLOUD_PROJECT"]="cloudshell-gca"}__name(setUpCloudShellEnvironmentInEnv,"setUpCloudShellEnvironmentInEnv");function readProjectEnvFiles(settings,startDir,workspaceTrusted){const userLevelPaths=getUserLevelEnvPaths();let workspaceRoot=path.resolve(startDir);try{workspaceRoot=fs.realpathSync(workspaceRoot)}catch{}const isInsideWorkspace=__name(filePath=>{let resolved;try{resolved=fs.realpathSync(filePath)}catch{return false}return isWithinRoot(resolved,workspaceRoot)},"isInsideWorkspace");const files={};for(const file of findEnvFiles(settings,startDir,userLevelPaths,workspaceTrusted)){if(userLevelPaths.has(path.normalize(file)))continue;if(!isInsideWorkspace(file))continue;try{files[file]=dotenv.parse(fs.readFileSync(file,"utf-8"))}catch{files[file]=null}}return files}__name(readProjectEnvFiles,"readProjectEnvFiles");function parseEnvFiles(envFilePaths,userLevelPaths){const files=[];const readFailures=[];for(const envFilePath of envFilePaths){try{const envFileContent=fs.readFileSync(envFilePath,"utf-8");const parsedEnv=dotenv.parse(envFileContent);const normalizedEnvFilePath=path.normalize(envFilePath);const isHomeScopedEnvFile=userLevelPaths.has(normalizedEnvFilePath);const isQwenScopedEnvFile=isHomeScopedEnvFile||path.basename(path.dirname(normalizedEnvFilePath))===QWEN_DIR;files.push({path:envFilePath,parsedEnv,isHomeScopedEnvFile,isQwenScopedEnvFile})}catch(err){readFailures.push({path:envFilePath,error:getErrorMessage(err)})}}return{files,readFailed:readFailures.length>0,readFailures}}__name(parseEnvFiles,"parseEnvFiles");function canApplyParsedEnvKey(envFile,key,excludedVars,options={}){if(!Object.hasOwn(envFile.parsedEnv,key))return false;if(isLoaderEnvKey(key))return false;if(isPrivateProvenanceEnvKey(key))return false;if(options.reload&&isReloadExcludedKey(key))return false;if(!envFile.isHomeScopedEnvFile&&isHardcodedProjectEnvExclusion(key)){return false}return envFile.isQwenScopedEnvFile||!excludedVars.includes(key)}__name(canApplyParsedEnvKey,"canApplyParsedEnvKey");function isEffectivelyUnset(env,key){const existingValue=env[key];return!Object.hasOwn(env,key)||existingValue===""}__name(isEffectivelyUnset,"isEffectivelyUnset");function setRuntimeEnvIfUnset(env,key,value){if(isEffectivelyUnset(env,key)){env[key]=value}}__name(setRuntimeEnvIfUnset,"setRuntimeEnvIfUnset");function reportRejectedSettingsEnv(env,startDir){const source=`settings.env (${startDir})`;reportRejectedLoaderKeys(source,Object.keys(env));if(Object.entries(env).some(([key,value])=>key.toUpperCase()==="QWEN_AGENT_EXECUTION_BACKEND"&&typeof value==="string"&&value.trim()!=="")){writeStderrLineSafe(`qwen: ${source} cannot set QWEN_AGENT_EXECUTION_BACKEND; ignored. Export it in the launch environment instead.`)}for(const[setting,key]of Object.entries(VERIFY_PR_COORDINATE_ENV)){const entry=Object.entries(env).find(([candidate,value])=>candidate.toUpperCase()===key&&typeof value==="string"&&value.trim()!=="");if(!entry)continue;writeStderrLineSafe(`qwen: ${source} cannot set ${entry[0]}; ignored. Set verifyPr.${setting} at user scope in settings.json, or export it in the launch environment.`)}}__name(reportRejectedSettingsEnv,"reportRejectedSettingsEnv");function buildRuntimeEnvironment(settings,startDir=process.cwd(),baseEnv=process.env,workspaceTrusted){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);const effectiveEnv={...baseEnv};if(baseEnv["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(effectiveEnv,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}setRuntimeEnvIfUnset(effectiveEnv,key,envFile.parsedEnv[key])}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(excludedVars.includes(key))continue;if(typeof value!=="string")continue;setRuntimeEnvIfUnset(effectiveEnv,key,value)}reportRejectedSettingsEnv(settings.env,startDir)}const overlayKeys=Object.keys(effectiveEnv).filter(key=>effectiveEnv[key]!==baseEnv[key]).sort();return{effectiveEnv:Object.freeze({...effectiveEnv}),overlayKeys:Object.freeze(overlayKeys),envFilePaths:Object.freeze([...envFilePaths]),envFileReadFailed:parsedEnvFiles.readFailed,envFileReadFailures:Object.freeze([...parsedEnvFiles.readFailures])}}__name(buildRuntimeEnvironment,"buildRuntimeEnvironment");function loadEnvironment(settings,startDir=process.cwd()){captureEnvironmentBeforeLoad();rememberRequestTimeEnvKeys(settings);const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,startDir,userLevelPaths);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars))continue;const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue===""&&!keepsEmptyHomeEnvValue(key);if(isEffectivelyUnset2){process.env[key]=envFile.parsedEnv[key];dotEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key)){continue}if(isReloadExcludedKey(key)){continue}if(isHardcodedProjectEnvExclusion(key)){continue}const existingValue=process.env[key];const isEffectivelyUnset2=!Object.hasOwn(process.env,key)||existingValue==="";if(isEffectivelyUnset2&&typeof value==="string"){process.env[key]=value;settingsEnvSourcedKeys.add(key)}if(!lastReloadSnapshotSeeded&&typeof value==="string"&&!lastReloadSnapshot.has(key)){lastReloadSnapshot.set(key,value)}}reportRejectedSettingsEnv(settings.env,startDir)}lastReloadSnapshotSeeded=true;Object.assign(process.env,getRelaunchEnvProvenance());publishPendingCompileCache()}__name(loadEnvironment,"loadEnvironment");function reloadEnvironment(settings,workspaceCwd,workspaceTrusted,options={}){const userLevelPaths=getUserLevelEnvPaths();const envFilePaths=findEnvFiles(settings,workspaceCwd,userLevelPaths,workspaceTrusted);const parsedEnvFiles=parseEnvFiles(envFilePaths,userLevelPaths);if(parsedEnvFiles.readFailed&&options.failClosedOnEnvFileReadError){return{updatedKeys:[],removedKeys:[],envFileReadFailed:true}}if(process.env["CLOUD_SHELL"]==="true"){setUpCloudShellEnvironmentInEnv(process.env,parsedEnvFiles.files)}const dotEnvReadFailed=parsedEnvFiles.readFailed;const newDotEnvKeys=new Map;const newSettingsEnvKeys=new Map;for(const envFile of parsedEnvFiles.files){const excludedVars=settings?.advanced?.excludedEnvVars||DEFAULT_EXCLUDED_ENV_VARS;for(const key in envFile.parsedEnv){if(!canApplyParsedEnvKey(envFile,key,excludedVars,{reload:true})){continue}if(!newDotEnvKeys.has(key)){newDotEnvKeys.set(key,envFile.parsedEnv[key])}}reportRejectedLoaderKeys(`.env file ${envFile.path}`,Object.keys(envFile.parsedEnv))}if(settings.env){for(const[key,value]of Object.entries(settings.env)){if(isLoaderEnvKey(key))continue;if(isReloadExcludedKey(key))continue;if(isHardcodedProjectEnvExclusion(key))continue;if(typeof value!=="string")continue;const dotEnvValue=newDotEnvKeys.get(key);if(dotEnvValue!==void 0&&dotEnvValue!=="")continue;if(dotEnvReadFailed&&lastReloadSnapshot.has(key))continue;newSettingsEnvKeys.set(key,value)}reportRejectedSettingsEnv(settings.env,workspaceCwd)}const allNewKeys=new Set([...newDotEnvKeys.keys(),...newSettingsEnvKeys.keys()]);const updatedKeys=[];const removedKeys=[];if(!dotEnvReadFailed){const previouslyKnown=new Set([...lastReloadSnapshot.keys(),...dotEnvSourcedKeys,...settingsEnvSourcedKeys]);for(const key of previouslyKnown){if(!allNewKeys.has(key)&&!isReloadExcludedKey(key)){delete process.env[key];inheritedDotEnvKeys.delete(key);inheritedSettingsEnvKeys.delete(key);removedKeys.push(key)}}}for(const[key,value]of newDotEnvKeys){if(value===""&&newSettingsEnvKeys.has(key))continue;if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}for(const[key,value]of newSettingsEnvKeys){if(process.env[key]!==value){updatedKeys.push(key)}process.env[key]=value}if(!dotEnvReadFailed){for(const sources of[dotEnvSourcedKeys,settingsEnvSourcedKeys]){for(const key of sources){if(!isReloadExcludedKey(key))sources.delete(key)}}lastReloadSnapshot.clear();for(const[key,value]of newDotEnvKeys){lastReloadSnapshot.set(key,value)}for(const[key,value]of newSettingsEnvKeys){lastReloadSnapshot.set(key,value)}}for(const key of newDotEnvKeys.keys()){dotEnvSourcedKeys.add(key)}for(const key of newSettingsEnvKeys.keys()){settingsEnvSourcedKeys.add(key)}Object.assign(process.env,getRelaunchEnvProvenance());return{updatedKeys,removedKeys,...dotEnvReadFailed?{envFileReadFailed:true}:{}}}__name(reloadEnvironment,"reloadEnvironment");export{SETTINGS_DIRECTORY_NAME,hasLoadedEnvironmentValues,getRelaunchEnvProvenance,preResolveHomeEnvOverrides,resetHomeEnvBootstrapForTesting,resetEnvironmentTrackingForTesting,isFileSourcedEnvKey,getHomeEnvFallbackVars,findEnvFiles,setUpCloudShellEnvironment,readProjectEnvFiles,buildRuntimeEnvironment,loadEnvironment,reloadEnvironment};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2025 Qwen Team
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{promises as fs}from"node:fs";import{join}from"node:path";var cleanupFunctions=[];var exitCleanupPromise;function registerCleanup(fn,options={}){if(options.first)cleanupFunctions.unshift(fn);else cleanupFunctions.push(fn);return()=>{const index=cleanupFunctions.indexOf(fn);if(index!==-1)cleanupFunctions.splice(index,1)}}__name(registerCleanup,"registerCleanup");var PER_CLEANUP_TIMEOUT_MS=2e3;var OVERALL_CLEANUP_TIMEOUT_MS=5e3;function withTimeout(promise,ms){return new Promise(resolve=>{const timer=setTimeout(()=>resolve(void 0),ms);timer.unref?.();promise.then(value=>{clearTimeout(timer);resolve(value)},()=>{clearTimeout(timer);resolve(void 0)})})}__name(withTimeout,"withTimeout");function runExitCleanup(options={}){if(exitCleanupPromise)return exitCleanupPromise;const cleanup=runExitCleanupPass(options).finally(()=>{if(exitCleanupPromise===cleanup)exitCleanupPromise=void 0});exitCleanupPromise=cleanup;return cleanup}__name(runExitCleanup,"runExitCleanup");async function runExitCleanupPass(options){const perFn=options._testPerFnTimeoutMs??PER_CLEANUP_TIMEOUT_MS;const overall=options._testOverallTimeoutMs??OVERALL_CLEANUP_TIMEOUT_MS;const drain=(async()=>{for(const fn of cleanupFunctions){try{await withTimeout(Promise.resolve().then(fn),perFn)}catch(_){}}})();let wallClockTimer;const wallClock=new Promise(resolve=>{wallClockTimer=setTimeout(()=>resolve(),overall);wallClockTimer.unref?.()});try{await Promise.race([drain,wallClock])}finally{if(wallClockTimer)clearTimeout(wallClockTimer);cleanupFunctions.length=0}}__name(runExitCleanupPass,"runExitCleanupPass");async function cleanupCheckpoints(){const{Storage}=await import("./deferred-core-runtime-YC5XIWEI.js");const storage=new Storage(process.cwd());const tempDir=storage.getProjectTempDir();const checkpointsDir=join(tempDir,"checkpoints");try{await fs.rm(checkpointsDir,{recursive:true,force:true})}catch{}}__name(cleanupCheckpoints,"cleanupCheckpoints");export{registerCleanup,runExitCleanup,cleanupCheckpoints};
3
+ import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{promises as fs}from"node:fs";import{join}from"node:path";var cleanupFunctions=[];var exitCleanupPromise;function registerCleanup(fn,options={}){if(options.first)cleanupFunctions.unshift(fn);else cleanupFunctions.push(fn);return()=>{const index=cleanupFunctions.indexOf(fn);if(index!==-1)cleanupFunctions.splice(index,1)}}__name(registerCleanup,"registerCleanup");var PER_CLEANUP_TIMEOUT_MS=2e3;var OVERALL_CLEANUP_TIMEOUT_MS=5e3;function withTimeout(promise,ms){return new Promise(resolve=>{const timer=setTimeout(()=>resolve(void 0),ms);timer.unref?.();promise.then(value=>{clearTimeout(timer);resolve(value)},()=>{clearTimeout(timer);resolve(void 0)})})}__name(withTimeout,"withTimeout");function runExitCleanup(options={}){if(exitCleanupPromise)return exitCleanupPromise;const cleanup=runExitCleanupPass(options).finally(()=>{if(exitCleanupPromise===cleanup)exitCleanupPromise=void 0});exitCleanupPromise=cleanup;return cleanup}__name(runExitCleanup,"runExitCleanup");async function runExitCleanupPass(options){const perFn=options._testPerFnTimeoutMs??PER_CLEANUP_TIMEOUT_MS;const overall=options._testOverallTimeoutMs??OVERALL_CLEANUP_TIMEOUT_MS;const drain=(async()=>{for(const fn of cleanupFunctions){try{await withTimeout(Promise.resolve().then(fn),perFn)}catch(_){}}})();let wallClockTimer;const wallClock=new Promise(resolve=>{wallClockTimer=setTimeout(()=>resolve(),overall);wallClockTimer.unref?.()});try{await Promise.race([drain,wallClock])}finally{if(wallClockTimer)clearTimeout(wallClockTimer);cleanupFunctions.length=0}}__name(runExitCleanupPass,"runExitCleanupPass");async function cleanupCheckpoints(){const{Storage}=await import("./deferred-core-runtime-NTKFHL5J.js");const storage=new Storage(process.cwd());const tempDir=storage.getProjectTempDir();const checkpointsDir=join(tempDir,"checkpoints");try{await fs.rm(checkpointsDir,{recursive:true,force:true})}catch{}}__name(cleanupCheckpoints,"cleanupCheckpoints");export{registerCleanup,runExitCleanup,cleanupCheckpoints};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2025 Google LLC
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{loadSettings}from"./chunk-23543L6E.js";import{t}from"./chunk-FK5L2WVV.js";import{loadEnvironment}from"./chunk-RBA3TP7L.js";import{collectProviderModelsForProtocol}from"./chunk-56PVVXUG.js";import{resolveModelSelectionAuthType}from"./chunk-AJ75BPTA.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var DEFAULT_ENV_KEYS={["openai"]:"OPENAI_API_KEY",["openai-responses"]:"OPENAI_API_KEY"};function findModelConfig(modelProviders,providerProtocol,authType,modelId,baseUrl){if(!modelProviders||!modelId){return void 0}const models=collectProviderModelsForProtocol(modelProviders,providerProtocol,authType);if(models.length===0){return void 0}if(baseUrl){return models.find(m=>m.id===modelId&&m.baseUrl===baseUrl)??models.find(m=>m.id===modelId)}return models.find(m=>m.id===modelId)}__name(findModelConfig,"findModelConfig");function resolveSelectedModel(settings,config){const modelsConfig=config?.getModelsConfig();if(modelsConfig){return{modelId:modelsConfig.getModel(),baseUrl:modelsConfig.getGenerationConfig()?.baseUrl}}return{modelId:settings.model?.name,baseUrl:settings.model?.baseUrl}}__name(resolveSelectedModel,"resolveSelectedModel");function hasEnvValue(settings,envKey){if(!envKey){return false}if(process.env[envKey]){return true}const settingsEnv=settings.env;const settingsEnvValue=settingsEnv?.[envKey];return typeof settingsEnvValue==="string"&&settingsEnvValue.trim().length>0}__name(hasEnvValue,"hasEnvValue");function hasApiKeyForAuth(authType,settings,config){const modelProviders=settings.modelProviders;const{modelId,baseUrl}=resolveSelectedModel(settings,config);const modelAuthType=!config&&(authType==="openai"||authType==="openai-responses")?resolveModelSelectionAuthType(authType,modelId,modelProviders,settings.providerProtocol,baseUrl):authType;const modelConfig=findModelConfig(modelProviders,settings.providerProtocol,modelAuthType,modelId,baseUrl);const resolvedApiKey=config?.getModelsConfig().getGenerationConfig()?.apiKey;if(resolvedApiKey){return{hasKey:true,checkedEnvKey:modelConfig?.envKey??DEFAULT_ENV_KEYS[authType],isExplicitEnvKey:!!modelConfig?.envKey}}if(modelConfig?.envKey){const hasKey=hasEnvValue(settings,modelConfig.envKey);return{hasKey,checkedEnvKey:modelConfig.envKey,isExplicitEnvKey:true}}const defaultEnvKey=DEFAULT_ENV_KEYS[authType];if(defaultEnvKey){const hasKey=hasEnvValue(settings,defaultEnvKey);if(hasKey){return{hasKey,checkedEnvKey:defaultEnvKey,isExplicitEnvKey:false}}}if(settings.security?.auth?.apiKey){return{hasKey:true,checkedEnvKey:defaultEnvKey||void 0,isExplicitEnvKey:false}}return{hasKey:false,checkedEnvKey:defaultEnvKey,isExplicitEnvKey:false}}__name(hasApiKeyForAuth,"hasApiKeyForAuth");function validateAuthMethod(authMethod,config){const settings=loadSettings(process.cwd(),false);loadEnvironment(settings.merged);if(authMethod==="openai"||authMethod==="openai-responses"){const{hasKey,checkedEnvKey,isExplicitEnvKey}=hasApiKeyForAuth(authMethod,settings.merged,config);if(!hasKey){const envKeyHint=checkedEnvKey?`'${checkedEnvKey}'`:"'OPENAI_API_KEY'";if(isExplicitEnvKey){return t("Missing API key for OpenAI-compatible auth. Set the {{envKeyHint}} environment variable.",{envKeyHint})}return t("Missing API key for OpenAI-compatible auth. Set settings.security.auth.apiKey, or set the {{envKeyHint}} environment variable.",{envKeyHint})}return null}return t("Invalid auth method selected.")}__name(validateAuthMethod,"validateAuthMethod");export{validateAuthMethod};
3
+ import{loadSettings}from"./chunk-4RJ2RRGZ.js";import{t}from"./chunk-AUM57JI2.js";import{loadEnvironment}from"./chunk-QJ6ZTZFC.js";import{collectProviderModelsForProtocol}from"./chunk-IYH3IZL4.js";import{resolveModelSelectionAuthType}from"./chunk-SINRWOVD.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var DEFAULT_ENV_KEYS={["openai"]:"OPENAI_API_KEY",["openai-responses"]:"OPENAI_API_KEY"};function findModelConfig(modelProviders,providerProtocol,authType,modelId,baseUrl){if(!modelProviders||!modelId){return void 0}const models=collectProviderModelsForProtocol(modelProviders,providerProtocol,authType);if(models.length===0){return void 0}if(baseUrl){return models.find(m=>m.id===modelId&&m.baseUrl===baseUrl)??models.find(m=>m.id===modelId)}return models.find(m=>m.id===modelId)}__name(findModelConfig,"findModelConfig");function resolveSelectedModel(settings,config){const modelsConfig=config?.getModelsConfig();if(modelsConfig){return{modelId:modelsConfig.getModel(),baseUrl:modelsConfig.getGenerationConfig()?.baseUrl}}return{modelId:settings.model?.name,baseUrl:settings.model?.baseUrl}}__name(resolveSelectedModel,"resolveSelectedModel");function hasEnvValue(settings,envKey){if(!envKey){return false}if(process.env[envKey]){return true}const settingsEnv=settings.env;const settingsEnvValue=settingsEnv?.[envKey];return typeof settingsEnvValue==="string"&&settingsEnvValue.trim().length>0}__name(hasEnvValue,"hasEnvValue");function hasApiKeyForAuth(authType,settings,config){const modelProviders=settings.modelProviders;const{modelId,baseUrl}=resolveSelectedModel(settings,config);const modelAuthType=!config&&(authType==="openai"||authType==="openai-responses")?resolveModelSelectionAuthType(authType,modelId,modelProviders,settings.providerProtocol,baseUrl):authType;const modelConfig=findModelConfig(modelProviders,settings.providerProtocol,modelAuthType,modelId,baseUrl);const resolvedApiKey=config?.getModelsConfig().getGenerationConfig()?.apiKey;if(resolvedApiKey){return{hasKey:true,checkedEnvKey:modelConfig?.envKey??DEFAULT_ENV_KEYS[authType],isExplicitEnvKey:!!modelConfig?.envKey}}if(modelConfig?.envKey){const hasKey=hasEnvValue(settings,modelConfig.envKey);return{hasKey,checkedEnvKey:modelConfig.envKey,isExplicitEnvKey:true}}const defaultEnvKey=DEFAULT_ENV_KEYS[authType];if(defaultEnvKey){const hasKey=hasEnvValue(settings,defaultEnvKey);if(hasKey){return{hasKey,checkedEnvKey:defaultEnvKey,isExplicitEnvKey:false}}}if(settings.security?.auth?.apiKey){return{hasKey:true,checkedEnvKey:defaultEnvKey||void 0,isExplicitEnvKey:false}}return{hasKey:false,checkedEnvKey:defaultEnvKey,isExplicitEnvKey:false}}__name(hasApiKeyForAuth,"hasApiKeyForAuth");function validateAuthMethod(authMethod,config){const settings=loadSettings(process.cwd(),false);loadEnvironment(settings.merged);if(authMethod==="openai"||authMethod==="openai-responses"){const{hasKey,checkedEnvKey,isExplicitEnvKey}=hasApiKeyForAuth(authMethod,settings.merged,config);if(!hasKey){const envKeyHint=checkedEnvKey?`'${checkedEnvKey}'`:"'OPENAI_API_KEY'";if(isExplicitEnvKey){return t("Missing API key for OpenAI-compatible auth. Set the {{envKeyHint}} environment variable.",{envKeyHint})}return t("Missing API key for OpenAI-compatible auth. Set settings.security.auth.apiKey, or set the {{envKeyHint}} environment variable.",{envKeyHint})}return null}return t("Invalid auth method selected.")}__name(validateAuthMethod,"validateAuthMethod");export{validateAuthMethod};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2025 Qwen Team
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{SessionService,TURN_INTERRUPTION_HISTORY_TAIL_COUNT,buildSessionHistoryFromConversation,detectTurnInterruption,effectiveHistoryEnd}from"./chunk-PFKTTUGS.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{closeSync as closeSync2,openSync as openSync2,readSync as readSync2,statSync as statSync2}from"node:fs";init_esbuild_shims();import{appendFileSync,closeSync,mkdirSync,openSync,readFileSync,readSync,statSync}from"node:fs";import*as path from"node:path";function isPromptLedgerTerminalRecord(record){return"terminal"in record}__name(isPromptLedgerTerminalRecord,"isPromptLedgerTerminalRecord");function appendPromptLedgerRecord(filePath,record){mkdirSync(path.dirname(filePath),{recursive:true});sealTornTailSync(filePath);appendFileSync(filePath,`${JSON.stringify(record)}
3
+ import{SessionService,TURN_INTERRUPTION_HISTORY_TAIL_COUNT,buildSessionHistoryFromConversation,detectTurnInterruption,effectiveHistoryEnd}from"./chunk-ZUWLTGSR.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{closeSync as closeSync2,openSync as openSync2,readSync as readSync2,statSync as statSync2}from"node:fs";init_esbuild_shims();import{appendFileSync,closeSync,mkdirSync,openSync,readFileSync,readSync,statSync}from"node:fs";import*as path from"node:path";function isPromptLedgerTerminalRecord(record){return"terminal"in record}__name(isPromptLedgerTerminalRecord,"isPromptLedgerTerminalRecord");function appendPromptLedgerRecord(filePath,record){mkdirSync(path.dirname(filePath),{recursive:true});sealTornTailSync(filePath);appendFileSync(filePath,`${JSON.stringify(record)}
4
4
  `,{encoding:"utf8",mode:384})}__name(appendPromptLedgerRecord,"appendPromptLedgerRecord");function sealTornTailSync(filePath){let stats;try{stats=statSync(filePath)}catch(error){if(error.code==="ENOENT")return;throw error}if(stats.size===0)return;const fd=openSync(filePath,"r");try{const lastByte=Buffer.alloc(1);const bytesRead=readSync(fd,lastByte,0,1,stats.size-1);if(bytesRead===1&&lastByte[0]!==10){appendFileSync(filePath,"\n","utf8")}}finally{closeSync(fd)}}__name(sealTornTailSync,"sealTornTailSync");function coercePromptLedgerRecord(value){if(typeof value!=="object"||value===null)return void 0;const record=value;const promptId=record["promptId"];const at=record["at"];if(record["v"]!==1||typeof promptId!=="string")return void 0;if(typeof at!=="number"||!Number.isFinite(at))return void 0;if(record["state"]==="in_flight"){const tailUuid=record["tailUuid"];return{v:1,promptId,state:"in_flight",...typeof tailUuid==="string"&&tailUuid.length>0?{tailUuid}:{},at}}const terminal=record["terminal"];if(terminal!=="completed"&&terminal!=="cancelled"&&terminal!=="error"&&terminal!=="interrupted"){return void 0}const code=record["code"];const stopReason=record["stopReason"];return{v:1,promptId,terminal,...typeof code==="string"?{code}:{},...typeof stopReason==="string"?{stopReason}:{},at}}__name(coercePromptLedgerRecord,"coercePromptLedgerRecord");function readPromptLedgerRecords(filePath,options){let contents;let dropFirstLine=false;try{const tailBytes=options?.tailBytes;if(tailBytes===void 0){contents=readFileSync(filePath,"utf8")}else{const size=statSync(filePath).size;if(size<=tailBytes){contents=readFileSync(filePath,"utf8")}else{const fd=openSync(filePath,"r");try{const buffer=Buffer.alloc(tailBytes);const bytesRead=readSync(fd,buffer,0,tailBytes,size-tailBytes);contents=buffer.subarray(0,bytesRead).toString("utf8");dropFirstLine=true}finally{closeSync(fd)}}}}catch(error){if(error.code==="ENOENT")return[];throw error}const records=[];const lines=contents.split("\n");for(let i=dropFirstLine?1:0;i<lines.length;i++){const line=lines[i];if(line===void 0||line.length===0)continue;let parsed;try{parsed=JSON.parse(line)}catch{continue}const record=coercePromptLedgerRecord(parsed);if(record!==void 0)records.push(record)}return records}__name(readPromptLedgerRecords,"readPromptLedgerRecords");function danglingInFlightPromptIds(records){const latest=new Map;for(const record of records){latest.set(record.promptId,record)}const dangling=[];for(const[promptId,record]of latest){if(!isPromptLedgerTerminalRecord(record))dangling.push(promptId)}return dangling}__name(danglingInFlightPromptIds,"danglingInFlightPromptIds");var PROMPT_TERMINALS_RESPONSE_LIMIT=64;function recentPromptTerminalRecords(records){const terminals=records.filter(isPromptLedgerTerminalRecord);return terminals.length<=PROMPT_TERMINALS_RESPONSE_LIMIT?terminals:terminals.slice(-PROMPT_TERMINALS_RESPONSE_LIMIT)}__name(recentPromptTerminalRecords,"recentPromptTerminalRecords");function createPromptLedgerSink(workspaceCwd,sessionRuntimeBaseDir){const sessionService=new SessionService(workspaceCwd,{runtimeBaseDir:sessionRuntimeBaseDir});return{appendSync(sessionId,record){appendPromptLedgerRecord(sessionService.getPromptLedgerPath(sessionId),record)},transcriptTailUuid(sessionId){return readTranscriptTailUuid(sessionService.getSessionTranscriptPath(sessionId))}}}__name(createPromptLedgerSink,"createPromptLedgerSink");var TRANSCRIPT_TAIL_BYTES=64*1024;function readTranscriptTailUuid(transcriptPath){let contents;try{const size=statSync2(transcriptPath).size;if(size===0)return void 0;const windowBytes=Math.min(size,TRANSCRIPT_TAIL_BYTES);const buffer=Buffer.alloc(windowBytes);const fd=openSync2(transcriptPath,"r");try{readSync2(fd,buffer,0,windowBytes,size-windowBytes)}finally{closeSync2(fd)}contents=buffer.toString("utf8")}catch{return void 0}const lines=contents.split("\n");for(let i=lines.length-1;i>=0;i--){const line=lines[i];if(line===void 0||line.length===0)continue;try{const uuid=JSON.parse(line).uuid;return typeof uuid==="string"&&uuid.length>0?uuid:void 0}catch{return void 0}}return void 0}__name(readTranscriptTailUuid,"readTranscriptTailUuid");async function reconcileDanglingPromptTerminals(sessionService,sessionId){const ledgerPath=sessionService.getPromptLedgerPath(sessionId);let records;try{records=readPromptLedgerRecords(ledgerPath)}catch{return}const snapshotLength=records.length;const dangling=danglingInFlightPromptIds(records);if(dangling.length===0)return;if(dangling.length>1)return;const target=dangling[0];if(target===void 0)return;const settledPromptIds=new Set(records.filter(isPromptLedgerTerminalRecord).map(r=>r.promptId));let targetAdmission;for(const record2 of records){if(!isPromptLedgerTerminalRecord(record2)&&!settledPromptIds.has(record2.promptId)){targetAdmission=record2}}if(targetAdmission===void 0||targetAdmission.promptId!==target){return}let resumed;try{resumed=await sessionService.loadSession(sessionId)}catch{return}if(resumed===void 0)return;const messages=resumed.conversation.messages;const admissionMarker=targetAdmission.tailUuid;let markerIndex=-1;if(admissionMarker!==void 0){markerIndex=messages.findIndex(record2=>record2.uuid===admissionMarker);let wroteAfterMarker=false;for(let i=markerIndex+1;i<messages.length;i++){const record2=messages[i];if(record2===void 0||record2.type==="system")continue;if(!record2.message||record2.subtype==="realtime_message")continue;wroteAfterMarker=true;break}if(markerIndex<0||!wroteAfterMarker)return}let lastVisibleWriteMs=NaN;let lastVisibleNonSystem;let compressedAfterAdmission=false;let localCommandCompleted=false;const admissionAt=targetAdmission.at;const isAfterAdmission=__name((idx,writeMs)=>admissionMarker!==void 0?idx>markerIndex:Number.isFinite(writeMs)&&writeMs>=admissionAt,"isAfterAdmission");for(let idx=0;idx<messages.length;idx++){const record2=messages[idx];const writeMs=Date.parse(record2.timestamp);if(record2.type==="system"){if(isCompressionResetRecord(record2)){if(isAfterAdmission(idx,writeMs))compressedAfterAdmission=true}else if(!localCommandCompleted&&isAfterAdmission(idx,writeMs)&&isLocalSlashCommandResult(record2,lastVisibleNonSystem)){localCommandCompleted=true}continue}if(!record2.message||record2.subtype==="realtime_message")continue;if(record2.provenance==="system")continue;if(record2.subtype==="agent_mention"||record2.subtype==="agent_message"){continue}if(Number.isFinite(writeMs))lastVisibleWriteMs=writeMs;lastVisibleNonSystem=record2}let lastOtherTerminalAt=0;for(const record2 of records){if(isPromptLedgerTerminalRecord(record2)&&record2.promptId!==target){if(record2.code==="prompt_deadline_exceeded")return;lastOtherTerminalAt=Math.max(lastOtherTerminalAt,record2.at)}}if(compressedAfterAdmission||!Number.isFinite(lastVisibleWriteMs)||lastVisibleWriteMs<=targetAdmission.at||lastVisibleWriteMs<=lastOtherTerminalAt){return}const{apiHistory,completedToolCallIds}=buildSessionHistoryFromConversation(resumed.conversation);const classifiableEnd=effectiveHistoryEnd(apiHistory);const historyTail=apiHistory.slice(Math.max(0,classifiableEnd-TURN_INTERRUPTION_HISTORY_TAIL_COUNT),classifiableEnd);const verdict=detectTurnInterruption(historyTail,completedToolCallIds);const interrupted=verdict.kind!=="none"||tailHoldsAnyFunctionCall(historyTail);const lastVisibleNonSystemType=lastVisibleNonSystem?.type;if(!interrupted&&lastVisibleNonSystemType!=="assistant"&&lastVisibleNonSystemType!=="tool_result"&&!localCommandCompleted){return}let refetch;try{refetch=readPromptLedgerRecords(ledgerPath)}catch{return}if(refetch.length!==snapshotLength)return;const record=interrupted?{v:1,promptId:target,terminal:"interrupted",code:"daemon_lost",at:Date.now()}:{v:1,promptId:target,terminal:"completed",stopReason:"reconstructed_from_transcript",at:Date.now()};try{appendPromptLedgerRecord(ledgerPath,record)}catch{}}__name(reconcileDanglingPromptTerminals,"reconcileDanglingPromptTerminals");function isCompressionResetRecord(record){if(record.type!=="system"||record.subtype!=="chat_compression"){return false}return Boolean(record.systemPayload?.compressedHistory)}__name(isCompressionResetRecord,"isCompressionResetRecord");function isLocalSlashCommandResult(record,previous){if(record.subtype!=="slash_command")return false;const payload=record.systemPayload;const items=payload?.outputHistoryItems;const parts=previous?.message?.parts;const first=parts?.[0];return payload?.phase==="result"&&payload.sentToModel!==true&&Array.isArray(items)&&items.length>0&&items.every(item=>item["type"]==="assistant")&&previous?.type==="user"&&previous.subtype===void 0&&previous.message?.role==="user"&&parts?.length===1&&first!==void 0&&typeof first.text==="string"&&Object.keys(first).length===1&&first.text===payload.rawCommand}__name(isLocalSlashCommandResult,"isLocalSlashCommandResult");function tailHoldsAnyFunctionCall(history){const last=history[history.length-1];if(last?.role!=="model")return false;return(last.parts??[]).some(part=>part.functionCall!==void 0)}__name(tailHoldsAnyFunctionCall,"tailHoldsAnyFunctionCall");var RECENT_TERMINALS_TAIL_BYTES=256*1024;function readRecentPromptTerminals(sessionService,sessionId){try{const terminals=recentPromptTerminalRecords(readPromptLedgerRecords(sessionService.getPromptLedgerPath(sessionId),{tailBytes:RECENT_TERMINALS_TAIL_BYTES}));return terminals.length>0?terminals:void 0}catch{return void 0}}__name(readRecentPromptTerminals,"readRecentPromptTerminals");function withPromptTerminals(session,terminals){if(terminals===void 0||terminals.length===0)return session;return{...session,promptTerminals:[...terminals]}}__name(withPromptTerminals,"withPromptTerminals");export{createPromptLedgerSink,readTranscriptTailUuid,reconcileDanglingPromptTerminals,readRecentPromptTerminals,withPromptTerminals};
5
5
  /**
6
6
  * @license
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{clipToWidth,cpLen,cpSlice,getCachedStringWidth,sanitizeTerminalLine}from"./chunk-64CA3W6G.js";import{normalizeProjectRoot}from"./chunk-JDZ3UHK5.js";import{readProjectEnvFiles}from"./chunk-RBA3TP7L.js";import{require_strip_json_comments}from"./chunk-EKRCICRK.js";import{resolveEnvVarsInObject}from"./chunk-HW7ZRPZU.js";import{atomicWriteFile}from"./chunk-2GF3E5MI.js";import{writeStderrLine}from"./chunk-M4ECEHLX.js";import{HookEventName}from"./chunk-4WFJ5OPA.js";import{Storage}from"./chunk-5VB4YX3Z.js";import{getErrorMessage}from"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import*as crypto from"node:crypto";import*as fs from"node:fs";import*as path from"node:path";var import_strip_json_comments=__toESM(require_strip_json_comments(),1);var HOOK_APPROVALS_FILENAME="hookApprovals.json";function getHookApprovalsPath(){if(process.env["QWEN_CODE_HOOK_APPROVALS_PATH"]){return process.env["QWEN_CODE_HOOK_APPROVALS_PATH"]}return path.join(Storage.getGlobalQwenDir(),HOOK_APPROVALS_FILENAME)}__name(getHookApprovalsPath,"getHookApprovalsPath");function getProjectHooksRoot(settings){return path.dirname(path.dirname(settings.workspace.path))}__name(getProjectHooksRoot,"getProjectHooksRoot");function getProjectHooksForApproval(settings){const resolved=settings.getProjectHooks();if(!isRecord(resolved)||summarizeProjectHooks(resolved).length===0){return void 0}const hooks=settings.workspace.originalSettings.hooks;if(!isRecord(hooks))return void 0;const root=getProjectHooksRoot(settings);return{root,hooks,resolved,env:{files:readProjectEnvFiles(settings.merged,root),settings:settings.workspace.originalSettings.env??null}}}__name(getProjectHooksForApproval,"getProjectHooksForApproval");function getProjectHooksForApprovalFromRawWorkspace(settings){const hooks=settings.workspace.originalSettings.hooks;if(!isRecord(hooks))return void 0;const resolved=resolveEnvVarsInObject(hooks);if(summarizeProjectHooks(resolved,hooks).length===0)return void 0;const root=getProjectHooksRoot(settings);return{root,hooks,resolved,env:{files:readProjectEnvFiles(settings.merged,root,true),settings:settings.workspace.originalSettings.env??null}}}__name(getProjectHooksForApprovalFromRawWorkspace,"getProjectHooksForApprovalFromRawWorkspace");function getSeparatedHookSettings(settings){const projectHooks=structuredClone(settings.getProjectHooks());const projectHooksApproval=getProjectHooksForApproval(settings);return{systemHooks:settings.getSystemHooks(),userHooks:settings.getUserHooks(),projectHooks,projectHooksDisplayOnly:structuredClone(settings.workspace?.originalSettings?.hooks),...projectHooksApproval?{projectHooksApproval}:{}}}__name(getSeparatedHookSettings,"getSeparatedHookSettings");function hashProjectHooks(approval){const stable=JSON.stringify({hooks:approval.hooks,env:approval.env},(_key,value)=>{if(value&&typeof value==="object"&&!Array.isArray(value)){const obj=value;const sorted=Object.create(null);for(const k of Object.keys(obj).sort()){sorted[k]=obj[k]}return sorted}return value});return crypto.createHash("sha256").update(stable).digest("hex")}__name(hashProjectHooks,"hashProjectHooks");function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isRecord,"isRecord");function displayText(value,max=200){const text=sanitizeTerminalLine(String(value??"")).replace(new RegExp("\\p{Cf}","gu"),"");const length=cpLen(text);return length>max?`${cpSlice(text,0,max)}\u2026 [${length} chars, full value in .qwen/settings.json]`:text}__name(displayText,"displayText");function envList(value){if(!isRecord(value))return keyList(value);return Object.entries(value).map(([k,v])=>`${displayText(k)}=${displayText(v,80)}`).join(", ")}__name(envList,"envList");function keyList(value){if(Array.isArray(value))return value.map(v=>displayText(v)).join(", ");if(isRecord(value))return Object.keys(value).map(k=>displayText(k)).join(", ");return void 0}__name(keyList,"keyList");function describeHook(hook,raw,matcher){const details=[];const add=__name((label,value)=>{if(value)details.push(`${label}: ${value}`)},"add");let head;switch(hook["type"]){case"command":head=displayText(raw["command"]);if(typeof raw["command"]==="string"&&/\$\{?\w/.test(raw["command"])){details.push("resolves ${VAR} from the environment (project .env/settings.env or shell)")}add("env",envList(raw["env"]));if(raw["shell"])add("shell",displayText(raw["shell"]));if(hook["async"]===true)details.push("async");break;case"http":head=`http ${displayText(raw["url"])}`;add("headers",keyList(raw["headers"]));add("allowedEnvVars",keyList(raw["allowedEnvVars"]));break;default:head=`prompt "${displayText(raw["prompt"])}"`;if(raw["model"])add("model",displayText(raw["model"],80))}if(raw["type"]!==hook["type"])add("type",displayText(raw["type"]));if(matcher)add("matcher",displayText(matcher,80));return details.length>0?`${head} [${details.join("; ")}]`:head}__name(describeHook,"describeHook");var HOOK_EVENTS=new Set(Object.values(HookEventName));var REQUIRED_FIELD={command:"command",http:"url",prompt:"prompt"};function isRunnableHook(hook){if(!isRecord(hook)||typeof hook["type"]!=="string")return false;const field=REQUIRED_FIELD[hook["type"]];return field!==void 0&&Boolean(hook[field])}__name(isRunnableHook,"isRunnableHook");function entry(value,key){if(Array.isArray(value)&&typeof key==="number")return value[key];return isRecord(value)?value[key]:void 0}__name(entry,"entry");function summarizeProjectHooks(resolved,raw=resolved){const lines=[];for(const[event,definitions]of Object.entries(resolved)){if(!HOOK_EVENTS.has(event)||!Array.isArray(definitions))continue;definitions.forEach((definition,i)=>{if(!isRecord(definition)||!Array.isArray(definition["hooks"]))return;const rawDefinition=entry(entry(raw,event),i);definition["hooks"].forEach((hook,j)=>{if(!isRunnableHook(hook))return;const rawHook=entry(entry(rawDefinition,"hooks"),j);const rawMatcher=entry(rawDefinition,"matcher");lines.push(`${displayText(event,24)} ${describeHook(hook,isRecord(rawHook)?rawHook:hook,rawMatcher??definition["matcher"])}`)})})}return lines}__name(summarizeProjectHooks,"summarizeProjectHooks");function fitHookLines(lines,maxRows){const rows=Math.max(1,Math.floor(maxRows));if(lines.length<=rows)return lines;const shown=Math.max(0,rows-1);return[...lines.slice(0,shown),`\u2026 and ${lines.length-shown} more (see .qwen/settings.json)`]}__name(fitHookLines,"fitHookLines");function fitHookLine(line,width){if(getCachedStringWidth(line)<=width)return line;const total=cpLen(line);const marker=`\u2026 [+${total} chars]`;const kept=clipToWidth(line,width-getCachedStringWidth(marker));return`${kept}\u2026 [+${total-cpLen(kept)} chars]`}__name(fitHookLine,"fitHookLine");var LoadedHookApprovals=class{constructor(file,errors){this.file=file;this.errors=errors}static{__name(this,"LoadedHookApprovals")}getState(approval){const record=this.file.config[normalizeProjectRoot(approval.root)];if(!isRecord(record)||record["hash"]!==hashProjectHooks(approval)){return"pending"}const status=record["status"];return status==="approved"||status==="rejected"?status:"pending"}async setState(approval,status){const{config,errors}=readHookApprovals(this.file.path);if(errors.length>0){throw new Error(`${errors[0].message} (${this.file.path})`)}Object.defineProperty(config,normalizeProjectRoot(approval.root),{value:{hash:hashProjectHooks(approval),status},enumerable:true,configurable:true,writable:true});fs.mkdirSync(path.dirname(this.file.path),{recursive:true});await atomicWriteFile(this.file.path,JSON.stringify(config,null,2),{mode:384,forceMode:true});this.file.config=config}};var warnedErrors=new Set;function readHookApprovals(filePath){const errors=[];let config=Object.create(null);try{if(fs.existsSync(filePath)){const parsed=JSON.parse((0,import_strip_json_comments.default)(fs.readFileSync(filePath,"utf-8")));if(isRecord(parsed)){config=Object.assign(Object.create(null),parsed)}else{errors.push({message:"Hook approvals file is not a valid JSON object.",path:filePath})}}}catch(error){errors.push({message:getErrorMessage(error),path:filePath})}return{config,errors}}__name(readHookApprovals,"readHookApprovals");function loadHookApprovals(){const filePath=getHookApprovalsPath();const{config,errors}=readHookApprovals(filePath);for(const error of errors){if(warnedErrors.has(error.message))continue;warnedErrors.add(error.message);writeStderrLine(`Warning: hook approvals file error: ${error.message}`)}return new LoadedHookApprovals({path:filePath,config},errors)}__name(loadHookApprovals,"loadHookApprovals");function getProjectHooksApprovalState(approval){return approval?loadHookApprovals().getState(approval):void 0}__name(getProjectHooksApprovalState,"getProjectHooksApprovalState");function applyProjectHooksApproval(config,approval){const state=getProjectHooksApprovalState(approval);const trusted=config.isExplicitlyTrustedFolder?.()===true;config.setProjectHooksPendingApproval(state!==void 0&&state!=="approved"&&!(trusted&&state!=="rejected"),state==="rejected");return state}__name(applyProjectHooksApproval,"applyProjectHooksApproval");function getProjectHooksHeadlessWarning(state){return state==="rejected"?`Project hooks in .qwen/settings.json were not loaded: they were rejected for this folder and are not asked about again until they change (decisions are kept in ${getHookApprovalsPath()}).`:"Project hooks in .qwen/settings.json were not loaded: they are not approved for this folder. Run qwen interactively here to review them."}__name(getProjectHooksHeadlessWarning,"getProjectHooksHeadlessWarning");export{getProjectHooksForApproval,getProjectHooksForApprovalFromRawWorkspace,getSeparatedHookSettings,hashProjectHooks,summarizeProjectHooks,fitHookLines,fitHookLine,loadHookApprovals,getProjectHooksApprovalState,applyProjectHooksApproval,getProjectHooksHeadlessWarning};
3
+ import{clipToWidth,cpLen,cpSlice,getCachedStringWidth,sanitizeTerminalLine}from"./chunk-64CA3W6G.js";import{normalizeProjectRoot}from"./chunk-JDZ3UHK5.js";import{readProjectEnvFiles}from"./chunk-QJ6ZTZFC.js";import{require_strip_json_comments}from"./chunk-EKRCICRK.js";import{resolveEnvVarsInObject}from"./chunk-HW7ZRPZU.js";import{atomicWriteFile}from"./chunk-2GF3E5MI.js";import{writeStderrLine}from"./chunk-M4ECEHLX.js";import{HookEventName}from"./chunk-4WFJ5OPA.js";import{Storage}from"./chunk-5VB4YX3Z.js";import{getErrorMessage}from"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name,__toESM}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import*as crypto from"node:crypto";import*as fs from"node:fs";import*as path from"node:path";var import_strip_json_comments=__toESM(require_strip_json_comments(),1);var HOOK_APPROVALS_FILENAME="hookApprovals.json";function getHookApprovalsPath(){if(process.env["QWEN_CODE_HOOK_APPROVALS_PATH"]){return process.env["QWEN_CODE_HOOK_APPROVALS_PATH"]}return path.join(Storage.getGlobalQwenDir(),HOOK_APPROVALS_FILENAME)}__name(getHookApprovalsPath,"getHookApprovalsPath");function getProjectHooksRoot(settings){return path.dirname(path.dirname(settings.workspace.path))}__name(getProjectHooksRoot,"getProjectHooksRoot");function getProjectHooksForApproval(settings){const resolved=settings.getProjectHooks();if(!isRecord(resolved)||summarizeProjectHooks(resolved).length===0){return void 0}const hooks=settings.workspace.originalSettings.hooks;if(!isRecord(hooks))return void 0;const root=getProjectHooksRoot(settings);return{root,hooks,resolved,env:{files:readProjectEnvFiles(settings.merged,root),settings:settings.workspace.originalSettings.env??null}}}__name(getProjectHooksForApproval,"getProjectHooksForApproval");function getProjectHooksForApprovalFromRawWorkspace(settings){const hooks=settings.workspace.originalSettings.hooks;if(!isRecord(hooks))return void 0;const resolved=resolveEnvVarsInObject(hooks);if(summarizeProjectHooks(resolved,hooks).length===0)return void 0;const root=getProjectHooksRoot(settings);return{root,hooks,resolved,env:{files:readProjectEnvFiles(settings.merged,root,true),settings:settings.workspace.originalSettings.env??null}}}__name(getProjectHooksForApprovalFromRawWorkspace,"getProjectHooksForApprovalFromRawWorkspace");function getSeparatedHookSettings(settings){const projectHooks=structuredClone(settings.getProjectHooks());const projectHooksApproval=getProjectHooksForApproval(settings);return{systemHooks:settings.getSystemHooks(),userHooks:settings.getUserHooks(),projectHooks,projectHooksDisplayOnly:structuredClone(settings.workspace?.originalSettings?.hooks),...projectHooksApproval?{projectHooksApproval}:{}}}__name(getSeparatedHookSettings,"getSeparatedHookSettings");function hashProjectHooks(approval){const stable=JSON.stringify({hooks:approval.hooks,env:approval.env},(_key,value)=>{if(value&&typeof value==="object"&&!Array.isArray(value)){const obj=value;const sorted=Object.create(null);for(const k of Object.keys(obj).sort()){sorted[k]=obj[k]}return sorted}return value});return crypto.createHash("sha256").update(stable).digest("hex")}__name(hashProjectHooks,"hashProjectHooks");function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isRecord,"isRecord");function displayText(value,max=200){const text=sanitizeTerminalLine(String(value??"")).replace(new RegExp("\\p{Cf}","gu"),"");const length=cpLen(text);return length>max?`${cpSlice(text,0,max)}\u2026 [${length} chars, full value in .qwen/settings.json]`:text}__name(displayText,"displayText");function envList(value){if(!isRecord(value))return keyList(value);return Object.entries(value).map(([k,v])=>`${displayText(k)}=${displayText(v,80)}`).join(", ")}__name(envList,"envList");function keyList(value){if(Array.isArray(value))return value.map(v=>displayText(v)).join(", ");if(isRecord(value))return Object.keys(value).map(k=>displayText(k)).join(", ");return void 0}__name(keyList,"keyList");function describeHook(hook,raw,matcher){const details=[];const add=__name((label,value)=>{if(value)details.push(`${label}: ${value}`)},"add");let head;switch(hook["type"]){case"command":head=displayText(raw["command"]);if(typeof raw["command"]==="string"&&/\$\{?\w/.test(raw["command"])){details.push("resolves ${VAR} from the environment (project .env/settings.env or shell)")}add("env",envList(raw["env"]));if(raw["shell"])add("shell",displayText(raw["shell"]));if(hook["async"]===true)details.push("async");break;case"http":head=`http ${displayText(raw["url"])}`;add("headers",keyList(raw["headers"]));add("allowedEnvVars",keyList(raw["allowedEnvVars"]));break;default:head=`prompt "${displayText(raw["prompt"])}"`;if(raw["model"])add("model",displayText(raw["model"],80))}if(raw["type"]!==hook["type"])add("type",displayText(raw["type"]));if(matcher)add("matcher",displayText(matcher,80));return details.length>0?`${head} [${details.join("; ")}]`:head}__name(describeHook,"describeHook");var HOOK_EVENTS=new Set(Object.values(HookEventName));var REQUIRED_FIELD={command:"command",http:"url",prompt:"prompt"};function isRunnableHook(hook){if(!isRecord(hook)||typeof hook["type"]!=="string")return false;const field=REQUIRED_FIELD[hook["type"]];return field!==void 0&&Boolean(hook[field])}__name(isRunnableHook,"isRunnableHook");function entry(value,key){if(Array.isArray(value)&&typeof key==="number")return value[key];return isRecord(value)?value[key]:void 0}__name(entry,"entry");function summarizeProjectHooks(resolved,raw=resolved){const lines=[];for(const[event,definitions]of Object.entries(resolved)){if(!HOOK_EVENTS.has(event)||!Array.isArray(definitions))continue;definitions.forEach((definition,i)=>{if(!isRecord(definition)||!Array.isArray(definition["hooks"]))return;const rawDefinition=entry(entry(raw,event),i);definition["hooks"].forEach((hook,j)=>{if(!isRunnableHook(hook))return;const rawHook=entry(entry(rawDefinition,"hooks"),j);const rawMatcher=entry(rawDefinition,"matcher");lines.push(`${displayText(event,24)} ${describeHook(hook,isRecord(rawHook)?rawHook:hook,rawMatcher??definition["matcher"])}`)})})}return lines}__name(summarizeProjectHooks,"summarizeProjectHooks");function fitHookLines(lines,maxRows){const rows=Math.max(1,Math.floor(maxRows));if(lines.length<=rows)return lines;const shown=Math.max(0,rows-1);return[...lines.slice(0,shown),`\u2026 and ${lines.length-shown} more (see .qwen/settings.json)`]}__name(fitHookLines,"fitHookLines");function fitHookLine(line,width){if(getCachedStringWidth(line)<=width)return line;const total=cpLen(line);const marker=`\u2026 [+${total} chars]`;const kept=clipToWidth(line,width-getCachedStringWidth(marker));return`${kept}\u2026 [+${total-cpLen(kept)} chars]`}__name(fitHookLine,"fitHookLine");var LoadedHookApprovals=class{constructor(file,errors){this.file=file;this.errors=errors}static{__name(this,"LoadedHookApprovals")}getState(approval){const record=this.file.config[normalizeProjectRoot(approval.root)];if(!isRecord(record)||record["hash"]!==hashProjectHooks(approval)){return"pending"}const status=record["status"];return status==="approved"||status==="rejected"?status:"pending"}async setState(approval,status){const{config,errors}=readHookApprovals(this.file.path);if(errors.length>0){throw new Error(`${errors[0].message} (${this.file.path})`)}Object.defineProperty(config,normalizeProjectRoot(approval.root),{value:{hash:hashProjectHooks(approval),status},enumerable:true,configurable:true,writable:true});fs.mkdirSync(path.dirname(this.file.path),{recursive:true});await atomicWriteFile(this.file.path,JSON.stringify(config,null,2),{mode:384,forceMode:true});this.file.config=config}};var warnedErrors=new Set;function readHookApprovals(filePath){const errors=[];let config=Object.create(null);try{if(fs.existsSync(filePath)){const parsed=JSON.parse((0,import_strip_json_comments.default)(fs.readFileSync(filePath,"utf-8")));if(isRecord(parsed)){config=Object.assign(Object.create(null),parsed)}else{errors.push({message:"Hook approvals file is not a valid JSON object.",path:filePath})}}}catch(error){errors.push({message:getErrorMessage(error),path:filePath})}return{config,errors}}__name(readHookApprovals,"readHookApprovals");function loadHookApprovals(){const filePath=getHookApprovalsPath();const{config,errors}=readHookApprovals(filePath);for(const error of errors){if(warnedErrors.has(error.message))continue;warnedErrors.add(error.message);writeStderrLine(`Warning: hook approvals file error: ${error.message}`)}return new LoadedHookApprovals({path:filePath,config},errors)}__name(loadHookApprovals,"loadHookApprovals");function getProjectHooksApprovalState(approval){return approval?loadHookApprovals().getState(approval):void 0}__name(getProjectHooksApprovalState,"getProjectHooksApprovalState");function applyProjectHooksApproval(config,approval){const state=getProjectHooksApprovalState(approval);const trusted=config.isExplicitlyTrustedFolder?.()===true;config.setProjectHooksPendingApproval(state!==void 0&&state!=="approved"&&!(trusted&&state!=="rejected"),state==="rejected");return state}__name(applyProjectHooksApproval,"applyProjectHooksApproval");function getProjectHooksHeadlessWarning(state){return state==="rejected"?`Project hooks in .qwen/settings.json were not loaded: they were rejected for this folder and are not asked about again until they change (decisions are kept in ${getHookApprovalsPath()}).`:"Project hooks in .qwen/settings.json were not loaded: they are not approved for this folder. Run qwen interactively here to review them."}__name(getProjectHooksHeadlessWarning,"getProjectHooksHeadlessWarning");export{getProjectHooksForApproval,getProjectHooksForApprovalFromRawWorkspace,getSeparatedHookSettings,hashProjectHooks,summarizeProjectHooks,fitHookLines,fitHookLine,loadHookApprovals,getProjectHooksApprovalState,applyProjectHooksApproval,getProjectHooksHeadlessWarning};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2026 Qwen Team
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{JsonFormatter}from"./chunk-3MBYQYPC.js";import{parseAndFormatApiError}from"./chunk-PFKTTUGS.js";import{runExitCleanup}from"./chunk-PFECH6U6.js";import{writeStderrLine}from"./chunk-M4ECEHLX.js";import{stripAnsiAndControl}from"./chunk-DBRQGEEI.js";import{createDebugLogger}from"./chunk-46KPDLFH.js";import{FatalBudgetExceededError,FatalCancellationError,FatalTurnLimitedError}from"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var debugLogger=createDebugLogger("CLI_ERRORS");var AlreadyReportedError=class extends Error{static{__name(this,"AlreadyReportedError")}exitCode;constructor(message,exitCode=1){super(message);this.name="AlreadyReportedError";this.exitCode=exitCode}};function getErrorMessage(error){if(error instanceof Error){return error.message}if(error!==null&&typeof error==="object"&&"message"in error&&typeof error.message==="string"){return error.message}if(error!==null&&typeof error==="object"){try{const stringified=JSON.stringify(error);return stringified??String(error)}catch{return String(error)}}return String(error)}__name(getErrorMessage,"getErrorMessage");function extractErrorCode(error){const errorWithCode=error;if(typeof errorWithCode.exitCode==="number"){return errorWithCode.exitCode}if(errorWithCode.code!==void 0){return errorWithCode.code}if(errorWithCode.status!==void 0){return errorWithCode.status}return 1}__name(extractErrorCode,"extractErrorCode");function getNumericExitCode(errorCode){return typeof errorCode==="number"?errorCode:1}__name(getNumericExitCode,"getNumericExitCode");var exiting=false;async function exitAfterCleanup(code,onExitCommitted){if(exiting)return new Promise(()=>{});exiting=true;onExitCommitted?.();await runExitCleanup();return process.exit(code)}__name(exitAfterCleanup,"exitAfterCleanup");function _resetExitLatchForTest(){exiting=false}__name(_resetExitLatchForTest,"_resetExitLatchForTest");async function handleError(error,config,customErrorCode,translate){if(error instanceof AlreadyReportedError){if(config.getOutputFormat()==="json"){const formatter=new JsonFormatter;const errorCode=customErrorCode??error.exitCode;const formattedError=formatter.formatError(error,errorCode);writeStderrLine(formattedError);return exitAfterCleanup(getNumericExitCode(errorCode))}await runExitCleanup();throw error}const errorMessage=parseAndFormatApiError(error,config.getContentGeneratorConfig()?.authType,translate);if(config.getOutputFormat()==="json"){const formatter=new JsonFormatter;const errorCode=customErrorCode??extractErrorCode(error);const formattedError=formatter.formatError(error instanceof Error?error:new Error(getErrorMessage(error)),errorCode);writeStderrLine(formattedError);return exitAfterCleanup(getNumericExitCode(errorCode))}else{writeStderrLine(errorMessage);await runExitCleanup();throw error}}__name(handleError,"handleError");var TOOL_NAME_ECHO_LIMIT=64;var DENIAL_REASON_ECHO_LIMIT=500;function sanitizeForStderr(text,limit){const clean=stripAnsiAndControl(text.replace(/\s+/g," ")).replace(new RegExp("\\p{Cf}","gu"),"").trim();return clean.length>limit?`${clean.slice(0,limit)}\u2026`:clean}__name(sanitizeForStderr,"sanitizeForStderr");function handleToolError(toolName,toolError,config,errorCode,resultDisplay,options={}){const isExecutionDenied=errorCode==="execution_denied";const isNonInteractive=!config.isInteractive();const isTextMode=config.getOutputFormat()==="text";if(isExecutionDenied&&isNonInteractive&&isTextMode){const displayName=sanitizeForStderr(toolName,TOOL_NAME_ECHO_LIMIT);if(options.approvalRequired){process.stderr.write(`Warning: Tool "${displayName}" requires user approval but cannot execute in non-interactive mode.
3
+ import{JsonFormatter}from"./chunk-E4REGDEZ.js";import{parseAndFormatApiError}from"./chunk-ZUWLTGSR.js";import{runExitCleanup}from"./chunk-QRGWB7IX.js";import{writeStderrLine}from"./chunk-M4ECEHLX.js";import{stripAnsiAndControl}from"./chunk-DBRQGEEI.js";import{createDebugLogger}from"./chunk-46KPDLFH.js";import{FatalBudgetExceededError,FatalCancellationError,FatalTurnLimitedError}from"./chunk-E7MYPQGV.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();var debugLogger=createDebugLogger("CLI_ERRORS");var AlreadyReportedError=class extends Error{static{__name(this,"AlreadyReportedError")}exitCode;constructor(message,exitCode=1){super(message);this.name="AlreadyReportedError";this.exitCode=exitCode}};function getErrorMessage(error){if(error instanceof Error){return error.message}if(error!==null&&typeof error==="object"&&"message"in error&&typeof error.message==="string"){return error.message}if(error!==null&&typeof error==="object"){try{const stringified=JSON.stringify(error);return stringified??String(error)}catch{return String(error)}}return String(error)}__name(getErrorMessage,"getErrorMessage");function extractErrorCode(error){const errorWithCode=error;if(typeof errorWithCode.exitCode==="number"){return errorWithCode.exitCode}if(errorWithCode.code!==void 0){return errorWithCode.code}if(errorWithCode.status!==void 0){return errorWithCode.status}return 1}__name(extractErrorCode,"extractErrorCode");function getNumericExitCode(errorCode){return typeof errorCode==="number"?errorCode:1}__name(getNumericExitCode,"getNumericExitCode");var exiting=false;async function exitAfterCleanup(code,onExitCommitted){if(exiting)return new Promise(()=>{});exiting=true;onExitCommitted?.();await runExitCleanup();return process.exit(code)}__name(exitAfterCleanup,"exitAfterCleanup");function _resetExitLatchForTest(){exiting=false}__name(_resetExitLatchForTest,"_resetExitLatchForTest");async function handleError(error,config,customErrorCode,translate){if(error instanceof AlreadyReportedError){if(config.getOutputFormat()==="json"){const formatter=new JsonFormatter;const errorCode=customErrorCode??error.exitCode;const formattedError=formatter.formatError(error,errorCode);writeStderrLine(formattedError);return exitAfterCleanup(getNumericExitCode(errorCode))}await runExitCleanup();throw error}const errorMessage=parseAndFormatApiError(error,config.getContentGeneratorConfig()?.authType,translate);if(config.getOutputFormat()==="json"){const formatter=new JsonFormatter;const errorCode=customErrorCode??extractErrorCode(error);const formattedError=formatter.formatError(error instanceof Error?error:new Error(getErrorMessage(error)),errorCode);writeStderrLine(formattedError);return exitAfterCleanup(getNumericExitCode(errorCode))}else{writeStderrLine(errorMessage);await runExitCleanup();throw error}}__name(handleError,"handleError");var TOOL_NAME_ECHO_LIMIT=64;var DENIAL_REASON_ECHO_LIMIT=500;function sanitizeForStderr(text,limit){const clean=stripAnsiAndControl(text.replace(/\s+/g," ")).replace(new RegExp("\\p{Cf}","gu"),"").trim();return clean.length>limit?`${clean.slice(0,limit)}\u2026`:clean}__name(sanitizeForStderr,"sanitizeForStderr");function handleToolError(toolName,toolError,config,errorCode,resultDisplay,options={}){const isExecutionDenied=errorCode==="execution_denied";const isNonInteractive=!config.isInteractive();const isTextMode=config.getOutputFormat()==="text";if(isExecutionDenied&&isNonInteractive&&isTextMode){const displayName=sanitizeForStderr(toolName,TOOL_NAME_ECHO_LIMIT);if(options.approvalRequired){process.stderr.write(`Warning: Tool "${displayName}" requires user approval but cannot execute in non-interactive mode.
4
4
  To enable automatic tool execution, use the -y flag (YOLO mode):
5
5
  Example: qwen -p 'your prompt' -y
6
6