@readmagic/workmate 0.0.21 → 0.0.23

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 (493) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-OgcBcK5A.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CDNd5-7E.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-CNEifEyV.js +1 -0
  4. package/dist/chunks/App-B-3tPQ3k.js +1 -0
  5. package/dist/chunks/BackgroundTasksDialog-COuhHcey.js +2 -0
  6. package/dist/chunks/BypassPermissionsModeDialog-bJek4siJ.js +1 -0
  7. package/dist/chunks/CustomSelect-DoeEXOIP.js +1 -0
  8. package/dist/chunks/DiffDialog-B3X9FMpO.js +6 -0
  9. package/dist/chunks/Doctor-6PXyjIi6.js +3 -0
  10. package/dist/chunks/Doctor-DNgkgYhB.js +1 -0
  11. package/dist/chunks/ExitFlow-DgAZp_8U.js +2 -0
  12. package/dist/chunks/Grove-CHatOzcE.js +11 -0
  13. package/dist/chunks/InvalidConfigDialog-DXL92MN9.js +1 -0
  14. package/dist/chunks/InvalidSettingsDialog-Dtmpzeps.js +1 -0
  15. package/dist/chunks/KeybindingProviderSetup-DA37QUFs.js +1 -0
  16. package/dist/chunks/MCPConnectionManager-thZd-xA_.js +1 -0
  17. package/dist/chunks/MCPToolListView-CpY-YJg4.js +1 -0
  18. package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-JvChf3xr.js} +1 -1
  19. package/dist/chunks/MessageSelector-C0_iw7SI.js +3 -0
  20. package/dist/chunks/Messages-K4DDsDP9.js +10 -0
  21. package/dist/chunks/Onboarding-C1UdzM-1.js +1 -0
  22. package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-AyLog8p7.js} +1 -1
  23. package/dist/chunks/PromptInputHelpMenu-oyic20ip.js +1 -0
  24. package/dist/chunks/ProviderSetup-XcBHjUnd.js +1 -0
  25. package/dist/chunks/QueryEngine-DYxBjJ4i.js +1 -0
  26. package/dist/chunks/REPL-CQBJRrT0.js +124 -0
  27. package/dist/chunks/REPL-CrVuMQY2.js +1 -0
  28. package/dist/chunks/ResumeConversation-Dl8H9Gfy.js +1 -0
  29. package/dist/chunks/SearchExtraToolsTool-lv7VE50N.js +1 -0
  30. package/dist/chunks/SelectMulti-Bc6l11_K.js +1 -0
  31. package/dist/chunks/Settings-TGp3fPrS.js +3 -0
  32. package/dist/chunks/Spinner-zYPFVFHN.js +1 -0
  33. package/dist/chunks/SpinnerGlyph-CmkRUvHe.js +1 -0
  34. package/dist/chunks/TextInput-CD9iau2k.js +22 -0
  35. package/dist/chunks/ThemePicker-0F0hZYPX.js +1 -0
  36. package/dist/chunks/TrustDialog-C76YiMKz.js +1 -0
  37. package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-DgNzJQUP.js} +1 -1
  38. package/dist/chunks/_baseEach-4ff-vRlp.js +1 -0
  39. package/dist/chunks/add-dir-JMsRLGfx.js +1 -0
  40. package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-BReJUBWg.js} +1 -1
  41. package/dist/chunks/agents-9qQ8I6zW.js +101 -0
  42. package/dist/chunks/{agents-CvW8XjoJ.js → agents-B3x8yJ_r.js} +1 -1
  43. package/dist/chunks/allErrors-DfWylHSw.js +1 -0
  44. package/dist/chunks/appleTerminalBackup-BArZWB21.js +1 -0
  45. package/dist/chunks/backgroundHousekeeping-BGxHB_OX.js +1 -0
  46. package/dist/chunks/backgroundHousekeeping-CVNIhQg8.js +17 -0
  47. package/dist/chunks/banner-Cu2-XUek.js +2 -0
  48. package/dist/chunks/{bedrockClient-DxE_mHFI.js → bedrockClient-CfiDN-kF.js} +2 -2
  49. package/dist/chunks/branch-C4TsMEkx.js +2 -0
  50. package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BMXqFTeS.js} +2 -2
  51. package/dist/chunks/btw-Dn1eYFAz.js +1 -0
  52. package/dist/chunks/caches-BGzKwpnc.js +1 -0
  53. package/dist/chunks/caches-DArHxBgL.js +1 -0
  54. package/dist/chunks/claudeDesktop-D8ml2767.js +1 -0
  55. package/dist/chunks/{clear-D2KRoibg.js → clear-Bdhb6b39.js} +1 -1
  56. package/dist/chunks/{client-C_jBL1yC.js → client-4iqhC8xq.js} +1 -1
  57. package/dist/chunks/client-BiqbIkwr.js +1 -0
  58. package/dist/chunks/client-CZ8nyVh5.js +1 -0
  59. package/dist/chunks/client-CpTCeWba.js +1 -0
  60. package/dist/chunks/commands-QepeBbFn.js +1 -0
  61. package/dist/chunks/compact-Bu9BUpxV.js +2 -0
  62. package/dist/chunks/config-C-Y2qtB2.js +3 -0
  63. package/dist/chunks/config-D58C3_Lu.js +1 -0
  64. package/dist/chunks/config-DD8fCYXn.js +1 -0
  65. package/dist/chunks/{context-Db9tH1VF.js → context-CY_yfdYa.js} +1 -1
  66. package/dist/chunks/context-noninteractive-BDDi3NLF.js +1 -0
  67. package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-Dd4xIoP1.js} +10 -10
  68. package/dist/chunks/conversation-B0wxBwzv.js +1 -0
  69. package/dist/chunks/conversation-DUu9qBnq.js +1 -0
  70. package/dist/chunks/conversationRecovery-2ft8sCPE.js +1 -0
  71. package/dist/chunks/crossProjectResume-6boHMUBx.js +40 -0
  72. package/dist/chunks/cwd-Dc3NV7s8.js +1 -0
  73. package/dist/chunks/cwd-Pa83R95t.js +1 -0
  74. package/dist/chunks/{datadog-BuElf2EQ.js → datadog-BPuGcxxC.js} +1 -1
  75. package/dist/chunks/{debug-D58GQBDG.js → debug-Bglx1aTu.js} +5 -5
  76. package/dist/chunks/detectRepository-CfX8Lc0A.js +1 -0
  77. package/dist/chunks/{diff-yA6v_dpP.js → diff-BOAElpfQ.js} +1 -1
  78. package/dist/chunks/directoryCompletion-D_Rtg-4j.js +1 -0
  79. package/dist/chunks/dist-es-B3-7VFf2.js +1 -0
  80. package/dist/chunks/dist-es-B7j_mv242.js +1 -0
  81. package/dist/chunks/dist-es-BSKD_hOQ.js +1 -0
  82. package/dist/chunks/dist-es-BSRN-2nA.js +9 -0
  83. package/dist/chunks/{dist-es-yHGBqhBe.js → dist-es-BXXmyhQ2.js} +1 -1
  84. package/dist/chunks/{dist-es-C3reqy7X.js → dist-es-BaQndfvh2.js} +1 -1
  85. package/dist/chunks/dist-es-CzTYn7xo.js +1 -0
  86. package/dist/chunks/dist-es-DSkyibcN.js +1 -0
  87. package/dist/chunks/{dist-es-BOPBJQo3.js → dist-es-_UNJQniz.js} +1 -1
  88. package/dist/chunks/dist-es-hwK6468D.js +1 -0
  89. package/dist/chunks/dist-es-ovsdbtwh.js +1 -0
  90. package/dist/chunks/doctor-CkLzqAMd.js +1 -0
  91. package/dist/chunks/entry-TNOoyy7_.js +13 -0
  92. package/dist/chunks/{envUtils-DcaKZlRU.js → envUtils-DfkgIdYf.js} +1 -1
  93. package/dist/chunks/esm-eTAUP-La.js +1 -0
  94. package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BTachNBI.js} +1 -1
  95. package/dist/chunks/exit-DXApFJIP.js +1 -0
  96. package/dist/chunks/extraUsage-CmQaLPV1.js +1 -0
  97. package/dist/chunks/extractMemories-xP63mv6R.js +1 -0
  98. package/dist/chunks/fast-C5nQH8rm.js +1 -0
  99. package/dist/chunks/fast-eGx2IxD7.js +1 -0
  100. package/dist/chunks/fetchModelList-CxLsVNsu.js +1 -0
  101. package/dist/chunks/fetchModelList-D24lRIgR.js +1 -0
  102. package/dist/chunks/fileSuggestions-DHxdwq28.js +3 -0
  103. package/dist/chunks/firstPartyEventLogger-BVAogAX8.js +1 -0
  104. package/dist/chunks/firstPartyEventLogger-M6UMli2c.js +3 -0
  105. package/dist/chunks/gemini-D_ORb_L6.js +2 -0
  106. package/dist/chunks/generateSessionName-BQoDduyA.js +1 -0
  107. package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-DwQFuna9.js} +1 -1
  108. package/dist/chunks/goal-D7c2mSds.js +3 -0
  109. package/dist/chunks/grok-B2-ZbUiR.js +1 -0
  110. package/dist/chunks/grove-O6qp7ITR.js +1 -0
  111. package/dist/chunks/help-CZJdRviD.js +1 -0
  112. package/dist/chunks/history-CQiUERTL.js +1 -0
  113. package/dist/chunks/hooks-BNuUlMzL.js +1 -0
  114. package/dist/chunks/{hooks-BDgToO1Z.js → hooks-DIvN6gdv.js} +3 -3
  115. package/dist/chunks/install-T_CV1Slu.js +1 -0
  116. package/dist/chunks/instrumentation-BjqUZ383.js +21 -0
  117. package/dist/chunks/{job-DYMfSglZ.js → job-R6c4-3c8.js} +1 -1
  118. package/dist/chunks/keybindings-CLRaiL_Z.js +1 -0
  119. package/dist/chunks/launchLocalMemory-DrbKrwXc.js +3 -0
  120. package/dist/chunks/{launchOnboarding-BeNf51Ig.js → launchOnboarding-tqsMD8ni.js} +1 -1
  121. package/dist/chunks/loadAgentsDir-CcmY8zCj.js +1 -0
  122. package/dist/chunks/loadAgentsDir-DlPbtIsS.js +3349 -0
  123. package/dist/chunks/loadPluginHooks-C_msxVIc.js +1 -0
  124. package/dist/chunks/{loader-C33o_5kS.js → loader-CICGtLp2.js} +1 -1
  125. package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-CK-sFzPm.js} +1 -1
  126. package/dist/chunks/localSearch-DrUj0B-d.js +1 -0
  127. package/dist/chunks/log-D2TIwHBV.js +1 -0
  128. package/dist/chunks/logoUtils-x2pHV-Nl.js +1 -0
  129. package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-BEF8D3if.js} +3 -3
  130. package/dist/chunks/main-kOVUGxOS.js +345 -0
  131. package/dist/chunks/managedEnv-BEqrGqn1.js +1 -0
  132. package/dist/chunks/managedEnv-OPlzUPbJ.js +1 -0
  133. package/dist/chunks/mcp-BNd29r6p.js +6 -0
  134. package/dist/chunks/mcp-D0wAJrRT.js +1 -0
  135. package/dist/chunks/mcp-mgOlm1cY.js +2 -0
  136. package/dist/chunks/memory-DDLk9_LJ.js +1 -0
  137. package/dist/chunks/mode-CcNsWgK3.js +2 -0
  138. package/dist/chunks/model-BwBG0V1u.js +1 -0
  139. package/dist/chunks/model-DzCP4K-9.js +1 -0
  140. package/dist/chunks/modelOptions-DRaG3bo0.js +1 -0
  141. package/dist/chunks/nativeInstaller-C3pVPqrZ.js +1 -0
  142. package/dist/chunks/notifications-4wP1Tx9Y.js +1 -0
  143. package/dist/chunks/onChangeAppState-BlaoFbYF.js +1 -0
  144. package/dist/chunks/openai-CDN71NdX.js +2 -0
  145. package/dist/chunks/overlayContext-BT2Lq8ei.js +1 -0
  146. package/dist/chunks/{panel-Cm23FDVt.js → panel-CVS4SK_E.js} +1 -1
  147. package/dist/chunks/parser-CG5RuOCK.js +1 -0
  148. package/dist/chunks/{parser-eVu-cTRs.js → parser-Cg6hSCmn.js} +1 -1
  149. package/dist/chunks/partition-CIl_ORUT.js +1 -0
  150. package/dist/chunks/pasteStore-P0zP-ch0.js +1 -0
  151. package/dist/chunks/permissions-zSNOZSwr.js +3 -0
  152. package/dist/chunks/pidLock-BTqO-h7Y.js +3 -0
  153. package/dist/chunks/{plan-s228H7IU.js → plan-Bs6em6lk.js} +1 -1
  154. package/dist/chunks/{platform-DMQxcm4K.js → platform-BacQ6ACS.js} +1 -1
  155. package/dist/chunks/plugin-DDDxjBa0.js +17 -0
  156. package/dist/chunks/pluginAutoupdate-8qugAFhb.js +1 -0
  157. package/dist/chunks/pluginBlocklist-q01ackCf.js +1 -0
  158. package/dist/chunks/pluginCliCommands-DXZfCZsv.js +1 -0
  159. package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-BG2MHCQJ.js} +1 -1
  160. package/dist/chunks/pluginOperations-hXYLrzM2.js +2 -0
  161. package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-DTMa6TgL.js} +1 -1
  162. package/dist/chunks/pluginStartupCheck-HS1ZceZa.js +1 -0
  163. package/dist/chunks/plugins-COoGBYk6.js +4 -0
  164. package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-B0QGV6Ci.js} +1 -1
  165. package/dist/chunks/poorMode-G-pnu6NM.js +1 -0
  166. package/dist/chunks/print-BASybEtO.js +13 -0
  167. package/dist/chunks/processBashCommand-DDi_Pymt.js +1 -0
  168. package/dist/chunks/processSlashCommand-Cq9kaoSF.js +5 -0
  169. package/dist/chunks/{projectContext-Bw3o5BrN.js → projectContext-5fmRr6Sd.js} +1 -1
  170. package/dist/chunks/{projectContext-BN2ZWzOG.js → projectContext-DhtjLv3k.js} +1 -1
  171. package/dist/chunks/projectOnboardingState-B5YATuc6.js +1 -0
  172. package/dist/chunks/prompt-CHobfCB1.js +1 -0
  173. package/dist/chunks/prompt-CMm6RHHc.js +1 -0
  174. package/dist/chunks/{prompt-BNNE5tsG.js → prompt-mM79EGnT.js} +3 -3
  175. package/dist/chunks/promptEditor-DLGN_eLu.js +4 -0
  176. package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-DjQALaU2.js} +2 -2
  177. package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CDBfZjO7.js} +2 -2
  178. package/dist/chunks/reconciler-CeXqh95g.js +1 -0
  179. package/dist/chunks/refresh-Ce2yk28a.js +1 -0
  180. package/dist/chunks/registerProtocol-CAsDme_E.js +1 -0
  181. package/dist/chunks/reject-Bld5E-bn.js +1 -0
  182. package/dist/chunks/reload-plugins-C42xSB5l.js +1 -0
  183. package/dist/chunks/rename-CtBghpxZ.js +1 -0
  184. package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-DV0dn0IW.js} +1 -1
  185. package/dist/chunks/resume-BWkaTDqd.js +2 -0
  186. package/dist/chunks/ripgrep-DLs8MraF.js +1 -0
  187. package/dist/chunks/ripgrep-Dl3y5r4m.js +5 -0
  188. package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-1wQO8HSZ.js} +1 -1
  189. package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-XQrOux41.js} +4 -4
  190. package/dist/chunks/sandbox-adapter-8GO6eJxw.js +1 -0
  191. package/dist/chunks/sandbox-toggle-Dir9Polo.js +1 -0
  192. package/dist/chunks/searchExtraTools-BhDq8DTJ.js +1 -0
  193. package/dist/chunks/select-Bxf5-5sI.js +1 -0
  194. package/dist/chunks/sessionFileAccessHooks-CozocHQE.js +1 -0
  195. package/dist/chunks/sessionObserver-DGEQM4cO.js +1 -0
  196. package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-DS4G6mb9.js} +2 -2
  197. package/dist/chunks/sessionStorage-BcAscOGE.js +1 -0
  198. package/dist/chunks/sessionTracing-BoDDYLxW.js +11 -0
  199. package/dist/chunks/settings-B2jvL8Dp.js +24 -0
  200. package/dist/chunks/settings-CisDe8DB.js +1 -0
  201. package/dist/chunks/setup-BRypY6iT.js +3 -0
  202. package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-BRxZjobz.js} +1 -1
  203. package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-DLJxyrlp.js} +3 -3
  204. package/dist/chunks/sinks-CGdKmq_8.js +1 -0
  205. package/dist/chunks/sinks-Cz2HfgMU.js +1 -0
  206. package/dist/chunks/skillChangeDetector-xviGstqm.js +1 -0
  207. package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CKN_d3pO.js} +2 -2
  208. package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BMY2JGGG.js} +2 -2
  209. package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-D9trHULQ.js} +4 -4
  210. package/dist/chunks/skills-CX_AvwLG.js +1 -0
  211. package/dist/chunks/startupProfiler-BH0FoI66.js +1 -0
  212. package/dist/chunks/startupProfiler-CJdr3SxP.js +3 -0
  213. package/dist/chunks/state-B4jiUise.js +1 -0
  214. package/dist/chunks/state-BhOKSFi5.js +1 -0
  215. package/dist/chunks/status-Daaak6Bo.js +1 -0
  216. package/dist/chunks/statusNoticeHelpers-vFVgIYuw.js +1 -0
  217. package/dist/chunks/stringUtils-C718f5ey.js +4 -0
  218. package/dist/chunks/sts-ei3CGBNu.js +1 -0
  219. package/dist/chunks/switcher-BpgmH4AI.js +1 -0
  220. package/dist/chunks/{switcher-DWfKi17X.js → switcher-CAajZeNL.js} +1 -1
  221. package/dist/chunks/{tasks-BwSsj2vI.js → tasks-BWNQr2d3.js} +1 -1
  222. package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
  223. package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-gUET39Ho.js} +1 -1
  224. package/dist/chunks/terminalSetup-B_10N_gE.js +32 -0
  225. package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-qc2PlvOm.js} +1 -1
  226. package/dist/chunks/{theme-CAoGjf2D.js → theme-B7fKI6E5.js} +1 -1
  227. package/dist/chunks/tipRegistry-DamZr34w.js +2 -0
  228. package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-BL06sDI4.js} +1 -1
  229. package/dist/chunks/toolPool-CX5wDBi1.js +1 -0
  230. package/dist/chunks/types-Dx7P7JLQ.js +81 -0
  231. package/dist/chunks/udsClient-cQz6nJ_T.js +1 -0
  232. package/dist/chunks/use-select-navigation-BiUJdWai.js +1 -0
  233. package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
  234. package/dist/chunks/useExitOnCtrlCDWithKeybindings-C9BYG8Bo.js +1 -0
  235. package/dist/chunks/useMainLoopModel-DwjSVzzO.js +1 -0
  236. package/dist/chunks/useManagePlugins-BqfIVa6E.js +1 -0
  237. package/dist/chunks/useMergedTools-Bw8FchX8.js +1 -0
  238. package/dist/chunks/useSearchInput-B25K1RnK.js +1 -0
  239. package/dist/chunks/useSettingsErrors-DYQ44kX4.js +1 -0
  240. package/dist/chunks/util-CtlC2dsN.js +1 -0
  241. package/dist/chunks/validatePlugin-D6tFo87L.js +1 -0
  242. package/dist/chunks/vim-CoRp9lY1.js +1 -0
  243. package/dist/chunks/worktree-B8apCnVe.js +1 -0
  244. package/dist/cli.js +1 -1
  245. package/package.json +1 -5
  246. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
  247. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
  248. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
  249. package/dist/chunks/App-VWyPd524.js +0 -1
  250. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
  251. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
  252. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
  253. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
  254. package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
  255. package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
  256. package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
  257. package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
  258. package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
  259. package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
  260. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
  261. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
  262. package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
  263. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
  264. package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
  265. package/dist/chunks/Messages-Cykztq1O.js +0 -10
  266. package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
  267. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
  268. package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
  269. package/dist/chunks/REPL-B8e5UU3H.js +0 -128
  270. package/dist/chunks/REPL-C4mbOhyL.js +0 -1
  271. package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
  272. package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
  273. package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
  274. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
  275. package/dist/chunks/Settings-B7n_dfP-.js +0 -2
  276. package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
  277. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
  278. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
  279. package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
  280. package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
  281. package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
  282. package/dist/chunks/agents-D96ng5I9.js +0 -101
  283. package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
  284. package/dist/chunks/api-DTyrmy1O.js +0 -1
  285. package/dist/chunks/api-DumFOErN.js +0 -1
  286. package/dist/chunks/auth-CZ4EsFWF.js +0 -10
  287. package/dist/chunks/auth-QvonHoG9.js +0 -1
  288. package/dist/chunks/auth-jV5THRH8.js +0 -1
  289. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
  290. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
  291. package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
  292. package/dist/chunks/bg-qG2osBbP.js +0 -9
  293. package/dist/chunks/branch-K8X6jx0i.js +0 -2
  294. package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
  295. package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
  296. package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
  297. package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
  298. package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
  299. package/dist/chunks/btw-BNs5OX7x.js +0 -1
  300. package/dist/chunks/bundledMode--fG1S62b.js +0 -1
  301. package/dist/chunks/caches-CC5NHwAz.js +0 -1
  302. package/dist/chunks/caches-nHxJWXgO.js +0 -1
  303. package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
  304. package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
  305. package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
  306. package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
  307. package/dist/chunks/client-9uHzAmFH.js +0 -1
  308. package/dist/chunks/client-BVal_QII.js +0 -1
  309. package/dist/chunks/client-BtTkq0YS.js +0 -1
  310. package/dist/chunks/client-Dd7CKMRX.js +0 -1
  311. package/dist/chunks/commands-C_rYjyQZ.js +0 -1
  312. package/dist/chunks/compact-Cqd6vKpn.js +0 -2
  313. package/dist/chunks/config-Be0BkAAr.js +0 -1
  314. package/dist/chunks/config-DUTgj3js.js +0 -3
  315. package/dist/chunks/config-DoEDgAfv.js +0 -1
  316. package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
  317. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
  318. package/dist/chunks/conversation-DWfE4KGH.js +0 -1
  319. package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
  320. package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
  321. package/dist/chunks/createSession-CqHnHhCR.js +0 -1
  322. package/dist/chunks/createSession-DqTtBycR.js +0 -1
  323. package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
  324. package/dist/chunks/cwd-DLK3znO7.js +0 -1
  325. package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
  326. package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
  327. package/dist/chunks/detached-Biz-xhu0.js +0 -4
  328. package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
  329. package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
  330. package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
  331. package/dist/chunks/dist-es-5t7v8oaj.js +0 -1
  332. package/dist/chunks/dist-es-BIjDeceU.js +0 -1
  333. package/dist/chunks/dist-es-C-OjW2Ao.js +0 -1
  334. package/dist/chunks/dist-es-CEk66gUu.js +0 -1
  335. package/dist/chunks/dist-es-CIULjvtA2.js +0 -1
  336. package/dist/chunks/dist-es-CMtO44xC.js +0 -1
  337. package/dist/chunks/dist-es-CYPVg66r.js +0 -9
  338. package/dist/chunks/dist-es-D1Y8zSMI.js +0 -1
  339. package/dist/chunks/dist-es-Gt_DpXlP.js +0 -1
  340. package/dist/chunks/dist-es-kj-F5A132.js +0 -1
  341. package/dist/chunks/doctor-eNAm6OiS.js +0 -1
  342. package/dist/chunks/entry-DidpiR-D.js +0 -13
  343. package/dist/chunks/esm-BCUC71kt.js +0 -1
  344. package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
  345. package/dist/chunks/exit-DywUeiYd.js +0 -1
  346. package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
  347. package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
  348. package/dist/chunks/fast-DCXZACT9.js +0 -1
  349. package/dist/chunks/fast-Qo4WVqiW.js +0 -1
  350. package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
  351. package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
  352. package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
  353. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
  354. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
  355. package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
  356. package/dist/chunks/gemini-BXAyy1JN.js +0 -1
  357. package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
  358. package/dist/chunks/git-Wid-XppW.js +0 -5
  359. package/dist/chunks/git-hO-TMvXc.js +0 -1
  360. package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
  361. package/dist/chunks/goal-C9clrwEH.js +0 -3
  362. package/dist/chunks/grok-CjeCecsZ.js +0 -1
  363. package/dist/chunks/grove-DqTnK9nn.js +0 -7
  364. package/dist/chunks/hash-Tu-My5Vp.js +0 -1
  365. package/dist/chunks/help-Bb6LdzXK.js +0 -1
  366. package/dist/chunks/hooks-BX2s7aoL.js +0 -1
  367. package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
  368. package/dist/chunks/install-eCA8UACi.js +0 -1
  369. package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
  370. package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
  371. package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
  372. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
  373. package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
  374. package/dist/chunks/lib-BlVGipXx.js +0 -14
  375. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
  376. package/dist/chunks/loadAgentsDir-C96o6gCj.js +0 -3422
  377. package/dist/chunks/loadPluginHooks-0nGlugZ4.js +0 -1
  378. package/dist/chunks/localSearch-dodgnjGn.js +0 -1
  379. package/dist/chunks/log-CZ7ploQm.js +0 -1
  380. package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
  381. package/dist/chunks/main-7ssnA9Yb.js +0 -31
  382. package/dist/chunks/main-BEv6MqMX.js +0 -356
  383. package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
  384. package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
  385. package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
  386. package/dist/chunks/mcp-BUn3yqsT.js +0 -1
  387. package/dist/chunks/mcp-BskLq9iP.js +0 -2
  388. package/dist/chunks/mcp-C-0DMaXx.js +0 -6
  389. package/dist/chunks/memoize-CumjjK2Q.js +0 -1
  390. package/dist/chunks/memory-vDkJM58W.js +0 -1
  391. package/dist/chunks/mode-Dbh21H2Y.js +0 -2
  392. package/dist/chunks/model-BaMclMXn.js +0 -1
  393. package/dist/chunks/model-atn3_JBi.js +0 -1
  394. package/dist/chunks/model-vS1Iewyq.js +0 -1
  395. package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
  396. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
  397. package/dist/chunks/oauth-D38aRTUb.js +0 -1
  398. package/dist/chunks/oauth-U649LV5H.js +0 -1
  399. package/dist/chunks/omit-B7eQ9q0x.js +0 -1
  400. package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
  401. package/dist/chunks/openai-wh8AX5iz.js +0 -10
  402. package/dist/chunks/parser-Cq9X7HMP.js +0 -1
  403. package/dist/chunks/partition-CENvOfiS.js +0 -1
  404. package/dist/chunks/permissions-ChuIx-d4.js +0 -3
  405. package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
  406. package/dist/chunks/plugin-DVBEWwMP.js +0 -17
  407. package/dist/chunks/pluginAutoupdate-aLXhSUVD.js +0 -1
  408. package/dist/chunks/pluginBlocklist-BprCv0En.js +0 -1
  409. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
  410. package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
  411. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
  412. package/dist/chunks/plugins-DdIaXpNb.js +0 -4
  413. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  414. package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
  415. package/dist/chunks/print-vxrRE1O2.js +0 -14
  416. package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
  417. package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
  418. package/dist/chunks/prompt-2AA5W7EH.js +0 -1
  419. package/dist/chunks/prompt-AXiS2LoO.js +0 -1
  420. package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
  421. package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
  422. package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
  423. package/dist/chunks/refresh-BSG0t4cf.js +0 -1
  424. package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
  425. package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
  426. package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
  427. package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
  428. package/dist/chunks/rename-BrEwj3Xw.js +0 -1
  429. package/dist/chunks/resume-DR5JbICs.js +0 -2
  430. package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
  431. package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
  432. package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
  433. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
  434. package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
  435. package/dist/chunks/session-wkRTfdo8.js +0 -2
  436. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
  437. package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
  438. package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
  439. package/dist/chunks/sessionState-8jutEorw.js +0 -11
  440. package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
  441. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
  442. package/dist/chunks/sessionTracing-fIp8g04N.js +0 -11
  443. package/dist/chunks/settings-BowI3jp-.js +0 -19
  444. package/dist/chunks/settings-CHn0gJCG.js +0 -1
  445. package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
  446. package/dist/chunks/setup-UiEO9i7F.js +0 -3
  447. package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
  448. package/dist/chunks/sinks-DnLqRPEC.js +0 -1
  449. package/dist/chunks/sinks-mGBiINp8.js +0 -1
  450. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
  451. package/dist/chunks/skills-DKtN17ch.js +0 -1
  452. package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
  453. package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
  454. package/dist/chunks/state-BStOuCh4.js +0 -1
  455. package/dist/chunks/state-D5D6QpTX.js +0 -1
  456. package/dist/chunks/stats-D4LEtkrw.js +0 -1
  457. package/dist/chunks/status-0ZBx6Ls0.js +0 -2
  458. package/dist/chunks/status-BUJ4-omB.js +0 -1
  459. package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
  460. package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
  461. package/dist/chunks/sts-C2Gf2WYN.js +0 -1
  462. package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
  463. package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
  464. package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
  465. package/dist/chunks/syncCache-DUhciJLz.js +0 -1
  466. package/dist/chunks/teleport-DwZMevmQ.js +0 -1
  467. package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
  468. package/dist/chunks/tmux-DA06aewY.js +0 -1
  469. package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
  470. package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
  471. package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
  472. package/dist/chunks/types-APu4OCXJ.js +0 -17
  473. package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
  474. package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
  475. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
  476. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
  477. package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
  478. package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
  479. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
  480. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
  481. package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
  482. package/dist/chunks/util-DU63xTwZ.js +0 -1
  483. package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
  484. package/dist/chunks/vim-xruiCyUd.js +0 -1
  485. package/dist/chunks/which-B8rchd8P.js +0 -1
  486. package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
  487. package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
  488. package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
  489. package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
  490. package/dist/chunks/worktree-C28I8mFB.js +0 -1
  491. /package/dist/chunks/{dist-es-Cgsa8pb82.js → dist-es-Cgsa8pb8.js} +0 -0
  492. /package/dist/chunks/{dist-es-Cwru7c2B2.js → dist-es-Cwru7c2B.js} +0 -0
  493. /package/dist/chunks/{dist-es-DXIR5NLi2.js → dist-es-DXIR5NLi.js} +0 -0
@@ -1,13 +0,0 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{$l as n,B as r,Ds as i,Es as a,Gd as o,Li as s,Mi as c,Oy as l,Ql as u,Sc as d,V as f,Wd as p,ar as m,br as h,i as g,o as _,wy as ee,xc as te}from"./loadAgentsDir-C96o6gCj.js";import{C as v,D as y,E as b,F as x,L as S,N as C,P as w,_ as T,f as ne,g as E,j as D,r as re,x as O}from"./lazySchema-DULtBUCI.js";import{$ as ie,Ut as k,ar as A,gr as ae,hr as oe,mt as se,zn as ce}from"./state-D5D6QpTX.js";import{d as le,h as ue}from"./settings-BowI3jp-.js";import{h as de,r as fe}from"./config-DUTgj3js.js";import{l as pe,p as me,r as he}from"./sessionStoragePortable-x0Yn02-G.js";import{_ as ge,u as _e}from"./model-BaMclMXn.js";import{_n as ve,vn as ye}from"./prompt-BNNE5tsG.js";import{n as be,r as xe}from"./managedEnv-CHYvwXBH.js";import{t as Se}from"./QueryEngine-DduzztIG.js";import{n as Ce,r as we}from"./modelOptions-Cw1ThINb.js";import{dirname as Te}from"node:path";import{randomUUID as j}from"node:crypto";import{Readable as Ee,Writable as De}from"node:stream";import{unlink as Oe}from"node:fs/promises";import*as M from"node:path/posix";import{isAbsolute as ke,resolve as Ae}from"node:path/posix";re();var N={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`},P={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`},je=y({_meta:D(C(),x()).nullish(),terminal:T().optional().default(!1)}),Me=y({_meta:D(C(),x()).nullish(),label:C().nullish(),name:C(),optional:T().optional().default(!1),secret:T().optional().default(!0)}),Ne=y({_meta:D(C(),x()).nullish(),description:C().nullish(),id:C(),name:C()}),Pe=y({_meta:D(C(),x()).nullish(),description:C().nullish(),id:C(),link:C().nullish(),name:C(),vars:E(Me)}),Fe=y({_meta:D(C(),x()).nullish(),args:E(C()).optional(),description:C().nullish(),env:D(C(),C()).optional(),id:C(),name:C()}),Ie=w([Pe.and(y({type:v(`env_var`)})),Fe.and(y({type:v(`terminal`)})),Ne]),Le=y({_meta:D(C(),x()).nullish(),methodId:C()}),Re=y({_meta:D(C(),x()).nullish()}),ze=y({_meta:D(C(),x()).nullish(),blob:C(),mimeType:C().nullish(),uri:C()}),Be=y({default:T().nullish(),description:C().nullish(),title:C().nullish()}),Ve=y({_meta:D(C(),x()).nullish()}),He=y({_meta:D(C(),x()).nullish()}),Ue=y({amount:b(),currency:C()}),We=y({_meta:D(C(),x()).nullish(),terminalId:C()}),Ge=y({_meta:D(C(),x()).nullish(),newText:C(),oldText:C().nullish(),path:C()}),Ke=w([C(),b(),b(),T(),E(C())]),qe=O(w([y({content:D(C(),Ke).nullish()}).and(y({action:v(`accept`)})),y({action:v(`decline`)}),y({action:v(`cancel`)})]),y({_meta:D(C(),x()).nullish()})),Je=y({_meta:D(C(),x()).nullish()}),Ye=C(),Xe=y({_meta:D(C(),x()).nullish(),elicitationId:Ye}),Ze=v(`object`),Qe=v(`string`),$e=y({_meta:D(C(),x()).nullish()}),et=y({_meta:D(C(),x()).nullish(),form:Je.nullish(),url:$e.nullish()}),tt=y({const:C(),title:C()}),nt=y({_meta:D(C(),x()).nullish(),name:C(),value:C()}),rt=y({code:w([v(-32700),v(-32600),v(-32601),v(-32602),v(-32603),v(-32800),v(-32e3),v(-32002),v(-32042),b().int().min(-2147483648,{message:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{message:`Invalid value: Expected int32 to be <= 2147483647`})]),data:x().optional(),message:C()}),it=x(),at=x(),ot=x(),st=y({_meta:D(C(),x()).nullish(),readTextFile:T().optional().default(!1),writeTextFile:T().optional().default(!1)}),ct=y({_meta:D(C(),x()).nullish(),name:C(),value:C()}),lt=y({_meta:D(C(),x()).nullish(),name:C(),title:C().nullish(),version:C()}),ut=y({default:b().nullish(),description:C().nullish(),maximum:b().nullish(),minimum:b().nullish(),title:C().nullish()}),dt=y({_meta:D(C(),x()).nullish()}),ft=y({_meta:D(C(),x()).nullish(),additionalDirectories:E(C()).optional(),cursor:C().nullish(),cwd:C().nullish()}),pt=y({_meta:D(C(),x()).nullish()}),mt=y({_meta:D(C(),x()).nullish(),logout:pt.nullish()}),ht=y({_meta:D(C(),x()).nullish()}),gt=y({_meta:D(C(),x()).nullish()}),_t=y({_meta:D(C(),x()).nullish(),http:T().optional().default(!1),sse:T().optional().default(!1)}),vt=y({_meta:D(C(),x()).nullish(),headers:E(ct),name:C(),url:C()}),yt=y({_meta:D(C(),x()).nullish(),headers:E(ct),name:C(),url:C()}),bt=y({_meta:D(C(),x()).nullish(),args:E(C()),command:C(),env:E(nt),name:C()}),F=w([vt.and(y({type:v(`http`)})),yt.and(y({type:v(`sse`)})),bt]),xt=C(),St=y({_meta:D(C(),x()).nullish(),description:C().nullish(),modelId:xt,name:C()}),Ct=w([v(`error`),v(`warning`),v(`information`),v(`hint`)]),wt=y({_meta:D(C(),x()).nullish()}),Tt=y({_meta:D(C(),x()).nullish()}),Et=y({_meta:D(C(),x()).nullish()}),Dt=y({_meta:D(C(),x()).nullish()}),Ot=y({_meta:D(C(),x()).nullish()}),kt=y({_meta:D(C(),x()).nullish(),maxCount:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),At=y({diff:C(),uri:C()}),jt=y({endLine:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),startLine:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),text:C()}),Mt=y({_meta:D(C(),x()).nullish()}),Nt=y({_meta:D(C(),x()).nullish()}),Pt=y({languageId:C(),text:C(),uri:C()}),Ft=y({_meta:D(C(),x()).nullish(),maxCount:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),It=w([v(`rejected`),v(`ignored`),v(`replaced`),v(`cancelled`)]),Lt=y({excerpts:E(jt),uri:C()}),Rt=y({_meta:D(C(),x()).nullish()}),zt=y({_meta:D(C(),x()).nullish()}),Bt=y({name:C(),owner:C(),remoteUrl:C()}),Vt=y({_meta:D(C(),x()).nullish()}),Ht=y({_meta:D(C(),x()).nullish(),jump:Mt.nullish(),rename:zt.nullish(),searchAndReplace:Vt.nullish()}),Ut=y({id:C(),isRegex:T().nullish(),replace:C(),search:C(),uri:C()}),Wt=w([v(`automatic`),v(`diagnostic`),v(`manual`)]),Gt=y({_meta:D(C(),x()).nullish(),maxCount:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish()}),Kt=y({_meta:D(C(),x()).nullish(),diagnostics:wt.nullish(),editHistory:kt.nullish(),openFiles:Nt.nullish(),recentFiles:Ft.nullish(),relatedSnippets:Rt.nullish(),userActions:Gt.nullish()}),qt=y({_meta:D(C(),x()).nullish(),additionalDirectories:E(C()).optional(),cwd:C(),mcpServers:E(F)}),Jt=y({default:b().nullish(),description:C().nullish(),maximum:b().nullish(),minimum:b().nullish(),title:C().nullish()}),Yt=C(),Xt=w([v(`allow_once`),v(`allow_always`),v(`reject_once`),v(`reject_always`)]),Zt=y({_meta:D(C(),x()).nullish(),kind:Xt,name:C(),optionId:Yt}),Qt=w([v(`high`),v(`medium`),v(`low`)]),$t=w([v(`pending`),v(`in_progress`),v(`completed`)]),en=y({_meta:D(C(),x()).nullish(),content:C(),priority:Qt,status:$t}),tn=y({_meta:D(C(),x()).nullish(),entries:E(en)}),I=y({character:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}),line:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`})}),nn=y({id:C(),position:I,uri:C()}),rn=y({id:C(),newName:C(),position:I,uri:C()}),an=y({action:C(),position:I,timestampMs:b(),uri:C()}),on=w([v(`utf-16`),v(`utf-32`),v(`utf-8`)]),sn=y({_meta:D(C(),x()).nullish(),auth:je.optional().default({terminal:!1}),elicitation:et.nullish(),fs:st.optional().default({readTextFile:!1,writeTextFile:!1}),nes:Ht.nullish(),positionEncodings:E(on).optional(),terminal:T().optional().default(!1)}),cn=y({_meta:D(C(),x()).nullish(),audio:T().optional().default(!1),embeddedContext:T().optional().default(!1),image:T().optional().default(!1)}),ln=b().int().gte(0).lte(65535),un=y({_meta:D(C(),x()).nullish(),clientCapabilities:sn.optional().default({auth:{terminal:!1},fs:{readTextFile:!1,writeTextFile:!1},terminal:!1}),clientInfo:lt.nullish(),protocolVersion:ln}),L=y({end:I,start:I}),dn=y({message:C(),range:L,severity:Ct,uri:C()}),fn=y({languageId:C(),lastFocusedMs:b().nullish(),uri:C(),visibleRange:L.nullish()}),pn=y({_meta:D(C(),x()).nullish(),diagnostics:E(dn).nullish(),editHistory:E(At).nullish(),openFiles:E(fn).nullish(),recentFiles:E(Pt).nullish(),relatedSnippets:E(Lt).nullish(),userActions:E(an).nullish()}),mn=y({newText:C(),range:L}),hn=w([y({cursorPosition:I.nullish(),edits:E(mn),id:C(),uri:C()}).and(y({kind:v(`edit`)})),nn.and(y({kind:v(`jump`)})),rn.and(y({kind:v(`rename`)})),Ut.and(y({kind:v(`searchAndReplace`)}))]),gn=y({_meta:D(C(),x()).nullish(),content:C()}),_n=y({_meta:D(C(),x()).nullish()}),R=w([b(),C()]).nullable();y({_meta:D(C(),x()).nullish(),requestId:R});var vn=y({requestId:R}),yn=ne([`assistant`,`user`]),z=y({_meta:D(C(),x()).nullish(),audience:E(yn).nullish(),lastModified:C().nullish(),priority:b().nullish()}),bn=y({_meta:D(C(),x()).nullish(),annotations:z.nullish(),data:C(),mimeType:C()}),xn=y({_meta:D(C(),x()).nullish(),annotations:z.nullish(),data:C(),mimeType:C(),uri:C().nullish()}),Sn=y({_meta:D(C(),x()).nullish(),annotations:z.nullish(),description:C().nullish(),mimeType:C().nullish(),name:C(),size:b().nullish(),title:C().nullish(),uri:C()}),Cn=y({_meta:D(C(),x()).nullish(),optionId:Yt}),wn=w([y({outcome:v(`cancelled`)}),Cn.and(y({outcome:v(`selected`)}))]),Tn=y({_meta:D(C(),x()).nullish(),outcome:wn}),En=y({_meta:D(C(),x()).nullish()}),Dn=y({_meta:D(C(),x()).nullish()}),On=y({currentValue:T()}),kn=C(),An=C(),jn=w([v(`mode`),v(`model`),v(`thought_level`),C()]),B=C(),Mn=y({_meta:D(C(),x()).nullish(),description:C().nullish(),name:C(),value:B}),Nn=y({_meta:D(C(),x()).nullish(),group:kn,name:C(),options:E(Mn)}),V=O(w([y({currentValue:B,options:w([E(Mn),E(Nn)])}).and(y({type:v(`select`)})),On.and(y({type:v(`boolean`)}))]),y({_meta:D(C(),x()).nullish(),category:jn.nullish(),description:C().nullish(),id:An,name:C()})),Pn=y({_meta:D(C(),x()).nullish(),configOptions:E(V)}),Fn=y({_meta:D(C(),x()).nullish()}),H=C(),In=y({_meta:D(C(),x()).nullish(),id:C(),sessionId:H}),Ln=y({_meta:D(C(),x()).nullish(),sessionId:H}),Rn=y({_meta:D(C(),x()).nullish(),sessionId:H}),zn=y({_meta:D(C(),x()).nullish(),sessionId:H}),Bn=y({_meta:D(C(),x()).nullish(),args:E(C()).optional(),command:C(),cwd:C().nullish(),env:E(nt).optional(),outputByteLimit:b().nullish(),sessionId:H}),Vn=y({_meta:D(C(),x()).nullish(),sessionId:H,uri:C()}),Hn=y({_meta:D(C(),x()).nullish(),position:I,sessionId:H,uri:C(),version:b(),visibleRange:L}),Un=y({_meta:D(C(),x()).nullish(),languageId:C(),sessionId:H,text:C(),uri:C(),version:b()}),Wn=y({_meta:D(C(),x()).nullish(),sessionId:H,uri:C()}),Gn=y({_meta:D(C(),x()).nullish(),additionalDirectories:E(C()).optional(),cwd:C(),mcpServers:E(F).optional(),sessionId:H}),Kn=y({_meta:D(C(),x()).nullish(),sessionId:H,terminalId:C()}),qn=y({_meta:D(C(),x()).nullish(),additionalDirectories:E(C()).optional(),cwd:C(),mcpServers:E(F),sessionId:H}),Jn=y({_meta:D(C(),x()).nullish(),limit:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),line:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:C(),sessionId:H}),Yn=y({_meta:D(C(),x()).nullish(),id:C(),reason:It.nullish(),sessionId:H}),Xn=y({_meta:D(C(),x()).nullish(),sessionId:H,terminalId:C()}),Zn=y({_meta:D(C(),x()).nullish(),additionalDirectories:E(C()).optional(),cwd:C(),mcpServers:E(F).optional(),sessionId:H}),Qn=y({_meta:D(C(),x()).nullish(),additionalDirectories:E(C()).optional(),cwd:C(),sessionId:H,title:C().nullish(),updatedAt:C().nullish()}),$n=y({_meta:D(C(),x()).nullish(),nextCursor:C().nullish(),sessions:E(Qn)}),er=y({_meta:D(C(),x()).nullish(),title:C().nullish(),updatedAt:C().nullish()}),tr=y({_meta:D(C(),x()).nullish()}),U=C(),nr=y({_meta:D(C(),x()).nullish(),currentModeId:U}),rr=y({_meta:D(C(),x()).nullish(),description:C().nullish(),id:U,name:C()}),W=y({_meta:D(C(),x()).nullish(),availableModes:E(rr),currentModeId:U}),G=y({_meta:D(C(),x()).nullish(),availableModels:E(St),currentModelId:xt}),ir=y({_meta:D(C(),x()).nullish(),configOptions:E(V).nullish(),models:G.nullish(),modes:W.nullish(),sessionId:H}),ar=y({_meta:D(C(),x()).nullish(),configOptions:E(V).nullish(),models:G.nullish(),modes:W.nullish()}),or=y({_meta:D(C(),x()).nullish(),configOptions:E(V).nullish(),models:G.nullish(),modes:W.nullish(),sessionId:H}),sr=y({_meta:D(C(),x()).nullish(),configOptions:E(V).nullish(),models:G.nullish(),modes:W.nullish()}),cr=y({_meta:D(C(),x()).nullish()}),lr=y({_meta:D(C(),x()).nullish(),additionalDirectories:En.nullish(),close:Dn.nullish(),fork:Fn.nullish(),list:tr.nullish(),resume:cr.nullish()}),ur=O(w([y({type:v(`boolean`),value:T()}),y({value:B})]),y({_meta:D(C(),x()).nullish(),configId:An,sessionId:H})),dr=y({_meta:D(C(),x()).nullish(),configOptions:E(V)}),fr=y({_meta:D(C(),x()).nullish(),modeId:U,sessionId:H}),pr=y({_meta:D(C(),x()).nullish()}),mr=y({_meta:D(C(),x()).nullish(),modelId:xt,sessionId:H}),hr=y({_meta:D(C(),x()).nullish()}),gr=y({_meta:D(C(),x()).nullish(),sessionId:H}),_r=w([v(`end_turn`),v(`max_tokens`),v(`max_turn_requests`),v(`refusal`),v(`cancelled`)]),vr=w([v(`email`),v(`uri`),v(`date`),v(`date-time`)]),yr=y({default:C().nullish(),description:C().nullish(),enum:E(C()).nullish(),format:vr.nullish(),maxLength:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),minLength:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),oneOf:E(tt).nullish(),pattern:C().nullish(),title:C().nullish()}),br=y({_meta:D(C(),x()).nullish(),context:pn.nullish(),position:I,selection:L.nullish(),sessionId:H,triggerKind:Wt,uri:C(),version:b()}),xr=y({_meta:D(C(),x()).nullish(),suggestions:E(hn)}),Sr=y({_meta:D(C(),x()).nullish(),terminalId:C()}),Cr=y({_meta:D(C(),x()).nullish(),exitCode:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:C().nullish()}),wr=y({_meta:D(C(),x()).nullish(),sessionId:H,terminalId:C()}),Tr=y({_meta:D(C(),x()).nullish(),exitStatus:Cr.nullish(),output:C(),truncated:T()}),Er=y({_meta:D(C(),x()).nullish(),annotations:z.nullish(),text:C()}),Dr=y({range:L.nullish(),text:C()}),Or=y({_meta:D(C(),x()).nullish(),contentChanges:E(Dr),sessionId:H,uri:C(),version:b()});y({method:C(),params:w([Ln,Un,Or,Vn,Wn,Hn,In,Yn,it]).nullish()});var kr=w([v(`full`),v(`incremental`)]),Ar=y({_meta:D(C(),x()).nullish(),syncKind:kr}),jr=y({_meta:D(C(),x()).nullish(),didChange:Ar.nullish(),didClose:Tt.nullish(),didFocus:Et.nullish(),didOpen:Dt.nullish(),didSave:Ot.nullish()}),Mr=y({_meta:D(C(),x()).nullish(),document:jr.nullish()}),Nr=y({_meta:D(C(),x()).nullish(),context:Kt.nullish(),events:Mr.nullish()}),Pr=y({_meta:D(C(),x()).nullish(),auth:mt.optional().default({}),loadSession:T().optional().default(!1),mcpCapabilities:_t.optional().default({http:!1,sse:!1}),nes:Nr.nullish(),positionEncoding:on.nullish(),promptCapabilities:cn.optional().default({audio:!1,embeddedContext:!1,image:!1}),sessionCapabilities:lr.optional().default({})}),Fr=y({_meta:D(C(),x()).nullish(),agentCapabilities:Pr.optional().default({auth:{},loadSession:!1,mcpCapabilities:{http:!1,sse:!1},promptCapabilities:{audio:!1,embeddedContext:!1,image:!1},sessionCapabilities:{}}),agentInfo:lt.nullish(),authMethods:E(Ie).optional().default([]),protocolVersion:ln}),Ir=w([y({_meta:D(C(),x()).nullish(),mimeType:C().nullish(),text:C(),uri:C()}),ze]),Lr=y({_meta:D(C(),x()).nullish(),annotations:z.nullish(),resource:Ir}),K=w([Er.and(y({type:v(`text`)})),xn.and(y({type:v(`image`)})),bn.and(y({type:v(`audio`)})),Sn.and(y({type:v(`resource_link`)})),Lr.and(y({type:v(`resource`)}))]),Rr=y({_meta:D(C(),x()).nullish(),content:K}),zr=y({_meta:D(C(),x()).nullish(),content:K,messageId:C().nullish()}),Br=y({_meta:D(C(),x()).nullish(),messageId:C().nullish(),prompt:E(K),sessionId:H}),Vr=y({anyOf:E(tt)}),Hr=w([Rr.and(y({type:v(`content`)})),Ge.and(y({type:v(`diff`)})),Sr.and(y({type:v(`terminal`)}))]),Ur=C(),Wr=y({sessionId:H,toolCallId:Ur.nullish()}),Gr=O(w([Wr,vn]),y({elicitationId:Ye,url:C().url()})),Kr=y({_meta:D(C(),x()).nullish(),line:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),path:C()}),qr=w([v(`pending`),v(`in_progress`),v(`completed`),v(`failed`)]),Jr=w([v(`read`),v(`edit`),v(`delete`),v(`move`),v(`search`),v(`execute`),v(`think`),v(`fetch`),v(`switch_mode`),v(`other`)]),Yr=y({_meta:D(C(),x()).nullish(),content:E(Hr).optional(),kind:Jr.optional(),locations:E(Kr).optional(),rawInput:x().optional(),rawOutput:x().optional(),status:qr.optional(),title:C(),toolCallId:Ur}),Xr=y({_meta:D(C(),x()).nullish(),content:E(Hr).nullish(),kind:Jr.nullish(),locations:E(Kr).nullish(),rawInput:x().optional(),rawOutput:x().optional(),status:qr.nullish(),title:C().nullish(),toolCallId:Ur}),Zr=y({_meta:D(C(),x()).nullish(),options:E(Zt),sessionId:H,toolCall:Xr}),Qr=y({_meta:D(C(),x()).nullish(),hint:C()}),$r=y({_meta:D(C(),x()).nullish(),description:C(),input:Qr.nullish(),name:C()}),ei=y({_meta:D(C(),x()).nullish(),availableCommands:E($r)}),ti=w([y({enum:E(C()),type:Qe}),Vr]),ni=y({default:E(C()).nullish(),description:C().nullish(),items:ti,maxItems:b().nullish(),minItems:b().nullish(),title:C().nullish()}),ri=w([yr.and(y({type:v(`string`)})),Jt.and(y({type:v(`number`)})),ut.and(y({type:v(`integer`)})),Be.and(y({type:v(`boolean`)})),ni.and(y({type:v(`array`)}))]),ii=y({description:C().nullish(),properties:D(C(),ri).optional().default({}),required:E(C()).nullish(),title:C().nullish(),type:Ze.optional().default(`object`)}),ai=O(w([O(w([Wr,vn]),y({requestedSchema:ii})).and(y({mode:v(`form`)})),Gr.and(y({mode:v(`url`)}))]),y({_meta:D(C(),x()).nullish(),message:C()})),oi=y({cachedReadTokens:b().nullish(),cachedWriteTokens:b().nullish(),inputTokens:b(),outputTokens:b(),thoughtTokens:b().nullish(),totalTokens:b()});w([y({id:R,result:w([Fr,Re,gt,or,ar,$n,ir,sr,He,pr,dr,y({_meta:D(C(),x()).nullish(),stopReason:_r,usage:oi.nullish(),userMessageId:C().nullish()}),hr,gr,xr,Ve,ot])}),y({error:rt,id:R})]);var si=y({_meta:D(C(),x()).nullish(),cost:Ue.nullish(),size:b(),used:b()}),ci=w([zr.and(y({sessionUpdate:v(`user_message_chunk`)})),zr.and(y({sessionUpdate:v(`agent_message_chunk`)})),zr.and(y({sessionUpdate:v(`agent_thought_chunk`)})),Yr.and(y({sessionUpdate:v(`tool_call`)})),Xr.and(y({sessionUpdate:v(`tool_call_update`)})),tn.and(y({sessionUpdate:v(`plan`)})),ei.and(y({sessionUpdate:v(`available_commands_update`)})),nr.and(y({sessionUpdate:v(`current_mode_update`)})),Pn.and(y({sessionUpdate:v(`config_option_update`)})),er.and(y({sessionUpdate:v(`session_info_update`)})),si.and(y({sessionUpdate:v(`usage_update`)}))]),li=y({_meta:D(C(),x()).nullish(),sessionId:H,update:ci});y({method:C(),params:w([li,Xe,it]).nullish()});var ui=y({_meta:D(C(),x()).nullish(),sessionId:H,terminalId:C()}),di=y({_meta:D(C(),x()).nullish(),exitCode:b().int().gte(0).max(4294967295,{message:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),signal:C().nullish()}),fi=y({name:C(),uri:C()}),pi=y({_meta:D(C(),x()).nullish(),repository:Bt.nullish(),workspaceFolders:E(fi).nullish(),workspaceUri:C().nullish()});y({id:R,method:C(),params:w([un,Le,ht,qt,qn,ft,Gn,Zn,zn,fr,ur,Br,mr,pi,br,Rn,at]).nullish()});var mi=y({_meta:D(C(),x()).nullish(),content:C(),path:C(),sessionId:H});y({id:R,method:C(),params:w([mi,Jn,Zr,Bn,wr,Xn,ui,Kn,ai,at]).nullish()}),w([y({id:R,result:w([y({_meta:D(C(),x()).nullish()}),gn,Tn,We,Tr,_n,di,dt,qe,ot])}),y({error:rt,id:R})]),e();function hi(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()}}})}}re();var gi,_i=class{constructor(e,n){t(this,`connection`,void 0);let r=e(this),i=async(e,t)=>{switch(e){case N.initialize:{let e=un.parse(t);return r.initialize(e)}case N.session_new:{let e=qt.parse(t);return r.newSession(e)}case N.session_load:{if(!r.loadSession)throw q.methodNotFound(e);let n=qn.parse(t);return r.loadSession(n)}case N.session_list:{if(!r.listSessions)throw q.methodNotFound(e);let n=ft.parse(t);return r.listSessions(n)}case N.session_fork:{if(!r.unstable_forkSession)throw q.methodNotFound(e);let n=Gn.parse(t);return r.unstable_forkSession(n)}case N.session_resume:{if(!r.unstable_resumeSession)throw q.methodNotFound(e);let n=Zn.parse(t);return r.unstable_resumeSession(n)}case N.session_close:{if(!r.unstable_closeSession)throw q.methodNotFound(e);let n=zn.parse(t);return r.unstable_closeSession(n)}case N.session_set_mode:{if(!r.setSessionMode)throw q.methodNotFound(e);let n=fr.parse(t);return await r.setSessionMode(n)??{}}case N.authenticate:{let e=Le.parse(t);return await r.authenticate(e)??{}}case N.logout:{if(!r.unstable_logout)throw q.methodNotFound(e);let n=ht.parse(t);return await r.unstable_logout(n)??{}}case N.session_prompt:{let e=Br.parse(t);return r.prompt(e)}case N.session_set_model:{if(!r.unstable_setSessionModel)throw q.methodNotFound(e);let n=mr.parse(t);return await r.unstable_setSessionModel(n)??{}}case N.session_set_config_option:{if(!r.setSessionConfigOption)throw q.methodNotFound(e);let n=ur.parse(t);return r.setSessionConfigOption(n)}case N.nes_start:{if(!r.unstable_startNes)throw q.methodNotFound(e);let n=pi.parse(t);return r.unstable_startNes(n)}case N.nes_suggest:{if(!r.unstable_suggestNes)throw q.methodNotFound(e);let n=br.parse(t);return r.unstable_suggestNes(n)}case N.nes_close:{if(!r.unstable_closeNes)throw q.methodNotFound(e);let n=Rn.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 N.session_cancel:{let e=Ln.parse(t);return r.cancel(e)}case N.document_did_open:{if(!r.unstable_didOpenDocument)return;let e=Un.parse(t);return r.unstable_didOpenDocument(e)}case N.document_did_change:{if(!r.unstable_didChangeDocument)return;let e=Or.parse(t);return r.unstable_didChangeDocument(e)}case N.document_did_close:{if(!r.unstable_didCloseDocument)return;let e=Vn.parse(t);return r.unstable_didCloseDocument(e)}case N.document_did_save:{if(!r.unstable_didSaveDocument)return;let e=Wn.parse(t);return r.unstable_didSaveDocument(e)}case N.document_did_focus:{if(!r.unstable_didFocusDocument)return;let e=Hn.parse(t);return r.unstable_didFocusDocument(e)}case N.nes_accept:{if(!r.unstable_acceptNes)return;let e=In.parse(t);return r.unstable_acceptNes(e)}case N.nes_reject:{if(!r.unstable_rejectNes)return;let e=Yn.parse(t);return r.unstable_rejectNes(e)}default:if(r.extNotification)return r.extNotification(e,t);throw q.methodNotFound(e)}};this.connection=new yi(i,a,n)}async sessionUpdate(e){return await this.connection.sendNotification(P.session_update,e)}async requestPermission(e){return await this.connection.sendRequest(P.session_request_permission,e)}async readTextFile(e){return await this.connection.sendRequest(P.fs_read_text_file,e)}async writeTextFile(e){return await this.connection.sendRequest(P.fs_write_text_file,e)??{}}async createTerminal(e){return new vi((await this.connection.sendRequest(P.terminal_create,e)).terminalId,e.sessionId,this.connection)}async unstable_createElicitation(e){return await this.connection.sendRequest(P.elicitation_create,e)}async unstable_completeElicitation(e){return await this.connection.sendNotification(P.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}};gi=Symbol.asyncDispose;var vi=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(P.terminal_output,{sessionId:this.sessionId,terminalId:this.id})}async waitForExit(){return await this.connection.sendRequest(P.terminal_wait_for_exit,{sessionId:this.sessionId,terminalId:this.id})}async kill(){return await this.connection.sendRequest(P.terminal_kill,{sessionId:this.sessionId,terminalId:this.id})??{}}async release(){return await this.connection.sendRequest(P.terminal_release,{sessionId:this.sessionId,terminalId:this.id})??{}}async[gi](){await this.release()}},yi=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 S)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 S)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}}};oe(),k(),ue(),ye(),de(),l(),d(),i(),s(),f(),_(),xe();function J(e,t){if(e)return t?ke(e)?e:Ae(t,e):e}var bi=!(typeof process.geteuid==`function`?process.geteuid()===0:typeof process.getuid==`function`&&process.getuid()===0)||!!process.env.IS_SANDBOX,xi={auto:`auto`,default:`default`,acceptedits:`acceptEdits`,dontask:`dontAsk`,plan:`plan`,bypasspermissions:`bypassPermissions`,bypass:`bypassPermissions`};function Si(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=xi[n];if(!r)throw Error(`Invalid ${t}: ${e}.`);if(r===`bypassPermissions`&&!bi)throw Error(`Invalid ${t}: bypassPermissions is not available when running as root.`);return r}function Ci(e){let t=[...e.mcpServers??[]].sort((e,t)=>e.name.localeCompare(t.name));return JSON.stringify({cwd:e.cwd,mcpServers:t})}var wi=256;function Ti(e){let t=e.replace(/[\r\n]+/g,` `).replace(/\s+/g,` `).trim();return t.length<=wi?t:`${t.slice(0,wi-1)}…`}function Ei(e,t){if(!t)return e;let n=M.resolve(t),r=M.resolve(e);return r.startsWith(n+M.sep)||r===n?M.relative(n,r):e}function Di(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?Ei(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?Ei(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?Ei(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 Oi(e,t){return Array.isArray(e)&&e.length>0?{content:e.map(e=>({type:`content`,content:ki(e,t)}))}:typeof e==`string`&&e.length>0?{content:[{type:`content`,content:{type:`text`,text:t?`\`\`\`\n${e}\n\`\`\``:e}}]}:{}}function ki(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 Ai(e,t,n=!1){if(!t)return{};let r=e.is_error===!0,i=e.content;if(r&&i)return Oi(i,!0);switch(t.name){case`Read`:return typeof i==`string`&&i.length>0?{content:[{type:`content`,content:{type:`text`,text:Di(i)}}]}:Array.isArray(i)&&i.length>0?{content:i.map(e=>({type:`content`,content:e.type===`text`?{type:`text`,text:Di(e.text)}:ki(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 Oi(i??``,r)}}function ji(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:ji(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=Ai(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 Mi(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 Ni(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 Pi(e,t){let n=0,r=Math.min(e.length,t.length);for(;n<r&&e[n]===t[n];)n++;return n}function Fi(e,t){let n=null,r=0;for(let i of Object.keys(e)){let e=Pi(i,t);e>r&&(r=e,n=i)}return n?e[n]??null:null}var Ii=console;function Li(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 Ri(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 Li(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=Fi(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=j());let r=Ni(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=j()),s=m);let c=Mi(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:Ii.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 zi(e,t,n,r,i,a){for(let o of t){let t=o;if(t.type!==`user`&&t.type!==`assistant`){Ii.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=j();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:j()});for(let e of t)await n.sessionUpdate(e)}}}function Bi(e,t,n,i,a,o,s,c){return async(n,l,u,d,f,p)=>{let m=Hi(i);if(n.name===`ExitPlanMode`)return Vi(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 Vi(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 Hi(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}ge(),we(),p(),pe(),e(),n(),h();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||ie(),n=await he(t),r=await o({dir:t}),i=[];for(let e of r){if(!e.cwd||await he(e.cwd)!==n)continue;let t=Ti(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 Ui(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 me(e.sessionId);if(t)try{await Oe(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 Ui(e){let t;try{let n=await m(e);n&&n.messages.length>0&&(t=u(n.messages))}catch(e){console.error(`[ACP] fork source load failed:`,e)}return{initialMessages:t}}var Wi=[`auto`,`default`,`acceptEdits`,`bypassPermissions`,`dontAsk`,`plan`];function Gi(e){return Wi.includes(e)}function Ki(e,t,n){if(t){let t=qi(e,`_meta.permissionMode`);if(t===`bypassPermissions`&&!Xi())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 Ji(n)??`default`}function qi(e,t){if(e==null)throw Error(`Invalid ${t}: expected a string.`);return Si(e,t)}function Ji(e){if(e!=null)try{return Si(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 Yi(e,t){return!!e&&Object.hasOwn(e,t)}function Xi(){return Zi()}function Zi(){return process.env.IS_SANDBOX?!0:typeof process.geteuid==`function`?process.geteuid()!==0:typeof process.getuid!=`function`||process.getuid()!==0}function Qi(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 $i(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 ea(e,t,n,r){n===`mode`?t.modes={...t.modes,currentModeId:r}:n===`model`&&(t.models={...t.models,currentModelId:r})}k();function ta(){return le().permissions?.defaultMode}async function na(e,t={}){fe();let n=t.sessionId??j(),r=e.cwd;A(n,se()),ce(r);let i=process.cwd(),o=!1;try{process.chdir(r),o=!0}catch{}ae(),be();try{let i=ve(),o=te(i),s=e._meta,l=Yi(s,`permissionMode`),u=Ki(l?s?.permissionMode:void 0,l,ta()),d=$(this),f=this.conn,p=Bi(f,n,()=>this.sessions.get(n)?.modes.currentModeId??`default`,d,r,e=>{this.applySessionMode(n,e)},()=>this.sessions.get(n)?.appState.toolPermissionContext.isBypassPermissionsModeAvailable??!1),m=Xi(),h={...a(),toolPermissionContext:{...i,mode:u,isBypassPermissionsModeAvailable:m}},[_,v]=await Promise.all([c(r),g(r)]);h.agentDefinitions=v;let y=new Se({cwd:r,tools:o,commands:_,mcpClients:[],agents:v.activeAgents,canUseTool:p,getAppState:()=>h,setAppState:e=>{let t=e(h);Object.assign(h,t)},readFileCache:new ee(500,50*1024*1024),includePartialMessages:!0,replayUserMessages:!0,initialMessages:t.initialMessages}),b={currentModeId:u,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.`},...m?[{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`}]},x=Ce(),S=_e(),C={availableModels:x.map(e=>({modelId:String(e.value??``),name:e.label??String(e.value??``),description:e.description??void 0})),currentModelId:S};y.setModel(S);let w=Qi(b,C),T={queryEngine:y,cancelled:!1,cancelGeneration:0,cwd:r,modes:b,models:C,configOptions:w,promptRunning:!1,pendingMessages:new Map,pendingQueue:[],pendingQueueHead:0,toolUseCache:{},clientCapabilities:d,appState:h,commands:_,sessionFingerprint:Ci({cwd:r,mcpServers:e.mcpServers})};return this.sessions.set(n,T),{sessionId:n,modes:b,models:C,configOptions:w}}finally{o&&process.chdir(i)}}Object.assign(Z.prototype,{createSession:na}),n(),h(),k(),pe();async function ra(e){let t=e.replay!==!1,n=this.sessions.get(e.sessionId);if(n){if(Ci({cwd:e.cwd,mcpServers:e.mcpServers})===n.sessionFingerprint){let r=await me(e.sessionId,e.cwd);return A(e.sessionId,r?Te(r.filePath):null),ce(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 me(e.sessionId,e.cwd),i=r?Te(r.filePath):null;A(e.sessionId,i),ce(e.cwd);let a;if(r)try{let t=await m(e.sessionId);t&&t.messages.length>0&&(a=u(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 zi(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 ia(e){this.sessions.get(e)&&(await this.cancel({sessionId:e}),this.sessions.delete(e))}async function aa(e){try{let t=await m(e.sessionId);if(!t||t.messages.length===0)return;let n=u(t.messages);if(n.length===0)return;let r=this.sessions.get(e.sessionId);if(!r)return;await zi(e.sessionId,n,Q(this),r.toolUseCache,$(this),r.cwd)}catch(e){console.error(`[ACP] Failed to replay session history:`,e)}}function oa(e,t){if(!Gi(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 sa(e,t,n){let r=this.sessions.get(e);r&&(ea(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:ra,teardownSession:ia,replaySessionHistory:aa,applySessionMode:oa,updateConfigOption:sa});function ca(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(la(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 la(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 ua(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),da(e),n}da(e)}function da(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)}}k();async function fa(e){let t=this.sessions.get(e.sessionId);if(!t)throw Error(`Session ${e.sessionId} not found`);let n=e.messageId??void 0,r=ca(e.prompt);if(!r.trim())throw Error(`Prompt content is empty`);let i=t.cancelGeneration;if(t.promptRunning){let e=j();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,se());let i=t.queryEngine.submitMessage(r),{stopReason:a,usage:o}=await Ri(e.sessionId,i,Q(this),t.queryEngine.getAbortSignal(),t.toolUseCache,$(this),t.cwd,()=>t.cancelled);if(t.cancelled)return{stopReason:`cancelled`};if(await ma(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=ua(t);e?(t.promptRunning=!0,e.resolve(!1)):t.promptRunning=!1}}async function pa(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=$i(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),ea(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 ma(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=Ti(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:fa,setSessionConfigOption:pa}),de(),xe();function ha(e,t){let n=Ee.toWeb(e);return hi(De.toWeb(t),n)}async function ga(){fe(),be();let e=ha(process.stdin,process.stdout),t,n=new _i(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{ga as runAcpAgent};
@@ -1 +0,0 @@
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 m,E as h,F as g,O as re,S as ie,T as ae,b as oe,c as se,i as ce,m as le,n as _,o as ue,u as de,v,x as fe}from"./esm-BbMeEYcz.js";import{n as pe,t as me}from"./esm-sVMjGuep.js";import{L as he,S as ge,Ut as _e,et as ve,ft as ye}from"./state-D5D6QpTX.js";import{C as be,R as xe,i as Se,x as Ce}from"./debug-D58GQBDG.js";import{Gt as y,Jt as we,Kt as Te,Wt as Ee}from"./settings-BowI3jp-.js";import{d as De,m as Oe}from"./git-Wid-XppW.js";import{i as ke,t as Ae}from"./execFileNoThrow-B_KRY4cT.js";import{a as je,n as Me,o as Ne,r as Pe}from"./platform-DMQxcm4K.js";import{Pt as Fe,Tn as Ie,_ as Le,kt as Re,u as ze,wn as Be,zt as Ve}from"./model-BaMclMXn.js";import{i as He,t as Ue}from"./genericProcessUtils-Cnyun_Wr.js";import{arch as We,hostname as Ge,platform as Ke,release as qe}from"os";import{extname as Je}from"path";import{stat as Ye}from"fs/promises";import{inspect as Xe}from"util";import*as Ze from"process";import{AsyncLocalStorage as Qe}from"async_hooks";var b,$e=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`})(b||(b={}))})),x,S,C=e((()=>{x=class{emit(e){}enabled(){return!1}},S=new x}));function et(e,t,n){return r=>r===e?t:n}var w,T,tt=e((()=>{w=Symbol.for(`io.opentelemetry.js.api.logs`),T=globalThis})),nt,E,rt=e((()=>{C(),nt=class{getLogger(e,t,n){return new x}},E=new nt})),it,at=e((()=>{C(),it=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):S}}})),ot,st=e((()=>{rt(),at(),ot=class{getLogger(e,t,n){return this._getDelegateLogger(e,t,n)??new it(this,e,t,n)}_getDelegate(){return this._delegate??E}_setDelegate(e){this._delegate=e}_getDelegateLogger(e,t,n){return this._delegate?.getLogger(e,t,n)}}})),ct,lt=e((()=>{tt(),rt(),st(),ct=class e{constructor(){this._proxyLoggerProvider=new ot}static getInstance(){return this._instance||(this._instance=new e),this._instance}setGlobalLoggerProvider(e){return T[w]?this.getLoggerProvider():(T[w]=et(1,e,E),this._proxyLoggerProvider._setDelegate(e),e)}getLoggerProvider(){return T[w]?.call(T,1)??this._proxyLoggerProvider}getLogger(e,t,n){return this.getLoggerProvider().getLogger(e,t,n)}disable(){delete T[w],this._proxyLoggerProvider=new ot}}})),ut,D=e((()=>{$e(),C(),lt(),ut=ct.getInstance()}));function dt(){return process.platform===`linux`&&r(process.env.CLAUDE_CODE_BUBBLEWRAP)}function ft(){return process.platform===`linux`?O??!1:!1}async function pt(){if(k!==void 0)return k;if(process.platform===`darwin`)return k=null,null;try{let e=await Ue(process.pid,10);for(let t of e){let e=t.toLowerCase();for(let t of Ee)if(e.includes(t))return k=t,t}}catch{}return k=null,null}async function mt(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&y.platform!==`darwin`?await pt()||`pycharm`:y.terminal}function ht(){return process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&y.platform!==`darwin`?k===void 0?`pycharm`:k||`pycharm`:y.terminal}async function gt(){process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`&&await pt()}var _t,O,k,A,vt=e((()=>{n(),we(),i(),ke(),He(),_t=t(async()=>{if(process.platform!==`linux`)return!1;let{code:e}=await Ae(`test`,[`-f`,`/.dockerenv`]);return e===0}),O=null,process.platform===`linux`&&Ye(`/lib/libc.musl-${process.arch===`x64`?`x86_64`:`aarch64`}.so.1`).then(()=>{O=!0},()=>{O=!1}),A={...y,terminal:ht(),getIsDocker:_t,getIsBubblewrapSandbox:dt,isMuslEnvironment:ft,getTerminalWithJetBrainsDetectionAsync:mt,initJetBrainsDetection:gt}}));function yt(e){return bt?.has(e)??!1}var bt,xt=e((()=>{Se(),xe()}));function j(){return Et.getStore()}function St(e,t){return Et.run(e,t)}function Ct(e){return e?.agentType===`subagent`}function wt(){let e=j();if(!(!Ct(e)||!e.subagentName))return e.isBuiltIn?e.subagentName:`user-defined`}function Tt(){let e=j();if(!(!e?.invokingRequestId||e.invocationEmitted))return e.invocationEmitted=!0,{invokingRequestId:e.invokingRequestId,invocationKind:e.invocationKind}}var Et,Dt=e((()=>{Et=new Qe}));function Ot(e){return e.startsWith(`mcp__`)?`mcp_tool`:e}function kt(){return r(process.env.OTEL_LOG_TOOL_DETAILS)}function At(e,t){return!!(process.env.CLAUDE_CODE_ENTRYPOINT===`local-agent`||e===`claudeai-proxy`||t&&yt(t))}function jt(e,t,n){let r=Mt(e);return!r||!Ht.has(r.serverName)&&!At(t,n)?{}:{mcpServerName:r.serverName,mcpToolName:r.mcpToolName}}function Mt(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 Nt(e,t){if(e===`Skill`&&typeof t==`object`&&t&&`skill`in t&&typeof t.skill==`string`)return t.skill}function Pt(e,t=0){if(typeof e==`string`)return e.length>Ut?`${e.slice(0,Wt)}…[${e.length} chars]`:e;if(typeof e==`number`||typeof e==`boolean`||e==null)return e;if(t>=Kt)return`<nested>`;if(Array.isArray(e)){let n=e.slice(0,M).map(e=>Pt(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,Pt(n,t+1)]);return n.length>M&&r.push([`…`,`${n.length} keys`]),Object.fromEntries(r)}return String(e)}function Ft(e){if(!kt())return;let t=be(Pt(e));return t.length>Gt&&(t=`${t.slice(0,Gt)}…[truncated]`),t}function It(e){let t=Je(e).toLowerCase();if(!t||t===`.`)return;let n=t.slice(1);return n.length>qt?`other`:n}function Lt(e,t){if(!e.includes(`.`)&&!t)return;let n,r=new Set;if(t){let e=It(t);e&&(r.add(e),n=e)}for(let t of e.split(Yt)){if(!t)continue;let e=t.split(Xt);if(e.length<2)continue;let i=e[0],a=i.lastIndexOf(`/`),o=a>=0?i.slice(a+1):i;if(Jt.has(o))for(let t=1;t<e.length;t++){let i=e[t];if(i.charCodeAt(0)===45)continue;let a=It(i);a&&!r.has(a)&&(r.add(a),n=n?`${n},${a}`:a)}}if(n)return n}function Rt(){let e=j();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=ve();return i?{parentSessionId:i}:{}}function zt(){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 Bt(e={}){let t=e.model?String(e.model):ze(),n=typeof e.betas==`string`?e.betas:Be(t).join(`,`),[r,i]=await Promise.all([Qt(),De()]),a=zt();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(he()),clientType:ge(),...a&&{processMetrics:a},sweBenchRunId:process.env.SWE_BENCH_RUN_ID||``,sweBenchInstanceId:process.env.SWE_BENCH_INSTANCE_ID||``,sweBenchTaskId:process.env.SWE_BENCH_TASK_ID||``,...Rt(),...Re()&&{subscriptionType:Re()},...i&&{rh:i}}}function Vt(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(be(i)).toString(`base64`)},...d&&{auth:d},core:u,additional:{...a&&{rh:a},...o&&{skill_mode:o},...s&&{observer_mode:s},...n}}}var Ht,Ut,Wt,Gt,M,Kt,qt,Jt,Yt,Xt,Zt,Qt,N,P,$t=e((()=>{n(),we(),vt(),Ie(),Le(),_e(),i(),xt(),Fe(),Oe(),Ne(),Dt(),Ce(),Ht=new Set,Ut=512,Wt=128,Gt=4*1024,M=20,Kt=2,qt=10,Jt=new Set([`rm`,`mv`,`cp`,`touch`,`mkdir`,`chmod`,`chown`,`cat`,`head`,`tail`,`sort`,`stat`,`diff`,`wc`,`grep`,`rg`,`sed`]),Yt=/\s*(?:&&|\|\||[;|])\s*/,Xt=/\s+/,Zt=t(()=>{let e=`0.0.21`.match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);return e?e[0]:void 0}),Qt=t(async()=>{let[e,t,n,i]=await Promise.all([y.getPackageManagers(),y.getRuntimes(),Pe(),Me()]);return{platform:Te(),platformRaw:process.env.CLAUDE_CODE_HOST_PLATFORM||process.platform,arch:y.arch,nodeVersion:y.nodeVersion,terminal:A.terminal,packageManagers:e.join(`,`),runtimes:t.join(`,`),isRunningWithBun:y.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:y.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:Ve(),version:`0.0.21`,versionBase:Zt(),buildTime:`2026-08-19T11:12:21.602Z`,deploymentEnvironment:y.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},...je()&&{wslVersion:je()},...n??{},...i.length>0?{vcs:i.join(`,`)}:{}}}),N=null,P=null}));function en(e){return e.setValue(F,!0)}function tn(e){return e.getValue(F)===!0}var F,I=e((()=>{f(),F=c(`OpenTelemetry SDK Context Key SUPPRESS_TRACING`)}));function nn(e){let t={};if(typeof e!=`object`||!e)return t;for(let n in e){if(!Object.prototype.hasOwnProperty.call(e,n))continue;if(!rn(n)){p.warn(`Invalid attribute key: ${n}`);continue}let r=e[n];if(!an(r)){p.warn(`Invalid attribute value set for key: ${n}`);continue}Array.isArray(r)?t[n]=r.slice():t[n]=r}return t}function rn(e){return typeof e==`string`&&e!==``}function an(e){return e==null?!0:Array.isArray(e)?on(e):sn(typeof e)}function on(e){let t;for(let n of e){if(n==null)continue;let e=typeof n;if(e!==t){if(!t){if(sn(e)){t=e;continue}return!1}return!1}}return!0}function sn(e){switch(e){case`number`:case`boolean`:case`string`:return!0}return!1}var cn=e((()=>{f()}));function ln(){return e=>{p.error(un(e))}}function un(e){return typeof e==`string`?e:JSON.stringify(dn(e))}function dn(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 fn=e((()=>{f()}));function pn(e){try{mn(e)}catch{}}var mn,hn=e((()=>{fn(),mn=ln()}));function gn(e){let t=process.env[e];if(t==null||t.trim()===``)return;let n=Number(t);if(isNaN(n)){p.warn(`Unknown value ${Xe(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 _n=e((()=>{f()})),vn,yn=e((()=>{vn=`2.9.0`})),bn,xn=e((()=>{bn=`process.runtime.name`})),R,Sn=e((()=>{yn(),v(),xn(),R={[h]:`opentelemetry`,[bn]:`node`,[ae]:re,[m]:vn}})),z,Cn=e((()=>{_n(),Sn(),z=performance})),wn=e((()=>{Cn()}));function B(e){let t=e/1e3;return[Math.trunc(t),Math.round(e%1e3*Nn)]}function Tn(e){return jn(B(z.timeOrigin),B(typeof e==`number`?e:z.now()))}function En(e,t){let n=t[0]-e[0],r=t[1]-e[1];return r<0&&(--n,r+=V),[n,r]}function Dn(e){return e[0]*1e6+e[1]/1e3}function On(e){return e[0]+e[1]/V}function kn(e){return Array.isArray(e)&&e.length===2&&typeof e[0]==`number`&&typeof e[1]==`number`}function An(e){return kn(e)||typeof e==`number`||e instanceof Date}function jn(e,t){let n=[e[0]+t[0],e[1]+t[1]];return n[1]>=V&&(n[1]-=V,n[0]+=1),n}var Mn,Nn,V,Pn=e((()=>{wn(),Mn=9,Nn=10**6,V=10**Mn})),H,Fn=e((()=>{(function(e){e[e.SUCCESS=0]=`SUCCESS`,e[e.FAILED=1]=`FAILED`})(H||(H={}))}));function In(e){if(!Ln(e)||Rn(e)!==Vn)return!1;let t=Gn(e);if(t===null)return!0;let n=G.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&U.call(n)===Wn}function Ln(e){return typeof e==`object`&&!!e}function Rn(e){return e==null?e===void 0?Un:Hn:K&&K in Object(e)?zn(e):Bn(e)}function zn(e){let t=G.call(e,K),n=e[K],r=!1;try{e[K]=void 0,r=!0}catch{}let i=q.call(e);return r&&(t?e[K]=n:delete e[K]),i}function Bn(e){return q.call(e)}var Vn,Hn,Un,U,Wn,Gn,W,G,K,q,Kn=e((()=>{Vn=`[object Object]`,Hn=`[object Null]`,Un=`[object Undefined]`,U=Function.prototype.toString,Wn=U.call(Object),Gn=Object.getPrototypeOf,W=Object.prototype,G=W.hasOwnProperty,K=Symbol?Symbol.toStringTag:void 0,q=W.toString}));function qn(...e){let t=e.shift(),n=new WeakMap;for(;e.length>0;)t=Yn(t,e.shift(),0,n);return t}function Jn(e){return J(e)?e.slice():e}function Yn(e,t,n=0,r){let i;if(!(n>$n)){if(n++,X(e)||X(t)||Zn(t))i=Jn(t);else if(J(e)){if(i=e.slice(),J(t))for(let e=0,n=t.length;e<n;e++)i.push(Jn(t[e]));else if(Y(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]=Jn(t[r]))}}}else if(Y(e))if(Y(t)){if(!Qn(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(X(c))c===void 0?delete i[s]:i[s]=c;else{let a=i[s],o=c;if(Xn(e,s,r)||Xn(t,s,r))delete i[s];else{if(Y(a)&&Y(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]=Yn(i[s],c,n,r)}}}}else i=t;return i}}function Xn(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 J(e){return Array.isArray(e)}function Zn(e){return typeof e==`function`}function Y(e){return!X(e)&&!J(e)&&!Zn(e)&&typeof e==`object`}function X(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||e===void 0||e instanceof Date||e instanceof RegExp||e===null}function Qn(e,t){return!(!In(e)||!In(t))}var $n,er=e((()=>{Kn(),$n=20})),tr,nr=e((()=>{a(),tr=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)}}})),rr,ir=e((()=>{nr(),a(),rr=class{constructor(e,t){o(this,`_isCalled`,!1),o(this,`_deferred`,new tr),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 ar(e,t){return new Promise(n=>{d.with(en(d.active()),()=>{e.export(t,n)})})}var or=e((()=>{f(),I()})),sr,cr=e((()=>{I(),cn(),hn(),fn(),Pn(),Fn(),wn(),er(),ir(),or(),sr={_export:ar}}));function lr(){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,ur=e((()=>{})),Q,dr=e((()=>{Q=e=>typeof e==`object`&&!!e&&typeof e.then==`function`}));function fr(e,t){return _r.FromAttributeList(Object.entries(e),t)}function pr(){return fr({[ne]:lr(),[ae]:R[ae],[h]:R[h],[m]:R[m]})}function mr(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 hr(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 gr(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 _r,vr=e((()=>{f(),cr(),v(),ur(),dr(),a(),_r=class e{static FromAttributeList(t,n){let r=new e({},n);return r._rawAttributes=mr(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=mr(this._rawAttributes),this._schemaUrl=hr(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=gr(this,t),r=n?{schemaUrl:n}:void 0;return e.FromAttributeList([...t.getRawAttributes(),...this.getRawAttributes()],r)}}})),yr,br,xr=e((()=>{f(),v(),cr(),a(),yr=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}},br=new yr})),Sr,Cr,wr,Tr,Er,Dr=e((()=>{Sr=`host.arch`,Cr=`host.id`,wr=`host.name`,Tr=`os.type`,Er=`os.version`}));async function Or(){if(!$)switch(Ze.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 $,kr=e((()=>{})),Ar,jr,Mr=e((()=>{Ar=e=>{switch(e){case`arm`:return`arm32`;case`ppc`:return`ppc32`;case`x64`:return`amd64`;default:return e}},jr=e=>{switch(e){case`sunos`:return`solaris`;case`win32`:return`windows`;default:return e}}})),Nr,Pr,Fr=e((()=>{Dr(),kr(),Mr(),Nr=class{detect(e){return{attributes:{[wr]:Ge(),[Sr]:Ar(We()),[Cr]:Or()}}}},Pr=new Nr})),Ir,Lr,Rr=e((()=>{Dr(),Mr(),Ir=class{detect(e){return{attributes:{[Tr]:jr(Ke()),[Er]:qe()}}}},Lr=new Ir})),zr=e((()=>{Fr(),Rr(),Dr()})),Br=e((()=>{zr()})),Vr=e((()=>{xr(),Br()})),Hr=e((()=>{vr(),Vr(),ur()}));function Ur(e){return Wr(e,new WeakSet)}function Wr(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=>Wr(e,t));let n=e;return n.constructor!==Object&&n.constructor!==void 0?!1:Object.values(n).every(e=>Wr(e,t))}return!1}var Gr=e((()=>{})),Kr,qr=e((()=>{f(),_(),v(),Gr(),a(),Kr=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=le(r??te),this.hrTimeObserved=le(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(!Ur(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(oe,String(e)),t=!0;else if(e&&typeof e==`object`){let n=e;n.code?(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ie,n.code.toString()),t=!0):n.name&&(Object.hasOwn(this.attributes,`exception.type`)||this.setAttribute(ie,n.name),t=!0),n.message&&(Object.hasOwn(this.attributes,`exception.message`)||this.setAttribute(oe,n.message),t=!0),n.stack&&(Object.hasOwn(this.attributes,`exception.stacktrace`)||this.setAttribute(fe,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}}})),Jr,Yr=e((()=>{D(),f(),qr(),a(),Jr=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??b.UNSPECIFIED;if(r!==b.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 Kr(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!==b.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}}})),Xr,Zr=e((()=>{Xr=class{forceFlush(){return Promise.resolve()}onEmit(e,t){}shutdown(){return Promise.resolve()}enabled(e){return!1}}})),Qr,$r=e((()=>{_(),a(),Qr=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=>ue(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 ei(e){return`${e.name}@${e.version||``}:${e.schemaUrl||``}`}var ti=e((()=>{})),ni,ri=e((()=>{ni=`otel.sdk.log.created`})),ii,ai=e((()=>{ri(),a(),ii=class{constructor(e){o(this,`createdLogs`,void 0),this.createdLogs=e.createCounter(ni,{unit:`{log_record}`,description:`The number of logs submitted to enabled SDK Loggers.`})}emitLog(){this.createdLogs.add(1)}}})),oi,si=e((()=>{oi=`0.215.0`})),ci,li,ui,di=e((()=>{f(),D(),Zr(),$r(),ti(),ai(),si(),a(),ci={disabled:!1,minimumSeverity:b.UNSPECIFIED,traceBased:!1},li=()=>({...ci}),ui=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 Qr(this.registeredLogRecordProcessors,this.forceFlushTimeoutMillis)):this.activeProcessor=new Xr,this._loggerConfigurator=i??li;let c=a?a.getMeter(`@opentelemetry/sdk-logs`,oi):s();this.loggerMetrics=new ii(c)}getLoggerConfig(e){let t=ei(e),n=this._loggerConfigs.get(t);return n||(n=this._loggerConfigurator(e),this._loggerConfigs.set(t,n),n)}}})),fi,pi=e((()=>{f(),D(),me(),_(),Yr(),di(),a(),fi=class{constructor(e={}){o(this,`_shutdownOnce`,void 0),o(this,`_sharedState`,void 0);let t={resource:e.resource??pe(),forceFlushTimeoutMillis:e.forceFlushTimeoutMillis??3e4,logRecordLimits:{attributeCountLimit:e.logRecordLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.logRecordLimits?.attributeValueLengthLimit??1/0},loggerConfigurator:e.loggerConfigurator??li,processors:e.processors??[],meterProvider:e.meterProvider};this._sharedState=new ui(t.resource,t.forceFlushTimeoutMillis,t.logRecordLimits,t.processors,t.loggerConfigurator,t.meterProvider),this._shutdownOnce=new ce(this._shutdown,this)}getLogger(e,t,n){if(this._shutdownOnce.isCalled)return p.warn(`A shutdown LoggerProvider cannot provide a Logger`),S;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 Jr({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()}}})),mi,hi=e((()=>{_(),mi=class{export(e,t){this._sendLogRecords(e,t)}async forceFlush(){}async shutdown(){}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,timestamp:de(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:se.SUCCESS})}}}));async function gi(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 _i,vi,yi=e((()=>{f(),_(),a(),_i=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 gi(t),await d.with(te(d.active()),async()=>this._exportWithTimeout(e,t,n))}catch(e){g(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===se.SUCCESS?r():i(e.error??Error(`BatchLogRecordProcessor: log record export failed`))}),this._exportScheduledResolve()})}},vi=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 ce(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 _i(this._exporter,t,this._exportTimeoutMillis);this._currentExport=n;try{await n.exportScheduled,await this._exporter.forceFlush(),await n.exportCompleted}catch(e){g(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 _i(this._exporter,e,this._exportTimeoutMillis);this._currentExport=t,t.exportCompleted.then(()=>{this._currentExport=null,this._maybeStartTimer()}).catch(e=>{this._currentExport=null,g(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)}}})),bi,xi=e((()=>{yi(),bi=class extends vi{onShutdown(){}}})),Si=e((()=>{xi()})),Ci=e((()=>{Si()})),wi=e((()=>{pi(),hi(),Ci(),D()}));export{Lt as $,On as A,pn as B,qn as C,Tn as D,jn as E,Cn as F,I as G,cn as H,z as I,Mt as J,tn as K,gn as L,An as M,kn as N,En as O,B as P,It as Q,L as R,er as S,Fn as T,an as U,hn as V,nn as W,Ft as X,Nt as Y,Bt as Z,fr as _,hi as a,Tt as at,rr as b,Hr as c,Dt as ct,Pr as d,gt as dt,$t as et,Fr as f,vt as ft,vr as g,pr as h,mi as i,Vt as it,Pn as j,Dn as k,Rr as l,St as lt,xr as m,ut as mt,bi as n,jt as nt,fi as o,j as ot,br as p,D as pt,en as q,xi as r,Ot as rt,pi as s,wt as st,wi as t,kt as tt,Lr as u,A as ut,cr as v,H as w,ir as x,sr as y,_n as z};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{w as t,x as n}from"./debug-D58GQBDG.js";import{execSync as r}from"child_process";function i(e,n){return t`execSync: ${e.slice(0,100)}`,r(e,n)}var a=e((()=>{n()}));export{a as n,i as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ed as t,Gs as n,Od as r,St as i,Ws as a,bT as o,xT as s,yt as c}from"./loadAgentsDir-C96o6gCj.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{n as u,t as d}from"./ExitFlow-DhRv5JPj.js";import{spawnSync as f}from"child_process";function p(){return s(g)??`Goodbye!`}async function m(e){if(n())return e(),f(`tmux`,[`detach-client`],{stdio:`ignore`}),null;let r=c()!==null;return r?(0,h.jsx)(d,{showWorktree:r,onDone:e,onCancel:()=>e()}):(e(p()),await t(0,`prompt_input_exit`),null)}var h,g;e((()=>{o(),u(),a(),r(),i(),h=l(),g=[`Goodbye!`,`See ya!`,`Bye!`,`Catch you later!`]}))();export{m as call};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Du as n,Eh as r,Eu as i,Th as a,np as o,rp as s,zS as c}from"./loadAgentsDir-C96o6gCj.js";import{D as l,Gt as u,I as d,P as f,T as p,ai as m,t as h,x as g}from"./src-DL3w8VPk.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{Bn as v,J as y,Pt as b,X as x,Y as S,Z as C,_ as w,x as T,z as E,zn as D,zt as O}from"./model-BaMclMXn.js";import{n as k,t as A}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";import{n as j,r as M,t as N}from"./modelOptions-Cw1ThINb.js";import{n as P,t as F}from"./fetchModelList-fQDsmR3E.js";function I({initial:e,sessionModel:t,onSelect:i,onCancel:a,isStandaloneCommand:s,showFastModeNotice:c,headerText:m}){let h=k(),_=e===null?z:e,[v,y]=(0,L.useState)(_),b=r(e=>C()?e.fastMode:!1),[w,O]=(0,L.useState)(()=>new Set(D(_)?[_.replace(/\[1m\]/i,``)]:[])),A=(0,L.useCallback)(()=>{if(!v||v===z)return;let e=v.replace(/\[1m\]/i,``);O(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[v]),M=(0,L.useMemo)(()=>j(b??!1),[b]),[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?N(P,b??!1):null,[P,b]),U=P===null&&!B,W=(0,L.useMemo)(()=>{let t=H??M;return e!==null&&!t.some(t=>t.value===e)?[...t,{value:e,label:T(e),description:`Current model`}]:t},[H,M,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===_)?_:G[0]?.value??void 0,[G,_]),q=Math.min(10,G.length),J=Math.max(0,G.length-q),Y=G.find(e=>e.value===v)?.label,X=v!==void 0&&v!==z&&w.has(v.replace(/\[1m\]/i,``)),Z=(0,L.useCallback)(e=>{y(e)},[]);u({"modelPicker:toggle1M":()=>A()},{context:`ModelPicker`});function Q(e){if(e===z){i(null);return}let t=e.replace(/\[1m\]/i,``);i(w.has(t)?`${t}[1m]`:t)}let $=(0,R.jsxs)(d,{flexDirection:`column`,children:[(0,R.jsxs)(d,{flexDirection:`column`,children:[(0,R.jsxs)(d,{marginBottom:1,flexDirection:`column`,children:[(0,R.jsx)(f,{color:`remember`,bold:!0,children:`Select model`}),(0,R.jsx)(f,{dimColor:!0,children:m??`Choose a model for this and future sessions. Use Space to toggle 1M context.`}),t&&(0,R.jsxs)(f,{dimColor:!0,children:[`Currently using `,T(t),` for this session (set by plan mode). Selecting a model will undo this.`]})]}),(0,R.jsxs)(d,{flexDirection:`column`,marginBottom:1,children:[(0,R.jsx)(d,{flexDirection:`column`,children:(0,R.jsx)(n,{defaultValue:_,defaultFocusValue:K,options:G,onChange:Q,onFocus:Z,onCancel:a??(()=>{}),visibleOptionCount:q})}),J>0&&(0,R.jsx)(d,{paddingLeft:3,children:(0,R.jsxs)(f,{dimColor:!0,children:[`and `,J,` more…`]})}),U&&(0,R.jsx)(d,{paddingLeft:3,children:(0,R.jsx)(f,{dimColor:!0,children:`正在从 API 拉取可用模型列表…`})}),B&&P===null&&(0,R.jsx)(d,{paddingLeft:3,children:(0,R.jsx)(f,{dimColor:!0,children:`API 拉取失败,使用内置列表`})})]}),(0,R.jsx)(d,{marginBottom:1,flexDirection:`column`,children:X?(0,R.jsxs)(f,{dimColor:!0,children:[`1M context on`,(0,R.jsx)(f,{color:`subtle`,children:` · Space to toggle`})]}):(0,R.jsxs)(f,{color:`subtle`,children:[`1M context off`,Y?` for ${Y}`:``,(0,R.jsx)(f,{color:`subtle`,children:` · Space to toggle`})]})}),C()?c?(0,R.jsx)(d,{marginBottom:1,children:(0,R.jsxs)(f,{dimColor:!0,children:[`Fast mode is `,(0,R.jsx)(f,{bold:!0,children:`ON`}),` and available with `,E,` only (/fast). Switching to other models turn off fast mode.`]})}):S()&&!x()?(0,R.jsx)(d,{marginBottom:1,children:(0,R.jsxs)(f,{dimColor:!0,children:[`Use `,(0,R.jsx)(f,{bold:!0,children:`/fast`}),` to turn on Fast mode (`,E,` only).`]})}):null:null]}),s&&(0,R.jsx)(f,{dimColor:!0,italic:!0,children:h.pending?(0,R.jsxs)(R.Fragment,{children:[`Press `,h.keyName,` again to exit`]}):(0,R.jsxs)(p,{children:[(0,R.jsx)(l,{shortcut:`Enter`,action:`confirm`}),(0,R.jsx)(o,{action:`select:cancel`,context:`Select`,fallback:`Esc`,description:`exit`})]})})]});return s?(0,R.jsx)(g,{color:`permission`,children:$}):$}var L,R,z,B=e((()=>{L=t(m(),1),v(),A(),y(),h(),c(),a(),w(),M(),P(),s(),i(),R=_(),z=`__NO_PREFERENCE__`}));function V(e,t,n){if(!O())return!1;if(t)return!0;if(e===null||!D(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((()=>{b(),v()}));export{B as i,V as n,I as r,H as t};
@@ -1 +0,0 @@
1
- import{ac as e,ic as t,oc as n,rc as r}from"./loadAgentsDir-C96o6gCj.js";n();export{r as drainPendingExtraction,t as executeExtractMemories,e as initExtractMemories};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./fast-Qo4WVqiW.js";t();export{n as FastModePicker,e as call};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Eh as n,Oh as r,Th as i,zS as a}from"./loadAgentsDir-C96o6gCj.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{Ut as _,b as v,h as y}from"./settings-BowI3jp-.js";import{c as b,h as x}from"./config-DUTgj3js.js";import{n as S,r as C}from"./analytics-DJobLaWP.js";import{l as w,v as T}from"./startupProfiler-B90b5vuq.js";import{B as E,H as D,I as O,J as k,L as A,Q as j,R as M,V as N,W as P,Z as F,rt as I,z as L}from"./model-BaMclMXn.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=!j(e.mainLoopModel);return{...e,...t?{mainLoopModel:N(),mainLoopModelForSession:null}:{},fastMode:!0}}:e=>({...e,fastMode:!1}))}function G({onDone:e,unavailableReason:t}){let i=n(e=>e.mainLoopModel),a=n(e=>e.fastMode),u=r(),[d,f]=(0,J.useState)(a??!1),p=D(),m=p.status===`cooldown`,g=t!==null,_=O(A(!0));function v(){g||(W(d,u),C(`tengu_fast_mode_toggled`,{enabled:d,source:`picker`}),d?e(`${V(d)} Fast mode ON${j(i)?``:` · model set to ${L}`} · ${_}`):(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 ${L}. 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 `,w(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=P();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${j(i)?``:` · model set to ${L}`} · ${O(A(!0))}`:`Fast mode OFF`}async function q(e,t,n){if(!F())return null;await I();let r=n?.trim().toLowerCase();if(r===`on`||r===`off`)return e(await K(r===`on`,t.getAppState,t.setAppState)),null;let i=P();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(),i(),k(),T(),M(),y(),Y=g()}));export{U as a,V as i,q as n,X as r,G as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n}from"./debug-D58GQBDG.js";import{r,t as i}from"./memoize-CumjjK2Q.js";import{s as a,u as o}from"./oauth-D38aRTUb.js";import{$r as s,Gn as c,Kn as l,Kr as u,Pt as d,Ur as f,ti as p,zt as m}from"./model-BaMclMXn.js";import{n as h,r as g}from"./client-C_jBL1yC.js";async function _(){let e=s();try{switch(e){case`firstParty`:{let e=await c({maxRetries:1}),t=m()?[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-Dd7CKMRX.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(n){return t(`[fetchModelList] ${e} failed: ${n instanceof Error?n.message:`unknown`}`),null}return null}var v,y,b=e((()=>{o(),l(),g(),d(),n(),i(),u(),p(),v=300*1e3,y=r(_,v)}));export{b as n,y as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./fetchModelList-fQDsmR3E.js";e();export{t as fetchAvailableModels};
@@ -1,3 +0,0 @@
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-C96o6gCj.js";import{cr as d,lr as f}from"./state-D5D6QpTX.js";import{n as p,t as m}from"./cwd-Nh5IZNKO.js";import{P as h,R as g,c as _,f as v,i as ee,u as y}from"./debug-D58GQBDG.js";import{ar as b,h as x,sr as te,t as ne}from"./settings-BowI3jp-.js";import{c as re,h as ie}from"./config-DUTgj3js.js";import{m as ae,p as oe,r as S}from"./git-Wid-XppW.js";import{i as se,n as ce}from"./execFileNoThrow-B_KRY4cT.js";import{o as le,s as C}from"./log-CZ7ploQm.js";import{n as ue,r as w}from"./analytics-DJobLaWP.js";import{a as de,s as fe}from"./ripgrep-Dt4a91S5.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,A,j,M,N,P,F,xe=e((()=>{n(),ye=16,be=8,D=6,O=4,k=8,A=3,j=1,M=100,N=64,P=new Int32Array(N),F=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,M)}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,N),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++){P[0]=g[e];let n=0,o=0,u=P[0],d=!0;for(let e=1;e<i;e++){let t=r.indexOf(a[e],u+1);if(t===-1){d=!1;break}P[e]=t;let i=t-u-1;i===0?o+=O:n+=A+i*j,u=t}if(!d||c.length===t&&s+o-n+y<=l)continue;let f=i*ye+o-n;f+=me(v,P[0],!0);for(let e=1;e<i;e++)f+=me(v,P[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 I(){return z||(z=new F),z}function Se(){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 Ce(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 we(){let e=S(m());if(!e)return null;try{return pe(T.join(e,`.git`,`index`)).mtimeMs}catch{return null}}function Te(e,t,n){return n===t?e:e.map(e=>{let r=T.join(t,e);return T.relative(n,r)})}async function Ee(e){if(e.length===0||!z||W.length===0)return;let t=await ke(e),n=[...W,...G,...K,...e,...t],r=Ce(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 De(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 Oe(e,t){let n=Date.now();_(`[FileIndex] getFilesUsingGit called`);let r=m(),i=S(r);if(!i)return _(`[FileIndex] not a git repo, returning null`),null;try{let a=Date.now(),o=await ce(oe(),[`-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=Te(o.stdout.trim().split(`
2
- `).filter(Boolean),i,r),c=await De(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=ce(oe(),e,{timeout:1e4,cwd:i}).then(async e=>{if(n===H&&e.code===0){let t=Te(e.stdout.trim().split(`
3
- `).filter(Boolean),i,r),n=await De(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`),Ee(t)}}).catch(e=>{_(`[FileIndex] background untracked fetch failed: ${e}`)}).finally(()=>{U=null})}return s}catch(e){return _(`[FileIndex] git ls-files error: ${h(e)}`),null}}async function ke(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 Oe(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=I();try{let n=ne(),r=re(),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 ke(c);K=l;let u=[...l,...c],d=Ce(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=we();if(z&&!(e!==null&&e!==X)&&Date.now()-Y<He)return;let t=H,n=Date.now();I(),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: ${h(e)}`),C(e),t===H&&(B=null),I()))}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(ne().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=b(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(),xe(),ue(),ie(),p(),ee(),g(),se(),v(),ae(),l(),le(),te(),de(),x(),f(),z=null,B=null,V=d(),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,Se as n,Ve as o,Fe as r,R as s,ze as t};
@@ -1,3 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{i as r,l as i,o as a}from"./envUtils-DcaKZlRU.js";import{n as o,t as s}from"./defineProperty-C-QyHrDq.js";import{C as c,v as l,w as u}from"./esm-BbMeEYcz.js";import{Z as d,_ as f,c as ee,et as p,it as te,n as ne,o as re,t as ie,v as ae,w as m}from"./esm-BCUC71kt.js";import{n as h,t as oe}from"./axios-DaWTGg7G.js";import{R as se,Ut as g,ft as _}from"./state-D5D6QpTX.js";import{n as ce,t as le}from"./cwd-Nh5IZNKO.js";import{C as v,P as ue,R as de,U as fe,V as pe,x as me}from"./debug-D58GQBDG.js";import{Jt as he,Kt as ge}from"./settings-BowI3jp-.js";import{c as _e,d as y,h as b,n as ve}from"./config-DUTgj3js.js";import{a as ye,s as be}from"./execFileNoThrow-B_KRY4cT.js";import{d as xe,o as Se,p as x,s as S}from"./log-CZ7ploQm.js";import{a as Ce,i as we,o as Te}from"./platform-DMQxcm4K.js";import{l as Ee,s as De}from"./types-APu4OCXJ.js";import{i as Oe,n as ke}from"./analytics-DJobLaWP.js";import{n as Ae,r as C}from"./startupProfiler-B90b5vuq.js";import{Dt as je,Nt as Me,Or as Ne,Pt as w,St as Pe,Tt as T,Xn as Fe,dn as Ie,fn as Le,kr as Re,kt as ze,qn as Be,zt as Ve}from"./model-BaMclMXn.js";import{n as He,t as Ue}from"./userAgent-NbKd-hN7.js";import*as E from"path";import{randomUUID as D}from"crypto";import{appendFile as We,mkdir as O,readdir as Ge,unlink as k,writeFile as Ke}from"fs/promises";function A(){return i(process.env.CLAUDE_CODE_USE_BEDROCK)||i(process.env.CLAUDE_CODE_USE_VERTEX)||i(process.env.CLAUDE_CODE_USE_FOUNDRY)||x()}function qe(){return x()}var j=e((()=>{a(),xe()}));async function Je(){M===null&&!N&&(N=Ze(),M=await N,N=null,P.cache.clear?.())}function Ye(){M=null,N=null,P.cache.clear?.(),F.cache.clear?.()}function Xe(){if(M!==null)return M;let e=T();if(e?.emailAddress)return e.emailAddress}async function Ze(){let e=T();if(e?.emailAddress)return e.emailAddress}var M,N,P,F,I=e((()=>{be(),n(),g(),w(),b(),ce(),he(),a(),M=null,N=null,P=t(e=>{let t=y(),n=_e(),r,a,o;if(e&&(r=ze()??void 0,a=je()??void 0,r&&n.claudeCodeFirstTokenDate)){let e=new Date(n.claudeCodeFirstTokenDate).getTime();isNaN(e)||(o=e)}let s=T(),c=s?.organizationUuid,l=s?.accountUuid;return{deviceId:t,sessionId:_(),email:Xe(),appVersion:`0.0.21`,platform:ge(),organizationUuid:c,accountUuid:l,userType:process.env.USER_TYPE,subscriptionType:r,rateLimitTier:a,firstTokenTime:o,...i(process.env.GITHUB_ACTIONS)&&{githubActionsMetadata:{actor:process.env.GITHUB_ACTOR,actorId:process.env.GITHUB_ACTOR_ID,repository:process.env.GITHUB_REPOSITORY,repositoryId:process.env.GITHUB_REPOSITORY_ID,repositoryOwner:process.env.GITHUB_REPOSITORY_OWNER,repositoryOwnerId:process.env.GITHUB_REPOSITORY_OWNER_ID}}}}),F=t(async()=>{let e=await ye(`git config --get user.email`,{shell:!0,reject:!1,cwd:le()});return e.exitCode===0&&e.stdout?e.stdout.trim():void 0})}));function Qe(){return{seconds:0,nanos:0}}function L(e){return e!=null}var R,$e=e((()=>{R={fromJSON(e){return{seconds:L(e.seconds)?globalThis.Number(e.seconds):0,nanos:L(e.nanos)?globalThis.Number(e.nanos):0}},toJSON(e){let t={};return e.seconds!==void 0&&(t.seconds=Math.round(e.seconds)),e.nanos!==void 0&&(t.nanos=Math.round(e.nanos)),t},create(e){return R.fromPartial(e??{})},fromPartial(e){let t=Qe();return t.seconds=e.seconds??0,t.nanos=e.nanos??0,t}}}));function et(){return{account_id:0,organization_uuid:``,account_uuid:``}}function z(e){return e!=null}var B,tt=e((()=>{B={fromJSON(e){return{account_id:z(e.account_id)?globalThis.Number(e.account_id):0,organization_uuid:z(e.organization_uuid)?globalThis.String(e.organization_uuid):``,account_uuid:z(e.account_uuid)?globalThis.String(e.account_uuid):``}},toJSON(e){let t={};return e.account_id!==void 0&&(t.account_id=Math.round(e.account_id)),e.organization_uuid!==void 0&&(t.organization_uuid=e.organization_uuid),e.account_uuid!==void 0&&(t.account_uuid=e.account_uuid),t},create(e){return B.fromPartial(e??{})},fromPartial(e){let t=et();return t.account_id=e.account_id??0,t.organization_uuid=e.organization_uuid??``,t.account_uuid=e.account_uuid??``,t}}}));function nt(){return{actor_id:``,repository_id:``,repository_owner_id:``}}function rt(){return{platform:``,node_version:``,terminal:``,package_managers:``,runtimes:``,is_running_with_bun:!1,is_ci:!1,is_claubbit:!1,is_github_action:!1,is_claude_code_action:!1,is_claude_ai_auth:!1,version:``,github_event_name:``,github_actions_runner_environment:``,github_actions_runner_os:``,github_action_ref:``,wsl_version:``,github_actions_metadata:void 0,arch:``,is_claude_code_remote:!1,remote_environment_type:``,claude_code_container_id:``,claude_code_remote_session_id:``,tags:[],deployment_environment:``,is_conductor:!1,version_base:``,coworker_type:``,build_time:``,is_local_agent_mode:!1,linux_distro_id:``,linux_distro_version:``,linux_kernel:``,vcs:``,platform_raw:``}}function it(){return{slack_team_id:``,is_enterprise_install:!1,trigger:``,creation_method:``}}function at(){return{event_name:``,client_timestamp:void 0,model:``,session_id:``,user_type:``,betas:``,env:void 0,entrypoint:``,agent_sdk_version:``,is_interactive:!1,client_type:``,process:``,additional_metadata:``,auth:void 0,server_timestamp:void 0,event_id:``,device_id:``,swe_bench_run_id:``,swe_bench_instance_id:``,swe_bench_task_id:``,email:``,agent_id:``,parent_session_id:``,agent_type:``,slack:void 0,team_name:``,skill_name:``,plugin_name:``,marketplace_name:``}}function ot(e){let t=(e.seconds||0)*1e3;return t+=(e.nanos||0)/1e6,new globalThis.Date(t)}function V(e){return e instanceof globalThis.Date?e:typeof e==`string`?new globalThis.Date(e):ot(R.fromJSON(e))}function H(e){return e!=null}var U,W,G,K,st=e((()=>{$e(),tt(),U={fromJSON(e){return{actor_id:H(e.actor_id)?globalThis.String(e.actor_id):``,repository_id:H(e.repository_id)?globalThis.String(e.repository_id):``,repository_owner_id:H(e.repository_owner_id)?globalThis.String(e.repository_owner_id):``}},toJSON(e){let t={};return e.actor_id!==void 0&&(t.actor_id=e.actor_id),e.repository_id!==void 0&&(t.repository_id=e.repository_id),e.repository_owner_id!==void 0&&(t.repository_owner_id=e.repository_owner_id),t},create(e){return U.fromPartial(e??{})},fromPartial(e){let t=nt();return t.actor_id=e.actor_id??``,t.repository_id=e.repository_id??``,t.repository_owner_id=e.repository_owner_id??``,t}},W={fromJSON(e){return{platform:H(e.platform)?globalThis.String(e.platform):``,node_version:H(e.node_version)?globalThis.String(e.node_version):``,terminal:H(e.terminal)?globalThis.String(e.terminal):``,package_managers:H(e.package_managers)?globalThis.String(e.package_managers):``,runtimes:H(e.runtimes)?globalThis.String(e.runtimes):``,is_running_with_bun:H(e.is_running_with_bun)?globalThis.Boolean(e.is_running_with_bun):!1,is_ci:H(e.is_ci)?globalThis.Boolean(e.is_ci):!1,is_claubbit:H(e.is_claubbit)?globalThis.Boolean(e.is_claubbit):!1,is_github_action:H(e.is_github_action)?globalThis.Boolean(e.is_github_action):!1,is_claude_code_action:H(e.is_claude_code_action)?globalThis.Boolean(e.is_claude_code_action):!1,is_claude_ai_auth:H(e.is_claude_ai_auth)?globalThis.Boolean(e.is_claude_ai_auth):!1,version:H(e.version)?globalThis.String(e.version):``,github_event_name:H(e.github_event_name)?globalThis.String(e.github_event_name):``,github_actions_runner_environment:H(e.github_actions_runner_environment)?globalThis.String(e.github_actions_runner_environment):``,github_actions_runner_os:H(e.github_actions_runner_os)?globalThis.String(e.github_actions_runner_os):``,github_action_ref:H(e.github_action_ref)?globalThis.String(e.github_action_ref):``,wsl_version:H(e.wsl_version)?globalThis.String(e.wsl_version):``,github_actions_metadata:H(e.github_actions_metadata)?U.fromJSON(e.github_actions_metadata):void 0,arch:H(e.arch)?globalThis.String(e.arch):``,is_claude_code_remote:H(e.is_claude_code_remote)?globalThis.Boolean(e.is_claude_code_remote):!1,remote_environment_type:H(e.remote_environment_type)?globalThis.String(e.remote_environment_type):``,claude_code_container_id:H(e.claude_code_container_id)?globalThis.String(e.claude_code_container_id):``,claude_code_remote_session_id:H(e.claude_code_remote_session_id)?globalThis.String(e.claude_code_remote_session_id):``,tags:globalThis.Array.isArray(e?.tags)?e.tags.map(e=>globalThis.String(e)):[],deployment_environment:H(e.deployment_environment)?globalThis.String(e.deployment_environment):``,is_conductor:H(e.is_conductor)?globalThis.Boolean(e.is_conductor):!1,version_base:H(e.version_base)?globalThis.String(e.version_base):``,coworker_type:H(e.coworker_type)?globalThis.String(e.coworker_type):``,build_time:H(e.build_time)?globalThis.String(e.build_time):``,is_local_agent_mode:H(e.is_local_agent_mode)?globalThis.Boolean(e.is_local_agent_mode):!1,linux_distro_id:H(e.linux_distro_id)?globalThis.String(e.linux_distro_id):``,linux_distro_version:H(e.linux_distro_version)?globalThis.String(e.linux_distro_version):``,linux_kernel:H(e.linux_kernel)?globalThis.String(e.linux_kernel):``,vcs:H(e.vcs)?globalThis.String(e.vcs):``,platform_raw:H(e.platform_raw)?globalThis.String(e.platform_raw):``}},toJSON(e){let t={};return e.platform!==void 0&&(t.platform=e.platform),e.node_version!==void 0&&(t.node_version=e.node_version),e.terminal!==void 0&&(t.terminal=e.terminal),e.package_managers!==void 0&&(t.package_managers=e.package_managers),e.runtimes!==void 0&&(t.runtimes=e.runtimes),e.is_running_with_bun!==void 0&&(t.is_running_with_bun=e.is_running_with_bun),e.is_ci!==void 0&&(t.is_ci=e.is_ci),e.is_claubbit!==void 0&&(t.is_claubbit=e.is_claubbit),e.is_github_action!==void 0&&(t.is_github_action=e.is_github_action),e.is_claude_code_action!==void 0&&(t.is_claude_code_action=e.is_claude_code_action),e.is_claude_ai_auth!==void 0&&(t.is_claude_ai_auth=e.is_claude_ai_auth),e.version!==void 0&&(t.version=e.version),e.github_event_name!==void 0&&(t.github_event_name=e.github_event_name),e.github_actions_runner_environment!==void 0&&(t.github_actions_runner_environment=e.github_actions_runner_environment),e.github_actions_runner_os!==void 0&&(t.github_actions_runner_os=e.github_actions_runner_os),e.github_action_ref!==void 0&&(t.github_action_ref=e.github_action_ref),e.wsl_version!==void 0&&(t.wsl_version=e.wsl_version),e.github_actions_metadata!==void 0&&(t.github_actions_metadata=U.toJSON(e.github_actions_metadata)),e.arch!==void 0&&(t.arch=e.arch),e.is_claude_code_remote!==void 0&&(t.is_claude_code_remote=e.is_claude_code_remote),e.remote_environment_type!==void 0&&(t.remote_environment_type=e.remote_environment_type),e.claude_code_container_id!==void 0&&(t.claude_code_container_id=e.claude_code_container_id),e.claude_code_remote_session_id!==void 0&&(t.claude_code_remote_session_id=e.claude_code_remote_session_id),e.tags?.length&&(t.tags=e.tags),e.deployment_environment!==void 0&&(t.deployment_environment=e.deployment_environment),e.is_conductor!==void 0&&(t.is_conductor=e.is_conductor),e.version_base!==void 0&&(t.version_base=e.version_base),e.coworker_type!==void 0&&(t.coworker_type=e.coworker_type),e.build_time!==void 0&&(t.build_time=e.build_time),e.is_local_agent_mode!==void 0&&(t.is_local_agent_mode=e.is_local_agent_mode),e.linux_distro_id!==void 0&&(t.linux_distro_id=e.linux_distro_id),e.linux_distro_version!==void 0&&(t.linux_distro_version=e.linux_distro_version),e.linux_kernel!==void 0&&(t.linux_kernel=e.linux_kernel),e.vcs!==void 0&&(t.vcs=e.vcs),e.platform_raw!==void 0&&(t.platform_raw=e.platform_raw),t},create(e){return W.fromPartial(e??{})},fromPartial(e){let t=rt();return t.platform=e.platform??``,t.node_version=e.node_version??``,t.terminal=e.terminal??``,t.package_managers=e.package_managers??``,t.runtimes=e.runtimes??``,t.is_running_with_bun=e.is_running_with_bun??!1,t.is_ci=e.is_ci??!1,t.is_claubbit=e.is_claubbit??!1,t.is_github_action=e.is_github_action??!1,t.is_claude_code_action=e.is_claude_code_action??!1,t.is_claude_ai_auth=e.is_claude_ai_auth??!1,t.version=e.version??``,t.github_event_name=e.github_event_name??``,t.github_actions_runner_environment=e.github_actions_runner_environment??``,t.github_actions_runner_os=e.github_actions_runner_os??``,t.github_action_ref=e.github_action_ref??``,t.wsl_version=e.wsl_version??``,t.github_actions_metadata=e.github_actions_metadata!==void 0&&e.github_actions_metadata!==null?U.fromPartial(e.github_actions_metadata):void 0,t.arch=e.arch??``,t.is_claude_code_remote=e.is_claude_code_remote??!1,t.remote_environment_type=e.remote_environment_type??``,t.claude_code_container_id=e.claude_code_container_id??``,t.claude_code_remote_session_id=e.claude_code_remote_session_id??``,t.tags=e.tags?.map(e=>e)||[],t.deployment_environment=e.deployment_environment??``,t.is_conductor=e.is_conductor??!1,t.version_base=e.version_base??``,t.coworker_type=e.coworker_type??``,t.build_time=e.build_time??``,t.is_local_agent_mode=e.is_local_agent_mode??!1,t.linux_distro_id=e.linux_distro_id??``,t.linux_distro_version=e.linux_distro_version??``,t.linux_kernel=e.linux_kernel??``,t.vcs=e.vcs??``,t.platform_raw=e.platform_raw??``,t}},G={fromJSON(e){return{slack_team_id:H(e.slack_team_id)?globalThis.String(e.slack_team_id):``,is_enterprise_install:H(e.is_enterprise_install)?globalThis.Boolean(e.is_enterprise_install):!1,trigger:H(e.trigger)?globalThis.String(e.trigger):``,creation_method:H(e.creation_method)?globalThis.String(e.creation_method):``}},toJSON(e){let t={};return e.slack_team_id!==void 0&&(t.slack_team_id=e.slack_team_id),e.is_enterprise_install!==void 0&&(t.is_enterprise_install=e.is_enterprise_install),e.trigger!==void 0&&(t.trigger=e.trigger),e.creation_method!==void 0&&(t.creation_method=e.creation_method),t},create(e){return G.fromPartial(e??{})},fromPartial(e){let t=it();return t.slack_team_id=e.slack_team_id??``,t.is_enterprise_install=e.is_enterprise_install??!1,t.trigger=e.trigger??``,t.creation_method=e.creation_method??``,t}},K={fromJSON(e){return{event_name:H(e.event_name)?globalThis.String(e.event_name):``,client_timestamp:H(e.client_timestamp)?V(e.client_timestamp):void 0,model:H(e.model)?globalThis.String(e.model):``,session_id:H(e.session_id)?globalThis.String(e.session_id):``,user_type:H(e.user_type)?globalThis.String(e.user_type):``,betas:H(e.betas)?globalThis.String(e.betas):``,env:H(e.env)?W.fromJSON(e.env):void 0,entrypoint:H(e.entrypoint)?globalThis.String(e.entrypoint):``,agent_sdk_version:H(e.agent_sdk_version)?globalThis.String(e.agent_sdk_version):``,is_interactive:H(e.is_interactive)?globalThis.Boolean(e.is_interactive):!1,client_type:H(e.client_type)?globalThis.String(e.client_type):``,process:H(e.process)?globalThis.String(e.process):``,additional_metadata:H(e.additional_metadata)?globalThis.String(e.additional_metadata):``,auth:H(e.auth)?B.fromJSON(e.auth):void 0,server_timestamp:H(e.server_timestamp)?V(e.server_timestamp):void 0,event_id:H(e.event_id)?globalThis.String(e.event_id):``,device_id:H(e.device_id)?globalThis.String(e.device_id):``,swe_bench_run_id:H(e.swe_bench_run_id)?globalThis.String(e.swe_bench_run_id):``,swe_bench_instance_id:H(e.swe_bench_instance_id)?globalThis.String(e.swe_bench_instance_id):``,swe_bench_task_id:H(e.swe_bench_task_id)?globalThis.String(e.swe_bench_task_id):``,email:H(e.email)?globalThis.String(e.email):``,agent_id:H(e.agent_id)?globalThis.String(e.agent_id):``,parent_session_id:H(e.parent_session_id)?globalThis.String(e.parent_session_id):``,agent_type:H(e.agent_type)?globalThis.String(e.agent_type):``,slack:H(e.slack)?G.fromJSON(e.slack):void 0,team_name:H(e.team_name)?globalThis.String(e.team_name):``,skill_name:H(e.skill_name)?globalThis.String(e.skill_name):``,plugin_name:H(e.plugin_name)?globalThis.String(e.plugin_name):``,marketplace_name:H(e.marketplace_name)?globalThis.String(e.marketplace_name):``}},toJSON(e){let t={};return e.event_name!==void 0&&(t.event_name=e.event_name),e.client_timestamp!==void 0&&(t.client_timestamp=e.client_timestamp.toISOString()),e.model!==void 0&&(t.model=e.model),e.session_id!==void 0&&(t.session_id=e.session_id),e.user_type!==void 0&&(t.user_type=e.user_type),e.betas!==void 0&&(t.betas=e.betas),e.env!==void 0&&(t.env=W.toJSON(e.env)),e.entrypoint!==void 0&&(t.entrypoint=e.entrypoint),e.agent_sdk_version!==void 0&&(t.agent_sdk_version=e.agent_sdk_version),e.is_interactive!==void 0&&(t.is_interactive=e.is_interactive),e.client_type!==void 0&&(t.client_type=e.client_type),e.process!==void 0&&(t.process=e.process),e.additional_metadata!==void 0&&(t.additional_metadata=e.additional_metadata),e.auth!==void 0&&(t.auth=B.toJSON(e.auth)),e.server_timestamp!==void 0&&(t.server_timestamp=e.server_timestamp.toISOString()),e.event_id!==void 0&&(t.event_id=e.event_id),e.device_id!==void 0&&(t.device_id=e.device_id),e.swe_bench_run_id!==void 0&&(t.swe_bench_run_id=e.swe_bench_run_id),e.swe_bench_instance_id!==void 0&&(t.swe_bench_instance_id=e.swe_bench_instance_id),e.swe_bench_task_id!==void 0&&(t.swe_bench_task_id=e.swe_bench_task_id),e.email!==void 0&&(t.email=e.email),e.agent_id!==void 0&&(t.agent_id=e.agent_id),e.parent_session_id!==void 0&&(t.parent_session_id=e.parent_session_id),e.agent_type!==void 0&&(t.agent_type=e.agent_type),e.slack!==void 0&&(t.slack=G.toJSON(e.slack)),e.team_name!==void 0&&(t.team_name=e.team_name),e.skill_name!==void 0&&(t.skill_name=e.skill_name),e.plugin_name!==void 0&&(t.plugin_name=e.plugin_name),e.marketplace_name!==void 0&&(t.marketplace_name=e.marketplace_name),t},create(e){return K.fromPartial(e??{})},fromPartial(e){let t=at();return t.event_name=e.event_name??``,t.client_timestamp=e.client_timestamp??void 0,t.model=e.model??``,t.session_id=e.session_id??``,t.user_type=e.user_type??``,t.betas=e.betas??``,t.env=e.env!==void 0&&e.env!==null?W.fromPartial(e.env):void 0,t.entrypoint=e.entrypoint??``,t.agent_sdk_version=e.agent_sdk_version??``,t.is_interactive=e.is_interactive??!1,t.client_type=e.client_type??``,t.process=e.process??``,t.additional_metadata=e.additional_metadata??``,t.auth=e.auth!==void 0&&e.auth!==null?B.fromPartial(e.auth):void 0,t.server_timestamp=e.server_timestamp??void 0,t.event_id=e.event_id??``,t.device_id=e.device_id??``,t.swe_bench_run_id=e.swe_bench_run_id??``,t.swe_bench_instance_id=e.swe_bench_instance_id??``,t.swe_bench_task_id=e.swe_bench_task_id??``,t.email=e.email??``,t.agent_id=e.agent_id??``,t.parent_session_id=e.parent_session_id??``,t.agent_type=e.agent_type??``,t.slack=e.slack!==void 0&&e.slack!==null?G.fromPartial(e.slack):void 0,t.team_name=e.team_name??``,t.skill_name=e.skill_name??``,t.plugin_name=e.plugin_name??``,t.marketplace_name=e.marketplace_name??``,t}}}));function q(){return E.join(r(),`telemetry`)}function ct(e){if(!h.isAxiosError(e))return ue(e);let t=[],n=e.response?.headers?.[`request-id`];return n&&t.push(`request-id=${n}`),e.response?.status&&t.push(`status=${e.response.status}`),e.code&&t.push(`code=${e.code}`),e.message&&t.push(e.message),t.join(`, `)}var J,Y,lt,ut=e((()=>{ae(),oe(),g(),st(),w(),b(),a(),de(),Fe(),De(),Se(),Ie(),me(),He(),Ne(),ke(),p(),o(),J=D(),Y=`1p_failed_events.`,lt=class{constructor(e={}){s(this,`endpoint`,void 0),s(this,`timeout`,void 0),s(this,`maxBatchSize`,void 0),s(this,`skipAuth`,void 0),s(this,`batchDelayMs`,void 0),s(this,`baseBackoffDelayMs`,void 0),s(this,`maxBackoffDelayMs`,void 0),s(this,`maxAttempts`,void 0),s(this,`isKilled`,void 0),s(this,`pendingExports`,[]),s(this,`isShutdown`,!1),s(this,`schedule`,void 0),s(this,`cancelBackoff`,null),s(this,`attempts`,0),s(this,`isRetrying`,!1),s(this,`lastExportErrorContext`,void 0);let t=e.baseUrl||(process.env.ANTHROPIC_BASE_URL===`https://api-staging.anthropic.com`?`https://api-staging.anthropic.com`:`https://api.anthropic.com`);this.endpoint=`${t}${e.path||`/api/event_logging/batch`}`,this.timeout=e.timeout||1e4,this.maxBatchSize=e.maxBatchSize||200,this.skipAuth=e.skipAuth??!1,this.batchDelayMs=e.batchDelayMs||100,this.baseBackoffDelayMs=e.baseBackoffDelayMs||500,this.maxBackoffDelayMs=e.maxBackoffDelayMs||3e4,this.maxAttempts=e.maxAttempts??8,this.isKilled=e.isKilled??(()=>!1),this.schedule=e.schedule??((e,t)=>{let n=setTimeout(e,t);return()=>clearTimeout(n)}),this.retryPreviousBatches()}async getQueuedEventCount(){return(await this.loadEventsFromCurrentBatch()).length}getCurrentBatchFilePath(){return E.join(q(),`${Y}${_()}.${J}.json`)}async loadEventsFromFile(e){try{return await Ee(e)}catch{return[]}}async loadEventsFromCurrentBatch(){return this.loadEventsFromFile(this.getCurrentBatchFilePath())}async saveEventsToFile(e,t){try{if(t.length===0)try{await k(e)}catch{}else await O(q(),{recursive:!0}),await Ke(e,`${t.map(e=>v(e)).join(`
2
- `)}\n`,`utf8`)}catch(e){S(e)}}async appendEventsToFile(e,t){if(t.length!==0)try{await O(q(),{recursive:!0}),await We(e,`${t.map(e=>v(e)).join(`
3
- `)}\n`,`utf8`)}catch(e){S(e)}}async deleteFile(e){try{await k(e)}catch{}}async retryPreviousBatches(){try{let e=`${Y}${_()}.`,t;try{t=(await Ge(q())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(J))}catch(e){if(pe(e))return;throw e}for(let e of t){let t=E.join(q(),e);this.retryFileInBackground(t)}}catch(e){S(e)}}async retryFileInBackground(e){if(this.attempts>=this.maxAttempts){await this.deleteFile(e);return}let t=await this.loadEventsFromFile(e);if(t.length===0){await this.deleteFile(e);return}let n=await this.sendEventsInBatches(t);n.length===0?await this.deleteFile(e):await this.saveEventsToFile(e,n)}async export(e,t){if(this.isShutdown){t({code:m.FAILED,error:Error(`Exporter has been shutdown`)});return}let n=this.doExport(e,t);this.pendingExports.push(n),n.finally(()=>{let e=this.pendingExports.indexOf(n);e>-1&&this.pendingExports.splice(e,1)})}async doExport(e,t){try{let n=e.filter(e=>e.instrumentationScope?.name===`com.anthropic.claude_code.events`);if(n.length===0){t({code:m.SUCCESS});return}let r=this.transformLogsToEvents(n).events;if(r.length===0){t({code:m.SUCCESS});return}if(this.attempts>=this.maxAttempts){t({code:m.FAILED,error:Error(`Dropped ${r.length} events: max attempts (${this.maxAttempts}) reached`)});return}let i=await this.sendEventsInBatches(r);if(this.attempts++,i.length>0){await this.queueFailedEvents(i),this.scheduleBackoffRetry();let e=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``;t({code:m.FAILED,error:Error(`Failed to export ${i.length} events${e}`)});return}this.resetBackoff(),await this.getQueuedEventCount()>0&&!this.isRetrying&&this.retryFailedEvents(),t({code:m.SUCCESS})}catch(e){S(e),t({code:m.FAILED,error:fe(e)})}}async sendEventsInBatches(e){let t=[];for(let n=0;n<e.length;n+=this.maxBatchSize)t.push(e.slice(n,n+this.maxBatchSize));let n=[],r;for(let e=0;e<t.length;e++){let i=t[e];try{await this.sendBatchWithRetry({events:i})}catch(i){r=ct(i);for(let r=e;r<t.length;r++)n.push(...t[r]);break}e<t.length-1&&this.batchDelayMs>0&&await Le(this.batchDelayMs)}return n.length>0&&r&&(this.lastExportErrorContext=r),n}async queueFailedEvents(e){let t=this.getCurrentBatchFilePath();await this.appendEventsToFile(t,e);let n=this.lastExportErrorContext?` (${this.lastExportErrorContext})`:``,r=`1P event logging: ${e.length} events failed to export${n}`;S(Error(r))}scheduleBackoffRetry(){if(this.cancelBackoff||this.isRetrying||this.isShutdown)return;let e=Math.min(this.baseBackoffDelayMs*this.attempts*this.attempts,this.maxBackoffDelayMs);this.cancelBackoff=this.schedule(async()=>{this.cancelBackoff=null,await this.retryFailedEvents()},e)}async retryFailedEvents(){let e=this.getCurrentBatchFilePath();for(;!this.isShutdown;){let t=await this.loadEventsFromFile(e);if(t.length===0)break;if(this.attempts>=this.maxAttempts){await this.deleteFile(e),this.resetBackoff();return}this.isRetrying=!0,await this.deleteFile(e);let n=await this.sendEventsInBatches(t);if(this.attempts++,this.isRetrying=!1,n.length>0){await this.saveEventsToFile(e,n),this.scheduleBackoffRetry();return}this.resetBackoff()}}resetBackoff(){this.attempts=0,this.cancelBackoff&&(this.cancelBackoff(),this.cancelBackoff=null)}async sendBatchWithRetry(e){if(this.isKilled())throw Error(`firstParty sink killswitch active`);let t={"Content-Type":`application/json`,"User-Agent":Ue(),"x-service-name":`workmate`},n=ve()||se(),r=this.skipAuth||!n;if(!r&&Ve()){let e=Pe();Me()?e&&Re(e.expiresAt)&&(r=!0):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:Be(),a=!i.error,o=a?{...t,...i.headers}:t;try{let t=await h.post(this.endpoint,e,{timeout:this.timeout,headers:o});this.logSuccess(e.events.length,a,t.data);return}catch(n){if(a&&h.isAxiosError(n)&&n.response?.status===401){let n=await h.post(this.endpoint,e,{timeout:this.timeout,headers:t});this.logSuccess(e.events.length,!1,n.data);return}throw n}}logSuccess(e,t,n){}hrTimeToDate(e){let[t,n]=e;return new Date(t*1e3+n/1e6)}transformLogsToEvents(e){let t=[];for(let n of e){let e=n.attributes||{},r=e.event_name||n.body||`unknown`,i=e.core_metadata,a=e.user_metadata,o=e.event_metadata||{};if(!i){t.push({event_type:`ClaudeCodeInternalEvent`,event_data:K.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),session_id:_(),additional_metadata:Buffer.from(v({transform_error:`core_metadata attribute is missing`})).toString(`base64`)})});continue}let s=te(i,a,o),{_PROTO_skill_name:c,_PROTO_plugin_name:l,_PROTO_marketplace_name:u,...d}=s.additional,f=Oe(d);t.push({event_type:`ClaudeCodeInternalEvent`,event_data:K.toJSON({event_id:e.event_id,event_name:r,client_timestamp:this.hrTimeToDate(n.hrTime),device_id:e.user_id,email:a?.email,auth:s.auth,...s.core,env:s.env,process:s.process,skill_name:typeof c==`string`?c:void 0,plugin_name:typeof l==`string`?l:void 0,marketplace_name:typeof u==`string`?u:void 0,additional_metadata:Object.keys(f).length>0?Buffer.from(v(f)).toString(`base64`):void 0})})}return{events:t}}async shutdown(){this.isShutdown=!0,this.resetBackoff(),await this.forceFlush()}async forceFlush(){await Promise.all(this.pendingExports)}}}));function dt(e){return!1}var ft=e((()=>{}));function pt(){return{}}function mt(e){let t=pt()[e];if(!t)return null;let n=t.sample_rate;return typeof n!=`number`||n<0||n>1||n>=1?null:n<=0?0:Math.random()<n?n:0}async function ht(){if($)try{await $.shutdown()}catch{}}function X(){return!A()}async function gt(e,t,n={}){try{let r=await d({model:n.model,betas:n.betas}),i={event_name:t,event_id:D(),core_metadata:r,user_metadata:P(!0),event_metadata:n},a=y();a&&(i.user_id=a),e.emit({body:t,attributes:i})}catch{}}function _t(e,t={}){X()&&(!Q||dt(`firstParty`)||gt(Q,e,t))}function vt(){if(C(`1p_event_logging_start`),!X())return;C(`1p_event_after_config`);let e=parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||yt.toString(),10),t=bt,n=Z,r=we(),i={[c]:`workmate`,[u]:`0.0.21`};if(r===`wsl`){let e=Ce();e&&(i[`wsl.version`]=e)}$=new re({resource:f(i),processors:[new ne(new lt({maxBatchSize:t,isKilled:()=>dt(`firstParty`)}),{scheduledDelayMillis:e,maxExportBatchSize:t,maxQueueSize:n})]}),Q=$.getLogger(`com.anthropic.claude_code.events`,`0.0.21`)}var yt,bt,Z,Q,$,xt=e((()=>{ee(),ie(),l(),b(),Te(),Ae(),I(),j(),ut(),p(),ft(),yt=1e4,bt=200,Z=8192,Q=null,$=null}));export{_t as a,F as c,Ye as d,j as f,X as i,Je as l,qe as m,xt as n,mt as o,A as p,vt as r,ht as s,pt as t,I as u};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./firstPartyEventLogger-B261Wksn.js";e();export{t as initialize1PEventLogging};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{D as n,E as r,N as i,_ as a,n as o,r as s,t as c}from"./lazySchema-DULtBUCI.js";import{P as l,R as u,c as d,i as f}from"./debug-D58GQBDG.js";import{C as p,vt as m,w as h,yt as g}from"./sessionState-8jutEorw.js";import"./bridgeMessaging-DSJlYarJ.js";import{i as _}from"./workSecret-CaM2yIJD.js";import{t as v}from"./ccrClient-JnhF5b3z.js";import{n as y,t as b}from"./SSETransport-CDNP2PlK.js";s(),c(),m();var x={init_retry_max_attempts:3,init_retry_base_delay_ms:500,init_retry_jitter_fraction:.25,init_retry_max_delay_ms:4e3,http_timeout_ms:1e4,uuid_dedup_buffer_size:2e3,heartbeat_interval_ms:2e4,heartbeat_jitter_fraction:.1,token_refresh_buffer_ms:3e5,teardown_archive_timeout_ms:1500,connect_timeout_ms:15e3,min_version:`0.0.0`,should_show_app_upgrade_message:!1},S=o(()=>n({init_retry_max_attempts:r().int().min(1).max(10).default(3),init_retry_base_delay_ms:r().int().min(100).default(500),init_retry_jitter_fraction:r().min(0).max(1).default(.25),init_retry_max_delay_ms:r().int().min(500).default(4e3),http_timeout_ms:r().int().min(2e3).default(1e4),uuid_dedup_buffer_size:r().int().min(100).max(5e4).default(2e3),heartbeat_interval_ms:r().int().min(5e3).max(3e4).default(2e4),heartbeat_jitter_fraction:r().min(0).max(.5).default(.1),token_refresh_buffer_ms:r().int().min(3e4).max(18e5).default(3e5),teardown_archive_timeout_ms:r().int().min(500).max(2e3).default(1500),connect_timeout_ms:r().int().min(5e3).max(6e4).default(15e3),min_version:i().refine(e=>{try{return g(e,`0.0.0`),!0}catch{return!1}}).default(`0.0.0`),should_show_app_upgrade_message:a().default(!1)}));async function C(){let e=x,t=S().safeParse(e);return t.success?t.data:x}async function w(){let e=await C();return e.min_version&&g(`0.0.21`,e.min_version)?`Your version of Work Mate (0.0.21) is too old for Remote Control.\nVersion ${e.min_version} or higher is required. Run \`claude update\` to update.`:null}y(),f(),u(),p();function T(e){return{write:t=>e.write(t),writeBatch:t=>e.writeBatch(t),close:()=>e.close(),isConnectedStatus:()=>e.isConnectedStatus(),getStateLabel:()=>e.getStateLabel(),setOnData:t=>e.setOnData(t),setOnClose:t=>e.setOnClose(t),setOnConnect:t=>e.setOnConnect(t),connect:()=>void e.connect(),getLastSequenceNum:()=>0,get droppedBatchCount(){return e.droppedBatchCount},reportState:()=>{},reportMetadata:()=>{},reportDelivery:()=>{},flush:()=>Promise.resolve()}}async function E(e){let{sessionUrl:t,ingressToken:n,sessionId:r,initialSequenceNum:i,getAuthToken:a}=e,o;a?o=()=>{let e=a();return e?{Authorization:`Bearer ${e}`}:{}}:h(n);let s=e.epoch??await _(t,n);d(`[bridge:repl] CCR v2: worker sessionId=${r} epoch=${s}${e.epoch===void 0?` (via registerWorker)`:` (from /bridge)`}`);let c=new URL(t);c.pathname=`${c.pathname.replace(/\/$/,``)}/worker/events/stream`;let u=new b(c,{},r,void 0,i,o),f,p=new v(u,new URL(t),{getAuthHeaders:o,heartbeatIntervalMs:e.heartbeatIntervalMs,heartbeatJitterFraction:e.heartbeatJitterFraction,onEpochMismatch:()=>{d(`[bridge:repl] CCR v2: epoch superseded (409) — closing for poll-loop recovery`);try{p.close(),u.close(),f?.(4090)}catch(e){d(`[bridge:repl] CCR v2: error during epoch-mismatch cleanup: ${l(e)}`,{level:`error`})}throw Error(`epoch superseded`)}});u.setOnEvent(e=>{p.reportDelivery(e.event_id,`received`),p.reportDelivery(e.event_id,`processed`)});let m,g=!1,y=!1;return{write(e){return p.writeEvent(e)},async writeBatch(e){for(let t of e){if(y)break;await p.writeEvent(t)}},close(){y=!0,p.close(),u.close()},isConnectedStatus(){return g},getStateLabel(){return u.isClosedStatus()?`closed`:u.isConnectedStatus()?g?`connected`:`init`:`connecting`},setOnData(e){u.setOnData(e)},setOnClose(e){f=e,u.setOnClose(t=>{p.close(),e(t??4092)})},setOnConnect(e){m=e},getLastSequenceNum(){return u.getLastSequenceNum()},droppedBatchCount:0,reportState(e){p.reportState(e)},reportMetadata(e){p.reportMetadata(e)},reportDelivery(e,t){p.reportDelivery(e,t)},flush(){return p.flush()},connect(){e.outboundOnly||u.connect(),p.initialize(s).then(()=>{g=!0,d(`[bridge:repl] v2 transport ready for writes (epoch=${s}, sse=${u.isConnectedStatus()?`open`:`opening`})`),m?.()},e=>{d(`[bridge:repl] CCR v2 initialize failed: ${l(e)}`,{level:`error`}),p.close(),u.close(),f?.(4091)})}}}e();var D=class{constructor(){t(this,`_active`,!1),t(this,`_pending`,[])}get active(){return this._active}get pendingCount(){return this._pending.length}start(){this._active=!0}end(){return this._active=!1,this._pending.splice(0)}enqueue(...e){return this._active?(this._pending.push(...e),!0):!1}drop(){this._active=!1;let e=this._pending.length;return this._pending.length=0,e}deactivate(){this._active=!1}};export{C as a,w as i,T as n,E as r,D as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ea as t,ha as n,it as r,pa as i,tt as a,ww as o}from"./loadAgentsDir-C96o6gCj.js";import{P as s,R as c,c as l,i as u}from"./debug-D58GQBDG.js";import{a as d,l as f}from"./proxy-BhIc7-mj.js";import{B as p,H as m,L as h,T as g,W as _,q as v,z as y}from"./sessionState-8jutEorw.js";import{n as b,r as x}from"./SSETransport-CDNP2PlK.js";import{randomUUID as S}from"crypto";function C(){return(process.env.GEMINI_BASE_URL||E).replace(/\/+$/,``)}function w(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*T(e){let t=await(e.fetchOverride??fetch)(`${C()}/${w(e.model)}:streamGenerateContent?alt=sse`,{method:`POST`,headers:{"Content-Type":`application/json`,"x-goog-api-key":process.env.GEMINI_API_KEY||``},body:JSON.stringify(e.body),signal:e.signal,...d({forAnthropicAPI:!1})});if(!t.ok){let e=await t.text();throw Error(`Gemini API request failed (${t.status} ${t.statusText}): ${e||`empty response body`}`)}if(!t.body)throw Error(`Gemini API returned no response body`);let n=t.body.getReader(),r=new TextDecoder,i=``;try{for(;;){let{done:e,value:t}=await n.read();if(e)break;i+=r.decode(t,D);let{frames:a,remaining:o}=x(i);i=o;for(let e of a)if(!(!e.data||e.data===`[DONE]`))try{yield JSON.parse(e.data)}catch(e){throw Error(`Failed to parse Gemini SSE payload: ${s(e)}`)}}i+=r.decode();let{frames:e}=x(i);for(let t of e)if(!(!t.data||t.data===`[DONE]`))try{yield JSON.parse(t.data)}catch(e){throw Error(`Failed to parse trailing Gemini SSE payload: ${s(e)}`)}}finally{n.releaseLock()}}var E,D,O=e((()=>{b(),c(),f(),E=`https://generativelanguage.googleapis.com/v1beta`,D={stream:!0}}));async function*k(e,t,a,s,c,u){try{let o=v(c.model),d=n(e,a),f=(await Promise.all(a.map(e=>r(e,{getToolPermissionContext:c.getToolPermissionContext,tools:a,agents:c.agents,allowedAgentTypes:c.allowedAgentTypes,model:c.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:g,systemInstruction:b}=m(d,t),x=p(f),C=y(c.toolChoice),w=T({model:o,signal:s,fetchOverride:c.fetchOverride,body:{contents:g,...b&&{systemInstruction:b},...x.length>0&&{tools:x},...C&&{toolConfig:{functionCallingConfig:C}},generationConfig:{...c.temperatureOverride!==void 0&&{temperature:c.temperatureOverride},...u.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...u.type===`enabled`&&{thinkingBudget:u.budgetTokens}}}}}});l(`[Gemini] Calling model=${o}, messages=${g.length}, tools=${x.length}`);let E=h(w,o),D={},O=null,k=0,A=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,k=Date.now()-A;break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.type===`thinking`?r.signature=n.signature:r[_]=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:i([t],a,c.agentId)},requestId:void 0,type:`assistant`,uuid:S(),timestamp:new Date().toISOString()};break}case`message_delta`:case`message_stop`:break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:k}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);l(`[Gemini] Error: ${t}`,{level:`error`}),yield o({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{a(),u(),t(),O(),g()}))();export{k as queryModelGemini};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{X as t,Yv as n,Z as r,ea as i,hw as a}from"./loadAgentsDir-C96o6gCj.js";import{P as o,R as s,c,i as l}from"./debug-D58GQBDG.js";import{s as u,u as d}from"./types-APu4OCXJ.js";import{Q as f}from"./sessionState-8jutEorw.js";import{r as p,t as m}from"./sessionTitle-k4wpUS5l.js";async function h(e,t){let n=m(e);if(!n)return null;try{let e=await r({systemPrompt:f([`Generate a short kebab-case name (2-4 words) that captures the main topic of this conversation. Use lowercase words separated by hyphens. Examples: "fix-login-bug", "add-auth-feature", "refactor-api-client", "debug-test-failures". Return JSON with a "name" field.`]),userPrompt:n,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:t,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),i=d(Array.isArray(e.message.content)?a(e.message.content):e.message.content);return i&&typeof i==`object`&&`name`in i&&typeof i.name==`string`?i.name:null}catch(e){return c(`generateSessionName failed: ${o(e)}`,{level:`error`}),null}}var g=e((()=>{t(),l(),s(),u(),i(),p(),n()}));export{g as n,h as t};
@@ -1,5 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{Ut as a,sr as o}from"./state-D5D6QpTX.js";import{n as s,t as c}from"./cwd-Nh5IZNKO.js";import{C as ee,f as l,i as te,nt as ne,tt as re,u,x as ie}from"./debug-D58GQBDG.js";import{i as ae,t as d}from"./execFileNoThrow-B_KRY4cT.js";import{o as oe}from"./log-CZ7ploQm.js";import{n as f,t as se}from"./memoize-CumjjK2Q.js";import{r as ce,t as le}from"./which-B8rchd8P.js";import{basename as ue,dirname as p,join as m,resolve as h,sep as g}from"path";import{readFileSync as _,realpathSync as v,statSync as y,unwatchFile as b,watchFile as de}from"fs";import{createHash as fe}from"crypto";import{readFile as x,readdir as pe,stat as me}from"fs/promises";function S(e,t,n){let r=he();if(!r)return;let i={timestamp:new Date().toISOString(),level:e,event:t,data:n??{}},a=u(),o=`${ee(i)}\n`;try{a.appendFileSync(r,o)}catch{try{a.mkdirSync(p(r)),a.appendFileSync(r,o)}catch{}}}function he(){return process.env.CLAUDE_CODE_DIAGNOSTICS_FILE}async function ge(e,t,n){let r=Date.now();S(`info`,`${e}_started`);try{let i=await t(),a=n?n(i):{};return S(`info`,`${e}_completed`,{duration_ms:Date.now()-r,...a}),i}catch(t){throw S(`error`,`${e}_failed`,{duration_ms:Date.now()-r}),t}}var C=e((()=>{l(),ie()}));async function w(e,t,n,r){try{return _e(await x(m(e,`config`),`utf-8`),t,n,r)}catch{return null}}function _e(e,t,n,r){let i=e.split(`
2
- `),a=t.toLowerCase(),o=r.toLowerCase(),s=!1;for(let e of i){let t=e.trim();if(t.length===0||t[0]===`#`||t[0]===`;`)continue;if(t[0]===`[`){s=xe(t,a,n);continue}if(!s)continue;let r=ve(t);if(r&&r.key.toLowerCase()===o)return r.value}return null}function ve(e){let t=0;for(;t<e.length&&Se(e[t]);)t++;if(t===0)return null;let n=e.slice(0,t);for(;t<e.length&&(e[t]===` `||e[t]===` `);)t++;if(t>=e.length||e[t]!==`=`)return null;for(t++;t<e.length&&(e[t]===` `||e[t]===` `);)t++;return{key:n,value:ye(e,t)}}function ye(e,t){let n=``,r=!1,i=t;for(;i<e.length;){let t=e[i];if(!r&&(t===`#`||t===`;`))break;if(t===`"`){r=!r,i++;continue}if(t===`\\`&&i+1<e.length){let t=e[i+1];if(r){switch(t){case`n`:n+=`
3
- `;break;case`t`:n+=` `;break;case`b`:n+=`\b`;break;case`"`:n+=`"`;break;case`\\`:n+=`\\`;break;default:n+=t;break}i+=2;continue}if(t===`\\`){n+=`\\`,i+=2;continue}}n+=t,i++}return r||(n=be(n)),n}function be(e){let t=e.length;for(;t>0&&(e[t-1]===` `||e[t-1]===` `);)t--;return e.slice(0,t)}function xe(e,t,n){let r=1;for(;r<e.length&&e[r]!==`]`&&e[r]!==` `&&e[r]!==` `&&e[r]!==`"`;)r++;if(e.slice(1,r).toLowerCase()!==t)return!1;if(n===null)return r<e.length&&e[r]===`]`;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r>=e.length||e[r]!==`"`)return!1;r++;let i=``;for(;r<e.length&&e[r]!==`"`;){if(e[r]===`\\`&&r+1<e.length){let t=e[r+1];if(t===`\\`||t===`"`){i+=t,r+=2;continue}i+=t,r+=2;continue}i+=e[r],r++}return r>=e.length||e[r]!==`"`||(r++,r>=e.length||e[r]!==`]`)?!1:i===n}function Se(e){return e>=`a`&&e<=`z`||e>=`A`&&e<=`Z`||e>=`0`&&e<=`9`||e===`-`}var T=e((()=>{}));function Ce(){N.clear()}async function E(e){let t=h(e??c()),n=N.get(t);if(n!==void 0)return n;let r=V(t);if(!r)return N.set(t,null),null;let i=m(r,`.git`);try{if((await me(i)).isFile()){let e=(await x(i,`utf-8`)).trim();if(e.startsWith(`gitdir:`)){let n=h(r,e.slice(7).trim());return N.set(t,n),n}}return N.set(t,i),i}catch{return N.set(t,null),null}}function D(e){return!(!e||e.startsWith(`-`)||e.startsWith(`/`)||e.includes(`..`)||e.split(`/`).some(e=>e===`.`||e===``)||!/^[a-zA-Z0-9/._+@-]+$/.test(e))}function O(e){return/^[0-9a-f]{40}$/.test(e)||/^[0-9a-f]{64}$/.test(e)}async function k(e){try{let t=(await x(m(e,`HEAD`),`utf-8`)).trim();if(t.startsWith(`ref:`)){let n=t.slice(4).trim();if(n.startsWith(`refs/heads/`)){let e=n.slice(11);return D(e)?{type:`branch`,name:e}:null}if(!D(n))return null;let r=await A(e,n);return r?{type:`detached`,sha:r}:{type:`detached`,sha:``}}return O(t)?{type:`detached`,sha:t}:null}catch{return null}}async function A(e,t){let n=await j(e,t);if(n)return n;let r=await M(e);return r&&r!==e?j(r,t):null}async function j(e,t){try{let n=(await x(m(e,t),`utf-8`)).trim();if(n.startsWith(`ref:`)){let t=n.slice(4).trim();return D(t)?A(e,t):null}return O(n)?n:null}catch{}try{let n=await x(m(e,`packed-refs`),`utf-8`);for(let e of n.split(`
4
- `)){if(e.startsWith(`#`)||e.startsWith(`^`))continue;let n=e.indexOf(` `);if(n!==-1&&e.slice(n+1)===t){let t=e.slice(0,n);return O(t)?t:null}}}catch{}return null}async function M(e){try{return h(e,(await x(m(e,`commondir`),`utf-8`)).trim())}catch{return null}}async function we(e,t,n){try{let r=(await x(m(e,t),`utf-8`)).trim();if(r.startsWith(`ref:`)){let e=r.slice(4).trim();if(e.startsWith(n)){let t=e.slice(n.length);return D(t)?t:null}}}catch{}return null}async function Te(){let e=await E();if(!e)return`HEAD`;let t=await k(e);return t&&t.type===`branch`?t.name:`HEAD`}async function Ee(){let e=await E();if(!e)return null;let t=await w(e,`remote`,`origin`,`url`);if(t)return t;let n=await M(e);return n&&n!==e?w(n,`remote`,`origin`,`url`):null}async function De(){let e=await E();if(!e)return`main`;let t=await M(e)??e,n=await we(t,`refs/remotes/origin/HEAD`,`refs/remotes/origin/`);if(n)return n;for(let e of[`main`,`master`])if(await A(t,`refs/remotes/origin/${e}`))return e;return`main`}function Oe(){return I.get(`branch`,Te)}function ke(){return I.get(`remoteUrl`,Ee)}function Ae(){return I.get(`defaultBranch`,De)}async function je(e){let t=await E(e);if(!t)return null;let n=await k(t);return n?n.type===`branch`?A(t,`refs/heads/${n.name}`):n.sha:null}async function Me(e){let t;try{let n=(await x(m(e,`.git`),`utf-8`)).trim();if(!n.startsWith(`gitdir:`))return null;t=h(e,n.slice(7).trim())}catch{return null}let n=await k(t);return n?n.type===`branch`?A(t,`refs/heads/${n.name}`):n.sha:null}async function Ne(e){let t=await E(e);if(!t)return null;let n=await w(t,`remote`,`origin`,`url`);if(n)return n;let r=await M(t);return r&&r!==t?w(r,`remote`,`origin`,`url`):null}async function Pe(){try{let e=await E();return e?(await pe(m(await M(e)??e,`worktrees`))).length+1:0}catch{return 1}}var N,P,F,I,L=e((()=>{a(),re(),s(),Ve(),T(),r(),N=new Map,P=1e3,F=class{constructor(){i(this,`gitDir`,null),i(this,`commonDir`,null),i(this,`initialized`,!1),i(this,`initPromise`,null),i(this,`watchedPaths`,[]),i(this,`branchRefPath`,null),i(this,`cache`,new Map)}async ensureStarted(){if(!this.initialized)return this.initPromise||(this.initPromise=this.start()),this.initPromise}async start(){this.gitDir=await E(),this.initialized=!0,this.gitDir&&(this.commonDir=await M(this.gitDir),this.watchPath(m(this.gitDir,`HEAD`),()=>{this.onHeadChanged()}),this.watchPath(m(this.commonDir??this.gitDir,`config`),()=>{this.invalidate()}),await this.watchCurrentBranchRef(),ne(async()=>{this.stopWatching()}))}watchPath(e,t){this.watchedPaths.push(e),de(e,{interval:P},t)}async watchCurrentBranchRef(){if(!this.gitDir)return;let e=await k(this.gitDir),t=this.commonDir??this.gitDir,n=e?.type===`branch`?m(t,`refs`,`heads`,e.name):null;n!==this.branchRefPath&&(this.branchRefPath&&(b(this.branchRefPath),this.watchedPaths=this.watchedPaths.filter(e=>e!==this.branchRefPath)),this.branchRefPath=n,n&&this.watchPath(n,()=>{this.invalidate()}))}async onHeadChanged(){this.invalidate(),await o(),await this.watchCurrentBranchRef()}invalidate(){for(let e of this.cache.values())e.dirty=!0}stopWatching(){for(let e of this.watchedPaths)b(e);this.watchedPaths=[],this.branchRefPath=null}async get(e,t){await this.ensureStarted();let n=this.cache.get(e);if(n&&!n.dirty)return n.value;n&&(n.dirty=!1);let r=await t(),i=this.cache.get(e);return i&&!i.dirty&&(i.value=r),i||this.cache.set(e,{value:r,dirty:!1,compute:t}),r}reset(){this.stopWatching(),this.cache.clear(),this.initialized=!1,this.initPromise=null,this.gitDir=null,this.commonDir=null}},I=new F}));function Fe(){function e(e){let t=B(e);return t===z?null:t}return e.cache=B.cache,e}function Ie(){function e(e){let t=V(e);return t?H(t):null}return e.cache=H.cache,e}function Le(e){return E(e)}function R(e){let t=e.trim();if(!t)return null;let n=t.match(/^git@([^:]+):(.+?)(?:\.git)?$/);if(n?.[1]&&n[2])return`${n[1]}/${n[2]}`.toLowerCase();let r=t.match(/^(?:https?|ssh):\/\/(?:[^@]+@)?([^/]+)\/(.+?)(?:\.git)?$/);if(r?.[1]&&r[2]){let e=r[1],t=r[2];if(ze(e)&&t.startsWith(`git/`)){let e=t.slice(4),n=e.split(`/`);return n.length>=3&&n[0].includes(`.`)?e.toLowerCase():`github.com/${e}`.toLowerCase()}return`${e}/${t}`.toLowerCase()}return null}async function Re(){let e=await Y();if(!e)return null;let t=R(e);return t?fe(`sha256`).update(t).digest(`hex`).substring(0,16):null}function ze(e){let t=e.split(`:`)[0]??``;return t===`localhost`||/^127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(t)}function Be(){let e=u(),t=c(),n=m(t,`.git`);try{let t=e.statSync(n);if(t.isFile())return!1;if(t.isDirectory()){let t=m(n,`HEAD`);try{if(e.statSync(t).isFile())return!1}catch{}}}catch{}try{if(e.statSync(m(t,`HEAD`)).isFile())return!0}catch{}try{if(e.statSync(m(t,`objects`)).isDirectory())return!0}catch{}try{if(e.statSync(m(t,`refs`)).isDirectory())return!0}catch{}return!1}var z,B,V,H,U,W,G,K,q,J,Y,X,Z,Q,$,Ve=e((()=>{n(),s(),te(),C(),ae(),l(),L(),oe(),se(),le(),z=Symbol(`git-root-not-found`),B=f(e=>{let t=Date.now();S(`info`,`find_git_root_started`);let n=h(e),r=n.substring(0,n.indexOf(g)+1)||g,i=0;for(;n!==r;){try{let e=m(n,`.git`);i++;let r=y(e);if(r.isDirectory()||r.isFile())return S(`info`,`find_git_root_completed`,{duration_ms:Date.now()-t,stat_count:i,found:!0}),n.normalize(`NFC`)}catch{}let e=p(n);if(e===n)break;n=e}try{let e=m(r,`.git`);i++;let n=y(e);if(n.isDirectory()||n.isFile())return S(`info`,`find_git_root_completed`,{duration_ms:Date.now()-t,stat_count:i,found:!0}),r.normalize(`NFC`)}catch{}return S(`info`,`find_git_root_completed`,{duration_ms:Date.now()-t,stat_count:i,found:!1}),z},e=>e,50),V=Fe(),H=f(e=>{try{let t=_(m(e,`.git`),`utf-8`).trim();if(!t.startsWith(`gitdir:`))return e;let n=h(e,t.slice(7).trim()),r=h(n,_(m(n,`commondir`),`utf-8`).trim());return h(p(n))!==m(r,`worktrees`)||v(_(m(n,`gitdir`),`utf-8`).trim())!==m(v(e),`.git`)?e:ue(r)===`.git`?p(r).normalize(`NFC`):r.normalize(`NFC`)}catch{return e}},e=>e,50),U=Ie(),W=t(()=>ce(`git`)||`git`),G=t(async()=>{let e=Date.now();S(`info`,`is_git_check_started`);let t=V(c())!==null;return S(`info`,`is_git_check_completed`,{duration_ms:Date.now()-e,is_git:t}),t}),K=async e=>V(e)!==null,q=async()=>Oe(),J=async()=>Ae(),Y=async()=>ke(),X=async e=>{let t=[`--no-optional-locks`,`status`,`--porcelain`];e?.ignoreUntracked&&t.push(`-uno`);let{stdout:n}=await d(W(),t,{preserveOutputOnError:!1});return n.trim().length===0},Z=async()=>{let{stdout:e}=await d(W(),[`--no-optional-locks`,`status`,`--porcelain`],{preserveOutputOnError:!1}),t=[],n=[];return e.trim().split(`
5
- `).filter(e=>e.length>0).forEach(e=>{let r=e.substring(0,2),i=e.substring(2).trim();r===`??`?n.push(i):i&&t.push(i)}),{tracked:t,untracked:n}},Q=async()=>Pe(),$=async e=>{try{let t=e||`Work Mate auto-stash - ${new Date().toISOString()}`,{untracked:n}=await Z();if(n.length>0){let{code:e}=await d(W(),[`add`,...n],{preserveOutputOnError:!1});if(e!==0)return!1}let{code:r}=await d(W(),[`stash`,`push`,`--message`,t],{preserveOutputOnError:!1});return r===0}catch{return!1}}}));export{ge as A,Me as C,w as D,T as E,C as O,L as S,A as T,$ as _,J as a,je as b,X as c,Re as d,Q as f,R as g,Be as h,q as i,S as k,G as l,Ve as m,U as n,Z as o,W as p,V as r,Le as s,K as t,Y as u,Ce as v,E as w,Ne as x,M as y};
@@ -1 +0,0 @@
1
- import{a as e,i as t,m as n,r,u as i}from"./git-Wid-XppW.js";n();export{r as findGitRoot,t as getBranch,e as getDefaultBranch,i as getRemoteUrl};
@@ -1 +0,0 @@
1
- import{$ as e,Ut as t}from"./state-D5D6QpTX.js";import{c as n,i as r}from"./debug-D58GQBDG.js";import{Cn as i,On as a}from"./settings-BowI3jp-.js";import{c as o,h as s,y as c}from"./config-DUTgj3js.js";import{S as l,m as u,r as d,x as f}from"./git-Wid-XppW.js";import{a as p,i as m,n as h}from"./detectRepository-pRAVv8SH.js";import{realpath as g}from"fs/promises";t(),s(),r(),m(),i(),l(),u();async function _(){try{let t=await h();if(!t){n(`Not in a GitHub repository, skipping path mapping update`);return}let r=e(),i=d(r)??r,a;try{a=(await g(i)).normalize(`NFC`)}catch{a=i}let s=t.toLowerCase(),l=o().githubRepoPaths?.[s]??[];if(l[0]===a){n(`Path ${a} already tracked for repo ${s}`);return}let u=l.filter(e=>e!==a),f=[a,...u];c(e=>({...e,githubRepoPaths:{...e.githubRepoPaths,[s]:f}})),n(`Added ${a} to tracked paths for repo ${s}`)}catch(e){n(`Error updating repo path mapping: ${e}`)}}function v(e){let t=o(),n=e.toLowerCase();return t.githubRepoPaths?.[n]??[]}async function y(e){let t=await Promise.all(e.map(a));return e.filter((e,n)=>t[n])}async function b(e,t){try{let n=await f(e);if(!n)return!1;let r=p(n);return r?r.toLowerCase()===t.toLowerCase():!1}catch{return!1}}function x(e,t){let r=o(),i=e.toLowerCase(),a=r.githubRepoPaths?.[i]??[],s=a.filter(e=>e!==t);if(s.length===a.length)return;let l={...r.githubRepoPaths};s.length===0?delete l[i]:l[i]=s,c(e=>({...e,githubRepoPaths:l})),n(`Removed ${t} from tracked paths for repo ${i}`)}export{b as a,_ as i,v as n,x as r,y as t};
@@ -1,3 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$c as t,Du as n,Eu as r,Jc as i,Lv as a,Mv as o,Qc as s,Xc as c,Yc as l,Zc as u,al as d,cl as f,el as p,il as m,ll as h,nl as g,sl as _,tl as v}from"./loadAgentsDir-C96o6gCj.js";import{I as y,P as b,t as x}from"./src-DL3w8VPk.js";import{t as S}from"./jsx-runtime-Bb4Xn-E0.js";import{n as C,t as w}from"./PermissionDialog-BaibiQae.js";function T({currentGoal:e,newObjective:t,onConfirm:r,onCancel:i}){function a(e){e===`yes`?r():i()}let o=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,E.jsx)(w,{color:`warning`,title:`Replace active goal?`,children:(0,E.jsxs)(y,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,E.jsx)(b,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,E.jsxs)(y,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(b,{dimColor:!0,children:`Current goal:`}),(0,E.jsxs)(b,{children:[(0,E.jsx)(b,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,E.jsxs)(b,{children:[(0,E.jsx)(b,{dimColor:!0,children:`· Status: `}),v(e.status)]}),(0,E.jsxs)(b,{children:[(0,E.jsx)(b,{dimColor:!0,children:`· Time: `}),p(e)]}),(0,E.jsxs)(b,{children:[(0,E.jsx)(b,{dimColor:!0,children:`· Tokens: `}),o]})]}),(0,E.jsxs)(y,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(b,{dimColor:!0,children:`New objective:`}),(0,E.jsx)(b,{children:t})]}),(0,E.jsx)(y,{marginTop:1,children:(0,E.jsx)(n,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:a,onCancel:i})})]})})}var E,D=e((()=>{x(),r(),C(),d(),E=S()}));function O(e){let t=e.split(`
2
- `)[0]??e;return t.length<=F?t:`${t.slice(0,F)}…`}function k(){a(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function A(){let e=g();if(!e)return"No active goal. Set one with `/goal <objective>`.";let t=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`,n=[`Goal: ${e.objective}`,`Status: ${v(e.status)}`,`Time: ${p(e)}`,`Tokens: ${t}`,`Continuation turns: ${e.turnsExecuted}`];return e.status===`max_turns`&&n.push("Hint: Max continuation turns reached (150). Run `/goal continue` to reset and continue."),n.join(`
3
- `)}function j(e){return h(e),m(),l(),`Goal set.`}async function M(e,n,r){let i=r.trim();if(!i||i.toLowerCase()===`status`)return e(A(),{display:`system`}),null;let a=i.toLowerCase();if(a===`clear`){let t=u();return t&&(c(),k()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(a===`pause`){let t=_();return t&&(l(),k()),e(t?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(a===`resume`){if(g()?.status===`max_turns`)return e("Goal reached max continuation turns (150). Run `/goal continue` to reset turn counter and continue.",{display:`system`}),null;let t=f();return t&&l(),e(t?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!t}),null}if(a===`continue`){let n=t();return n&&l(),e(n?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!n}),null}if(a===`complete`){let t=s();return t&&(l(),k()),e(t?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(i.length>P)return e(`Goal objective is too long (${i.length} chars; limit ${P}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let o=g();return o&&o.status!==`complete`?(0,N.jsx)(T,{currentGoal:o,newObjective:i,onConfirm:()=>{k(),e(j(i),{display:`system`,shouldQuery:!0,displayArgs:O(i),metaMessages:[`<goal-objective-updated>\n${i}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(j(i),{display:`system`,shouldQuery:!0,displayArgs:O(i),metaMessages:[`<goal-objective-updated>\n${i}\n</goal-objective-updated>`]}),null)}var N,P,F;e((()=>{d(),i(),o(),D(),N=S(),P=4e3,F=80}))();export{M as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{cy as t,ea as n,ha as r,it as i,iy as a,pa as o,tt as s,ww as c}from"./loadAgentsDir-C96o6gCj.js";import{c as l,i as u}from"./debug-D58GQBDG.js";import{F as d,R as f}from"./model-BaMclMXn.js";import{E as p,O as m,T as h,Y as g,j as _,k as v}from"./sessionState-8jutEorw.js";import{n as y,t as b}from"./client-9uHzAmFH.js";import{n as x,t as S}from"./openaiShared-G2-w4gJt.js";import{randomUUID as C}from"crypto";async function*w(e,t,n,s,u){try{let c=g(u.model),f=r(e,n),h=(await Promise.all(n.map(e=>i(e,{getToolPermissionContext:u.getToolPermissionContext,tools:n,agents:u.agents,allowedAgentTypes:u.allowedAgentTypes,model:u.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),y=_(f,t),S=v(h),w=m(u.toolChoice),T=b({maxRetries:0,fetchOverride:u.fetchOverride,source:u.querySource});l(`[Grok] Calling model=${c}, messages=${y.length}, tools=${S.length}`);let E=p(await T.chat.completions.create({model:c,messages:y,...S.length>0&&{tools:S,...w&&{tool_choice:w}},stream:!0,stream_options:{include_usage:!0},...u.temperatureOverride!==void 0&&{temperature:u.temperatureOverride}},{signal:s}),c),D={},O=null,k={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},A=0,j=Date.now();for await(let e of E){switch(e.type){case`message_start`:O=e.message,A=Date.now()-j,e.message.usage&&(k=x(k,e.message.usage));break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?D[t]={...n,input:``}:n.type===`text`?D[t]={...n,text:``}:n.type===`thinking`?D[t]={...n,thinking:``,signature:``}:D[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=D[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:o([t],n,u.agentId)},requestId:void 0,type:`assistant`,uuid:C(),timestamp:new Date().toISOString()};break}case`message_delta`:{let t=e.usage;t&&(k=x(k,t));break}case`message_stop`:break}e.type===`message_stop`&&k.input_tokens+k.output_tokens>0&&a(d(c,k),k,u.model),yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:A}:void 0}}}catch(e){let t=e instanceof Error?e.message:String(e);l(`[Grok] Error: ${t}`,{level:`error`}),yield c({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{y(),S(),h(),n(),s(),u(),t(),f()}))();export{w as queryModelGrok};
@@ -1,7 +0,0 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{n,t as r}from"./axios-DaWTGg7G.js";import{Ed as i,Od as a}from"./loadAgentsDir-C96o6gCj.js";import{c as o,i as s}from"./debug-D58GQBDG.js";import{c,h as l,y as u}from"./config-DUTgj3js.js";import{a as d,n as f}from"./process-gEbdy6uY.js";import{d as p,f as m,o as h,s as g}from"./log-CZ7ploQm.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{l as y,u as b}from"./oauth-D38aRTUb.js";import{Bt as x,Pt as S,Tt as C,Xn as w,Yn as T,Zn as E,qn as D}from"./model-BaMclMXn.js";import{n as O,t as k}from"./userAgent-NbKd-hN7.js";r(),t(),_(),S(),s(),a(),p(),f(),b(),l(),w(),h(),O();var A=1440*60*1e3,j=e(async()=>{if(m())return{success:!1};try{return{success:!0,data:(await E(()=>{let e=D();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return n.get(`${y().BASE_API_URL}/api/oauth/account/settings`,{headers:{...e.headers,"User-Agent":k()}})})).data}}catch(e){return g(e),j.cache.clear?.(),{success:!1}}});async function M(){try{await E(()=>{let e=D();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return n.post(`${y().BASE_API_URL}/api/oauth/account/grove_notice_viewed`,{},{headers:{...e.headers,"User-Agent":k()}})}),j.cache.clear?.()}catch(e){g(e)}}async function N(e){try{await E(()=>{let t=D();if(t.error)throw Error(`Failed to get auth headers: ${t.error}`);return n.patch(`${y().BASE_API_URL}/api/oauth/account/settings`,{grove_enabled:e},{headers:{...t.headers,"User-Agent":k()}})}),j.cache.clear?.()}catch(e){g(e)}}async function P(){if(!x())return!1;let e=C()?.accountUuid;if(!e)return!1;let t=c().groveConfigCache?.[e];return t?Date.now()-t.timestamp>A?(o(`Grove: Cache stale, returning cached data and refreshing in background`),F(e),t.grove_enabled):(o(`Grove: Using fresh cached config`),t.grove_enabled):(o(`Grove: No cache, fetching config in background (dialog skipped this session)`),F(e),!1)}async function F(e){try{let t=await I();if(!t.success)return;let n=t.data.grove_enabled,r=c().groveConfigCache?.[e];if(r?.grove_enabled===n&&Date.now()-r.timestamp<=A)return;u(t=>({...t,groveConfigCache:{...t.groveConfigCache,[e]:{grove_enabled:n,timestamp:Date.now()}}}))}catch(e){o(`Grove: Failed to fetch and store config: ${e}`)}}var I=e(async()=>{if(m())return{success:!1};try{let{grove_enabled:e,domain_excluded:t,notice_is_grace_period:r,notice_reminder_frequency:i}=(await E(()=>{let e=D();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return n.get(`${y().BASE_API_URL}/api/claude_code_grove`,{headers:{...e.headers,"User-Agent":T()},timeout:3e3})})).data;return{success:!0,data:{grove_enabled:e,domain_excluded:t??!1,notice_is_grace_period:r??!0,notice_reminder_frequency:i}}}catch(e){return o(`Failed to fetch Grove notice config: ${e}`),{success:!1}}});function L(e,t,n){if(!e.success||!t.success)return!1;let r=e.data,i=t.data;if(r.grove_enabled!==null)return!1;if(n||!i.notice_is_grace_period)return!0;let a=i.notice_reminder_frequency;return a!==null&&r.grove_notice_viewed_at?Math.floor((Date.now()-new Date(r.grove_notice_viewed_at).getTime())/(1e3*60*60*24))>=a:r.grove_notice_viewed_at==null}async function R(){let[e,t]=await Promise.all([j(),I()]);if(L(e,t,!1)){let e=t.success?t.data:null;v(`tengu_grove_print_viewed`,{dismissable:e?.notice_is_grace_period}),e===null||e.notice_is_grace_period?(d(`
2
- An update to our Consumer Terms and Privacy Policy will take effect on October 8, 2025. Run \`claude\` to review the updated terms.
3
-
4
- `),await M()):(d(`
5
- [ACTION REQUIRED] An update to our Consumer Terms and Privacy Policy has taken effect on October 8, 2025. You must run \`claude\` to review the updated terms.
6
-
7
- `),await i(1))}}export{P as a,j as i,R as n,M as o,I as r,N as s,L as t};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./rolldown-runtime-DaDcL9Zw.js";function n(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n)|0;return t}function r(t){return typeof Bun<`u`?Bun.hash(t).toString():e(`crypto`).createHash(`sha256`).update(t).digest(`hex`)}function i(t,n){return typeof Bun<`u`?Bun.hash(n,Bun.hash(t)).toString():e(`crypto`).createHash(`sha256`).update(t).update(`\0`).update(n).digest(`hex`)}var a=t((()=>{}));export{a as i,r as n,i as r,n as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ai as n,BS as r,Du as i,GS as a,Li as o,Ou as s,Ti as c,VS as l,zS as u}from"./loadAgentsDir-C96o6gCj.js";import{I as d,Lt as f,P as p,Wt as m,a as h,ai as g,n as _,ot as v,r as y,t as b,x}from"./src-DL3w8VPk.js";import{t as S}from"./jsx-runtime-Bb4Xn-E0.js";import{b as C,y as w}from"./startupProfiler-B90b5vuq.js";import{n as T,t as E}from"./useExitOnCtrlCDWithKeybindings-L5idX6Kz.js";import{n as D,r as O}from"./modalContext-DDZdU1J8.js";import{n as k,t as A}from"./PromptInputHelpMenu-Ckp0k8E3.js";function j({commands:e,maxHeight:t,columns:r,title:a,onCancel:o,emptyMessage:s}){let{headerFocused:c,focusHeader:l}=h(),u=Math.max(1,r-10),f=Math.max(1,Math.floor((t-10)/2)),m=(0,M.useMemo)(()=>{let t=new Set;return e.filter(e=>t.has(e.name)?!1:(t.add(e.name),!0)).sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({label:`/${e.name}`,value:e.name,description:C(n(e),u,!0)}))},[e,u]);return(0,N.jsx)(d,{flexDirection:`column`,paddingY:1,children:e.length===0&&s?(0,N.jsx)(p,{dimColor:!0,children:s}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(p,{children:a}),(0,N.jsx)(d,{marginTop:1,children:(0,N.jsx)(i,{options:m,visibleOptionCount:f,onCancel:o,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:l,isDisabled:c})})]})})}var M,N,P=e((()=>{M=t(g(),1),o(),w(),b(),s(),N=S()}));function F(){return(0,I.jsxs)(d,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,I.jsxs)(d,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(p,{bold:!0,children:`Getting started`}),(0,I.jsxs)(d,{flexDirection:`column`,children:[(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`1. `}),(0,I.jsx)(p,{children:`Ask a question or describe a task — Work Mate will explore your code and respond.`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`2. `}),(0,I.jsx)(p,{children:`When Work Mate wants to edit files or run commands, you review and approve each action.`})]}),(0,I.jsxs)(p,{children:[(0,I.jsx)(p,{bold:!0,children:`3. `}),(0,I.jsx)(p,{children:`Type `}),(0,I.jsx)(p,{bold:!0,children:`/help`}),(0,I.jsx)(p,{children:` for commands, or `}),(0,I.jsx)(p,{bold:!0,children:`?`}),(0,I.jsx)(p,{children:` for shortcuts.`})]})]})]}),(0,I.jsxs)(d,{flexDirection:`column`,children:[(0,I.jsx)(d,{children:(0,I.jsx)(p,{bold:!0,children:`Shortcuts`})}),(0,I.jsx)(A,{gap:2,fixedWidth:!0})]})]})}var I,L=e((()=>{b(),k(),I=S()}));function R({onClose:e,commands:t}){let{rows:n,columns:r}=v(),i=Math.floor(n/2),a=O(),o=()=>e(`Help dialog dismissed`,{display:`system`});m(`help:dismiss`,o,{context:`Help`});let s=T(o),u=l(`help:dismiss`,`Help`,`esc`),h=c(),g=t.filter(e=>h.has(e.name)&&!e.isHidden),b=t.filter(e=>!h.has(e.name)&&!e.isHidden),S=[(0,z.jsx)(_,{title:`general`,children:(0,z.jsx)(F,{})},`general`)];return S.push((0,z.jsx)(_,{title:`commands`,children:(0,z.jsx)(j,{commands:g,maxHeight:i,columns:r,title:`Browse default commands:`,onCancel:o})},`commands`)),S.push((0,z.jsx)(_,{title:`custom-commands`,children:(0,z.jsx)(j,{commands:b,maxHeight:i,columns:r,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:o})},`custom`)),(0,z.jsx)(d,{flexDirection:`column`,height:a?void 0:i,children:(0,z.jsxs)(x,{color:`professionalBlue`,children:[(0,z.jsx)(y,{title:`Work Mate v0.0.21`,color:`professionalBlue`,defaultTab:`general`,children:S}),(0,z.jsx)(d,{marginTop:1,children:(0,z.jsxs)(p,{children:[`For more help: `,(0,z.jsx)(f,{url:`https://code.workmate.com/docs/en/overview`})]})}),(0,z.jsx)(d,{marginTop:1,children:(0,z.jsx)(p,{dimColor:!0,children:s.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,s.keyName,` again to exit`]}):(0,z.jsxs)(p,{italic:!0,children:[u,` to cancel`]})})})]})})}var z,B=e((()=>{E(),r(),o(),D(),a(),b(),u(),P(),L(),z=S()})),V,H;e((()=>{B(),V=S(),H=async(e,{options:{commands:t}})=>(0,V.jsx)(R,{commands:t,onClose:e})}))();export{H as call};
@@ -1 +0,0 @@
1
- import{hn as e,mn as t,qt as n,sn as r}from"./loadAgentsDir-C96o6gCj.js";e();export{n as executeSessionEndHooks,r as getSessionEndHookTimeoutMs,t as hasWorktreeCreateHook};