gerege-cli 0.26.7 → 0.26.8

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 (246) hide show
  1. package/bundled/gerege-video/SKILL.md +22 -0
  2. package/bundled/gerege-video/scripts/video.js +137 -0
  3. package/chunks/{MaxSizedBox-LSNOJEKM.js → MaxSizedBox-LUINLOQW.js} +1 -1
  4. package/chunks/{StandaloneSessionPicker-KSYGPMEV.js → StandaloneSessionPicker-B7N4QO5D.js} +1 -1
  5. package/chunks/{acp-subagent-executor-NSW2MFUI.js → acp-subagent-executor-J6H6FKUT.js} +1 -1
  6. package/chunks/{acpAgent-3DTOHTDM.js → acpAgent-XG6SM2VU.js} +3 -3
  7. package/chunks/{advisor-7JGQPS7X.js → advisor-SZVPQNPA.js} +1 -1
  8. package/chunks/{agent-PNKQJGDO.js → agent-N7QF7BJS.js} +1 -1
  9. package/chunks/{agent-headless-7D33X7QQ.js → agent-headless-GLP5GUEX.js} +1 -1
  10. package/chunks/{agent-host-client-3R2MAUVE.js → agent-host-client-H4VOB3M6.js} +1 -1
  11. package/chunks/{agent-host-connections-2D7DECAE.js → agent-host-connections-E4C3OC4M.js} +1 -1
  12. package/chunks/{anthropicContentGenerator-MGTJJGEQ.js → anthropicContentGenerator-5VTWQLT5.js} +1 -1
  13. package/chunks/{autofix-pr-OIHHZSPQ.js → autofix-pr-HDYQDJS4.js} +1 -1
  14. package/chunks/{batch-6UDAMPAA.js → batch-3CRVN5VJ.js} +1 -1
  15. package/chunks/{bridge-QXVXPNJ6.js → bridge-NZ6WVBLQ.js} +1 -1
  16. package/chunks/{channel-settings-store-P4W4R5SJ.js → channel-settings-store-Z7I2JI6M.js} +1 -1
  17. package/chunks/{chunk-HVP4UF2Q.js → chunk-236DHGNH.js} +1 -1
  18. package/chunks/{chunk-GA35LMSX.js → chunk-2M3ND5WN.js} +1 -1
  19. package/chunks/{chunk-IZXHCHJD.js → chunk-36A6EXHB.js} +1 -1
  20. package/chunks/{chunk-QHYSRPQR.js → chunk-3ANIQTDT.js} +1 -1
  21. package/chunks/{chunk-WK666FGZ.js → chunk-3QTR2HAE.js} +3 -3
  22. package/chunks/{chunk-3EZ5GCUT.js → chunk-3TTHYXT3.js} +1 -1
  23. package/chunks/{chunk-YWK3E4WJ.js → chunk-4CE4GMDL.js} +1 -1
  24. package/chunks/{chunk-VUNHJ74J.js → chunk-4FVT657Y.js} +1 -1
  25. package/chunks/{chunk-BY46PCWY.js → chunk-4HSISRRA.js} +1 -1
  26. package/chunks/{chunk-2LMSDH6P.js → chunk-4SZUJ5RT.js} +1 -1
  27. package/chunks/{chunk-53IB4U4E.js → chunk-57D2OB3I.js} +1 -1
  28. package/chunks/{chunk-QTKPC24L.js → chunk-5FGBLIXB.js} +1 -1
  29. package/chunks/{chunk-5TWAP4OG.js → chunk-5HX2QGVR.js} +1 -1
  30. package/chunks/{chunk-K7GN4CMV.js → chunk-5ZNXAWOG.js} +6 -6
  31. package/chunks/{chunk-QTVSPQZQ.js → chunk-6CKX56LJ.js} +1 -1
  32. package/chunks/{chunk-4W27Z3OL.js → chunk-6NIQFWXP.js} +1 -1
  33. package/chunks/{chunk-6YFNUVJR.js → chunk-6PC6MZHL.js} +1 -1
  34. package/chunks/{chunk-DQQN2HOP.js → chunk-6VQKGKMJ.js} +1 -1
  35. package/chunks/{chunk-MXZXQUVP.js → chunk-6ZEMLEK2.js} +1 -1
  36. package/chunks/{chunk-RT6J7PV4.js → chunk-72VY2PJA.js} +1 -1
  37. package/chunks/{chunk-EEPNACXJ.js → chunk-75I3NYBD.js} +1 -1
  38. package/chunks/{chunk-ATTJQLQV.js → chunk-76L7ZDEK.js} +1 -1
  39. package/chunks/{chunk-T3CQ72HC.js → chunk-7XQ5D34E.js} +6 -6
  40. package/chunks/{chunk-4AKTP4MM.js → chunk-AYX75VXG.js} +1 -1
  41. package/chunks/{chunk-MDCA4I63.js → chunk-BBDFEMCF.js} +1 -1
  42. package/chunks/{chunk-N4ZQC5HB.js → chunk-BOTX7S66.js} +1 -1
  43. package/chunks/{chunk-UVMLWDRU.js → chunk-CY2QKKZA.js} +1 -1
  44. package/chunks/{chunk-W2CV36HT.js → chunk-D5JWQUID.js} +1 -1
  45. package/chunks/{chunk-WEPC42YR.js → chunk-DMIPB7RZ.js} +1 -1
  46. package/chunks/{chunk-BVV7UXES.js → chunk-DSKA3P2C.js} +1 -1
  47. package/chunks/{chunk-SAVYMUU3.js → chunk-DVC65H4X.js} +1 -1
  48. package/chunks/{chunk-MS2XCBPP.js → chunk-DVJSDCMX.js} +1 -1
  49. package/chunks/{chunk-4QOVM2LL.js → chunk-E6CPFQX2.js} +1 -1
  50. package/chunks/{chunk-LYFRGP42.js → chunk-EIFBGEXJ.js} +1 -1
  51. package/chunks/{chunk-3ICJI5KW.js → chunk-EQOHDAYU.js} +1 -1
  52. package/chunks/{chunk-Q5RRVBTY.js → chunk-EZPM4DLR.js} +1 -1
  53. package/chunks/{chunk-ISQMHOCC.js → chunk-F6U6T7QD.js} +1 -1
  54. package/chunks/{chunk-WCI33URB.js → chunk-FCGFBUHS.js} +1 -1
  55. package/chunks/{chunk-CK3OKTTL.js → chunk-G2LTZU67.js} +1 -1
  56. package/chunks/{chunk-WSI4G7XC.js → chunk-GMJSEK4V.js} +1 -1
  57. package/chunks/{chunk-QONPET6Y.js → chunk-HJMUBVXZ.js} +2 -2
  58. package/chunks/{chunk-H5EXNXGW.js → chunk-HQZTAA2U.js} +1 -1
  59. package/chunks/{chunk-5R2JIZID.js → chunk-I63TIQOI.js} +1 -1
  60. package/chunks/{chunk-IY7M5HKF.js → chunk-I65LBJN7.js} +1 -1
  61. package/chunks/{chunk-H34KVVI4.js → chunk-IBDOC27R.js} +1 -1
  62. package/chunks/{chunk-N6EFYQ7M.js → chunk-IKF2HWEV.js} +1 -1
  63. package/chunks/{chunk-CDKBM72V.js → chunk-K6NS2HXT.js} +1 -1
  64. package/chunks/{chunk-BIPPD7W6.js → chunk-KTRNYPQP.js} +1 -1
  65. package/chunks/{chunk-DTX2OVQW.js → chunk-L3ANU5JZ.js} +1 -1
  66. package/chunks/{chunk-WXK7Z45R.js → chunk-LKPMADUO.js} +1 -1
  67. package/chunks/{chunk-4VR4DUUD.js → chunk-M56Y2B6N.js} +1 -1
  68. package/chunks/{chunk-YY4GWNTU.js → chunk-N5KRBAK5.js} +2 -2
  69. package/chunks/{chunk-DVUKYOCJ.js → chunk-NA2WJPOU.js} +1 -1
  70. package/chunks/{chunk-O3TUZQP4.js → chunk-NGOWLXYK.js} +1 -1
  71. package/chunks/{chunk-F7622ZRQ.js → chunk-NL7P73ZP.js} +1 -1
  72. package/chunks/{chunk-U5YOAOU3.js → chunk-NS3QR7D3.js} +1 -1
  73. package/chunks/{chunk-FTF2NFLB.js → chunk-O5JCCBMQ.js} +1 -1
  74. package/chunks/{chunk-DEJ47KJE.js → chunk-OOKFFZHF.js} +1 -1
  75. package/chunks/{chunk-4A663FE6.js → chunk-OTYPLLMT.js} +5 -5
  76. package/chunks/{chunk-NPAENNRO.js → chunk-P7NHWX27.js} +1 -1
  77. package/chunks/{chunk-HXTYFGSQ.js → chunk-PC5QZUKR.js} +1 -1
  78. package/chunks/{chunk-RULGA7WE.js → chunk-PS7MQL57.js} +2 -2
  79. package/chunks/{chunk-FKUDVIME.js → chunk-PXWHOFAA.js} +1 -1
  80. package/chunks/{chunk-6WV5RKYB.js → chunk-Q65LVCDR.js} +1 -1
  81. package/chunks/{chunk-ULLW2AYD.js → chunk-QDUDLELH.js} +1 -1
  82. package/chunks/{chunk-PMBI46K4.js → chunk-QF22ILPV.js} +1 -1
  83. package/chunks/{chunk-LY4XTBL4.js → chunk-QW7MAG2E.js} +1 -1
  84. package/chunks/{chunk-IIHUDJX7.js → chunk-RXK6XD6F.js} +1 -1
  85. package/chunks/{chunk-QSPXKBUX.js → chunk-SVDFCWS7.js} +1 -1
  86. package/chunks/{chunk-NHPKD7LY.js → chunk-TKP3GAUI.js} +1 -1
  87. package/chunks/{chunk-WF7Q3ZSQ.js → chunk-TUS74LFI.js} +1 -1
  88. package/chunks/{chunk-OZFZBGZG.js → chunk-U7YGHPSL.js} +1 -1
  89. package/chunks/{chunk-G4MWPXNY.js → chunk-UB37RBSK.js} +1 -1
  90. package/chunks/{chunk-4LC4INFI.js → chunk-UK5SIRH4.js} +1 -1
  91. package/chunks/{chunk-7HFFTOAD.js → chunk-UTTSBCFR.js} +1 -1
  92. package/chunks/{chunk-IQMKQKKD.js → chunk-UYV4ZVXY.js} +2 -2
  93. package/chunks/{chunk-E3KWSRJN.js → chunk-VC3JJL7E.js} +1 -1
  94. package/chunks/{chunk-FRVXSKL4.js → chunk-VKWVIWLK.js} +1 -1
  95. package/chunks/{chunk-L7LO3YRT.js → chunk-VUI6STKU.js} +1 -1
  96. package/chunks/{chunk-VK7LOUOJ.js → chunk-W3YXE55M.js} +1 -1
  97. package/chunks/{chunk-JHC22BZH.js → chunk-WAIPC47V.js} +1 -1
  98. package/chunks/{chunk-P2MZZMCS.js → chunk-WMJ6UHDP.js} +1 -1
  99. package/chunks/{chunk-6JAXAFX7.js → chunk-WZU2ECUD.js} +1 -1
  100. package/chunks/{chunk-HJLRKM3W.js → chunk-XAGIZY2Y.js} +1 -1
  101. package/chunks/{chunk-2J2BQ3PL.js → chunk-XGZYVULJ.js} +2 -2
  102. package/chunks/{chunk-QVHDM6N7.js → chunk-XJIHDVPX.js} +1 -1
  103. package/chunks/{chunk-ZFOEVHWG.js → chunk-XVDIHFRH.js} +1 -1
  104. package/chunks/{chunk-F5SLLEJY.js → chunk-YMEW4TTT.js} +1 -1
  105. package/chunks/{chunk-NYBYDW6R.js → chunk-Z32URWBG.js} +1 -1
  106. package/chunks/{chunk-WMLYHZZX.js → chunk-Z6HRXHJP.js} +1 -1
  107. package/chunks/{chunk-UM5KBBYP.js → chunk-ZO4F6ZWR.js} +1 -1
  108. package/chunks/{codex-subagent-executor-GPTKVP7H.js → codex-subagent-executor-DDKYNU42.js} +1 -1
  109. package/chunks/{config-utils-6B5FHBSF.js → config-utils-S7Z2ZZ2E.js} +1 -1
  110. package/chunks/{contextCommand-FGRDE3GA.js → contextCommand-7F4PGV2A.js} +1 -1
  111. package/chunks/{core-runtime-OFEHSKDB.js → core-runtime-LBH3U7ZF.js} +1 -1
  112. package/chunks/{create-sub-session-D2KEWVHQ.js → create-sub-session-56DS2T6L.js} +1 -1
  113. package/chunks/{cron-create-RFGGKTL7.js → cron-create-PBP3C46Q.js} +1 -1
  114. package/chunks/{daemon-git-worktree-guard-AV752IOZ.js → daemon-git-worktree-guard-WJS6FBDA.js} +1 -1
  115. package/chunks/{daemon-status-provider-GHQBRDMC.js → daemon-status-provider-UPPAEHJ6.js} +1 -1
  116. package/chunks/{daemon-trust-policy-24ENJNTQ.js → daemon-trust-policy-4Z5HSNUX.js} +1 -1
  117. package/chunks/{daemon-trust-policy-monitor-NMSQAGWV.js → daemon-trust-policy-monitor-WFWDOYX3.js} +1 -1
  118. package/chunks/{deferred-core-runtime-5BAMFFOI.js → deferred-core-runtime-MJYNEA4N.js} +1 -1
  119. package/chunks/{edit-XCECLEH3.js → edit-U7TGKKK3.js} +1 -1
  120. package/chunks/{enterPlanMode-SEN2PMRM.js → enterPlanMode-27HC5AXN.js} +1 -1
  121. package/chunks/{environment-CCPQJYKS.js → environment-PHWY6C4P.js} +1 -1
  122. package/chunks/{errors-Y6HHUTGK.js → errors-F2EYYFI3.js} +1 -1
  123. package/chunks/{execution-tool-HADWGMIG.js → execution-tool-O4KJ5SMM.js} +1 -1
  124. package/chunks/{execution-worker-GZS7WOQL.js → execution-worker-AMFXZ7JD.js} +1 -1
  125. package/chunks/{exitPlanMode-76B5HDLT.js → exitPlanMode-LDYL43PB.js} +1 -1
  126. package/chunks/{fast-path-OEV7LQYV.js → fast-path-HTODEVOR.js} +1 -1
  127. package/chunks/{glob-NLWCQRMS.js → glob-NKQJJZND.js} +1 -1
  128. package/chunks/{goal-tools-43XV33BT.js → goal-tools-47I455VV.js} +1 -1
  129. package/chunks/{handleAutoUpdate-JDQWGSSP.js → handleAutoUpdate-MJKTDJUO.js} +1 -1
  130. package/chunks/{i18n-JW6BVEGF.js → i18n-TCOB4TC5.js} +1 -1
  131. package/chunks/{initializer-UT6JLZ3O.js → initializer-NLYOGZZS.js} +1 -1
  132. package/chunks/{installationInfo-LKWDV3S2.js → installationInfo-TF2RSJOG.js} +1 -1
  133. package/chunks/{interactive-mod-session-2KWKYVPC.js → interactive-mod-session-5F7R3KSA.js} +1 -1
  134. package/chunks/{list-BKINK3S2.js → list-U2AEVLFP.js} +1 -1
  135. package/chunks/{llm-3RWXAVM2.js → llm-EV2QTQBU.js} +4 -4
  136. package/chunks/{llm-content-generator-MDRBSH73.js → llm-content-generator-ZXUSPPG2.js} +1 -1
  137. package/chunks/{loadedSettingsAdapter-WWJUKWUN.js → loadedSettingsAdapter-TLRI22X7.js} +1 -1
  138. package/chunks/{local-TT4FLCTR.js → local-ZTSBSKWV.js} +1 -1
  139. package/chunks/{local-execution-environment-OBA6VWYL.js → local-execution-environment-F263PSIM.js} +1 -1
  140. package/chunks/{loggingContentGenerator-CK7IKYQH.js → loggingContentGenerator-2XHSIJQD.js} +1 -1
  141. package/chunks/{loop-wakeup-4MSRX3DY.js → loop-wakeup-5ET3JHUT.js} +1 -1
  142. package/chunks/{manage-memory-PX5PZJKZ.js → manage-memory-MJEQ47H2.js} +1 -1
  143. package/chunks/{managed-execution-engine-WMAUR3ZK.js → managed-execution-engine-ODPR5OEH.js} +1 -1
  144. package/chunks/{managed-local-serve-X7REHGB4.js → managed-local-serve-S5R4Z5OL.js} +1 -1
  145. package/chunks/managed-npm-update-BUI5APGY.js +8 -0
  146. package/chunks/{managed-runtime-attestation-worker-F4AT53M5.js → managed-runtime-attestation-worker-BQP4E7LQ.js} +1 -1
  147. package/chunks/{managed-runtime-bootstrap-3BP5JRJX.js → managed-runtime-bootstrap-SRBDFSKK.js} +1 -1
  148. package/chunks/{managed-runtime-session-worker-2PO7J5UK.js → managed-runtime-session-worker-UI23BTYJ.js} +1 -1
  149. package/chunks/{managed-runtime-ssh-worker-4N7EMRSV.js → managed-runtime-ssh-worker-HU4CIJRK.js} +1 -1
  150. package/chunks/{managed-session-authority-MYOYTUM2.js → managed-session-authority-XSSTLAEY.js} +1 -1
  151. package/chunks/{mcp-5OTEMZ7P.js → mcp-WLHDOKP7.js} +1 -1
  152. package/chunks/{memory-TNW7RSAV.js → memory-OUUHPSDD.js} +1 -1
  153. package/chunks/{model-call-collection-KNTWFZQS.js → model-call-collection-4A2EB76B.js} +1 -1
  154. package/chunks/{model-configuration-U5C5P5UQ.js → model-configuration-4CGUFKEP.js} +1 -1
  155. package/chunks/{modelConfigUtils-R4KFI2WK.js → modelConfigUtils-HUEERWBA.js} +1 -1
  156. package/chunks/{monitor-RD2PFK42.js → monitor-FXL5UNMP.js} +1 -1
  157. package/chunks/{nonInteractiveCli-QQ72HZSH.js → nonInteractiveCli-W7M2O43W.js} +1 -1
  158. package/chunks/{nonInteractiveToolExecutor-QPQYR6IS.js → nonInteractiveToolExecutor-EMLI363Q.js} +1 -1
  159. package/chunks/{notebook-edit-YLRN3UZT.js → notebook-edit-R5RSLSSH.js} +1 -1
  160. package/chunks/{omni-CUJ52EW5.js → omni-DNZGITTE.js} +1 -1
  161. package/chunks/{openaiContentGenerator-6B5MAU54.js → openaiContentGenerator-PKOPYMHR.js} +1 -1
  162. package/chunks/{openaiResponsesContentGenerator-I245I3R7.js → openaiResponsesContentGenerator-MHH2MF3V.js} +1 -1
  163. package/chunks/{pidfile-P2HIGAUA.js → pidfile-5ZNJWMKG.js} +1 -1
  164. package/chunks/{processUtils-JSKN5UGS.js → processUtils-JIHQDASW.js} +1 -1
  165. package/chunks/{prompt-terminal-ledger-F5TSXVGU.js → prompt-terminal-ledger-L3LZ5SLR.js} +1 -1
  166. package/chunks/{qwenContentGenerator-IEDZONWG.js → qwenContentGenerator-QCZL7HJJ.js} +1 -1
  167. package/chunks/{reactive-degrade-FYZBJCF6.js → reactive-degrade-YUXOUQG4.js} +1 -1
  168. package/chunks/{read-file-VNZNSD6X.js → read-file-FBNU3AVX.js} +1 -1
  169. package/chunks/{resumeHistoryUtils-IDPE6N2N.js → resumeHistoryUtils-5FPRTI4A.js} +1 -1
  170. package/chunks/{review-TBJRZWTD.js → review-NLFYSNM3.js} +1 -1
  171. package/chunks/{ripGrep-4W5B5FOE.js → ripGrep-JUAPC5LD.js} +1 -1
  172. package/chunks/{run-qwen-serve-44X262G5.js → run-qwen-serve-JP64UQ3Y.js} +1 -1
  173. package/chunks/{runtime-6H6LKD73.js → runtime-D2QUYM6U.js} +1 -1
  174. package/chunks/{sandboxConfig-SQXDRGVN.js → sandboxConfig-7VZJQV6H.js} +1 -1
  175. package/chunks/{scheduled-tasks-62IZKHJG.js → scheduled-tasks-PC6EH75E.js} +1 -1
  176. package/chunks/{scheduler-QUCXJYRL.js → scheduler-RUV2FNDR.js} +1 -1
  177. package/chunks/{search-memory-TC2Z34QN.js → search-memory-YJTJ7BRU.js} +1 -1
  178. package/chunks/{send-message-TFZX7KI7.js → send-message-EEEFFTHX.js} +1 -1
  179. package/chunks/{serve-WSICDFGG.js → serve-KMIZDYON.js} +1 -1
  180. package/chunks/{server-GYYVTNGY.js → server-DUPK3V7B.js} +3 -3
  181. package/chunks/{session-KF3O23ZJ.js → session-CW5YMFMP.js} +1 -1
  182. package/chunks/{session-attachments-root-7HFUSONH.js → session-attachments-root-5H5GFHLI.js} +1 -1
  183. package/chunks/{session-execution-engine-selector-NVILT6BR.js → session-execution-engine-selector-MVXM2HZW.js} +1 -1
  184. package/chunks/{session-pr-refresh-3KDFTDEV.js → session-pr-refresh-4UPONX4L.js} +1 -1
  185. package/chunks/{sessionService-XRTFLPDW.js → sessionService-GGCYISSL.js} +1 -1
  186. package/chunks/{settings-QPPK6WXE.js → settings-AASJCESS.js} +1 -1
  187. package/chunks/{shell-WYQDZWL7.js → shell-V4WWLW3Q.js} +1 -1
  188. package/chunks/{skill-FYPT6AU7.js → skill-NDEBB7VX.js} +1 -1
  189. package/chunks/{skill-settings-OGFI5KZF.js → skill-settings-YAI3GYU5.js} +1 -1
  190. package/chunks/{spawnChannel-ANOOVPG7.js → spawnChannel-6JKVJAXZ.js} +1 -1
  191. package/chunks/{standalone-update-45WTDY4E.js → standalone-update-NJP5OCKJ.js} +1 -1
  192. package/chunks/{start-opentui-ui-TL5WK33V.js → start-opentui-ui-M4B4SXRM.js} +1 -1
  193. package/chunks/{startInteractiveUI-N2IREVBM.js → startInteractiveUI-O4JUDEAU.js} +1 -1
  194. package/chunks/{team-create-R77PRZ5U.js → team-create-NLJ7QBLD.js} +1 -1
  195. package/chunks/{team-plan-approval-6DCRKB5I.js → team-plan-approval-XKYPVWNG.js} +1 -1
  196. package/chunks/{terminal-image-renderer-TB7EX2WW.js → terminal-image-renderer-47TD747D.js} +1 -1
  197. package/chunks/{theme-manager-RQDXJGVR.js → theme-manager-AANEBPLJ.js} +1 -1
  198. package/chunks/{tool-call-LVB4NCDT.js → tool-call-ETH3LS7Y.js} +1 -1
  199. package/chunks/{tool-result-media-LRBB2KS6.js → tool-result-media-EFOEPAF2.js} +1 -1
  200. package/chunks/{tool-search-OG73QAQZ.js → tool-search-J3CF5PRN.js} +1 -1
  201. package/chunks/{total-session-admission-A4CUF6AD.js → total-session-admission-3DC52PLQ.js} +1 -1
  202. package/chunks/{trustedFolders-LSGOYTU2.js → trustedFolders-4KPWZZKB.js} +1 -1
  203. package/chunks/{update-relaunch-OGC6BZO7.js → update-relaunch-A67BS7QS.js} +1 -1
  204. package/chunks/{updateCheck-7J3GXTER.js → updateCheck-X623JRSY.js} +1 -1
  205. package/chunks/{upload-config-ML5XEJIF.js → upload-config-X2CR3F26.js} +1 -1
  206. package/chunks/{useAutoAcceptIndicator-6DH6GQ2X.js → useAutoAcceptIndicator-INIOQGJH.js} +1 -1
  207. package/chunks/{validateNonInterActiveAuth-KJDAGZCM.js → validateNonInterActiveAuth-XJ2U5CLB.js} +1 -1
  208. package/chunks/{version-7JN2YXL2.js → version-MFHRMM7W.js} +1 -1
  209. package/chunks/{web-fetch-42ZR4FEZ.js → web-fetch-3GEJ62DH.js} +1 -1
  210. package/chunks/{web-search-74NLPMZJ.js → web-search-WJZO3Q3A.js} +1 -1
  211. package/chunks/{workflow-WNPHX42I.js → workflow-ML7ITCMH.js} +1 -1
  212. package/chunks/{workflow-ancestor-trust-HGF6G7LQ.js → workflow-ancestor-trust-M3VFMS73.js} +1 -1
  213. package/chunks/{workspace-agents-3YFBFAK3.js → workspace-agents-YFZMV7EF.js} +1 -1
  214. package/chunks/{workspace-providers-status-EPJI6KRV.js → workspace-providers-status-3COKLBCI.js} +1 -1
  215. package/chunks/{workspace-recovery-worker-T3FK5YOD.js → workspace-recovery-worker-QURA3WFZ.js} +1 -1
  216. package/chunks/{workspace-registration-store-VEXYBDMA.js → workspace-registration-store-F3AGIOBW.js} +1 -1
  217. package/chunks/{workspace-registry-NRZYTP2X.js → workspace-registry-QUBL3RW6.js} +1 -1
  218. package/chunks/{workspace-runtime-coordinator-USNSTP2V.js → workspace-runtime-coordinator-22TSDHXX.js} +1 -1
  219. package/chunks/{workspace-service-USATWO56.js → workspace-service-UUENTHNO.js} +1 -1
  220. package/chunks/{workspace-skills-status-M5JTSFDL.js → workspace-skills-status-NNQQBBCJ.js} +1 -1
  221. package/chunks/{workspace-trust-reconciler-ZUZ2O5WC.js → workspace-trust-reconciler-3CMMNCGG.js} +1 -1
  222. package/chunks/{write-file-UMJVKE4S.js → write-file-DEAFIK4C.js} +1 -1
  223. package/chunks/{zoom-image-76XYHQ3Z.js → zoom-image-YYO22PQG.js} +1 -1
  224. package/cli-entry.js +2 -3
  225. package/cli.js +2 -2
  226. package/execution-worker.js +1 -1
  227. package/export-transcript-document.js +1 -1
  228. package/package.json +2 -12
  229. package/chunks/managed-npm-update-6HUVAJH7.js +0 -8
  230. package/opentui-assets/@opentui/core/assets/javascript/highlights.scm +0 -205
  231. package/opentui-assets/@opentui/core/assets/javascript/tree-sitter-javascript.wasm +0 -0
  232. package/opentui-assets/@opentui/core/assets/markdown/highlights.scm +0 -150
  233. package/opentui-assets/@opentui/core/assets/markdown/injections.scm +0 -27
  234. package/opentui-assets/@opentui/core/assets/markdown/tree-sitter-markdown.wasm +0 -0
  235. package/opentui-assets/@opentui/core/assets/markdown_inline/highlights.scm +0 -115
  236. package/opentui-assets/@opentui/core/assets/markdown_inline/tree-sitter-markdown_inline.wasm +0 -0
  237. package/opentui-assets/@opentui/core/assets/typescript/highlights.scm +0 -604
  238. package/opentui-assets/@opentui/core/assets/typescript/tree-sitter-typescript.wasm +0 -0
  239. package/opentui-assets/@opentui/core/assets/zig/highlights.scm +0 -284
  240. package/opentui-assets/@opentui/core/assets/zig/tree-sitter-zig.wasm +0 -0
  241. package/opentui-assets/@opentui/core/parser.worker.js +0 -4566
  242. package/opentui-assets/@opentui/core-darwin-arm64/libopentui.dylib +0 -0
  243. package/opentui-assets/@opentui/core-darwin-x64/libopentui.dylib +0 -0
  244. package/opentui-assets/@opentui/core-linux-arm64/libopentui.so +0 -0
  245. package/opentui-assets/@opentui/core-linux-x64/libopentui.so +0 -0
  246. package/opentui-assets/web-tree-sitter/tree-sitter.wasm +0 -0
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{cancelTask,checkReadiness,cleanTask,collectTask,listTasks,retryTask,runPlan}from"./chunk-SZBGWRES.js";import{loadUndici}from"./chunk-XKSB7VTV.js";import{collectProviderModelsForProtocol,getAuthTypeFromEnv,resolveCliGenerationConfig}from"./chunk-SAVYMUU3.js";import{loadSettings}from"./chunk-Q5RRVBTY.js";import{normalizeProxyUrl}from"./chunk-T3CQ72HC.js";import{isTlsVerificationDisabled}from"./chunk-ZZZAYAJW.js";import{ignoreBrokenPipe,writeStderrLine,writeStdoutLine}from"./chunk-M4ECEHLX.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();init_esbuild_shims();async function resolveProxy(cliProxy,settingsProxy){const proxyUrl=resolveProxyUrl(cliProxy,settingsProxy);if(proxyUrl){const{EnvHttpProxyAgent,setGlobalDispatcher}=await loadUndici();setGlobalDispatcher(new EnvHttpProxyAgent({httpProxy:proxyUrl,httpsProxy:proxyUrl}))}return proxyUrl}__name(resolveProxy,"resolveProxy");function resolveProxyUrl(cliProxy,settingsProxy){return normalizeProxyUrl(cliProxy||settingsProxy||process.env["HTTPS_PROXY"]||process.env["https_proxy"]||process.env["HTTP_PROXY"]||process.env["http_proxy"])}__name(resolveProxyUrl,"resolveProxyUrl");var DEFAULT_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1";function resolveEndpoint(env=process.env,options={}){let settings=options.settings??loadSettings().merged;const batch=settings.batch;if(batch?.model||batch?.authType||batch?.baseUrl){if(!batch.model?.trim()){throw new Error("Set batch.model to a modelProviders model ID.")}if(batch.authType&&batch.authType!=="openai"){throw new Error('batch.authType must be "openai" for DashScope Batch.')}const matches=collectProviderModelsForProtocol(settings.modelProviders,settings.providerProtocol,"openai").filter(provider2=>provider2.id===batch.model&&(!batch.baseUrl||provider2.baseUrl===batch.baseUrl));if(matches.length!==1){throw new Error("batch.model must match exactly one chat-completions modelProviders entry; use batch.baseUrl to disambiguate duplicate IDs.")}const provider=matches[0];if(!provider.baseUrl||!provider.envKey||!env[provider.envKey]){throw new Error("The Batch provider needs baseUrl and an envKey with a non-empty value in settings.env or the environment.")}settings={...settings,model:{name:provider.id,baseUrl:provider.baseUrl},modelProviders:{openai:[provider]},security:{auth:{selectedType:"openai"}}};env={[provider.envKey]:env[provider.envKey]}}const selectedAuthType=settings.security?.auth?.selectedType??getAuthTypeFromEnv(env);if(selectedAuthType!=="openai"){throw new Error(`qwen batch needs an API key (auth type "openai") for a DashScope endpoint; current auth type is "${selectedAuthType??"none"}".`)}const{apiKey,baseUrl,model,warnings,authType,generationConfig}=resolveCliGenerationConfig({argv:{},settings,selectedAuthType,env});if(authType!=="openai"){throw new Error(`qwen batch needs a model on the OpenAI-compatible chat-completions wire; "${model||"the configured model"}" resolves to auth type "${authType??"none"}".`)}if(!apiKey){throw new Error("No API key found: set OPENAI_API_KEY or security.auth.apiKey.")}const warn=options.warn??(message=>writeStderrLine(`warning: ${message}`));for(const warning of warnings??[]){warn(warning)}return{apiKey,baseUrl:(baseUrl||DEFAULT_BASE_URL).replace(/\/+$/,""),model,generationConfig}}__name(resolveEndpoint,"resolveEndpoint");async function prepareEndpoint(env=process.env,cliOptions={}){if(cliOptions.insecure)process.env["QWEN_TLS_INSECURE"]="1";if(isTlsVerificationDisabled()&&process.env["NODE_TLS_REJECT_UNAUTHORIZED"]!=="0"){process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";writeStderrLine("WARNING: TLS certificate verification is disabled (--insecure / QWEN_TLS_INSECURE); connections made by this command are vulnerable to man-in-the-middle attacks.")}await resolveProxy(cliOptions.proxy,loadSettings().merged.proxy);return resolveEndpoint(env)}__name(prepareEndpoint,"prepareEndpoint");var cliOptionsOf=__name(argv=>({proxy:argv["proxy"],insecure:argv["insecure"]}),"cliOptionsOf");async function run(fn){try{await fn()}catch(error){writeStderrLine(error instanceof Error?error.message:String(error));process.exitCode=1}await Promise.all([process.stdout,process.stderr].map(stream=>new Promise(resolve=>stream.write("",()=>resolve()))))}__name(run,"run");var LOCK_WAIT_MS=15e3;var workflowDeps=__name(ep=>({ep,cwd:process.cwd(),env:process.env,out:writeStdoutLine,err:writeStderrLine,lockWaitMs:LOCK_WAIT_MS}),"workflowDeps");var runWorkflowCommand={command:"run <plan>",describe:"Run an agent-prepared batch plan: assemble requests, submit, record the task",builder:__name(yargs=>yargs.positional("plan",{describe:"Plan JSON (usually written by the /batch-api skill): shared rules + source/target items",type:"string",demandOption:true}).option("dry-run",{describe:"Assemble and show items, frozen settings and the estimate without uploading; prints a snapshot digest",type:"boolean",default:false}).option("expect",{describe:"Submit only if the batch still matches this snapshot digest from --dry-run",type:"string"}).check(argv=>argv["dry-run"]&&argv["expect"]!==void 0?"--dry-run and --expect cannot be combined":true),"builder"),handler:__name(argv=>run(async()=>{await runPlan(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["plan"],{dryRun:argv["dry-run"],expect:argv["expect"]})}),"handler")};var collectWorkflowCommand={command:"collect <task-id>",describe:"Collect a workflow task: reconcile, download, validate, and deliver results",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id printed by `qwen batch run`",type:"string",demandOption:true}).option("wait",{describe:"Poll (over HTTP, holding no lock) until the batch settles, then collect",type:"boolean",default:false}).option("timeout",{describe:"Seconds to wait with --wait before giving up (default: none)",type:"number"}).check(argv=>argv["timeout"]===void 0||Number.isFinite(argv["timeout"])&&argv["timeout"]>0?true:"--timeout must be a positive number of seconds"),"builder"),handler:__name(argv=>run(async()=>{await collectTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"],{wait:argv["wait"],timeoutSeconds:argv["timeout"]})}),"handler")};var retryWorkflowCommand={command:"retry <task-id>",describe:"Resubmit only the failed items of a workflow task",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}).option("max-output-tokens",{describe:"Output limit for the new attempt; required to resend items that were truncated",type:"number"}).check(argv=>argv["max-output-tokens"]===void 0||Number.isInteger(argv["max-output-tokens"])&&argv["max-output-tokens"]>0?true:"--max-output-tokens must be a positive integer"),"builder"),handler:__name(argv=>run(async()=>{await retryTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"],{maxOutputTokens:argv["max-output-tokens"]})}),"handler")};var cleanWorkflowCommand={command:"clean <task-id>",describe:"Delete a workflow task's local record (cancels nothing; refuses while a batch may be running)",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}).option("force",{describe:"Delete even if a batch may still be running or uncollected (it is not cancelled)",type:"boolean",default:false}),"builder"),handler:__name(argv=>run(async()=>{await cleanTask({env:process.env,out:writeStdoutLine,err:writeStderrLine,lockWaitMs:LOCK_WAIT_MS},argv["task-id"],{force:argv["force"]})}),"handler")};var checkWorkflowCommand={command:"check",describe:"Verify credentials and the Batch route, and show the settings a run would freeze (no billed request)",builder:__name(yargs=>yargs,"builder"),handler:__name(argv=>run(async()=>{await checkReadiness(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))))}),"handler")};var cancelWorkflowCommand={command:"cancel <task-id>",describe:"Cancel a workflow task's active batch (already-completed requests are still billed)",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}),"builder"),handler:__name(argv=>run(async()=>{await cancelTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"])}),"handler")};var listWorkflowCommand={command:"list",describe:"List all recorded workflow tasks with their project",builder:__name(yargs=>yargs,"builder"),handler:__name(()=>run(async()=>{ignoreBrokenPipe();await listTasks({env:process.env,out:writeStdoutLine,err:writeStderrLine})}),"handler")};var batchCommand={command:"batch",describe:"Run many independent requests through the DashScope Batch API",builder:__name(yargs=>yargs.command(runWorkflowCommand).command(collectWorkflowCommand).command(retryWorkflowCommand).command(cancelWorkflowCommand).command(listWorkflowCommand).command(checkWorkflowCommand).command(cleanWorkflowCommand).demandCommand(1,"You need at least one command before continuing.").version(false),"builder"),handler:__name(()=>{},"handler")};export{resolveProxy,resolveProxyUrl,resolveEndpoint,prepareEndpoint,listWorkflowCommand,batchCommand};
3
+ import{cancelTask,checkReadiness,cleanTask,collectTask,listTasks,retryTask,runPlan}from"./chunk-SZBGWRES.js";import{loadUndici}from"./chunk-XKSB7VTV.js";import{collectProviderModelsForProtocol,getAuthTypeFromEnv,resolveCliGenerationConfig}from"./chunk-DVC65H4X.js";import{loadSettings}from"./chunk-EZPM4DLR.js";import{normalizeProxyUrl}from"./chunk-7XQ5D34E.js";import{isTlsVerificationDisabled}from"./chunk-ZZZAYAJW.js";import{ignoreBrokenPipe,writeStderrLine,writeStdoutLine}from"./chunk-M4ECEHLX.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();init_esbuild_shims();async function resolveProxy(cliProxy,settingsProxy){const proxyUrl=resolveProxyUrl(cliProxy,settingsProxy);if(proxyUrl){const{EnvHttpProxyAgent,setGlobalDispatcher}=await loadUndici();setGlobalDispatcher(new EnvHttpProxyAgent({httpProxy:proxyUrl,httpsProxy:proxyUrl}))}return proxyUrl}__name(resolveProxy,"resolveProxy");function resolveProxyUrl(cliProxy,settingsProxy){return normalizeProxyUrl(cliProxy||settingsProxy||process.env["HTTPS_PROXY"]||process.env["https_proxy"]||process.env["HTTP_PROXY"]||process.env["http_proxy"])}__name(resolveProxyUrl,"resolveProxyUrl");var DEFAULT_BASE_URL="https://dashscope.aliyuncs.com/compatible-mode/v1";function resolveEndpoint(env=process.env,options={}){let settings=options.settings??loadSettings().merged;const batch=settings.batch;if(batch?.model||batch?.authType||batch?.baseUrl){if(!batch.model?.trim()){throw new Error("Set batch.model to a modelProviders model ID.")}if(batch.authType&&batch.authType!=="openai"){throw new Error('batch.authType must be "openai" for DashScope Batch.')}const matches=collectProviderModelsForProtocol(settings.modelProviders,settings.providerProtocol,"openai").filter(provider2=>provider2.id===batch.model&&(!batch.baseUrl||provider2.baseUrl===batch.baseUrl));if(matches.length!==1){throw new Error("batch.model must match exactly one chat-completions modelProviders entry; use batch.baseUrl to disambiguate duplicate IDs.")}const provider=matches[0];if(!provider.baseUrl||!provider.envKey||!env[provider.envKey]){throw new Error("The Batch provider needs baseUrl and an envKey with a non-empty value in settings.env or the environment.")}settings={...settings,model:{name:provider.id,baseUrl:provider.baseUrl},modelProviders:{openai:[provider]},security:{auth:{selectedType:"openai"}}};env={[provider.envKey]:env[provider.envKey]}}const selectedAuthType=settings.security?.auth?.selectedType??getAuthTypeFromEnv(env);if(selectedAuthType!=="openai"){throw new Error(`qwen batch needs an API key (auth type "openai") for a DashScope endpoint; current auth type is "${selectedAuthType??"none"}".`)}const{apiKey,baseUrl,model,warnings,authType,generationConfig}=resolveCliGenerationConfig({argv:{},settings,selectedAuthType,env});if(authType!=="openai"){throw new Error(`qwen batch needs a model on the OpenAI-compatible chat-completions wire; "${model||"the configured model"}" resolves to auth type "${authType??"none"}".`)}if(!apiKey){throw new Error("No API key found: set OPENAI_API_KEY or security.auth.apiKey.")}const warn=options.warn??(message=>writeStderrLine(`warning: ${message}`));for(const warning of warnings??[]){warn(warning)}return{apiKey,baseUrl:(baseUrl||DEFAULT_BASE_URL).replace(/\/+$/,""),model,generationConfig}}__name(resolveEndpoint,"resolveEndpoint");async function prepareEndpoint(env=process.env,cliOptions={}){if(cliOptions.insecure)process.env["QWEN_TLS_INSECURE"]="1";if(isTlsVerificationDisabled()&&process.env["NODE_TLS_REJECT_UNAUTHORIZED"]!=="0"){process.env["NODE_TLS_REJECT_UNAUTHORIZED"]="0";writeStderrLine("WARNING: TLS certificate verification is disabled (--insecure / QWEN_TLS_INSECURE); connections made by this command are vulnerable to man-in-the-middle attacks.")}await resolveProxy(cliOptions.proxy,loadSettings().merged.proxy);return resolveEndpoint(env)}__name(prepareEndpoint,"prepareEndpoint");var cliOptionsOf=__name(argv=>({proxy:argv["proxy"],insecure:argv["insecure"]}),"cliOptionsOf");async function run(fn){try{await fn()}catch(error){writeStderrLine(error instanceof Error?error.message:String(error));process.exitCode=1}await Promise.all([process.stdout,process.stderr].map(stream=>new Promise(resolve=>stream.write("",()=>resolve()))))}__name(run,"run");var LOCK_WAIT_MS=15e3;var workflowDeps=__name(ep=>({ep,cwd:process.cwd(),env:process.env,out:writeStdoutLine,err:writeStderrLine,lockWaitMs:LOCK_WAIT_MS}),"workflowDeps");var runWorkflowCommand={command:"run <plan>",describe:"Run an agent-prepared batch plan: assemble requests, submit, record the task",builder:__name(yargs=>yargs.positional("plan",{describe:"Plan JSON (usually written by the /batch-api skill): shared rules + source/target items",type:"string",demandOption:true}).option("dry-run",{describe:"Assemble and show items, frozen settings and the estimate without uploading; prints a snapshot digest",type:"boolean",default:false}).option("expect",{describe:"Submit only if the batch still matches this snapshot digest from --dry-run",type:"string"}).check(argv=>argv["dry-run"]&&argv["expect"]!==void 0?"--dry-run and --expect cannot be combined":true),"builder"),handler:__name(argv=>run(async()=>{await runPlan(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["plan"],{dryRun:argv["dry-run"],expect:argv["expect"]})}),"handler")};var collectWorkflowCommand={command:"collect <task-id>",describe:"Collect a workflow task: reconcile, download, validate, and deliver results",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id printed by `qwen batch run`",type:"string",demandOption:true}).option("wait",{describe:"Poll (over HTTP, holding no lock) until the batch settles, then collect",type:"boolean",default:false}).option("timeout",{describe:"Seconds to wait with --wait before giving up (default: none)",type:"number"}).check(argv=>argv["timeout"]===void 0||Number.isFinite(argv["timeout"])&&argv["timeout"]>0?true:"--timeout must be a positive number of seconds"),"builder"),handler:__name(argv=>run(async()=>{await collectTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"],{wait:argv["wait"],timeoutSeconds:argv["timeout"]})}),"handler")};var retryWorkflowCommand={command:"retry <task-id>",describe:"Resubmit only the failed items of a workflow task",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}).option("max-output-tokens",{describe:"Output limit for the new attempt; required to resend items that were truncated",type:"number"}).check(argv=>argv["max-output-tokens"]===void 0||Number.isInteger(argv["max-output-tokens"])&&argv["max-output-tokens"]>0?true:"--max-output-tokens must be a positive integer"),"builder"),handler:__name(argv=>run(async()=>{await retryTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"],{maxOutputTokens:argv["max-output-tokens"]})}),"handler")};var cleanWorkflowCommand={command:"clean <task-id>",describe:"Delete a workflow task's local record (cancels nothing; refuses while a batch may be running)",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}).option("force",{describe:"Delete even if a batch may still be running or uncollected (it is not cancelled)",type:"boolean",default:false}),"builder"),handler:__name(argv=>run(async()=>{await cleanTask({env:process.env,out:writeStdoutLine,err:writeStderrLine,lockWaitMs:LOCK_WAIT_MS},argv["task-id"],{force:argv["force"]})}),"handler")};var checkWorkflowCommand={command:"check",describe:"Verify credentials and the Batch route, and show the settings a run would freeze (no billed request)",builder:__name(yargs=>yargs,"builder"),handler:__name(argv=>run(async()=>{await checkReadiness(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))))}),"handler")};var cancelWorkflowCommand={command:"cancel <task-id>",describe:"Cancel a workflow task's active batch (already-completed requests are still billed)",builder:__name(yargs=>yargs.positional("task-id",{describe:"Task id",type:"string",demandOption:true}),"builder"),handler:__name(argv=>run(async()=>{await cancelTask(workflowDeps(await prepareEndpoint(process.env,cliOptionsOf(argv))),argv["task-id"])}),"handler")};var listWorkflowCommand={command:"list",describe:"List all recorded workflow tasks with their project",builder:__name(yargs=>yargs,"builder"),handler:__name(()=>run(async()=>{ignoreBrokenPipe();await listTasks({env:process.env,out:writeStdoutLine,err:writeStderrLine})}),"handler")};var batchCommand={command:"batch",describe:"Run many independent requests through the DashScope Batch API",builder:__name(yargs=>yargs.command(runWorkflowCommand).command(collectWorkflowCommand).command(retryWorkflowCommand).command(cancelWorkflowCommand).command(listWorkflowCommand).command(checkWorkflowCommand).command(cleanWorkflowCommand).demandCommand(1,"You need at least one command before continuing.").version(false),"builder"),handler:__name(()=>{},"handler")};export{resolveProxy,resolveProxyUrl,resolveEndpoint,prepareEndpoint,listWorkflowCommand,batchCommand};
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{GlobTool}from"./chunk-M7MGE5IU.js";import{GrepTool}from"./chunk-S7Z7SUH3.js";import{LSTool}from"./chunk-FK5M3433.js";import{NotebookEditTool}from"./chunk-N6EFYQ7M.js";import{TaskStopTool}from"./chunk-GXWDEHFP.js";import{WriteFileTool}from"./chunk-W2CV36HT.js";import{EditTool}from"./chunk-O3TUZQP4.js";import{ShellTool,isModifiableDeclarativeTool}from"./chunk-T3CQ72HC.js";import{stableJson}from"./chunk-FIXDX63I.js";import{ReadFileTool}from"./chunk-ZWPSBU7K.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{stat}from"node:fs/promises";function createExecutionTools(config){const tools=[new ReadFileTool(config),new WriteFileTool(config),new EditTool(config),new NotebookEditTool(config),new GlobTool(config),new GrepTool(config),new LSTool(config),new ShellTool(config),new TaskStopTool(config)];return new Map(tools.map(tool=>[tool.name,tool]))}__name(createExecutionTools,"createExecutionTools");var LocalExecutionEnvironment=class{constructor(config,options={}){this.config=config;this.toolNames=options.toolNames;this.run=options.run;this.tools=createExecutionTools(config);if(options.toolNames){for(const name of this.tools.keys()){if(!options.toolNames.has(name))this.tools.delete(name)}}}static{__name(this,"LocalExecutionEnvironment")}toolNames;tools;invocations=new Map;controllers=new Set;run;disposed=false;tool(name){if(this.disposed)throw new Error("Execution environment is disposed.");const tool=this.tools.get(name);if(!tool)throw new Error(`Unsupported execution tool: ${name}`);return tool}pending(id){if(this.disposed)throw new Error("Execution environment is disposed.");const pending=this.invocations.get(id);if(!pending)throw new Error(`Unknown execution invocation: ${id}`);if(pending.executing)throw new Error(`Invocation is executing: ${id}`);return pending}toolDefinition(name){const{name:toolName,description,parametersJsonSchema}=this.tool(name).schema;return{name:toolName,description,parametersJsonSchema}}async prepare(request,signal){signal.throwIfAborted();const tool=this.tool(request.toolName);if(this.invocations.has(request.id))throw new Error(`Duplicate invocation: ${request.id}`);if(this.invocations.size>=256)throw new Error("Too many pending execution invocations.");let params=structuredClone(request.params);if(request.modification){if(!isModifiableDeclarativeTool(tool))throw new Error("Tool does not support modification.");params=tool.getModifyContext(signal).createUpdatedParams(request.modification.oldContent,request.modification.newContent,params)}const invocation=tool.build(params);this.invocations.set(request.id,{toolName:request.toolName,invocation,executing:false,...request.callId===void 0?{}:{callId:request.callId}});return{params:invocation.params,description:invocation.getDescription(),locations:invocation.toolLocations()}}async permission(id,signal){signal.throwIfAborted();return this.pending(id).invocation.getDefaultPermission(signal)}async confirmation(id,signal){signal.throwIfAborted();const pending=this.pending(id);const details=await pending.invocation.getConfirmationDetails(signal);pending.confirmation=details;const{onConfirm:_onConfirm,...serializable}=details;return serializable}async confirm(id,outcome,payload,signal){signal.throwIfAborted();const pending=this.pending(id);await pending.confirmation?.onConfirm(outcome,payload);if(outcome==="cancel")this.invocations.delete(id)}async execute(id,signal,updateOutput){signal.throwIfAborted();const pending=this.pending(id);pending.executing=true;const controller=new AbortController;const abort=__name(()=>controller.abort(signal.reason),"abort");signal.addEventListener("abort",abort,{once:true});this.controllers.add(controller);try{if(this.run){const params=structuredClone(pending.invocation.params);const rebuilt=this.tool(pending.toolName).build(structuredClone(params)).params;if(stableJson(rebuilt)!==stableJson(params)){throw new Error("The approved parameters change when the tool builds them again; the call did not run.")}return await this.run({id,toolName:pending.toolName,params,...pending.callId===void 0?{}:{callId:pending.callId}},controller.signal,updateOutput)}return await pending.invocation.execute(controller.signal,updateOutput,{...this.config.getShellExecutionConfig(),streamBufferedOutput:true})}finally{signal.removeEventListener("abort",abort);this.controllers.delete(controller);this.invocations.delete(id)}}async modificationContent(toolName,params,signal){signal.throwIfAborted();const tool=this.tool(toolName);if(!isModifiableDeclarativeTool(tool))throw new Error("Tool does not support modification.");const context=tool.getModifyContext(signal);const current=await context.getCurrentContent(params);const proposed=await context.getProposedContent(params);return{current,proposed}}async release(id,signal){signal.throwIfAborted();if(!this.invocations.get(id)?.executing)this.invocations.delete(id)}async invalidateReadCache(paths){const cache=this.config.getFileReadCache();if(!paths){cache.clear();return}await Promise.all(paths.map(async filePath=>{const stats=await stat(filePath).catch(()=>void 0);if(!stats||!cache.markReadEvictedFromHistory(stats))cache.invalidateByPath(filePath)}))}async dispose(){this.disposed=true;for(const controller of this.controllers)controller.abort();this.config.getBackgroundShellRegistry().abortAll();this.invocations.clear();this.tools.clear()}};export{createExecutionTools,LocalExecutionEnvironment};
3
+ import{GlobTool}from"./chunk-M7MGE5IU.js";import{GrepTool}from"./chunk-S7Z7SUH3.js";import{LSTool}from"./chunk-FK5M3433.js";import{NotebookEditTool}from"./chunk-IKF2HWEV.js";import{TaskStopTool}from"./chunk-GXWDEHFP.js";import{WriteFileTool}from"./chunk-D5JWQUID.js";import{EditTool}from"./chunk-NGOWLXYK.js";import{ShellTool,isModifiableDeclarativeTool}from"./chunk-7XQ5D34E.js";import{stableJson}from"./chunk-FIXDX63I.js";import{ReadFileTool}from"./chunk-ZWPSBU7K.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{stat}from"node:fs/promises";function createExecutionTools(config){const tools=[new ReadFileTool(config),new WriteFileTool(config),new EditTool(config),new NotebookEditTool(config),new GlobTool(config),new GrepTool(config),new LSTool(config),new ShellTool(config),new TaskStopTool(config)];return new Map(tools.map(tool=>[tool.name,tool]))}__name(createExecutionTools,"createExecutionTools");var LocalExecutionEnvironment=class{constructor(config,options={}){this.config=config;this.toolNames=options.toolNames;this.run=options.run;this.tools=createExecutionTools(config);if(options.toolNames){for(const name of this.tools.keys()){if(!options.toolNames.has(name))this.tools.delete(name)}}}static{__name(this,"LocalExecutionEnvironment")}toolNames;tools;invocations=new Map;controllers=new Set;run;disposed=false;tool(name){if(this.disposed)throw new Error("Execution environment is disposed.");const tool=this.tools.get(name);if(!tool)throw new Error(`Unsupported execution tool: ${name}`);return tool}pending(id){if(this.disposed)throw new Error("Execution environment is disposed.");const pending=this.invocations.get(id);if(!pending)throw new Error(`Unknown execution invocation: ${id}`);if(pending.executing)throw new Error(`Invocation is executing: ${id}`);return pending}toolDefinition(name){const{name:toolName,description,parametersJsonSchema}=this.tool(name).schema;return{name:toolName,description,parametersJsonSchema}}async prepare(request,signal){signal.throwIfAborted();const tool=this.tool(request.toolName);if(this.invocations.has(request.id))throw new Error(`Duplicate invocation: ${request.id}`);if(this.invocations.size>=256)throw new Error("Too many pending execution invocations.");let params=structuredClone(request.params);if(request.modification){if(!isModifiableDeclarativeTool(tool))throw new Error("Tool does not support modification.");params=tool.getModifyContext(signal).createUpdatedParams(request.modification.oldContent,request.modification.newContent,params)}const invocation=tool.build(params);this.invocations.set(request.id,{toolName:request.toolName,invocation,executing:false,...request.callId===void 0?{}:{callId:request.callId}});return{params:invocation.params,description:invocation.getDescription(),locations:invocation.toolLocations()}}async permission(id,signal){signal.throwIfAborted();return this.pending(id).invocation.getDefaultPermission(signal)}async confirmation(id,signal){signal.throwIfAborted();const pending=this.pending(id);const details=await pending.invocation.getConfirmationDetails(signal);pending.confirmation=details;const{onConfirm:_onConfirm,...serializable}=details;return serializable}async confirm(id,outcome,payload,signal){signal.throwIfAborted();const pending=this.pending(id);await pending.confirmation?.onConfirm(outcome,payload);if(outcome==="cancel")this.invocations.delete(id)}async execute(id,signal,updateOutput){signal.throwIfAborted();const pending=this.pending(id);pending.executing=true;const controller=new AbortController;const abort=__name(()=>controller.abort(signal.reason),"abort");signal.addEventListener("abort",abort,{once:true});this.controllers.add(controller);try{if(this.run){const params=structuredClone(pending.invocation.params);const rebuilt=this.tool(pending.toolName).build(structuredClone(params)).params;if(stableJson(rebuilt)!==stableJson(params)){throw new Error("The approved parameters change when the tool builds them again; the call did not run.")}return await this.run({id,toolName:pending.toolName,params,...pending.callId===void 0?{}:{callId:pending.callId}},controller.signal,updateOutput)}return await pending.invocation.execute(controller.signal,updateOutput,{...this.config.getShellExecutionConfig(),streamBufferedOutput:true})}finally{signal.removeEventListener("abort",abort);this.controllers.delete(controller);this.invocations.delete(id)}}async modificationContent(toolName,params,signal){signal.throwIfAborted();const tool=this.tool(toolName);if(!isModifiableDeclarativeTool(tool))throw new Error("Tool does not support modification.");const context=tool.getModifyContext(signal);const current=await context.getCurrentContent(params);const proposed=await context.getProposedContent(params);return{current,proposed}}async release(id,signal){signal.throwIfAborted();if(!this.invocations.get(id)?.executing)this.invocations.delete(id)}async invalidateReadCache(paths){const cache=this.config.getFileReadCache();if(!paths){cache.clear();return}await Promise.all(paths.map(async filePath=>{const stats=await stat(filePath).catch(()=>void 0);if(!stats||!cache.markReadEvictedFromHistory(stats))cache.invalidateByPath(filePath)}))}async dispose(){this.disposed=true;for(const controller of this.controllers)controller.abort();this.config.getBackgroundShellRegistry().abortAll();this.invocations.clear();this.tools.clear()}};export{createExecutionTools,LocalExecutionEnvironment};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2026 Qwen Team
@@ -1,7 +1,7 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
3
  import{remarkParse,unified}from"./chunk-AZ3CKMCT.js";import{estimateTextTokens}from"./chunk-RP57XAJ2.js";import{ignoreBrokenPipe}from"./chunk-M4ECEHLX.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{homedir}from"node:os";import path2 from"node:path";import*as fs2 from"node:fs/promises";init_esbuild_shims();init_esbuild_shims();var MEMORY_IMPORT_BUDGET={maxCalls:32,maxReservedTokens:512e3,batchSections:8,sourceBytes:65536,contextBytes:32768,outputTokens:8192,promptBytes:32768};function packMemoryImportSections(sections){const groups=new Map;for(const section of[...sections].sort((a,b)=>a.id.localeCompare(b.id))){const key=`${section.scope??""}:${section.groupId}`;const group=groups.get(key)??[];group.push(section);groups.set(key,group)}const batches=[];for(const group of groups.values()){let batch=[];let bytes=0;for(const section of group){const size=Buffer.byteLength(section.content);if(batch.length&&(batch.length===MEMORY_IMPORT_BUDGET.batchSections||bytes+size>MEMORY_IMPORT_BUDGET.sourceBytes)){batches.push(batch);batch=[];bytes=0}batch.push(section);bytes+=size}if(batch.length)batches.push(batch)}return batches}__name(packMemoryImportSections,"packMemoryImportSections");function estimateMemoryImport(sections){const batches=packMemoryImportSections(sections);const modelCalls=batches.length*2;const sourceTokens=sections.reduce((n,section)=>n+estimateTextTokens(section.content),0);const sourceBytes=Buffer.byteLength(JSON.stringify(sections.map(({id,content})=>({id,content}))));const reservedTokens=modelCalls*(MEMORY_IMPORT_BUDGET.contextBytes+MEMORY_IMPORT_BUDGET.promptBytes+MEMORY_IMPORT_BUDGET.outputTokens+1024)+sourceBytes+modelCalls;return{basis:"source-only-with-context-reserve",modelCalls,sourceTokens,maxOutputTokens:modelCalls*MEMORY_IMPORT_BUDGET.outputTokens,reservedTokens,exceedsBudget:modelCalls>MEMORY_IMPORT_BUDGET.maxCalls||reservedTokens>MEMORY_IMPORT_BUDGET.maxReservedTokens,limits:MEMORY_IMPORT_BUDGET}}__name(estimateMemoryImport,"estimateMemoryImport");import{createHash}from"node:crypto";import*as fs from"node:fs/promises";import path from"node:path";import{constants}from"node:fs";var MemoryImportRequestError=class extends Error{static{__name(this,"MemoryImportRequestError")}};var IMPORT_LIMITS={files:256,fileBytes:512*1024,totalBytes:8*1024*1024,sectionBytes:64*1024,headings:4096,markdownLines:16384,inlineMarkers:4096};function digest(value){return createHash("sha256").update(value).digest("hex")}__name(digest,"digest");function record(value){return value!==null&&typeof value==="object"&&!Array.isArray(value)}__name(record,"record");function validSourcePath(value){return value.length<=512&&!/[\\\p{Cc}]/u.test(value)&&!value.startsWith("/")&&!/^[a-z]:/i.test(value)&&value.split("/").every(part=>part!==""&&part!=="."&&part!=="..")&&(/^(?:MEMORY|memory_summary)\.md$/.test(value)||/^rollout_summaries\/[\w.-]+\.md$/.test(value))}__name(validSourcePath,"validSourcePath");function validateSource(value){if(!record(value)||value["version"]!==1||value["source"]!=="codex"||!Array.isArray(value["files"])||value["files"].length===0||value["files"].length>IMPORT_LIMITS.files)throw new MemoryImportRequestError("Invalid version 1 Codex source set.");let bytes=0;const seen=new Set;const files=value["files"].map(file=>{if(!record(file)||typeof file["path"]!=="string"||!validSourcePath(file["path"])||typeof file["content"]!=="string"||file["content"].includes("\0"))throw new MemoryImportRequestError("Invalid Codex Markdown resource. Only memory Markdown and rollout_summaries/*.md are accepted.");const size=Buffer.byteLength(file["content"]);bytes+=size;if(size>IMPORT_LIMITS.fileBytes||bytes>IMPORT_LIMITS.totalBytes||seen.has(file["path"].toLowerCase()))throw new MemoryImportRequestError("Source exceeds limits or contains duplicate paths.");seen.add(file["path"].toLowerCase());return{path:file["path"],content:file["content"]}});if(!files.some(file=>file.path==="MEMORY.md"||file.path==="memory_summary.md"))throw new MemoryImportRequestError("Select the Codex memories folder containing MEMORY.md or memory_summary.md.");return{version:1,source:"codex",files:files.sort((a,b)=>a.path.localeCompare(b.path))}}__name(validateSource,"validateSource");var parser=unified().use(remarkParse);function headingTitle(raw){const atx=raw.match(/^ {0,3}#{1,6}(?:[\t ]+|$)/);if(atx)return raw.slice(atx[0].length).replace(/[\t ]+#+[\t ]*$/,"").trim();return raw.split(/\r\n|[\r\n]/).slice(0,-1).join(" ").trim()}__name(headingTitle,"headingTitle");function scopeFor(content,title,summary){const scopes=[];for(const match of content.matchAll(/(?:^|[\s;(])cwd\s*[=:]\s*(?:`([^`\n]+)`|([^\r\n,;()\s]+))/gim)){if(match[1]!==void 0){scopes.push({value:match[1].trim(),quoted:true,prose:false});continue}const trailing=content.slice(match.index+match[0].length).split(/\r\n|[\r\n]/,1)[0].trim();scopes.push({value:match[2].trim(),quoted:false,prose:/[^\s,;()]/.test(trailing)})}const heading=title.trim();if(/^(?:\/|[A-Za-z]:[\\/])/.test(heading))scopes.push({value:heading.replace(/^`|`$/g,""),quoted:false,prose:false});const strip=__name(value=>value.replace(/[\\/]+$/,"").replace(/[.:!?'"]+$/,""),"strip");const unique=[...new Set(scopes.map(scope=>strip(scope.value)))];if(unique.length===1&&/^(?:\/|[A-Za-z]:[\\/])/.test(unique[0])&&scopes.every(scope=>!scope.prose&&!/[*?{}[\]\p{Cc}]|\bcwd\s*[=:]/u.test(scope.value)&&(scope.quoted||!/\s/.test(scope.value))))return{suggestedScope:"project",sourceProject:unique[0],reason:"Source project hint; explicit target mapping is required."};if(scopes.length)return{suggestedScope:"unassigned",reason:"Ambiguous or unsupported project scope; assign explicitly."};if(summary&&/^(?:user profile|user preferences)$/i.test(title))return{suggestedScope:"user",reason:"Explicit user-level summary section."};return{suggestedScope:"unassigned",reason:"No reliable project scope; assign explicitly."}}__name(scopeFor,"scopeFor");function previewSource(input){const source=validateSource(input);const sections=[];const warnings=[];let headingCount=0;let lineCount=0;let markerCount=0;let expandedBytes=0;const paths=new Set(source.files.map(file=>file.path));const referenced=new Set;for(const file of source.files.filter(f=>!f.path.startsWith("rollout_summaries/"))){for(const match of file.content.matchAll(/rollout_summaries\/[\w.-]+\.md/g))referenced.add(match[0])}for(const ref of referenced)if(!paths.has(ref))warnings.push(`Missing referenced Markdown: ${ref}`);for(const file of source.files){if(file.path.startsWith("rollout_summaries/")&&!referenced.has(file.path)){warnings.push(`Unreferenced supporting resource excluded: ${file.path}`);continue}const atxCandidates=file.content.match(/^ {0,3}#{1,6}(?:[\t ]|$)/gm)?.length??0;if(headingCount+atxCandidates>4*IMPORT_LIMITS.headings)throw new MemoryImportRequestError("Source exceeds the supported heading limit.");for(let i=0;i<file.content.length;i++){const char=file.content[i];if(char==="\n"||char==="\r"&&file.content[i+1]!=="\n")lineCount++;if("*_~[]<>!`&\\".includes(char))markerCount++;if(lineCount>IMPORT_LIMITS.markdownLines||markerCount>IMPORT_LIMITS.inlineMarkers)throw new MemoryImportRequestError("Source exceeds the Markdown complexity limit; split it into smaller source sets before importing.")}const tree=parser.parse(file.content);const headings=tree.children.filter(node=>node.type==="heading").map((node,index,nodes)=>({offset:node.position.start.offset,line:node.position.start.line,depth:node.depth,title:headingTitle(file.content.slice(node.position.start.offset,node.position.end.offset)),preface:file.content.slice(node.position.start.offset,nodes[index+1]?.position.start.offset).trim()}));headingCount+=headings.length;if(headingCount>IMPORT_LIMITS.headings)throw new MemoryImportRequestError("Source exceeds the supported heading limit.");const scopedDepths=headings.filter(heading=>/^(?:`?\/|`?[A-Za-z]:[\\/])/.test(heading.title)||/\bcwd\s*[=:]/i.test(heading.preface)).map(heading=>heading.depth);const minDepth=headings.length?Math.min(...headings.map(h=>h.depth)):1;const depth=Math.max(file.path==="memory_summary.md"?2:minDepth,...scopedDepths);const boundaries=headings.filter(heading=>heading.depth<=depth);if(!boundaries.length||boundaries[0].offset>0)boundaries.unshift({offset:0,line:1,title:file.path,depth:0,preface:""});for(let i=0;i<boundaries.length;i++){const boundary=boundaries[i];const own=file.content.slice(boundary.offset,boundaries[i+1]?.offset).trim();if(!own||/^v\d+$/.test(own)||own.split(/\r\n|[\r\n]/).every(line=>!line.trim()||/^#{1,6}\s/.test(line)))continue;const ancestors=[];for(const heading of headings){if(heading.offset>=boundary.offset)break;while(ancestors.length&&ancestors.at(-1).depth>=heading.depth)ancestors.pop();ancestors.push(heading)}while(ancestors.length&&ancestors.at(-1).depth>=boundary.depth)ancestors.pop();const parts=[...ancestors.map(heading=>heading.preface),own];expandedBytes+=parts.reduce((bytes,part)=>bytes+Buffer.byteLength(part),0)+2*(parts.length-1);if(expandedBytes>IMPORT_LIMITS.totalBytes)throw new MemoryImportRequestError("Source expanded context exceeds 8 MiB; split shared context and project groups before importing.");const content=parts.join("\n\n");let scope=scopeFor(content,boundary.title,file.path==="memory_summary.md");if(scope.suggestedScope==="unassigned"&&!/\bcwd\s*[=:]/i.test(content)){const parent=ancestors.at(-1);if(parent)scope=scopeFor(content,parent.title,file.path==="memory_summary.md")}const references=[...new Set(Array.from(content.matchAll(/rollout_summaries\/[\w.-]+\.md/g),m=>m[0]))];const selectable=Buffer.byteLength(content)<=IMPORT_LIMITS.sectionBytes;if(!selectable)warnings.push(`${file.path}:${boundary.line}: section exceeds ${IMPORT_LIMITS.sectionBytes} bytes; split it before import.`);const id=digest(`${file.path}\0${content}`);if(sections.some(section=>section.id===id))continue;sections.push({id,groupId:digest(`${scope.suggestedScope}\0${scope.sourceProject??""}`),title:boundary.title,path:file.path,line:boundary.line,content,references,...scope,selectable})}}const groups=new Map;for(const section of sections){const group=groups.get(section.groupId)??{id:section.groupId,scope:section.suggestedScope,sourceProject:section.sourceProject,sectionIds:[]};group.sectionIds.push(section.id);groups.set(group.id,group)}return{version:1,kind:"preview",digest:digest(JSON.stringify(source)),groups:[...groups.values()].map(group=>({...group,estimate:estimateMemoryImport(sections.filter(section=>section.selectable&&section.groupId===group.id))})),sections,warnings,estimate:estimateMemoryImport(sections.filter(section=>section.selectable))}}__name(previewSource,"previewSource");async function readLocalSource(directory){const root=await fs.realpath(directory);const files=[];const read=__name(async relative=>{const file=path.join(root,relative);const info=await fs.lstat(file);if(!info.isFile()||info.isSymbolicLink()||info.size>IMPORT_LIMITS.fileBytes)throw new Error("Source must contain regular bounded Markdown files.");const handle=await fs.open(file,constants.O_RDONLY|(constants.O_NOFOLLOW??0)|(constants.O_NONBLOCK??0));try{const opened=await handle.stat();if(!opened.isFile()||opened.size>IMPORT_LIMITS.fileBytes)throw new Error("Source changed while opening.");const buffer=Buffer.alloc(IMPORT_LIMITS.fileBytes+1);let length=0;while(length<buffer.length){const read2=await handle.read(buffer,length,buffer.length-length,null);if(!read2.bytesRead)break;length+=read2.bytesRead}if(length>IMPORT_LIMITS.fileBytes||files.reduce((sum,entry)=>sum+Buffer.byteLength(entry.content),length)>IMPORT_LIMITS.totalBytes)throw new Error("Source exceeds byte limits.");files.push({path:relative,content:buffer.subarray(0,length).toString("utf8")})}finally{await handle.close()}},"read");for(const name of["MEMORY.md","memory_summary.md"]){try{await read(name)}catch(error){if(error.code!=="ENOENT")throw error}}const refs=new Set(files.flatMap(file=>Array.from(file.content.matchAll(/rollout_summaries\/[\w.-]+\.md/g),m=>m[0])));if(refs.size+files.length>IMPORT_LIMITS.files)throw new Error("Too many referenced source files.");if(refs.size){const dir=await fs.lstat(path.join(root,"rollout_summaries")).catch(error=>{if(error.code==="ENOENT")return void 0;throw error});if(dir&&(!dir.isDirectory()||dir.isSymbolicLink()))throw new Error("Supporting resource directory must not be a symlink.");if(dir)for(const ref of refs){try{await read(ref)}catch(error){if(error.code!=="ENOENT")throw error}}}return validateSource({version:1,source:"codex",files})}__name(readLocalSource,"readLocalSource");var writeStdoutLineFlushed=__name(message=>new Promise((resolve,reject)=>process.stdout.write(message.endsWith("\n")?message:`${message}
4
- `,error=>error&&error.code!=="EPIPE"?reject(error):resolve())),"writeStdoutLineFlushed");var memoryCommand={command:"memory",describe:"Preview and import external memories",builder:__name(argv=>argv.command({command:"import codex",describe:"Preview Codex memory; explicitly confirm selected sections to consolidate",builder:__name(args=>args.positional("codex",{type:"string",describe:"External memory source",choices:["codex"]}).option("source",{type:"string",describe:"Codex memories directory"}).option("dry-run",{type:"boolean",default:false,describe:"Offline preview; no model or memory writes"}).option("json",{type:"boolean",default:false}).option("apply",{type:"boolean",default:false,describe:"Authorize model consolidation of an explicit selection"}).option("selection",{type:"string",describe:"JSON array of {id, scope: project|user}"}).option("idempotency-key",{type:"string",describe:"Stable caller key for this selection"}).option("retry",{type:"boolean",default:false,describe:"Retry unfinished items of this submitted batch"}).strict(),"builder"),handler:__name(async args=>{ignoreBrokenPipe();if(args["apply"]&&args["dry-run"])throw new Error("--apply and --dry-run cannot be combined.");if(args["apply"]&&(args["bare"]||args["safeMode"]||args["safe-mode"]))throw new Error("Confirmed memory import is unavailable in bare or safe mode. Offline preview remains available.");if(args["source"]!==void 0&&typeof args["source"]!=="string")throw new Error("Provide a single --source directory.");const directory=typeof args["source"]==="string"?args["source"]:path2.join(process.env["CODEX_HOME"]?.trim()||path2.join(homedir(),".codex"),"memories");const source=await readLocalSource(directory);const preview=previewSource(source);if(!args["apply"]){if(args["json"])await writeStdoutLineFlushed(JSON.stringify(preview));else{const lines=[`Preview only: ${preview.sections.length} source sections. No memory was written.`,...preview.groups.map(group=>`[${group.sectionIds.length} sections] ${group.scope}: ${JSON.stringify(group.sourceProject??"No project hint")}`),`Estimated usage (all selectable sections): ${preview.estimate.modelCalls} model calls, ${preview.estimate.sourceTokens} source tokens, up to ${preview.estimate.maxOutputTokens} output tokens; ${preview.estimate.reservedTokens} reserved token units including context.`,`Task limits: ${preview.estimate.limits.maxCalls} calls / ${preview.estimate.limits.maxReservedTokens} reserved token units. Estimates are not billing quotes; explicit selection and existing context affect usage.`];if(preview.estimate.exceedsBudget)lines.push("Warning: the full selection may exceed the task budget; select fewer sections before confirming.");for(const warning of preview.warnings)lines.push(`Warning: ${JSON.stringify(warning)}`);lines.push("Use --json for section IDs, details and source text. To import, provide --apply --selection <JSON file> --idempotency-key <key>. Unassigned sections require an explicit scope.");await writeStdoutLineFlushed(lines.join("\n"))}return}if(typeof args["selection"]!=="string"||typeof args["idempotency-key"]!=="string")throw new Error("--apply requires --selection and --idempotency-key.");const stat=await fs2.lstat(args["selection"]);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>512*1024)throw new Error("Selection must be a bounded regular JSON file.");const selection=JSON.parse(await fs2.readFile(args["selection"],"utf8"));const{createLocalMemoryImportService}=await import("./local-TT4FLCTR.js");const service=await createLocalMemoryImportService();let task=await service.submit(source,selection,args["idempotency-key"]);if(args["retry"])task=await service.retry(task.id);task=await service.idle(task.id);await writeStdoutLineFlushed(JSON.stringify(task));if(task.status!=="completed"||task.items.some(item=>item.status==="conflict"))process.exitCode=1},"handler")}).demandCommand(1).version(false),"builder"),handler:__name(()=>{},"handler")};export{MEMORY_IMPORT_BUDGET,packMemoryImportSections,MemoryImportRequestError,digest,previewSource,memoryCommand};
4
+ `,error=>error&&error.code!=="EPIPE"?reject(error):resolve())),"writeStdoutLineFlushed");var memoryCommand={command:"memory",describe:"Preview and import external memories",builder:__name(argv=>argv.command({command:"import codex",describe:"Preview Codex memory; explicitly confirm selected sections to consolidate",builder:__name(args=>args.positional("codex",{type:"string",describe:"External memory source",choices:["codex"]}).option("source",{type:"string",describe:"Codex memories directory"}).option("dry-run",{type:"boolean",default:false,describe:"Offline preview; no model or memory writes"}).option("json",{type:"boolean",default:false}).option("apply",{type:"boolean",default:false,describe:"Authorize model consolidation of an explicit selection"}).option("selection",{type:"string",describe:"JSON array of {id, scope: project|user}"}).option("idempotency-key",{type:"string",describe:"Stable caller key for this selection"}).option("retry",{type:"boolean",default:false,describe:"Retry unfinished items of this submitted batch"}).strict(),"builder"),handler:__name(async args=>{ignoreBrokenPipe();if(args["apply"]&&args["dry-run"])throw new Error("--apply and --dry-run cannot be combined.");if(args["apply"]&&(args["bare"]||args["safeMode"]||args["safe-mode"]))throw new Error("Confirmed memory import is unavailable in bare or safe mode. Offline preview remains available.");if(args["source"]!==void 0&&typeof args["source"]!=="string")throw new Error("Provide a single --source directory.");const directory=typeof args["source"]==="string"?args["source"]:path2.join(process.env["CODEX_HOME"]?.trim()||path2.join(homedir(),".codex"),"memories");const source=await readLocalSource(directory);const preview=previewSource(source);if(!args["apply"]){if(args["json"])await writeStdoutLineFlushed(JSON.stringify(preview));else{const lines=[`Preview only: ${preview.sections.length} source sections. No memory was written.`,...preview.groups.map(group=>`[${group.sectionIds.length} sections] ${group.scope}: ${JSON.stringify(group.sourceProject??"No project hint")}`),`Estimated usage (all selectable sections): ${preview.estimate.modelCalls} model calls, ${preview.estimate.sourceTokens} source tokens, up to ${preview.estimate.maxOutputTokens} output tokens; ${preview.estimate.reservedTokens} reserved token units including context.`,`Task limits: ${preview.estimate.limits.maxCalls} calls / ${preview.estimate.limits.maxReservedTokens} reserved token units. Estimates are not billing quotes; explicit selection and existing context affect usage.`];if(preview.estimate.exceedsBudget)lines.push("Warning: the full selection may exceed the task budget; select fewer sections before confirming.");for(const warning of preview.warnings)lines.push(`Warning: ${JSON.stringify(warning)}`);lines.push("Use --json for section IDs, details and source text. To import, provide --apply --selection <JSON file> --idempotency-key <key>. Unassigned sections require an explicit scope.");await writeStdoutLineFlushed(lines.join("\n"))}return}if(typeof args["selection"]!=="string"||typeof args["idempotency-key"]!=="string")throw new Error("--apply requires --selection and --idempotency-key.");const stat=await fs2.lstat(args["selection"]);if(!stat.isFile()||stat.isSymbolicLink()||stat.size>512*1024)throw new Error("Selection must be a bounded regular JSON file.");const selection=JSON.parse(await fs2.readFile(args["selection"],"utf8"));const{createLocalMemoryImportService}=await import("./local-ZTSBSKWV.js");const service=await createLocalMemoryImportService();let task=await service.submit(source,selection,args["idempotency-key"]);if(args["retry"])task=await service.retry(task.id);task=await service.idle(task.id);await writeStdoutLineFlushed(JSON.stringify(task));if(task.status!=="completed"||task.items.some(item=>item.status==="conflict"))process.exitCode=1},"handler")}).demandCommand(1).version(false),"builder"),handler:__name(()=>{},"handler")};export{MEMORY_IMPORT_BUDGET,packMemoryImportSections,MemoryImportRequestError,digest,previewSource,memoryCommand};
5
5
  /**
6
6
  * @license
7
7
  * Copyright 2026 Qwen Team
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{publicProviderBaseUrl}from"./chunk-GT4TCQ3R.js";import{getWritableScopes}from"./chunk-Q5RRVBTY.js";import{isImageGenerationCapable,tryResolveModelProtocol}from"./chunk-ET2Z7ZGF.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{createHash}from"node:crypto";function modelKey(scope,provider,model,authType){return createHash("sha256").update(JSON.stringify([scope,provider,model.id,model.baseUrl??"",authType])).digest("hex")}__name(modelKey,"modelKey");function modelEntries(loaded){const seenProviders=new Set;return["System",...getWritableScopes(loaded),"SystemDefaults"].flatMap(scope=>{const providers=loaded.forScope(scope).settings.modelProviders??{};return Object.entries(providers).flatMap(([provider,models])=>{if(seenProviders.has(provider))return[];seenProviders.add(provider);if(!Array.isArray(models))return[];return models.flatMap((model,index)=>{if(!model||typeof model!=="object"||typeof model.id!=="string"||!model.id||model.baseUrl!==void 0&&typeof model.baseUrl!=="string")return[];const authType=tryResolveModelProtocol(provider,model,loaded.merged.providerProtocol);if(!authType||authType==="qwen-oauth")return[];return[{scope,provider,authType,model,index,key:modelKey(scope,provider,model,authType)}]})})})}__name(modelEntries,"modelEntries");function findModelConfiguration(loaded,key){const matches=modelEntries(loaded).filter(entry=>entry.key===key);return matches.length===1&&getWritableScopes(loaded).includes(matches[0].scope)?matches[0]:void 0}__name(findModelConfiguration,"findModelConfiguration");function findModelConfigurationForDeletion(loaded,target){const candidates=modelEntries(loaded).filter(entry=>entry.authType===target.authType&&entry.model.id===target.modelId);const exact=candidates.filter(entry=>(entry.model.baseUrl??void 0)===target.baseUrl);const matches=target.baseUrl!==void 0&&exact.length?exact:candidates;if(matches.length===0)return void 0;return matches.length===1&&getWritableScopes(loaded).includes(matches[0].scope)?matches[0]:"ambiguous"}__name(findModelConfigurationForDeletion,"findModelConfigurationForDeletion");function getModelConfigurationKey(loaded,authType,modelId,baseUrl){const matches=modelEntries(loaded).filter(entry=>entry.authType===authType&&entry.model.id===modelId&&(entry.model.baseUrl??"")===(baseUrl??""));return matches.length===1&&getWritableScopes(loaded).includes(matches[0].scope)?matches[0].key:void 0}__name(getModelConfigurationKey,"getModelConfigurationKey");function isConversationModelConfiguration(model){return!model.imageOnly&&!model.voiceOnly&&!model.fastOnly&&!model.visionOnly&&!model.realtimeOnly}__name(isConversationModelConfiguration,"isConversationModelConfiguration");function isImageModelConfiguration(model){if(!isImageGenerationCapable(model)||model.fastOnly||model.voiceOnly||model.realtimeOnly||!model.baseUrl||typeof model.envKey!=="string"||!model.envKey.trim())return false;try{const url=new URL(model.baseUrl);return url.protocol==="https:"&&!url.username&&!url.password&&!url.search&&!url.hash}catch{return false}}__name(isImageModelConfiguration,"isImageModelConfiguration");function listModelConfigurations(loaded){const entries=modelEntries(loaded);const routeKey=__name(entry=>JSON.stringify([entry.authType,entry.model.id,entry.model.baseUrl??""]),"routeKey");const counts=new Map;for(const entry of entries){const route=routeKey(entry);counts.set(route,(counts.get(route)??0)+1)}const writableScopes=getWritableScopes(loaded);return entries.filter(entry=>writableScopes.includes(entry.scope)).map(entry=>{const{model,authType,key}=entry;const uniqueRoute=counts.get(routeKey(entry))===1;let imageModel;let advisorModel;if(uniqueRoute&&isConversationModelConfiguration(model)){if(!model.baseUrl)advisorModel=`${authType}:${model.id}\0`;else{try{const url=new URL(model.baseUrl);if(["https:","http:"].includes(url.protocol)&&!url.username&&!url.password&&!url.search&&!url.hash)advisorModel=`${authType}:${model.id}\0${model.baseUrl}`}catch{}}}if(uniqueRoute&&isImageModelConfiguration(model)){imageModel=`${authType}:${model.id}\0${model.baseUrl}`}return{key,authType,modelId:model.id,name:model.name,baseUrl:model.baseUrl?publicProviderBaseUrl(model.baseUrl):void 0,envKey:typeof model.envKey==="string"?model.envKey:void 0,contextWindowSize:typeof model.generationConfig?.contextWindowSize==="number"&&Number.isInteger(model.generationConfig.contextWindowSize)&&model.generationConfig.contextWindowSize>0?model.generationConfig.contextWindowSize:void 0,canEditContextWindow:uniqueRoute,purpose:model.imageOnly===true?"image":model.voiceOnly===true?"voice":model.realtimeOnly===true?"realtime":"chat",...imageModel?{imageModel}:{},...advisorModel?{advisorModel}:{}}})}__name(listModelConfigurations,"listModelConfigurations");function updateModelContextWindow(loaded,key,contextWindowSize,assertGenerationOpen){const match=findModelConfiguration(loaded,key);if(!match)return void 0;if(getModelConfigurationKey(loaded,match.authType,match.model.id,match.model.baseUrl)!==key)return void 0;const{scope,provider,index}=match;const providers=loaded.forScope(scope).originalSettings.modelProviders??{};const model=providers[provider][index];const generationConfig={...model.generationConfig};if(contextWindowSize===null)delete generationConfig.contextWindowSize;else generationConfig.contextWindowSize=contextWindowSize;const updated={...model,generationConfig};if(Object.keys(generationConfig).length===0)delete updated.generationConfig;loaded.setValue(scope,"modelProviders",{...providers,[provider]:providers[provider].map((entry,i)=>i===index?updated:entry)},assertGenerationOpen,{throwOnWriteFailure:true});return scope==="Workspace"?"workspace":"user"}__name(updateModelContextWindow,"updateModelContextWindow");export{findModelConfiguration,findModelConfigurationForDeletion,getModelConfigurationKey,isConversationModelConfiguration,isImageModelConfiguration,listModelConfigurations,updateModelContextWindow};
3
+ import{publicProviderBaseUrl}from"./chunk-GT4TCQ3R.js";import{getWritableScopes}from"./chunk-EZPM4DLR.js";import{isImageGenerationCapable,tryResolveModelProtocol}from"./chunk-ET2Z7ZGF.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{createHash}from"node:crypto";function modelKey(scope,provider,model,authType){return createHash("sha256").update(JSON.stringify([scope,provider,model.id,model.baseUrl??"",authType])).digest("hex")}__name(modelKey,"modelKey");function modelEntries(loaded){const seenProviders=new Set;return["System",...getWritableScopes(loaded),"SystemDefaults"].flatMap(scope=>{const providers=loaded.forScope(scope).settings.modelProviders??{};return Object.entries(providers).flatMap(([provider,models])=>{if(seenProviders.has(provider))return[];seenProviders.add(provider);if(!Array.isArray(models))return[];return models.flatMap((model,index)=>{if(!model||typeof model!=="object"||typeof model.id!=="string"||!model.id||model.baseUrl!==void 0&&typeof model.baseUrl!=="string")return[];const authType=tryResolveModelProtocol(provider,model,loaded.merged.providerProtocol);if(!authType||authType==="qwen-oauth")return[];return[{scope,provider,authType,model,index,key:modelKey(scope,provider,model,authType)}]})})})}__name(modelEntries,"modelEntries");function findModelConfiguration(loaded,key){const matches=modelEntries(loaded).filter(entry=>entry.key===key);return matches.length===1&&getWritableScopes(loaded).includes(matches[0].scope)?matches[0]:void 0}__name(findModelConfiguration,"findModelConfiguration");function findModelConfigurationForDeletion(loaded,target){const candidates=modelEntries(loaded).filter(entry=>entry.authType===target.authType&&entry.model.id===target.modelId);const exact=candidates.filter(entry=>(entry.model.baseUrl??void 0)===target.baseUrl);const matches=target.baseUrl!==void 0&&exact.length?exact:candidates;if(matches.length===0)return void 0;return matches.length===1&&getWritableScopes(loaded).includes(matches[0].scope)?matches[0]:"ambiguous"}__name(findModelConfigurationForDeletion,"findModelConfigurationForDeletion");function getModelConfigurationKey(loaded,authType,modelId,baseUrl){const matches=modelEntries(loaded).filter(entry=>entry.authType===authType&&entry.model.id===modelId&&(entry.model.baseUrl??"")===(baseUrl??""));return matches.length===1&&getWritableScopes(loaded).includes(matches[0].scope)?matches[0].key:void 0}__name(getModelConfigurationKey,"getModelConfigurationKey");function isConversationModelConfiguration(model){return!model.imageOnly&&!model.voiceOnly&&!model.fastOnly&&!model.visionOnly&&!model.realtimeOnly}__name(isConversationModelConfiguration,"isConversationModelConfiguration");function isImageModelConfiguration(model){if(!isImageGenerationCapable(model)||model.fastOnly||model.voiceOnly||model.realtimeOnly||!model.baseUrl||typeof model.envKey!=="string"||!model.envKey.trim())return false;try{const url=new URL(model.baseUrl);return url.protocol==="https:"&&!url.username&&!url.password&&!url.search&&!url.hash}catch{return false}}__name(isImageModelConfiguration,"isImageModelConfiguration");function listModelConfigurations(loaded){const entries=modelEntries(loaded);const routeKey=__name(entry=>JSON.stringify([entry.authType,entry.model.id,entry.model.baseUrl??""]),"routeKey");const counts=new Map;for(const entry of entries){const route=routeKey(entry);counts.set(route,(counts.get(route)??0)+1)}const writableScopes=getWritableScopes(loaded);return entries.filter(entry=>writableScopes.includes(entry.scope)).map(entry=>{const{model,authType,key}=entry;const uniqueRoute=counts.get(routeKey(entry))===1;let imageModel;let advisorModel;if(uniqueRoute&&isConversationModelConfiguration(model)){if(!model.baseUrl)advisorModel=`${authType}:${model.id}\0`;else{try{const url=new URL(model.baseUrl);if(["https:","http:"].includes(url.protocol)&&!url.username&&!url.password&&!url.search&&!url.hash)advisorModel=`${authType}:${model.id}\0${model.baseUrl}`}catch{}}}if(uniqueRoute&&isImageModelConfiguration(model)){imageModel=`${authType}:${model.id}\0${model.baseUrl}`}return{key,authType,modelId:model.id,name:model.name,baseUrl:model.baseUrl?publicProviderBaseUrl(model.baseUrl):void 0,envKey:typeof model.envKey==="string"?model.envKey:void 0,contextWindowSize:typeof model.generationConfig?.contextWindowSize==="number"&&Number.isInteger(model.generationConfig.contextWindowSize)&&model.generationConfig.contextWindowSize>0?model.generationConfig.contextWindowSize:void 0,canEditContextWindow:uniqueRoute,purpose:model.imageOnly===true?"image":model.voiceOnly===true?"voice":model.realtimeOnly===true?"realtime":"chat",...imageModel?{imageModel}:{},...advisorModel?{advisorModel}:{}}})}__name(listModelConfigurations,"listModelConfigurations");function updateModelContextWindow(loaded,key,contextWindowSize,assertGenerationOpen){const match=findModelConfiguration(loaded,key);if(!match)return void 0;if(getModelConfigurationKey(loaded,match.authType,match.model.id,match.model.baseUrl)!==key)return void 0;const{scope,provider,index}=match;const providers=loaded.forScope(scope).originalSettings.modelProviders??{};const model=providers[provider][index];const generationConfig={...model.generationConfig};if(contextWindowSize===null)delete generationConfig.contextWindowSize;else generationConfig.contextWindowSize=contextWindowSize;const updated={...model,generationConfig};if(Object.keys(generationConfig).length===0)delete updated.generationConfig;loaded.setValue(scope,"modelProviders",{...providers,[provider]:providers[provider].map((entry,i)=>i===index?updated:entry)},assertGenerationOpen,{throwOnWriteFailure:true});return scope==="Workspace"?"workspace":"user"}__name(updateModelContextWindow,"updateModelContextWindow");export{findModelConfiguration,findModelConfigurationForDeletion,getModelConfigurationKey,isConversationModelConfiguration,isImageModelConfiguration,listModelConfigurations,updateModelContextWindow};
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{MAX_AGENT_MESSAGE_DISPLAY_TEXT_CHARS,MAX_AGENT_MESSAGE_STEPS,SESSION_AGENTS_SCHEMA_VERSION}from"./chunk-CK3OKTTL.js";import{STORE_DIR_MODE,STORE_FILE_OPTIONS,getAgentsDir,withAgentStoreTransaction}from"./chunk-T3CQ72HC.js";import{atomicWriteJSON}from"./chunk-BMHYEQTI.js";import{isNodeError}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import*as fs from"node:fs/promises";import*as path from"node:path";var SESSIONS_DIRNAME="sessions";var MAX_TERMINAL_SESSION_AGENT_RUNS=50;var SESSION_ID_PATTERN=/^[0-9a-fA-F-]{32,36}$/;var MAX_BINDING_SCAN_FILES=5e3;var LIVE_RUN_STATUSES=new Set(["queued","running","awaiting_approval"]);var TERMINAL_RUN_STATUSES=new Set(["completed","failed","cancelled","offline"]);var EXECUTING_RUN_STATUSES=new Set(["running","awaiting_approval"]);function isValidSessionAgentsSessionId(value){return typeof value==="string"&&SESSION_ID_PATTERN.test(value)}__name(isValidSessionAgentsSessionId,"isValidSessionAgentsSessionId");function isTerminalSessionAgentRunStatus(status){return TERMINAL_RUN_STATUSES.has(status)}__name(isTerminalSessionAgentRunStatus,"isTerminalSessionAgentRunStatus");function getSessionAgentsDir(projectRoot){return path.join(getAgentsDir(projectRoot),SESSIONS_DIRNAME)}__name(getSessionAgentsDir,"getSessionAgentsDir");function getSessionAgentsFilePath(projectRoot,sessionId){if(!isValidSessionAgentsSessionId(sessionId)){throw new Error(`Invalid chat session id: ${JSON.stringify(sessionId)}`)}return path.join(getSessionAgentsDir(projectRoot),`${sessionId}.json`)}__name(getSessionAgentsFilePath,"getSessionAgentsFilePath");function emptySessionAgentsFile(sessionId){return{schemaVersion:SESSION_AGENTS_SCHEMA_VERSION,sessionId,bindings:{},runs:[]}}__name(emptySessionAgentsFile,"emptySessionAgentsFile");function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isRecord,"isRecord");function isOptionalString(value){return value===void 0||typeof value==="string"}__name(isOptionalString,"isOptionalString");function isOptionalFiniteNumber(value){return value===void 0||typeof value==="number"&&Number.isFinite(value)}__name(isOptionalFiniteNumber,"isOptionalFiniteNumber");var RUN_STATUSES=new Set([...LIVE_RUN_STATUSES,...TERMINAL_RUN_STATUSES]);function isValidBinding(value){return isRecord(value)&&typeof value["agentId"]==="string"&&isOptionalString(value["nativeSessionId"])&&isOptionalString(value["runtimeId"])&&(value["program"]===void 0||value["program"]==="qwen"||value["program"]==="claude"||value["program"]==="codex")&&isOptionalString(value["readThroughRecordId"])&&(value["remotePersona"]===void 0||isRecord(value["remotePersona"])&&typeof value["remotePersona"]["name"]==="string"&&isOptionalString(value["remotePersona"]["instructions"])&&isOptionalString(value["remotePersona"]["model"]))}__name(isValidBinding,"isValidBinding");function isValidLease(value){return value===void 0||isRecord(value)&&typeof value["hostId"]==="string"&&typeof value["leaseId"]==="string"&&typeof value["attempt"]==="number"&&typeof value["expiresAt"]==="number"&&isOptionalFiniteNumber(value["lastSequence"])}__name(isValidLease,"isValidLease");function isValidRun(value){return isRecord(value)&&typeof value["id"]==="string"&&typeof value["agentId"]==="string"&&typeof value["status"]==="string"&&RUN_STATUSES.has(value["status"])&&Array.isArray(value["triggerRecordIds"])&&value["triggerRecordIds"].every(id=>typeof id==="string")&&typeof value["chainDepth"]==="number"&&typeof value["createdAt"]==="number"&&typeof value["attempts"]==="number"&&isOptionalFiniteNumber(value["startedAt"])&&isOptionalFiniteNumber(value["endedAt"])&&isOptionalString(value["error"])&&isOptionalFiniteNumber(value["totalTokens"])&&isOptionalString(value["retryOf"])&&isOptionalString(value["squadId"])&&(value["recorded"]===void 0||typeof value["recorded"]==="boolean")&&isValidLease(value["lease"])}__name(isValidRun,"isValidRun");function isValidEngagement(value){return isRecord(value)&&typeof value["leaderAgentId"]==="string"&&typeof value["startedByRecordId"]==="string"&&Array.isArray(value["outstandingRunIds"])&&value["outstandingRunIds"].every(id=>typeof id==="string")&&(value["pendingWakeRunIds"]===void 0||Array.isArray(value["pendingWakeRunIds"])&&value["pendingWakeRunIds"].every(id=>typeof id==="string"))&&typeof value["active"]==="boolean"}__name(isValidEngagement,"isValidEngagement");function isValidEngagements(value){return value===void 0||isRecord(value)&&Object.values(value).every(isValidEngagement)}__name(isValidEngagements,"isValidEngagements");function parseSessionAgentsFile(value,sessionId,filePath="<memory>"){if(!isRecord(value)){throw new Error(`Malformed session agents file ${filePath}.`)}if(value["schemaVersion"]!==SESSION_AGENTS_SCHEMA_VERSION){throw new Error(`Unsupported session agents schema version ${JSON.stringify(value["schemaVersion"])} in ${filePath}; this build supports version ${SESSION_AGENTS_SCHEMA_VERSION}.`)}if(value["sessionId"]!==sessionId){throw new Error(`Session agents file ${filePath} names session ${JSON.stringify(value["sessionId"])}, not ${sessionId}.`)}const bindings=value["bindings"];const runs=value["runs"];if(!isRecord(bindings)||!Object.entries(bindings).every(([agentId,binding])=>isValidBinding(binding)&&binding.agentId===agentId)||!Array.isArray(runs)||!runs.every(isValidRun)||!isValidEngagements(value["squads"])){throw new Error(`Malformed session agents file ${filePath}.`)}const squads=value["squads"];return{schemaVersion:SESSION_AGENTS_SCHEMA_VERSION,sessionId,bindings,runs,...typeof value["chainTokens"]==="number"&&Number.isFinite(value["chainTokens"])&&value["chainTokens"]>0?{chainTokens:value["chainTokens"]}:{},...squads&&Object.keys(squads).length>0?{squads}:{}}}__name(parseSessionAgentsFile,"parseSessionAgentsFile");function trimTerminalRuns(runs,max=MAX_TERMINAL_SESSION_AGENT_RUNS){const terminal=runs.filter(run=>isTerminalSessionAgentRunStatus(run.status)&&run.recorded!==false);if(terminal.length<=max)return[...runs];const keep=new Set([...terminal].sort((a,b)=>(b.endedAt??b.createdAt)-(a.endedAt??a.createdAt)).slice(0,Math.max(0,max)).map(run=>run.id));return runs.filter(run=>!isTerminalSessionAgentRunStatus(run.status)||run.recorded===false||keep.has(run.id))}__name(trimTerminalRuns,"trimTerminalRuns");async function readFileUnlocked(projectRoot,sessionId){const filePath=getSessionAgentsFilePath(projectRoot,sessionId);let raw;try{raw=await fs.readFile(filePath,"utf-8")}catch(error){if(isNodeError(error)&&error.code==="ENOENT")return void 0;throw error}let parsed;try{parsed=JSON.parse(raw)}catch{throw new Error(`Malformed JSON in ${filePath} \u2014 fix or delete the file; refusing to treat it as empty.`)}return parseSessionAgentsFile(parsed,sessionId,filePath)}__name(readFileUnlocked,"readFileUnlocked");async function readSessionAgents(projectRoot,sessionId){return await readFileUnlocked(projectRoot,sessionId)??emptySessionAgentsFile(sessionId)}__name(readSessionAgents,"readSessionAgents");async function updateSessionAgents(projectRoot,sessionId,mutate){const filePath=getSessionAgentsFilePath(projectRoot,sessionId);return withAgentStoreTransaction(projectRoot,async()=>{const current=await readFileUnlocked(projectRoot,sessionId)??emptySessionAgentsFile(sessionId);const mutated=mutate(current)??current;const next={schemaVersion:SESSION_AGENTS_SCHEMA_VERSION,sessionId,bindings:mutated.bindings,runs:trimTerminalRuns(mutated.runs),...mutated.chainTokens?{chainTokens:mutated.chainTokens}:{},...mutated.squads&&Object.keys(mutated.squads).length>0?{squads:mutated.squads}:{}};parseSessionAgentsFile(next,sessionId,filePath);await fs.mkdir(getSessionAgentsDir(projectRoot),{recursive:true,mode:STORE_DIR_MODE});await atomicWriteJSON(filePath,next,STORE_FILE_OPTIONS);return next})}__name(updateSessionAgents,"updateSessionAgents");async function writeSessionAgents(projectRoot,file){return updateSessionAgents(projectRoot,file.sessionId,()=>({...file,bindings:structuredClone(file.bindings),runs:structuredClone(file.runs),...file.chainTokens?{chainTokens:file.chainTokens}:{},...file.squads?{squads:structuredClone(file.squads)}:{}}))}__name(writeSessionAgents,"writeSessionAgents");async function listSessionAgentsSessionIds(projectRoot){let names;try{names=await fs.readdir(getSessionAgentsDir(projectRoot))}catch(error){if(isNodeError(error)&&error.code==="ENOENT")return[];throw error}return names.filter(name=>name.endsWith(".json")).map(name=>name.slice(0,-".json".length)).filter(isValidSessionAgentsSessionId)}__name(listSessionAgentsSessionIds,"listSessionAgentsSessionIds");async function findSessionAgentBinding(projectRoot,nativeSessionId,agentId){if(!nativeSessionId||!agentId)return void 0;const ids=(await listSessionAgentsSessionIds(projectRoot)).slice(0,MAX_BINDING_SCAN_FILES);for(const chatSessionId of ids){let file;try{file=await readFileUnlocked(projectRoot,chatSessionId)}catch{continue}if(!file)continue;const binding=file.bindings[agentId];if(binding?.nativeSessionId!==nativeSessionId)continue;const run=file.runs.find(candidate=>candidate.agentId===agentId&&EXECUTING_RUN_STATUSES.has(candidate.status)&&candidate.lease===void 0);if(!run)continue;return{chatSessionId,agentId,runId:run.id,status:run.status,...binding.remotePersona?{remotePersona:{...binding.remotePersona}}:{}}}return void 0}__name(findSessionAgentBinding,"findSessionAgentBinding");function canReuseNativeSession(binding,runtimeId,program){return(binding.runtimeId===void 0||binding.runtimeId===runtimeId)&&(binding.program===void 0||binding.program===program)}__name(canReuseNativeSession,"canReuseNativeSession");init_esbuild_shims();var MAX_EXTERNAL_RECORD_KEY_LENGTH=256;var MAX_EXTERNAL_RECORD_TEXT_LENGTH=65536;var MAX_EXTERNAL_RECORD_DISPLAY_TEXT_LENGTH=MAX_AGENT_MESSAGE_DISPLAY_TEXT_CHARS;var MAX_EXTERNAL_RECORD_STEPS=MAX_AGENT_MESSAGE_STEPS;var MAX_EXTERNAL_RECORD_MENTION_IDS=32;var MAX_EXTERNAL_RECORD_ID_LENGTH=256;var MAX_EXTERNAL_RECORD_STEP_TITLE_LENGTH=1024;var STEP_STATUSES=new Set(["running","completed","failed"]);var TERMINAL_STATUSES=new Set(["completed","failed","cancelled","offline"]);function isObject(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isObject,"isObject");function isBoundedString(value,maxLength){return typeof value==="string"&&value.length<=maxLength}__name(isBoundedString,"isBoundedString");function isIdList(value){return Array.isArray(value)&&value.length<=MAX_EXTERNAL_RECORD_MENTION_IDS&&value.every(id=>isBoundedString(id,MAX_EXTERNAL_RECORD_ID_LENGTH))}__name(isIdList,"isIdList");function isSteps(value){return Array.isArray(value)&&value.length<=MAX_EXTERNAL_RECORD_STEPS&&value.every(step=>isObject(step)&&isBoundedString(step["id"],MAX_EXTERNAL_RECORD_ID_LENGTH)&&typeof step["title"]==="string"&&step["title"].length<=MAX_EXTERNAL_RECORD_STEP_TITLE_LENGTH&&typeof step["status"]==="string"&&STEP_STATUSES.has(step["status"]))}__name(isSteps,"isSteps");function isAuthor(value){return isObject(value)&&typeof value["agentId"]==="string"&&value["agentId"].length>0&&typeof value["name"]==="string"&&value["name"].length>0}__name(isAuthor,"isAuthor");function parseSessionExternalRecordParams(params){const{kind,recordKey,modelText,payload}=params;if(kind!=="agent_mention"&&kind!=="agent_message"){return"Invalid external record kind"}if(typeof recordKey!=="string"||recordKey.length===0||recordKey.length>MAX_EXTERNAL_RECORD_KEY_LENGTH){return"Invalid or missing external record recordKey"}if(typeof modelText!=="string"||modelText.length===0||modelText.length>MAX_EXTERNAL_RECORD_TEXT_LENGTH){return"Invalid or missing external record modelText"}if(!isObject(payload)||typeof payload["displayText"]!=="string"||payload["displayText"].length>(kind==="agent_message"?MAX_EXTERNAL_RECORD_DISPLAY_TEXT_LENGTH:MAX_EXTERNAL_RECORD_TEXT_LENGTH)){return"Invalid or missing external record payload.displayText"}if(kind==="agent_message"){if(!isAuthor(payload["author"])){return"Invalid agent_message payload.author"}if(typeof payload["runId"]!=="string"||payload["runId"].length===0){return"Invalid agent_message payload.runId"}if(typeof payload["status"]!=="string"||!TERMINAL_STATUSES.has(payload["status"])){return"Invalid agent_message payload.status"}if(payload["steps"]!==void 0&&!isSteps(payload["steps"])){return"Invalid or oversized agent_message payload.steps"}return{kind,recordKey,modelText,payload}}if(!isIdList(payload["mentionedAgentIds"])){return"Invalid or oversized agent_mention payload.mentionedAgentIds"}if(payload["mentionedSquadIds"]!==void 0&&!isIdList(payload["mentionedSquadIds"])){return"Invalid or oversized agent_mention payload.mentionedSquadIds"}if(payload["author"]!==void 0&&!isAuthor(payload["author"])){return"Invalid agent_mention payload.author"}return{kind,recordKey,modelText,payload}}__name(parseSessionExternalRecordParams,"parseSessionExternalRecordParams");export{isValidSessionAgentsSessionId,isTerminalSessionAgentRunStatus,trimTerminalRuns,readSessionAgents,updateSessionAgents,writeSessionAgents,listSessionAgentsSessionIds,findSessionAgentBinding,canReuseNativeSession,MAX_EXTERNAL_RECORD_TEXT_LENGTH,MAX_EXTERNAL_RECORD_MENTION_IDS,MAX_EXTERNAL_RECORD_ID_LENGTH,MAX_EXTERNAL_RECORD_STEP_TITLE_LENGTH,parseSessionExternalRecordParams};
3
+ import{MAX_AGENT_MESSAGE_DISPLAY_TEXT_CHARS,MAX_AGENT_MESSAGE_STEPS,SESSION_AGENTS_SCHEMA_VERSION}from"./chunk-G2LTZU67.js";import{STORE_DIR_MODE,STORE_FILE_OPTIONS,getAgentsDir,withAgentStoreTransaction}from"./chunk-7XQ5D34E.js";import{atomicWriteJSON}from"./chunk-BMHYEQTI.js";import{isNodeError}from"./chunk-XYB7GC5U.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import*as fs from"node:fs/promises";import*as path from"node:path";var SESSIONS_DIRNAME="sessions";var MAX_TERMINAL_SESSION_AGENT_RUNS=50;var SESSION_ID_PATTERN=/^[0-9a-fA-F-]{32,36}$/;var MAX_BINDING_SCAN_FILES=5e3;var LIVE_RUN_STATUSES=new Set(["queued","running","awaiting_approval"]);var TERMINAL_RUN_STATUSES=new Set(["completed","failed","cancelled","offline"]);var EXECUTING_RUN_STATUSES=new Set(["running","awaiting_approval"]);function isValidSessionAgentsSessionId(value){return typeof value==="string"&&SESSION_ID_PATTERN.test(value)}__name(isValidSessionAgentsSessionId,"isValidSessionAgentsSessionId");function isTerminalSessionAgentRunStatus(status){return TERMINAL_RUN_STATUSES.has(status)}__name(isTerminalSessionAgentRunStatus,"isTerminalSessionAgentRunStatus");function getSessionAgentsDir(projectRoot){return path.join(getAgentsDir(projectRoot),SESSIONS_DIRNAME)}__name(getSessionAgentsDir,"getSessionAgentsDir");function getSessionAgentsFilePath(projectRoot,sessionId){if(!isValidSessionAgentsSessionId(sessionId)){throw new Error(`Invalid chat session id: ${JSON.stringify(sessionId)}`)}return path.join(getSessionAgentsDir(projectRoot),`${sessionId}.json`)}__name(getSessionAgentsFilePath,"getSessionAgentsFilePath");function emptySessionAgentsFile(sessionId){return{schemaVersion:SESSION_AGENTS_SCHEMA_VERSION,sessionId,bindings:{},runs:[]}}__name(emptySessionAgentsFile,"emptySessionAgentsFile");function isRecord(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isRecord,"isRecord");function isOptionalString(value){return value===void 0||typeof value==="string"}__name(isOptionalString,"isOptionalString");function isOptionalFiniteNumber(value){return value===void 0||typeof value==="number"&&Number.isFinite(value)}__name(isOptionalFiniteNumber,"isOptionalFiniteNumber");var RUN_STATUSES=new Set([...LIVE_RUN_STATUSES,...TERMINAL_RUN_STATUSES]);function isValidBinding(value){return isRecord(value)&&typeof value["agentId"]==="string"&&isOptionalString(value["nativeSessionId"])&&isOptionalString(value["runtimeId"])&&(value["program"]===void 0||value["program"]==="qwen"||value["program"]==="claude"||value["program"]==="codex")&&isOptionalString(value["readThroughRecordId"])&&(value["remotePersona"]===void 0||isRecord(value["remotePersona"])&&typeof value["remotePersona"]["name"]==="string"&&isOptionalString(value["remotePersona"]["instructions"])&&isOptionalString(value["remotePersona"]["model"]))}__name(isValidBinding,"isValidBinding");function isValidLease(value){return value===void 0||isRecord(value)&&typeof value["hostId"]==="string"&&typeof value["leaseId"]==="string"&&typeof value["attempt"]==="number"&&typeof value["expiresAt"]==="number"&&isOptionalFiniteNumber(value["lastSequence"])}__name(isValidLease,"isValidLease");function isValidRun(value){return isRecord(value)&&typeof value["id"]==="string"&&typeof value["agentId"]==="string"&&typeof value["status"]==="string"&&RUN_STATUSES.has(value["status"])&&Array.isArray(value["triggerRecordIds"])&&value["triggerRecordIds"].every(id=>typeof id==="string")&&typeof value["chainDepth"]==="number"&&typeof value["createdAt"]==="number"&&typeof value["attempts"]==="number"&&isOptionalFiniteNumber(value["startedAt"])&&isOptionalFiniteNumber(value["endedAt"])&&isOptionalString(value["error"])&&isOptionalFiniteNumber(value["totalTokens"])&&isOptionalString(value["retryOf"])&&isOptionalString(value["squadId"])&&(value["recorded"]===void 0||typeof value["recorded"]==="boolean")&&isValidLease(value["lease"])}__name(isValidRun,"isValidRun");function isValidEngagement(value){return isRecord(value)&&typeof value["leaderAgentId"]==="string"&&typeof value["startedByRecordId"]==="string"&&Array.isArray(value["outstandingRunIds"])&&value["outstandingRunIds"].every(id=>typeof id==="string")&&(value["pendingWakeRunIds"]===void 0||Array.isArray(value["pendingWakeRunIds"])&&value["pendingWakeRunIds"].every(id=>typeof id==="string"))&&typeof value["active"]==="boolean"}__name(isValidEngagement,"isValidEngagement");function isValidEngagements(value){return value===void 0||isRecord(value)&&Object.values(value).every(isValidEngagement)}__name(isValidEngagements,"isValidEngagements");function parseSessionAgentsFile(value,sessionId,filePath="<memory>"){if(!isRecord(value)){throw new Error(`Malformed session agents file ${filePath}.`)}if(value["schemaVersion"]!==SESSION_AGENTS_SCHEMA_VERSION){throw new Error(`Unsupported session agents schema version ${JSON.stringify(value["schemaVersion"])} in ${filePath}; this build supports version ${SESSION_AGENTS_SCHEMA_VERSION}.`)}if(value["sessionId"]!==sessionId){throw new Error(`Session agents file ${filePath} names session ${JSON.stringify(value["sessionId"])}, not ${sessionId}.`)}const bindings=value["bindings"];const runs=value["runs"];if(!isRecord(bindings)||!Object.entries(bindings).every(([agentId,binding])=>isValidBinding(binding)&&binding.agentId===agentId)||!Array.isArray(runs)||!runs.every(isValidRun)||!isValidEngagements(value["squads"])){throw new Error(`Malformed session agents file ${filePath}.`)}const squads=value["squads"];return{schemaVersion:SESSION_AGENTS_SCHEMA_VERSION,sessionId,bindings,runs,...typeof value["chainTokens"]==="number"&&Number.isFinite(value["chainTokens"])&&value["chainTokens"]>0?{chainTokens:value["chainTokens"]}:{},...squads&&Object.keys(squads).length>0?{squads}:{}}}__name(parseSessionAgentsFile,"parseSessionAgentsFile");function trimTerminalRuns(runs,max=MAX_TERMINAL_SESSION_AGENT_RUNS){const terminal=runs.filter(run=>isTerminalSessionAgentRunStatus(run.status)&&run.recorded!==false);if(terminal.length<=max)return[...runs];const keep=new Set([...terminal].sort((a,b)=>(b.endedAt??b.createdAt)-(a.endedAt??a.createdAt)).slice(0,Math.max(0,max)).map(run=>run.id));return runs.filter(run=>!isTerminalSessionAgentRunStatus(run.status)||run.recorded===false||keep.has(run.id))}__name(trimTerminalRuns,"trimTerminalRuns");async function readFileUnlocked(projectRoot,sessionId){const filePath=getSessionAgentsFilePath(projectRoot,sessionId);let raw;try{raw=await fs.readFile(filePath,"utf-8")}catch(error){if(isNodeError(error)&&error.code==="ENOENT")return void 0;throw error}let parsed;try{parsed=JSON.parse(raw)}catch{throw new Error(`Malformed JSON in ${filePath} \u2014 fix or delete the file; refusing to treat it as empty.`)}return parseSessionAgentsFile(parsed,sessionId,filePath)}__name(readFileUnlocked,"readFileUnlocked");async function readSessionAgents(projectRoot,sessionId){return await readFileUnlocked(projectRoot,sessionId)??emptySessionAgentsFile(sessionId)}__name(readSessionAgents,"readSessionAgents");async function updateSessionAgents(projectRoot,sessionId,mutate){const filePath=getSessionAgentsFilePath(projectRoot,sessionId);return withAgentStoreTransaction(projectRoot,async()=>{const current=await readFileUnlocked(projectRoot,sessionId)??emptySessionAgentsFile(sessionId);const mutated=mutate(current)??current;const next={schemaVersion:SESSION_AGENTS_SCHEMA_VERSION,sessionId,bindings:mutated.bindings,runs:trimTerminalRuns(mutated.runs),...mutated.chainTokens?{chainTokens:mutated.chainTokens}:{},...mutated.squads&&Object.keys(mutated.squads).length>0?{squads:mutated.squads}:{}};parseSessionAgentsFile(next,sessionId,filePath);await fs.mkdir(getSessionAgentsDir(projectRoot),{recursive:true,mode:STORE_DIR_MODE});await atomicWriteJSON(filePath,next,STORE_FILE_OPTIONS);return next})}__name(updateSessionAgents,"updateSessionAgents");async function writeSessionAgents(projectRoot,file){return updateSessionAgents(projectRoot,file.sessionId,()=>({...file,bindings:structuredClone(file.bindings),runs:structuredClone(file.runs),...file.chainTokens?{chainTokens:file.chainTokens}:{},...file.squads?{squads:structuredClone(file.squads)}:{}}))}__name(writeSessionAgents,"writeSessionAgents");async function listSessionAgentsSessionIds(projectRoot){let names;try{names=await fs.readdir(getSessionAgentsDir(projectRoot))}catch(error){if(isNodeError(error)&&error.code==="ENOENT")return[];throw error}return names.filter(name=>name.endsWith(".json")).map(name=>name.slice(0,-".json".length)).filter(isValidSessionAgentsSessionId)}__name(listSessionAgentsSessionIds,"listSessionAgentsSessionIds");async function findSessionAgentBinding(projectRoot,nativeSessionId,agentId){if(!nativeSessionId||!agentId)return void 0;const ids=(await listSessionAgentsSessionIds(projectRoot)).slice(0,MAX_BINDING_SCAN_FILES);for(const chatSessionId of ids){let file;try{file=await readFileUnlocked(projectRoot,chatSessionId)}catch{continue}if(!file)continue;const binding=file.bindings[agentId];if(binding?.nativeSessionId!==nativeSessionId)continue;const run=file.runs.find(candidate=>candidate.agentId===agentId&&EXECUTING_RUN_STATUSES.has(candidate.status)&&candidate.lease===void 0);if(!run)continue;return{chatSessionId,agentId,runId:run.id,status:run.status,...binding.remotePersona?{remotePersona:{...binding.remotePersona}}:{}}}return void 0}__name(findSessionAgentBinding,"findSessionAgentBinding");function canReuseNativeSession(binding,runtimeId,program){return(binding.runtimeId===void 0||binding.runtimeId===runtimeId)&&(binding.program===void 0||binding.program===program)}__name(canReuseNativeSession,"canReuseNativeSession");init_esbuild_shims();var MAX_EXTERNAL_RECORD_KEY_LENGTH=256;var MAX_EXTERNAL_RECORD_TEXT_LENGTH=65536;var MAX_EXTERNAL_RECORD_DISPLAY_TEXT_LENGTH=MAX_AGENT_MESSAGE_DISPLAY_TEXT_CHARS;var MAX_EXTERNAL_RECORD_STEPS=MAX_AGENT_MESSAGE_STEPS;var MAX_EXTERNAL_RECORD_MENTION_IDS=32;var MAX_EXTERNAL_RECORD_ID_LENGTH=256;var MAX_EXTERNAL_RECORD_STEP_TITLE_LENGTH=1024;var STEP_STATUSES=new Set(["running","completed","failed"]);var TERMINAL_STATUSES=new Set(["completed","failed","cancelled","offline"]);function isObject(value){return typeof value==="object"&&value!==null&&!Array.isArray(value)}__name(isObject,"isObject");function isBoundedString(value,maxLength){return typeof value==="string"&&value.length<=maxLength}__name(isBoundedString,"isBoundedString");function isIdList(value){return Array.isArray(value)&&value.length<=MAX_EXTERNAL_RECORD_MENTION_IDS&&value.every(id=>isBoundedString(id,MAX_EXTERNAL_RECORD_ID_LENGTH))}__name(isIdList,"isIdList");function isSteps(value){return Array.isArray(value)&&value.length<=MAX_EXTERNAL_RECORD_STEPS&&value.every(step=>isObject(step)&&isBoundedString(step["id"],MAX_EXTERNAL_RECORD_ID_LENGTH)&&typeof step["title"]==="string"&&step["title"].length<=MAX_EXTERNAL_RECORD_STEP_TITLE_LENGTH&&typeof step["status"]==="string"&&STEP_STATUSES.has(step["status"]))}__name(isSteps,"isSteps");function isAuthor(value){return isObject(value)&&typeof value["agentId"]==="string"&&value["agentId"].length>0&&typeof value["name"]==="string"&&value["name"].length>0}__name(isAuthor,"isAuthor");function parseSessionExternalRecordParams(params){const{kind,recordKey,modelText,payload}=params;if(kind!=="agent_mention"&&kind!=="agent_message"){return"Invalid external record kind"}if(typeof recordKey!=="string"||recordKey.length===0||recordKey.length>MAX_EXTERNAL_RECORD_KEY_LENGTH){return"Invalid or missing external record recordKey"}if(typeof modelText!=="string"||modelText.length===0||modelText.length>MAX_EXTERNAL_RECORD_TEXT_LENGTH){return"Invalid or missing external record modelText"}if(!isObject(payload)||typeof payload["displayText"]!=="string"||payload["displayText"].length>(kind==="agent_message"?MAX_EXTERNAL_RECORD_DISPLAY_TEXT_LENGTH:MAX_EXTERNAL_RECORD_TEXT_LENGTH)){return"Invalid or missing external record payload.displayText"}if(kind==="agent_message"){if(!isAuthor(payload["author"])){return"Invalid agent_message payload.author"}if(typeof payload["runId"]!=="string"||payload["runId"].length===0){return"Invalid agent_message payload.runId"}if(typeof payload["status"]!=="string"||!TERMINAL_STATUSES.has(payload["status"])){return"Invalid agent_message payload.status"}if(payload["steps"]!==void 0&&!isSteps(payload["steps"])){return"Invalid or oversized agent_message payload.steps"}return{kind,recordKey,modelText,payload}}if(!isIdList(payload["mentionedAgentIds"])){return"Invalid or oversized agent_mention payload.mentionedAgentIds"}if(payload["mentionedSquadIds"]!==void 0&&!isIdList(payload["mentionedSquadIds"])){return"Invalid or oversized agent_mention payload.mentionedSquadIds"}if(payload["author"]!==void 0&&!isAuthor(payload["author"])){return"Invalid agent_mention payload.author"}return{kind,recordKey,modelText,payload}}__name(parseSessionExternalRecordParams,"parseSessionExternalRecordParams");export{isValidSessionAgentsSessionId,isTerminalSessionAgentRunStatus,trimTerminalRuns,readSessionAgents,updateSessionAgents,writeSessionAgents,listSessionAgentsSessionIds,findSessionAgentBinding,canReuseNativeSession,MAX_EXTERNAL_RECORD_TEXT_LENGTH,MAX_EXTERNAL_RECORD_MENTION_IDS,MAX_EXTERNAL_RECORD_ID_LENGTH,MAX_EXTERNAL_RECORD_STEP_TITLE_LENGTH,parseSessionExternalRecordParams};
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{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,reportRejectedLoaderKeys,resetLoaderKeyRejectionReportingForTesting}from"./chunk-N3AQAZ7D.js";import{PRIVATE_RELAUNCH_ENV_PROVENANCE}from"./chunk-E5T4R2PM.js";import{isWorkspaceTrusted}from"./chunk-YWK3E4WJ.js";import{require_main}from"./chunk-ZOTKZI2P.js";import{writeStderrLineSafe}from"./chunk-M4ECEHLX.js";import{Storage}from"./chunk-EPODBRBP.js";import{QWEN_DIR}from"./chunk-OKN3Z5C5.js";import{getErrorMessage}from"./chunk-XYB7GC5U.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]&&!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 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==="";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,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,reportRejectedLoaderKeys,resetLoaderKeyRejectionReportingForTesting}from"./chunk-N3AQAZ7D.js";import{PRIVATE_RELAUNCH_ENV_PROVENANCE}from"./chunk-E5T4R2PM.js";import{isWorkspaceTrusted}from"./chunk-4CE4GMDL.js";import{require_main}from"./chunk-ZOTKZI2P.js";import{writeStderrLineSafe}from"./chunk-M4ECEHLX.js";import{Storage}from"./chunk-EPODBRBP.js";import{QWEN_DIR}from"./chunk-OKN3Z5C5.js";import{getErrorMessage}from"./chunk-XYB7GC5U.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]&&!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 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==="";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,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{assertExternalAgentSpawnPlatformSupported,isExpectedExternalAgentCleanupExit,isUnprovenExternalAgentTreeExit}from"./chunk-5TWAP4OG.js";import{ProcessRegistry}from"./chunk-ESSOEHTE.js";import"./chunk-BC4C6F32.js";import"./chunk-2QYDBHYZ.js";import"./chunk-LUDNUVSA.js";import"./chunk-VTZZXEWA.js";import"./chunk-L5UULTGF.js";import"./chunk-CFTFKWPW.js";import"./chunk-NIEO2TBE.js";import"./chunk-WSOEJTOC.js";import"./chunk-CK3OKTTL.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3EZ5GCUT.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-E3KWSRJN.js";import"./chunk-FRVXSKL4.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-BVV7UXES.js";import"./chunk-7XZVMIY5.js";import"./chunk-BY46PCWY.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-PMBI46K4.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import{AgentEventEmitter,renderSubagentSystemPrompt}from"./chunk-T3CQ72HC.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import{sanitizeChildEnv}from"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-H5EXNXGW.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{spawn}from"node:child_process";import{createInterface}from"node:readline";var debugLogger=createDebugLogger("EXTERNAL_AGENT");var CodexInterruption=class extends Error{constructor(mode){super(mode==="TIMEOUT"?"Codex task exceeded its time limit.":"Codex task cancelled.");this.mode=mode}static{__name(this,"CodexInterruption")}};function object(value){if(!value||typeof value!=="object"||Array.isArray(value)){throw new Error("Codex returned an invalid protocol object.")}return value}__name(object,"object");function id(value){if(typeof value!=="string"||!value){throw new Error("Codex returned an invalid thread or turn ID.")}return value}__name(id,"id");async function runCodex(params,prompt,sandbox,signal){if(signal.aborted)throw new CodexInterruption("CANCELLED");const env=sanitizeChildEnv(process.env);delete env["CODEX_THREAD_ID"];delete env["CLAUDECODE"];delete env["NODE_OPTIONS"];const child=spawn(params.spec.command,params.spec.args??["app-server","--stdio"],{cwd:params.runtimeContext.getTargetDir(),env,stdio:"pipe",detached:process.platform!=="win32",windowsHide:true});const tracked=new ProcessRegistry().reserve().attach(child,{ownsProcessTree:true});child.stderr.resume();const lines=createInterface({input:child.stdout,crlfDelay:Infinity});const pending=new Map;let sequence=0;let threadId;let turnId;let finalAnswer;let unphasedAnswer;let terminal=false;let exitDrainTimer;let fail;const failure=new Promise((_resolve,reject)=>{fail=reject});let complete;const completed=new Promise(resolve=>{complete=resolve});const write=__name(frame=>{child.stdin.write(`${JSON.stringify(frame)}
3
+ import{assertExternalAgentSpawnPlatformSupported,isExpectedExternalAgentCleanupExit,isUnprovenExternalAgentTreeExit}from"./chunk-5HX2QGVR.js";import{ProcessRegistry}from"./chunk-ESSOEHTE.js";import"./chunk-BC4C6F32.js";import"./chunk-2QYDBHYZ.js";import"./chunk-LUDNUVSA.js";import"./chunk-VTZZXEWA.js";import"./chunk-L5UULTGF.js";import"./chunk-CFTFKWPW.js";import"./chunk-NIEO2TBE.js";import"./chunk-WSOEJTOC.js";import"./chunk-G2LTZU67.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3TTHYXT3.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-VC3JJL7E.js";import"./chunk-VKWVIWLK.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-DSKA3P2C.js";import"./chunk-7XZVMIY5.js";import"./chunk-4HSISRRA.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-QF22ILPV.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import{AgentEventEmitter,renderSubagentSystemPrompt}from"./chunk-7XQ5D34E.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import{sanitizeChildEnv}from"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-HQZTAA2U.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import{createDebugLogger}from"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import{__name}from"./chunk-KBWJGX7I.js";init_esbuild_shims();import{spawn}from"node:child_process";import{createInterface}from"node:readline";var debugLogger=createDebugLogger("EXTERNAL_AGENT");var CodexInterruption=class extends Error{constructor(mode){super(mode==="TIMEOUT"?"Codex task exceeded its time limit.":"Codex task cancelled.");this.mode=mode}static{__name(this,"CodexInterruption")}};function object(value){if(!value||typeof value!=="object"||Array.isArray(value)){throw new Error("Codex returned an invalid protocol object.")}return value}__name(object,"object");function id(value){if(typeof value!=="string"||!value){throw new Error("Codex returned an invalid thread or turn ID.")}return value}__name(id,"id");async function runCodex(params,prompt,sandbox,signal){if(signal.aborted)throw new CodexInterruption("CANCELLED");const env=sanitizeChildEnv(process.env);delete env["CODEX_THREAD_ID"];delete env["CLAUDECODE"];delete env["NODE_OPTIONS"];const child=spawn(params.spec.command,params.spec.args??["app-server","--stdio"],{cwd:params.runtimeContext.getTargetDir(),env,stdio:"pipe",detached:process.platform!=="win32",windowsHide:true});const tracked=new ProcessRegistry().reserve().attach(child,{ownsProcessTree:true});child.stderr.resume();const lines=createInterface({input:child.stdout,crlfDelay:Infinity});const pending=new Map;let sequence=0;let threadId;let turnId;let finalAnswer;let unphasedAnswer;let terminal=false;let exitDrainTimer;let fail;const failure=new Promise((_resolve,reject)=>{fail=reject});let complete;const completed=new Promise(resolve=>{complete=resolve});const write=__name(frame=>{child.stdin.write(`${JSON.stringify(frame)}
4
4
  `)},"write");const request=__name((method,parameters)=>{const requestId=++sequence;return new Promise((resolve,reject)=>{pending.set(requestId,{resolve,reject});write({id:requestId,method,params:parameters})})},"request");const abort=__name(()=>{if(threadId&&turnId){void request("turn/interrupt",{threadId,turnId}).catch(()=>{})}fail(new CodexInterruption("CANCELLED"))},"abort");signal.addEventListener("abort",abort,{once:true});child.once("error",error=>{fail(new Error(error.code==="ENOENT"?`Cannot start ${params.spec.command}. Install Codex and make it available on PATH.`:`Cannot start Codex: ${error.code??"process error"}`))});const onExit=__name((code,exitSignal)=>{exitDrainTimer=setTimeout(()=>fail(new Error(`Codex exited before completion (${exitSignal??code}).`)),1e4)},"onExit");child.once("exit",onExit);child.stdin.on("error",()=>fail(new Error("Codex input stream closed.")));child.stdout.on("error",()=>fail(new Error("Codex output stream failed.")));const associateTurn=__name(value=>{const observed=id(value);if(turnId&&observed!==turnId)throw new Error("Codex returned another turn.");turnId=observed},"associateTurn");lines.on("line",line=>{if(terminal&&pending.size===0)return;try{let frame;try{frame=object(JSON.parse(line))}catch(error){if(terminal)return;throw error}if(typeof frame["method"]!=="string"){const reply=pending.get(frame["id"]);if(!reply)return;pending.delete(frame["id"]);if(frame["error"])reply.reject(new Error("Codex rejected an app-server request."));else reply.resolve(object(frame["result"]));return}if(terminal)return;const method=frame["method"];const parameters=object(frame["params"]??{});if(frame["id"]!==void 0){let result;switch(method){case"item/commandExecution/requestApproval":case"item/fileChange/requestApproval":{const available=parameters["availableDecisions"];const decision=Array.isArray(available)?available.includes("decline")?"decline":available.includes("cancel")?"cancel":void 0:"decline";if(!decision)throw new Error("Codex offered no unattended rejection.");result={decision};break}case"item/permissions/requestApproval":result={permissions:{},scope:"turn"};break;case"item/tool/requestUserInput":result={answers:{}};break;case"mcpServer/elicitation/request":result={action:"decline",content:null,_meta:null};break;default:write({id:frame["id"],error:{code:-32601,message:"Unsupported unattended request."}});throw new Error(`Codex requested unsupported interaction: ${method}`)}write({id:frame["id"],result});return}if(!threadId||parameters["threadId"]!==threadId)return;if(method==="turn/started"||method==="turn/completed"){const turn=object(parameters["turn"]);associateTurn(turn["id"]);if(method==="turn/completed"){terminal=true;complete(turn)}}else if(method==="item/completed"){associateTurn(parameters["turnId"]);const item=object(parameters["item"]);if(item["type"]!=="agentMessage")return;if(typeof item["text"]!=="string")throw new Error("Codex returned an invalid message.");if(item["phase"]==="final_answer")finalAnswer=item["text"];else if(item["phase"]==null)unphasedAnswer=item["text"]}}catch(error){fail(error instanceof Error?error:new Error("Invalid Codex protocol frame."))}});lines.on("close",()=>{if(!terminal||pending.size>0)fail(new Error("Codex protocol closed before completion."))});const initTimer=setTimeout(()=>fail(new Error("Codex initialization timed out.")),1e4);const minutes=params.runConfig.max_time_minutes;const executionTimer=minutes===void 0?void 0:setTimeout(()=>fail(new CodexInterruption("TIMEOUT")),minutes*6e4);const run=__name(async()=>{await request("initialize",{clientInfo:{name:"qwen-code",version:"1.0.0"},capabilities:{experimentalApi:false}});write({method:"initialized"});const started=await request("thread/start",{cwd:params.runtimeContext.getTargetDir(),ephemeral:true,approvalPolicy:"never",sandbox});const thread=object(started["thread"]);threadId=id(thread["id"]);if(thread["ephemeral"]!==true)throw new Error("Codex did not create an ephemeral thread.");clearTimeout(initTimer);const startedTurn=await request("turn/start",{threadId,input:[{type:"text",text:prompt,text_elements:[]}]});associateTurn(object(startedTurn["turn"])["id"]);const turn=await completed;if(turn["status"]!=="completed")throw new Error(`Codex turn ended with status ${String(turn["status"])}.`);const answer=finalAnswer??unphasedAnswer;if(!answer?.trim())throw new Error("Codex completed without a final answer.");return answer},"run");let completedAnswer;let interruption;try{completedAnswer=await Promise.race([run(),failure]);return completedAnswer}catch(error){if(error instanceof CodexInterruption)interruption=error;throw error}finally{clearTimeout(initTimer);clearTimeout(executionTimer);clearTimeout(exitDrainTimer);child.removeListener("exit",onExit);signal.removeEventListener("abort",abort);lines.close();for(const reply of pending.values())reply.reject(new Error("Codex connection closed."));pending.clear();await tracked.terminate().catch(error=>{const detail=error instanceof Error?error.message:String(error);if(isUnprovenExternalAgentTreeExit(error)){const diagnostic=`Codex process tree not proven gone after cleanup: ${detail}`;debugLogger.warn(diagnostic);if(params.eventEmitter?.rawListeners("error").length){params.eventEmitter.emit("error",{subagentId:params.subagentId??params.name,error:diagnostic,timestamp:Date.now()})}}else if(!isExpectedExternalAgentCleanupExit(error)){if(interruption){interruption.message+=`
5
5
 
6
6
  Codex cleanup failed: ${detail}`;throw interruption}throw new Error(`Codex cleanup failed: ${detail}`+(completedAnswer===void 0?"":`
@@ -1,3 +1,3 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{effectiveSessionScope,multiSessionCompatibilityError,parseChannelConfig,parseChannelWebhookConfig,parseChannelWebhookConfigLenient,parseMessageRoutingConfig,parseSessionRotationConfig,resolveEnvVars}from"./chunk-MMQY4FJL.js";import"./chunk-NY56CL2X.js";import"./chunk-TL6RUTMP.js";import{findCliEntryPath}from"./chunk-W7V6J2VV.js";import"./chunk-QN7NYEE3.js";import"./chunk-WSOEJTOC.js";import"./chunk-CK3OKTTL.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3EZ5GCUT.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-E3KWSRJN.js";import"./chunk-FRVXSKL4.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-BVV7UXES.js";import"./chunk-7XZVMIY5.js";import"./chunk-BY46PCWY.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-PMBI46K4.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import"./chunk-T3CQ72HC.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-H5EXNXGW.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";export{effectiveSessionScope,findCliEntryPath,multiSessionCompatibilityError,parseChannelConfig,parseChannelWebhookConfig,parseChannelWebhookConfigLenient,parseMessageRoutingConfig,parseSessionRotationConfig,resolveEnvVars};
3
+ import{effectiveSessionScope,multiSessionCompatibilityError,parseChannelConfig,parseChannelWebhookConfig,parseChannelWebhookConfigLenient,parseMessageRoutingConfig,parseSessionRotationConfig,resolveEnvVars}from"./chunk-MMQY4FJL.js";import"./chunk-NY56CL2X.js";import"./chunk-TL6RUTMP.js";import{findCliEntryPath}from"./chunk-W7V6J2VV.js";import"./chunk-QN7NYEE3.js";import"./chunk-WSOEJTOC.js";import"./chunk-G2LTZU67.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3TTHYXT3.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-VC3JJL7E.js";import"./chunk-VKWVIWLK.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-DSKA3P2C.js";import"./chunk-7XZVMIY5.js";import"./chunk-4HSISRRA.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-QF22ILPV.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import"./chunk-7XQ5D34E.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-HQZTAA2U.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";export{effectiveSessionScope,findCliEntryPath,multiSessionCompatibilityError,parseChannelConfig,parseChannelWebhookConfig,parseChannelWebhookConfigLenient,parseMessageRoutingConfig,parseSessionRotationConfig,resolveEnvVars};
@@ -1,3 +1,3 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import{collectContextData,contextCommand,formatContextUsageText}from"./chunk-7HFFTOAD.js";import"./chunk-EVBKKQ7Y.js";import"./chunk-4TZUKLPC.js";import"./chunk-NO7VTKRL.js";import"./chunk-U7HZUZKP.js";import"./chunk-CK3OKTTL.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3EZ5GCUT.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-E3KWSRJN.js";import"./chunk-FRVXSKL4.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-BVV7UXES.js";import"./chunk-7XZVMIY5.js";import"./chunk-BY46PCWY.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-PMBI46K4.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import"./chunk-T3CQ72HC.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-H5EXNXGW.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-M4ECEHLX.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";export{collectContextData,contextCommand,formatContextUsageText};
3
+ import{collectContextData,contextCommand,formatContextUsageText}from"./chunk-UTTSBCFR.js";import"./chunk-EVBKKQ7Y.js";import"./chunk-4TZUKLPC.js";import"./chunk-NO7VTKRL.js";import"./chunk-U7HZUZKP.js";import"./chunk-G2LTZU67.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3TTHYXT3.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-VC3JJL7E.js";import"./chunk-VKWVIWLK.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-DSKA3P2C.js";import"./chunk-7XZVMIY5.js";import"./chunk-4HSISRRA.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-QF22ILPV.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import"./chunk-7XQ5D34E.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-HQZTAA2U.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-M4ECEHLX.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";export{collectContextData,contextCommand,formatContextUsageText};
@@ -1,6 +1,6 @@
1
1
  // Force strict mode and setup for ESM
2
2
  "use strict";
3
- import"./chunk-CK3OKTTL.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3EZ5GCUT.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-E3KWSRJN.js";import"./chunk-FRVXSKL4.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-BVV7UXES.js";import"./chunk-7XZVMIY5.js";import"./chunk-BY46PCWY.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-PMBI46K4.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import"./chunk-T3CQ72HC.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import{readCronTasks}from"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import{DEFAULT_OTLP_ENDPOINT,DEFAULT_TELEMETRY_TARGET,initializeDaemonMetrics,recordDaemonCancel,recordDaemonChannelLifecycle,recordDaemonPipeMessage,recordDaemonPromptDuration,recordDaemonPromptQueueWait,recordDaemonSessionLifecycle,registerDaemonEventLoopLagGauge,registerDaemonGaugeCallbacks,resolveTelemetrySettings,startEventLoopLagMonitor}from"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import{applyProviderInstallPlan,buildInstallPlan,findProviderById,getDefaultModelIds,getModelsForProviderProtocol,resolveBaseUrl}from"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import{createDaemonBridgeTelemetry,emitDaemonLog,hashDaemonWorkspace}from"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-H5EXNXGW.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import{forceFlushMetrics,initializeTelemetry,shutdownTelemetry}from"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import{Storage}from"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import{FatalConfigError}from"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";init_esbuild_shims();export{DEFAULT_OTLP_ENDPOINT,DEFAULT_TELEMETRY_TARGET,FatalConfigError,Storage,applyProviderInstallPlan,buildInstallPlan,createDaemonBridgeTelemetry,emitDaemonLog,findProviderById,forceFlushMetrics,getDefaultModelIds,getModelsForProviderProtocol,hashDaemonWorkspace,initializeDaemonMetrics,initializeTelemetry,readCronTasks,recordDaemonCancel,recordDaemonChannelLifecycle,recordDaemonPipeMessage,recordDaemonPromptDuration,recordDaemonPromptQueueWait,recordDaemonSessionLifecycle,registerDaemonEventLoopLagGauge,registerDaemonGaugeCallbacks,resolveBaseUrl,resolveTelemetrySettings,shutdownTelemetry,startEventLoopLagMonitor};
3
+ import"./chunk-G2LTZU67.js";import"./chunk-QS2ZMQIS.js";import"./chunk-S7IKHQ6I.js";import"./chunk-PAD5GPDY.js";import"./chunk-MD3ZEOBX.js";import"./chunk-SSYS5YN5.js";import"./chunk-X5QSFJVS.js";import"./chunk-OMDTFGTX.js";import"./chunk-3TTHYXT3.js";import"./chunk-46VUDNCL.js";import"./chunk-MKH3EH7O.js";import"./chunk-VC3JJL7E.js";import"./chunk-VKWVIWLK.js";import"./chunk-HW6SU6MX.js";import"./chunk-ZHHFNZ5J.js";import"./chunk-AKWYMQKU.js";import"./chunk-MZUOREFD.js";import"./chunk-DSKA3P2C.js";import"./chunk-7XZVMIY5.js";import"./chunk-4HSISRRA.js";import"./chunk-ZZJXFLVM.js";import"./chunk-RKDS7A4H.js";import"./chunk-QF22ILPV.js";import"./chunk-IV3HAIUN.js";import"./chunk-XFMPZINJ.js";import"./chunk-DECUAM3U.js";import"./chunk-QX7W2HY7.js";import"./chunk-HN5UYLPU.js";import"./chunk-PGRN3GZY.js";import"./chunk-HTW7PYHK.js";import"./chunk-AMGUAA4G.js";import"./chunk-YFTVFH2A.js";import"./chunk-ZBHL2CXR.js";import"./chunk-NIOS3B3V.js";import"./chunk-7XQ5D34E.js";import"./chunk-R2EHHA2C.js";import"./chunk-YK7NDQKM.js";import"./chunk-ZLZF2ZDD.js";import"./chunk-OMSVOFTC.js";import"./chunk-PHIPLV2I.js";import"./chunk-ZOTKZI2P.js";import"./chunk-A6G5TAIF.js";import"./chunk-YVBHCSZD.js";import"./chunk-FIXDX63I.js";import"./chunk-T7CHK6C2.js";import"./chunk-PT7NZBDY.js";import"./chunk-TWP72VRH.js";import"./chunk-UYEWRLGD.js";import"./chunk-QVPT37XZ.js";import"./chunk-YVD4O5ZB.js";import{readCronTasks}from"./chunk-T6W33SET.js";import"./chunk-WK2IBT6D.js";import"./chunk-QZV4PFQK.js";import"./chunk-ILECDNJX.js";import"./chunk-QXQGUM3Y.js";import"./chunk-UQ7IROJH.js";import"./chunk-SZCBUCNH.js";import"./chunk-BEKROCWN.js";import"./chunk-5SUFJTQQ.js";import"./chunk-BYU42MLK.js";import"./chunk-JWQXU3SR.js";import"./chunk-5LZ2DPLH.js";import"./chunk-XQJOZDV7.js";import"./chunk-CV2UAEZA.js";import"./chunk-FUBDS3AV.js";import{DEFAULT_OTLP_ENDPOINT,DEFAULT_TELEMETRY_TARGET,initializeDaemonMetrics,recordDaemonCancel,recordDaemonChannelLifecycle,recordDaemonPipeMessage,recordDaemonPromptDuration,recordDaemonPromptQueueWait,recordDaemonSessionLifecycle,registerDaemonEventLoopLagGauge,registerDaemonGaugeCallbacks,resolveTelemetrySettings,startEventLoopLagMonitor}from"./chunk-HW6AWS7W.js";import"./chunk-KLC3OD2M.js";import"./chunk-Q5IZXKUJ.js";import"./chunk-G5PYYZMM.js";import"./chunk-BG67XABA.js";import"./chunk-OBOU4ZZM.js";import"./chunk-D7XCQWP2.js";import"./chunk-AE5OMKRY.js";import"./chunk-OBV7RNHV.js";import"./chunk-7CQMWEMY.js";import"./chunk-GOZYWU4B.js";import"./chunk-OUC3WICA.js";import"./chunk-JZK2WGXA.js";import"./chunk-MPHSE7M4.js";import"./chunk-S2ZKZXHX.js";import"./chunk-7UK4WJWS.js";import"./chunk-4GP3PH7Z.js";import"./chunk-4QQKOW5M.js";import"./chunk-OV3EBH6J.js";import"./chunk-EBMCWXGZ.js";import"./chunk-XZTE4YTN.js";import"./chunk-LSASUDF2.js";import"./chunk-2V5EKGDK.js";import"./chunk-MOKVM4PT.js";import"./chunk-YIW3H46P.js";import"./chunk-EOMRLUNZ.js";import"./chunk-4ZRCV3JY.js";import"./chunk-TL6MLBXR.js";import"./chunk-NMY3PYNO.js";import"./chunk-YGLM5XPP.js";import"./chunk-WGNF7FPC.js";import"./chunk-4NPYOXJO.js";import"./chunk-MWGB5RCF.js";import"./chunk-SCD5TUBG.js";import"./chunk-NTRFETZB.js";import"./chunk-TL3SF2GA.js";import"./chunk-LMJPU2JM.js";import"./chunk-VFB6Q74I.js";import"./chunk-4JNHUZ7M.js";import"./chunk-SW54YEPK.js";import"./chunk-ZCRL73DT.js";import"./chunk-A6LT3FIJ.js";import"./chunk-S6RXVOY6.js";import"./chunk-YZFNBUKG.js";import"./chunk-AGEDDL7Z.js";import"./chunk-2NJJHZ52.js";import"./chunk-BN4FIQ77.js";import"./chunk-X64RXJQQ.js";import"./chunk-HETUGUHE.js";import{applyProviderInstallPlan,buildInstallPlan,findProviderById,getDefaultModelIds,getModelsForProviderProtocol,resolveBaseUrl}from"./chunk-ET2Z7ZGF.js";import"./chunk-XFPYXD2P.js";import"./chunk-3YWXKSOI.js";import"./chunk-5CWTKFI4.js";import"./chunk-C4MVD5OI.js";import"./chunk-Z2W7S4O4.js";import"./chunk-476F6QIM.js";import"./chunk-4R67LXKL.js";import{createDaemonBridgeTelemetry,emitDaemonLog,hashDaemonWorkspace}from"./chunk-FQRF6B65.js";import"./chunk-ZWPSBU7K.js";import"./chunk-UQFTXKEB.js";import"./chunk-HDGTWJ24.js";import"./chunk-W5NWIGKO.js";import"./chunk-KVA6DHHF.js";import"./chunk-PWOQASXT.js";import"./chunk-K7JCVESI.js";import"./chunk-Y6HHV4LC.js";import"./chunk-RP57XAJ2.js";import"./chunk-Z6AR5XE5.js";import"./chunk-7DOOXUDG.js";import"./chunk-77V43YOE.js";import"./chunk-7U7CWMP7.js";import"./chunk-EFTJIDS3.js";import"./chunk-4DIWAQ5G.js";import"./chunk-Q6UAOTP3.js";import"./chunk-HQZTAA2U.js";import"./chunk-GOR7FFVE.js";import"./chunk-4ZBZL23U.js";import"./chunk-BMHYEQTI.js";import"./chunk-ZZZAYAJW.js";import"./chunk-XMANRGPK.js";import{forceFlushMetrics,initializeTelemetry,shutdownTelemetry}from"./chunk-3XVPZY7X.js";import"./chunk-KQX4H2D3.js";import"./chunk-URNNJMIC.js";import"./chunk-GU22I6TY.js";import"./chunk-YEYW7PPR.js";import"./chunk-DBRQGEEI.js";import"./chunk-B3ZFUGTC.js";import"./chunk-IRINPFG7.js";import"./chunk-6GTPLW7K.js";import"./chunk-NGVRCUYD.js";import"./chunk-5DTFN37U.js";import"./chunk-2YUBAWQ6.js";import"./chunk-O5EKX7LG.js";import"./chunk-TM6ZCBR7.js";import"./chunk-SVAPAMMG.js";import"./chunk-3KUHQGOS.js";import"./chunk-I6S7NGX3.js";import"./chunk-SBZFGYYS.js";import"./chunk-JAUJI56S.js";import"./chunk-I4H7NUVP.js";import{Storage}from"./chunk-EPODBRBP.js";import"./chunk-OKN3Z5C5.js";import{FatalConfigError}from"./chunk-XYB7GC5U.js";import"./chunk-2UOMCYQG.js";import"./chunk-I7L2TX4M.js";import"./chunk-MK3OONRA.js";import"./chunk-COGTQ5KZ.js";import{init_esbuild_shims}from"./chunk-VKDAXTCZ.js";import"./chunk-KBWJGX7I.js";init_esbuild_shims();export{DEFAULT_OTLP_ENDPOINT,DEFAULT_TELEMETRY_TARGET,FatalConfigError,Storage,applyProviderInstallPlan,buildInstallPlan,createDaemonBridgeTelemetry,emitDaemonLog,findProviderById,forceFlushMetrics,getDefaultModelIds,getModelsForProviderProtocol,hashDaemonWorkspace,initializeDaemonMetrics,initializeTelemetry,readCronTasks,recordDaemonCancel,recordDaemonChannelLifecycle,recordDaemonPipeMessage,recordDaemonPromptDuration,recordDaemonPromptQueueWait,recordDaemonSessionLifecycle,registerDaemonEventLoopLagGauge,registerDaemonGaugeCallbacks,resolveBaseUrl,resolveTelemetrySettings,shutdownTelemetry,startEventLoopLagMonitor};
4
4
  /**
5
5
  * @license
6
6
  * Copyright 2026 Qwen Team