@readmagic/workmate 0.0.21 → 0.0.22

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 (461) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-DWgTWJ7R.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-s0Orgord.js +1 -0
  4. package/dist/chunks/App-BcEI6U5j.js +1 -0
  5. package/dist/chunks/ApproveApiKey-DegdTXZl.js +1 -0
  6. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +2 -0
  8. package/dist/chunks/BypassPermissionsModeDialog-D2Gesf-u.js +1 -0
  9. package/dist/chunks/CustomSelect-B46Eh0gU.js +1 -0
  10. package/dist/chunks/DiffDialog-v2IiYyi3.js +6 -0
  11. package/dist/chunks/Doctor-BP0Rqraa.js +1 -0
  12. package/dist/chunks/Doctor-By_y3C2V.js +3 -0
  13. package/dist/chunks/ExitFlow-BasHk1mk.js +2 -0
  14. package/dist/chunks/Grove-C3mhgshv.js +11 -0
  15. package/dist/chunks/InvalidConfigDialog-DYVQK5js.js +1 -0
  16. package/dist/chunks/InvalidSettingsDialog-Dg6OiStR.js +1 -0
  17. package/dist/chunks/KeybindingProviderSetup-Bn1jzN5F.js +1 -0
  18. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +1 -0
  19. package/dist/chunks/MCPToolListView-DLSrQHDc.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-DZejAh8b.js} +1 -1
  21. package/dist/chunks/MessageSelector-CdDlJE48.js +3 -0
  22. package/dist/chunks/Messages-DuL_r1Or.js +10 -0
  23. package/dist/chunks/Onboarding-CE2GNA-h.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-lkr_A5jQ.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-DaQKKyM5.js +1 -0
  26. package/dist/chunks/QueryEngine-DNNy1UCD.js +1 -0
  27. package/dist/chunks/REPL-CEhW-C41.js +1 -0
  28. package/dist/chunks/REPL-CkSL4C_8.js +124 -0
  29. package/dist/chunks/ResumeConversation-BMCO_3X7.js +1 -0
  30. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +1 -0
  31. package/dist/chunks/SelectMulti-CNE06VAN.js +1 -0
  32. package/dist/chunks/Settings-mDykHLok.js +2 -0
  33. package/dist/chunks/Spinner-DwsJJUtn.js +1 -0
  34. package/dist/chunks/SpinnerGlyph-A6G-gloN.js +1 -0
  35. package/dist/chunks/TextInput-7uqPhq9T.js +22 -0
  36. package/dist/chunks/ThemePicker-DT9zVy-0.js +1 -0
  37. package/dist/chunks/TrustDialog-G4jM9IfM.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-BLtP647v.js} +1 -1
  39. package/dist/chunks/add-dir-7RfQAC3h.js +1 -0
  40. package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-vLQHFrmq.js} +1 -1
  41. package/dist/chunks/agents-BNg_skSm.js +101 -0
  42. package/dist/chunks/{agents-CvW8XjoJ.js → agents-DLz0kfsr.js} +1 -1
  43. package/dist/chunks/allErrors-DaztSMrw.js +1 -0
  44. package/dist/chunks/appleTerminalBackup-BYKdf3of.js +1 -0
  45. package/dist/chunks/auth-BTB00dq5.js +10 -0
  46. package/dist/chunks/auth-Bbc0Ny8i.js +1 -0
  47. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +1 -0
  48. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +17 -0
  49. package/dist/chunks/banner-mqZEluky.js +2 -0
  50. package/dist/chunks/branch-exFKkymg.js +2 -0
  51. package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BL2gnDLX.js} +2 -2
  52. package/dist/chunks/btw-3l78DYET.js +1 -0
  53. package/dist/chunks/caches-6Nx6tsk9.js +1 -0
  54. package/dist/chunks/caches-ouaWB9bY.js +1 -0
  55. package/dist/chunks/claudeDesktop-D3PEgx3U.js +1 -0
  56. package/dist/chunks/{clear-D2KRoibg.js → clear-CXfhVRp8.js} +1 -1
  57. package/dist/chunks/client-C01Bnxxv.js +1 -0
  58. package/dist/chunks/client-DYRgRQsr.js +1 -0
  59. package/dist/chunks/{client-C_jBL1yC.js → client-DdenNfkQ.js} +1 -1
  60. package/dist/chunks/client-DvhWKIOx.js +1 -0
  61. package/dist/chunks/commands-BoxOw75F.js +1 -0
  62. package/dist/chunks/compact-BOYr105K.js +2 -0
  63. package/dist/chunks/config-BddEvZZl.js +3 -0
  64. package/dist/chunks/config-GEv9hUzz.js +1 -0
  65. package/dist/chunks/config-kw4xg7Nk.js +1 -0
  66. package/dist/chunks/{context-Db9tH1VF.js → context-3s9wtn4L.js} +1 -1
  67. package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-CJhUu_4y.js} +9 -9
  68. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +1 -0
  69. package/dist/chunks/conversation-CoGharlH.js +1 -0
  70. package/dist/chunks/conversation-MxEVm54C.js +1 -0
  71. package/dist/chunks/conversationRecovery-Da_8uldZ.js +1 -0
  72. package/dist/chunks/crossProjectResume-CzPCHq_K.js +40 -0
  73. package/dist/chunks/cwd-BcO6WHKo.js +1 -0
  74. package/dist/chunks/cwd-CDUelriw.js +1 -0
  75. package/dist/chunks/{datadog-BuElf2EQ.js → datadog-v_mXWncN.js} +1 -1
  76. package/dist/chunks/{debug-D58GQBDG.js → debug-8DCufdSp.js} +4 -4
  77. package/dist/chunks/detectRepository-DfX8xXw2.js +1 -0
  78. package/dist/chunks/{diff-yA6v_dpP.js → diff-DJSt7QO6.js} +1 -1
  79. package/dist/chunks/directoryCompletion-CT6YVeg7.js +1 -0
  80. package/dist/chunks/doctor-DWvioSU9.js +1 -0
  81. package/dist/chunks/entry-ex0-RyYV.js +13 -0
  82. package/dist/chunks/esm-BQY8jJNR.js +1 -0
  83. package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BsfuytkN.js} +1 -1
  84. package/dist/chunks/exit-BxC_ZEtO.js +1 -0
  85. package/dist/chunks/extraUsage-DYm33Occ.js +1 -0
  86. package/dist/chunks/extractMemories-CzN3Ax2B.js +1 -0
  87. package/dist/chunks/fast-DqUpl_Lr.js +1 -0
  88. package/dist/chunks/fast-NUdUyAaM.js +1 -0
  89. package/dist/chunks/fetchModelList-CqsTAWEN.js +1 -0
  90. package/dist/chunks/fetchModelList-DBMHE6Ng.js +1 -0
  91. package/dist/chunks/fileSuggestions-B-SLfb-o.js +3 -0
  92. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +3 -0
  93. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +1 -0
  94. package/dist/chunks/gemini-BC9kHhwe.js +2 -0
  95. package/dist/chunks/generateSessionName-ChvKBVxB.js +1 -0
  96. package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-BYi0OefF.js} +1 -1
  97. package/dist/chunks/goal-ByyimpVU.js +3 -0
  98. package/dist/chunks/grok-DenjixMl.js +1 -0
  99. package/dist/chunks/grove-Dq8QbQ9o.js +7 -0
  100. package/dist/chunks/help-CK90i4hE.js +1 -0
  101. package/dist/chunks/history-CNQNd6hT.js +1 -0
  102. package/dist/chunks/{hooks-BDgToO1Z.js → hooks-BRFDg9DV.js} +2 -2
  103. package/dist/chunks/hooks-BaYwmkxD.js +1 -0
  104. package/dist/chunks/install-ZMll-dAa.js +1 -0
  105. package/dist/chunks/instrumentation-BwVyvRfY.js +21 -0
  106. package/dist/chunks/{job-DYMfSglZ.js → job-G_ukhLc4.js} +1 -1
  107. package/dist/chunks/keybindings-wNxBzDVQ.js +1 -0
  108. package/dist/chunks/launchLocalMemory-BcRlXLm6.js +3 -0
  109. package/dist/chunks/launchOnboarding-CDjQ64RO.js +8 -0
  110. package/dist/chunks/{loadAgentsDir-C96o6gCj.js → loadAgentsDir-C1LkW7gl.js} +551 -621
  111. package/dist/chunks/loadAgentsDir-DKXap_Om.js +1 -0
  112. package/dist/chunks/{loadPluginHooks-0nGlugZ4.js → loadPluginHooks-DtmHtEiS.js} +1 -1
  113. package/dist/chunks/{loader-C33o_5kS.js → loader-C61fB6vU.js} +1 -1
  114. package/dist/chunks/localSearch-BB9x5C2N.js +1 -0
  115. package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-DFo_WTMm.js} +1 -1
  116. package/dist/chunks/log-DaILwWJa.js +1 -0
  117. package/dist/chunks/logoUtils-Dj_2SWmO.js +1 -0
  118. package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-DYc9TFmI.js} +2 -2
  119. package/dist/chunks/main-BRg8L_aw.js +346 -0
  120. package/dist/chunks/managedEnv-DsqAYOJ4.js +1 -0
  121. package/dist/chunks/managedEnv-lybrMred.js +1 -0
  122. package/dist/chunks/mcp-Bsw3cMiJ.js +6 -0
  123. package/dist/chunks/mcp-DDdud6Y7.js +1 -0
  124. package/dist/chunks/mcp-DbgTDUt7.js +2 -0
  125. package/dist/chunks/memory-CzwTzihf.js +1 -0
  126. package/dist/chunks/mode-Pan-Q2c4.js +2 -0
  127. package/dist/chunks/model-BYfmXKHf.js +1 -0
  128. package/dist/chunks/model-BwBE0Pt5.js +1 -0
  129. package/dist/chunks/modelOptions-DvNBapgG.js +1 -0
  130. package/dist/chunks/nativeInstaller-DnSNJWIi.js +1 -0
  131. package/dist/chunks/notifications-B0DTaYoy.js +1 -0
  132. package/dist/chunks/omit-Dl1Us_PY.js +1 -0
  133. package/dist/chunks/onChangeAppState-4KOJMN82.js +1 -0
  134. package/dist/chunks/openai-C_6C1_0N.js +10 -0
  135. package/dist/chunks/overlayContext-CMV7nYR9.js +1 -0
  136. package/dist/chunks/{panel-Cm23FDVt.js → panel-D9fGQgln.js} +1 -1
  137. package/dist/chunks/parser-BKAVMTyD.js +1 -0
  138. package/dist/chunks/{parser-eVu-cTRs.js → parser-D8slvrJP.js} +1 -1
  139. package/dist/chunks/partition-B504IgAa.js +1 -0
  140. package/dist/chunks/pasteStore-DNV1M5Xd.js +1 -0
  141. package/dist/chunks/permissions-CLFMhdRk.js +3 -0
  142. package/dist/chunks/pidLock-D9do1Afy.js +3 -0
  143. package/dist/chunks/{plan-s228H7IU.js → plan-CQLnPLuE.js} +1 -1
  144. package/dist/chunks/{platform-DMQxcm4K.js → platform-Dzff1WWw.js} +1 -1
  145. package/dist/chunks/plugin-BYdF7uob.js +17 -0
  146. package/dist/chunks/{pluginAutoupdate-aLXhSUVD.js → pluginAutoupdate-BJaAqwTH.js} +1 -1
  147. package/dist/chunks/{pluginBlocklist-BprCv0En.js → pluginBlocklist-DKKmOnWM.js} +1 -1
  148. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +1 -0
  149. package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-DQP8tBi2.js} +1 -1
  150. package/dist/chunks/pluginOperations-BcfJCDco.js +2 -0
  151. package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-CfRvCrFg.js} +1 -1
  152. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +1 -0
  153. package/dist/chunks/plugins-CTM8jpOw.js +4 -0
  154. package/dist/chunks/policyLimits-a7ix6GnU.js +1 -0
  155. package/dist/chunks/poorMode-C11JEH3d.js +1 -0
  156. package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-J5SYJvoY.js} +1 -1
  157. package/dist/chunks/print-u6MzL5Cr.js +13 -0
  158. package/dist/chunks/processBashCommand-DIwrI2QC.js +1 -0
  159. package/dist/chunks/processSlashCommand-B-Gujpxm.js +5 -0
  160. package/dist/chunks/projectOnboardingState-CJycxw5P.js +1 -0
  161. package/dist/chunks/{prompt-BNNE5tsG.js → prompt-BGqgPgCU.js} +3 -3
  162. package/dist/chunks/prompt-BPJDGlx5.js +1 -0
  163. package/dist/chunks/prompt-DEdZzkEz.js +1 -0
  164. package/dist/chunks/promptEditor-CmQ9p4oe.js +4 -0
  165. package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-CJo9-PfZ.js} +2 -2
  166. package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CB17QimU.js} +2 -2
  167. package/dist/chunks/reconciler-DSKLuOS7.js +1 -0
  168. package/dist/chunks/refresh-BbZFCNpn.js +1 -0
  169. package/dist/chunks/registerProtocol-CLIpzVwF.js +1 -0
  170. package/dist/chunks/reload-plugins-DjugL8jH.js +1 -0
  171. package/dist/chunks/rename-DOtCOtEr.js +1 -0
  172. package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-Zqfm2U1y.js} +1 -1
  173. package/dist/chunks/resume-BB4T4WIV.js +2 -0
  174. package/dist/chunks/ripgrep-BuzOTf1S.js +5 -0
  175. package/dist/chunks/ripgrep-CZ2CqaHb.js +1 -0
  176. package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-CK_iZ6OB.js} +1 -1
  177. package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-CpP0L9T9.js} +4 -4
  178. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +1 -0
  179. package/dist/chunks/sandbox-toggle-KOHYvbQT.js +1 -0
  180. package/dist/chunks/searchExtraTools-CdJghGkj.js +1 -0
  181. package/dist/chunks/select-C_KXmqbI.js +1 -0
  182. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +1 -0
  183. package/dist/chunks/sessionObserver-DB-sLv-X.js +1 -0
  184. package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-WOYv2n7C.js} +2 -2
  185. package/dist/chunks/sessionStorage-sgOAbDn7.js +1 -0
  186. package/dist/chunks/{sessionTracing-fIp8g04N.js → sessionTracing-yBre24PH.js} +2 -2
  187. package/dist/chunks/settings-C-KNkvsM.js +1 -0
  188. package/dist/chunks/settings-DKN4xSpQ.js +24 -0
  189. package/dist/chunks/setup-CN_Pk7AR.js +3 -0
  190. package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-Df-kZ_pK.js} +1 -1
  191. package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-CMB8hfgX.js} +3 -3
  192. package/dist/chunks/sinks-BS17vtN0.js +1 -0
  193. package/dist/chunks/sinks-D1EjkHb4.js +1 -0
  194. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +1 -0
  195. package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CfmlO6pb.js} +2 -2
  196. package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BQ2LMfMx.js} +2 -2
  197. package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-BwYuwLFs.js} +4 -4
  198. package/dist/chunks/skills-BVHPQma0.js +1 -0
  199. package/dist/chunks/startupProfiler-B_U4QDtf.js +1 -0
  200. package/dist/chunks/startupProfiler-DTs9w9EN.js +3 -0
  201. package/dist/chunks/{state-D5D6QpTX.js → state-BowF111d.js} +1 -1
  202. package/dist/chunks/state-CGuyDES7.js +1 -0
  203. package/dist/chunks/status-BurdTfyz.js +2 -0
  204. package/dist/chunks/status-DMq1An5h.js +1 -0
  205. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +1 -0
  206. package/dist/chunks/stringUtils-BQm3OfeJ.js +4 -0
  207. package/dist/chunks/{switcher-DWfKi17X.js → switcher-Bq1Ct_Sn.js} +1 -1
  208. package/dist/chunks/switcher-DGD4ORVf.js +1 -0
  209. package/dist/chunks/{tasks-BwSsj2vI.js → tasks-0c8Uy04D.js} +1 -1
  210. package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
  211. package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-BdFzE9XG.js} +1 -1
  212. package/dist/chunks/terminalSetup-Cf_r6pwK.js +32 -0
  213. package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-D7J6bxcn.js} +1 -1
  214. package/dist/chunks/{theme-CAoGjf2D.js → theme-Bby4fssR.js} +1 -1
  215. package/dist/chunks/tipRegistry-CyRXWWTz.js +2 -0
  216. package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-CzFZUIsM.js} +1 -1
  217. package/dist/chunks/toolPool-CnrZcprA.js +1 -0
  218. package/dist/chunks/types-zk5Ltv5q.js +81 -0
  219. package/dist/chunks/udsClient-ftP0yIpe.js +1 -0
  220. package/dist/chunks/use-select-navigation-DMaC_3iw.js +1 -0
  221. package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
  222. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CjW3gUOt.js +1 -0
  223. package/dist/chunks/useMainLoopModel-DWscpA9I.js +1 -0
  224. package/dist/chunks/useManagePlugins-CYXVcql2.js +1 -0
  225. package/dist/chunks/useMergedTools-DarmnCEw.js +1 -0
  226. package/dist/chunks/useSearchInput-C2JuUW3g.js +1 -0
  227. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +1 -0
  228. package/dist/chunks/util-Bq5l7FF5.js +1 -0
  229. package/dist/chunks/validatePlugin-DIdEydz_.js +1 -0
  230. package/dist/chunks/{vim-xruiCyUd.js → vim-D8prM2IH.js} +1 -1
  231. package/dist/chunks/worktree-Caqt2WRZ.js +1 -0
  232. package/dist/cli.js +1 -1
  233. package/package.json +1 -1
  234. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
  235. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
  236. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
  237. package/dist/chunks/App-VWyPd524.js +0 -1
  238. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
  239. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
  240. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
  241. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
  242. package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
  243. package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
  244. package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
  245. package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
  246. package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
  247. package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
  248. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
  249. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
  250. package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
  251. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
  252. package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
  253. package/dist/chunks/Messages-Cykztq1O.js +0 -10
  254. package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
  255. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
  256. package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
  257. package/dist/chunks/REPL-B8e5UU3H.js +0 -128
  258. package/dist/chunks/REPL-C4mbOhyL.js +0 -1
  259. package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
  260. package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
  261. package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
  262. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
  263. package/dist/chunks/Settings-B7n_dfP-.js +0 -2
  264. package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
  265. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
  266. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
  267. package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
  268. package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
  269. package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
  270. package/dist/chunks/agents-D96ng5I9.js +0 -101
  271. package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
  272. package/dist/chunks/api-DTyrmy1O.js +0 -1
  273. package/dist/chunks/api-DumFOErN.js +0 -1
  274. package/dist/chunks/auth-CZ4EsFWF.js +0 -10
  275. package/dist/chunks/auth-QvonHoG9.js +0 -1
  276. package/dist/chunks/auth-jV5THRH8.js +0 -1
  277. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
  278. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
  279. package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
  280. package/dist/chunks/bg-qG2osBbP.js +0 -9
  281. package/dist/chunks/branch-K8X6jx0i.js +0 -2
  282. package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
  283. package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
  284. package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
  285. package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
  286. package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
  287. package/dist/chunks/btw-BNs5OX7x.js +0 -1
  288. package/dist/chunks/bundledMode--fG1S62b.js +0 -1
  289. package/dist/chunks/caches-CC5NHwAz.js +0 -1
  290. package/dist/chunks/caches-nHxJWXgO.js +0 -1
  291. package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
  292. package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
  293. package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
  294. package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
  295. package/dist/chunks/client-9uHzAmFH.js +0 -1
  296. package/dist/chunks/client-BVal_QII.js +0 -1
  297. package/dist/chunks/client-BtTkq0YS.js +0 -1
  298. package/dist/chunks/client-Dd7CKMRX.js +0 -1
  299. package/dist/chunks/commands-C_rYjyQZ.js +0 -1
  300. package/dist/chunks/compact-Cqd6vKpn.js +0 -2
  301. package/dist/chunks/config-Be0BkAAr.js +0 -1
  302. package/dist/chunks/config-DUTgj3js.js +0 -3
  303. package/dist/chunks/config-DoEDgAfv.js +0 -1
  304. package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
  305. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
  306. package/dist/chunks/conversation-DWfE4KGH.js +0 -1
  307. package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
  308. package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
  309. package/dist/chunks/createSession-CqHnHhCR.js +0 -1
  310. package/dist/chunks/createSession-DqTtBycR.js +0 -1
  311. package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
  312. package/dist/chunks/cwd-DLK3znO7.js +0 -1
  313. package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
  314. package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
  315. package/dist/chunks/detached-Biz-xhu0.js +0 -4
  316. package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
  317. package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
  318. package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
  319. package/dist/chunks/doctor-eNAm6OiS.js +0 -1
  320. package/dist/chunks/entry-DidpiR-D.js +0 -13
  321. package/dist/chunks/esm-BCUC71kt.js +0 -1
  322. package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
  323. package/dist/chunks/exit-DywUeiYd.js +0 -1
  324. package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
  325. package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
  326. package/dist/chunks/fast-DCXZACT9.js +0 -1
  327. package/dist/chunks/fast-Qo4WVqiW.js +0 -1
  328. package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
  329. package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
  330. package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
  331. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
  332. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
  333. package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
  334. package/dist/chunks/gemini-BXAyy1JN.js +0 -1
  335. package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
  336. package/dist/chunks/git-Wid-XppW.js +0 -5
  337. package/dist/chunks/git-hO-TMvXc.js +0 -1
  338. package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
  339. package/dist/chunks/goal-C9clrwEH.js +0 -3
  340. package/dist/chunks/grok-CjeCecsZ.js +0 -1
  341. package/dist/chunks/grove-DqTnK9nn.js +0 -7
  342. package/dist/chunks/hash-Tu-My5Vp.js +0 -1
  343. package/dist/chunks/help-Bb6LdzXK.js +0 -1
  344. package/dist/chunks/hooks-BX2s7aoL.js +0 -1
  345. package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
  346. package/dist/chunks/install-eCA8UACi.js +0 -1
  347. package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
  348. package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
  349. package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
  350. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
  351. package/dist/chunks/launchOnboarding-BeNf51Ig.js +0 -8
  352. package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
  353. package/dist/chunks/lib-BlVGipXx.js +0 -14
  354. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
  355. package/dist/chunks/localSearch-dodgnjGn.js +0 -1
  356. package/dist/chunks/log-CZ7ploQm.js +0 -1
  357. package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
  358. package/dist/chunks/main-7ssnA9Yb.js +0 -31
  359. package/dist/chunks/main-BEv6MqMX.js +0 -356
  360. package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
  361. package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
  362. package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
  363. package/dist/chunks/mcp-BUn3yqsT.js +0 -1
  364. package/dist/chunks/mcp-BskLq9iP.js +0 -2
  365. package/dist/chunks/mcp-C-0DMaXx.js +0 -6
  366. package/dist/chunks/memoize-CumjjK2Q.js +0 -1
  367. package/dist/chunks/memory-vDkJM58W.js +0 -1
  368. package/dist/chunks/mode-Dbh21H2Y.js +0 -2
  369. package/dist/chunks/model-BaMclMXn.js +0 -1
  370. package/dist/chunks/model-atn3_JBi.js +0 -1
  371. package/dist/chunks/model-vS1Iewyq.js +0 -1
  372. package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
  373. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
  374. package/dist/chunks/oauth-D38aRTUb.js +0 -1
  375. package/dist/chunks/oauth-U649LV5H.js +0 -1
  376. package/dist/chunks/omit-B7eQ9q0x.js +0 -1
  377. package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
  378. package/dist/chunks/openai-wh8AX5iz.js +0 -10
  379. package/dist/chunks/parser-Cq9X7HMP.js +0 -1
  380. package/dist/chunks/partition-CENvOfiS.js +0 -1
  381. package/dist/chunks/permissions-ChuIx-d4.js +0 -3
  382. package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
  383. package/dist/chunks/plugin-DVBEWwMP.js +0 -17
  384. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
  385. package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
  386. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
  387. package/dist/chunks/plugins-DdIaXpNb.js +0 -4
  388. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  389. package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
  390. package/dist/chunks/print-vxrRE1O2.js +0 -14
  391. package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
  392. package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
  393. package/dist/chunks/prompt-2AA5W7EH.js +0 -1
  394. package/dist/chunks/prompt-AXiS2LoO.js +0 -1
  395. package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
  396. package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
  397. package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
  398. package/dist/chunks/refresh-BSG0t4cf.js +0 -1
  399. package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
  400. package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
  401. package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
  402. package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
  403. package/dist/chunks/rename-BrEwj3Xw.js +0 -1
  404. package/dist/chunks/resume-DR5JbICs.js +0 -2
  405. package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
  406. package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
  407. package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
  408. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
  409. package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
  410. package/dist/chunks/session-wkRTfdo8.js +0 -2
  411. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
  412. package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
  413. package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
  414. package/dist/chunks/sessionState-8jutEorw.js +0 -11
  415. package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
  416. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
  417. package/dist/chunks/settings-BowI3jp-.js +0 -19
  418. package/dist/chunks/settings-CHn0gJCG.js +0 -1
  419. package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
  420. package/dist/chunks/setup-UiEO9i7F.js +0 -3
  421. package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
  422. package/dist/chunks/sinks-DnLqRPEC.js +0 -1
  423. package/dist/chunks/sinks-mGBiINp8.js +0 -1
  424. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
  425. package/dist/chunks/skills-DKtN17ch.js +0 -1
  426. package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
  427. package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
  428. package/dist/chunks/state-BStOuCh4.js +0 -1
  429. package/dist/chunks/stats-D4LEtkrw.js +0 -1
  430. package/dist/chunks/status-0ZBx6Ls0.js +0 -2
  431. package/dist/chunks/status-BUJ4-omB.js +0 -1
  432. package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
  433. package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
  434. package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
  435. package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
  436. package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
  437. package/dist/chunks/syncCache-DUhciJLz.js +0 -1
  438. package/dist/chunks/teleport-DwZMevmQ.js +0 -1
  439. package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
  440. package/dist/chunks/tmux-DA06aewY.js +0 -1
  441. package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
  442. package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
  443. package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
  444. package/dist/chunks/types-APu4OCXJ.js +0 -17
  445. package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
  446. package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
  447. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
  448. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
  449. package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
  450. package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
  451. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
  452. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
  453. package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
  454. package/dist/chunks/util-DU63xTwZ.js +0 -1
  455. package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
  456. package/dist/chunks/which-B8rchd8P.js +0 -1
  457. package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
  458. package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
  459. package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
  460. package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
  461. package/dist/chunks/worktree-C28I8mFB.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DcaKZlRU.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{Ut as l,ft as u}from"./state-D5D6QpTX.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r?.[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i?.[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,x,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,S=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new x({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Ie(t,a,r,i,o):t===401?new Le(t,a,r,i,o):t===403?new Re(t,a,r,i,o):t===404?new ze(t,a,r,i,o):t===409?new Be(t,a,r,i,o):t===422?new Ve(t,a,r,i,o):t===429?new He(t,a,r,i,o):t>=500?new Ue(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},x=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Fe=class extends x{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Ie=class extends y{},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{}}));function We(e){return typeof e==`object`?e??{}:{}}function Ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qe,Je,Ye,Xe,Ze,Qe,$e=e((()=>{S(),qe=/^[a-z][a-z0-9+.-]*:/i,Je=e=>qe.test(e),Ye=e=>(Ye=Array.isArray,Ye(e)),Xe=Ye,Ze=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},Qe=e=>{try{return JSON.parse(e)}catch{return}}})),et,tt=e((()=>{et=e=>new Promise(t=>setTimeout(t,e))})),C,nt=e((()=>{C=`0.81.0`}));function rt(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function it(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var at,ot,st,ct,lt,ut,dt=e((()=>{nt(),at=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,ot=()=>{let e=rt();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(Deno.build.os),"X-Stainless-Arch":st(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(globalThis.process.platform??`unknown`),"X-Stainless-Arch":st(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=it();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},st=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,ct=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),ut=()=>lt??(lt=ot())}));function ft(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function pt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function mt(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return pt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ht(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gt(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var _t=e((()=>{})),vt,yt=e((()=>{vt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function bt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var xt=e((()=>{S()}));function St(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ct(e){let t;return(Tt??(t=new globalThis.TextEncoder,Tt=t.encode.bind(t)))(e)}function wt(e){let t;return(Et??(t=new globalThis.TextDecoder,Et=t.decode.bind(t)))(e)}var Tt,Et,Dt=e((()=>{}));function Ot(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function kt(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var w,T,At,jt=e((()=>{_(),Dt(),At=class{constructor(){w.set(this,void 0),T.set(this,void 0),h(this,w,new Uint8Array,`f`),h(this,T,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ct(e):e;h(this,w,St([g(this,w,`f`),t]),`f`);let n=[],r;for(;(r=Ot(g(this,w,`f`),g(this,T,`f`)))!=null;){if(r.carriage&&g(this,T,`f`)==null){h(this,T,r.index,`f`);continue}if(g(this,T,`f`)!=null&&(r.index!==g(this,T,`f`)+1||r.carriage)){n.push(wt(g(this,w,`f`).subarray(0,g(this,T,`f`)-1))),h(this,w,g(this,w,`f`).subarray(g(this,T,`f`)),`f`),h(this,T,null,`f`);continue}let e=g(this,T,`f`)===null?r.preceding:r.preceding-1,t=wt(g(this,w,`f`).subarray(0,e));n.push(t),h(this,w,g(this,w,`f`).subarray(r.index),`f`),h(this,T,null,`f`)}return n}flush(){return g(this,w,`f`).length?this.decode(`
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{i,l as a,o}from"./envUtils-DcaKZlRU.js";import{n as s,t as c}from"./defineProperty-C-QyHrDq.js";import{ut as l,zt as u}from"./state-BowF111d.js";import{a as ee,n as d}from"./process-gEbdy6uY.js";import{homedir as f}from"os";import*as p from"path";import{dirname as te,join as ne,resolve as re}from"path";import*as m from"fs";import{closeSync as ie,fsyncSync as ae,openSync as oe,writeFileSync as se}from"fs";import{appendFile as ce,mkdir as le,open as ue,readFile as de,readdir as fe,rename as pe,rm as me,rmdir as he,stat as ge,symlink as _e,unlink as ve}from"fs/promises";function ye({writeFn:e,flushIntervalMs:t=1e3,maxBufferSize:n=100,maxBufferBytes:r=1/0,immediateMode:i=!1}){let a=[],o=0,s=null,c=null;function l(){s&&(clearTimeout(s),s=null)}function u(){c&&(e(c.join(``)),c=null),a.length!==0&&(e(a.join(``)),a=[],o=0,l())}function ee(){s||(s=setTimeout(u,t))}function d(){if(c){c.push(...a),a=[],o=0,l();return}let t=a;a=[],o=0,l(),c=t,setImmediate(()=>{let t=c;c=null,t&&e(t.join(``))})}return{write(t){if(i){e(t);return}a.push(t),o+=t.length,ee(),(a.length>=n||o>=r)&&d()},flush:u,dispose(){u()}}}var be=e((()=>{}));function xe(e){return Ce.add(e),()=>Ce.delete(e)}async function Se(){await Promise.all(Array.from(Ce).map(e=>e()))}var Ce,we=e((()=>{Ce=new Set}));function Te(e){let t=[],n=e.match(/^MCP server ["']([^"']+)["']/);if(n?.[1])t.push(`mcp`),t.push(n[1].toLowerCase());else{let n=e.match(/^([^:[]+):/);n?.[1]&&t.push(n[1].trim().toLowerCase())}let r=e.match(/^\[([^\]]+)]/);r?.[1]&&t.push(r[1].trim().toLowerCase()),e.toLowerCase().includes(`1p event:`)&&t.push(`1p`);let i=e.match(/:\s*([^:]+?)(?:\s+(?:type|mode|status|event))?:/);if(i?.[1]){let e=i[1].trim().toLowerCase();e.length<30&&!e.includes(` `)&&t.push(e)}return Array.from(new Set(t))}function Ee(e,t){return t?e.length===0?!1:t.isExclusive?!e.some(e=>t.exclude.includes(e)):e.some(e=>t.include.includes(e)):!0}function De(e,t){return!t||Ee(Te(e),t)}var Oe,ke=e((()=>{r(),Oe=n(e=>{if(!e||e.trim()===``)return null;let t=e.split(`,`).map(e=>e.trim()).filter(Boolean);if(t.length===0)return null;let n=t.some(e=>e.startsWith(`!`)),r=t.some(e=>!e.startsWith(`!`));if(n&&r)return null;let i=t.map(e=>e.replace(/^!/,``).toLowerCase());return{include:n?[]:i,exclude:n?i:[],isExclusive:n}})}));function h(e,t,n,r,i){if(r===`m`)throw TypeError(`Private method is not writable`);if(r===`a`&&!i)throw TypeError(`Private accessor was defined without a setter`);if(typeof t==`function`?e!==t||!i:!t.has(e))throw TypeError(`Cannot write private member to an object whose class did not declare it`);return r===`a`?i.call(e,n):i?i.value=n:t.set(e,n),n}function g(e,t,n,r){if(n===`a`&&!r)throw TypeError(`Private accessor was defined without a getter`);if(typeof t==`function`?e!==t||!r:!t.has(e))throw TypeError(`Cannot read private member from an object whose class did not declare it`);return n===`m`?r:n===`a`?r.call(e):r?r.value:t.get(e)}var _=e((()=>{})),Ae,je=e((()=>{Ae=function(){let{crypto:e}=globalThis;if(e?.randomUUID)return Ae=e.randomUUID.bind(e),e.randomUUID();let t=new Uint8Array(1),n=e?()=>e.getRandomValues(t)[0]:()=>Math.random()*255&255;return`10000000-1000-4000-8000-100000000000`.replace(/[018]/g,e=>(e^n()&15>>e/4).toString(16))}}));function Me(e){return typeof e==`object`&&!!e&&(`name`in e&&e.name===`AbortError`||`message`in e&&String(e.message).includes(`FetchRequestCanceledException`))}var Ne,Pe=e((()=>{Ne=e=>{if(e instanceof Error)return e;if(typeof e==`object`&&e){try{if(Object.prototype.toString.call(e)===`[object Error]`){let t=Error(e.message,e.cause?{cause:e.cause}:{});return e.stack&&(t.stack=e.stack),e.cause&&!t.cause&&(t.cause=e.cause),e.name&&(t.name=e.name),t}}catch{}try{return Error(JSON.stringify(e))}catch{}}return Error(e)}})),v,y,b,x,Fe,Ie,Le,Re,ze,Be,Ve,He,Ue,S=e((()=>{Pe(),v=class extends Error{},y=class e extends v{constructor(t,n,r,i,a){super(`${e.makeMessage(t,n,r)}`),this.status=t,this.headers=i,this.requestID=i?.get(`request-id`),this.error=n,this.type=a??null}static makeMessage(e,t,n){let r=t?.message?typeof t.message==`string`?t.message:JSON.stringify(t.message):t?JSON.stringify(t):n;return e&&r?`${e} ${r}`:e?`${e} status code (no body)`:r||`(no status code or body)`}static generate(t,n,r,i){if(!t||!i)return new x({message:r,cause:Ne(n)});let a=n,o=a?.error?.type;return t===400?new Ie(t,a,r,i,o):t===401?new Le(t,a,r,i,o):t===403?new Re(t,a,r,i,o):t===404?new ze(t,a,r,i,o):t===409?new Be(t,a,r,i,o):t===422?new Ve(t,a,r,i,o):t===429?new He(t,a,r,i,o):t>=500?new Ue(t,a,r,i,o):new e(t,a,r,i,o)}},b=class extends y{constructor({message:e}={}){super(void 0,void 0,e||`Request was aborted.`,void 0)}},x=class extends y{constructor({message:e,cause:t}){super(void 0,void 0,e||`Connection error.`,void 0),t&&(this.cause=t)}},Fe=class extends x{constructor({message:e}={}){super({message:e??`Request timed out.`})}},Ie=class extends y{},Le=class extends y{},Re=class extends y{},ze=class extends y{},Be=class extends y{},Ve=class extends y{},He=class extends y{},Ue=class extends y{}}));function We(e){return typeof e==`object`?e??{}:{}}function Ge(e){if(!e)return!0;for(let t in e)return!1;return!0}function Ke(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var qe,Je,Ye,Xe,Ze,Qe,$e=e((()=>{S(),qe=/^[a-z][a-z0-9+.-]*:/i,Je=e=>qe.test(e),Ye=e=>(Ye=Array.isArray,Ye(e)),Xe=Ye,Ze=(e,t)=>{if(typeof t!=`number`||!Number.isInteger(t))throw new v(`${e} must be an integer`);if(t<0)throw new v(`${e} must be a positive integer`);return t},Qe=e=>{try{return JSON.parse(e)}catch{return}}})),et,tt=e((()=>{et=e=>new Promise(t=>setTimeout(t,e))})),C,nt=e((()=>{C=`0.81.0`}));function rt(){return typeof Deno<`u`&&Deno.build!=null?`deno`:typeof EdgeRuntime<`u`?`edge`:Object.prototype.toString.call(globalThis.process===void 0?0:globalThis.process)===`[object process]`?`node`:`unknown`}function it(){if(typeof navigator>`u`||!navigator)return null;for(let{key:e,pattern:t}of[{key:`edge`,pattern:/Edge(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/MSIE(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`ie`,pattern:/Trident(?:.*rv\:(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`chrome`,pattern:/Chrome(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`firefox`,pattern:/Firefox(?:\W+(\d+)\.(\d+)(?:\.(\d+))?)?/},{key:`safari`,pattern:/(?:Version\W+(\d+)\.(\d+)(?:\.(\d+))?)?(?:\W+Mobile\S*)?\W+Safari/}]){let n=t.exec(navigator.userAgent);if(n)return{browser:e,version:`${n[1]||0}.${n[2]||0}.${n[3]||0}`}}return null}var at,ot,st,ct,lt,ut,dt=e((()=>{nt(),at=()=>typeof window<`u`&&window.document!==void 0&&typeof navigator<`u`,ot=()=>{let e=rt();if(e===`deno`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(Deno.build.os),"X-Stainless-Arch":st(Deno.build.arch),"X-Stainless-Runtime":`deno`,"X-Stainless-Runtime-Version":typeof Deno.version==`string`?Deno.version:Deno.version?.deno??`unknown`};if(typeof EdgeRuntime<`u`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`other:${EdgeRuntime}`,"X-Stainless-Runtime":`edge`,"X-Stainless-Runtime-Version":globalThis.process.version};if(e===`node`)return{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":ct(globalThis.process.platform??`unknown`),"X-Stainless-Arch":st(globalThis.process.arch??`unknown`),"X-Stainless-Runtime":`node`,"X-Stainless-Runtime-Version":globalThis.process.version??`unknown`};let t=it();return t?{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`browser:${t.browser}`,"X-Stainless-Runtime-Version":t.version}:{"X-Stainless-Lang":`js`,"X-Stainless-Package-Version":C,"X-Stainless-OS":`Unknown`,"X-Stainless-Arch":`unknown`,"X-Stainless-Runtime":`unknown`,"X-Stainless-Runtime-Version":`unknown`}},st=e=>e===`x32`?`x32`:e===`x86_64`||e===`x64`?`x64`:e===`arm`?`arm`:e===`aarch64`||e===`arm64`?`arm64`:e?`other:${e}`:`unknown`,ct=e=>(e=e.toLowerCase(),e.includes(`ios`)?`iOS`:e===`android`?`Android`:e===`darwin`?`MacOS`:e===`win32`?`Windows`:e===`freebsd`?`FreeBSD`:e===`openbsd`?`OpenBSD`:e===`linux`?`Linux`:e?`Other:${e}`:`Unknown`),ut=()=>lt??(lt=ot())}));function ft(){if(typeof fetch<`u`)return fetch;throw Error("`fetch` is not defined as a global; Either pass `fetch` to the client, `new Anthropic({ fetch })` or polyfill the global, `globalThis.fetch = fetch`")}function pt(...e){let t=globalThis.ReadableStream;if(t===void 0)throw Error("`ReadableStream` is not defined as a global; You will need to polyfill it, `globalThis.ReadableStream = ReadableStream`");return new t(...e)}function mt(e){let t=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator]();return pt({start(){},async pull(e){let{done:n,value:r}=await t.next();n?e.close():e.enqueue(r)},async cancel(){await t.return?.()}})}function ht(e){if(e[Symbol.asyncIterator])return e;let t=e.getReader();return{async next(){try{let e=await t.read();return e?.done&&t.releaseLock(),e}catch(e){throw t.releaseLock(),e}},async return(){let e=t.cancel();return t.releaseLock(),await e,{done:!0,value:void 0}},[Symbol.asyncIterator](){return this}}}async function gt(e){if(typeof e!=`object`||!e)return;if(e[Symbol.asyncIterator]){await e[Symbol.asyncIterator]().return?.();return}let t=e.getReader(),n=t.cancel();t.releaseLock(),await n}var _t=e((()=>{})),vt,yt=e((()=>{vt=({headers:e,body:t})=>({bodyHeaders:{"content-type":`application/json`},body:JSON.stringify(t)})}));function bt(e){return Object.entries(e).filter(([e,t])=>t!==void 0).map(([e,t])=>{if(typeof t==`string`||typeof t==`number`||typeof t==`boolean`)return`${encodeURIComponent(e)}=${encodeURIComponent(t)}`;if(t===null)return`${encodeURIComponent(e)}=`;throw new v(`Cannot stringify type ${typeof t}; Expected string, number, boolean, or null. If you need to pass nested query parameters, you can manually encode them, e.g. { query: { 'foo[key1]': value1, 'foo[key2]': value2 } }, and please open a GitHub issue requesting better support for your use case.`)}).join(`&`)}var xt=e((()=>{S()}));function St(e){let t=0;for(let n of e)t+=n.length;let n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}function Ct(e){let t;return(Tt??(t=new globalThis.TextEncoder,Tt=t.encode.bind(t)))(e)}function wt(e){let t;return(Et??(t=new globalThis.TextDecoder,Et=t.decode.bind(t)))(e)}var Tt,Et,Dt=e((()=>{}));function Ot(e,t){for(let n=t??0;n<e.length;n++){if(e[n]===10)return{preceding:n,index:n+1,carriage:!1};if(e[n]===13)return{preceding:n,index:n+1,carriage:!0}}return null}function kt(e){for(let t=0;t<e.length-1;t++){if(e[t]===10&&e[t+1]===10||e[t]===13&&e[t+1]===13)return t+2;if(e[t]===13&&e[t+1]===10&&t+3<e.length&&e[t+2]===13&&e[t+3]===10)return t+4}return-1}var w,T,At,jt=e((()=>{_(),Dt(),At=class{constructor(){w.set(this,void 0),T.set(this,void 0),h(this,w,new Uint8Array,`f`),h(this,T,null,`f`)}decode(e){if(e==null)return[];let t=e instanceof ArrayBuffer?new Uint8Array(e):typeof e==`string`?Ct(e):e;h(this,w,St([g(this,w,`f`),t]),`f`);let n=[],r;for(;(r=Ot(g(this,w,`f`),g(this,T,`f`)))!=null;){if(r.carriage&&g(this,T,`f`)==null){h(this,T,r.index,`f`);continue}if(g(this,T,`f`)!=null&&(r.index!==g(this,T,`f`)+1||r.carriage)){n.push(wt(g(this,w,`f`).subarray(0,g(this,T,`f`)-1))),h(this,w,g(this,w,`f`).subarray(g(this,T,`f`)),`f`),h(this,T,null,`f`);continue}let e=g(this,T,`f`)===null?r.preceding:r.preceding-1,t=wt(g(this,w,`f`).subarray(0,e));n.push(t),h(this,w,g(this,w,`f`).subarray(r.index),`f`),h(this,T,null,`f`)}return n}flush(){return g(this,w,`f`).length?this.decode(`
2
2
  `):[]}},w=new WeakMap,T=new WeakMap,At.NEWLINE_CHARS=new Set([`
3
3
  `,`\r`]),At.NEWLINE_REGEXP=/\r\n|[\n\r]/g}));function Mt(){}function Nt(e,t,n){return!t||Pt[e]>Pt[n]?Mt:t[e].bind(t)}function E(e){let t=e.logger,n=e.logLevel??`off`;if(!t)return It;let r=Lt.get(t);if(r&&r[0]===n)return r[1];let i={error:Nt(`error`,t,n),warn:Nt(`warn`,t,n),info:Nt(`info`,t,n),debug:Nt(`debug`,t,n)};return Lt.set(t,[n,i]),i}var Pt,Ft,It,Lt,D,Rt=e((()=>{$e(),Pt={off:0,error:200,warn:300,info:400,debug:500},Ft=(e,t,n)=>{if(e){if(Ke(Pt,e))return e;E(n).warn(`${t} was set to ${JSON.stringify(e)}, expected one of ${JSON.stringify(Object.keys(Pt))}`)}},It={error:Mt,warn:Mt,info:Mt,debug:Mt},Lt=new WeakMap,D=e=>(e.options&&(e.options={...e.options},delete e.options.headers),e.headers&&(e.headers=Object.fromEntries((e.headers instanceof Headers?[...e.headers]:Object.entries(e.headers)).map(([e,t])=>[e,e.toLowerCase()===`x-api-key`||e.toLowerCase()===`authorization`||e.toLowerCase()===`cookie`||e.toLowerCase()===`set-cookie`?`***`:t]))),`retryOfRequestLogID`in e&&(e.retryOfRequestLogID&&(e.retryOf=e.retryOfRequestLogID),delete e.retryOfRequestLogID),e)}));async function*zt(e,t){if(!e.body)throw t.abort(),globalThis.navigator!==void 0&&globalThis.navigator.product===`ReactNative`?new v(`The default react-native fetch implementation does not support streaming. Please use expo/fetch: https://docs.expo.dev/versions/latest/sdk/expo/#expofetch-api`):new v(`Attempted to iterate over a response with no body`);let n=new Wt,r=new At,i=ht(e.body);for await(let e of Bt(i))for(let t of r.decode(e)){let e=n.decode(t);e&&(yield e)}for(let e of r.flush()){let t=n.decode(e);t&&(yield t)}}async function*Bt(e){let t=new Uint8Array;for await(let n of e){if(n==null)continue;let e=n instanceof ArrayBuffer?new Uint8Array(n):typeof n==`string`?Ct(n):n,r=new Uint8Array(t.length+e.length);r.set(t),r.set(e,t.length),t=r;let i;for(;(i=kt(t))!==-1;)yield t.slice(0,i),t=t.slice(i)}t.length>0&&(yield t)}function Vt(e,t){let n=e.indexOf(t);return n===-1?[e,``,``]:[e.substring(0,n),t,e.substring(n+t.length)]}var Ht,Ut,Wt,Gt=e((()=>{_(),S(),_t(),jt(),Pe(),$e(),Dt(),Rt(),Ut=class e{constructor(e,t,n){this.iterator=e,Ht.set(this,void 0),this.controller=t,h(this,Ht,n,`f`)}static fromSSEResponse(t,n,r){let i=!1,a=r?E(r):console;async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let e of zt(t,n)){if(e.event===`completion`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event===`message_start`||e.event===`message_delta`||e.event===`message_stop`||e.event===`content_block_start`||e.event===`content_block_delta`||e.event===`content_block_stop`)try{yield JSON.parse(e.data)}catch(t){throw a.error(`Could not parse message into JSON:`,e.data),a.error(`From chunk:`,e.raw),t}if(e.event!==`ping`&&e.event===`error`){let n=Qe(e.data)??e.data,r=n?.error?.type;throw new y(void 0,n,void 0,t.headers,r)}}e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}static fromReadableStream(t,n,r){let i=!1;async function*a(){let e=new At,n=ht(t);for await(let t of n)for(let n of e.decode(t))yield n;for(let t of e.flush())yield t}async function*o(){if(i)throw new v("Cannot iterate over a consumed stream, use `.tee()` to split the stream.");i=!0;let e=!1;try{for await(let t of a())e||t&&(yield JSON.parse(t));e=!0}catch(e){if(Me(e))return;throw e}finally{e||n.abort()}}return new e(o,n,r)}[(Ht=new WeakMap,Symbol.asyncIterator)](){return this.iterator()}tee(){let t=[],n=[],r=this.iterator(),i=e=>({next:()=>{if(e.length===0){let e=r.next();t.push(e),n.push(e)}return e.shift()}});return[new e(()=>i(t),this.controller,g(this,Ht,`f`)),new e(()=>i(n),this.controller,g(this,Ht,`f`))]}toReadableStream(){let e=this,t;return pt({async start(){t=e[Symbol.asyncIterator]()},async pull(e){try{let{value:n,done:r}=await t.next();if(r)return e.close();let i=Ct(JSON.stringify(n)+`
4
4
  `);e.enqueue(i)}catch(t){e.error(t)}},async cancel(){await t.return?.()}})}},Wt=class{constructor(){this.event=null,this.data=[],this.chunks=[]}decode(e){if(e.endsWith(`\r`)&&(e=e.substring(0,e.length-1)),!e){if(!this.event&&!this.data.length)return null;let e={event:this.event,data:this.data.join(`
@@ -34,6 +34,6 @@ you can set the \`dangerouslyAllowBrowser\` option to \`true\`, e.g.,
34
34
  new Anthropic({ apiKey, dangerouslyAllowBrowser: true });
35
35
  `);this.baseURL=i.baseURL,this.timeout=i.timeout??zi.DEFAULT_TIMEOUT,this.logger=i.logger??console;let a=`warn`;this.logLevel=a,this.logLevel=Ft(i.logLevel,`ClientOptions.logLevel`,this)??Ft(Ii(`ANTHROPIC_LOG`),`process.env['ANTHROPIC_LOG']`,this)??a,this.fetchOptions=i.fetchOptions,this.maxRetries=i.maxRetries??2,this.fetch=i.fetch??ft(),h(this,Bi,vt,`f`),this._options=i,this.apiKey=typeof t==`string`?t:null,this.authToken=n}withOptions(e){return new this.constructor({...this._options,baseURL:this.baseURL,maxRetries:this.maxRetries,timeout:this.timeout,logger:this.logger,logLevel:this.logLevel,fetch:this.fetch,fetchOptions:this.fetchOptions,apiKey:this.apiKey,authToken:this.authToken,...e})}defaultQuery(){return this._options.defaultQuery}validateHeaders({values:e,nulls:t}){if(!(e.get(`x-api-key`)||e.get(`authorization`))&&!(this.apiKey&&e.get(`x-api-key`))&&!t.has(`x-api-key`)&&!(this.authToken&&e.get(`authorization`))&&!t.has(`authorization`))throw Error(`Could not resolve authentication method. Expected either apiKey or authToken to be set. Or for one of the "X-Api-Key" or "Authorization" headers to be explicitly omitted`)}async authHeaders(e){return M([await this.apiKeyAuth(e),await this.bearerAuth(e)])}async apiKeyAuth(e){if(this.apiKey!=null)return M([{"X-Api-Key":this.apiKey}])}async bearerAuth(e){if(this.authToken!=null)return M([{Authorization:`Bearer ${this.authToken}`}])}stringifyQuery(e){return bt(e)}getUserAgent(){return`${this.constructor.name}/JS ${C}`}defaultIdempotencyKey(){return`stainless-node-retry-${Ae()}`}makeStatusError(e,t,n,r){return y.generate(e,t,n,r)}buildURL(e,t,n){let r=!g(this,Ri,`m`,Vi).call(this)&&n||this.baseURL,i=Je(e)?new URL(e):new URL(r+(r.endsWith(`/`)&&e.startsWith(`/`)?e.slice(1):e)),a=this.defaultQuery(),o=Object.fromEntries(i.searchParams);return(!Ge(a)||!Ge(o))&&(t={...o,...a,...t}),typeof t==`object`&&t&&!Array.isArray(t)&&(i.search=this.stringifyQuery(t)),i.toString()}_calculateNonstreamingTimeout(e){if(3600*e/128e3>600)throw new v(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#streaming-responses for more details`);return 600*1e3}async prepareOptions(e){}async prepareRequest(e,{url:t,options:n}){}get(e,t){return this.methodRequest(`get`,e,t)}post(e,t){return this.methodRequest(`post`,e,t)}patch(e,t){return this.methodRequest(`patch`,e,t)}put(e,t){return this.methodRequest(`put`,e,t)}delete(e,t){return this.methodRequest(`delete`,e,t)}methodRequest(e,t,n){return this.request(Promise.resolve(n).then(n=>({method:e,path:t,...n})))}request(e,t=null){return new Xt(this,this.makeRequest(e,t,void 0))}async makeRequest(e,t,n){let r=await e,i=r.maxRetries??this.maxRetries;t??(t=i),await this.prepareOptions(r);let{req:a,url:o,timeout:s}=await this.buildRequest(r,{retryCount:i-t});await this.prepareRequest(a,{url:o,options:r});let c=`log_`+(Math.random()*(1<<24)|0).toString(16).padStart(6,`0`),l=n===void 0?``:`, retryOf: ${n}`,u=Date.now();if(E(this).debug(`[${c}] sending request`,D({retryOfRequestLogID:n,method:r.method,url:o,options:r,headers:a.headers})),r.signal?.aborted)throw new b;let ee=new AbortController,d=await this.fetchWithTimeout(o,a,s,ee).catch(Ne),f=Date.now();if(d instanceof globalThis.Error){let e=`retrying, ${t} attempts remaining`;if(r.signal?.aborted)throw new b;let i=Me(d)||/timed? ?out/i.test(String(d)+(`cause`in d?String(d.cause):``));if(t)return E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - ${e}`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (${e})`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),this.retryRequest(r,t,n??c);throw E(this).info(`[${c}] connection ${i?`timed out`:`failed`} - error; no more retries left`),E(this).debug(`[${c}] connection ${i?`timed out`:`failed`} (error; no more retries left)`,D({retryOfRequestLogID:n,url:o,durationMs:f-u,message:d.message})),i?new Fe:new x({cause:d})}let p=`[${c}${l}${[...d.headers.entries()].filter(([e])=>e===`request-id`).map(([e,t])=>`, `+e+`: `+JSON.stringify(t)).join(``)}] ${a.method} ${o} ${d.ok?`succeeded`:`failed`} with status ${d.status} in ${f-u}ms`;if(!d.ok){let e=await this.shouldRetry(d);if(t&&e){let e=`retrying, ${t} attempts remaining`;return await gt(d.body),E(this).info(`${p} - ${e}`),E(this).debug(`[${c}] response error (${e})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),this.retryRequest(r,t,n??c,d.headers)}let i=e?`error; no more retries left`:`error; not retryable`;E(this).info(`${p} - ${i}`);let a=await d.text().catch(e=>Ne(e).message),o=Qe(a),s=o?void 0:a;throw E(this).debug(`[${c}] response error (${i})`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,message:s,durationMs:Date.now()-u})),this.makeStatusError(d.status,o,s,d.headers)}return E(this).info(p),E(this).debug(`[${c}] response start`,D({retryOfRequestLogID:n,url:d.url,status:d.status,headers:d.headers,durationMs:f-u})),{response:d,options:r,controller:ee,requestLogID:c,retryOfRequestLogID:n,startTime:u}}getAPIList(e,t,n){return this.requestAPIList(t,n&&`then`in n?n.then(t=>({method:`get`,path:e,...t})):{method:`get`,path:e,...n})}requestAPIList(e,t){let n=this.makeRequest(t,null,void 0);return new en(this,n,e)}async fetchWithTimeout(e,t,n,r){let{signal:i,method:a,...o}=t||{},s=this._makeAbort(r);i&&i.addEventListener(`abort`,s,{once:!0});let c=setTimeout(s,n),l=globalThis.ReadableStream&&o.body instanceof globalThis.ReadableStream||typeof o.body==`object`&&o.body!==null&&Symbol.asyncIterator in o.body,u={signal:r.signal,...l?{duplex:`half`}:{},method:`GET`,...o};a&&(u.method=a.toUpperCase());try{return await this.fetch.call(void 0,e,u)}finally{clearTimeout(c)}}async shouldRetry(e){let t=e.headers.get(`x-should-retry`);return t===`true`?!0:t===`false`?!1:e.status===408||e.status===409||e.status===429||e.status>=500}async retryRequest(e,t,n,r){let i,a=r?.get(`retry-after-ms`);if(a){let e=parseFloat(a);Number.isNaN(e)||(i=e)}let o=r?.get(`retry-after`);if(o&&!i){let e=parseFloat(o);i=Number.isNaN(e)?Date.parse(o)-Date.now():e*1e3}if(i===void 0){let n=e.maxRetries??this.maxRetries;i=this.calculateDefaultRetryTimeoutMillis(t,n)}return await et(i),this.makeRequest(e,t-1,n)}calculateDefaultRetryTimeoutMillis(e,t){let n=t-e;return Math.min(.5*2**n,8)*(1-Math.random()*.25)*1e3}calculateNonstreamingTimeout(e,t){let n=600*1e3;if(36e5*e/128e3>n||t!=null&&e>t)throw new v(`Streaming is required for operations that may take longer than 10 minutes. See https://github.com/anthropics/anthropic-sdk-typescript#long-requests for more details`);return n}async buildRequest(e,{retryCount:t=0}={}){let n={...e},{method:r,path:i,query:a,defaultBaseURL:o}=n,s=this.buildURL(i,a,o);`timeout`in n&&Ze(`timeout`,n.timeout),n.timeout=n.timeout??this.timeout;let{bodyHeaders:c,body:l}=this.buildBody({options:n});return{req:{method:r,headers:await this.buildHeaders({options:e,method:r,bodyHeaders:c,retryCount:t}),...n.signal&&{signal:n.signal},...globalThis.ReadableStream&&l instanceof globalThis.ReadableStream&&{duplex:`half`},...l&&{body:l},...this.fetchOptions??{},...n.fetchOptions??{}},url:s,timeout:n.timeout}}async buildHeaders({options:e,method:t,bodyHeaders:n,retryCount:r}){let i={};this.idempotencyHeader&&t!==`get`&&(e.idempotencyKey||(e.idempotencyKey=this.defaultIdempotencyKey()),i[this.idempotencyHeader]=e.idempotencyKey);let a=M([i,{Accept:`application/json`,"User-Agent":this.getUserAgent(),"X-Stainless-Retry-Count":String(r),...e.timeout?{"X-Stainless-Timeout":String(Math.trunc(e.timeout/1e3))}:{},...ut(),...this._options.dangerouslyAllowBrowser?{"anthropic-dangerous-direct-browser-access":`true`}:void 0,"anthropic-version":`2023-06-01`},await this.authHeaders(e),this._options.defaultHeaders,n,e.headers]);return this.validateHeaders(a),a.values}_makeAbort(e){return()=>e.abort()}buildBody({options:{body:e,headers:t}}){if(!e)return{bodyHeaders:void 0,body:void 0};let n=M([t]);return ArrayBuffer.isView(e)||e instanceof ArrayBuffer||e instanceof DataView||typeof e==`string`&&n.values.has(`content-type`)||globalThis.Blob&&e instanceof globalThis.Blob||e instanceof FormData||e instanceof URLSearchParams||globalThis.ReadableStream&&e instanceof globalThis.ReadableStream?{bodyHeaders:void 0,body:e}:typeof e==`object`&&(Symbol.asyncIterator in e||Symbol.iterator in e&&`next`in e&&typeof e.next==`function`)?{bodyHeaders:void 0,body:mt(e)}:typeof e==`object`&&n.values.get(`content-type`)===`application/x-www-form-urlencoded`?{bodyHeaders:{"content-type":`application/x-www-form-urlencoded`},body:this.stringifyQuery(e)}:g(this,Bi,`f`).call(this,{body:e,headers:n})}},zi=Z,Bi=new WeakMap,Ri=new WeakSet,Vi=function(){return this.baseURL!==`https://api.anthropic.com`},Z.Anthropic=zi,Z.HUMAN_PROMPT=Hi,Z.AI_PROMPT=Ui,Z.DEFAULT_TIMEOUT=6e5,Z.AnthropicError=v,Z.APIError=y,Z.APIConnectionError=x,Z.APIConnectionTimeoutError=Fe,Z.APIUserAbortError=b,Z.NotFoundError=ze,Z.ConflictError=Be,Z.RateLimitError=He,Z.BadRequestError=Ie,Z.AuthenticationError=Le,Z.InternalServerError=Ue,Z.PermissionDeniedError=Re,Z.UnprocessableEntityError=Ve,Z.toFile=mn,Wi=class extends Z{constructor(){super(...arguments),this.completions=new Xr(this),this.messages=new ki(this),this.models=new Ni(this),this.beta=new K(this)}},Wi.Completions=Xr,Wi.Messages=ki,Wi.Models=Ni,Wi.Beta=K})),Ki=e((()=>{Gi(),xn(),Zt(),O(),S()}));function qi(e){return e instanceof aa||e instanceof b||e instanceof Error&&e.name===`AbortError`}function Ji(e,t){return e instanceof Error&&e.message===t}function Yi(e){return e instanceof Error?e:Error(String(e))}function Xi(e){return e instanceof Error?e.message:String(e)}function Zi(e){if(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`)return e.code}function Qi(e){return Zi(e)===`ENOENT`}function $i(e){if(e&&typeof e==`object`&&`path`in e&&typeof e.path==`string`)return e.path}function ea(e,t=5){if(!(e instanceof Error))return String(e);if(!e.stack)return e.message;let n=e.stack.split(`
36
36
  `),r=n[0]??e.message,i=n.slice(1).filter(e=>e.trim().startsWith(`at `));return i.length<=t?e.stack:[r,...i.slice(0,t)].join(`
37
- `)}function ta(e){let t=Zi(e);return t===`ENOENT`||t===`EACCES`||t===`EPERM`||t===`ENOTDIR`||t===`ELOOP`}function na(e){let t=Xi(e);if(!e||typeof e!=`object`||!(`isAxiosError`in e)||!e.isAxiosError)return{kind:`other`,message:t};let n=e,r=n.response?.status;return r===401||r===403?{kind:`auth`,status:r,message:t}:n.code===`ECONNABORTED`?{kind:`timeout`,status:r,message:t}:n.code===`ECONNREFUSED`||n.code===`ENOTFOUND`?{kind:`network`,status:r,message:t}:{kind:`http`,status:r,message:t}}var ra,ia,aa,oa,sa,ca,la,ua=e((()=>{Ki(),s(),ra=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},ia=class extends Error{},aa=class extends Error{constructor(e){super(e),this.name=`AbortError`}},oa=class extends Error{constructor(e,t,n){super(e),c(this,`filePath`,void 0),c(this,`defaultConfig`,void 0),this.name=`ConfigParseError`,this.filePath=t,this.defaultConfig=n}},sa=class extends Error{constructor(e,t,n,r){super(`Shell command failed`),c(this,`stdout`,void 0),c(this,`stderr`,void 0),c(this,`code`,void 0),c(this,`interrupted`,void 0),this.stdout=e,this.stderr=t,this.code=n,this.interrupted=r,this.name=`ShellError`}},ca=class extends Error{constructor(e,t){super(e),c(this,`formattedMessage`,void 0),this.formattedMessage=t,this.name=`TeleportOperationError`}},la=class extends Error{constructor(e,t){super(e),c(this,`telemetryMessage`,void 0),this.name=`TelemetrySafeError`,this.telemetryMessage=t??e}}}));function da(){return ha}function fa(e,t,n){return Q`JSON.stringify(${e})`,JSON.stringify(e,t,n)}function pa(e,t){return Q`structuredClone(${e})`,structuredClone(e,t)}function ma(e,t,n){if(Q`fs.writeFileSync(${e}, ${t})`,typeof n==`object`&&n&&`flush`in n&&n.flush===!0){let r=typeof n==`object`&&`encoding`in n?n.encoding:void 0,i=typeof n==`object`&&`mode`in n?n.mode:void 0,a;try{a=oe(e,`w`,i),se(a,t,{encoding:r??void 0}),ae(a)}finally{a!==void 0&&ie(a)}}else se(e,t,n)}var ha,Q,ga,_a=e((()=>{l(),Za(),(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),ha={[Symbol.dispose](){}},Q=da,ga=(e,t)=>(Q`JSON.parse(${e})`,t===void 0?JSON.parse(e):JSON.parse(e,t))}));function va(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var ya=e((()=>{}));function ba(e,t){if(t.startsWith(`//`)||t.startsWith(`\\\\`))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};try{let n=e.lstatSync(t);if(n.isFIFO()||n.isSocket()||n.isCharacterDevice()||n.isBlockDevice())return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch{return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}function xa(e,t,n){let{resolvedPath:r}=ba(e,t);return n.has(r)?!0:(n.add(r),!1)}function Sa(e,t){let n=t,r=[];for(;n!==p.dirname(n);){let t;try{t=e.lstatSync(n)}catch{r.unshift(p.basename(n)),n=p.dirname(n);continue}if(t.isSymbolicLink())try{let t=e.realpathSync(n);return r.length===0?t:p.join(t,...r)}catch{let t=e.readlinkSync(n),i=p.isAbsolute(t)?t:p.resolve(p.dirname(n),t);return r.length===0?i:p.join(i,...r)}try{let t=e.realpathSync(n);if(t!==n)return r.length===0?t:p.join(t,...r)}catch{}return}}function Ca(e){let t=e;t===`~`?t=f().normalize(`NFC`):t.startsWith(`~/`)&&(t=p.join(f().normalize(`NFC`),t.slice(2)));let n=new Set,r=wa();if(n.add(t),t.startsWith(`//`)||t.startsWith(`\\\\`))return Array.from(n);try{let e=t,i=new Set;for(let a=0;a<40&&!i.has(e);a++){if(i.add(e),!r.existsSync(e)){if(e===t){let e=Sa(r,t);e!==void 0&&n.add(e)}break}let a=r.lstatSync(e);if(a.isFIFO()||a.isSocket()||a.isCharacterDevice()||a.isBlockDevice()||!a.isSymbolicLink())break;let o=r.readlinkSync(e),s=p.isAbsolute(o)?o:p.resolve(p.dirname(e),o);n.add(s),e=s}}catch{}let{resolvedPath:i,isSymlink:a}=ba(r,t);return a&&i!==t&&n.add(i),Array.from(n)}function wa(){return ka}async function Ta(e,t,n){try{var r=va();let i=r.a(await ue(e,`r`)),a=(await i.stat()).size;if(a<=t)return null;let o=Math.min(a-t,n),s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await i.read(s,c,o-c,t+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:a}}catch(e){r.e=e}finally{await r.d()}}async function Ea(e,t){try{var n=va();let r=n.a(await ue(e,`r`)),i=(await r.stat()).size;if(i===0)return{content:``,bytesRead:0,bytesTotal:0};let a=Math.max(0,i-t),o=i-a,s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await r.read(s,c,o-c,a+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:i}}catch(e){n.e=e}finally{await n.d()}}async function*Da(e){let t=1024*4,n=await ue(e,`r`);try{let e=(await n.stat()).size,r=Buffer.alloc(0),i=Buffer.alloc(t);for(;e>0;){let a=Math.min(t,e);e-=a,await n.read(i,0,a,e);let o=Buffer.concat([i.subarray(0,a),r]),s=o.indexOf(10);if(s===-1){r=o;continue}r=Buffer.from(o.subarray(0,s));let c=o.toString(`utf8`,s+1).split(`
38
- `);for(let e=c.length-1;e>=0;e--){let t=c[e];t&&(yield t)}}r.length>0&&(yield r.toString(`utf8`))}finally{await n.close()}}var Oa,ka,Aa=e((()=>{ua(),_a(),ya(),Oa={cwd(){return process.cwd()},existsSync(e){return Q`fs.existsSync(${e})`,m.existsSync(e)},async stat(e){return ge(e)},async readdir(e){return fe(e,{withFileTypes:!0})},async unlink(e){return ve(e)},async rmdir(e){return he(e)},async rm(e,t){return me(e,t)},async mkdir(e,t){try{await le(e,{recursive:!0,...t})}catch(e){if(Zi(e)!==`EEXIST`)throw e}},async readFile(e,t){return de(e,{encoding:t.encoding})},async rename(e,t){return pe(e,t)},statSync(e){return Q`fs.statSync(${e})`,m.statSync(e)},lstatSync(e){return Q`fs.lstatSync(${e})`,m.lstatSync(e)},readFileSync(e,t){return Q`fs.readFileSync(${e})`,m.readFileSync(e,{encoding:t.encoding})},readFileBytesSync(e){return Q`fs.readFileBytesSync(${e})`,m.readFileSync(e)},readSync(e,t){Q`fs.readSync(${e}, ${t.length} bytes)`;let n;try{n=m.openSync(e,`r`);let r=Buffer.alloc(t.length);return{buffer:r,bytesRead:m.readSync(n,r,0,t.length,0)}}finally{n&&m.closeSync(n)}},appendFileSync(e,t,n){if(Q`fs.appendFileSync(${e}, ${t.length} chars)`,n?.mode!==void 0)try{let r=m.openSync(e,`ax`,n.mode);try{m.appendFileSync(r,t)}finally{m.closeSync(r)}return}catch(e){if(Zi(e)!==`EEXIST`)throw e}m.appendFileSync(e,t)},copyFileSync(e,t){Q`fs.copyFileSync(${e} → ${t})`,m.copyFileSync(e,t)},unlinkSync(e){Q`fs.unlinkSync(${e})`,m.unlinkSync(e)},renameSync(e,t){Q`fs.renameSync(${e} → ${t})`,m.renameSync(e,t)},linkSync(e,t){Q`fs.linkSync(${e} → ${t})`,m.linkSync(e,t)},symlinkSync(e,t,n){Q`fs.symlinkSync(${e} → ${t})`,m.symlinkSync(e,t,n)},readlinkSync(e){return Q`fs.readlinkSync(${e})`,m.readlinkSync(e)},realpathSync(e){return Q`fs.realpathSync(${e})`,m.realpathSync(e).normalize(`NFC`)},mkdirSync(e,t){Q`fs.mkdirSync(${e})`;let n={recursive:!0};t?.mode!==void 0&&(n.mode=t.mode);try{m.mkdirSync(e,n)}catch(e){if(Zi(e)!==`EEXIST`)throw e}},readdirSync(e){return Q`fs.readdirSync(${e})`,m.readdirSync(e,{withFileTypes:!0})},readdirStringSync(e){return Q`fs.readdirStringSync(${e})`,m.readdirSync(e)},isDirEmptySync(e){return Q`fs.isDirEmptySync(${e})`,this.readdirSync(e).length===0},rmdirSync(e){Q`fs.rmdirSync(${e})`,m.rmdirSync(e)},rmSync(e,t){Q`fs.rmSync(${e})`,m.rmSync(e,t)},createWriteStream(e){return m.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return de(e);let n=await ue(e,`r`);try{let{size:e}=await n.stat(),r=Math.min(e,t),i=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:e}=await n.read(i,a,r-a,a);if(e===0)break;a+=e}return a<r?i.subarray(0,a):i}finally{await n.close()}}},ka=Oa})),ja=t({flushDebugLogs:()=>Ra,getDebugFilePath:()=>qa,getDebugFilter:()=>Ga,getDebugLogPath:()=>Ba,getHasFormattedOutput:()=>Pa,getMinDebugLogLevel:()=>Ua,isDebugMode:()=>Wa,isDebugToStdErr:()=>Ka,logAntError:()=>Va,logForDebugging:()=>za,setHasFormattedOutput:()=>Na});function Ma(e){return!Wa()||typeof process>`u`||process.versions===void 0||process.versions.node===void 0?!1:De(e,Ga())}function Na(e){Ja=e}function Pa(){return Ja}async function Fa(e,t,n,r){e&&await le(t,{recursive:!0}).catch(()=>{}),await ce(n,r),Xa()}function Ia(){}function La(){if(!$){let e=null;$=ye({writeFn:t=>{let n=Ba(),r=te(n),i=e!==r;if(e=r,Wa()){if(i)try{wa().mkdirSync(r)}catch{}try{wa().appendFileSync(n,t)}catch{try{wa().mkdirSync(r),wa().appendFileSync(n,t)}catch{}}Xa();return}Ya=Ya.then(Fa.bind(null,i,r,n,t)).catch(Ia)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:Wa()}),xe(async()=>{$?.dispose(),await Ya})}return $}async function Ra(){$?.flush(),await Ya}function za(e,{level:t}={level:`debug`}){if(Ha[t]<Ha[Ua()]||!Ma(e))return;Ja&&e.includes(`
39
- `)&&(e=fa(e));let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}\n`;if(Ka()){ee(n);return}La().write(n)}function Ba(){return qa()??(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR?re(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR):null)??ne(i(),`debug`,`${u()}.txt`)}function Va(e,t){t instanceof Error&&t.stack&&za(`[ANT-ONLY] ${e} stack trace:\n${t.stack}`,{level:`error`})}var Ha,Ua,Wa,Ga,Ka,qa,Ja,$,Ya,Xa,Za=e((()=>{r(),l(),be(),we(),ke(),o(),Aa(),d(),_a(),Ha={verbose:0,debug:1,info:2,warn:3,error:4},Ua=n(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(Ha,e)?e:`debug`}),Wa=n(()=>a(process.env.DEBUG)||a(process.env.DEBUG_SDK)||process.argv.includes(`--debug`)||process.argv.includes(`-d`)||Ka()||process.argv.some(e=>e.startsWith(`--debug=`))||qa()!==null),Ga=n(()=>{let e=process.argv.find(e=>e.startsWith(`--debug=`));return e?Oe(e.substring(8)):null}),Ka=n(()=>process.argv.includes(`--debug-to-stderr`)),qa=n(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith(`--debug-file=`))return re(t.substring(13));if(t===`--debug-file`&&e+1<process.argv.length)return re(process.argv[e+1])}return null}),Ja=!1,$=null,Ya=Promise.resolve(),Xa=n(async()=>{try{let e=Ba(),t=ne(te(e),`latest`);await ve(t).catch(()=>{}),await _e(e,t)}catch{}})}));export{ze as $,sa as A,Qi as B,fa as C,ra as D,aa as E,Zi as F,Wi as G,ea as H,$i as I,x as J,Gi as K,Ji as L,ca as M,na as N,oa as O,Xi as P,Le as Q,ua as R,ga as S,ma as T,Yi as U,ta as V,Ki as W,y as X,Fe as Y,b as Z,Ea as _,Wa as a,be as at,pa as b,za as c,Ca as d,S as et,Aa as f,ba as g,Da as h,Za as i,ye as it,la as j,ia as k,Na as l,Ta as m,Ba as n,xe as nt,Ka as o,xa as p,Rn as q,Pa as r,Se as rt,Va as s,ja as t,we as tt,wa as u,va as v,Q as w,_a as x,ya as y,qi as z};
37
+ `)}function ta(e){let t=Zi(e);return t===`ENOENT`||t===`EACCES`||t===`EPERM`||t===`ENOTDIR`||t===`ELOOP`}function na(e){let t=Xi(e);if(!e||typeof e!=`object`||!(`isAxiosError`in e)||!e.isAxiosError)return{kind:`other`,message:t};let n=e,r=n.response?.status;return r===401||r===403?{kind:`auth`,status:r,message:t}:n.code===`ECONNABORTED`?{kind:`timeout`,status:r,message:t}:n.code===`ECONNREFUSED`||n.code===`ENOTFOUND`?{kind:`network`,status:r,message:t}:{kind:`http`,status:r,message:t}}var ra,ia,aa,oa,sa,ca,la=e((()=>{Ki(),s(),ra=class extends Error{constructor(e){super(e),this.name=this.constructor.name}},ia=class extends Error{},aa=class extends Error{constructor(e){super(e),this.name=`AbortError`}},oa=class extends Error{constructor(e,t,n){super(e),c(this,`filePath`,void 0),c(this,`defaultConfig`,void 0),this.name=`ConfigParseError`,this.filePath=t,this.defaultConfig=n}},sa=class extends Error{constructor(e,t,n,r){super(`Shell command failed`),c(this,`stdout`,void 0),c(this,`stderr`,void 0),c(this,`code`,void 0),c(this,`interrupted`,void 0),this.stdout=e,this.stderr=t,this.code=n,this.interrupted=r,this.name=`ShellError`}},ca=class extends Error{constructor(e,t){super(e),c(this,`telemetryMessage`,void 0),this.name=`TelemetrySafeError`,this.telemetryMessage=t??e}}}));function ua(){return ma}function da(e,t,n){return Q`JSON.stringify(${e})`,JSON.stringify(e,t,n)}function fa(e,t){return Q`structuredClone(${e})`,structuredClone(e,t)}function pa(e,t,n){if(Q`fs.writeFileSync(${e}, ${t})`,typeof n==`object`&&n&&`flush`in n&&n.flush===!0){let r=typeof n==`object`&&`encoding`in n?n.encoding:void 0,i=typeof n==`object`&&`mode`in n?n.mode:void 0,a;try{a=oe(e,`w`,i),se(a,t,{encoding:r??void 0}),ae(a)}finally{a!==void 0&&ie(a)}}else se(e,t,n)}var ma,Q,ha,ga=e((()=>{u(),Xa(),(()=>{let e=process.env.CLAUDE_CODE_SLOW_OPERATION_THRESHOLD_MS;if(e!==void 0){let t=Number(e);if(!Number.isNaN(t)&&t>=0)return t}return 1/0})(),ma={[Symbol.dispose](){}},Q=ua,ha=(e,t)=>(Q`JSON.parse(${e})`,t===void 0?JSON.parse(e):JSON.parse(e,t))}));function _a(){var e=typeof SuppressedError==`function`?SuppressedError:function(e,t){var n=Error();return n.name=`SuppressedError`,n.error=e,n.suppressed=t,n},t={},n=[];function r(e,t){if(t!=null){if(Object(t)!==t)throw TypeError(`using declarations can only be used with objects, functions, null, or undefined.`);if(e)var r=t[Symbol.asyncDispose||Symbol.for(`Symbol.asyncDispose`)];if(r===void 0&&(r=t[Symbol.dispose||Symbol.for(`Symbol.dispose`)],e))var i=r;if(typeof r!=`function`)throw TypeError(`Object is not disposable.`);i&&(r=function(){try{i.call(t)}catch(e){return Promise.reject(e)}}),n.push({v:t,d:r,a:e})}else e&&n.push({d:t,a:e});return t}return{e:t,u:r.bind(null,!1),a:r.bind(null,!0),d:function(){var r,i=this.e,a=0;function o(){for(;r=n.pop();)try{if(!r.a&&a===1)return a=0,n.push(r),Promise.resolve().then(o);if(r.d){var e=r.d.call(r.v);if(r.a)return a|=2,Promise.resolve(e).then(o,s)}else a|=1}catch(e){return s(e)}if(a===1)return i===t?Promise.resolve():Promise.reject(i);if(i!==t)throw i}function s(n){return i=i===t?n:new e(n,i),o()}return o()}}}var va=e((()=>{}));function ya(e,t){if(t.startsWith(`//`)||t.startsWith(`\\\\`))return{resolvedPath:t,isSymlink:!1,isCanonical:!1};try{let n=e.lstatSync(t);if(n.isFIFO()||n.isSocket()||n.isCharacterDevice()||n.isBlockDevice())return{resolvedPath:t,isSymlink:!1,isCanonical:!1};let r=e.realpathSync(t);return{resolvedPath:r,isSymlink:r!==t,isCanonical:!0}}catch{return{resolvedPath:t,isSymlink:!1,isCanonical:!1}}}function ba(e,t,n){let{resolvedPath:r}=ya(e,t);return n.has(r)?!0:(n.add(r),!1)}function xa(e,t){let n=t,r=[];for(;n!==p.dirname(n);){let t;try{t=e.lstatSync(n)}catch{r.unshift(p.basename(n)),n=p.dirname(n);continue}if(t.isSymbolicLink())try{let t=e.realpathSync(n);return r.length===0?t:p.join(t,...r)}catch{let t=e.readlinkSync(n),i=p.isAbsolute(t)?t:p.resolve(p.dirname(n),t);return r.length===0?i:p.join(i,...r)}try{let t=e.realpathSync(n);if(t!==n)return r.length===0?t:p.join(t,...r)}catch{}return}}function Sa(e){let t=e;t===`~`?t=f().normalize(`NFC`):t.startsWith(`~/`)&&(t=p.join(f().normalize(`NFC`),t.slice(2)));let n=new Set,r=Ca();if(n.add(t),t.startsWith(`//`)||t.startsWith(`\\\\`))return Array.from(n);try{let e=t,i=new Set;for(let a=0;a<40&&!i.has(e);a++){if(i.add(e),!r.existsSync(e)){if(e===t){let e=xa(r,t);e!==void 0&&n.add(e)}break}let a=r.lstatSync(e);if(a.isFIFO()||a.isSocket()||a.isCharacterDevice()||a.isBlockDevice()||!a.isSymbolicLink())break;let o=r.readlinkSync(e),s=p.isAbsolute(o)?o:p.resolve(p.dirname(e),o);n.add(s),e=s}}catch{}let{resolvedPath:i,isSymlink:a}=ya(r,t);return a&&i!==t&&n.add(i),Array.from(n)}function Ca(){return Oa}async function wa(e,t,n){try{var r=_a();let i=r.a(await ue(e,`r`)),a=(await i.stat()).size;if(a<=t)return null;let o=Math.min(a-t,n),s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await i.read(s,c,o-c,t+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:a}}catch(e){r.e=e}finally{await r.d()}}async function Ta(e,t){try{var n=_a();let r=n.a(await ue(e,`r`)),i=(await r.stat()).size;if(i===0)return{content:``,bytesRead:0,bytesTotal:0};let a=Math.max(0,i-t),o=i-a,s=Buffer.allocUnsafe(o),c=0;for(;c<o;){let{bytesRead:e}=await r.read(s,c,o-c,a+c);if(e===0)break;c+=e}return{content:s.toString(`utf8`,0,c),bytesRead:c,bytesTotal:i}}catch(e){n.e=e}finally{await n.d()}}async function*Ea(e){let t=1024*4,n=await ue(e,`r`);try{let e=(await n.stat()).size,r=Buffer.alloc(0),i=Buffer.alloc(t);for(;e>0;){let a=Math.min(t,e);e-=a,await n.read(i,0,a,e);let o=Buffer.concat([i.subarray(0,a),r]),s=o.indexOf(10);if(s===-1){r=o;continue}r=Buffer.from(o.subarray(0,s));let c=o.toString(`utf8`,s+1).split(`
38
+ `);for(let e=c.length-1;e>=0;e--){let t=c[e];t&&(yield t)}}r.length>0&&(yield r.toString(`utf8`))}finally{await n.close()}}var Da,Oa,ka=e((()=>{la(),ga(),va(),Da={cwd(){return process.cwd()},existsSync(e){return Q`fs.existsSync(${e})`,m.existsSync(e)},async stat(e){return ge(e)},async readdir(e){return fe(e,{withFileTypes:!0})},async unlink(e){return ve(e)},async rmdir(e){return he(e)},async rm(e,t){return me(e,t)},async mkdir(e,t){try{await le(e,{recursive:!0,...t})}catch(e){if(Zi(e)!==`EEXIST`)throw e}},async readFile(e,t){return de(e,{encoding:t.encoding})},async rename(e,t){return pe(e,t)},statSync(e){return Q`fs.statSync(${e})`,m.statSync(e)},lstatSync(e){return Q`fs.lstatSync(${e})`,m.lstatSync(e)},readFileSync(e,t){return Q`fs.readFileSync(${e})`,m.readFileSync(e,{encoding:t.encoding})},readFileBytesSync(e){return Q`fs.readFileBytesSync(${e})`,m.readFileSync(e)},readSync(e,t){Q`fs.readSync(${e}, ${t.length} bytes)`;let n;try{n=m.openSync(e,`r`);let r=Buffer.alloc(t.length);return{buffer:r,bytesRead:m.readSync(n,r,0,t.length,0)}}finally{n&&m.closeSync(n)}},appendFileSync(e,t,n){if(Q`fs.appendFileSync(${e}, ${t.length} chars)`,n?.mode!==void 0)try{let r=m.openSync(e,`ax`,n.mode);try{m.appendFileSync(r,t)}finally{m.closeSync(r)}return}catch(e){if(Zi(e)!==`EEXIST`)throw e}m.appendFileSync(e,t)},copyFileSync(e,t){Q`fs.copyFileSync(${e} → ${t})`,m.copyFileSync(e,t)},unlinkSync(e){Q`fs.unlinkSync(${e})`,m.unlinkSync(e)},renameSync(e,t){Q`fs.renameSync(${e} → ${t})`,m.renameSync(e,t)},linkSync(e,t){Q`fs.linkSync(${e} → ${t})`,m.linkSync(e,t)},symlinkSync(e,t,n){Q`fs.symlinkSync(${e} → ${t})`,m.symlinkSync(e,t,n)},readlinkSync(e){return Q`fs.readlinkSync(${e})`,m.readlinkSync(e)},realpathSync(e){return Q`fs.realpathSync(${e})`,m.realpathSync(e).normalize(`NFC`)},mkdirSync(e,t){Q`fs.mkdirSync(${e})`;let n={recursive:!0};t?.mode!==void 0&&(n.mode=t.mode);try{m.mkdirSync(e,n)}catch(e){if(Zi(e)!==`EEXIST`)throw e}},readdirSync(e){return Q`fs.readdirSync(${e})`,m.readdirSync(e,{withFileTypes:!0})},readdirStringSync(e){return Q`fs.readdirStringSync(${e})`,m.readdirSync(e)},isDirEmptySync(e){return Q`fs.isDirEmptySync(${e})`,this.readdirSync(e).length===0},rmdirSync(e){Q`fs.rmdirSync(${e})`,m.rmdirSync(e)},rmSync(e,t){Q`fs.rmSync(${e})`,m.rmSync(e,t)},createWriteStream(e){return m.createWriteStream(e)},async readFileBytes(e,t){if(t===void 0)return de(e);let n=await ue(e,`r`);try{let{size:e}=await n.stat(),r=Math.min(e,t),i=Buffer.allocUnsafe(r),a=0;for(;a<r;){let{bytesRead:e}=await n.read(i,a,r-a,a);if(e===0)break;a+=e}return a<r?i.subarray(0,a):i}finally{await n.close()}}},Oa=Da})),Aa=t({flushDebugLogs:()=>La,getDebugFilePath:()=>Ka,getDebugFilter:()=>Wa,getDebugLogPath:()=>za,getHasFormattedOutput:()=>Na,getMinDebugLogLevel:()=>Ha,isDebugMode:()=>Ua,isDebugToStdErr:()=>Ga,logAntError:()=>Ba,logForDebugging:()=>Ra,setHasFormattedOutput:()=>Ma});function ja(e){return!Ua()||typeof process>`u`||process.versions===void 0||process.versions.node===void 0?!1:De(e,Wa())}function Ma(e){qa=e}function Na(){return qa}async function Pa(e,t,n,r){e&&await le(t,{recursive:!0}).catch(()=>{}),await ce(n,r),Ya()}function Fa(){}function Ia(){if(!$){let e=null;$=ye({writeFn:t=>{let n=za(),r=te(n),i=e!==r;if(e=r,Ua()){if(i)try{Ca().mkdirSync(r)}catch{}try{Ca().appendFileSync(n,t)}catch{try{Ca().mkdirSync(r),Ca().appendFileSync(n,t)}catch{}}Ya();return}Ja=Ja.then(Pa.bind(null,i,r,n,t)).catch(Fa)},flushIntervalMs:1e3,maxBufferSize:100,immediateMode:Ua()}),xe(async()=>{$?.dispose(),await Ja})}return $}async function La(){$?.flush(),await Ja}function Ra(e,{level:t}={level:`debug`}){if(Va[t]<Va[Ha()]||!ja(e))return;qa&&e.includes(`
39
+ `)&&(e=da(e));let n=`${new Date().toISOString()} [${t.toUpperCase()}] ${e.trim()}\n`;if(Ga()){ee(n);return}Ia().write(n)}function za(){return Ka()??(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR?re(process.env.CLAUDE_CODE_DEBUG_LOGS_DIR):null)??ne(i(),`debug`,`${l()}.txt`)}function Ba(e,t){t instanceof Error&&t.stack&&Ra(`[ANT-ONLY] ${e} stack trace:\n${t.stack}`,{level:`error`})}var Va,Ha,Ua,Wa,Ga,Ka,qa,$,Ja,Ya,Xa=e((()=>{r(),u(),be(),we(),ke(),o(),ka(),d(),ga(),Va={verbose:0,debug:1,info:2,warn:3,error:4},Ha=n(()=>{let e=process.env.CLAUDE_CODE_DEBUG_LOG_LEVEL?.toLowerCase().trim();return e&&Object.hasOwn(Va,e)?e:`debug`}),Ua=n(()=>a(process.env.DEBUG)||a(process.env.DEBUG_SDK)||process.argv.includes(`--debug`)||process.argv.includes(`-d`)||Ga()||process.argv.some(e=>e.startsWith(`--debug=`))||Ka()!==null),Wa=n(()=>{let e=process.argv.find(e=>e.startsWith(`--debug=`));return e?Oe(e.substring(8)):null}),Ga=n(()=>process.argv.includes(`--debug-to-stderr`)),Ka=n(()=>{for(let e=0;e<process.argv.length;e++){let t=process.argv[e];if(t.startsWith(`--debug-file=`))return re(t.substring(13));if(t===`--debug-file`&&e+1<process.argv.length)return re(process.argv[e+1])}return null}),qa=!1,$=null,Ja=Promise.resolve(),Ya=n(async()=>{try{let e=za(),t=ne(te(e),`latest`);await ve(t).catch(()=>{}),await _e(e,t)}catch{}})}));export{S as $,sa as A,ta as B,da as C,ra as D,aa as E,$i as F,Gi as G,Yi as H,Ji as I,Fe as J,Rn as K,la as L,na as M,Xi as N,oa as O,Zi as P,ze as Q,qi as R,ha as S,pa as T,Ki as U,ea as V,Wi as W,b as X,y as Y,Le as Z,Ta as _,Ua as a,fa as b,Ra as c,Sa as d,we as et,ka as f,ya as g,Ea as h,Xa as i,be as it,ca as j,ia as k,Ma as l,wa as m,za as n,Se as nt,Ga as o,ba as p,x as q,Na as r,ye as rt,Ba as s,Aa as t,xe as tt,Ca as u,_a as v,Q as w,ga as x,va as y,Qi as z};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./cwd-BcO6WHKo.js";import{c as r,i}from"./debug-8DCufdSp.js";import{Ur as a,zr as o}from"./settings-DKN4xSpQ.js";function s(){f.clear()}async function c(){let e=await l();return!e||e.host!==`github.com`?null:`${e.owner}/${e.name}`}async function l(){let e=n();if(f.has(e))return f.get(e)??null;try{let t=await o();if(r(`Git remote URL: ${t}`),!t)return r(`No git remote URL found`),f.set(e,null),null;let n=u(t);return r(`Parsed repository: ${n?`${n.host}/${n.owner}/${n.name}`:null} from URL: ${t}`),f.set(e,n),n}catch(t){return r(`Error detecting repository: ${t}`),f.set(e,null),null}}function u(e){let t=e.trim(),n=t.match(/^git@([^:]+):([^/]+)\/([^/]+?)(?:\.git)?$/);if(n?.[1]&&n[2]&&n[3])return d(n[1])?{host:n[1],owner:n[2],name:n[3]}:null;let r=t.match(/^(https?|ssh|git):\/\/(?:[^@]+@)?([^/:]+(?::\d+)?)\/([^/]+)\/([^/]+?)(?:\.git)?$/);if(r?.[1]&&r[2]&&r[3]&&r[4]){let e=r[1],t=r[2],n=t.split(`:`)[0]??``;return d(n)?{host:e===`https`||e===`http`?t:n,owner:r[3],name:r[4]}:null}return null}function d(e){if(!e.includes(`.`))return!1;let t=e.split(`.`).pop();return t?/^[a-zA-Z]+$/.test(t):!1}var f,p=e((()=>{t(),i(),a(),f=new Map}));export{c as n,p as r,s as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-CMtml9iw.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";var n,r;e((()=>{n=t(),r=async(e,t)=>{let{DiffDialog:r}=await import(`./DiffDialog-v2IiYyi3.js`);return(0,n.jsx)(r,{messages:t.messages,onDone:e})}}))();export{r as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{b as t,y as n}from"./types-zk5Ltv5q.js";import{n as r,t as i}from"./cwd-BcO6WHKo.js";import{f as a,u as o}from"./debug-8DCufdSp.js";import{cr as s,or as c}from"./settings-DKN4xSpQ.js";import{o as l,s as u}from"./log-DaILwWJa.js";import{basename as d,dirname as f,join as p,sep as m}from"path";function h(e,t){if(!e)return{directory:t||i(),prefix:``};let n=c(e,t);return e.endsWith(`/`)||e.endsWith(m)?{directory:n,prefix:``}:{directory:f(n),prefix:d(e)}}async function g(e){let t=C.get(e);if(t)return t;try{let t=(await o().readdir(e)).filter(e=>e.isDirectory()&&!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:`directory`})).slice(0,100);return C.set(e,t),t}catch(e){return u(e),[]}}async function _(e,t={}){let{basePath:n=i(),maxResults:r=10}=t,{directory:a,prefix:o}=h(e,n),s=await g(a),c=o.toLowerCase();return s.filter(e=>e.name.toLowerCase().startsWith(c)).slice(0,r).map(e=>({id:e.path,displayText:`${e.name}/`,description:`directory`,metadata:{type:`directory`}}))}function v(e){return e.startsWith(`~/`)||e.startsWith(`/`)||e.startsWith(`./`)||e.startsWith(`../`)||e===`~`||e===`.`||e===`..`}async function y(e,t=!1){let n=`${e}:${t}`,r=w.get(n);if(r)return r;try{let r=(await o().readdir(e)).filter(e=>t||!e.name.startsWith(`.`)).map(t=>({name:t.name,path:p(e,t.name),type:t.isDirectory()?`directory`:`file`})).sort((e,t)=>e.type===`directory`&&t.type!==`directory`?-1:e.type!==`directory`&&t.type===`directory`?1:e.name.localeCompare(t.name)).slice(0,100);return w.set(n,r),r}catch(e){return u(e),[]}}async function b(e,t={}){let{basePath:n=i(),maxResults:r=10,includeFiles:a=!0,includeHidden:o=!1}=t,{directory:s,prefix:c}=h(e,n),l=await y(s,o),u=c.toLowerCase(),d=l.filter(e=>!a&&e.type===`file`?!1:e.name.toLowerCase().startsWith(u)).slice(0,r),f=e.includes(`/`)||e.includes(m),p=``;if(f){let t=e.lastIndexOf(`/`),n=e.lastIndexOf(m),r=Math.max(t,n);p=e.substring(0,r+1)}return(p.startsWith(`./`)||p.startsWith(`.${m}`))&&(p=p.slice(2)),d.map(e=>{let t=p+e.name;return{id:t,displayText:e.type===`directory`?`${t}/`:t,metadata:{type:e.type}}})}var x,S,C,w,T=e((()=>{t(),r(),a(),l(),s(),x=500,S=300*1e3,C=new n({max:x,ttl:S}),w=new n({max:x,ttl:S})}));export{v as i,b as n,T as r,_ as t};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Doctor-By_y3C2V.js";var i,a;e((()=>{n(),i=t(),a=(e,t,n)=>Promise.resolve((0,i.jsx)(r,{onDone:e}))}))();export{a as call};
@@ -0,0 +1,13 @@
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A_ as n,B as r,Cc as i,E_ as a,Gl as o,Kl as s,Os as c,Pi as l,Sc as u,V as d,i as f,ir as p,ki as m,ks as h,o as g,vr as _}from"./loadAgentsDir-C1LkW7gl.js";import{$ as v,A as y,F as b,G as x,P as S,Q as C,V as w,W as T,Y as E,Z as D,tt as ee,x as te,z as O}from"./types-zk5Ltv5q.js";import{Mn as k,Yn as A,Z as ne,ar as re,dt as ie,or as ae,zt as j}from"./state-BowF111d.js";import{Cr as oe,d as se,h as ce,pr as le,yr as ue}from"./settings-DKN4xSpQ.js";import{m as de,r as fe}from"./config-BddEvZZl.js";import{f as pe,s as me}from"./model-BwBE0Pt5.js";import{_n as he,vn as ge}from"./prompt-BGqgPgCU.js";import{t as _e}from"./conversationRecovery-Da_8uldZ.js";import{t as ve}from"./QueryEngine-DNNy1UCD.js";import{n as ye,r as be}from"./modelOptions-DvNBapgG.js";import{n as xe,r as Se}from"./managedEnv-lybrMred.js";import{dirname as Ce}from"node:path";import{randomUUID as M}from"node:crypto";import{Readable as we,Writable as Te}from"node:stream";import{unlink as Ee}from"node:fs/promises";import*as N from"node:path/posix";import{isAbsolute as De,resolve as Oe}from"node:path/posix";te();var P={authenticate:`authenticate`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_focus:`document/didFocus`,document_did_open:`document/didOpen`,document_did_save:`document/didSave`,initialize:`initialize`,logout:`logout`,nes_accept:`nes/accept`,nes_close:`nes/close`,nes_reject:`nes/reject`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,session_cancel:`session/cancel`,session_close:`session/close`,session_fork:`session/fork`,session_list:`session/list`,session_load:`session/load`,session_new:`session/new`,session_prompt:`session/prompt`,session_resume:`session/resume`,session_set_config_option:`session/set_config_option`,session_set_mode:`session/set_mode`,session_set_model:`session/set_model`},F={elicitation_complete:`elicitation/complete`,elicitation_create:`elicitation/create`,fs_read_text_file:`fs/read_text_file`,fs_write_text_file:`fs/write_text_file`,session_request_permission:`session/request_permission`,session_update:`session/update`,terminal_create:`terminal/create`,terminal_kill:`terminal/kill`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`},ke=x({_meta:E(D(),v()).nullish(),terminal:b().optional().default(!1)}),Ae=x({_meta:E(D(),v()).nullish(),label:D().nullish(),name:D(),optional:b().optional().default(!1),secret:b().optional().default(!0)}),je=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:D(),name:D()}),Me=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:D(),link:D().nullish(),name:D(),vars:S(Ae)}),Ne=x({_meta:E(D(),v()).nullish(),args:S(D()).optional(),description:D().nullish(),env:E(D(),D()).optional(),id:D(),name:D()}),Pe=C([Me.and(x({type:w(`env_var`)})),Ne.and(x({type:w(`terminal`)})),je]),Fe=x({_meta:E(D(),v()).nullish(),methodId:D()}),Ie=x({_meta:E(D(),v()).nullish()}),Le=x({_meta:E(D(),v()).nullish(),blob:D(),mimeType:D().nullish(),uri:D()}),Re=x({default:b().nullish(),description:D().nullish(),title:D().nullish()}),ze=x({_meta:E(D(),v()).nullish()}),Be=x({_meta:E(D(),v()).nullish()}),Ve=x({amount:T(),currency:D()}),He=x({_meta:E(D(),v()).nullish(),terminalId:D()}),Ue=x({_meta:E(D(),v()).nullish(),newText:D(),oldText:D().nullish(),path:D()}),We=C([D(),T(),T(),b(),S(D())]),Ge=O(C([x({content:E(D(),We).nullish()}).and(x({action:w(`accept`)})),x({action:w(`decline`)}),x({action:w(`cancel`)})]),x({_meta:E(D(),v()).nullish()})),Ke=x({_meta:E(D(),v()).nullish()}),qe=D(),Je=x({_meta:E(D(),v()).nullish(),elicitationId:qe}),Ye=w(`object`),Xe=w(`string`),Ze=x({_meta:E(D(),v()).nullish()}),Qe=x({_meta:E(D(),v()).nullish(),form:Ke.nullish(),url:Ze.nullish()}),$e=x({const:D(),title:D()}),et=x({_meta:E(D(),v()).nullish(),name:D(),value:D()}),tt=x({code:C([w(-32700),w(-32600),w(-32601),w(-32602),w(-32603),w(-32800),w(-32e3),w(-32002),w(-32042),T().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:v().optional(),message:D()}),nt=v(),rt=v(),it=v(),at=x({_meta:E(D(),v()).nullish(),readTextFile:b().optional().default(!1),writeTextFile:b().optional().default(!1)}),ot=x({_meta:E(D(),v()).nullish(),name:D(),value:D()}),st=x({_meta:E(D(),v()).nullish(),name:D(),title:D().nullish(),version:D()}),ct=x({default:T().nullish(),description:D().nullish(),maximum:T().nullish(),minimum:T().nullish(),title:D().nullish()}),lt=x({_meta:E(D(),v()).nullish()}),ut=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cursor:D().nullish(),cwd:D().nullish()}),dt=x({_meta:E(D(),v()).nullish()}),ft=x({_meta:E(D(),v()).nullish(),logout:dt.nullish()}),pt=x({_meta:E(D(),v()).nullish()}),mt=x({_meta:E(D(),v()).nullish()}),ht=x({_meta:E(D(),v()).nullish(),http:b().optional().default(!1),sse:b().optional().default(!1)}),gt=x({_meta:E(D(),v()).nullish(),headers:S(ot),name:D(),url:D()}),_t=x({_meta:E(D(),v()).nullish(),headers:S(ot),name:D(),url:D()}),vt=x({_meta:E(D(),v()).nullish(),args:S(D()),command:D(),env:S(et),name:D()}),I=C([gt.and(x({type:w(`http`)})),_t.and(x({type:w(`sse`)})),vt]),yt=D(),bt=x({_meta:E(D(),v()).nullish(),description:D().nullish(),modelId:yt,name:D()}),xt=C([w(`error`),w(`warning`),w(`information`),w(`hint`)]),St=x({_meta:E(D(),v()).nullish()}),Ct=x({_meta:E(D(),v()).nullish()}),wt=x({_meta:E(D(),v()).nullish()}),Tt=x({_meta:E(D(),v()).nullish()}),Et=x({_meta:E(D(),v()).nullish()}),Dt=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Ot=x({diff:D(),uri:D()}),kt=x({endLine:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:D()}),At=x({_meta:E(D(),v()).nullish()}),jt=x({_meta:E(D(),v()).nullish()}),Mt=x({languageId:D(),text:D(),uri:D()}),Nt=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Pt=C([w(`rejected`),w(`ignored`),w(`replaced`),w(`cancelled`)]),Ft=x({excerpts:S(kt),uri:D()}),It=x({_meta:E(D(),v()).nullish()}),Lt=x({_meta:E(D(),v()).nullish()}),Rt=x({name:D(),owner:D(),remoteUrl:D()}),zt=x({_meta:E(D(),v()).nullish()}),Bt=x({_meta:E(D(),v()).nullish(),jump:At.nullish(),rename:Lt.nullish(),searchAndReplace:zt.nullish()}),Vt=x({id:D(),isRegex:b().nullish(),replace:D(),search:D(),uri:D()}),Ht=C([w(`automatic`),w(`diagnostic`),w(`manual`)]),Ut=x({_meta:E(D(),v()).nullish(),maxCount:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Wt=x({_meta:E(D(),v()).nullish(),diagnostics:St.nullish(),editHistory:Dt.nullish(),openFiles:jt.nullish(),recentFiles:Nt.nullish(),relatedSnippets:It.nullish(),userActions:Ut.nullish()}),Gt=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I)}),Kt=x({default:T().nullish(),description:D().nullish(),maximum:T().nullish(),minimum:T().nullish(),title:D().nullish()}),qt=D(),Jt=C([w(`allow_once`),w(`allow_always`),w(`reject_once`),w(`reject_always`)]),Yt=x({_meta:E(D(),v()).nullish(),kind:Jt,name:D(),optionId:qt}),Xt=C([w(`high`),w(`medium`),w(`low`)]),Zt=C([w(`pending`),w(`in_progress`),w(`completed`)]),Qt=x({_meta:E(D(),v()).nullish(),content:D(),priority:Xt,status:Zt}),$t=x({_meta:E(D(),v()).nullish(),entries:S(Qt)}),L=x({character:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),en=x({id:D(),position:L,uri:D()}),tn=x({id:D(),newName:D(),position:L,uri:D()}),nn=x({action:D(),position:L,timestampMs:T(),uri:D()}),rn=C([w(`utf-16`),w(`utf-32`),w(`utf-8`)]),an=x({_meta:E(D(),v()).nullish(),auth:ke.optional().default({terminal:!1}),elicitation:Qe.nullish(),fs:at.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Bt.nullish(),positionEncodings:S(rn).optional(),terminal:b().optional().default(!1)}),on=x({_meta:E(D(),v()).nullish(),audio:b().optional().default(!1),embeddedContext:b().optional().default(!1),image:b().optional().default(!1)}),sn=T().int().gte(0).lte(65535),cn=x({_meta:E(D(),v()).nullish(),clientCapabilities:an.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:st.nullish(),protocolVersion:sn}),R=x({end:L,start:L}),ln=x({message:D(),range:R,severity:xt,uri:D()}),un=x({languageId:D(),lastFocusedMs:T().nullish(),uri:D(),visibleRange:R.nullish()}),dn=x({_meta:E(D(),v()).nullish(),diagnostics:S(ln).nullish(),editHistory:S(Ot).nullish(),openFiles:S(un).nullish(),recentFiles:S(Mt).nullish(),relatedSnippets:S(Ft).nullish(),userActions:S(nn).nullish()}),fn=x({newText:D(),range:R}),pn=C([x({cursorPosition:L.nullish(),edits:S(fn),id:D(),uri:D()}).and(x({kind:w(`edit`)})),en.and(x({kind:w(`jump`)})),tn.and(x({kind:w(`rename`)})),Vt.and(x({kind:w(`searchAndReplace`)}))]),mn=x({_meta:E(D(),v()).nullish(),content:D()}),hn=x({_meta:E(D(),v()).nullish()}),z=C([T(),D()]).nullable();x({_meta:E(D(),v()).nullish(),requestId:z});var gn=x({requestId:z}),_n=y([`assistant`,`user`]),B=x({_meta:E(D(),v()).nullish(),audience:S(_n).nullish(),lastModified:D().nullish(),priority:T().nullish()}),vn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),data:D(),mimeType:D()}),yn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),data:D(),mimeType:D(),uri:D().nullish()}),bn=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),description:D().nullish(),mimeType:D().nullish(),name:D(),size:T().nullish(),title:D().nullish(),uri:D()}),xn=x({_meta:E(D(),v()).nullish(),optionId:qt}),Sn=C([x({outcome:w(`cancelled`)}),xn.and(x({outcome:w(`selected`)}))]),Cn=x({_meta:E(D(),v()).nullish(),outcome:Sn}),wn=x({_meta:E(D(),v()).nullish()}),Tn=x({_meta:E(D(),v()).nullish()}),En=x({currentValue:b()}),Dn=D(),On=D(),kn=C([w(`mode`),w(`model`),w(`thought_level`),D()]),V=D(),An=x({_meta:E(D(),v()).nullish(),description:D().nullish(),name:D(),value:V}),jn=x({_meta:E(D(),v()).nullish(),group:Dn,name:D(),options:S(An)}),H=O(C([x({currentValue:V,options:C([S(An),S(jn)])}).and(x({type:w(`select`)})),En.and(x({type:w(`boolean`)}))]),x({_meta:E(D(),v()).nullish(),category:kn.nullish(),description:D().nullish(),id:On,name:D()})),Mn=x({_meta:E(D(),v()).nullish(),configOptions:S(H)}),Nn=x({_meta:E(D(),v()).nullish()}),U=D(),Pn=x({_meta:E(D(),v()).nullish(),id:D(),sessionId:U}),Fn=x({_meta:E(D(),v()).nullish(),sessionId:U}),In=x({_meta:E(D(),v()).nullish(),sessionId:U}),Ln=x({_meta:E(D(),v()).nullish(),sessionId:U}),Rn=x({_meta:E(D(),v()).nullish(),args:S(D()).optional(),command:D(),cwd:D().nullish(),env:S(et).optional(),outputByteLimit:T().nullish(),sessionId:U}),zn=x({_meta:E(D(),v()).nullish(),sessionId:U,uri:D()}),Bn=x({_meta:E(D(),v()).nullish(),position:L,sessionId:U,uri:D(),version:T(),visibleRange:R}),Vn=x({_meta:E(D(),v()).nullish(),languageId:D(),sessionId:U,text:D(),uri:D(),version:T()}),Hn=x({_meta:E(D(),v()).nullish(),sessionId:U,uri:D()}),Un=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I).optional(),sessionId:U}),Wn=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Gn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I),sessionId:U}),Kn=x({_meta:E(D(),v()).nullish(),limit:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:D(),sessionId:U}),qn=x({_meta:E(D(),v()).nullish(),id:D(),reason:Pt.nullish(),sessionId:U}),Jn=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Yn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),mcpServers:S(I).optional(),sessionId:U}),Xn=x({_meta:E(D(),v()).nullish(),additionalDirectories:S(D()).optional(),cwd:D(),sessionId:U,title:D().nullish(),updatedAt:D().nullish()}),Zn=x({_meta:E(D(),v()).nullish(),nextCursor:D().nullish(),sessions:S(Xn)}),Qn=x({_meta:E(D(),v()).nullish(),title:D().nullish(),updatedAt:D().nullish()}),$n=x({_meta:E(D(),v()).nullish()}),W=D(),er=x({_meta:E(D(),v()).nullish(),currentModeId:W}),tr=x({_meta:E(D(),v()).nullish(),description:D().nullish(),id:W,name:D()}),G=x({_meta:E(D(),v()).nullish(),availableModes:S(tr),currentModeId:W}),K=x({_meta:E(D(),v()).nullish(),availableModels:S(bt),currentModelId:yt}),nr=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),rr=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish()}),ir=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish(),sessionId:U}),ar=x({_meta:E(D(),v()).nullish(),configOptions:S(H).nullish(),models:K.nullish(),modes:G.nullish()}),or=x({_meta:E(D(),v()).nullish()}),sr=x({_meta:E(D(),v()).nullish(),additionalDirectories:wn.nullish(),close:Tn.nullish(),fork:Nn.nullish(),list:$n.nullish(),resume:or.nullish()}),cr=O(C([x({type:w(`boolean`),value:b()}),x({value:V})]),x({_meta:E(D(),v()).nullish(),configId:On,sessionId:U})),lr=x({_meta:E(D(),v()).nullish(),configOptions:S(H)}),ur=x({_meta:E(D(),v()).nullish(),modeId:W,sessionId:U}),dr=x({_meta:E(D(),v()).nullish()}),fr=x({_meta:E(D(),v()).nullish(),modelId:yt,sessionId:U}),pr=x({_meta:E(D(),v()).nullish()}),mr=x({_meta:E(D(),v()).nullish(),sessionId:U}),hr=C([w(`end_turn`),w(`max_tokens`),w(`max_turn_requests`),w(`refusal`),w(`cancelled`)]),gr=C([w(`email`),w(`uri`),w(`date`),w(`date-time`)]),_r=x({default:D().nullish(),description:D().nullish(),enum:S(D()).nullish(),format:gr.nullish(),maxLength:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:S($e).nullish(),pattern:D().nullish(),title:D().nullish()}),vr=x({_meta:E(D(),v()).nullish(),context:dn.nullish(),position:L,selection:R.nullish(),sessionId:U,triggerKind:Ht,uri:D(),version:T()}),yr=x({_meta:E(D(),v()).nullish(),suggestions:S(pn)}),br=x({_meta:E(D(),v()).nullish(),terminalId:D()}),xr=x({_meta:E(D(),v()).nullish(),exitCode:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:D().nullish()}),Sr=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),Cr=x({_meta:E(D(),v()).nullish(),exitStatus:xr.nullish(),output:D(),truncated:b()}),wr=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),text:D()}),Tr=x({range:R.nullish(),text:D()}),Er=x({_meta:E(D(),v()).nullish(),contentChanges:S(Tr),sessionId:U,uri:D(),version:T()});x({method:D(),params:C([Fn,Vn,Er,zn,Hn,Bn,Pn,qn,nt]).nullish()});var Dr=C([w(`full`),w(`incremental`)]),Or=x({_meta:E(D(),v()).nullish(),syncKind:Dr}),kr=x({_meta:E(D(),v()).nullish(),didChange:Or.nullish(),didClose:Ct.nullish(),didFocus:wt.nullish(),didOpen:Tt.nullish(),didSave:Et.nullish()}),Ar=x({_meta:E(D(),v()).nullish(),document:kr.nullish()}),jr=x({_meta:E(D(),v()).nullish(),context:Wt.nullish(),events:Ar.nullish()}),Mr=x({_meta:E(D(),v()).nullish(),auth:ft.optional().default({}),loadSession:b().optional().default(!1),mcpCapabilities:ht.optional().default({http:!1,sse:!1}),nes:jr.nullish(),positionEncoding:rn.nullish(),promptCapabilities:on.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:sr.optional().default({})}),Nr=x({_meta:E(D(),v()).nullish(),agentCapabilities:Mr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:st.nullish(),authMethods:S(Pe).optional().default([]),protocolVersion:sn}),Pr=C([x({_meta:E(D(),v()).nullish(),mimeType:D().nullish(),text:D(),uri:D()}),Le]),Fr=x({_meta:E(D(),v()).nullish(),annotations:B.nullish(),resource:Pr}),Ir=C([wr.and(x({type:w(`text`)})),yn.and(x({type:w(`image`)})),vn.and(x({type:w(`audio`)})),bn.and(x({type:w(`resource_link`)})),Fr.and(x({type:w(`resource`)}))]),Lr=x({_meta:E(D(),v()).nullish(),content:Ir}),Rr=x({_meta:E(D(),v()).nullish(),content:Ir,messageId:D().nullish()}),zr=x({_meta:E(D(),v()).nullish(),messageId:D().nullish(),prompt:S(Ir),sessionId:U}),Br=x({anyOf:S($e)}),Vr=C([Lr.and(x({type:w(`content`)})),Ue.and(x({type:w(`diff`)})),br.and(x({type:w(`terminal`)}))]),Hr=D(),Ur=x({sessionId:U,toolCallId:Hr.nullish()}),Wr=O(C([Ur,gn]),x({elicitationId:qe,url:D().url()})),Gr=x({_meta:E(D(),v()).nullish(),line:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:D()}),Kr=C([w(`pending`),w(`in_progress`),w(`completed`),w(`failed`)]),qr=C([w(`read`),w(`edit`),w(`delete`),w(`move`),w(`search`),w(`execute`),w(`think`),w(`fetch`),w(`switch_mode`),w(`other`)]),Jr=x({_meta:E(D(),v()).nullish(),content:S(Vr).optional(),kind:qr.optional(),locations:S(Gr).optional(),rawInput:v().optional(),rawOutput:v().optional(),status:Kr.optional(),title:D(),toolCallId:Hr}),Yr=x({_meta:E(D(),v()).nullish(),content:S(Vr).nullish(),kind:qr.nullish(),locations:S(Gr).nullish(),rawInput:v().optional(),rawOutput:v().optional(),status:Kr.nullish(),title:D().nullish(),toolCallId:Hr}),Xr=x({_meta:E(D(),v()).nullish(),options:S(Yt),sessionId:U,toolCall:Yr}),Zr=x({_meta:E(D(),v()).nullish(),hint:D()}),Qr=x({_meta:E(D(),v()).nullish(),description:D(),input:Zr.nullish(),name:D()}),$r=x({_meta:E(D(),v()).nullish(),availableCommands:S(Qr)}),ei=C([x({enum:S(D()),type:Xe}),Br]),ti=x({default:S(D()).nullish(),description:D().nullish(),items:ei,maxItems:T().nullish(),minItems:T().nullish(),title:D().nullish()}),ni=C([_r.and(x({type:w(`string`)})),Kt.and(x({type:w(`number`)})),ct.and(x({type:w(`integer`)})),Re.and(x({type:w(`boolean`)})),ti.and(x({type:w(`array`)}))]),ri=x({description:D().nullish(),properties:E(D(),ni).optional().default({}),required:S(D()).nullish(),title:D().nullish(),type:Ye.optional().default(`object`)}),ii=O(C([O(C([Ur,gn]),x({requestedSchema:ri})).and(x({mode:w(`form`)})),Wr.and(x({mode:w(`url`)}))]),x({_meta:E(D(),v()).nullish(),message:D()})),ai=x({cachedReadTokens:T().nullish(),cachedWriteTokens:T().nullish(),inputTokens:T(),outputTokens:T(),thoughtTokens:T().nullish(),totalTokens:T()});C([x({id:z,result:C([Nr,Ie,mt,ir,rr,Zn,nr,ar,Be,dr,lr,x({_meta:E(D(),v()).nullish(),stopReason:hr,usage:ai.nullish(),userMessageId:D().nullish()}),pr,mr,yr,ze,it])}),x({error:tt,id:z})]);var oi=x({_meta:E(D(),v()).nullish(),cost:Ve.nullish(),size:T(),used:T()}),si=C([Rr.and(x({sessionUpdate:w(`user_message_chunk`)})),Rr.and(x({sessionUpdate:w(`agent_message_chunk`)})),Rr.and(x({sessionUpdate:w(`agent_thought_chunk`)})),Jr.and(x({sessionUpdate:w(`tool_call`)})),Yr.and(x({sessionUpdate:w(`tool_call_update`)})),$t.and(x({sessionUpdate:w(`plan`)})),$r.and(x({sessionUpdate:w(`available_commands_update`)})),er.and(x({sessionUpdate:w(`current_mode_update`)})),Mn.and(x({sessionUpdate:w(`config_option_update`)})),Qn.and(x({sessionUpdate:w(`session_info_update`)})),oi.and(x({sessionUpdate:w(`usage_update`)}))]),ci=x({_meta:E(D(),v()).nullish(),sessionId:U,update:si});x({method:D(),params:C([ci,Je,nt]).nullish()});var li=x({_meta:E(D(),v()).nullish(),sessionId:U,terminalId:D()}),ui=x({_meta:E(D(),v()).nullish(),exitCode:T().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:D().nullish()}),di=x({name:D(),uri:D()}),fi=x({_meta:E(D(),v()).nullish(),repository:Rt.nullish(),workspaceFolders:S(di).nullish(),workspaceUri:D().nullish()});x({id:z,method:D(),params:C([cn,Fe,pt,Gt,Gn,ut,Un,Yn,Ln,ur,cr,zr,fr,fi,vr,In,rt]).nullish()});var pi=x({_meta:E(D(),v()).nullish(),content:D(),path:D(),sessionId:U});x({id:z,method:D(),params:C([pi,Kn,Xr,Rn,Sr,Jn,li,Wn,ii,rt]).nullish()}),C([x({id:z,result:C([x({_meta:E(D(),v()).nullish()}),mn,Cn,He,Cr,hn,ui,lt,Ge,it])}),x({error:tt,id:z})]),e();function mi(e,t){let n=new TextEncoder,r=new TextDecoder;return{readable:new ReadableStream({async start(e){let n=``,i=t.getReader();try{for(;;){let{value:t,done:a}=await i.read();if(a){n+=r.decode();break}if(!t)continue;n+=r.decode(t,{stream:!0});let o=n.split(`
2
+ `);n=o.pop()||``;for(let t of o){let n=t.trim();if(n)try{let t=JSON.parse(n);e.enqueue(t)}catch(e){console.error(`Failed to parse JSON message:`,n,e)}}}let t=n.trim();if(t)try{let n=JSON.parse(t);e.enqueue(n)}catch(e){console.error(`Failed to parse JSON message:`,t,e)}}catch(t){e.error(t);return}finally{i.releaseLock()}e.close()}}),writable:new WritableStream({async write(t){let r=JSON.stringify(t)+`
3
+ `,i=e.getWriter();try{await i.write(n.encode(r))}finally{i.releaseLock()}}})}}te();var hi,gi=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case P.initialize:{let e=cn.parse(t);return r.initialize(e)}case P.session_new:{let e=Gt.parse(t);return r.newSession(e)}case P.session_load:{if(!r.loadSession)throw q.methodNotFound(e);let n=Gn.parse(t);return r.loadSession(n)}case P.session_list:{if(!r.listSessions)throw q.methodNotFound(e);let n=ut.parse(t);return r.listSessions(n)}case P.session_fork:{if(!r.unstable_forkSession)throw q.methodNotFound(e);let n=Un.parse(t);return r.unstable_forkSession(n)}case P.session_resume:{if(!r.unstable_resumeSession)throw q.methodNotFound(e);let n=Yn.parse(t);return r.unstable_resumeSession(n)}case P.session_close:{if(!r.unstable_closeSession)throw q.methodNotFound(e);let n=Ln.parse(t);return r.unstable_closeSession(n)}case P.session_set_mode:{if(!r.setSessionMode)throw q.methodNotFound(e);let n=ur.parse(t);return await r.setSessionMode(n)??{}}case P.authenticate:{let e=Fe.parse(t);return await r.authenticate(e)??{}}case P.logout:{if(!r.unstable_logout)throw q.methodNotFound(e);let n=pt.parse(t);return await r.unstable_logout(n)??{}}case P.session_prompt:{let e=zr.parse(t);return r.prompt(e)}case P.session_set_model:{if(!r.unstable_setSessionModel)throw q.methodNotFound(e);let n=fr.parse(t);return await r.unstable_setSessionModel(n)??{}}case P.session_set_config_option:{if(!r.setSessionConfigOption)throw q.methodNotFound(e);let n=cr.parse(t);return r.setSessionConfigOption(n)}case P.nes_start:{if(!r.unstable_startNes)throw q.methodNotFound(e);let n=fi.parse(t);return r.unstable_startNes(n)}case P.nes_suggest:{if(!r.unstable_suggestNes)throw q.methodNotFound(e);let n=vr.parse(t);return r.unstable_suggestNes(n)}case P.nes_close:{if(!r.unstable_closeNes)throw q.methodNotFound(e);let n=In.parse(t);return await r.unstable_closeNes(n)??{}}default:if(r.extMethod)return r.extMethod(e,t);throw q.methodNotFound(e)}},a=async(e,t)=>{switch(e){case P.session_cancel:{let e=Fn.parse(t);return r.cancel(e)}case P.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Vn.parse(t);return r.unstable_didOpenDocument(e)}case P.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Er.parse(t);return r.unstable_didChangeDocument(e)}case P.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=zn.parse(t);return r.unstable_didCloseDocument(e)}case P.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Hn.parse(t);return r.unstable_didSaveDocument(e)}case P.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Bn.parse(t);return r.unstable_didFocusDocument(e)}case P.nes_accept:{if(!r.unstable_acceptNes)return;let e=Pn.parse(t);return r.unstable_acceptNes(e)}case P.nes_reject:{if(!r.unstable_rejectNes)return;let e=qn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw q.methodNotFound(e)}};this.connection=new vi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(F.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(F.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(F.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(F.fs_write_text_file,e)??{}}async createTerminal(e){return new _i((await this.connection.sendRequest(F.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(F.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(F.elicitation_complete,e)}async extMethod(e,t){return await this.connection.sendRequest(e,t)}async extNotification(e,t){return await this.connection.sendNotification(e,t)}get signal(){return this.connection.signal}get closed(){return this.connection.closed}};hi=Symbol.asyncDispose;var _i=class{constructor(e,n,r){t(this,`id`,void 0),t(this,`sessionId`,void 0),t(this,`connection`,void 0),this.id=e,this.sessionId=n,this.connection=r}async currentOutput(){return await this.connection.sendRequest(F.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(F.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(F.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(F.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[hi](){await this.release()}},vi=class{constructor(e,n,r){t(this,`pendingResponses`,new Map),t(this,`nextRequestId`,0),t(this,`requestHandler`,void 0),t(this,`notificationHandler`,void 0),t(this,`stream`,void 0),t(this,`writeQueue`,Promise.resolve()),t(this,`abortController`,new AbortController),t(this,`closedPromise`,void 0),this.requestHandler=e,this.notificationHandler=n,this.stream=r,this.closedPromise=new Promise(e=>{this.abortController.signal.addEventListener(`abort`,()=>e())}),this.receive()}get signal(){return this.abortController.signal}get closed(){return this.closedPromise}async receive(){let e;try{let e=this.stream.readable.getReader();try{for(;!this.abortController.signal.aborted;){let{value:t,done:n}=await e.read();if(n)break;if(t)try{this.processMessage(t)}catch(e){console.error(`Unexpected error during message processing:`,t,e),`id`in t&&t.id!==void 0&&this.sendMessage({jsonrpc:`2.0`,id:t.id,error:{code:-32700,message:`Parse error`}})}}}finally{e.releaseLock()}}catch(t){e=t}finally{this.close(e)}}close(e){if(this.abortController.signal.aborted)return;let t=e??Error(`ACP connection closed`);for(let e of this.pendingResponses.values())e.reject(t);this.pendingResponses.clear(),this.abortController.abort(t)}async processMessage(e){if(`method`in e&&`id`in e){let t=await this.tryCallRequestHandler(e.method,e.params);`error`in t&&console.error(`Error handling request`,e,t.error),await this.sendMessage({jsonrpc:`2.0`,id:e.id,...t})}else if(`method`in e){let t=await this.tryCallNotificationHandler(e.method,e.params);`error`in t&&console.error(`Error handling notification`,e,t.error)}else`id`in e?this.handleResponse(e):console.error(`Invalid message`,{message:e})}async tryCallRequestHandler(e,t){try{return{result:await this.requestHandler(e,t)??null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof ee)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}async tryCallNotificationHandler(e,t){try{return await this.notificationHandler(e,t),{result:null}}catch(e){if(e instanceof q)return e.toResult();if(e instanceof ee)return q.invalidParams(e.format()).toResult();let t;(e instanceof Error||typeof e==`object`&&e&&`message`in e&&typeof e.message==`string`)&&(t=e.message);try{return q.internalError(t?JSON.parse(t):{}).toResult()}catch{return q.internalError({details:t}).toResult()}}}handleResponse(e){let t=this.pendingResponses.get(e.id);if(t){if(`result`in e)t.resolve(e.result);else if(`error`in e){let{code:n,message:r,data:i}=e.error;t.reject(new q(n,r,i))}this.pendingResponses.delete(e.id)}else console.error(`Got response to unknown request`,e.id)}sendRequest(e,t){this.throwIfClosed();let n=this.nextRequestId++,r=new Promise((e,t)=>{this.pendingResponses.set(n,{resolve:e,reject:t})});return r.catch(()=>{}),this.sendMessage({jsonrpc:`2.0`,id:n,method:e,params:t}),r}async sendNotification(e,t){this.throwIfClosed(),await this.sendMessage({jsonrpc:`2.0`,method:e,params:t})}throwIfClosed(){if(this.abortController.signal.aborted)throw this.abortController.signal.reason??Error(`ACP connection closed`)}async sendMessage(e){return this.writeQueue=this.writeQueue.then(async()=>{let t=this.stream.writable.getWriter();try{await t.write(e)}finally{t.releaseLock()}}).catch(e=>{this.close(e)}),this.writeQueue}},q=class e extends Error{constructor(e,n,r){super(n),t(this,`code`,void 0),t(this,`data`,void 0),this.code=e,this.name=`RequestError`,this.data=r}static parseError(t,n){return new e(-32700,`Parse error${n?`: ${n}`:``}`,t)}static invalidRequest(t,n){return new e(-32600,`Invalid request${n?`: ${n}`:``}`,t)}static methodNotFound(t){return new e(-32601,`"Method not found": ${t}`,{method:t})}static invalidParams(t,n){return new e(-32602,`Invalid params${n?`: ${n}`:``}`,t)}static internalError(t,n){return new e(-32603,`Internal error${n?`: ${n}`:``}`,t)}static authRequired(t,n){return new e(-32e3,`Authentication required${n?`: ${n}`:``}`,t)}static resourceNotFound(t){return new e(-32002,`Resource not found${t?`: ${t}`:``}`,t&&{uri:t})}toResult(){return{error:{code:this.code,message:this.message,data:this.data}}}toErrorResponse(){return{code:this.code,message:this.message,data:this.data}}};re(),j(),ce(),ge(),de(),n(),i(),h(),l(),d(),g(),Se();function J(e,t){if(e)return t?De(e)?e:Oe(t,e):e}var yi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,bi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function xi(e,t=`permissions.defaultMode`){if(e===void 0)return`default`;if(typeof e!=`string`)throw Error(`Invalid ${t}: expected a string.`);let n=e.trim().toLowerCase();if(n===``)throw Error(`Invalid ${t}: expected a non-empty string.`);let r=bi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!yi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Si(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var Ci=256;function wi(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=Ci?t:`${t.slice(0,Ci-1)}…`}function Ti(e,t){if(!t)return e;let n=N.resolve(t),r=N.resolve(e);return r.startsWith(n+N.sep)||r===n?N.relative(n,r):e}function Ei(e){let t="```";for(let n of e.matchAll(/^```+/gm)??[])for(;n[0].length>=t.length;)t+="`";return`${t}\n${e}${e.endsWith(`
4
+ `)?``:`
5
+ `}${t}`}function Y(e,t=!1,n){let r=e.name,i=e.input;switch(r){case`Agent`:case`Task`:{let e=i?.description??`Task`,t=i?.prompt;return{title:e,kind:`think`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Bash`:{let e=i?.command??`Terminal`,t=i?.description;return{title:e,kind:`execute`,content:t?[{type:`content`,content:{type:`text`,text:t}}]:[]}}case`Read`:{let e=i?.file_path,t=e??`File`,r=i?.offset,a=i?.limit,o=``;a&&a>0?o=` (${r??1} - ${(r??1)+a-1})`:r&&(o=` (from line ${r})`);let s=t?Ti(t,n):`File`,c=J(e,n);return{title:`Read ${s}${o}`,kind:`read`,locations:c?[{path:c,line:r??1}]:[],content:[]}}case`Write`:{let e=i?.file_path??``,t=i?.content??``,r=e?Ti(e,n):void 0,a=J(e,n);return{title:r?`Write ${r}`:`Write`,kind:`edit`,content:a?[{type:`diff`,path:a,oldText:null,newText:t}]:[{type:`content`,content:{type:`text`,text:t}}],locations:a?[{path:a}]:[]}}case`Edit`:{let e=i?.file_path??``,t=i?.old_string??``,r=i?.new_string??``,a=e?Ti(e,n):void 0,o=J(e,n);return{title:a?`Edit ${a}`:`Edit`,kind:`edit`,content:o?[{type:`diff`,path:o,oldText:t||null,newText:r}]:[],locations:o?[{path:o}]:[]}}case`Glob`:{let e=i?.path??``,t=i?.pattern??``,r=J(e,n),a=`Find`;return e&&(a+=` \`${e}\``),t&&(a+=` \`${t}\``),{title:a,kind:`search`,content:[],locations:r?[{path:r}]:[]}}case`Grep`:{let e=i?.pattern??``,t=i?.path??``,n=`grep`;return i?.[`-i`]&&(n+=` -i`),i?.[`-n`]&&(n+=` -n`),i?.[`-A`]!==void 0&&(n+=` -A ${i[`-A`]}`),i?.[`-B`]!==void 0&&(n+=` -B ${i[`-B`]}`),i?.[`-C`]!==void 0&&(n+=` -C ${i[`-C`]}`),i?.output_mode===`files_with_matches`?n+=` -l`:i?.output_mode===`count`&&(n+=` -c`),i?.head_limit!==void 0&&(n+=` | head -${i.head_limit}`),i?.glob&&(n+=` --include="${i.glob}"`),i?.type&&(n+=` --type=${i.type}`),i?.multiline&&(n+=` -P`),e&&(n+=` "${e}"`),t&&(n+=` ${t}`),{title:n,kind:`search`,content:[]}}case`TodoWrite`:{let e=i?.todos;return{title:Array.isArray(e)?`Update TODOs: ${e.map(e=>e.content).join(`, `)}`:`Update TODOs`,kind:`think`,content:[]}}case`ExitPlanMode`:{let e=i?.plan;return{title:`Ready to code?`,kind:`switch_mode`,content:e?[{type:`content`,content:{type:`text`,text:e}}]:[]}}default:return{title:r||`Unknown Tool`,kind:`other`,content:[]}}}function Di(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:Oi(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function Oi(e,t){let n=e=>({type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e});switch(e.type){case`text`:{let n=e.text;return{type:`text`,text:t?`\`\`\`\n${n}\n\`\`\``:n}}case`image`:{let t=e.source;return t?.type===`base64`?{type:`image`,data:t.data,mimeType:t.media_type}:n(t?.type===`url`?`[image: ${t.url}]`:`[image: file reference]`)}case`resource_link`:{let t=e.uri;return{type:`resource_link`,uri:t,name:e.name??t,mimeType:e.mimeType}}case`resource`:{let t=e.resource;return{type:`resource`,resource:{uri:t?.uri??``,mimeType:t?.mimeType,...typeof t?.text==`string`?{text:t.text}:{},...typeof t?.blob==`string`?{blob:t.blob}:{}}}}case`tool_reference`:return n(`Tool: ${e.tool_name}`);case`tool_search_tool_search_result`:{let t=e.tool_references;return n(`Tools found: ${t?.map(e=>e.tool_name).join(`, `)||`none`}`)}case`tool_search_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);case`web_fetch_result`:return n(`Fetched: ${e.url}`);case`web_fetch_tool_result_error`:return n(`Error: ${e.error_code}`);case`code_execution_result`:case`bash_code_execution_result`:return n(`Output: ${e.stdout||e.stderr||``}`);case`code_execution_tool_result_error`:case`bash_code_execution_tool_result_error`:return n(`Error: ${e.error_code}`);case`text_editor_code_execution_view_result`:return n(e.content);case`text_editor_code_execution_create_result`:return n(e.is_file_update?`File updated`:`File created`);case`text_editor_code_execution_str_replace_result`:{let t=e.lines;return n(t?.join(`
6
+ `)||``)}case`text_editor_code_execution_tool_result_error`:return n(`Error: ${e.error_code}${e.error_message?` - ${e.error_message}`:``}`);default:try{return{type:`text`,text:JSON.stringify(e)}}catch{return{type:`text`,text:`[content]`}}}}function ki(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Di(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:Ei(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Ei(e.text)}:Oi(e,!1)}))}:{};case`Bash`:{let e=``;if(i&&typeof i==`object`&&!Array.isArray(i)&&i.type===`bash_code_execution_result`){let t=i;e=[t.stdout,t.stderr].filter(Boolean).join(`
7
+ `)}else typeof i==`string`?e=i:Array.isArray(i)&&i.length>0&&(e=i.map(e=>e.type===`text`?e.text:``).join(`
8
+ `));return e.trim()?{content:[{type:`content`,content:{type:`text`,text:`\`\`\`console\n${e.trimEnd()}\n\`\`\``}}]}:{}}case`Edit`:case`Write`:return{};case`ExitPlanMode`:return{title:`Exited Plan Mode`};default:return Di(i??``,r)}}function Ai(e){return e===`in_progress`?`in_progress`:e===`completed`?`completed`:`pending`}function X(e,t,n,r,i,a,o){let s=[];for(let i of e){let e=i.type,a=null;switch(e){case`text`:case`text_delta`:{let e=i.text??``;a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`thinking`:case`thinking_delta`:{let e=i.thinking??``;a={sessionUpdate:`agent_thought_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`text`,text:e}};break}case`image`:{let e=i.source;e?.type===`base64`&&(a={sessionUpdate:t===`assistant`?`agent_message_chunk`:`user_message_chunk`,...o?.messageId?{messageId:o.messageId}:{},content:{type:`image`,data:e.data,mimeType:e.media_type}});break}case`tool_use`:case`server_tool_use`:case`mcp_tool_use`:{let t=i.id??``,n=i.name??`unknown`,s=i.input,c=t in r;if(r[t]={type:e,id:t,name:n,input:s},n===`TodoWrite`){let e=s?.todos;Array.isArray(e)&&(a={sessionUpdate:`plan`,entries:e.map(e=>({content:e.content,status:Ai(e.status),priority:`medium`}))})}else{let e=s?{...s}:{};a=c?{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call_update`,status:`in_progress`,rawInput:e,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}:{_meta:{claudeCode:{toolName:n}},toolCallId:t,sessionUpdate:`tool_call`,rawInput:e,status:`pending`,...Y({name:n,id:t,input:s??{}},!1,o?.cwd)}}break}case`tool_result`:case`mcp_tool_result`:{let e=i.tool_use_id??``,t=r[e];if(!t)break;if(t.name!==`TodoWrite`){let n=ki(i,{name:t.name,id:t.id},!1);a={_meta:{claudeCode:{toolName:t.name}},toolCallId:e,sessionUpdate:`tool_call_update`,status:i.is_error===!0?`failed`:`completed`,rawOutput:i.content,...n}}break}case`redacted_thinking`:case`input_json_delta`:case`citations_delta`:case`signature_delta`:case`container_upload`:case`compaction`:case`compaction_delta`:break}if(a){if(o?.parentToolUseId){let e=a._meta;a._meta={...e,claudeCode:{...e?.claudeCode??{},parentToolUseId:o.parentToolUseId}}}s.push({sessionId:n,update:a})}}return s}function ji(e,t,n,r,i){let a=e.message;if(!a)return[];let o=a.content;if(!o)return[];if(typeof o==`string`)return[{sessionId:t,update:{sessionUpdate:`agent_message_chunk`,...i?.messageId?{messageId:i.messageId}:{},content:{type:`text`,text:o}}}];let s=i?.streamingActive?o.filter(e=>e.type!==`text`&&e.type!==`thinking`):o;return s.length===0?[]:X(s,`assistant`,t,n,r,void 0,i)}function Mi(e,t,n,r,i){let a=e.event;if(!a)return[];switch(a.type){case`content_block_start`:{let o=a.content_block;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`content_block_delta`:{let o=a.delta;return o?X([o],`assistant`,t,n,r,void 0,{clientCapabilities:i?.clientCapabilities,parentToolUseId:e.parent_tool_use_id,cwd:i?.cwd,messageId:i?.messageId}):[]}case`message_start`:case`message_delta`:case`message_stop`:case`content_block_stop`:return[];default:return[]}}function Ni(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function Pi(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=Ni(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}var Fi=console;function Ii(e,t){if(t.aborted)return Promise.resolve({done:!0,value:void 0});let n,r=new Promise(e=>{n=()=>e({done:!0,value:void 0}),t.addEventListener(`abort`,n,{once:!0})});return Promise.race([e.next(),r]).finally(()=>{n&&t.removeEventListener(`abort`,n)})}async function Li(e,t,n,r,i,a,o,s){let c=`end_turn`,l={inputTokens:0,outputTokens:0,cachedReadTokens:0,cachedWriteTokens:0},u=null,d=null,f=2e5,p=!1,m=null;try{for(;!r.aborted;){let s=await Ii(t,r);if(s.done||r.aborted)break;let h=s.value;if(h==null)continue;let g=h;switch(g.type){case`system`:g.subtype===`compact_boundary`&&(u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
9
+
10
+ Compacting completed.`}}}));break;case`result`:{let t=g.usage;t&&(l.inputTokens+=t.input_tokens??0,l.outputTokens+=t.output_tokens??0,l.cachedReadTokens+=t.cache_read_input_tokens??0,l.cachedWriteTokens+=t.cache_creation_input_tokens??0);let i=g.modelUsage;if(i&&d){let e=Pi(i,d);e?.contextWindow&&(f=e.contextWindow)}u!==null&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`usage_update`,used:u,size:f}});let a=g.subtype,o=g.is_error;if(r.aborted){c=`cancelled`;break}switch(a){case`success`:{let e=g.stop_reason;c=e===`max_tokens`?`max_tokens`:e===`refusal`?`refusal`:`end_turn`,o&&(c=`end_turn`);break}case`error_during_execution`:c=g.stop_reason===`max_tokens`?`max_tokens`:`end_turn`;break;case`error_max_budget_usd`:case`error_max_turns`:case`error_max_structured_output_retries`:c=`max_turn_requests`;break}break}case`stream_event`:{let t=g.parent_tool_use_id;t===null&&m===null&&(m=M());let r=Mi(g,e,i,n,{clientCapabilities:a,cwd:o,messageId:t===null?m??void 0:void 0});for(let e of r)await n.sessionUpdate(e);p=!0;break}case`assistant`:{let t=g.message,r=g.parent_tool_use_id;if(t?.usage&&r===null){let e=t.usage;u=(typeof e.input_tokens==`number`?e.input_tokens:0)+(typeof e.output_tokens==`number`?e.output_tokens:0)+(typeof e.cache_read_input_tokens==`number`?e.cache_read_input_tokens:0)+(typeof e.cache_creation_input_tokens==`number`?e.cache_creation_input_tokens:0)}r===null&&t?.model&&t.model!==`<synthetic>`&&(d=t.model);let s;r===null&&(m===null&&(m=M()),s=m);let c=ji(g,e,i,n,{clientCapabilities:a,cwd:o,parentToolUseId:r,streamingActive:p,messageId:s});for(let e of c)await n.sessionUpdate(e);r===null&&(m=null);break}case`user`:break;case`progress`:{let t=g.data;if(!t)break;let r=t.type;if(r===`agent_progress`||r===`skill_progress`){let r=t.message;if(r){let t=r.content;if(t)for(let r of t)r.type===`text`&&await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:r.text}}})}}break}case`tool_use_summary`:break;case`attachment`:break;case`compact_boundary`:u=0,await n.sessionUpdate({sessionId:e,update:{sessionUpdate:`agent_message_chunk`,content:{type:`text`,text:`
11
+
12
+ Compacting completed.`}}});break;default:Fi.debug(`Ignoring unknown SDK message type`);break}}if(r.aborted||s?.())return{stopReason:`cancelled`,usage:l}}catch(e){if(r.aborted)return{stopReason:`cancelled`,usage:l};throw e}return{stopReason:c,usage:l}}async function Ri(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Fi.debug(`Ignoring unknown SDK message type`);continue}if(t.isMeta===!0)continue;let s=t.message?.content;if(!s)continue;let c=t.type===`assistant`?`assistant`:`user`;if(typeof s==`string`){if(!s.trim())continue;let t=M();await n.sessionUpdate({sessionId:e,update:{sessionUpdate:c===`assistant`?`agent_message_chunk`:`user_message_chunk`,...t?{messageId:t}:{},content:{type:`text`,text:s}}});continue}if(Array.isArray(s)){let t=X(s,c,e,r,n,void 0,{clientCapabilities:i,cwd:a,messageId:M()});for(let e of t)await n.sessionUpdate(e)}}}function zi(e,t,n,i,a,o,s,c){return async(n,l,u,d,f,p)=>{let m=Vi(i);if(n.name===`ExitPlanMode`)return Bi(e,t,f,l,m,a,o,s,c);if(p!==void 0)return p;try{let e=await r(n,l,u,d,f);if(e.behavior===`allow`||e.behavior===`deny`)return e}catch(e){return console.error(`[ACP Permissions] Pipeline error:`,e),{behavior:`deny`,message:`Permission pipeline failed`,decisionReason:{type:`other`,reason:`Permission pipeline failed`},toolUseID:f}}let h=Y({name:n.name,id:f,input:l},m,a),g={toolCallId:f,title:h.title,kind:h.kind,status:`pending`,rawInput:l},_=[{kind:`allow_always`,name:`Always Allow`,optionId:`allow_always`},{kind:`allow_once`,name:`Allow`,optionId:`allow`},{kind:`reject_once`,name:`Reject`,optionId:`reject`},{kind:`reject_always`,name:`Always Reject`,optionId:`reject_always`}];try{let n=await e.requestPermission({sessionId:t,toolCall:g,options:_});if(n.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Permission request cancelled by client`,decisionReason:{type:`mode`,mode:`default`},toolUseID:f};if(n.outcome.outcome===`selected`&&`optionId`in n.outcome&&n.outcome.optionId!==void 0){let e=n.outcome.optionId;if(e===`allow`||e===`allow_always`)return{behavior:`allow`,updatedInput:l}}return{behavior:`deny`,message:`Permission denied by client`,decisionReason:{type:`mode`,mode:`default`}}}catch(e){return console.error(`[ACP Permissions] Client request error:`,e),{behavior:`deny`,message:`Permission request failed`,decisionReason:{type:`mode`,mode:`default`}}}}}async function Bi(e,t,n,r,i,a,o,s,c){let l=[{kind:`allow_always`,name:`Yes, and use "auto" mode`,optionId:`auto`},{kind:`allow_always`,name:`Yes, and auto-accept edits`,optionId:`acceptEdits`},{kind:`allow_once`,name:`Yes, and manually approve edits`,optionId:`default`},{kind:`reject_once`,name:`No, keep planning`,optionId:`plan`}];s?.()===!0&&l.unshift({kind:`allow_always`,name:`Yes, and bypass permissions`,optionId:`bypassPermissions`});let u=Y({name:`ExitPlanMode`,id:n,input:r},i,a),d={toolCallId:n,title:u.title,kind:u.kind,status:`pending`,rawInput:r},f=await e.requestPermission({sessionId:t,toolCall:d,options:l});if(f.outcome.outcome===`cancelled`)return c?.(),{behavior:`deny`,message:`Tool use aborted`,decisionReason:{type:`mode`,mode:`default`}};if(f.outcome.outcome===`selected`&&`optionId`in f.outcome&&f.outcome.optionId!==void 0){let n=f.outcome.optionId;if(l.some(e=>e.optionId===n)&&(n==="default"||n===`acceptEdits`||n===`auto`||n===`bypassPermissions`))return o?.(n),await e.sessionUpdate({sessionId:t,update:{sessionUpdate:`current_mode_update`,currentModeId:n}}),{behavior:`allow`,updatedInput:r}}return{behavior:`deny`,message:`User rejected request to exit plan mode.`,decisionReason:{type:`mode`,mode:`plan`}}}function Vi(e){if(!e)return!1;if(e.terminal===!0)return!0;let t=e._meta;return!t||typeof t!=`object`?!1:t.terminal_output===!0}pe(),be(),o(),ue(),e(),_();var Z=class{constructor(e){t(this,`conn`,void 0),t(this,`sessions`,new Map),t(this,`clientCapabilities`,void 0),this.conn=e}async initialize(e){return this.clientCapabilities=e.clientCapabilities,{protocolVersion:1,authMethods:[],agentInfo:{name:`workmate`,title:`Work Mate`,version:typeof globalThis.MACRO==`object`&&globalThis.MACRO!==null?String(globalThis.MACRO.VERSION??`0.0.0`):`0.0.0`},agentCapabilities:{_meta:{claudeCode:{promptQueueing:!0,forkSession:!0}},promptCapabilities:{image:!1,embeddedContext:!0},mcpCapabilities:{http:!0,sse:!0},loadSession:!0,sessionCapabilities:{list:{},resume:{},close:{},delete:{}}}}}async authenticate(e){return{}}async newSession(e){let t=await this.createSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async unstable_resumeSession(e){let t=await this.getOrCreateSession({...e,replay:!1});return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async loadSession(e){let t=await this.getOrCreateSession(e);return this.scheduleAvailableCommandsUpdate(t.sessionId),t}async listSessions(e){if(e.cursor!==void 0&&e.cursor!==null)throw Error(`Pagination cursor not supported: listSessions returns all results in a single page.`);let t=e.cwd||ne(),n=await le(t),r=await s({dir:t}),i=[];for(let e of r){if(!e.cwd||await le(e.cwd)!==n)continue;let t=wi(e.summary??``);i.push({sessionId:e.sessionId,cwd:e.cwd,...t?{title:t}:{},updatedAt:new Date(e.lastModified).toISOString()})}return{sessions:i}}async unstable_forkSession(e){let{initialMessages:t}=await Hi(e.sessionId),n=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{initialMessages:t});return this.scheduleAvailableCommandsUpdate(n.sessionId),n}async unstable_closeSession(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return await this.teardownSession(e.sessionId),{}}async unstable_deleteSession(e){let t=await oe(e.sessionId);if(t)try{await Ee(t.filePath)}catch(e){if(e.code!==`ENOENT`)throw e}return this.sessions.has(e.sessionId)&&await this.teardownSession(e.sessionId),{}}async extMethod(e,t){if(e===`session/delete`){let e=t.sessionId;if(typeof e!=`string`||e.length===0)throw Error(`session/delete requires a non-empty sessionId`);return this.unstable_deleteSession({sessionId:e})}throw q.methodNotFound(e)}async cancel(e){let t=this.sessions.get(e.sessionId);if(t){t.cancelled=!0,t.cancelGeneration+=1;for(let[,e]of t.pendingMessages)e.resolve(!0);t.pendingMessages.clear(),t.pendingQueue=[],t.pendingQueueHead=0,t.queryEngine.interrupt()}}async setSessionMode(e){if(!this.sessions.get(e.sessionId))throw Error(`Session not found`);return this.applySessionMode(e.sessionId,e.modeId),await this.conn.sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:e.modeId}}),await this.updateConfigOption(e.sessionId,`mode`,e.modeId),{}}async unstable_setSessionModel(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);return t.queryEngine.setModel(e.modelId),await this.updateConfigOption(e.sessionId,`model`,e.modelId),{}}async sendAvailableCommandsUpdate(e){let t=this.sessions.get(e);if(!t)return;let n=t.commands.filter(e=>e.type===`prompt`&&!e.isHidden&&e.userInvocable!==!1).map(e=>({name:e.name,description:e.description,input:e.argumentHint?{hint:e.argumentHint}:void 0}));await this.conn.sessionUpdate({sessionId:e,update:{sessionUpdate:`available_commands_update`,availableCommands:n}})}scheduleAvailableCommandsUpdate(e){setTimeout(()=>{this.sendAvailableCommandsUpdate(e).catch(e=>{console.error(`[ACP] Failed to send available commands update:`,e)})},0)}};async function Hi(e){let t;try{let n=await p(e);n&&n.messages.length>0&&(t=_e(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Ui=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Wi(e){return Ui.includes(e)}function Gi(e,t,n){if(t){let t=Ki(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Yi())throw Error(`Mode not available: bypassPermissions cannot run as root (start the agent as a non-root user, or set IS_SANDBOX=1).`);return t}return qi(n)??`default`}function Ki(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return xi(e,t)}function qi(e){if(e!=null)try{return xi(e,`permissions.defaultMode`)}catch(e){let t=e instanceof Error?e.message:String(e);console.error(`[ACP] Invalid permissions.defaultMode, using default:`,t);return}}function Ji(e,t){return!!e&&Object.hasOwn(e,t)}function Yi(){return Xi()}function Xi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Zi(e,t){return[{id:`mode`,name:`Mode`,description:`Session permission mode`,category:`mode`,type:`select`,currentValue:e.currentModeId,options:e.availableModes.map(e=>({value:e.id,name:e.name,description:e.description}))},{id:`model`,name:`Model`,description:`AI model to use`,category:`model`,type:`select`,currentValue:t.currentModelId,options:t.availableModels.map(e=>({value:e.modelId,name:e.name,description:e.description??void 0}))}]}function Qi(e){let t=[];if(!Array.isArray(e))return t;for(let n of e){if(typeof n!=`object`||!n)continue;let e=n;if(Array.isArray(e.options))for(let n of e.options)n&&typeof n==`object`&&typeof n.value==`string`&&t.push(n.value);else typeof n.value==`string`&&t.push(n.value)}return t}function Q(e){return e.conn}function $(e){return e.clientCapabilities}function $i(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}j();function ea(){return se().permissions?.defaultMode}async function ta(e,t={}){fe();let n=t.sessionId??M(),r=e.cwd;A(n,ie()),k(r);let i=process.cwd(),o=!1;try{process.chdir(r),o=!0}catch{}ae(),xe();try{let i=he(),o=u(i),s=e._meta,l=Ji(s,`permissionMode`),d=Gi(l?s?.permissionMode:void 0,l,ea()),p=$(this),h=this.conn,g=zi(h,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,p,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),_=Yi(),v={...c(),toolPermissionContext:{...i,mode:d,isBypassPermissionsModeAvailable:_}},[y,b]=await Promise.all([m(r),f(r)]);v.agentDefinitions=b;let x=new ve({cwd:r,tools:o,commands:y,mcpClients:[],agents:b.activeAgents,canUseTool:g,getAppState:()=>v,setAppState:e=>{let t=e(v);Object.assign(v,t)},readFileCache:new a(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),S={currentModeId:d,availableModes:[{id:`default`,name:`Default`,description:`Standard behavior, prompts for dangerous operations`},{id:`acceptEdits`,name:`Accept Edits`,description:`Auto-accept file edit operations`},{id:`plan`,name:`Plan Mode`,description:`Planning mode, no actual tool execution`},{id:`auto`,name:`Auto`,description:`Use a model classifier to approve/deny permission prompts.`},..._?[{id:`bypassPermissions`,name:`Bypass Permissions`,description:`Skip all permission checks`}]:[],{id:`dontAsk`,name:`Don't Ask`,description:`Don't prompt for permissions, deny if not pre-approved`}]},C=ye(),w=me(),T={availableModels:C.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:w};x.setModel(w);let E=Zi(S,T),D={queryEngine:x,cancelled:!1,cancelGeneration:0,cwd:r,modes:S,models:T,configOptions:E,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:p,appState:v,commands:y,sessionFingerprint:Si({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,D),{sessionId:n,modes:S,models:T,configOptions:E}}finally{o&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:ta}),_(),j(),ue();async function na(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Si({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await oe(e.sessionId,e.cwd);return A(e.sessionId,r?Ce(r.filePath):null),k(e.cwd),t&&await this.replaySessionHistory(e),{sessionId:e.sessionId,modes:n.modes,models:n.models,configOptions:n.configOptions}}await this.teardownSession(e.sessionId)}let r=await oe(e.sessionId,e.cwd),i=r?Ce(r.filePath):null;A(e.sessionId,i),k(e.cwd);let a;if(r)try{let t=await p(e.sessionId);t&&t.messages.length>0&&(a=_e(t.messages))}catch(e){console.error(`[ACP] Failed to load session history:`,e)}let o=await this.createSession({cwd:e.cwd,mcpServers:e.mcpServers??[],_meta:e._meta},{sessionId:e.sessionId,initialMessages:a});if(t&&a&&a.length>0){let t=this.sessions.get(e.sessionId);t&&await Ri(e.sessionId,a,Q(this),t.toolUseCache,$(this),t.cwd)}return{sessionId:o.sessionId,modes:o.modes,models:o.models,configOptions:o.configOptions}}async function ra(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function ia(e){try{let t=await p(e.sessionId);if(!t||t.messages.length===0)return;let n=_e(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await Ri(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function aa(e,t){if(!Wi(t))throw Error(`Invalid mode: ${t}`);let n=this.sessions.get(e);if(n){if(t===`bypassPermissions`&&!n.appState.toolPermissionContext.isBypassPermissionsModeAvailable||!n.modes.availableModes.some(e=>e.id===t))throw Error(`Mode not available: ${t}`);n.modes={...n.modes,currentModeId:t},n.appState.toolPermissionContext={...n.appState.toolPermissionContext,mode:t}}}async function oa(e,t,n){let r=this.sessions.get(e);r&&($i(this,r,t,n),r.configOptions=r.configOptions.map(e=>e.id===t&&typeof e.currentValue==`string`?{...e,currentValue:n}:e),await Q(this).sessionUpdate({sessionId:e,update:{sessionUpdate:`config_option_update`,configOptions:r.configOptions}}))}Object.assign(Z.prototype,{getOrCreateSession:na,teardownSession:ra,replaySessionHistory:ia,applySessionMode:aa,updateConfigOption:oa});function sa(e){if(!e||e.length===0)return``;let t=[];for(let n of e){let e=n;if(e.type===`text`)t.push(String(e.text??``));else if(e.type===`resource_link`){let n=typeof e.name==`string`?e.name:void 0,r=typeof e.uri==`string`?e.uri:void 0;t.push(ca(n,r))}else if(e.type===`resource`){let n=e.resource;if(n&&typeof n.text==`string`)t.push(n.text);else if(n&&typeof n.blob==`string`){let e=typeof n.mimeType==`string`?n.mimeType:`application/octet-stream`,r=typeof n.uri==`string`?n.uri:`(unknown uri)`;t.push(`Embedded resource: ${r} (${e}, base64 blob, ${n.blob.length} chars)`)}}}return t.filter(e=>e.length>0).join(`
13
+ `)}function ca(e,t){let n=[];return e&&e.length>0&&n.push(`name=${e}`),t&&t.length>0&&n.push(`uri=${t}`),n.length>0?`Resource link: ${n.join(`, `)}`:`Resource link`}function la(e){for(;e.pendingQueueHead<e.pendingQueue.length;){let t=e.pendingQueue[e.pendingQueueHead++];if(!t)continue;let n=e.pendingMessages.get(t);if(n)return e.pendingMessages.delete(t),ua(e),n}ua(e)}function ua(e){if(e.pendingQueueHead!==0){if(e.pendingQueueHead>=e.pendingQueue.length){e.pendingQueue=[],e.pendingQueueHead=0;return}e.pendingQueueHead>1024&&e.pendingQueueHead*2>e.pendingQueue.length&&(e.pendingQueue=e.pendingQueue.slice(e.pendingQueueHead),e.pendingQueueHead=0)}}j();async function da(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=sa(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=M();if(await new Promise(n=>{t.pendingQueue.push(e),t.pendingMessages.set(e,{resolve:n})}))return{stopReason:`cancelled`}}if(t.cancelGeneration!==i)return{stopReason:`cancelled`};t.cancelled=!1,t.promptRunning=!0;try{t.queryEngine.resetAbortController(),A(e.sessionId,ie());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Li(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await pa(this,e.sessionId,r),o){let e={inputTokens:o.inputTokens,outputTokens:o.outputTokens,cachedReadTokens:o.cachedReadTokens,cachedWriteTokens:o.cachedWriteTokens,thoughtTokens:0,totalTokens:o.inputTokens+o.outputTokens+o.cachedReadTokens+o.cachedWriteTokens+0};return{stopReason:a,usage:e,...n?{userMessageId:n}:{},_meta:{claudeCode:{usage:e}}}}return{stopReason:a,...n?{userMessageId:n}:{}}}catch(n){let r=n instanceof Error&&(n.name===`AbortError`||/abort|cancelled|interrupt/i.test(n.message));if(t.cancelled||r)return{stopReason:`cancelled`};throw n instanceof Error&&(n.message.includes(`terminated`)||n.message.includes(`process exited`))?(await this.teardownSession(e.sessionId),Error(`The Work Mate Agent process exited unexpectedly. Please start a new session.`)):n}finally{let e=la(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session not found`);if(typeof e.value!=`string`)throw Error(`Invalid value for config option ${e.configId}: ${String(e.value)}`);let n=t.configOptions.find(t=>t.id===e.configId);if(!n)throw Error(`Unknown config option: ${e.configId}`);if(n.type===`select`){let t=Qi(n.options);if(!t.includes(e.value))throw Error(`Invalid value '${e.value}' for config option ${e.configId}; must be one of: ${t.join(`, `)}`)}let r=e.value;return e.configId===`mode`?(this.applySessionMode(e.sessionId,r),await Q(this).sessionUpdate({sessionId:e.sessionId,update:{sessionUpdate:`current_mode_update`,currentModeId:r}})):e.configId===`model`&&t.queryEngine.setModel(r),$i(this,t,e.configId,r),t.configOptions=t.configOptions.map(t=>t.id===e.configId&&typeof t.currentValue==`string`?{...t,currentValue:r}:t),{configOptions:t.configOptions}}async function pa(e,t,n){let r=e.sessions.get(t);if(!r)return;let i=r.toolUseCache;if(i.__sessionInfoTitleSent)return;i.__sessionInfoTitleSent=!0;let a=wi(n).slice(0,100);try{await Q(e).sessionUpdate({sessionId:t,update:{sessionUpdate:`session_info_update`,...a?{title:a}:{},updatedAt:new Date().toISOString()}})}catch(e){console.error(`[ACP] Failed to send session_info_update:`,e)}}Object.assign(Z.prototype,{prompt:da,setSessionConfigOption:fa}),de(),Se();function ma(e,t){let n=we.toWeb(e);return mi(Te.toWeb(t),n)}async function ha(){fe(),xe();let e=ma(process.stdin,process.stdout),t,n=new gi(e=>(t=new Z(e),t),e);console.log=console.error,console.info=console.error,console.warn=console.error,console.debug=console.error;async function r(){for(let[e]of t.sessions)try{await t.unstable_closeSession({sessionId:e})}catch{}process.exit(0)}n.closed.then(r).catch(r),process.on(`SIGTERM`,r),process.on(`SIGINT`,r),process.on(`unhandledRejection`,(e,t)=>{console.error(`Unhandled Rejection at:`,t,`reason:`,e)}),process.stdin.resume()}export{ha as runAcpAgent};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{l as r,o as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{E as s,O as c,S as l,i as u,l as d,n as f,s as p,v as ee}from"./esm-lWlUmoUA.js";import{B as te,C as ne,D as re,E as ie,F as m,O as ae,S as oe,T as h,b as se,c as ce,i as le,m as ue,n as g,o as de,u as fe,v as _,x as pe}from"./esm-BbMeEYcz.js";import{n as me,t as he}from"./esm-sVMjGuep.js";import{I as ge,Q as _e,S as ve,ut as ye,zt as be}from"./state-BowF111d.js";import{C as xe,L as Se,i as Ce,x as we}from"./debug-8DCufdSp.js";import{Br as Te,Gt as Ee,Ur as De,Ut as Oe,Wt as v,qt as ke}from"./settings-DKN4xSpQ.js";import{i as Ae,t as je}from"./execFileNoThrow-BsfuytkN.js";import{a as Me,n as Ne,o as Pe,r as Fe}from"./platform-Dzff1WWw.js";import{St as Ie,Tt as Le,en as Re,f as ze,s as Be,tn as Ve,yt as He}from"./model-BwBE0Pt5.js";import{i as Ue,t as We}from"./genericProcessUtils-BYi0OefF.js";import{arch as Ge,hostname as Ke,platform as qe,release as Je}from"os";import{extname as Ye}from"path";import{stat as Xe}from"fs/promises";import{inspect as Ze}from"util";import*as Qe from"process";import{AsyncLocalStorage as $e}from"async_hooks";var y,et=e((()=>{(function(e){e[e.UNSPECIFIED=0]=`UNSPECIFIED`,e[e.TRACE=1]=`TRACE`,e[e.TRACE2=2]=`TRACE2`,e[e.TRACE3=3]=`TRACE3`,e[e.TRACE4=4]=`TRACE4`,e[e.DEBUG=5]=`DEBUG`,e[e.DEBUG2=6]=`DEBUG2`,e[e.DEBUG3=7]=`DEBUG3`,e[e.DEBUG4=8]=`DEBUG4`,e[e.INFO=9]=`INFO`,e[e.INFO2=10]=`INFO2`,e[e.INFO3=11]=`INFO3`,e[e.INFO4=12]=`INFO4`,e[e.WARN=13]=`WARN`,e[e.WARN2=14]=`WARN2`,e[e.WARN3=15]=`WARN3`,e[e.WARN4=16]=`WARN4`,e[e.ERROR=17]=`ERROR`,e[e.ERROR2=18]=`ERROR2`,e[e.ERROR3=19]=`ERROR3`,e[e.ERROR4=20]=`ERROR4`,e[e.FATAL=21]=`FATAL`,e[e.FATAL2=22]=`FATAL2`,e[e.FATAL3=23]=`FATAL3`,e[e.FATAL4=24]=`FATAL4`})(y||(y={}))})),b,x,S=e((()=>{b=class{emit(e){}enabled(){return!1}},x=new b}));function tt(e,t,n){return r=>r===e?t:n}var C,w,nt=e((()=>{C=Symbol.for(`io.opentelemetry.js.api.logs`),w=globalThis})),rt,T,it=e((()=>{S(),rt=class{getLogger(e,t,n){return new b}},T=new rt})),at,ot=e((()=>{S(),at=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}emit(e){this._getLogger().emit(e)}enabled(e){return this._getLogger().enabled(e)}_getLogger(){if(this._delegate)return this._delegate;let e=this._provider._getDelegateLogger(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):x}}})),st,ct=e((()=>{it(),ot(),st=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new at(this,e,t,n)}_getDelegate(){return this._delegate??T}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}})),lt,ut=e((()=>{nt(),it(),ct(),lt=class e{constructor(){this._proxyLoggerProvider=new st}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return w[C]?this.getLoggerProvider():(w[C]=tt(1,e,T),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return w[C]?.call(w,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete w[C],this._proxyLoggerProvider=new st}}})),dt,E=e((()=>{et(),S(),ut(),dt=lt.getInstance()}));function ft(){return`workmate/0.0.22`}var pt=e((()=>{}));function mt(){return process.platform===`linux`&&r(process.env.CLAUDE_CODE_BUBBLEWRAP)}function ht(){return process.platform===`linux`?D??!1:!1}async function gt(){if(O!==void 0)return O;if(process.platform===`darwin`)return O=null,null;try{let e=await We(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Oe)if(e.includes(t))return O=t,t}}catch{}return O=null,null}async function _t(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&v.platform!==`darwin`?await gt()||`pycharm`:v.terminal}function vt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&v.platform!==`darwin`?O===void 0?`pycharm`:O||`pycharm`:v.terminal}async function yt(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await gt()}var bt,D,O,xt,St=e((()=>{n(),ke(),i(),Ae(),Ue(),bt=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await je(`test`,[`-f`,`/.dockerenv`]);return e===0}),D=null,process.platform===`linux`&&Xe(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{D=!0},()=>{D=!1}),xt={...v,terminal:vt(),getIsDocker:bt,getIsBubblewrapSandbox:mt,isMuslEnvironment:ht,getTerminalWithJetBrainsDetectionAsync:_t,initJetBrainsDetection:yt}}));function Ct(e){return wt?.has(e)??!1}var wt,Tt=e((()=>{Ce(),Se()}));function k(){return At.getStore()}function Et(e,t){return At.run(e,t)}function Dt(e){return e?.agentType===`subagent`}function Ot(){let e=k();if(!(!Dt(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function kt(){let e=k();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var At,jt=e((()=>{At=new $e}));function Mt(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function Nt(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function Pt(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&Ct(t))}function Ft(e,t,n){let r=It(e);return!r||!Gt.has(r.serverName)&&!Pt(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function It(e){if(!e.startsWith(`mcp__`))return;let t=e.split(`__`);if(t.length<3)return;let n=t[1],r=t.slice(2).join(`__`);if(!(!n||!r))return{serverName:n,mcpToolName:r}}function Lt(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function Rt(e,t=0){if(typeof e==`string`)return e.length>Kt?`${e.slice(0,qt)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=Jt)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,M).map(e=>Rt(e,t+1));return e.length>M&&n.push(`…[${e.length} items]`),n}if(typeof e==`object`){let n=Object.entries(e).filter(([e])=>!e.startsWith(`_`)),r=n.slice(0,M).map(([e,n])=>[e,Rt(n,t+1)]);return n.length>M&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function zt(e){if(!Nt())return;let t=xe(Rt(e));return t.length>j&&(t=`${t.slice(0,j)}…[truncated]`),t}function A(e){let t=Ye(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>Yt?`other`:n}function Bt(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=A(t);e&&(r.add(e),n=e)}for(let t of e.split(Zt)){if(!t)continue;let e=t.split(Qt);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(Xt.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=A(i);a&&!r.has(a)&&(r.add(a),n=n?`${n},${a}`:a)}}if(n)return n}function Vt(){let e=k();if(e)return{agentId:e.agentId,parentSessionId:e.parentSessionId,agentType:e.agentType};let t=process.env.CLAUDE_CODE_AGENT_ID,n=process.env.CLAUDE_CODE_PARENT_SESSION_ID,r=t?`standalone`:void 0;if(t||r||n)return{...t?{agentId:t}:{},...r?{agentType:r}:{},...n?{parentSessionId:n}:{}};let i=_e();return i?{parentSessionId:i}:{}}function Ht(){try{let e=process.memoryUsage(),t=process.cpuUsage(),n=Date.now(),r;if(N&&P){let e=n-P;e>0&&(r=(t.user-N.user+(t.system-N.system))/(e*1e3)*100)}return N=t,P=n,{uptime:process.uptime(),rss:e.rss,heapTotal:e.heapTotal,heapUsed:e.heapUsed,external:e.external,arrayBuffers:e.arrayBuffers,constrainedMemory:process.constrainedMemory(),cpuUsage:t,cpuPercent:r}}catch{return}}async function Ut(e={}){let t=e.model?String(e.model):Be(),n=typeof e.betas==`string`?e.betas:Re(t).join(`,`),[r,i]=await Promise.all([en(),Te()]),a=Ht();return{model:t,sessionId:ye(),userType:process.env.USER_TYPE||``,...n.length>0?{betas:n}:{},envContext:r,...process.env.CLAUDE_CODE_ENTRYPOINT&&{entrypoint:process.env.CLAUDE_CODE_ENTRYPOINT},...process.env.CLAUDE_AGENT_SDK_VERSION&&{agentSdkVersion:process.env.CLAUDE_AGENT_SDK_VERSION},isInteractive:String(ge()),clientType:ve(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...Vt(),...He()&&{subscriptionType:He()},...i&&{rh:i}}}function Wt(e,t,n={}){let{envContext:r,processMetrics:i,rh:a,skillMode:o,observerMode:s,...c}=e,l={platform:r.platform,platform_raw:r.platformRaw,arch:r.arch,node_version:r.nodeVersion,terminal:r.terminal||`unknown`,package_managers:r.packageManagers,runtimes:r.runtimes,is_running_with_bun:r.isRunningWithBun,is_ci:r.isCi,is_claubbit:r.isClaubbit,is_claude_code_remote:r.isClaudeCodeRemote,is_local_agent_mode:r.isLocalAgentMode,is_conductor:r.isConductor,is_github_action:r.isGithubAction,is_claude_code_action:r.isClaudeCodeAction,is_claude_ai_auth:r.isClaudeAiAuth,version:r.version,build_time:r.buildTime,deployment_environment:r.deploymentEnvironment};r.remoteEnvironmentType&&(l.remote_environment_type=r.remoteEnvironmentType),r.claudeCodeContainerId&&(l.claude_code_container_id=r.claudeCodeContainerId),r.claudeCodeRemoteSessionId&&(l.claude_code_remote_session_id=r.claudeCodeRemoteSessionId),r.tags&&(l.tags=r.tags.split(`,`).map(e=>e.trim()).filter(Boolean)),r.githubEventName&&(l.github_event_name=r.githubEventName),r.githubActionsRunnerEnvironment&&(l.github_actions_runner_environment=r.githubActionsRunnerEnvironment),r.githubActionsRunnerOs&&(l.github_actions_runner_os=r.githubActionsRunnerOs),r.githubActionRef&&(l.github_action_ref=r.githubActionRef),r.wslVersion&&(l.wsl_version=r.wslVersion),r.linuxDistroId&&(l.linux_distro_id=r.linuxDistroId),r.linuxDistroVersion&&(l.linux_distro_version=r.linuxDistroVersion),r.linuxKernel&&(l.linux_kernel=r.linuxKernel),r.vcs&&(l.vcs=r.vcs),r.versionBase&&(l.version_base=r.versionBase);let u={session_id:c.sessionId,model:c.model,user_type:c.userType,is_interactive:c.isInteractive===`true`,client_type:c.clientType};if(c.betas&&(u.betas=c.betas),c.entrypoint&&(u.entrypoint=c.entrypoint),c.agentSdkVersion&&(u.agent_sdk_version=c.agentSdkVersion),c.sweBenchRunId&&(u.swe_bench_run_id=c.sweBenchRunId),c.sweBenchInstanceId&&(u.swe_bench_instance_id=c.sweBenchInstanceId),c.sweBenchTaskId&&(u.swe_bench_task_id=c.sweBenchTaskId),c.agentId&&(u.agent_id=c.agentId),c.parentSessionId&&(u.parent_session_id=c.parentSessionId),c.agentType&&(u.agent_type=c.agentType),t.githubActionsMetadata){let e=t.githubActionsMetadata;l.github_actions_metadata={actor_id:e.actorId,repository_id:e.repositoryId,repository_owner_id:e.repositoryOwnerId}}let d;return(t.accountUuid||t.organizationUuid)&&(d={account_uuid:t.accountUuid,organization_uuid:t.organizationUuid}),{env:l,...i&&{process:Buffer.from(xe(i)).toString(`base64`)},...d&&{auth:d},core:u,additional:{...a&&{rh:a},...o&&{skill_mode:o},...s&&{observer_mode:s},...n}}}var Gt,Kt,qt,j,M,Jt,Yt,Xt,Zt,Qt,$t,en,N,P,tn=e((()=>{n(),ke(),St(),Ve(),ze(),be(),i(),Tt(),Ie(),De(),Pe(),jt(),we(),Gt=new Set,Kt=512,qt=128,j=4*1024,M=20,Jt=2,Yt=10,Xt=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),Zt=/\s*(?:&&|\|\||[;|])\s*/,Qt=/\s+/,$t=t(()=>{let e=`0.0.22`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),en=t(async()=>{let[e,t,n,i]=await Promise.all([v.getPackageManagers(),v.getRuntimes(),Fe(),Ne()]);return{platform:Ee(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:v.arch,nodeVersion:v.nodeVersion,terminal:xt.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:v.isRunningWithBun(),isCi:r(process.env.CI),isClaubbit:r(process.env.CLAUBBIT),isClaudeCodeRemote:r(process.env.CLAUDE_CODE_REMOTE),isLocalAgentMode:process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`,isConductor:v.isConductor(),...process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE&&{remoteEnvironmentType:process.env.CLAUDE_CODE_REMOTE_ENVIRONMENT_TYPE},...process.env.CLAUDE_CODE_CONTAINER_ID&&{claudeCodeContainerId:process.env.CLAUDE_CODE_CONTAINER_ID},...process.env.CLAUDE_CODE_REMOTE_SESSION_ID&&{claudeCodeRemoteSessionId:process.env.CLAUDE_CODE_REMOTE_SESSION_ID},...process.env.CLAUDE_CODE_TAGS&&{tags:process.env.CLAUDE_CODE_TAGS},isGithubAction:r(process.env.GITHUB_ACTIONS),isClaudeCodeAction:r(process.env.CLAUDE_CODE_ACTION),isClaudeAiAuth:Le(),version:`0.0.22`,versionBase:$t(),buildTime:`2026-08-20T09:27:22.266Z`,deploymentEnvironment:v.detectDeploymentEnvironment(),...r(process.env.GITHUB_ACTIONS)&&{githubEventName:process.env.GITHUB_EVENT_NAME,githubActionsRunnerEnvironment:process.env.RUNNER_ENVIRONMENT,githubActionsRunnerOs:process.env.RUNNER_OS,githubActionRef:process.env.GITHUB_ACTION_PATH?.includes(`claude-code-action/`)?process.env.GITHUB_ACTION_PATH.split(`claude-code-action/`)[1]:void 0},...Me()&&{wslVersion:Me()},...n??{},...i.length>0?{vcs:i.join(`,`)}:{}}}),N=null,P=null}));function nn(e){return e.setValue(F,!0)}function rn(e){return e.getValue(F)===!0}var F,I=e((()=>{f(),F=c(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function an(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!on(n)){p.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!sn(r)){p.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function on(e){return typeof e==`string`&&e!==``}function sn(e){return e==null?!0:Array.isArray(e)?cn(e):ln(typeof e)}function cn(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(ln(e)){t=e;continue}return!1}return!1}}return!0}function ln(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var un=e((()=>{f()}));function dn(){return e=>{p.error(fn(e))}}function fn(e){return typeof e==`string`?e:JSON.stringify(pn(e))}function pn(e){let t={},n=e;for(;n!==null;)Object.getOwnPropertyNames(n).forEach(e=>{if(t[e])return;let r=n[e];r&&(t[e]=String(r))}),n=Object.getPrototypeOf(n);return t}var mn=e((()=>{f()}));function hn(e){try{gn(e)}catch{}}var gn,_n=e((()=>{mn(),gn=dn()}));function vn(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){p.warn(`Unknown value ${Ze(t)} for ${e}, expected a number, using defaults`);return}return n}function L(e){let t=process.env[e];if(!(t==null||t.trim()===``))return t}var yn=e((()=>{f()})),bn,xn=e((()=>{bn=`2.9.0`})),Sn,Cn=e((()=>{Sn=`process.runtime.name`})),R,wn=e((()=>{xn(),_(),Cn(),R={[ie]:`opentelemetry`,[Sn]:`node`,[h]:ae,[re]:bn}})),z,Tn=e((()=>{yn(),wn(),z=performance})),En=e((()=>{Tn()}));function B(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Fn)]}function Dn(e){return Nn(B(z.timeOrigin),B(typeof e==`number`?e:z.now()))}function On(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=V),[n,r]}function kn(e){return e[0]*1e6+e[1]/1e3}function An(e){return e[0]+e[1]/V}function jn(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function Mn(e){return jn(e)||typeof e==`number`||e instanceof Date}function Nn(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=V&&(n[1]-=V,n[0]+=1),n}var Pn,Fn,V,In=e((()=>{En(),Pn=9,Fn=10**6,V=10**Pn})),H,Ln=e((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(H||(H={}))}));function Rn(e){if(!zn(e)||Bn(e)!==Un)return!1;let t=qn(e);if(t===null)return!0;let n=G.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&U.call(n)===Kn}function zn(e){return typeof e==`object`&&!!e}function Bn(e){return e==null?e===void 0?Gn:Wn:K&&K in Object(e)?Vn(e):Hn(e)}function Vn(e){let t=G.call(e,K),n=e[K],r=!1;try{e[K]=void 0,r=!0}catch{}let i=Jn.call(e);return r&&(t?e[K]=n:delete e[K]),i}function Hn(e){return Jn.call(e)}var Un,Wn,Gn,U,Kn,qn,W,G,K,Jn,Yn=e((()=>{Un=`[object Object]`,Wn=`[object Null]`,Gn=`[object Undefined]`,U=Function.prototype.toString,Kn=U.call(Object),qn=Object.getPrototypeOf,W=Object.prototype,G=W.hasOwnProperty,K=Symbol?Symbol.toStringTag:void 0,Jn=W.toString}));function Xn(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Qn(t,e.shift(),0,n);return t}function Zn(e){return q(e)?e.slice():e}function Qn(e,t,n=0,r){let i;if(!(n>nr)){if(n++,Y(e)||Y(t)||er(t))i=Zn(t);else if(q(e)){if(i=e.slice(),q(t))for(let e=0,n=t.length;e<n;e++)i.push(Zn(t[e]));else if(J(t)){let e=Object.keys(t);for(let n=0,r=e.length;n<r;n++){let r=e[n];r===`__proto__`||r===`constructor`||r===`prototype`||(i[r]=Zn(t[r]))}}}else if(J(e))if(J(t)){if(!tr(e,t))return t;i=Object.assign({},e);let a=Object.keys(t);for(let o=0,s=a.length;o<s;o++){let s=a[o];if(s===`__proto__`||s===`constructor`||s===`prototype`)continue;let c=t[s];if(Y(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if($n(e,s,r)||$n(t,s,r))delete i[s];else{if(J(a)&&J(o)){let n=r.get(a)||[],i=r.get(o)||[];n.push({obj:e,key:s}),i.push({obj:t,key:s}),r.set(a,n),r.set(o,i)}i[s]=Qn(i[s],c,n,r)}}}}else i=t;return i}}function $n(e,t,n){let r=n.get(e[t])||[];for(let n=0,i=r.length;n<i;n++){let i=r[n];if(i.key===t&&i.obj===e)return!0}return!1}function q(e){return Array.isArray(e)}function er(e){return typeof e==`function`}function J(e){return!Y(e)&&!q(e)&&!er(e)&&typeof e==`object`}function Y(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function tr(e,t){return!(!Rn(e)||!Rn(t))}var nr,rr=e((()=>{Yn(),nr=20})),ir,ar=e((()=>{a(),ir=class{constructor(){o(this,`_promise`,void 0),o(this,`_resolve`,void 0),o(this,`_reject`,void 0),this._promise=new Promise((e,t)=>{this._resolve=e,this._reject=t})}get promise(){return this._promise}resolve(e){this._resolve(e)}reject(e){this._reject(e)}}})),or,sr=e((()=>{ar(),a(),or=class{constructor(e,t){o(this,`_isCalled`,!1),o(this,`_deferred`,new ir),o(this,`_callback`,void 0),o(this,`_that`,void 0),this._callback=e,this._that=t}get isCalled(){return this._isCalled}get promise(){return this._deferred.promise}call(...e){if(!this._isCalled){this._isCalled=!0;try{Promise.resolve(this._callback.call(this._that,...e)).then(e=>this._deferred.resolve(e),e=>this._deferred.reject(e))}catch(e){this._deferred.reject(e)}}return this._deferred.promise}}}));function cr(e,t){return new Promise(n=>{d.with(nn(d.active()),()=>{e.export(t,n)})})}var lr=e((()=>{f(),I()})),ur,X=e((()=>{I(),un(),_n(),mn(),In(),Ln(),En(),rr(),sr(),lr(),ur={_export:cr}}));function dr(){if(Z===void 0)try{let e=globalThis.process.argv0;Z=e?`unknown_service:${e}`:`unknown_service`}catch{Z=`unknown_service`}return Z}var Z,fr=e((()=>{})),Q,pr=e((()=>{Q=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function mr(e,t){return yr.FromAttributeList(Object.entries(e),t)}function hr(){return mr({[ne]:dr(),[h]:R[h],[ie]:R[ie],[re]:R[re]})}function gr(e){return e.map(([e,t])=>Q(t)?[e,t.catch(t=>{p.debug(`promise rejection for resource attribute: %s - %s`,e,t)})]:[e,t])}function _r(e){if(typeof e==`string`||e===void 0)return e;p.warn(`Schema URL must be string or undefined, got %s. Schema URL will be ignored.`,e)}function vr(e,t){let n=e?.schemaUrl,r=t?.schemaUrl,i=n===void 0||n===``,a=r===void 0||r===``;if(i)return r;if(a||n===r)return n;p.warn(`Schema URL merge conflict: old resource has "%s", updating resource has "%s". Resulting resource will have undefined Schema URL.`,n,r)}var yr,br=e((()=>{f(),X(),_(),fr(),pr(),a(),yr=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=gr(t),r._asyncAttributesPending=t.filter(([e,t])=>Q(t)).length>0,r}constructor(e,t){o(this,`_rawAttributes`,void 0),o(this,`_asyncAttributesPending`,!1),o(this,`_schemaUrl`,void 0),o(this,`_memoizedAttributes`,void 0);let n=e.attributes??{};this._rawAttributes=Object.entries(n).map(([e,t])=>(Q(t)&&(this._asyncAttributesPending=!0),[e,t])),this._rawAttributes=gr(this._rawAttributes),this._schemaUrl=_r(t?.schemaUrl)}get asyncAttributesPending(){return this._asyncAttributesPending}async waitForAsyncAttributes(){if(this.asyncAttributesPending){for(let e=0;e<this._rawAttributes.length;e++){let[t,n]=this._rawAttributes[e];this._rawAttributes[e]=[t,Q(n)?await n:n]}this._asyncAttributesPending=!1}}get attributes(){if(this.asyncAttributesPending&&p.error(`Accessing resource attributes before async attributes settled`),this._memoizedAttributes)return this._memoizedAttributes;let e={};for(let[t,n]of this._rawAttributes){if(Q(n)){p.debug(`Unsettled resource attribute ${t} skipped`);continue}n!=null&&(e[t]??(e[t]=n))}return this._asyncAttributesPending||(this._memoizedAttributes=e),e}getRawAttributes(){return this._rawAttributes}get schemaUrl(){return this._schemaUrl}merge(t){if(t==null)return this;let n=vr(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),xr,Sr,Cr=e((()=>{f(),_(),X(),a(),xr=class{constructor(){o(this,`_MAX_LENGTH`,255),o(this,`_COMMA_SEPARATOR`,`,`),o(this,`_LABEL_KEY_VALUE_SPLITTER`,`=`)}detect(e){let t={},n=L(`OTEL_RESOURCE_ATTRIBUTES`),r=L(`OTEL_SERVICE_NAME`);if(n)try{let e=this._parseResourceAttributes(n);Object.assign(t,e)}catch(e){p.debug(`EnvDetector failed: ${e instanceof Error?e.message:e}`)}return r&&(t[ne]=r),{attributes:t}}_parseResourceAttributes(e){if(!e)return{};let t={},n=e.split(this._COMMA_SEPARATOR).filter(e=>e.trim()!==``);for(let e of n){let n=e.split(this._LABEL_KEY_VALUE_SPLITTER);if(n.length!==2)throw Error(`Invalid format for OTEL_RESOURCE_ATTRIBUTES: "${e}". Expected format: key=value. The ',' and '=' characters must be percent-encoded in keys and values.`);let[r,i]=n,a=r.trim(),o=i.trim();if(a.length===0)throw Error(`Invalid OTEL_RESOURCE_ATTRIBUTES: empty attribute key in "${e}".`);let s,c;try{s=decodeURIComponent(a),c=decodeURIComponent(o)}catch(t){throw Error(`Failed to percent-decode OTEL_RESOURCE_ATTRIBUTES entry "${e}": ${t instanceof Error?t.message:t}`,{cause:t})}if(s.length>this._MAX_LENGTH)throw Error(`Attribute key exceeds the maximum length of ${this._MAX_LENGTH} characters: "${s}".`);if(c.length>this._MAX_LENGTH)throw Error(`Attribute value exceeds the maximum length of ${this._MAX_LENGTH} characters for key "${s}".`);t[s]=c}return t}},Sr=new xr})),wr,Tr,Er,Dr,Or,kr=e((()=>{wr=`host.arch`,Tr=`host.id`,Er=`host.name`,Dr=`os.type`,Or=`os.version`}));async function Ar(){if(!$)switch(Qe.platform){case`darwin`:$=(await import(`./getMachineId-darwin-CsRhaP3y.js`)).getMachineId;break;case`linux`:$=(await import(`./getMachineId-linux-Bd7UBNRQ.js`)).getMachineId;break;case`freebsd`:$=(await import(`./getMachineId-bsd-Cut1kHoA.js`)).getMachineId;break;case`win32`:$=(await import(`./getMachineId-win-DamF2CH_.js`)).getMachineId;break;default:$=(await import(`./getMachineId-unsupported-vFGP8E_8.js`)).getMachineId;break}return $()}var $,jr=e((()=>{})),Mr,Nr,Pr=e((()=>{Mr=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},Nr=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),Fr,Ir,Lr=e((()=>{kr(),jr(),Pr(),Fr=class{detect(e){return{attributes:{[Er]:Ke(),[wr]:Mr(Ge()),[Tr]:Ar()}}}},Ir=new Fr})),Rr,zr,Br=e((()=>{kr(),Pr(),Rr=class{detect(e){return{attributes:{[Dr]:Nr(qe()),[Or]:Je()}}}},zr=new Rr})),Vr=e((()=>{Lr(),Br(),kr()})),Hr=e((()=>{Vr()})),Ur=e((()=>{Cr(),Hr()})),Wr=e((()=>{br(),Ur(),fr()}));function Gr(e){return Kr(e,new WeakSet)}function Kr(e,t){if(e==null||typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e instanceof Uint8Array)return!0;if(typeof e==`object`){if(t.has(e))return!1;if(t.add(e),Array.isArray(e))return e.every(e=>Kr(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Kr(e,t))}return!1}var qr=e((()=>{})),Jr,Yr=e((()=>{f(),g(),_(),qr(),a(),Jr=class{set severityText(e){this._isLogRecordReadonly()||(this._severityText=e)}get severityText(){return this._severityText}set severityNumber(e){this._isLogRecordReadonly()||(this._severityNumber=e)}get severityNumber(){return this._severityNumber}set body(e){this._isLogRecordReadonly()||(this._body=e)}get body(){return this._body}get eventName(){return this._eventName}set eventName(e){this._isLogRecordReadonly()||(this._eventName=e)}get droppedAttributesCount(){return this._droppedAttributesCount}constructor(e,t,n){o(this,`hrTime`,void 0),o(this,`hrTimeObserved`,void 0),o(this,`spanContext`,void 0),o(this,`resource`,void 0),o(this,`instrumentationScope`,void 0),o(this,`attributes`,{}),o(this,`_severityText`,void 0),o(this,`_severityNumber`,void 0),o(this,`_body`,void 0),o(this,`_eventName`,void 0),o(this,`_attributesCount`,0),o(this,`_droppedAttributesCount`,0),o(this,`_isReadonly`,!1),o(this,`_logRecordLimits`,void 0);let{timestamp:r,observedTimestamp:i,eventName:a,severityNumber:s,severityText:c,body:l,attributes:d={},exception:f,context:p}=n,te=Date.now();if(this.hrTime=ue(r??te),this.hrTimeObserved=ue(i??te),p){let e=u.getSpanContext(p);e&&ee(e)&&(this.spanContext=e)}this.severityNumber=s,this.severityText=c,this.body=l,this.resource=e.resource,this.instrumentationScope=t,this._logRecordLimits=e.logRecordLimits,this._eventName=a,this.setAttributes(d),f!=null&&this._setException(f)}setAttribute(e,t){if(this._isLogRecordReadonly())return this;if(e.length===0)return p.warn(`Invalid attribute key: ${e}`),this;if(!Gr(t))return p.warn(`Invalid attribute value set for key: ${e}`),this;let n=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n&&this._attributesCount>=this._logRecordLimits.attributeCountLimit?(this._droppedAttributesCount++,this._droppedAttributesCount===1&&p.warn(`Dropping extra attributes.`),this):(this.attributes[e]=this._truncateToSize(t),n&&this._attributesCount++,this)}setAttributes(e){for(let[t,n]of Object.entries(e))this.setAttribute(t,n);return this}setBody(e){return this.body=e,this}setEventName(e){return this.eventName=e,this}setSeverityNumber(e){return this.severityNumber=e,this}setSeverityText(e){return this.severityText=e,this}_makeReadonly(){this._isReadonly=!0}_truncateToSize(e){let t=this._logRecordLimits.attributeValueLengthLimit;if(t<=0)return p.warn(`Attribute value limit must be positive, got ${t}`),e;if(e==null)return e;if(typeof e==`string`)return this._truncateToLimitUtil(e,t);if(e instanceof Uint8Array)return e;if(Array.isArray(e))return e.map(e=>this._truncateToSize(e));if(typeof e==`object`){let t={};for(let[n,r]of Object.entries(e))t[n]=this._truncateToSize(r);return t}return e}_setException(e){let t=!1;if(typeof e==`string`||typeof e==`number`)Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(se,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(oe,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(oe,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(se,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(pe,n.stack),t=!0)}t||p.warn(`Failed to record an exception ${e}`)}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_isLogRecordReadonly(){return this._isReadonly&&p.warn(`Can not execute the operation on emitted log record`),this._isReadonly}}})),Xr,Zr=e((()=>{E(),f(),Yr(),a(),Xr=class{constructor(e,t){o(this,`instrumentationScope`,void 0),o(this,`_sharedState`,void 0),o(this,`_loggerConfig`,void 0),this.instrumentationScope=e,this._sharedState=t,this._loggerConfig=this._sharedState.getLoggerConfig(this.instrumentationScope)}emit(e){let t=this._loggerConfig,n=e.context||d.active(),r=e.severityNumber??y.UNSPECIFIED;if(r!==y.UNSPECIFIED&&r<t.minimumSeverity)return;if(t.traceBased){let e=u.getSpanContext(n);if(e&&ee(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return}let i=new Jr(this._sharedState,this.instrumentationScope,{context:n,...e});this._sharedState.loggerMetrics.emitLog(),this._sharedState.activeProcessor.onEmit(i,n),i._makeReadonly()}enabled(e){let t=this._loggerConfig;if(t.disabled)return!1;let n=e?.severityNumber;if(typeof n==`number`&&n!==y.UNSPECIFIED&&n<t.minimumSeverity)return!1;let r=e?.context||d.active();if(t.traceBased){let e=u.getSpanContext(r);if(e&&ee(e)&&(e.traceFlags&l.SAMPLED)!==l.SAMPLED)return!1}let i={context:r,instrumentationScope:this.instrumentationScope,severityNumber:e?.severityNumber,eventName:e?.eventName};for(let e of this._sharedState.processors)if(!e.enabled||e.enabled(i))return!0;return!1}}})),Qr,$r=e((()=>{Qr=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),ei,ti=e((()=>{g(),a(),ei=class{constructor(e,t){o(this,`processors`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),this.processors=e,this.forceFlushTimeoutMillis=t}async forceFlush(){let e=this.forceFlushTimeoutMillis;await Promise.all(this.processors.map(t=>de(t.forceFlush(),e)))}onEmit(e,t){this.processors.forEach(n=>n.onEmit(e,t))}async shutdown(){await Promise.all(this.processors.map(e=>e.shutdown()))}enabled(e){for(let t of this.processors)if(!t.enabled||t.enabled(e))return!0;return!1}}}));function ni(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var ri=e((()=>{})),ii,ai=e((()=>{ii=`otel.sdk.log.created`})),oi,si=e((()=>{ai(),a(),oi=class{constructor(e){o(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(ii,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),ci,li=e((()=>{ci=`0.215.0`})),ui,di,fi,pi=e((()=>{f(),E(),$r(),ti(),ri(),si(),li(),a(),ui={disabled:!1,minimumSeverity:y.UNSPECIFIED,traceBased:!1},di=()=>({...ui}),fi=class{constructor(e,t,n,r,i,a){o(this,`loggers`,new Map),o(this,`activeProcessor`,void 0),o(this,`registeredLogRecordProcessors`,[]),o(this,`resource`,void 0),o(this,`forceFlushTimeoutMillis`,void 0),o(this,`logRecordLimits`,void 0),o(this,`processors`,void 0),o(this,`loggerMetrics`,void 0),o(this,`_loggerConfigurator`,void 0),o(this,`_loggerConfigs`,new Map),this.resource=e,this.forceFlushTimeoutMillis=t,this.logRecordLimits=n,this.processors=r,r.length>0?(this.registeredLogRecordProcessors=r,this.activeProcessor=new ei(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Qr,this._loggerConfigurator=i??di;let c=a?a.getMeter(`@opentelemetry/sdk-logs`,ci):s();this.loggerMetrics=new oi(c)}getLoggerConfig(e){let t=ni(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),mi,hi=e((()=>{f(),E(),he(),g(),Zr(),pi(),a(),mi=class{constructor(e={}){o(this,`_shutdownOnce`,void 0),o(this,`_sharedState`,void 0);let t={resource:e.resource??me(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??di,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new fi(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new le(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return p.warn(`A shutdown LoggerProvider cannot provide a Logger`),x;e||p.warn(`Logger requested without instrumentation scope name.`);let r=e||`unknown`,i=`${r}@${t||``}:${n?.schemaUrl||``}`;return this._sharedState.loggers.has(i)||this._sharedState.loggers.set(i,new Xr({name:r,version:t,schemaUrl:n?.schemaUrl},this._sharedState)),this._sharedState.loggers.get(i)}forceFlush(){return this._shutdownOnce.isCalled?(p.warn(`invalid attempt to force flush after LoggerProvider shutdown`),this._shutdownOnce.promise):this._sharedState.activeProcessor.forceFlush()}shutdown(){return this._shutdownOnce.isCalled?(p.warn(`shutdown may only be called once per LoggerProvider`),this._shutdownOnce.promise):this._shutdownOnce.call()}_shutdown(){return this._sharedState.activeProcessor.shutdown()}}})),gi,_i=e((()=>{g(),gi=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:fe(e.hrTime),traceId:e.spanContext?.traceId,spanId:e.spanContext?.spanId,traceFlags:e.spanContext?.traceFlags,severityText:e.severityText,severityNumber:e.severityNumber,eventName:e.eventName,body:e.body,attributes:e.attributes}}_sendLogRecords(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});t?.({code:ce.SUCCESS})}}}));async function vi(e){let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];r.resource.asyncAttributesPending&&r.resource.waitForAsyncAttributes&&t.push(r.resource.waitForAsyncAttributes())}t!=null&&t.length>0&&await Promise.all(t)}var yi,bi,xi=e((()=>{f(),g(),a(),yi=class{constructor(e,t,n){o(this,`_exportCompleted`,void 0),o(this,`_exportScheduledPromise`,void 0),o(this,`_exportScheduledResolve`,void 0),this._exportScheduledPromise=new Promise(e=>{this._exportScheduledResolve=e}),this._exportCompleted=this._executeExport(e,t,n)}get exportCompleted(){return this._exportCompleted}get exportScheduled(){return this._exportScheduledPromise}async _executeExport(e,t,n){try{await vi(t),await d.with(te(d.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){m(e),this._exportScheduledResolve()}}async _exportWithTimeout(e,t,n){return new Promise((r,i)=>{let a=setTimeout(()=>{i(Error(`Timeout`))},n);e.export(t,e=>{clearTimeout(a),e.code===ce.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},bi=class{constructor(e,t){o(this,`_maxExportBatchSize`,void 0),o(this,`_maxQueueSize`,void 0),o(this,`_scheduledDelayMillis`,void 0),o(this,`_exportTimeoutMillis`,void 0),o(this,`_exporter`,void 0),o(this,`_currentExport`,null),o(this,`_finishedLogRecords`,[]),o(this,`_timer`,void 0),o(this,`_shutdownOnce`,void 0),o(this,`_flushing`,!1),this._exporter=e,this._maxExportBatchSize=t?.maxExportBatchSize??512,this._maxQueueSize=t?.maxQueueSize??2048,this._scheduledDelayMillis=t?.scheduledDelayMillis??5e3,this._exportTimeoutMillis=t?.exportTimeoutMillis??3e4,this._shutdownOnce=new le(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(p.warn(`BatchLogRecordProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize)}onEmit(e){this._shutdownOnce.isCalled||this._addToBuffer(e)}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}_addToBuffer(e){this._finishedLogRecords.length>=this._maxQueueSize||(this._finishedLogRecords.push(e),this._maybeStartTimer())}shutdown(){return this._shutdownOnce.call()}async _shutdown(){this.onShutdown(),await this._flushAll(),await this._exporter.shutdown()}async _flushAll(){if(this._flushing)return;this._flushing=!0;let e=this._finishedLogRecords;for(this._finishedLogRecords=[],this._clearTimer(),this._currentExport!==null&&(await this._exporter.forceFlush(),await this._currentExport.exportCompleted,this._currentExport=null);e.length>0;){let t;e.length<=this._maxExportBatchSize?(t=e,e=[]):t=e.splice(0,this._maxExportBatchSize);let n=new yi(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){m(e)}finally{this._currentExport=null}}this._flushing=!1,this._maybeStartTimer()}_extractBatch(){if(this._finishedLogRecords.length===0)return null;if(this._finishedLogRecords.length<=this._maxExportBatchSize){let e=this._finishedLogRecords;return this._finishedLogRecords=[],e}else return this._finishedLogRecords.splice(0,this._maxExportBatchSize)}_exportOneBatch(){this._clearTimer();let e=this._extractBatch();if(e===null)return;let t=new yi(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,m(e),this._maybeStartTimer()})}_maybeStartTimer(){if(!this._shutdownOnce.isCalled&&!this._flushing&&this._finishedLogRecords.length!==0&&this._currentExport===null){if(this._finishedLogRecords.length>=this._maxExportBatchSize){this._exportOneBatch();return}this._timer===void 0&&(this._timer=setTimeout(()=>{this._timer=void 0,this._exportOneBatch()},this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}}})),Si,Ci=e((()=>{xi(),Si=class extends bi{onShutdown(){}}})),wi=e((()=>{Ci()})),Ti=e((()=>{wi()})),Ei=e((()=>{hi(),_i(),Ti(),E()}));export{Bt as $,An as A,hn as B,Xn as C,Dn as D,Nn as E,Tn as F,I as G,un as H,z as I,It as J,rn as K,vn as L,Mn as M,jn as N,On as O,B as P,A as Q,L as R,rr as S,Ln as T,sn as U,_n as V,an as W,zt as X,Lt as Y,Ut as Z,mr as _,_i as a,kt as at,or as b,Wr as c,jt as ct,Ir as d,yt as dt,tn as et,Lr as f,St as ft,br as g,dt as gt,hr as h,E as ht,gi as i,Wt as it,In as j,kn as k,Br as l,Et as lt,Cr as m,pt as mt,Si as n,Ft as nt,mi as o,k as ot,Sr as p,ft as pt,nn as q,Ci as r,Mt as rt,hi as s,Ot as st,Ei as t,Nt as tt,zr as u,xt as ut,X as v,H as w,sr as x,ur as y,yn as z};
@@ -1,4 +1,4 @@
1
- import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-Nh5IZNKO.js";import{w as ee,x as te}from"./debug-D58GQBDG.js";import{o as ne,s as re}from"./log-CZ7ploQm.js";import{aborted as ie,callbackify as S,debuglog as ae,inspect as oe,promisify as se,stripVTControlCharacters as ce}from"node:util";import C,{execArgv as le,execPath as ue,hrtime as de,platform as fe}from"node:process";import w from"node:path";import{ChildProcess as pe,execFile as me,spawn as he,spawnSync as ge}from"node:child_process";import{appendFileSync as _e,createReadStream as ve,createWriteStream as ye,readFileSync as be,statSync as xe,writeFileSync as Se}from"node:fs";import{constants as Ce}from"node:os";import we from"node:tty";import{EventEmitter as Te,addAbortListener as Ee,on as De,once as T,setMaxListeners as Oe}from"node:events";import{Duplex as ke,PassThrough as Ae,Readable as E,Transform as je,Writable as Me,getDefaultHighWaterMark as Ne}from"node:stream";import{StringDecoder as Pe}from"node:string_decoder";import{fileURLToPath as Fe}from"node:url";import{Buffer as Ie}from"node:buffer";import{scheduler as Le,setImmediate as Re,setTimeout as ze}from"node:timers/promises";import{serialize as Be}from"node:v8";import{finished as D}from"node:stream/promises";function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var k=t((()=>{})),Ve,He,Ue,We,Ge=t((()=>{Ve=(e,t)=>{let n=We(He(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},He=e=>Ue(e)?e.toString():e,Ue=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,We=e=>e instanceof URL?Fe(e):e})),Ke,qe=t((()=>{k(),Ge(),Ke=(e,t=[],n={})=>{let r=Ve(e,`First argument`),[i,a]=O(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!O(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]}})),Je,Ye,A,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,j=t((()=>{({toString:Je}=Object.prototype),Ye=e=>Je.call(e)===`[object ArrayBuffer]`,A=e=>Je.call(e)===`[object Uint8Array]`,Xe=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ze=new TextEncoder,Qe=e=>Ze.encode(e),$e=new TextDecoder,et=e=>$e.decode(e),tt=(e,t)=>nt(e,t).join(``),nt=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new Pe(t),r=e.map(e=>typeof e==`string`?Qe(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},rt=e=>e.length===1&&A(e[0])?e[0]:at(it(e)),it=e=>e.map(e=>typeof e==`string`?Qe(e):e),at=e=>{let t=new Uint8Array(ot(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},ot=e=>{let t=0;for(let n of e)t+=n.length;return t}})),st,ct,lt,ut,dt,ft,pt,mt,ht,gt=t((()=>{k(),j(),st=e=>Array.isArray(e)&&Array.isArray(e.raw),ct=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=lt({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},lt=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ut(i,e.raw[r]),c=pt(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>mt(e)):[mt(l)];return pt(c,u,s)},ut=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=dt.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(dt.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
1
+ import{i as e,n as t,o as n,t as r}from"./rolldown-runtime-DaDcL9Zw.js";import{n as i,t as a}from"./defineProperty-C-QyHrDq.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./classPrivateFieldSet2-D4U5K-I3.js";import{n as m,t as h}from"./classPrivateMethodInitSpec-BXQD0Vh4.js";import{i as g,n as _,r as v,t as y}from"./figures-5ThXQEtq.js";import{n as b,t as x}from"./cwd-BcO6WHKo.js";import{w as ee,x as te}from"./debug-8DCufdSp.js";import{o as ne,s as re}from"./log-DaILwWJa.js";import{aborted as ie,callbackify as S,debuglog as ae,inspect as oe,promisify as se,stripVTControlCharacters as ce}from"node:util";import C,{execArgv as le,execPath as ue,hrtime as de,platform as fe}from"node:process";import w from"node:path";import{ChildProcess as pe,execFile as me,spawn as he,spawnSync as ge}from"node:child_process";import{appendFileSync as _e,createReadStream as ve,createWriteStream as ye,readFileSync as be,statSync as xe,writeFileSync as Se}from"node:fs";import{constants as Ce}from"node:os";import we from"node:tty";import{EventEmitter as Te,addAbortListener as Ee,on as De,once as T,setMaxListeners as Oe}from"node:events";import{Duplex as ke,PassThrough as Ae,Readable as E,Transform as je,Writable as Me,getDefaultHighWaterMark as Ne}from"node:stream";import{StringDecoder as Pe}from"node:string_decoder";import{fileURLToPath as Fe}from"node:url";import{Buffer as Ie}from"node:buffer";import{scheduler as Le,setImmediate as Re,setTimeout as ze}from"node:timers/promises";import{serialize as Be}from"node:v8";import{finished as D}from"node:stream/promises";function O(e){if(typeof e!=`object`||!e)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}var k=t((()=>{})),Ve,He,Ue,We,Ge=t((()=>{Ve=(e,t)=>{let n=We(He(e));if(typeof n!=`string`)throw TypeError(`${t} must be a string or a file URL: ${n}.`);return n},He=e=>Ue(e)?e.toString():e,Ue=e=>typeof e!=`string`&&e&&Object.getPrototypeOf(e)===String.prototype,We=e=>e instanceof URL?Fe(e):e})),Ke,qe=t((()=>{k(),Ge(),Ke=(e,t=[],n={})=>{let r=Ve(e,`First argument`),[i,a]=O(t)?[[],t]:[t,n];if(!Array.isArray(i))throw TypeError(`Second argument must be either an array of arguments or an options object: ${i}`);if(i.some(e=>typeof e==`object`&&!!e))throw TypeError(`Second argument must be an array of strings: ${i}`);let o=i.map(String),s=o.find(e=>e.includes(`\0`));if(s!==void 0)throw TypeError(`Arguments cannot contain null bytes ("\\0"): ${s}`);if(!O(a))throw TypeError(`Last argument must be an options object: ${a}`);return[r,o,a]}})),Je,Ye,A,Xe,Ze,Qe,$e,et,tt,nt,rt,it,at,ot,j=t((()=>{({toString:Je}=Object.prototype),Ye=e=>Je.call(e)===`[object ArrayBuffer]`,A=e=>Je.call(e)===`[object Uint8Array]`,Xe=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength),Ze=new TextEncoder,Qe=e=>Ze.encode(e),$e=new TextDecoder,et=e=>$e.decode(e),tt=(e,t)=>nt(e,t).join(``),nt=(e,t)=>{if(t===`utf8`&&e.every(e=>typeof e==`string`))return e;let n=new Pe(t),r=e.map(e=>typeof e==`string`?Qe(e):e).map(e=>n.write(e)),i=n.end();return i===``?r:[...r,i]},rt=e=>e.length===1&&A(e[0])?e[0]:at(it(e)),it=e=>e.map(e=>typeof e==`string`?Qe(e):e),at=e=>{let t=new Uint8Array(ot(e)),n=0;for(let r of e)t.set(r,n),n+=r.length;return t},ot=e=>{let t=0;for(let n of e)t+=n.length;return t}})),st,ct,lt,ut,dt,ft,pt,mt,ht,gt=t((()=>{k(),j(),st=e=>Array.isArray(e)&&Array.isArray(e.raw),ct=(e,t)=>{let n=[];for(let[r,i]of e.entries())n=lt({templates:e,expressions:t,tokens:n,index:r,template:i});if(n.length===0)throw TypeError(`Template script must not be empty`);let[r,...i]=n;return[r,i,{}]},lt=({templates:e,expressions:t,tokens:n,index:r,template:i})=>{if(i===void 0)throw TypeError(`Invalid backslash sequence: ${e.raw[r]}`);let{nextTokens:a,leadingWhitespaces:o,trailingWhitespaces:s}=ut(i,e.raw[r]),c=pt(n,a,o);if(r===t.length)return c;let l=t[r],u=Array.isArray(l)?l.map(e=>mt(e)):[mt(l)];return pt(c,u,s)},ut=(e,t)=>{if(t.length===0)return{nextTokens:[],leadingWhitespaces:!1,trailingWhitespaces:!1};let n=[],r=0,i=dt.has(t[0]);for(let i=0,a=0;i<e.length;i+=1,a+=1){let o=t[a];if(dt.has(o))r!==i&&n.push(e.slice(r,i)),r=i+1;else if(o===`\\`){let e=t[a+1];e===`
2
2
  `?(--i,a+=1):e===`u`&&t[a+2]===`{`?a=t.indexOf(`}`,a+3):a+=ft[e]??1}}let a=r===e.length;return a||n.push(e.slice(r)),{nextTokens:n,leadingWhitespaces:i,trailingWhitespaces:a}},dt=new Set([` `,` `,`\r`,`
3
3
  `]),ft={x:3,u:5},pt=(e,t,n)=>n||e.length===0||t.length===0?[...e,...t]:[...e.slice(0,-1),`${e.at(-1)}${t[0]}`,...t.slice(1)],mt=e=>{let t=typeof e;if(t===`string`)return e;if(t===`number`)return String(e);if(O(e)&&(`stdout`in e||`isMaxBuffer`in e))return ht(e);throw e instanceof pe||Object.prototype.toString.call(e)===`[object Promise]`?TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}."):TypeError(`Unexpected "${t}" in template expression`)},ht=({stdout:e})=>{if(typeof e==`string`)return e;if(A(e))return et(e);throw TypeError(e===void 0?`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`:`Unexpected "${typeof e}" stdout in template expression`)}})),M,_t,N,vt,P=t((()=>{M=e=>_t.includes(e),_t=[C.stdin,C.stdout,C.stderr],N=[`stdin`,`stdout`,`stderr`],vt=e=>N[e]??`stdio[${e}]`})),yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt,F=t((()=>{k(),P(),yt=e=>{let t={...e};for(let n of jt)t[n]=bt(e,n);return t},bt=(e,t)=>{let n=Array.from({length:xt(e)+1}),r=St(e[t],n,t);return kt(r,t)},xt=({stdio:e})=>Array.isArray(e)?Math.max(e.length,N.length):N.length,St=(e,t,n)=>O(e)?Ct(e,t,n):t.fill(e),Ct=(e,t,n)=>{for(let r of Object.keys(e).sort(wt))for(let i of Et(r,n,t))t[i]=e[r];return t},wt=(e,t)=>Tt(e)<Tt(t)?1:-1,Tt=e=>e===`stdout`||e===`stderr`?0:e===`all`?2:1,Et=(e,t,n)=>{if(e===`ipc`)return[n.length-1];let r=Dt(e);if(r===void 0||r===0)throw TypeError(`"${t}.${e}" is invalid.
4
4
  It must be "${t}.stdout", "${t}.stderr", "${t}.all", "${t}.ipc", or "${t}.fd3", "${t}.fd4" (and so on).`);if(r>=n.length)throw TypeError(`"${t}.${e}" is invalid: that file descriptor does not exist.
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ks as t,St as n,gi as r,ow as i,qs as a,sw as o,vi as s,yt as c}from"./loadAgentsDir-C1LkW7gl.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{n as u,t as d}from"./ExitFlow-BasHk1mk.js";import{spawnSync as f}from"child_process";function p(){return o(g)??`Goodbye!`}async function m(e){if(a())return e(),f(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let t=c()!==null;return t?(0,h.jsx)(d,{showWorktree:t,onDone:e,onCancel:()=>e()}):(e(p()),await r(0,`prompt_input_exit`),null)}var h,g;e((()=>{i(),u(),t(),s(),n(),h=l(),g=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{m as call};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Dp as n,Op as r,Ub as i,ad as a,id as o}from"./loadAgentsDir-C1LkW7gl.js";import{D as s,Gt as c,I as l,P as u,T as d,ai as f,t as p,x as m}from"./src-DL3w8VPk.js";import{t as h}from"./jsx-runtime-Bb4Xn-E0.js";import{G as g,K as _,P as v,St as y,Tt as b,U as x,W as S,f as C,g as w,gn as T,hn as E}from"./model-BwBE0Pt5.js";import{n as D,t as O}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{t as k}from"./select-C_KXmqbI.js";import{n as A,r as j,t as M}from"./modelOptions-DvNBapgG.js";import{t as N}from"./CustomSelect-B46Eh0gU.js";import{n as P,t as F}from"./fetchModelList-CqsTAWEN.js";function I({initial:e,sessionModel:t,onSelect:n,onCancel:i,isStandaloneCommand:a,showFastModeNotice:f,headerText:p}){let h=D(),y=e===null?z:e,[b,x]=(0,L.useState)(y),C=r(e=>_()?e.fastMode:!1),[T,O]=(0,L.useState)(()=>new Set(E(y)?[y.replace(/\[1m\]/i,``)]:[])),j=(0,L.useCallback)(()=>{if(!b||b===z)return;let e=b.replace(/\[1m\]/i,``);O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[b]),N=(0,L.useMemo)(()=>A(C??!1),[C]),[P,I]=(0,L.useState)(null),[B,V]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=!1;return V(!1),F().then(t=>{if(!e){if(!t||t.length===0){I(null),V(!0);return}I(t)}}).catch(()=>{e||V(!0)}),()=>{e=!0}},[]);let H=(0,L.useMemo)(()=>P?M(P,C??!1):null,[P,C]),U=P===null&&!B,W=(0,L.useMemo)(()=>{let t=H??N;return e!==null&&!t.some(t=>t.value===e)?[...t,{value:e,label:w(e),description:`Current model`}]:t},[H,N,e]),G=(0,L.useMemo)(()=>W.map(e=>({...e,value:e.value===null?z:e.value})),[W]),K=(0,L.useMemo)(()=>G.some(e=>e.value===y)?y:G[0]?.value??void 0,[G,y]),q=Math.min(10,G.length),J=Math.max(0,G.length-q),Y=G.find(e=>e.value===b)?.label,X=b!==void 0&&b!==z&&T.has(b.replace(/\[1m\]/i,``)),Z=(0,L.useCallback)(e=>{x(e)},[]);c({"modelPicker:toggle1M":()=>j()},{context:`ModelPicker`});function Q(e){if(e===z){n(null);return}let t=e.replace(/\[1m\]/i,``);n(T.has(t)?`${t}[1m]`:t)}let $=(0,R.jsxs)(l,{flexDirection:`column`,children:[(0,R.jsxs)(l,{flexDirection:`column`,children:[(0,R.jsxs)(l,{marginBottom:1,flexDirection:`column`,children:[(0,R.jsx)(u,{color:`remember`,bold:!0,children:`Select model`}),(0,R.jsx)(u,{dimColor:!0,children:p??`Choose a model for this and future sessions. Use Space to toggle 1M context.`}),t&&(0,R.jsxs)(u,{dimColor:!0,children:[`Currently using `,w(t),` for this session (set by plan mode). Selecting a model will undo this.`]})]}),(0,R.jsxs)(l,{flexDirection:`column`,marginBottom:1,children:[(0,R.jsx)(l,{flexDirection:`column`,children:(0,R.jsx)(k,{defaultValue:y,defaultFocusValue:K,options:G,onChange:Q,onFocus:Z,onCancel:i??(()=>{}),visibleOptionCount:q})}),J>0&&(0,R.jsx)(l,{paddingLeft:3,children:(0,R.jsxs)(u,{dimColor:!0,children:[`and `,J,` more…`]})}),U&&(0,R.jsx)(l,{paddingLeft:3,children:(0,R.jsx)(u,{dimColor:!0,children:`正在从 API 拉取可用模型列表…`})}),B&&P===null&&(0,R.jsx)(l,{paddingLeft:3,children:(0,R.jsx)(u,{dimColor:!0,children:`API 拉取失败,使用内置列表`})})]}),(0,R.jsx)(l,{marginBottom:1,flexDirection:`column`,children:X?(0,R.jsxs)(u,{dimColor:!0,children:[`1M context on`,(0,R.jsx)(u,{color:`subtle`,children:` · Space to toggle`})]}):(0,R.jsxs)(u,{color:`subtle`,children:[`1M context off`,Y?` for ${Y}`:``,(0,R.jsx)(u,{color:`subtle`,children:` · Space to toggle`})]})}),_()?f?(0,R.jsx)(l,{marginBottom:1,children:(0,R.jsxs)(u,{dimColor:!0,children:[`Fast mode is `,(0,R.jsx)(u,{bold:!0,children:`ON`}),` and available with `,v,` only (/fast). Switching to other models turn off fast mode.`]})}):S()&&!g()?(0,R.jsx)(l,{marginBottom:1,children:(0,R.jsxs)(u,{dimColor:!0,children:[`Use `,(0,R.jsx)(u,{bold:!0,children:`/fast`}),` to turn on Fast mode (`,v,` only).`]})}):null:null]}),a&&(0,R.jsx)(u,{dimColor:!0,italic:!0,children:h.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,R.jsxs)(d,{children:[(0,R.jsx)(s,{shortcut:`Enter`,action:`confirm`}),(0,R.jsx)(o,{action:`select:cancel`,context:`Select`,fallback:`Esc`,description:`exit`})]})})]});return a?(0,R.jsx)(m,{color:`permission`,children:$}):$}var L,R,z,B=e((()=>{L=t(f(),1),T(),O(),x(),p(),i(),n(),C(),j(),P(),a(),N(),R=h(),z=`__NO_PREFERENCE__`}));function V(e,t,n){if(!b())return!1;if(t)return!0;if(e===null||!E(e))return!1;let r=e.toLowerCase().replace(/\[1m\]$/,``).trim(),i=r===`opus`||r.includes(`opus-4-6`)||r.includes(`opus-4-7`),a=r===`sonnet`||r.includes(`sonnet-4-6`);return i&&n?!1:i||a}var H=e((()=>{y(),T()}));export{B as i,V as n,I as r,H as t};
@@ -0,0 +1 @@
1
+ import{ac as e,ic as t,oc as n,sc as r}from"./loadAgentsDir-C1LkW7gl.js";r();export{t as drainPendingExtraction,e as executeExtractMemories,n as initExtractMemories};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ap as n,Dp as r,Op as i,Ub as a}from"./loadAgentsDir-C1LkW7gl.js";import{Gt as o,I as s,Lt as c,P as l,ai as u,di as d,fi as f,j as p,t as m,y as h}from"./src-DL3w8VPk.js";import{t as g}from"./jsx-runtime-Bb4Xn-E0.js";import{Ht as _,b as v,h as y}from"./settings-DKN4xSpQ.js";import{c as b,m as x}from"./config-BddEvZZl.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{_ as w,l as T}from"./startupProfiler-DTs9w9EN.js";import{F as E,I as D,K as O,L as k,M as A,N as j,P as M,Q as N,U as P,j as F,q as I,z as L}from"./model-BwBE0Pt5.js";import{n as R,t as z}from"./systemTheme-Ceakddth.js";function B({cooldown:e}){return e?(0,H.jsx)(l,{color:`promptBorder`,dimColor:!0,children:`↯`}):(0,H.jsx)(l,{color:`fastMode`,children:`↯`})}function V(e=!0,t=!1){if(!e)return`↯`;let n=R(b().theme);return t?d.dim(p(`promptBorder`,n)(`↯`)):p(`fastMode`,n)(`↯`)}var H,U=e((()=>{f(),_(),m(),x(),z(),H=g()}));function W(e,t){E(),v(`userSettings`,{fastMode:e?!0:void 0}),t(e?e=>{let t=!I(e.mainLoopModel);return{...e,...t?{mainLoopModel:D(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let r=i(e=>e.mainLoopModel),a=i(e=>e.fastMode),u=n(),[d,f]=(0,J.useState)(a??!1),p=k(),m=p.status===`cooldown`,g=t!==null,_=F(A(!0));function v(){g||(W(d,u),C(`tengu_fast_mode_toggled`,{enabled:d,source:`picker`}),d?e(`${V(d)} Fast mode ON${I(r)?``:` · model set to ${M}`} · ${_}`):(u(e=>({...e,fastMode:!1})),e(`Fast mode OFF`)))}function y(){if(g){a&&W(!1,u),e(`Fast mode OFF`,{display:`system`});return}e(a?`${V()} Kept Fast mode ON`:`Kept Fast mode OFF`,{display:`system`})}function b(){g||f(e=>!e)}return o({"confirm:yes":v,"confirm:nextField":b,"confirm:next":b,"confirm:previous":b,"confirm:cycleMode":b,"confirm:toggle":b},{context:`Confirmation`}),(0,Y.jsxs)(h,{title:(0,Y.jsxs)(l,{children:[(0,Y.jsx)(B,{cooldown:m}),` Fast mode (research preview)`]}),subtitle:`High-speed mode for ${M}. Billed as extra usage at a premium rate. Separate rate limits apply.`,onCancel:y,color:`fastMode`,inputGuide:e=>e.pending?(0,Y.jsxs)(l,{children:[`Press `,e.keyName,` again to exit`]}):g?(0,Y.jsx)(l,{children:`Esc to cancel`}):(0,Y.jsx)(l,{children:`Tab to toggle · Enter to confirm · Esc to cancel`}),children:[t?(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsx)(l,{color:`error`,children:t})}):(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(s,{flexDirection:`column`,gap:0,marginLeft:2,children:(0,Y.jsxs)(s,{flexDirection:`row`,gap:2,children:[(0,Y.jsx)(l,{bold:!0,children:`Fast mode`}),(0,Y.jsx)(l,{color:d?`fastMode`:void 0,bold:d,children:d?`ON `:`OFF`}),(0,Y.jsx)(l,{dimColor:!0,children:_})]})}),m&&p.status===`cooldown`&&(0,Y.jsx)(s,{marginLeft:2,children:(0,Y.jsxs)(l,{color:`warning`,children:[p.reason===`overloaded`?`Fast mode overloaded and is temporarily unavailable`:`You've hit your fast limit`,` · resets in `,T(p.resetAt-Date.now(),{hideTrailingZeros:!0})]})})]}),(0,Y.jsxs)(l,{dimColor:!0,children:[`Learn more:`,` `,(0,Y.jsx)(c,{url:`https://code.workmate.com/docs/en/fast-mode`,children:`https://code.workmate.com/docs/en/fast-mode`})]})]})}async function K(e,t,n){let r=L();if(r)return`Fast mode unavailable: ${r}`;let{mainLoopModel:i}=t();return W(e,n),C(`tengu_fast_mode_toggled`,{enabled:e,source:`shortcut`}),e?`${V(!0)} Fast mode ON${I(i)?``:` · model set to ${M}`} · ${F(A(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!O())return null;await N();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=L();return C(`tengu_fast_mode_picker_shown`,{unavailable_reason:i??``}),(0,Y.jsx)(G,{onDone:e,unavailableReason:i})}var J,Y,X=e((()=>{J=t(u(),1),m(),U(),a(),S(),r(),P(),w(),j(),y(),Y=g()}));export{U as a,V as i,q as n,X as r,G as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./fast-DqUpl_Lr.js";t();export{n as FastModePicker,e as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{g as t,v as n}from"./types-zk5Ltv5q.js";import{c as r,i}from"./debug-8DCufdSp.js";import{$t as a,tn as o}from"./settings-DKN4xSpQ.js";import{Er as s,Sn as c,St as l,Tt as u,_r as d,mr as f,wr as p,xn as m}from"./model-BwBE0Pt5.js";import{n as h,r as g}from"./client-DdenNfkQ.js";async function _(){let e=p();try{switch(e){case`firstParty`:{let e=await m({maxRetries:1}),t=u()?[a]:void 0,n=[];for await(let r of e.models.list({betas:t}))n.push({value:r.id,label:r.display_name??r.id,description:r.id});return n.length>0?n:null}case`openai`:{let e=h({maxRetries:1}),t=[];for await(let n of e.models.list())t.push({value:n.id,label:n.id,description:`via openai-compat`});return t.length>0?t:null}case`grok`:{let{getGrokClient:e}=await import(`./client-DYRgRQsr.js`),t=e({maxRetries:1}),n=[];for await(let e of t.models.list())n.push({value:e.id,label:e.id,description:`via grok`});return n.length>0?n:null}case`bedrock`:{let e=(await f()).map(e=>({value:e,label:e,description:`Bedrock inference profile`}));return e.length>0?e:null}case`gemini`:case`vertex`:case`foundry`:return null}}catch(t){return r(`[fetchModelList] ${e} failed: ${t instanceof Error?t.message:`unknown`}`),null}return null}var v,y,b=e((()=>{o(),c(),g(),l(),i(),t(),d(),s(),v=300*1e3,y=n(_,v)}));export{b as n,y as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./fetchModelList-CqsTAWEN.js";e();export{t as fetchAvailableModels};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{m as i}from"./zod-CuNujUwx.js";import{Mt as a,Rt as o,_ as s,g as c,hn as l,p as u}from"./loadAgentsDir-C1LkW7gl.js";import{$n as d,Qn as f}from"./state-BowF111d.js";import{n as p,t as m}from"./cwd-BcO6WHKo.js";import{L as h,N as g,c as _,f as v,i as ee,u as y}from"./debug-8DCufdSp.js";import{Hr as b,Pr as x,Ur as te,cr as ne,h as re,or as ie,t as ae}from"./settings-DKN4xSpQ.js";import{c as oe,m as se}from"./config-BddEvZZl.js";import{i as ce,n as S}from"./execFileNoThrow-BsfuytkN.js";import{o as le,s as C}from"./log-DaILwWJa.js";import{n as ue,r as w}from"./analytics-DJobLaWP.js";import{a as de,s as fe}from"./ripgrep-BuzOTf1S.js";import*as T from"path";import{statSync as pe}from"fs";function me(e,t,n){if(t===0)return n?k:0;let r=e.charCodeAt(t-1);return he(r)?be:ge(r)&&_e(e.charCodeAt(t))?D:0}function he(e){return e===47||e===92||e===45||e===95||e===46||e===32}function ge(e){return e>=97&&e<=122}function _e(e){return e>=65&&e<=90}function E(){return new Promise(e=>setImmediate(e))}function ve(e,t){let n=new Set;for(let r of e){let e=r.length;for(let t=0;t<r.length;t++){let n=r.charCodeAt(t);if(n===47||n===92){e=t;break}}let i=r.slice(0,e);if(i.length>0&&(n.add(i),n.size>=t))break}let r=Array.from(n);return r.sort((e,t)=>{let n=e.length-t.length;return n===0?e<t?-1:+(e>t):n}),r.slice(0,t).map(e=>({path:e,score:0}))}var ye,be,D,O,k,xe,Se,Ce,A,j,we,Te=e((()=>{n(),ye=16,be=8,D=6,O=4,k=8,xe=3,Se=1,Ce=100,A=64,j=new Int32Array(A),we=class{constructor(){r(this,`paths`,[]),r(this,`lowerPaths`,[]),r(this,`charBits`,new Int32Array),r(this,`pathLens`,new Uint16Array),r(this,`topLevelCache`,null),r(this,`readyCount`,0)}loadFromFileList(e){let t=new Set,n=[];for(let r of e)r.length>0&&!t.has(r)&&(t.add(r),n.push(r));this.buildIndex(n)}loadFromFileListAsync(e){let t=()=>{};return{queryable:new Promise(e=>{t=e}),done:this.buildAsync(e,t)}}async buildAsync(e,t){let n=new Set,r=[],i=performance.now();for(let t=0;t<e.length;t++){let a=e[t];a.length>0&&!n.has(a)&&(n.add(a),r.push(a)),(t&255)==255&&performance.now()-i>4&&(await E(),i=performance.now())}this.resetArrays(r),i=performance.now();let a=!0;for(let e=0;e<r.length;e++)this.indexPath(e),(e&255)==255&&performance.now()-i>4&&(this.readyCount=e+1,a&&(t(),a=!1),await E(),i=performance.now());this.readyCount=r.length,t()}buildIndex(e){this.resetArrays(e);for(let t=0;t<e.length;t++)this.indexPath(t);this.readyCount=e.length}resetArrays(e){let t=e.length;this.paths=e,this.lowerPaths=Array(t),this.charBits=new Int32Array(t),this.pathLens=new Uint16Array(t),this.readyCount=0,this.topLevelCache=ve(e,Ce)}indexPath(e){let t=this.paths[e].toLowerCase();this.lowerPaths[e]=t;let n=t.length;this.pathLens[e]=n;let r=0;for(let e=0;e<n;e++){let n=t.charCodeAt(e);n>=97&&n<=122&&(r|=1<<n-97)}this.charBits[e]=r}search(e,t){if(t<=0)return[];if(e.length===0)return this.topLevelCache?this.topLevelCache.slice(0,t):[];let n=e!==e.toLowerCase(),r=n?e:e.toLowerCase(),i=Math.min(r.length,A),a=Array(i),o=0;for(let e=0;e<i;e++){let t=r.charAt(e);a[e]=t;let n=t.charCodeAt(0);n>=97&&n<=122&&(o|=1<<n-97)}let s=i*24+k+32,c=[],l=-1/0,{paths:u,lowerPaths:d,charBits:f,pathLens:p,readyCount:m}=this;for(let e=0;e<m;e++){if((f[e]&o)!==o)continue;let r=n?u[e]:d[e],m=a[0],h=0,g=[],_=r.indexOf(m);if(_===-1)continue;g[h++]=_;for(let e=_+1;e<r.length;e++){if(r.charCodeAt(e)!==m.charCodeAt(0))continue;let t=r.charCodeAt(e-1);(t===47||t===92||t===45||t===95||t===46||t===32)&&(g[h++]=e)}let v=u[e],ee=p[e],y=Math.max(0,32-(ee>>2)),b=-1/0;for(let e=0;e<h;e++){j[0]=g[e];let n=0,o=0,u=j[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}j[e]=t;let i=t-u-1;i===0?o+=O:n+=xe+i*Se,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*ye+o-n;f+=me(v,j[0],!0);for(let e=1;e<i;e++)f+=me(v,j[e],!1);f+=y,f>b&&(b=f)}if(b===-1/0)continue;let x=b;if(c.length<t)c.push({path:v,fuzzScore:x}),c.length===t&&(c.sort((e,t)=>e.fuzzScore-t.fuzzScore),l=c[0].fuzzScore);else if(x>l){let e=0,t=c.length;for(;e<t;){let n=e+t>>1;c[n].fuzzScore<x?e=n+1:t=n}c.splice(e,0,{path:v,fuzzScore:x}),c.shift(),l=c[0].fuzzScore}}c.sort((e,t)=>t.fuzzScore-e.fuzzScore);let h=c.length,g=Math.max(h,1),_=Array(h);for(let e=0;e<h;e++){let t=c[e].path,n=e/g;_[e]={path:t,score:t.includes(`test`)?Math.min(n*1.05,1):n}}return _}}}));function M(){return z||(z=new we),z}function Ee(){z=null,B=null,H++,U=null,W=[],G=[],K=[],V.clear(),q=null,J=null,Y=0,X=null,Z=null,Q=null}function N(e){let t=e.length,n=Math.max(1,Math.floor(t/500)),r=-2128831035;for(let i=0;i<t;i+=n){let t=e[i];for(let e=0;e<t.length;e++)r=(r^t.charCodeAt(e))*16777619|0;r=r*16777619|0}if(t>0){let n=e[t-1];for(let e=0;e<n.length;e++)r=(r^n.charCodeAt(e))*16777619|0}return`${t}:${(r>>>0).toString(16)}`}function De(){let e=x(m());if(!e)return null;try{return pe(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function P(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function Oe(e){if(e.length===0||!z||W.length===0)return;let t=await I(e),n=[...W,...G,...K,...e,...t],r=N(n);if(r===Q){_(`[FileIndex] skipped index rebuild — merged paths unchanged`);return}await z.loadFromFileListAsync(n).done,Q=r,_(`[FileIndex] rebuilt index with ${W.length} tracked + ${e.length} untracked files`)}async function F(e,t){let n=`${e}:${t}`;if(J===n)return q;let r=y(),i=[`.ignore`,`.rgignore`],a=[...new Set([e,t])],o=(0,Be.default)(),s=!1,c=a.flatMap(e=>i.map(t=>T.join(e,t))),l=await Promise.all(c.map(e=>r.readFile(e,{encoding:`utf8`}).catch(()=>null)));for(let[e,t]of l.entries())t!==null&&(o.add(t),s=!0,_(`[FileIndex] loaded ignore patterns from ${c[e]}`));let u=s?o:null;return q=u,J=n,u}async function ke(e,t){let n=Date.now();_(`[FileIndex] getFilesUsingGit called`);let r=m(),i=x(r);if(!i)return _(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await S(b(),[`-c`,`core.quotepath=false`,`ls-files`,`--recurse-submodules`],{timeout:5e3,abortSignal:e,cwd:i});if(_(`[FileIndex] git ls-files (tracked) took ${Date.now()-a}ms`),o.code!==0)return _(`[FileIndex] git ls-files failed (code=${o.code}, stderr=${o.stderr}), falling back to ripgrep`),null;let s=P(o.stdout.trim().split(`
2
+ `).filter(Boolean),i,r),c=await F(i,r);if(c){let e=s.length;s=c.filter(s),_(`[FileIndex] applied ignore patterns: ${e} -> ${s.length} files`)}W=s;let l=Date.now()-n;if(_(`[FileIndex] git ls-files: ${s.length} tracked files in ${l}ms`),w(`tengu_file_suggestions_git_ls_files`,{file_count:s.length,tracked_count:s.length,untracked_count:0,duration_ms:l}),!U){let e=t?[`-c`,`core.quotepath=false`,`ls-files`,`--others`,`--exclude-standard`]:[`-c`,`core.quotepath=false`,`ls-files`,`--others`],n=H;U=S(b(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===H&&e.code===0){let t=P(e.stdout.trim().split(`
3
+ `).filter(Boolean),i,r),n=await F(i,r);if(n&&t.length>0){let e=t.length;t=n.filter(t),_(`[FileIndex] applied ignore patterns to untracked: ${e} -> ${t.length} files`)}_(`[FileIndex] background untracked fetch: ${t.length} files`),Oe(t)}}).catch(e=>{_(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return s}catch(e){return _(`[FileIndex] git ls-files error: ${g(e)}`),null}}async function I(e){let t=new Set,n=performance.now();for(let r=0;r<e.length;r++)Ae(e,r,r+1,t),(r&255)==255&&performance.now()-n>4&&(await E(),n=performance.now());return[...t].map(e=>e+T.sep)}function Ae(e,t,n,r){for(let i=t;i<n;i++){let t=T.dirname(e[i]);for(;t!==`.`&&!r.has(t);){let e=T.dirname(t);if(e===t)break;r.add(t),t=e}}}async function je(e){return(await Promise.all(u.map(t=>s(t,e)))).flatMap(e=>e.map(e=>e.filePath))}async function Me(e,t){_(`[FileIndex] getProjectFiles called, respectGitignore=${t}`);let n=await ke(e,t);if(n!==null)return _(`[FileIndex] using git ls-files result (${n.length} files)`),n;_(`[FileIndex] git ls-files returned null, falling back to ripgrep`);let r=Date.now(),i=[`--files`,`--follow`,`--hidden`,`--glob`,`!.git/`,`--glob`,`!.svn/`,`--glob`,`!.hg/`,`--glob`,`!.bzr/`,`--glob`,`!.jj/`,`--glob`,`!.sl/`];t||i.push(`--no-ignore-vcs`);let a=(await fe(i,`.`,e)).map(e=>T.relative(m(),e)),o=Date.now()-r;return _(`[FileIndex] ripgrep: ${a.length} files in ${o}ms`),w(`tengu_file_suggestions_ripgrep`,{file_count:a.length,duration_ms:o}),a}async function Ne(){let e=AbortSignal.timeout(1e4),t=M();try{let n=ae(),r=oe(),i=n.respectGitignore??r.respectGitignore??!0,a=m(),[o,s]=await Promise.all([Me(e,i),je(a)]);G=s;let c=[...o,...s],l=await I(c);K=l;let u=[...l,...c],d=N(u);d===Z?_(`[FileIndex] skipped index rebuild — tracked paths unchanged`):(await t.loadFromFileListAsync(u).done,Z=d,Q=null)}catch(e){C(e)}return t}function Pe(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;return e.substring(0,r)}function Fe(e){if(e.length===0)return``;let t=e.map(e=>e.displayText),n=t[0];for(let e=1;e<t.length;e++){let r=t[e];if(n=Pe(n,r),n===``)return``}return n}function L(e,t){return{id:`file-${e}`,displayText:e,metadata:t===void 0?void 0:{score:t}}}function Ie(e,t){return e.search(t,$).map(e=>L(e.path,e.score))}function R(){if(B)return;let e=De();if(z&&!(e!==null&&e!==X)&&Date.now()-Y<He)return;let t=H,n=Date.now();M(),B=Ne().then(r=>t===H?(B=null,V.emit(),X=e,Y=Date.now(),_(`[FileIndex] cache refresh completed in ${Date.now()-n}ms`),r):r).catch(e=>(_(`[FileIndex] Cache refresh failed: ${g(e)}`),C(e),t===H&&(B=null),M()))}async function Le(){let e=y(),t=m();try{return(await e.readdir(t)).map(e=>{let n=T.join(t,e.name),r=T.relative(t,n);return e.isDirectory()?r+T.sep:r})}catch(e){return C(e),[]}}async function Re(e,t=!1){if(!e&&!t)return[];if(ae().fileSuggestion?.type===`command`)return(await o({...a(),query:e})).slice(0,$).map(L);if(e===``||e===`.`||e===`./`){let e=await Le();return R(),e.slice(0,$).map(L)}let n=Date.now();try{let t=B!==null;R();let r=e,i=`.${T.sep}`;e.startsWith(i)&&(r=e.substring(2)),r.startsWith(`~`)&&(r=ie(r));let a=z?Ie(z,r):[],o=Date.now()-n;return _(`[FileIndex] generateFileSuggestions: ${a.length} results in ${o}ms (${t?`partial`:`full`} index)`),w(`tengu_file_suggestions_query`,{duration_ms:o,cache_hit:!t,result_count:a.length,query_length:e.length}),a}catch(e){return C(e),[]}}function ze(e,t,n,r,i,a){let o=typeof e==`string`?e:e.displayText;i(t.substring(0,r)+o+t.substring(r+n.length)),a(r+o.length)}var Be,z,B,V,Ve,H,U,W,G,K,q,J,Y,X,Z,Q,$,He,Ue=e((()=>{Be=t(i(),1),c(),Te(),ue(),se(),p(),ee(),h(),ce(),v(),te(),l(),le(),ne(),de(),re(),d(),z=null,B=null,V=f(),Ve=V.subscribe,H=0,U=null,W=[],G=[],K=[],q=null,J=null,Y=0,X=null,Z=null,Q=null,$=15,He=5e3}));export{Ue as a,Re as i,Ee as n,Ve as o,Fe as r,R as s,ze as t};