@readmagic/workmate 0.0.21 → 0.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (461) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-DWgTWJ7R.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-DCvgQ6n3.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-s0Orgord.js +1 -0
  4. package/dist/chunks/App-BcEI6U5j.js +1 -0
  5. package/dist/chunks/ApproveApiKey-DegdTXZl.js +1 -0
  6. package/dist/chunks/ApproveApiKey-_VXIMSwY.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-CjBt1L0p.js +2 -0
  8. package/dist/chunks/BypassPermissionsModeDialog-D2Gesf-u.js +1 -0
  9. package/dist/chunks/CustomSelect-B46Eh0gU.js +1 -0
  10. package/dist/chunks/DiffDialog-v2IiYyi3.js +6 -0
  11. package/dist/chunks/Doctor-BP0Rqraa.js +1 -0
  12. package/dist/chunks/Doctor-By_y3C2V.js +3 -0
  13. package/dist/chunks/ExitFlow-BasHk1mk.js +2 -0
  14. package/dist/chunks/Grove-C3mhgshv.js +11 -0
  15. package/dist/chunks/InvalidConfigDialog-DYVQK5js.js +1 -0
  16. package/dist/chunks/InvalidSettingsDialog-Dg6OiStR.js +1 -0
  17. package/dist/chunks/KeybindingProviderSetup-Bn1jzN5F.js +1 -0
  18. package/dist/chunks/MCPConnectionManager-ChN4Ayjk.js +1 -0
  19. package/dist/chunks/MCPToolListView-DLSrQHDc.js +1 -0
  20. package/dist/chunks/{McpParsingWarnings-6ENzOklf.js → McpParsingWarnings-DZejAh8b.js} +1 -1
  21. package/dist/chunks/MessageSelector-CdDlJE48.js +3 -0
  22. package/dist/chunks/Messages-DuL_r1Or.js +10 -0
  23. package/dist/chunks/Onboarding-CE2GNA-h.js +1 -0
  24. package/dist/chunks/{PromptInputFooterSuggestions-Blzgj5yW.js → PromptInputFooterSuggestions-lkr_A5jQ.js} +1 -1
  25. package/dist/chunks/PromptInputHelpMenu-DaQKKyM5.js +1 -0
  26. package/dist/chunks/QueryEngine-DNNy1UCD.js +1 -0
  27. package/dist/chunks/REPL-CEhW-C41.js +1 -0
  28. package/dist/chunks/REPL-CkSL4C_8.js +124 -0
  29. package/dist/chunks/ResumeConversation-BMCO_3X7.js +1 -0
  30. package/dist/chunks/SearchExtraToolsTool-DSy_jDhf.js +1 -0
  31. package/dist/chunks/SelectMulti-CNE06VAN.js +1 -0
  32. package/dist/chunks/Settings-mDykHLok.js +2 -0
  33. package/dist/chunks/Spinner-DwsJJUtn.js +1 -0
  34. package/dist/chunks/SpinnerGlyph-A6G-gloN.js +1 -0
  35. package/dist/chunks/TextInput-7uqPhq9T.js +22 -0
  36. package/dist/chunks/ThemePicker-DT9zVy-0.js +1 -0
  37. package/dist/chunks/TrustDialog-G4jM9IfM.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-2QWIs_6h.js → ValidationErrorsList-BLtP647v.js} +1 -1
  39. package/dist/chunks/add-dir-7RfQAC3h.js +1 -0
  40. package/dist/chunks/{agentDisplay-1Y-N-gqz.js → agentDisplay-vLQHFrmq.js} +1 -1
  41. package/dist/chunks/agents-BNg_skSm.js +101 -0
  42. package/dist/chunks/{agents-CvW8XjoJ.js → agents-DLz0kfsr.js} +1 -1
  43. package/dist/chunks/allErrors-DaztSMrw.js +1 -0
  44. package/dist/chunks/appleTerminalBackup-BYKdf3of.js +1 -0
  45. package/dist/chunks/auth-BTB00dq5.js +10 -0
  46. package/dist/chunks/auth-Bbc0Ny8i.js +1 -0
  47. package/dist/chunks/backgroundHousekeeping-DYz83_8C.js +1 -0
  48. package/dist/chunks/backgroundHousekeeping-bEZtlJSf.js +17 -0
  49. package/dist/chunks/banner-mqZEluky.js +2 -0
  50. package/dist/chunks/branch-exFKkymg.js +2 -0
  51. package/dist/chunks/{break-cache-BZ_UMtEL.js → break-cache-BL2gnDLX.js} +2 -2
  52. package/dist/chunks/btw-3l78DYET.js +1 -0
  53. package/dist/chunks/caches-6Nx6tsk9.js +1 -0
  54. package/dist/chunks/caches-ouaWB9bY.js +1 -0
  55. package/dist/chunks/claudeDesktop-D3PEgx3U.js +1 -0
  56. package/dist/chunks/{clear-D2KRoibg.js → clear-CXfhVRp8.js} +1 -1
  57. package/dist/chunks/client-C01Bnxxv.js +1 -0
  58. package/dist/chunks/client-DYRgRQsr.js +1 -0
  59. package/dist/chunks/{client-C_jBL1yC.js → client-DdenNfkQ.js} +1 -1
  60. package/dist/chunks/client-DvhWKIOx.js +1 -0
  61. package/dist/chunks/commands-BoxOw75F.js +1 -0
  62. package/dist/chunks/compact-BOYr105K.js +2 -0
  63. package/dist/chunks/config-BddEvZZl.js +3 -0
  64. package/dist/chunks/config-GEv9hUzz.js +1 -0
  65. package/dist/chunks/config-kw4xg7Nk.js +1 -0
  66. package/dist/chunks/{context-Db9tH1VF.js → context-3s9wtn4L.js} +1 -1
  67. package/dist/chunks/{context-noninteractive-CacA9VlT.js → context-noninteractive-CJhUu_4y.js} +9 -9
  68. package/dist/chunks/context-noninteractive-DFvoZ2L9.js +1 -0
  69. package/dist/chunks/conversation-CoGharlH.js +1 -0
  70. package/dist/chunks/conversation-MxEVm54C.js +1 -0
  71. package/dist/chunks/conversationRecovery-Da_8uldZ.js +1 -0
  72. package/dist/chunks/crossProjectResume-CzPCHq_K.js +40 -0
  73. package/dist/chunks/cwd-BcO6WHKo.js +1 -0
  74. package/dist/chunks/cwd-CDUelriw.js +1 -0
  75. package/dist/chunks/{datadog-BuElf2EQ.js → datadog-v_mXWncN.js} +1 -1
  76. package/dist/chunks/{debug-D58GQBDG.js → debug-8DCufdSp.js} +4 -4
  77. package/dist/chunks/detectRepository-DfX8xXw2.js +1 -0
  78. package/dist/chunks/{diff-yA6v_dpP.js → diff-DJSt7QO6.js} +1 -1
  79. package/dist/chunks/directoryCompletion-CT6YVeg7.js +1 -0
  80. package/dist/chunks/doctor-DWvioSU9.js +1 -0
  81. package/dist/chunks/entry-ex0-RyYV.js +13 -0
  82. package/dist/chunks/esm-BQY8jJNR.js +1 -0
  83. package/dist/chunks/{execFileNoThrow-B_KRY4cT.js → execFileNoThrow-BsfuytkN.js} +1 -1
  84. package/dist/chunks/exit-BxC_ZEtO.js +1 -0
  85. package/dist/chunks/extraUsage-DYm33Occ.js +1 -0
  86. package/dist/chunks/extractMemories-CzN3Ax2B.js +1 -0
  87. package/dist/chunks/fast-DqUpl_Lr.js +1 -0
  88. package/dist/chunks/fast-NUdUyAaM.js +1 -0
  89. package/dist/chunks/fetchModelList-CqsTAWEN.js +1 -0
  90. package/dist/chunks/fetchModelList-DBMHE6Ng.js +1 -0
  91. package/dist/chunks/fileSuggestions-B-SLfb-o.js +3 -0
  92. package/dist/chunks/firstPartyEventLogger-C0q45h_4.js +3 -0
  93. package/dist/chunks/firstPartyEventLogger-CP8hCBDj.js +1 -0
  94. package/dist/chunks/gemini-BC9kHhwe.js +2 -0
  95. package/dist/chunks/generateSessionName-ChvKBVxB.js +1 -0
  96. package/dist/chunks/{genericProcessUtils-Cnyun_Wr.js → genericProcessUtils-BYi0OefF.js} +1 -1
  97. package/dist/chunks/goal-ByyimpVU.js +3 -0
  98. package/dist/chunks/grok-DenjixMl.js +1 -0
  99. package/dist/chunks/grove-Dq8QbQ9o.js +7 -0
  100. package/dist/chunks/help-CK90i4hE.js +1 -0
  101. package/dist/chunks/history-CNQNd6hT.js +1 -0
  102. package/dist/chunks/{hooks-BDgToO1Z.js → hooks-BRFDg9DV.js} +2 -2
  103. package/dist/chunks/hooks-BaYwmkxD.js +1 -0
  104. package/dist/chunks/install-ZMll-dAa.js +1 -0
  105. package/dist/chunks/instrumentation-BwVyvRfY.js +21 -0
  106. package/dist/chunks/{job-DYMfSglZ.js → job-G_ukhLc4.js} +1 -1
  107. package/dist/chunks/keybindings-wNxBzDVQ.js +1 -0
  108. package/dist/chunks/launchLocalMemory-BcRlXLm6.js +3 -0
  109. package/dist/chunks/launchOnboarding-CDjQ64RO.js +8 -0
  110. package/dist/chunks/{loadAgentsDir-C96o6gCj.js → loadAgentsDir-C1LkW7gl.js} +551 -621
  111. package/dist/chunks/loadAgentsDir-DKXap_Om.js +1 -0
  112. package/dist/chunks/{loadPluginHooks-0nGlugZ4.js → loadPluginHooks-DtmHtEiS.js} +1 -1
  113. package/dist/chunks/{loader-C33o_5kS.js → loader-C61fB6vU.js} +1 -1
  114. package/dist/chunks/localSearch-BB9x5C2N.js +1 -0
  115. package/dist/chunks/{localSearch-DLz5IGGu.js → localSearch-DFo_WTMm.js} +1 -1
  116. package/dist/chunks/log-DaILwWJa.js +1 -0
  117. package/dist/chunks/logoUtils-Dj_2SWmO.js +1 -0
  118. package/dist/chunks/{magicDocs-DmPNMnNY.js → magicDocs-DYc9TFmI.js} +2 -2
  119. package/dist/chunks/main-BRg8L_aw.js +346 -0
  120. package/dist/chunks/managedEnv-DsqAYOJ4.js +1 -0
  121. package/dist/chunks/managedEnv-lybrMred.js +1 -0
  122. package/dist/chunks/mcp-Bsw3cMiJ.js +6 -0
  123. package/dist/chunks/mcp-DDdud6Y7.js +1 -0
  124. package/dist/chunks/mcp-DbgTDUt7.js +2 -0
  125. package/dist/chunks/memory-CzwTzihf.js +1 -0
  126. package/dist/chunks/mode-Pan-Q2c4.js +2 -0
  127. package/dist/chunks/model-BYfmXKHf.js +1 -0
  128. package/dist/chunks/model-BwBE0Pt5.js +1 -0
  129. package/dist/chunks/modelOptions-DvNBapgG.js +1 -0
  130. package/dist/chunks/nativeInstaller-DnSNJWIi.js +1 -0
  131. package/dist/chunks/notifications-B0DTaYoy.js +1 -0
  132. package/dist/chunks/omit-Dl1Us_PY.js +1 -0
  133. package/dist/chunks/onChangeAppState-4KOJMN82.js +1 -0
  134. package/dist/chunks/openai-C_6C1_0N.js +10 -0
  135. package/dist/chunks/overlayContext-CMV7nYR9.js +1 -0
  136. package/dist/chunks/{panel-Cm23FDVt.js → panel-D9fGQgln.js} +1 -1
  137. package/dist/chunks/parser-BKAVMTyD.js +1 -0
  138. package/dist/chunks/{parser-eVu-cTRs.js → parser-D8slvrJP.js} +1 -1
  139. package/dist/chunks/partition-B504IgAa.js +1 -0
  140. package/dist/chunks/pasteStore-DNV1M5Xd.js +1 -0
  141. package/dist/chunks/permissions-CLFMhdRk.js +3 -0
  142. package/dist/chunks/pidLock-D9do1Afy.js +3 -0
  143. package/dist/chunks/{plan-s228H7IU.js → plan-CQLnPLuE.js} +1 -1
  144. package/dist/chunks/{platform-DMQxcm4K.js → platform-Dzff1WWw.js} +1 -1
  145. package/dist/chunks/plugin-BYdF7uob.js +17 -0
  146. package/dist/chunks/{pluginAutoupdate-aLXhSUVD.js → pluginAutoupdate-BJaAqwTH.js} +1 -1
  147. package/dist/chunks/{pluginBlocklist-BprCv0En.js → pluginBlocklist-DKKmOnWM.js} +1 -1
  148. package/dist/chunks/pluginCliCommands-z8TtJMKH.js +1 -0
  149. package/dist/chunks/{pluginFlagging-BSLuTk3M.js → pluginFlagging-DQP8tBi2.js} +1 -1
  150. package/dist/chunks/pluginOperations-BcfJCDco.js +2 -0
  151. package/dist/chunks/{pluginStartupCheck-xQbHZ5gf.js → pluginStartupCheck-CfRvCrFg.js} +1 -1
  152. package/dist/chunks/pluginStartupCheck-Cq4PvULa.js +1 -0
  153. package/dist/chunks/plugins-CTM8jpOw.js +4 -0
  154. package/dist/chunks/policyLimits-a7ix6GnU.js +1 -0
  155. package/dist/chunks/poorMode-C11JEH3d.js +1 -0
  156. package/dist/chunks/{poorMode-Bt_A2arj.js → poorMode-J5SYJvoY.js} +1 -1
  157. package/dist/chunks/print-u6MzL5Cr.js +13 -0
  158. package/dist/chunks/processBashCommand-DIwrI2QC.js +1 -0
  159. package/dist/chunks/processSlashCommand-B-Gujpxm.js +5 -0
  160. package/dist/chunks/projectOnboardingState-CJycxw5P.js +1 -0
  161. package/dist/chunks/{prompt-BNNE5tsG.js → prompt-BGqgPgCU.js} +3 -3
  162. package/dist/chunks/prompt-BPJDGlx5.js +1 -0
  163. package/dist/chunks/prompt-DEdZzkEz.js +1 -0
  164. package/dist/chunks/promptEditor-CmQ9p4oe.js +4 -0
  165. package/dist/chunks/{protocolHandler-DukQ6b4Q.js → protocolHandler-CJo9-PfZ.js} +2 -2
  166. package/dist/chunks/{proxy-BhIc7-mj.js → proxy-CB17QimU.js} +2 -2
  167. package/dist/chunks/reconciler-DSKLuOS7.js +1 -0
  168. package/dist/chunks/refresh-BbZFCNpn.js +1 -0
  169. package/dist/chunks/registerProtocol-CLIpzVwF.js +1 -0
  170. package/dist/chunks/reload-plugins-DjugL8jH.js +1 -0
  171. package/dist/chunks/rename-DOtCOtEr.js +1 -0
  172. package/dist/chunks/{renderOptions-D-aQZbzS.js → renderOptions-Zqfm2U1y.js} +1 -1
  173. package/dist/chunks/resume-BB4T4WIV.js +2 -0
  174. package/dist/chunks/ripgrep-BuzOTf1S.js +5 -0
  175. package/dist/chunks/ripgrep-CZ2CqaHb.js +1 -0
  176. package/dist/chunks/{runtimeObserver-DS1PK6We.js → runtimeObserver-CK_iZ6OB.js} +1 -1
  177. package/dist/chunks/{runtimeObserver-CsZw5XBt.js → runtimeObserver-CpP0L9T9.js} +4 -4
  178. package/dist/chunks/sandbox-adapter-DhJJ6WOV.js +1 -0
  179. package/dist/chunks/sandbox-toggle-KOHYvbQT.js +1 -0
  180. package/dist/chunks/searchExtraTools-CdJghGkj.js +1 -0
  181. package/dist/chunks/select-C_KXmqbI.js +1 -0
  182. package/dist/chunks/sessionFileAccessHooks-D7KbWFp7.js +1 -0
  183. package/dist/chunks/sessionObserver-DB-sLv-X.js +1 -0
  184. package/dist/chunks/{sessionObserver-N7fORFdL.js → sessionObserver-WOYv2n7C.js} +2 -2
  185. package/dist/chunks/sessionStorage-sgOAbDn7.js +1 -0
  186. package/dist/chunks/{sessionTracing-fIp8g04N.js → sessionTracing-yBre24PH.js} +2 -2
  187. package/dist/chunks/settings-C-KNkvsM.js +1 -0
  188. package/dist/chunks/settings-DKN4xSpQ.js +24 -0
  189. package/dist/chunks/setup-CN_Pk7AR.js +3 -0
  190. package/dist/chunks/{shadowedRuleDetection-DEo1hvGi.js → shadowedRuleDetection-Df-kZ_pK.js} +1 -1
  191. package/dist/chunks/{sideQuestion-C11KgNGL.js → sideQuestion-CMB8hfgX.js} +3 -3
  192. package/dist/chunks/sinks-BS17vtN0.js +1 -0
  193. package/dist/chunks/sinks-D1EjkHb4.js +1 -0
  194. package/dist/chunks/skillChangeDetector-CBKuGuEi.js +1 -0
  195. package/dist/chunks/{skillGapStore-H4MkUFUY.js → skillGapStore-CfmlO6pb.js} +2 -2
  196. package/dist/chunks/{skillLifecycle-ADUTDK7D.js → skillLifecycle-BQ2LMfMx.js} +2 -2
  197. package/dist/chunks/{skillSearchPanel-PpfVDMGR.js → skillSearchPanel-BwYuwLFs.js} +4 -4
  198. package/dist/chunks/skills-BVHPQma0.js +1 -0
  199. package/dist/chunks/startupProfiler-B_U4QDtf.js +1 -0
  200. package/dist/chunks/startupProfiler-DTs9w9EN.js +3 -0
  201. package/dist/chunks/{state-D5D6QpTX.js → state-BowF111d.js} +1 -1
  202. package/dist/chunks/state-CGuyDES7.js +1 -0
  203. package/dist/chunks/status-BurdTfyz.js +2 -0
  204. package/dist/chunks/status-DMq1An5h.js +1 -0
  205. package/dist/chunks/statusNoticeHelpers-X75JNlx5.js +1 -0
  206. package/dist/chunks/stringUtils-BQm3OfeJ.js +4 -0
  207. package/dist/chunks/{switcher-DWfKi17X.js → switcher-Bq1Ct_Sn.js} +1 -1
  208. package/dist/chunks/switcher-DGD4ORVf.js +1 -0
  209. package/dist/chunks/{tasks-BwSsj2vI.js → tasks-0c8Uy04D.js} +1 -1
  210. package/dist/chunks/tempfile-CHO5wXsV.js +1 -0
  211. package/dist/chunks/{templateJobs-fiKuu4DK.js → templateJobs-BdFzE9XG.js} +1 -1
  212. package/dist/chunks/terminalSetup-Cf_r6pwK.js +32 -0
  213. package/dist/chunks/{terminalSetup-Cte5a4hM.js → terminalSetup-D7J6bxcn.js} +1 -1
  214. package/dist/chunks/{theme-CAoGjf2D.js → theme-Bby4fssR.js} +1 -1
  215. package/dist/chunks/tipRegistry-CyRXWWTz.js +2 -0
  216. package/dist/chunks/{toolEventObserver-Cq_ZV7x9.js → toolEventObserver-CzFZUIsM.js} +1 -1
  217. package/dist/chunks/toolPool-CnrZcprA.js +1 -0
  218. package/dist/chunks/types-zk5Ltv5q.js +81 -0
  219. package/dist/chunks/udsClient-ftP0yIpe.js +1 -0
  220. package/dist/chunks/use-select-navigation-DMaC_3iw.js +1 -0
  221. package/dist/chunks/useDoublePress-C9xxQzh1.js +1 -0
  222. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CjW3gUOt.js +1 -0
  223. package/dist/chunks/useMainLoopModel-DWscpA9I.js +1 -0
  224. package/dist/chunks/useManagePlugins-CYXVcql2.js +1 -0
  225. package/dist/chunks/useMergedTools-DarmnCEw.js +1 -0
  226. package/dist/chunks/useSearchInput-C2JuUW3g.js +1 -0
  227. package/dist/chunks/useSettingsErrors-DutJBiKZ.js +1 -0
  228. package/dist/chunks/util-Bq5l7FF5.js +1 -0
  229. package/dist/chunks/validatePlugin-DIdEydz_.js +1 -0
  230. package/dist/chunks/{vim-xruiCyUd.js → vim-D8prM2IH.js} +1 -1
  231. package/dist/chunks/worktree-Caqt2WRZ.js +1 -0
  232. package/dist/cli.js +1 -1
  233. package/package.json +1 -1
  234. package/dist/chunks/AddWorkspaceDirectory-DgAxYgBY.js +0 -1
  235. package/dist/chunks/AgentsMdExternalIncludesDialog-DGMRVexR.js +0 -1
  236. package/dist/chunks/AgentsMdExternalIncludesDialog-Dp6CwZyI.js +0 -1
  237. package/dist/chunks/App-VWyPd524.js +0 -1
  238. package/dist/chunks/ApproveApiKey-Bolw0sPs.js +0 -1
  239. package/dist/chunks/ApproveApiKey-CyNPMd6g.js +0 -1
  240. package/dist/chunks/BackgroundTasksDialog-DxagIOOw.js +0 -2
  241. package/dist/chunks/BypassPermissionsModeDialog-OS2S66zQ.js +0 -1
  242. package/dist/chunks/DiffDialog-CMtml9iw.js +0 -6
  243. package/dist/chunks/Doctor-Bk9P37mU.js +0 -1
  244. package/dist/chunks/Doctor-D9F3tKsr.js +0 -3
  245. package/dist/chunks/ExitFlow-DhRv5JPj.js +0 -2
  246. package/dist/chunks/Grove-Bbh8PpH0.js +0 -11
  247. package/dist/chunks/HybridTransport-P1vEUwhv.js +0 -2
  248. package/dist/chunks/InvalidConfigDialog-xAYpE-20.js +0 -1
  249. package/dist/chunks/InvalidSettingsDialog-CXFSISy3.js +0 -1
  250. package/dist/chunks/MCPConnectionManager-CoId-C__.js +0 -1
  251. package/dist/chunks/MCPToolListView-BQkQ-hyF.js +0 -1
  252. package/dist/chunks/MessageSelector-BvRVrfg6.js +0 -3
  253. package/dist/chunks/Messages-Cykztq1O.js +0 -10
  254. package/dist/chunks/Onboarding-CfeRwPNQ.js +0 -1
  255. package/dist/chunks/PromptInputHelpMenu-Ckp0k8E3.js +0 -1
  256. package/dist/chunks/QueryEngine-DduzztIG.js +0 -1
  257. package/dist/chunks/REPL-B8e5UU3H.js +0 -128
  258. package/dist/chunks/REPL-C4mbOhyL.js +0 -1
  259. package/dist/chunks/RemoteSessionManager-BPESC6Wu.js +0 -2
  260. package/dist/chunks/ResumeConversation-DG1sLryB.js +0 -1
  261. package/dist/chunks/SSETransport-CDNP2PlK.js +0 -2
  262. package/dist/chunks/SearchExtraToolsTool-vK2PP628.js +0 -1
  263. package/dist/chunks/Settings-B7n_dfP-.js +0 -2
  264. package/dist/chunks/TeleportProgress-QL3ibQfK.js +0 -1
  265. package/dist/chunks/TeleportRepoMismatchDialog-f-xl7biD.js +0 -1
  266. package/dist/chunks/TeleportResumeWrapper-DzVcrFuP.js +0 -1
  267. package/dist/chunks/ThemePicker-CIFKZza0.js +0 -1
  268. package/dist/chunks/TrustDialog-C0HEwZPk.js +0 -1
  269. package/dist/chunks/add-dir-DmEhPnvj.js +0 -1
  270. package/dist/chunks/agents-D96ng5I9.js +0 -101
  271. package/dist/chunks/allErrors-CT2dbBF3.js +0 -1
  272. package/dist/chunks/api-DTyrmy1O.js +0 -1
  273. package/dist/chunks/api-DumFOErN.js +0 -1
  274. package/dist/chunks/auth-CZ4EsFWF.js +0 -10
  275. package/dist/chunks/auth-QvonHoG9.js +0 -1
  276. package/dist/chunks/auth-jV5THRH8.js +0 -1
  277. package/dist/chunks/backgroundHousekeeping-C72oPgfD.js +0 -17
  278. package/dist/chunks/backgroundHousekeeping-D9PScHES.js +0 -1
  279. package/dist/chunks/banner-ChT5Ri7Q.js +0 -2
  280. package/dist/chunks/bg-qG2osBbP.js +0 -9
  281. package/dist/chunks/branch-K8X6jx0i.js +0 -2
  282. package/dist/chunks/bridgeConfig-C-bI-slm.js +0 -1
  283. package/dist/chunks/bridgeConfig-_xpxhGB5.js +0 -1
  284. package/dist/chunks/bridgeMessaging-DSJlYarJ.js +0 -1
  285. package/dist/chunks/bridgePointer-DfTOjgtX.js +0 -1
  286. package/dist/chunks/bridgeStatusUtil-DaEq5c69.js +0 -1
  287. package/dist/chunks/btw-BNs5OX7x.js +0 -1
  288. package/dist/chunks/bundledMode--fG1S62b.js +0 -1
  289. package/dist/chunks/caches-CC5NHwAz.js +0 -1
  290. package/dist/chunks/caches-nHxJWXgO.js +0 -1
  291. package/dist/chunks/capacityWake-BpP6c7x3.js +0 -3
  292. package/dist/chunks/ccrClient-JnhF5b3z.js +0 -1
  293. package/dist/chunks/claudeDesktop-DPc_SaVn.js +0 -1
  294. package/dist/chunks/cliLaunch-DDtwAolw.js +0 -1
  295. package/dist/chunks/client-9uHzAmFH.js +0 -1
  296. package/dist/chunks/client-BVal_QII.js +0 -1
  297. package/dist/chunks/client-BtTkq0YS.js +0 -1
  298. package/dist/chunks/client-Dd7CKMRX.js +0 -1
  299. package/dist/chunks/commands-C_rYjyQZ.js +0 -1
  300. package/dist/chunks/compact-Cqd6vKpn.js +0 -2
  301. package/dist/chunks/config-Be0BkAAr.js +0 -1
  302. package/dist/chunks/config-DUTgj3js.js +0 -3
  303. package/dist/chunks/config-DoEDgAfv.js +0 -1
  304. package/dist/chunks/context-noninteractive-D9tJYwi7.js +0 -1
  305. package/dist/chunks/controlMessageCompat-IFu4Gc1y.js +0 -1
  306. package/dist/chunks/conversation-DWfE4KGH.js +0 -1
  307. package/dist/chunks/conversation-Tvo4EDpQ.js +0 -1
  308. package/dist/chunks/createSSHSession-BQ83MMtr.js +0 -5
  309. package/dist/chunks/createSession-CqHnHhCR.js +0 -1
  310. package/dist/chunks/createSession-DqTtBycR.js +0 -1
  311. package/dist/chunks/crossProjectResume-DIXtiODF.js +0 -40
  312. package/dist/chunks/cwd-DLK3znO7.js +0 -1
  313. package/dist/chunks/cwd-Nh5IZNKO.js +0 -1
  314. package/dist/chunks/debugUtils-DXBRbwCE.js +0 -1
  315. package/dist/chunks/detached-Biz-xhu0.js +0 -4
  316. package/dist/chunks/detectRepository-DUJBh5s2.js +0 -1
  317. package/dist/chunks/detectRepository-pRAVv8SH.js +0 -1
  318. package/dist/chunks/directoryCompletion-CuA3_YIT.js +0 -1
  319. package/dist/chunks/doctor-eNAm6OiS.js +0 -1
  320. package/dist/chunks/entry-DidpiR-D.js +0 -13
  321. package/dist/chunks/esm-BCUC71kt.js +0 -1
  322. package/dist/chunks/execSyncWrapper-C3ZFV9od.js +0 -1
  323. package/dist/chunks/exit-DywUeiYd.js +0 -1
  324. package/dist/chunks/extraUsage-DiAirtuk.js +0 -1
  325. package/dist/chunks/extractMemories-_xiTnX95.js +0 -1
  326. package/dist/chunks/fast-DCXZACT9.js +0 -1
  327. package/dist/chunks/fast-Qo4WVqiW.js +0 -1
  328. package/dist/chunks/fetchModelList-fQDsmR3E.js +0 -1
  329. package/dist/chunks/fetchModelList-woVzIVde.js +0 -1
  330. package/dist/chunks/fileSuggestions-CRx1D6uk.js +0 -3
  331. package/dist/chunks/firstPartyEventLogger-B261Wksn.js +0 -3
  332. package/dist/chunks/firstPartyEventLogger-DtFTeHy-.js +0 -1
  333. package/dist/chunks/flushGate-BA8dSr0i.js +0 -1
  334. package/dist/chunks/gemini-BXAyy1JN.js +0 -1
  335. package/dist/chunks/generateSessionName-Cwmk2N3F.js +0 -1
  336. package/dist/chunks/git-Wid-XppW.js +0 -5
  337. package/dist/chunks/git-hO-TMvXc.js +0 -1
  338. package/dist/chunks/githubRepoPathMapping-OV8U1VFK.js +0 -1
  339. package/dist/chunks/goal-C9clrwEH.js +0 -3
  340. package/dist/chunks/grok-CjeCecsZ.js +0 -1
  341. package/dist/chunks/grove-DqTnK9nn.js +0 -7
  342. package/dist/chunks/hash-Tu-My5Vp.js +0 -1
  343. package/dist/chunks/help-Bb6LdzXK.js +0 -1
  344. package/dist/chunks/hooks-BX2s7aoL.js +0 -1
  345. package/dist/chunks/initReplBridge-D7cuY_os.js +0 -1
  346. package/dist/chunks/install-eCA8UACi.js +0 -1
  347. package/dist/chunks/instrumentation-BaRKojJh.js +0 -21
  348. package/dist/chunks/jwtUtils-JE2okZ70.js +0 -1
  349. package/dist/chunks/keybindings-iBqc1KHL.js +0 -1
  350. package/dist/chunks/launchLocalMemory-IZPGEzMk.js +0 -3
  351. package/dist/chunks/launchOnboarding-BeNf51Ig.js +0 -8
  352. package/dist/chunks/lazySchema-DULtBUCI.js +0 -65
  353. package/dist/chunks/lib-BlVGipXx.js +0 -14
  354. package/dist/chunks/loadAgentsDir-Bpke9CtB.js +0 -1
  355. package/dist/chunks/localSearch-dodgnjGn.js +0 -1
  356. package/dist/chunks/log-CZ7ploQm.js +0 -1
  357. package/dist/chunks/logoUtils-Cg_6QV1Z.js +0 -1
  358. package/dist/chunks/main-7ssnA9Yb.js +0 -31
  359. package/dist/chunks/main-BEv6MqMX.js +0 -356
  360. package/dist/chunks/managedEnv-CHYvwXBH.js +0 -1
  361. package/dist/chunks/managedEnv-CbjOQmEe.js +0 -1
  362. package/dist/chunks/mappers-D8VLUZ2N.js +0 -1
  363. package/dist/chunks/mcp-BUn3yqsT.js +0 -1
  364. package/dist/chunks/mcp-BskLq9iP.js +0 -2
  365. package/dist/chunks/mcp-C-0DMaXx.js +0 -6
  366. package/dist/chunks/memoize-CumjjK2Q.js +0 -1
  367. package/dist/chunks/memory-vDkJM58W.js +0 -1
  368. package/dist/chunks/mode-Dbh21H2Y.js +0 -2
  369. package/dist/chunks/model-BaMclMXn.js +0 -1
  370. package/dist/chunks/model-atn3_JBi.js +0 -1
  371. package/dist/chunks/model-vS1Iewyq.js +0 -1
  372. package/dist/chunks/modelOptions-Cw1ThINb.js +0 -1
  373. package/dist/chunks/nativeInstaller-CfZ5uNTh.js +0 -1
  374. package/dist/chunks/oauth-D38aRTUb.js +0 -1
  375. package/dist/chunks/oauth-U649LV5H.js +0 -1
  376. package/dist/chunks/omit-B7eQ9q0x.js +0 -1
  377. package/dist/chunks/onChangeAppState-kEAt8nxV.js +0 -1
  378. package/dist/chunks/openai-wh8AX5iz.js +0 -10
  379. package/dist/chunks/parser-Cq9X7HMP.js +0 -1
  380. package/dist/chunks/partition-CENvOfiS.js +0 -1
  381. package/dist/chunks/permissions-ChuIx-d4.js +0 -3
  382. package/dist/chunks/pidLock-C1hmh3YQ.js +0 -3
  383. package/dist/chunks/plugin-DVBEWwMP.js +0 -17
  384. package/dist/chunks/pluginCliCommands-WzzqR1Sr.js +0 -1
  385. package/dist/chunks/pluginOperations-Ca9Lup5G.js +0 -2
  386. package/dist/chunks/pluginStartupCheck-DdtxcNwH.js +0 -1
  387. package/dist/chunks/plugins-DdIaXpNb.js +0 -4
  388. package/dist/chunks/pollConfig-2nFzv6Hy.js +0 -1
  389. package/dist/chunks/poorMode-ZIq2oz7q.js +0 -1
  390. package/dist/chunks/print-vxrRE1O2.js +0 -14
  391. package/dist/chunks/processBashCommand-ISucgwpi.js +0 -1
  392. package/dist/chunks/processSlashCommand-BnpXO_fI.js +0 -5
  393. package/dist/chunks/prompt-2AA5W7EH.js +0 -1
  394. package/dist/chunks/prompt-AXiS2LoO.js +0 -1
  395. package/dist/chunks/promptEditor-DT6egmcb.js +0 -4
  396. package/dist/chunks/rcDebugLog-DSchf3Hs.js +0 -1
  397. package/dist/chunks/reconciler-D3zyJCnV.js +0 -1
  398. package/dist/chunks/refresh-BSG0t4cf.js +0 -1
  399. package/dist/chunks/registerProtocol-BOEYaX-X.js +0 -1
  400. package/dist/chunks/reload-plugins-BFMRhbv8.js +0 -1
  401. package/dist/chunks/remoteBridgeCore-D5OwvmAz.js +0 -1
  402. package/dist/chunks/remoteManagedSettings-DyGVvvcW.js +0 -1
  403. package/dist/chunks/rename-BrEwj3Xw.js +0 -1
  404. package/dist/chunks/resume-DR5JbICs.js +0 -2
  405. package/dist/chunks/ripgrep-Dt4a91S5.js +0 -5
  406. package/dist/chunks/ripgrep-KTOU5s9J.js +0 -1
  407. package/dist/chunks/sandbox-adapter-BqDyWcol.js +0 -1
  408. package/dist/chunks/sandbox-toggle-B9f_0NQI.js +0 -1
  409. package/dist/chunks/searchExtraTools-2pIT2C8u.js +0 -1
  410. package/dist/chunks/session-wkRTfdo8.js +0 -2
  411. package/dist/chunks/sessionFileAccessHooks-DV22q9JO.js +0 -1
  412. package/dist/chunks/sessionIdCompat-Dgp6PW_1.js +0 -1
  413. package/dist/chunks/sessionObserver-BLJg0qm_.js +0 -1
  414. package/dist/chunks/sessionState-8jutEorw.js +0 -11
  415. package/dist/chunks/sessionStorage-DRV7IhZF.js +0 -1
  416. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +0 -3
  417. package/dist/chunks/settings-BowI3jp-.js +0 -19
  418. package/dist/chunks/settings-CHn0gJCG.js +0 -1
  419. package/dist/chunks/settingsSync-DF4JgSNc.js +0 -1
  420. package/dist/chunks/setup-UiEO9i7F.js +0 -3
  421. package/dist/chunks/shellQuote-Ddgr1vif.js +0 -4
  422. package/dist/chunks/sinks-DnLqRPEC.js +0 -1
  423. package/dist/chunks/sinks-mGBiINp8.js +0 -1
  424. package/dist/chunks/skillChangeDetector-Dc6YZXJE.js +0 -1
  425. package/dist/chunks/skills-DKtN17ch.js +0 -1
  426. package/dist/chunks/startupProfiler-B90b5vuq.js +0 -3
  427. package/dist/chunks/startupProfiler-DG2TN5R_.js +0 -1
  428. package/dist/chunks/state-BStOuCh4.js +0 -1
  429. package/dist/chunks/stats-D4LEtkrw.js +0 -1
  430. package/dist/chunks/status-0ZBx6Ls0.js +0 -2
  431. package/dist/chunks/status-BUJ4-omB.js +0 -1
  432. package/dist/chunks/statusNoticeHelpers-BrpQWj0l.js +0 -1
  433. package/dist/chunks/stringUtils-D7oJIyY2.js +0 -4
  434. package/dist/chunks/subprocessEnv-CNBOhlDV.js +0 -1
  435. package/dist/chunks/subprocessEnv-DtBCqQIo.js +0 -1
  436. package/dist/chunks/switcher-D7Ey5uIi.js +0 -1
  437. package/dist/chunks/syncCache-DUhciJLz.js +0 -1
  438. package/dist/chunks/teleport-DwZMevmQ.js +0 -1
  439. package/dist/chunks/terminalSetup-a7-BNS4T.js +0 -32
  440. package/dist/chunks/tmux-DA06aewY.js +0 -1
  441. package/dist/chunks/toolPool-mdsxlKWR.js +0 -1
  442. package/dist/chunks/trustedDevice-C1m--Yjw.js +0 -1
  443. package/dist/chunks/trustedDevice-CeDIk_ln.js +0 -1
  444. package/dist/chunks/types-APu4OCXJ.js +0 -17
  445. package/dist/chunks/udsClient-BcwsY0XE.js +0 -1
  446. package/dist/chunks/upstreamproxy-CTOuotLO.js +0 -10
  447. package/dist/chunks/useExitOnCtrlCDWithKeybindings-L5idX6Kz.js +0 -1
  448. package/dist/chunks/useMainLoopModel-VXeS2EC6.js +0 -1
  449. package/dist/chunks/useManagePlugins-CAXp5CfH.js +0 -1
  450. package/dist/chunks/useMergedTools-DYXrPTIA.js +0 -1
  451. package/dist/chunks/useSearchInput-Bxl4wGcZ.js +0 -1
  452. package/dist/chunks/useSettingsErrors-sbjsaT7k.js +0 -1
  453. package/dist/chunks/userAgent-NbKd-hN7.js +0 -1
  454. package/dist/chunks/util-DU63xTwZ.js +0 -1
  455. package/dist/chunks/validatePlugin-DQ_9OCpP.js +0 -1
  456. package/dist/chunks/which-B8rchd8P.js +0 -1
  457. package/dist/chunks/windowsPaths-BdhjMYTm.js +0 -1
  458. package/dist/chunks/windowsPaths-DtGZ83kH.js +0 -1
  459. package/dist/chunks/workSecret-CaM2yIJD.js +0 -1
  460. package/dist/chunks/workerRegistry-BBgquE8F.js +0 -2
  461. package/dist/chunks/worktree-C28I8mFB.js +0 -1
@@ -0,0 +1,3 @@
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,mt as ne,n as re,o as ie,pt as ae,t as oe,v as se,w as m}from"./esm-BQY8jJNR.js";import{n as h,t as ce}from"./axios-DaWTGg7G.js";import{d as le,l as ue}from"./types-zk5Ltv5q.js";import{L as de,ut as g,zt as _}from"./state-BowF111d.js";import{n as fe,t as pe}from"./cwd-BcO6WHKo.js";import{B as me,C as v,H as he,L as ge,N as _e,x as ve}from"./debug-8DCufdSp.js";import{Gt as ye,qt as be}from"./settings-DKN4xSpQ.js";import{c as xe,d as y,m as b,n as Se}from"./config-BddEvZZl.js";import{a as Ce,s as we}from"./execFileNoThrow-BsfuytkN.js";import{d as Te,o as Ee,p as x,s as S}from"./log-DaILwWJa.js";import{a as De,i as Oe,o as ke}from"./platform-Dzff1WWw.js";import{i as Ae,n as je}from"./analytics-DJobLaWP.js";import{n as Me,r as C}from"./startupProfiler-DTs9w9EN.js";import{$n as Ne,Cn as Pe,En as Fe,Ht as Ie,St as w,Tt as Le,Vt as Re,_t as ze,er as Be,ht as T,pt as Ve,xt as He,yt as Ue}from"./model-BwBE0Pt5.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(),Te()}));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((()=>{we(),n(),_(),w(),b(),fe(),be(),a(),M=null,N=null,P=t(e=>{let t=y(),n=xe(),r,a,o;if(e&&(r=Ue()??void 0,a=ze()??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:g(),email:Xe(),appVersion:`0.0.22`,platform:ye(),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 Ce(`git config --get user.email`,{shell:!0,reject:!1,cwd:pe()});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 _e(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,X,lt=e((()=>{se(),ce(),_(),st(),w(),b(),a(),ge(),Fe(),ue(),Ee(),Re(),ve(),ne(),Ne(),je(),p(),o(),J=D(),Y=`1p_failed_events.`,X=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}${g()}.${J}.json`)}async loadEventsFromFile(e){try{return await le(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}${g()}.`,t;try{t=(await Ge(q())).filter(t=>t.startsWith(e)&&t.endsWith(`.json`)).filter(e=>!e.includes(J))}catch(e){if(me(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:he(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 Ie(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":ae(),"x-service-name":`workmate`},n=Se()||de(),r=this.skipAuth||!n;if(!r&&Le()){let e=Ve();He()?e&&Be(e.expiresAt)&&(r=!0):r=!0}let i=r?{headers:{},error:`trust not established or Oauth token expired`}:Pe(),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:g(),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=Ae(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 ut(e){return!1}var dt=e((()=>{}));function ft(){return{}}function pt(e){let t=ft()[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 mt(){if($)try{await $.shutdown()}catch{}}function Z(){return!A()}async function ht(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 gt(e,t={}){Z()&&(!Q||ut(`firstParty`)||ht(Q,e,t))}function _t(){if(C(`1p_event_logging_start`),!Z())return;C(`1p_event_after_config`);let e=parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||vt.toString(),10),t=yt,n=bt,r=Oe(),i={[c]:`workmate`,[u]:`0.0.22`};if(r===`wsl`){let e=De();e&&(i[`wsl.version`]=e)}$=new ie({resource:f(i),processors:[new re(new X({maxBatchSize:t,isKilled:()=>ut(`firstParty`)}),{scheduledDelayMillis:e,maxExportBatchSize:t,maxQueueSize:n})]}),Q=$.getLogger(`com.anthropic.claude_code.events`,`0.0.22`)}var vt,yt,bt,Q,$,xt=e((()=>{ee(),oe(),l(),b(),ke(),Me(),I(),j(),lt(),p(),dt(),vt=1e4,yt=200,bt=8192,Q=null,$=null}));export{gt as a,F as c,Ye as d,j as f,Z as i,Je as l,qe as m,xt as n,pt as o,A as p,_t as r,mt as s,ft as t,I as u};
@@ -0,0 +1 @@
1
+ import{n as e,r as t}from"./firstPartyEventLogger-C0q45h_4.js";e();export{t as initialize1PEventLogging};
@@ -0,0 +1,2 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{AC as t,CC as n,DC as r,NS as i,SC as a,TC as o,Zi as s,bC as c,da as l,it as u,lC as d,pa as f,tt as p}from"./loadAgentsDir-C1LkW7gl.js";import{L as m,N as h,c as g,i as _}from"./debug-8DCufdSp.js";import{c as v,i as y}from"./proxy-CB17QimU.js";import{randomUUID as b}from"crypto";function x(e){let t=[],n=0,r=/\r?\n\r?\n/g;r.lastIndex=n;let i;for(;(i=r.exec(e))!==null;){let r=i.index,a=e.slice(n,r);if(n=r+i[0].length,!a.trim())continue;let o={};for(let e of a.split(`
2
+ `)){let t=e[e.length-1]===`\r`?e.slice(0,-1):e;if(t.startsWith(`:`))continue;let n=t.indexOf(`:`);if(n===-1)continue;let r=t.slice(0,n),i=t[n+1]===` `?t.slice(n+2):t.slice(n+1);r===`data`&&(o.data=o.data?`${o.data}\n${i}`:i)}o.data&&t.push(o)}return{frames:t,remaining:e.slice(n)}}function S(){return(process.env.GEMINI_BASE_URL||T).replace(/\/+$/,``)}function C(e){let t=e.replace(/^\/+/,``);return t.startsWith(`models/`)?t:`models/${t}`}async function*w(e){let t=await(e.fetchOverride??fetch)(`${S()}/${C(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,...y({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,E);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: ${h(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: ${h(e)}`)}}finally{n.releaseLock()}}var T,E,D=e((()=>{m(),v(),T=`https://generativelanguage.googleapis.com/v1beta`,E={stream:!0}}));async function*O(e,s,d,p,m,h){try{let i=t(m.model),_=f(e,d),v=(await Promise.all(d.map(e=>u(e,{getToolPermissionContext:m.getToolPermissionContext,tools:d,agents:m.agents,allowedAgentTypes:m.allowedAgentTypes,model:m.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),{contents:y,systemInstruction:x}=o(_,s),S=n(v),C=a(m.toolChoice),T=w({model:i,signal:p,fetchOverride:m.fetchOverride,body:{contents:y,...x&&{systemInstruction:x},...S.length>0&&{tools:S},...C&&{toolConfig:{functionCallingConfig:C}},generationConfig:{...m.temperatureOverride!==void 0&&{temperature:m.temperatureOverride},...h.type!==`disabled`&&{thinkingConfig:{includeThoughts:!0,...h.type===`enabled`&&{thinkingBudget:h.budgetTokens}}}}}});g(`[Gemini] Calling model=${i}, messages=${y.length}, tools=${S.length}`);let E=c(T,i),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,i=D[t];if(!i)break;n.type===`text_delta`?i.text=(i.text||``)+n.text:n.type===`input_json_delta`?i.input=(i.input||``)+n.partial_json:n.type===`thinking_delta`?i.thinking=(i.thinking||``)+n.thinking:n.type===`signature_delta`&&(i.type===`thinking`?i.signature=n.signature:i[r]=n.signature);break}case`content_block_stop`:{let t=D[e.index];if(!t||!O)break;yield{message:{...O,content:l([t],d,m.agentId)},requestId:void 0,type:`assistant`,uuid:b(),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);g(`[Gemini] Error: ${t}`,{level:`error`}),yield i({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{p(),_(),s(),D(),d()}))();export{O as queryModelGemini};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{FC as t,X as n,Z as r,Zg as i,Zi as a,wS as o}from"./loadAgentsDir-C1LkW7gl.js";import{f as s,l as c}from"./types-zk5Ltv5q.js";import{L as l,N as u,c as d,i as f}from"./debug-8DCufdSp.js";import{r as p,t as m}from"./sessionTitle-k4wpUS5l.js";async function h(e,n){let i=m(e);if(!i)return null;try{let e=await r({systemPrompt:t([`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:i,outputFormat:{type:`json_schema`,schema:{type:`object`,properties:{name:{type:`string`}},required:[`name`],additionalProperties:!1}},signal:n,options:{querySource:`rename_generate_name`,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,mcpTools:[]}}),a=s(Array.isArray(e.message.content)?o(e.message.content):e.message.content);return a&&typeof a==`object`&&`name`in a&&typeof a.name==`string`?a.name:null}catch(e){return d(`generateSessionName failed: ${u(e)}`,{level:`error`}),null}}var g=e((()=>{n(),f(),l(),c(),a(),p(),i()}));export{g as n,h as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-B_KRY4cT.js";function i(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}async function a(e,t=10){if(process.platform===`win32`){let r=await n(`powershell.exe`,[`-NoProfile`,`-Command`,`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,n,r}from"./execFileNoThrow-BsfuytkN.js";function i(e){if(e<=1)return!1;try{return process.kill(e,0),!0}catch{return!1}}async function a(e,t=10){if(process.platform===`win32`){let r=await n(`powershell.exe`,[`-NoProfile`,`-Command`,`
2
2
  $pid = ${String(e)}
3
3
  $ancestors = @()
4
4
  for ($i = 0; $i -lt ${t}; $i++) {
@@ -0,0 +1,3 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$c as t,Pg as n,Qc as r,Xc as i,Yc as a,Zc as o,al as s,cl as c,el as l,ll as u,nl as d,ol as f,rl as p,tl as m,ul as h,zg as g}from"./loadAgentsDir-C1LkW7gl.js";import{I as _,P as v,t as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{t as x}from"./select-C_KXmqbI.js";import{t as S}from"./CustomSelect-B46Eh0gU.js";import{n as C,t as w}from"./PermissionDialog-BaibiQae.js";function T({currentGoal:e,newObjective:t,onConfirm:n,onCancel:r}){function i(e){e===`yes`?n():r()}let a=e.tokenBudget===null?`${e.tokensUsed}`:`${e.tokensUsed} / ${e.tokenBudget}`;return(0,E.jsx)(w,{color:`warning`,title:`Replace active goal?`,children:(0,E.jsxs)(_,{flexDirection:`column`,marginTop:1,paddingX:1,children:[(0,E.jsx)(v,{children:`A goal is already in progress. Replacing it will reset all progress and counters.`}),(0,E.jsxs)(_,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(v,{dimColor:!0,children:`Current goal:`}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Objective: `}),e.objective]}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Status: `}),d(e.status)]}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Time: `}),m(e)]}),(0,E.jsxs)(v,{children:[(0,E.jsx)(v,{dimColor:!0,children:`· Tokens: `}),a]})]}),(0,E.jsxs)(_,{marginTop:1,flexDirection:`column`,children:[(0,E.jsx)(v,{dimColor:!0,children:`New objective:`}),(0,E.jsx)(v,{children:t})]}),(0,E.jsx)(_,{marginTop:1,children:(0,E.jsx)(x,{options:[{label:`Yes, replace the goal`,value:`yes`},{label:`No, keep the current goal`,value:`no`}],onChange:i,onCancel:r})})]})})}var E,D=e((()=>{y(),S(),C(),f(),E=b()}));function O(e){let t=e.split(`
2
+ `)[0]??e;return t.length<=F?t:`${t.slice(0,F)}…`}function k(){g(e=>e.origin===`goal-continuation`||e.origin===`goal-budget-limit`)}function A(){let e=p();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: ${d(e.status)}`,`Time: ${m(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),s(),i(),`Goal set.`}async function M(e,n,a){let s=a.trim();if(!s||s.toLowerCase()===`status`)return e(A(),{display:`system`}),null;let d=s.toLowerCase();if(d===`clear`){let t=r();return t&&(o(),k()),e(t?`Goal cleared.`:`No active goal to clear.`,{display:`system`}),null}if(d===`pause`){let t=c();return t&&(i(),k()),e(t?`Goal paused.`:`No active goal to pause.`,{display:`system`}),null}if(d===`resume`){if(p()?.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=u();return t&&i(),e(t?`Goal resumed.`:`No paused goal to resume.`,{display:`system`,shouldQuery:!!t}),null}if(d===`continue`){let t=l();return t&&i(),e(t?`Goal continuation counter reset (0/150). Continuing...`:`Current goal is not in max-turns state.`,{display:`system`,shouldQuery:!!t}),null}if(d===`complete`){let n=t();return n&&(i(),k()),e(n?`Goal marked complete.`:`No active goal to complete.`,{display:`system`}),null}if(s.length>P)return e(`Goal objective is too long (${s.length} chars; limit ${P}). Save the detailed instructions to a file and reference it from a shorter objective.`,{display:`system`}),null;let f=p();return f&&f.status!==`complete`?(0,N.jsx)(T,{currentGoal:f,newObjective:s,onConfirm:()=>{k(),e(j(s),{display:`system`,shouldQuery:!0,displayArgs:O(s),metaMessages:[`<goal-objective-updated>\n${s}\n</goal-objective-updated>`]})},onCancel:()=>{e(`Kept the current goal. New objective discarded.`,{display:`system`})}}):(e(j(s),{display:`system`,shouldQuery:!0,displayArgs:O(s),metaMessages:[`<goal-objective-updated>\n${s}\n</goal-objective-updated>`]}),null)}var N,P,F;e((()=>{f(),a(),n(),D(),N=b(),P=4e3,F=80}))();export{M as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{MC as t,NS as n,Zi as r,da as i,fC as a,hC as o,it as s,lC as c,o_ as l,pC as u,pa as d,tt as f,uC as p,u_ as m}from"./loadAgentsDir-C1LkW7gl.js";import{c as h,i as g}from"./debug-8DCufdSp.js";import{A as _,N as v}from"./model-BwBE0Pt5.js";import{n as y,t as b}from"./client-DvhWKIOx.js";import{n as x,t as S}from"./openaiShared-G2-w4gJt.js";import{randomUUID as C}from"crypto";async function*w(e,r,c,f,m){try{let n=t(m.model),g=d(e,c),v=(await Promise.all(c.map(e=>s(e,{getToolPermissionContext:m.getToolPermissionContext,tools:c,agents:m.agents,allowedAgentTypes:m.allowedAgentTypes,model:m.model})))).filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),y=o(g,r),S=u(v),w=a(m.toolChoice),T=b({maxRetries:0,fetchOverride:m.fetchOverride,source:m.querySource});h(`[Grok] Calling model=${n}, messages=${y.length}, tools=${S.length}`);let E=p(await T.chat.completions.create({model:n,messages:y,...S.length>0&&{tools:S,...w&&{tool_choice:w}},stream:!0,stream_options:{include_usage:!0},...m.temperatureOverride!==void 0&&{temperature:m.temperatureOverride}},{signal:f}),n),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:i([t],c,m.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&&l(_(n,k),k,m.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);h(`[Grok] Error: ${t}`,{level:`error`}),yield n({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{y(),S(),c(),r(),f(),g(),m(),v()}))();export{w as queryModelGrok};
@@ -0,0 +1,7 @@
1
+ import{n as e,t}from"./memoize-BK3gG5ob.js";import{mt as n,pt as r}from"./esm-BQY8jJNR.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{gi as o,vi as s}from"./loadAgentsDir-C1LkW7gl.js";import{c,i as l}from"./debug-8DCufdSp.js";import{en as u,tn as d}from"./settings-DKN4xSpQ.js";import{c as f,m as p,v as m}from"./config-BddEvZZl.js";import{a as h,n as g}from"./process-gEbdy6uY.js";import{d as _,f as v,o as y,s as b}from"./log-DaILwWJa.js";import{n as x,r as S}from"./analytics-DJobLaWP.js";import{Cn as C,Dn as w,En as T,Et as E,St as D,Tn as O,ht as k}from"./model-BwBE0Pt5.js";a(),t(),x(),D(),l(),s(),_(),g(),d(),p(),T(),y(),n();var A=1440*60*1e3,j=e(async()=>{if(v())return{success:!1};try{return{success:!0,data:(await w(()=>{let e=C();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return i.get(`${u().BASE_API_URL}/api/oauth/account/settings`,{headers:{...e.headers,"User-Agent":r()}})})).data}}catch(e){return b(e),j.cache.clear?.(),{success:!1}}});async function M(){try{await w(()=>{let e=C();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return i.post(`${u().BASE_API_URL}/api/oauth/account/grove_notice_viewed`,{},{headers:{...e.headers,"User-Agent":r()}})}),j.cache.clear?.()}catch(e){b(e)}}async function N(e){try{await w(()=>{let t=C();if(t.error)throw Error(`Failed to get auth headers: ${t.error}`);return i.patch(`${u().BASE_API_URL}/api/oauth/account/settings`,{grove_enabled:e},{headers:{...t.headers,"User-Agent":r()}})}),j.cache.clear?.()}catch(e){b(e)}}async function P(){if(!E())return!1;let e=k()?.accountUuid;if(!e)return!1;let t=f().groveConfigCache?.[e];return t?Date.now()-t.timestamp>A?(c(`Grove: Cache stale, returning cached data and refreshing in background`),F(e),t.grove_enabled):(c(`Grove: Using fresh cached config`),t.grove_enabled):(c(`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=f().groveConfigCache?.[e];if(r?.grove_enabled===n&&Date.now()-r.timestamp<=A)return;m(t=>({...t,groveConfigCache:{...t.groveConfigCache,[e]:{grove_enabled:n,timestamp:Date.now()}}}))}catch(e){c(`Grove: Failed to fetch and store config: ${e}`)}}var I=e(async()=>{if(v())return{success:!1};try{let{grove_enabled:e,domain_excluded:t,notice_is_grace_period:n,notice_reminder_frequency:r}=(await w(()=>{let e=C();if(e.error)throw Error(`Failed to get auth headers: ${e.error}`);return i.get(`${u().BASE_API_URL}/api/claude_code_grove`,{headers:{...e.headers,"User-Agent":O()},timeout:3e3})})).data;return{success:!0,data:{grove_enabled:e,domain_excluded:t??!1,notice_is_grace_period:n??!0,notice_reminder_frequency:r}}}catch(e){return c(`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;S(`tengu_grove_print_viewed`,{dismissable:e?.notice_is_grace_period}),e===null||e.notice_is_grace_period?(h(`
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()):(h(`
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 o(1))}}export{P as a,j as i,R as n,M as o,I as r,N as s,L as t};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Ci as n,Di as r,Gb as i,Pi as a,Ub as o,Wb as s,Yb as c}from"./loadAgentsDir-C1LkW7gl.js";import{I as l,Lt as u,P as d,Wt as f,a as p,ai as m,n as h,ot as g,r as _,t as v,x as y}from"./src-DL3w8VPk.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{v as x,y as S}from"./startupProfiler-DTs9w9EN.js";import{n as C,t as w}from"./useExitOnCtrlCDWithKeybindings-CjW3gUOt.js";import{n as T,t as E}from"./select-C_KXmqbI.js";import{n as D,r as O}from"./modalContext-DDZdU1J8.js";import{n as k,t as A}from"./PromptInputHelpMenu-DaQKKyM5.js";function j({commands:e,maxHeight:t,columns:n,title:i,onCancel:a,emptyMessage:o}){let{headerFocused:s,focusHeader:c}=p(),u=Math.max(1,n-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:S(r(e),u,!0)}))},[e,u]);return(0,N.jsx)(l,{flexDirection:`column`,paddingY:1,children:e.length===0&&o?(0,N.jsx)(d,{dimColor:!0,children:o}):(0,N.jsxs)(N.Fragment,{children:[(0,N.jsx)(d,{children:i}),(0,N.jsx)(l,{marginTop:1,children:(0,N.jsx)(E,{options:m,visibleOptionCount:f,onCancel:a,disableSelection:!0,hideIndexes:!0,layout:`compact-vertical`,onUpFromFirstItem:c,isDisabled:s})})]})})}var M,N,P=e((()=>{M=t(m(),1),a(),x(),v(),T(),N=b()}));function F(){return(0,I.jsxs)(l,{flexDirection:`column`,paddingY:1,gap:1,children:[(0,I.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,I.jsx)(d,{bold:!0,children:`Getting started`}),(0,I.jsxs)(l,{flexDirection:`column`,children:[(0,I.jsxs)(d,{children:[(0,I.jsx)(d,{bold:!0,children:`1. `}),(0,I.jsx)(d,{children:`Ask a question or describe a task — Work Mate will explore your code and respond.`})]}),(0,I.jsxs)(d,{children:[(0,I.jsx)(d,{bold:!0,children:`2. `}),(0,I.jsx)(d,{children:`When Work Mate wants to edit files or run commands, you review and approve each action.`})]}),(0,I.jsxs)(d,{children:[(0,I.jsx)(d,{bold:!0,children:`3. `}),(0,I.jsx)(d,{children:`Type `}),(0,I.jsx)(d,{bold:!0,children:`/help`}),(0,I.jsx)(d,{children:` for commands, or `}),(0,I.jsx)(d,{bold:!0,children:`?`}),(0,I.jsx)(d,{children:` for shortcuts.`})]})]})]}),(0,I.jsxs)(l,{flexDirection:`column`,children:[(0,I.jsx)(l,{children:(0,I.jsx)(d,{bold:!0,children:`Shortcuts`})}),(0,I.jsx)(A,{gap:2,fixedWidth:!0})]})]})}var I,L=e((()=>{v(),k(),I=b()}));function R({onClose:e,commands:t}){let{rows:r,columns:a}=g(),o=Math.floor(r/2),s=O(),c=()=>e(`Help dialog dismissed`,{display:`system`});f(`help:dismiss`,c,{context:`Help`});let p=C(c),m=i(`help:dismiss`,`Help`,`esc`),v=n(),b=t.filter(e=>v.has(e.name)&&!e.isHidden),x=t.filter(e=>!v.has(e.name)&&!e.isHidden),S=[(0,z.jsx)(h,{title:`general`,children:(0,z.jsx)(F,{})},`general`)];return S.push((0,z.jsx)(h,{title:`commands`,children:(0,z.jsx)(j,{commands:b,maxHeight:o,columns:a,title:`Browse default commands:`,onCancel:c})},`commands`)),S.push((0,z.jsx)(h,{title:`custom-commands`,children:(0,z.jsx)(j,{commands:x,maxHeight:o,columns:a,title:`Browse custom commands:`,emptyMessage:`No custom commands found`,onCancel:c})},`custom`)),(0,z.jsx)(l,{flexDirection:`column`,height:s?void 0:o,children:(0,z.jsxs)(y,{color:`professionalBlue`,children:[(0,z.jsx)(_,{title:`Work Mate v0.0.22`,color:`professionalBlue`,defaultTab:`general`,children:S}),(0,z.jsx)(l,{marginTop:1,children:(0,z.jsxs)(d,{children:[`For more help: `,(0,z.jsx)(u,{url:`https://code.workmate.com/docs/en/overview`})]})}),(0,z.jsx)(l,{marginTop:1,children:(0,z.jsx)(d,{dimColor:!0,children:p.pending?(0,z.jsxs)(z.Fragment,{children:[`Press `,p.keyName,` again to exit`]}):(0,z.jsxs)(d,{italic:!0,children:[m,` to cancel`]})})})]})})}var z,B=e((()=>{w(),s(),a(),D(),c(),v(),o(),P(),L(),z=b()})),V,H;e((()=>{B(),V=b(),H=async(e,{options:{commands:t}})=>(0,V.jsx)(R,{commands:t,onClose:e})}))();export{H as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{i as t,l as n,o as r}from"./envUtils-DcaKZlRU.js";import{tt as i,ut as a,zt as o}from"./state-BowF111d.js";import{C as s,L as c,P as l,S as u,c as d,et as f,f as p,h as m,i as h,tt as g,x as _}from"./debug-8DCufdSp.js";import{S as v,x as y}from"./config-BddEvZZl.js";import{Ht as b,Vt as x}from"./model-BwBE0Pt5.js";import{a as S,i as C,n as w,r as T}from"./pasteStore-DNV1M5Xd.js";import{join as E}from"path";import{appendFile as D,writeFile as O}from"fs/promises";function k(e){return(e.match(/\r\n|\r|\n/g)||[]).length}function A(e,t){return t===0?`[Pasted text #${e}]`:`[Pasted text #${e} +${t} lines]`}function j(e){return`[Image #${e}]`}function M(e){return[...e.matchAll(/\[(Pasted text|Image|\.\.\.Truncated text) #(\d+)(?: \+\d+ lines)?(\.)*\]/g)].map(e=>({id:parseInt(e[2]||`0`,10),match:e[0],index:e.index})).filter(e=>e.id>0)}function N(e,t){let n=M(e),r=e;for(let e=n.length-1;e>=0;e--){let i=n[e],a=t[i.id];a?.type===`text`&&(r=r.slice(0,i.index)+a.content+r.slice(i.index+i.match.length))}return r}function P(e){return u(e)}async function*F(){let e=a();for(let e=q.length-1;e>=0;e--)yield q[e];let n=E(t(),`history.jsonl`);try{for await(let t of m(n))try{let n=P(t);if(n.sessionId===e&&Q.has(n.timestamp))continue;yield n}catch(e){d(`Failed to parse history line: ${e}`)}}catch(e){if(l(e)===`ENOENT`)return;throw e}}async function*I(){for await(let e of F())yield await z(e)}async function*L(){let e=i(),t=a(),n=[],r=0;for await(let i of F())if(!(!i||typeof i.project!=`string`)&&i.project===e&&(i.sessionId===t?(yield await z(i),r++):n.push(i),r+n.length>=G))break;for(let e of n){if(r>=G)return;yield await z(e),r++}}async function R(e){if(e.content)return{id:e.id,type:e.type,content:e.content,mediaType:e.mediaType,filename:e.filename};if(e.contentHash){let t=await C(e.contentHash);if(t)return{id:e.id,type:e.type,content:t,mediaType:e.mediaType,filename:e.filename}}return null}async function z(e){let t={};for(let[n,r]of Object.entries(e.pastedContents||{})){let e=await R(r);e&&(t[Number(n)]=e)}return{display:e.display,pastedContents:t}}async function B(){if(q.length===0)return;let e;try{let n=E(t(),`history.jsonl`);await O(n,``,{encoding:`utf8`,mode:384,flag:`a`}),e=await v(n,{stale:1e4,retries:{retries:3,minTimeout:50}});let r=q.map(e=>`${s(e)}\n`);q=[],await D(n,r.join(``),{mode:384})}catch(e){d(`Failed to write prompt history: ${e}`)}finally{e&&await e()}}async function V(e){if(!(J||q.length===0)&&!(e>5)){J=!0;try{await B()}finally{J=!1,q.length>0&&(await b(500),V(e+1))}}}async function H(e){let t=typeof e==`string`?{display:e,pastedContents:{}}:e,n={};if(t.pastedContents){for(let[e,r]of Object.entries(t.pastedContents))if(r.type!==`image`)if(r.content.length<=K)n[Number(e)]={id:r.id,type:r.type,content:r.content,mediaType:r.mediaType,filename:r.filename};else{let t=w(r.content);n[Number(e)]={id:r.id,type:r.type,contentHash:t,mediaType:r.mediaType,filename:r.filename},S(t,r.content)}}let r={...t,pastedContents:n,timestamp:Date.now(),project:i(),sessionId:a()};q.push(r),Z=r,Y=V(0)}function U(e){n(process.env.CLAUDE_CODE_SKIP_PROMPT_HISTORY)||(X||(X=!0,g(async()=>{Y&&await Y,q.length>0&&await B()})),H(e))}function W(){if(!Z)return;let e=Z;Z=null;let t=q.lastIndexOf(e);t===-1?Q.add(e.timestamp):q.splice(t,1)}var G,K,q,J,Y,X,Z,Q,$=e((()=>{o(),f(),h(),r(),c(),p(),y(),T(),x(),_(),G=100,K=1024,q=[],J=!1,Y=null,X=!1,Z=null,Q=new Set}));export{L as a,I as c,A as i,M as l,N as n,k as o,j as r,$ as s,U as t,W as u};
@@ -1,4 +1,4 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Dh as o,Du as s,Eh as c,Mh as ee,Ou as l,Sc as u,Th as d,dp as f,fp as p,hp as m,jh as h,lp as g,mp as _,pp as v,up as y,xc as b,zS as x}from"./loadAgentsDir-C96o6gCj.js";import{I as S,Lt as C,P as w,Wt as T,ai as E,t as D,y as O}from"./src-DL3w8VPk.js";import{t as k}from"./jsx-runtime-Bb4Xn-E0.js";import{Ut as te,ct as ne}from"./state-D5D6QpTX.js";import{d as A,h as re,s as j}from"./settings-BowI3jp-.js";import{n as M,r as N}from"./analytics-DJobLaWP.js";import{l as P,o as F}from"./stringUtils-D7oJIyY2.js";function ie(e,t){let n={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},r=L(t);g(e).forEach(e=>{let t=n[e.event];if(t){let n=r[e.event].matcherMetadata===void 0?``:e.matcher||``;t[n]||(t[n]=[]),t[n].push(e)}});let i=ne();if(i)for(let[e,t]of Object.entries(i)){let r=e,i=n[r];if(i)for(let e of t??[]){let t=e.matcher||``;if(`pluginRoot`in e){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:n,matcher:e.matcher,source:`pluginHook`,pluginName:e.pluginId})}}}return n}function ae(e,t){return m(Object.keys(e[t]||{}),e,t)}function oe(e,t,n){let r=n??``;return e[t]?.[r]??[]}function I(e,t){return L(t)[e].matcherMetadata}var L,R=e((()=>{r(),te(),_(),L=n(e=>({PreToolUse:{summary:`Before tool execution`,description:`Input to command is JSON of tool call arguments.
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./memoize-BK3gG5ob.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{Cc as o,Dp as s,Np as c,Op as ee,Pp as l,Sc as u,Ub as d,_d as f,dd as p,fd as m,gd as h,hd as g,kp as _,md as v,pd as y}from"./loadAgentsDir-C1LkW7gl.js";import{I as b,Lt as x,P as S,Wt as C,ai as w,t as T,y as E}from"./src-DL3w8VPk.js";import{t as D}from"./jsx-runtime-Bb4Xn-E0.js";import{ot as O,zt as te}from"./state-BowF111d.js";import{d as k,h as ne,s as A}from"./settings-DKN4xSpQ.js";import{l as j,o as M}from"./stringUtils-BQm3OfeJ.js";import{n as N,r as re}from"./analytics-DJobLaWP.js";import{n as P,t as F}from"./select-C_KXmqbI.js";function ie(e,t){let n={PreToolUse:{},PostToolUse:{},PostToolUseFailure:{},PermissionDenied:{},Notification:{},UserPromptSubmit:{},SessionStart:{},SessionEnd:{},Stop:{},StopFailure:{},SubagentStart:{},SubagentStop:{},PreCompact:{},PostCompact:{},PermissionRequest:{},Setup:{},TeammateIdle:{},TaskCreated:{},TaskCompleted:{},Elicitation:{},ElicitationResult:{},ConfigChange:{},WorktreeCreate:{},WorktreeRemove:{},InstructionsLoaded:{},CwdChanged:{},FileChanged:{}},r=L(t);p(e).forEach(e=>{let t=n[e.event];if(t){let n=r[e.event].matcherMetadata===void 0?``:e.matcher||``;t[n]||(t[n]=[]),t[n].push(e)}});let i=O();if(i)for(let[e,t]of Object.entries(i)){let r=e,i=n[r];if(i)for(let e of t??[]){let t=e.matcher||``;if(`pluginRoot`in e){i[t]??(i[t]=[]);for(let n of e.hooks)i[t].push({event:r,config:n,matcher:e.matcher,source:`pluginHook`,pluginName:e.pluginId})}}}return n}function ae(e,t){return f(Object.keys(e[t]||{}),e,t)}function oe(e,t,n){let r=n??``;return e[t]?.[r]??[]}function I(e,t){return L(t)[e].matcherMetadata}var L,R=e((()=>{r(),te(),h(),L=n(e=>({PreToolUse:{summary:`Before tool execution`,description:`Input to command is JSON of tool call arguments.
2
2
  Exit code 0 - stdout/stderr not shown
3
3
  Exit code 2 - show stderr to model and block tool call
4
4
  Other exit codes - show stderr to user only but continue with tool call`,matcherMetadata:{fieldToMatch:`tool_name`,values:e}},PostToolUse:{summary:`After tool execution`,description:`Input to command is JSON with fields "inputs" (tool call arguments) and "response" (tool call response).
@@ -76,4 +76,4 @@ CLAUDE_ENV_FILE is set — write bash exports there to apply env to subsequent B
76
76
  The matcher field specifies filenames to watch in the current directory (e.g. ".envrc|.env").
77
77
  Hook output can include hookSpecificOutput.watchPaths (array of absolute paths) to dynamically update the watch list.
78
78
  Exit code 0 - command completes successfully
79
- Other exit codes - show stderr to user only`}}),e=>e.slice().sort().join(`,`))}));function z({hookEventMetadata:e,hooksByEvent:t,totalHooksCount:n,restrictedByPolicy:r,onSelectEvent:i,onCancel:o}){return(0,B.jsx)(O,{title:`Hooks`,subtitle:`${n} ${P(n,`hook`)} configured`,onCancel:o,children:(0,B.jsxs)(S,{flexDirection:`column`,gap:1,children:[r&&(0,B.jsxs)(S,{flexDirection:`column`,children:[(0,B.jsxs)(w,{color:`suggestion`,children:[a.info,` Hooks Restricted by Policy`]}),(0,B.jsx)(w,{dimColor:!0,children:`Only hooks from managed settings can run. User-defined hooks from ~/.workmate/settings.json, .workmate/settings.json, and .workmate/settings.local.json are blocked.`})]}),(0,B.jsx)(S,{flexDirection:`column`,children:(0,B.jsxs)(w,{dimColor:!0,children:[a.info,` This menu is read-only. To add or modify hooks, edit settings.json directly or ask Work Mate.`,` `,(0,B.jsx)(C,{url:`https://code.workmate.com/docs/en/hooks`,children:`Learn more`})]})}),(0,B.jsx)(S,{flexDirection:`column`,children:(0,B.jsx)(s,{onChange:e=>{i(e)},onCancel:o,options:Object.entries(e).map(([e,n])=>{let r=t[e]||0;return{label:r>0?(0,B.jsxs)(w,{children:[e,` `,(0,B.jsxs)(w,{color:`suggestion`,children:[`(`,r,`)`]})]}):e,value:e,description:n.summary}})})})]})})}var B,V=e((()=>{i(),D(),F(),l(),B=k()}));function H({selectedEvent:e,selectedMatcher:t,hooksForSelectedMatcher:n,hookEventMetadata:r,onSelect:i,onCancel:a}){let o=r.matcherMetadata===void 0?e:`${e} - Matcher: ${t||`(all)`}`;return n.length===0?(0,U.jsx)(O,{title:o,subtitle:r.description,onCancel:a,inputGuide:()=>(0,U.jsx)(w,{children:`Esc to go back`}),children:(0,U.jsxs)(S,{flexDirection:`column`,gap:1,children:[(0,U.jsx)(w,{dimColor:!0,children:`No hooks configured for this event.`}),(0,U.jsx)(w,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,U.jsx)(O,{title:o,subtitle:r.description,onCancel:a,children:(0,U.jsx)(S,{flexDirection:`column`,children:(0,U.jsx)(s,{options:n.map((e,t)=>({label:`[${e.config.type}] ${y(e.config)}`,value:t.toString(),description:e.source===`pluginHook`&&e.pluginName?`${p(e.source)} (${e.pluginName})`:p(e.source)})),onChange:e=>{let t=n[parseInt(e,10)];t&&i(t)},onCancel:a})})})}var U,W=e((()=>{D(),_(),l(),U=k()}));function G({selectedEvent:e,matchersForSelectedEvent:t,hooksByEventAndMatcher:n,eventDescription:r,onSelect:i,onCancel:a}){let o=K.useMemo(()=>t.map(t=>{let r=n[e]?.[t]||[];return{matcher:t,sources:Array.from(new Set(r.map(e=>e.source))),hookCount:r.length}}),[t,n,e]);return t.length===0?(0,q.jsx)(O,{title:`${e} - Matchers`,subtitle:r,onCancel:a,inputGuide:()=>(0,q.jsx)(w,{children:`Esc to go back`}),children:(0,q.jsxs)(S,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(w,{dimColor:!0,children:`No hooks configured for this event.`}),(0,q.jsx)(w,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,q.jsx)(O,{title:`${e} - Matchers`,subtitle:r,onCancel:a,children:(0,q.jsx)(S,{flexDirection:`column`,children:(0,q.jsx)(s,{options:o.map(e=>({label:`[${e.sources.map(v).join(`, `)}] ${e.matcher||`(all)`}`,value:e.matcher,description:`${e.hookCount} ${P(e.hookCount,`hook`)}`})),onChange:e=>{i(e)},onCancel:a})})})}var K,q,se=e((()=>{K=t(E(),1),D(),_(),F(),l(),q=k()}));function ce({selectedHook:e,eventSupportsMatcher:t,onCancel:n}){return(0,J.jsx)(O,{title:`Hook details`,onCancel:n,inputGuide:()=>(0,J.jsx)(w,{children:`Esc to go back`}),children:(0,J.jsxs)(S,{flexDirection:`column`,gap:1,children:[(0,J.jsxs)(S,{flexDirection:`column`,children:[(0,J.jsxs)(w,{children:[`Event: `,(0,J.jsx)(w,{bold:!0,children:e.event})]}),t&&(0,J.jsxs)(w,{children:[`Matcher: `,(0,J.jsx)(w,{bold:!0,children:e.matcher||`(all)`})]}),(0,J.jsxs)(w,{children:[`Type: `,(0,J.jsx)(w,{bold:!0,children:e.config.type})]}),(0,J.jsxs)(w,{children:[`Source: `,(0,J.jsx)(w,{dimColor:!0,children:f(e.source)})]}),e.pluginName&&(0,J.jsxs)(w,{children:[`Plugin: `,(0,J.jsx)(w,{dimColor:!0,children:e.pluginName})]})]}),(0,J.jsxs)(S,{flexDirection:`column`,children:[(0,J.jsxs)(w,{dimColor:!0,children:[le(e.config),`:`]}),(0,J.jsx)(S,{borderStyle:`round`,borderDimColor:!0,paddingLeft:1,paddingRight:1,children:(0,J.jsx)(w,{children:ue(e.config)})})]}),`statusMessage`in e.config&&e.config.statusMessage&&(0,J.jsxs)(w,{children:[`Status message: `,(0,J.jsx)(w,{dimColor:!0,children:e.config.statusMessage})]}),(0,J.jsx)(w,{dimColor:!0,children:`To modify or remove this hook, edit settings.json directly or ask Work Mate to help.`})]})})}function le(e){switch(e.type){case`command`:return`Command`;case`prompt`:return`Prompt`;case`agent`:return`Prompt`;case`http`:return`URL`}}function ue(e){switch(e.type){case`command`:return e.command;case`prompt`:return e.prompt;case`agent`:return e.prompt;case`http`:return e.url}}var J,Y=e((()=>{D(),_(),J=k()}));function de({toolNames:e,onExit:t}){let[n,r]=(0,X.useState)({mode:`select-event`}),[i,a]=(0,X.useState)(()=>A()?.disableAllHooks===!0&&j(`policySettings`)?.disableAllHooks===!0),[s,l]=(0,X.useState)(()=>j(`policySettings`)?.allowManagedHooksOnly===!0);ee(e=>{if(e===`policySettings`){let e=A()?.disableAllHooks===!0;a(e&&j(`policySettings`)?.disableAllHooks===!0),l(j(`policySettings`)?.allowManagedHooksOnly===!0)}});let u=n.mode,d=`event`in n?n.event:`PreToolUse`,f=`matcher`in n?n.matcher:null,p=c(e=>e.mcp),m=o(),h=(0,X.useMemo)(()=>[...e,...p.tools.map(e=>e.name)],[e,p.tools]),g=(0,X.useMemo)(()=>ie(m.getState(),h),[h,m]),_=(0,X.useMemo)(()=>ae(g,d),[g,d]),v=(0,X.useMemo)(()=>oe(g,d,f),[g,d,f]),y=(0,X.useCallback)(()=>{t(`Hooks dialog dismissed`,{display:`system`})},[t]);T(`confirm:no`,y,{context:`Confirmation`,isActive:u===`select-event`}),T(`confirm:no`,()=>{r({mode:`select-event`})},{context:`Confirmation`,isActive:u===`select-matcher`}),T(`confirm:no`,()=>{`event`in n&&(I(n.event,h)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event}))},{context:`Confirmation`,isActive:u===`select-hook`}),T(`confirm:no`,()=>{if(n.mode===`view-hook`){let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}},{context:`Confirmation`,isActive:u===`view-hook`});let b=L(h),x=A()?.disableAllHooks===!0,{hooksByEvent:C,totalHooksCount:E}=(0,X.useMemo)(()=>{let e={},t=0;for(let[n,r]of Object.entries(g)){let i=Object.values(r).reduce((e,t)=>e+t.length,0);e[n]=i,t+=i}return{hooksByEvent:e,totalHooksCount:t}},[g]);if(x)return(0,Z.jsx)(O,{title:`Hook Configuration - Disabled`,onCancel:y,inputGuide:()=>(0,Z.jsx)(w,{children:`Esc to close`}),children:(0,Z.jsxs)(S,{flexDirection:`column`,gap:1,children:[(0,Z.jsxs)(S,{flexDirection:`column`,children:[(0,Z.jsxs)(w,{children:[`All hooks are currently `,(0,Z.jsx)(w,{bold:!0,children:`disabled`}),i&&` by a managed settings file`,`. You have `,(0,Z.jsx)(w,{bold:!0,children:E}),` `,`configured `,P(E,`hook`),` that `,P(E,`is`,`are`),` not running.`]}),(0,Z.jsx)(S,{marginTop:1,children:(0,Z.jsx)(w,{dimColor:!0,children:`When hooks are disabled:`})}),(0,Z.jsx)(w,{dimColor:!0,children:`· No hook commands will execute`}),(0,Z.jsx)(w,{dimColor:!0,children:`· StatusLine will not be displayed`}),(0,Z.jsx)(w,{dimColor:!0,children:`· Tool operations will proceed without hook validation`})]}),!i&&(0,Z.jsx)(w,{dimColor:!0,children:`To re-enable hooks, remove "disableAllHooks" from settings.json or ask Work Mate.`})]})});switch(n.mode){case`select-event`:return(0,Z.jsx)(z,{hookEventMetadata:b,hooksByEvent:C,totalHooksCount:E,restrictedByPolicy:s,onSelectEvent:e=>{I(e,h)===void 0?r({mode:`select-hook`,event:e,matcher:``}):r({mode:`select-matcher`,event:e})},onCancel:y});case`select-matcher`:return(0,Z.jsx)(G,{selectedEvent:n.event,matchersForSelectedEvent:_,hooksByEventAndMatcher:g,eventDescription:b[n.event].description,onSelect:e=>{r({mode:`select-hook`,event:n.event,matcher:e})},onCancel:()=>{r({mode:`select-event`})}});case`select-hook`:return(0,Z.jsx)(H,{selectedEvent:n.event,selectedMatcher:n.matcher,hooksForSelectedMatcher:v,hookEventMetadata:b[n.event],onSelect:e=>{r({mode:`view-hook`,event:n.event,hook:e})},onCancel:()=>{I(n.event,h)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event})}});case`view-hook`:return(0,Z.jsx)(ce,{selectedHook:n.hook,eventSupportsMatcher:I(n.event,h)!==void 0,onCancel:()=>{let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}})}}var X,Z,fe=e((()=>{X=t(E(),1),d(),h(),D(),x(),R(),re(),F(),V(),W(),se(),Y(),Z=k()})),Q,$;e((()=>{fe(),M(),u(),Q=k(),$=async(e,t)=>{N(`tengu_hooks_command`,{});let n=t.getAppState().toolPermissionContext;return(0,Q.jsx)(de,{toolNames:b(n).map(e=>e.name),onExit:e})}}))();export{$ as call};
79
+ Other exit codes - show stderr to user only`}}),e=>e.slice().sort().join(`,`))}));function z({hookEventMetadata:e,hooksByEvent:t,totalHooksCount:n,restrictedByPolicy:r,onSelectEvent:i,onCancel:o}){return(0,B.jsx)(E,{title:`Hooks`,subtitle:`${n} ${j(n,`hook`)} configured`,onCancel:o,children:(0,B.jsxs)(b,{flexDirection:`column`,gap:1,children:[r&&(0,B.jsxs)(b,{flexDirection:`column`,children:[(0,B.jsxs)(S,{color:`suggestion`,children:[a.info,` Hooks Restricted by Policy`]}),(0,B.jsx)(S,{dimColor:!0,children:`Only hooks from managed settings can run. User-defined hooks from ~/.workmate/settings.json, .workmate/settings.json, and .workmate/settings.local.json are blocked.`})]}),(0,B.jsx)(b,{flexDirection:`column`,children:(0,B.jsxs)(S,{dimColor:!0,children:[a.info,` This menu is read-only. To add or modify hooks, edit settings.json directly or ask Work Mate.`,` `,(0,B.jsx)(x,{url:`https://code.workmate.com/docs/en/hooks`,children:`Learn more`})]})}),(0,B.jsx)(b,{flexDirection:`column`,children:(0,B.jsx)(F,{onChange:e=>{i(e)},onCancel:o,options:Object.entries(e).map(([e,n])=>{let r=t[e]||0;return{label:r>0?(0,B.jsxs)(S,{children:[e,` `,(0,B.jsxs)(S,{color:`suggestion`,children:[`(`,r,`)`]})]}):e,value:e,description:n.summary}})})})]})})}var B,V=e((()=>{i(),T(),M(),P(),B=D()}));function H({selectedEvent:e,selectedMatcher:t,hooksForSelectedMatcher:n,hookEventMetadata:r,onSelect:i,onCancel:a}){let o=r.matcherMetadata===void 0?e:`${e} - Matcher: ${t||`(all)`}`;return n.length===0?(0,U.jsx)(E,{title:o,subtitle:r.description,onCancel:a,inputGuide:()=>(0,U.jsx)(S,{children:`Esc to go back`}),children:(0,U.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,U.jsx)(S,{dimColor:!0,children:`No hooks configured for this event.`}),(0,U.jsx)(S,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,U.jsx)(E,{title:o,subtitle:r.description,onCancel:a,children:(0,U.jsx)(b,{flexDirection:`column`,children:(0,U.jsx)(F,{options:n.map((e,t)=>({label:`[${e.config.type}] ${m(e.config)}`,value:t.toString(),description:e.source===`pluginHook`&&e.pluginName?`${v(e.source)} (${e.pluginName})`:v(e.source)})),onChange:e=>{let t=n[parseInt(e,10)];t&&i(t)},onCancel:a})})})}var U,W=e((()=>{T(),h(),P(),U=D()}));function G({selectedEvent:e,matchersForSelectedEvent:t,hooksByEventAndMatcher:n,eventDescription:r,onSelect:i,onCancel:a}){let o=K.useMemo(()=>t.map(t=>{let r=n[e]?.[t]||[];return{matcher:t,sources:Array.from(new Set(r.map(e=>e.source))),hookCount:r.length}}),[t,n,e]);return t.length===0?(0,q.jsx)(E,{title:`${e} - Matchers`,subtitle:r,onCancel:a,inputGuide:()=>(0,q.jsx)(S,{children:`Esc to go back`}),children:(0,q.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,q.jsx)(S,{dimColor:!0,children:`No hooks configured for this event.`}),(0,q.jsx)(S,{dimColor:!0,children:`To add hooks, edit settings.json directly or ask Work Mate.`})]})}):(0,q.jsx)(E,{title:`${e} - Matchers`,subtitle:r,onCancel:a,children:(0,q.jsx)(b,{flexDirection:`column`,children:(0,q.jsx)(F,{options:o.map(e=>({label:`[${e.sources.map(g).join(`, `)}] ${e.matcher||`(all)`}`,value:e.matcher,description:`${e.hookCount} ${j(e.hookCount,`hook`)}`})),onChange:e=>{i(e)},onCancel:a})})})}var K,q,se=e((()=>{K=t(w(),1),T(),h(),M(),P(),q=D()}));function ce({selectedHook:e,eventSupportsMatcher:t,onCancel:n}){return(0,J.jsx)(E,{title:`Hook details`,onCancel:n,inputGuide:()=>(0,J.jsx)(S,{children:`Esc to go back`}),children:(0,J.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,J.jsxs)(b,{flexDirection:`column`,children:[(0,J.jsxs)(S,{children:[`Event: `,(0,J.jsx)(S,{bold:!0,children:e.event})]}),t&&(0,J.jsxs)(S,{children:[`Matcher: `,(0,J.jsx)(S,{bold:!0,children:e.matcher||`(all)`})]}),(0,J.jsxs)(S,{children:[`Type: `,(0,J.jsx)(S,{bold:!0,children:e.config.type})]}),(0,J.jsxs)(S,{children:[`Source: `,(0,J.jsx)(S,{dimColor:!0,children:y(e.source)})]}),e.pluginName&&(0,J.jsxs)(S,{children:[`Plugin: `,(0,J.jsx)(S,{dimColor:!0,children:e.pluginName})]})]}),(0,J.jsxs)(b,{flexDirection:`column`,children:[(0,J.jsxs)(S,{dimColor:!0,children:[le(e.config),`:`]}),(0,J.jsx)(b,{borderStyle:`round`,borderDimColor:!0,paddingLeft:1,paddingRight:1,children:(0,J.jsx)(S,{children:ue(e.config)})})]}),`statusMessage`in e.config&&e.config.statusMessage&&(0,J.jsxs)(S,{children:[`Status message: `,(0,J.jsx)(S,{dimColor:!0,children:e.config.statusMessage})]}),(0,J.jsx)(S,{dimColor:!0,children:`To modify or remove this hook, edit settings.json directly or ask Work Mate to help.`})]})})}function le(e){switch(e.type){case`command`:return`Command`;case`prompt`:return`Prompt`;case`agent`:return`Prompt`;case`http`:return`URL`}}function ue(e){switch(e.type){case`command`:return e.command;case`prompt`:return e.prompt;case`agent`:return e.prompt;case`http`:return e.url}}var J,Y=e((()=>{T(),h(),J=D()}));function de({toolNames:e,onExit:t}){let[n,r]=(0,X.useState)({mode:`select-event`}),[i,a]=(0,X.useState)(()=>k()?.disableAllHooks===!0&&A(`policySettings`)?.disableAllHooks===!0),[o,s]=(0,X.useState)(()=>A(`policySettings`)?.allowManagedHooksOnly===!0);l(e=>{if(e===`policySettings`){let e=k()?.disableAllHooks===!0;a(e&&A(`policySettings`)?.disableAllHooks===!0),s(A(`policySettings`)?.allowManagedHooksOnly===!0)}});let c=n.mode,u=`event`in n?n.event:`PreToolUse`,d=`matcher`in n?n.matcher:null,f=ee(e=>e.mcp),p=_(),m=(0,X.useMemo)(()=>[...e,...f.tools.map(e=>e.name)],[e,f.tools]),h=(0,X.useMemo)(()=>ie(p.getState(),m),[m,p]),g=(0,X.useMemo)(()=>ae(h,u),[h,u]),v=(0,X.useMemo)(()=>oe(h,u,d),[h,u,d]),y=(0,X.useCallback)(()=>{t(`Hooks dialog dismissed`,{display:`system`})},[t]);C(`confirm:no`,y,{context:`Confirmation`,isActive:c===`select-event`}),C(`confirm:no`,()=>{r({mode:`select-event`})},{context:`Confirmation`,isActive:c===`select-matcher`}),C(`confirm:no`,()=>{`event`in n&&(I(n.event,m)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event}))},{context:`Confirmation`,isActive:c===`select-hook`}),C(`confirm:no`,()=>{if(n.mode===`view-hook`){let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}},{context:`Confirmation`,isActive:c===`view-hook`});let x=L(m),w=k()?.disableAllHooks===!0,{hooksByEvent:T,totalHooksCount:D}=(0,X.useMemo)(()=>{let e={},t=0;for(let[n,r]of Object.entries(h)){let i=Object.values(r).reduce((e,t)=>e+t.length,0);e[n]=i,t+=i}return{hooksByEvent:e,totalHooksCount:t}},[h]);if(w)return(0,Z.jsx)(E,{title:`Hook Configuration - Disabled`,onCancel:y,inputGuide:()=>(0,Z.jsx)(S,{children:`Esc to close`}),children:(0,Z.jsxs)(b,{flexDirection:`column`,gap:1,children:[(0,Z.jsxs)(b,{flexDirection:`column`,children:[(0,Z.jsxs)(S,{children:[`All hooks are currently `,(0,Z.jsx)(S,{bold:!0,children:`disabled`}),i&&` by a managed settings file`,`. You have `,(0,Z.jsx)(S,{bold:!0,children:D}),` `,`configured `,j(D,`hook`),` that `,j(D,`is`,`are`),` not running.`]}),(0,Z.jsx)(b,{marginTop:1,children:(0,Z.jsx)(S,{dimColor:!0,children:`When hooks are disabled:`})}),(0,Z.jsx)(S,{dimColor:!0,children:`· No hook commands will execute`}),(0,Z.jsx)(S,{dimColor:!0,children:`· StatusLine will not be displayed`}),(0,Z.jsx)(S,{dimColor:!0,children:`· Tool operations will proceed without hook validation`})]}),!i&&(0,Z.jsx)(S,{dimColor:!0,children:`To re-enable hooks, remove "disableAllHooks" from settings.json or ask Work Mate.`})]})});switch(n.mode){case`select-event`:return(0,Z.jsx)(z,{hookEventMetadata:x,hooksByEvent:T,totalHooksCount:D,restrictedByPolicy:o,onSelectEvent:e=>{I(e,m)===void 0?r({mode:`select-hook`,event:e,matcher:``}):r({mode:`select-matcher`,event:e})},onCancel:y});case`select-matcher`:return(0,Z.jsx)(G,{selectedEvent:n.event,matchersForSelectedEvent:g,hooksByEventAndMatcher:h,eventDescription:x[n.event].description,onSelect:e=>{r({mode:`select-hook`,event:n.event,matcher:e})},onCancel:()=>{r({mode:`select-event`})}});case`select-hook`:return(0,Z.jsx)(H,{selectedEvent:n.event,selectedMatcher:n.matcher,hooksForSelectedMatcher:v,hookEventMetadata:x[n.event],onSelect:e=>{r({mode:`view-hook`,event:n.event,hook:e})},onCancel:()=>{I(n.event,m)===void 0?r({mode:`select-event`}):r({mode:`select-matcher`,event:n.event})}});case`view-hook`:return(0,Z.jsx)(ce,{selectedHook:n.hook,eventSupportsMatcher:I(n.event,m)!==void 0,onCancel:()=>{let{event:e,hook:t}=n;r({mode:`select-hook`,event:e,matcher:t.matcher||``})}})}}var X,Z,fe=e((()=>{X=t(w(),1),s(),c(),T(),d(),R(),ne(),M(),V(),W(),se(),Y(),Z=D()})),Q,$;e((()=>{fe(),N(),o(),Q=D(),$=async(e,t)=>{re(`tengu_hooks_command`,{});let n=t.getAppState().toolPermissionContext;return(0,Q.jsx)(de,{toolNames:u(n).map(e=>e.name),onExit:e})}}))();export{$ as call};
@@ -0,0 +1 @@
1
+ import{hn as e,qt as t,sn as n}from"./loadAgentsDir-C1LkW7gl.js";e();export{t as executeSessionEndHooks,n as getSessionEndHookTimeoutMs};
@@ -0,0 +1 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,P as n,ai as r,kn as i,s as a,t as o}from"./src-DL3w8VPk.js";import{t as s}from"./jsx-runtime-Bb4Xn-E0.js";import{L as c,N as l,c as u,i as d}from"./debug-8DCufdSp.js";import{Wt as f,b as p,h as m,qt as h,t as g}from"./settings-DKN4xSpQ.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{a as y,n as b,r as x,s as S,t as C}from"./nativeInstaller-DnSNJWIi.js";import{join as w}from"node:path";import{homedir as T}from"node:os";var E=e(r(),1);_(),o(),d(),h(),c(),C(),m();var D=s();function O(){let e=f.platform===`win32`,t=T();return e?w(t,`.local`,`bin`,`claude.exe`).replace(/\//g,`\\`):`~/.local/bin/claude`}function k({messages:e}){return e.length===0?null:(0,D.jsxs)(t,{flexDirection:`column`,gap:0,marginBottom:1,children:[(0,D.jsx)(t,{children:(0,D.jsxs)(n,{color:`warning`,children:[(0,D.jsx)(a,{status:`warning`,withSpace:!0}),`Setup notes:`]})}),e.map((e,r)=>(0,D.jsx)(t,{marginLeft:2,children:(0,D.jsxs)(n,{dimColor:!0,children:[`• `,e]})},r))]})}function A({onDone:e,force:r,target:i}){let[o,s]=(0,E.useState)({type:`checking`});return(0,E.useEffect)(()=>{async function e(){try{u(`Install: Starting installation process (force=${r}, target=${i})`);let e=i||g()?.autoUpdatesChannel||`latest`;s({type:`installing`,version:e}),u(`Install: Calling installLatest(channelOrVersion=${e}, forceReinstall=${r})`);let t=await S(e,r);if(u(`Install: installLatest returned version=${t.latestVersion}, wasUpdated=${t.wasUpdated}, lockFailed=${t.lockFailed}`),t.lockFailed)throw Error(`Could not install - another process is currently installing Work Mate. Please try again in a moment.`);t.latestVersion||u(`Install: Failed to retrieve version information during install`,{level:`error`}),t.wasUpdated||u(`Install: Already up to date`),s({type:`setting-up`});let n=await b(!0);u(`Install: Setup launcher completed with ${n.length} messages`),n.length>0&&n.forEach(e=>u(`Install: Setup message: ${e.message}`)),u(`Install: Cleaning up npm installations after successful install`);let{removed:a,errors:o,warnings:c}=await x();a>0&&u(`Cleaned up ${a} npm installation(s)`),o.length>0&&u(`Cleanup errors: ${o.join(`, `)}`);let l=await y();l.length>0&&u(`Shell alias cleanup: ${l.map(e=>e.message).join(`; `)}`),v(`tengu_claude_install_command`,{has_version:+!!t.latestVersion,forced:+!!r}),(i===`latest`||i===`stable`)&&(p(`userSettings`,{autoUpdatesChannel:i}),u(`Install: Saved autoUpdatesChannel=${i} to user settings`));let d=[...c,...l.map(e=>e.message)];n.length>0?(s({type:`set-up`,messages:n.map(e=>e.message)}),setTimeout(s,2e3,{type:`success`,version:t.latestVersion||`current`,setupMessages:[...n.map(e=>e.message),...d]})):(u(`Install: Shell PATH already configured`),s({type:`success`,version:t.latestVersion||`current`,setupMessages:d.length>0?d:void 0}))}catch(e){u(`Install command failed: ${e}`,{level:`error`}),s({type:`error`,message:l(e)})}}e()},[r,i]),(0,E.useEffect)(()=>{o.type===`success`?setTimeout(e,2e3,`Work Mate installation completed successfully`,{display:`system`}):o.type===`error`&&setTimeout(e,3e3,`Work Mate installation failed`,{display:`system`})},[o,e]),(0,D.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[o.type===`checking`&&(0,D.jsx)(n,{color:`claude`,children:`Checking installation status...`}),o.type===`cleaning-npm`&&(0,D.jsx)(n,{color:`warning`,children:`Cleaning up old npm installations...`}),o.type===`installing`&&(0,D.jsxs)(n,{color:`claude`,children:[`Installing Work Mate native build `,o.version,`...`]}),o.type===`setting-up`&&(0,D.jsx)(n,{color:`claude`,children:`Setting up launcher and shell integration...`}),o.type===`set-up`&&(0,D.jsx)(k,{messages:o.messages}),o.type===`success`&&(0,D.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,D.jsxs)(t,{children:[(0,D.jsx)(a,{status:`success`,withSpace:!0}),(0,D.jsx)(n,{color:`success`,bold:!0,children:`Work Mate successfully installed!`})]}),(0,D.jsxs)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:[o.version!==`current`&&(0,D.jsxs)(t,{children:[(0,D.jsx)(n,{dimColor:!0,children:`Version: `}),(0,D.jsx)(n,{color:`claude`,children:o.version})]}),(0,D.jsxs)(t,{children:[(0,D.jsx)(n,{dimColor:!0,children:`Location: `}),(0,D.jsx)(n,{color:`text`,children:O()})]})]}),(0,D.jsx)(t,{marginLeft:2,flexDirection:`column`,gap:1,children:(0,D.jsxs)(t,{marginTop:1,children:[(0,D.jsx)(n,{dimColor:!0,children:`Next: Run `}),(0,D.jsx)(n,{color:`claude`,bold:!0,children:`claude --help`}),(0,D.jsx)(n,{dimColor:!0,children:` to get started`})]})}),o.setupMessages&&(0,D.jsx)(k,{messages:o.setupMessages})]}),o.type===`error`&&(0,D.jsxs)(t,{flexDirection:`column`,gap:1,children:[(0,D.jsxs)(t,{children:[(0,D.jsx)(a,{status:`error`,withSpace:!0}),(0,D.jsx)(n,{color:`error`,children:`Installation failed`})]}),(0,D.jsx)(n,{color:`error`,children:o.message}),(0,D.jsx)(t,{marginTop:1,children:(0,D.jsx)(n,{dimColor:!0,children:`Try running with --force to override checks`})})]})]})}var j={type:`local-jsx`,name:`install`,description:`安装 Work Mate 原生构建`,argumentHint:`[options]`,async call(e,t,n){let r=n.includes(`--force`),a=n.filter(e=>!e.startsWith(`--`))[0],{unmount:o}=await i((0,D.jsx)(A,{onDone:(t,n)=>{o(),e(t,n)},force:r,target:a}))}};export{j as install};
@@ -0,0 +1,21 @@
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{n as r,t as i}from"./defineProperty-C-QyHrDq.js";import{E as a,M as o,S as s,b as c,d as l,h as u,i as d,l as f,n as p,p as ee,s as m,v as te,w as h,y as ne}from"./esm-lWlUmoUA.js";import{A as g,C as re,S as ie,b as _,v,w as ae,x as oe,y as se}from"./esm-BbMeEYcz.js";import{A as ce,B as y,C as le,D as ue,E as de,I as b,K as fe,L as x,M as pe,N as me,O as he,P as S,R as ge,U as _e,W as C,_ as w,b as ve,c as ye,d as be,gt as T,h as xe,ht as Se,i as Ce,k as E,mt as we,n as Te,o as Ee,p as De,pt as Oe,q as ke,t as Ae,u as je,v as D,w as O,y as Me}from"./esm-BQY8jJNR.js";import{n as Ne,t as Pe}from"./axios-DaWTGg7G.js";import{g as Fe,v as Ie}from"./types-zk5Ltv5q.js";import{Dn as Le,Kn as Re,L as ze,Sn as Be,W as Ve,kt as k,on as He,q as Ue,zt as We}from"./state-BowF111d.js";import{C as Ge,H as Ke,L as qe,N as Je,c as A,et as Ye,i as j,r as Xe,tt as Ze,x as Qe}from"./debug-8DCufdSp.js";import{d as $e,h as et}from"./settings-DKN4xSpQ.js";import{c as tt,m as nt,n as rt,v as it}from"./config-BddEvZZl.js";import{d as at,f as ot,o as st,s as M}from"./log-DaILwWJa.js";import{a as ct,i as lt,o as ut}from"./platform-Dzff1WWw.js";import{n as dt,r as ft}from"./startupProfiler-DTs9w9EN.js";import{Cn as pt,Ct as mt,Dn as ht,En as gt,St as _t,Tt as vt,gt as yt,xt as bt,yt as xt}from"./model-BwBE0Pt5.js";import{_ as St,a as Ct,c as wt,f as Tt,g as Et,l as Dt,m as Ot,v as kt,y as At}from"./proxy-CB17QimU.js";import{C as jt,S as Mt,_ as Nt,c as Pt,g as Ft,l as It,r as Lt}from"./sessionTracing-yBre24PH.js";var N;(function(e){e[e.DELTA=0]=`DELTA`,e[e.CUMULATIVE=1]=`CUMULATIVE`})(N||(N={}));var P;(function(e){e.COUNTER=`COUNTER`,e.GAUGE=`GAUGE`,e.HISTOGRAM=`HISTOGRAM`,e.UP_DOWN_COUNTER=`UP_DOWN_COUNTER`,e.OBSERVABLE_COUNTER=`OBSERVABLE_COUNTER`,e.OBSERVABLE_GAUGE=`OBSERVABLE_GAUGE`,e.OBSERVABLE_UP_DOWN_COUNTER=`OBSERVABLE_UP_DOWN_COUNTER`})(P||(P={}));var F;(function(e){e[e.HISTOGRAM=0]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=1]=`EXPONENTIAL_HISTOGRAM`,e[e.GAUGE=2]=`GAUGE`,e[e.SUM=3]=`SUM`})(F||(F={}));function Rt(e){let t=Object.keys(e);return t.length===0?``:(t=t.sort(),JSON.stringify(t.map(t=>[t,e[t]])))}function zt(e){return`${e.name}:${e.version??``}:${e.schemaUrl??``}`}var Bt=class e extends Error{constructor(t){super(t),Object.setPrototypeOf(this,e.prototype)}};function I(e,t){let n,r=new Promise(function(e,r){n=setTimeout(function(){r(new Bt(`Operation timed out.`))},t)});return Promise.race([e,r]).then(e=>(clearTimeout(n),e),e=>{throw clearTimeout(n),e})}function Vt(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function Ht(e,t){let n=0,r=e.length-1,i=e.length;for(;r>=n;){let a=n+Math.trunc((r-n)/2);e[a]<t?n=a+1:(i=a,r=a-1)}return i}function Ut(e,t){return e.toLowerCase()===t.toLowerCase()}var L;(function(e){e[e.DROP=0]=`DROP`,e[e.SUM=1]=`SUM`,e[e.LAST_VALUE=2]=`LAST_VALUE`,e[e.HISTOGRAM=3]=`HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=4]=`EXPONENTIAL_HISTOGRAM`})(L||(L={})),r();var Wt=class{constructor(){i(this,`kind`,L.DROP)}createAccumulation(){}merge(e,t){}diff(e,t){}toMetricData(e,t,n,r){}};r();function Gt(e){let t=e.map(()=>0);return t.push(0),{buckets:{boundaries:e,counts:t},sum:0,count:0,hasMinMax:!1,min:1/0,max:-1/0}}var Kt=class{constructor(e,t,n=!0,r=Gt(t)){i(this,`startTime`,void 0),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_current`,void 0),this.startTime=e,this._boundaries=t,this._recordMinMax=n,this._current=r}record(e){if(Number.isNaN(e))return;this._current.count+=1,this._current.sum+=e,this._recordMinMax&&(this._current.min=Math.min(e,this._current.min),this._current.max=Math.max(e,this._current.max),this._current.hasMinMax=!0);let t=Ht(this._boundaries,e);this._current.buckets.counts[t]+=1}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},qt=class{constructor(e,t){i(this,`kind`,L.HISTOGRAM),i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),this._boundaries=e,this._recordMinMax=t}createAccumulation(e){return new Kt(e,this._boundaries,this._recordMinMax)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=i[e]+a[e];let s=1/0,c=-1/0;return this._recordMinMax&&(n.hasMinMax&&r.hasMinMax?(s=Math.min(n.min,r.min),c=Math.max(n.max,r.max)):n.hasMinMax?(s=n.min,c=n.max):r.hasMinMax&&(s=r.min,c=r.max)),new Kt(e.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:n.count+r.count,sum:n.sum+r.sum,hasMinMax:this._recordMinMax&&(n.hasMinMax||r.hasMinMax),min:s,max:c})}diff(e,t){let n=e.toPointValue(),r=t.toPointValue(),i=n.buckets.counts,a=r.buckets.counts,o=Array(i.length);for(let e=0;e<i.length;e++)o[e]=a[e]-i[e];return new Kt(t.startTime,n.buckets.boundaries,this._recordMinMax,{buckets:{boundaries:n.buckets.boundaries,counts:o},count:r.count-n.count,sum:r.sum-n.sum,hasMinMax:!1,min:1/0,max:-1/0})}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:F.HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===P.GAUGE||e.type===P.UP_DOWN_COUNTER||e.type===P.OBSERVABLE_GAUGE||e.type===P.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,buckets:i.buckets,count:i.count}}})}}};r();var Jt=class e{constructor(e=new Yt,t=0,n=0,r=0){i(this,`backing`,void 0),i(this,`indexBase`,void 0),i(this,`indexStart`,void 0),i(this,`indexEnd`,void 0),this.backing=e,this.indexBase=t,this.indexStart=n,this.indexEnd=r}get offset(){return this.indexStart}get length(){return this.backing.length===0||this.indexEnd===this.indexStart&&this.at(0)===0?0:this.indexEnd-this.indexStart+1}counts(){return Array.from({length:this.length},(e,t)=>this.at(t))}at(e){let t=this.indexBase-this.indexStart;return e<t&&(e+=this.backing.length),e-=t,this.backing.countAt(e)}incrementBucket(e,t){this.backing.increment(e,t)}decrementBucket(e,t){this.backing.decrement(e,t)}trim(){for(let e=0;e<this.length;e++)if(this.at(e)!==0){this.indexStart+=e;break}else if(e===this.length-1){this.indexStart=this.indexEnd=this.indexBase=0;return}for(let e=this.length-1;e>=0;e--)if(this.at(e)!==0){this.indexEnd-=this.length-e-1;break}this._rotate()}downscale(e){this._rotate();let t=1+this.indexEnd-this.indexStart,n=1<<e,r=0,i=0;for(let e=this.indexStart;e<=this.indexEnd;){let a=e%n;a<0&&(a+=n);for(let o=a;o<n&&r<t;o++)this._relocateBucket(i,r),r++,e++;i++}this.indexStart>>=e,this.indexEnd>>=e,this.indexBase=this.indexStart}clone(){return new e(this.backing.clone(),this.indexBase,this.indexStart,this.indexEnd)}_rotate(){let e=this.indexBase-this.indexStart;e!==0&&(e>0?(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,e),this.backing.reverse(e,this.backing.length)):(this.backing.reverse(0,this.backing.length),this.backing.reverse(0,this.backing.length+e)),this.indexBase=this.indexStart)}_relocateBucket(e,t){e!==t&&this.incrementBucket(e,this.backing.emptyBucket(t))}},Yt=class e{constructor(e=[0]){i(this,`_counts`,void 0),this._counts=e}get length(){return this._counts.length}countAt(e){return this._counts[e]}growTo(e,t,n){let r=Array(e).fill(0);r.splice(n,this._counts.length-t,...this._counts.slice(t)),r.splice(0,t,...this._counts.slice(0,t)),this._counts=r}reverse(e,t){let n=Math.floor((e+t)/2)-e;for(let r=0;r<n;r++){let n=this._counts[e+r];this._counts[e+r]=this._counts[t-r-1],this._counts[t-r-1]=n}}emptyBucket(e){let t=this._counts[e];return this._counts[e]=0,t}increment(e,t){this._counts[e]+=t}decrement(e,t){this._counts[e]>=t?this._counts[e]-=t:this._counts[e]=0}clone(){return new e([...this._counts])}},Xt=2146435072,Zt=1048575,Qt=1023,$t=-1022,en=Qt,tn=2**-1022;function nn(e){let t=new DataView(new ArrayBuffer(8));return t.setFloat64(0,e),((t.getUint32(0)&Xt)>>20)-Qt}function rn(e){let t=new DataView(new ArrayBuffer(8));t.setFloat64(0,e);let n=t.getUint32(0),r=t.getUint32(4);return(n&Zt)*2**32+r}function an(e,t){return e===0||e===1/0||e===-1/0||Number.isNaN(e)?e:e*2**t}function on(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,e++,e}var R=class extends Error{};r();var sn=class{constructor(e){i(this,`_shift`,void 0),this._shift=-e}mapToIndex(e){return e<tn?this._minNormalLowerBoundaryIndex():nn(e)+this._rightShift(rn(e)-1,52)>>this._shift}lowerBoundary(e){let t=this._minNormalLowerBoundaryIndex();if(e<t)throw new R(`underflow: ${e} is < minimum lower boundary: ${t}`);let n=this._maxNormalLowerBoundaryIndex();if(e>n)throw new R(`overflow: ${e} is > maximum lower boundary: ${n}`);return an(1,e<<this._shift)}get scale(){return this._shift===0?0:-this._shift}_minNormalLowerBoundaryIndex(){let e=$t>>this._shift;return this._shift<2&&e--,e}_maxNormalLowerBoundaryIndex(){return en>>this._shift}_rightShift(e,t){return Math.floor(e*2**-t)}};r();var cn=class{constructor(e){i(this,`_scale`,void 0),i(this,`_scaleFactor`,void 0),i(this,`_inverseFactor`,void 0),this._scale=e,this._scaleFactor=an(Math.LOG2E,e),this._inverseFactor=an(Math.LN2,-e)}mapToIndex(e){if(e<=tn)return this._minNormalLowerBoundaryIndex()-1;if(rn(e)===0)return(nn(e)<<this._scale)-1;let t=Math.floor(Math.log(e)*this._scaleFactor),n=this._maxNormalLowerBoundaryIndex();return t>=n?n:t}lowerBoundary(e){let t=this._maxNormalLowerBoundaryIndex();if(e>=t){if(e===t)return 2*Math.exp((e-(1<<this._scale))/this._scaleFactor);throw new R(`overflow: ${e} is > maximum lower boundary: ${t}`)}let n=this._minNormalLowerBoundaryIndex();if(e<=n){if(e===n)return tn;if(e===n-1)return Math.exp((e+(1<<this._scale))/this._scaleFactor)/2;throw new R(`overflow: ${e} is < minimum lower boundary: ${n}`)}return Math.exp(e*this._inverseFactor)}get scale(){return this._scale}_minNormalLowerBoundaryIndex(){return $t<<this._scale}_maxNormalLowerBoundaryIndex(){return(en+1<<this._scale)-1}},ln=-10,un=20,dn=Array.from({length:31},(e,t)=>t>10?new cn(t-10):new sn(t-10));function fn(e){if(e>un||e<ln)throw new R(`expected scale >= ${ln} && <= ${un}, got: ${e}`);return dn[e+10]}p(),r();var z=class e{static combine(t,n){return new e(Math.min(t.low,n.low),Math.max(t.high,n.high))}constructor(e,t){i(this,`low`,void 0),i(this,`high`,void 0),this.low=e,this.high=t}},pn=20,mn=160,hn=2,gn=class e{constructor(e,t=mn,n=!0,r=0,a=0,o=0,s=1/0,c=-1/0,l=new Jt,u=new Jt,d=fn(pn)){i(this,`startTime`,void 0),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),i(this,`_sum`,void 0),i(this,`_count`,void 0),i(this,`_zeroCount`,void 0),i(this,`_min`,void 0),i(this,`_max`,void 0),i(this,`_positive`,void 0),i(this,`_negative`,void 0),i(this,`_mapping`,void 0),this.startTime=e,this._maxSize=t,this._recordMinMax=n,this._sum=r,this._count=a,this._zeroCount=o,this._min=s,this._max=c,this._positive=l,this._negative=u,this._mapping=d,this._maxSize<hn&&(m.warn(`Exponential Histogram Max Size set to ${this._maxSize}, \
2
+ changing to the minimum size of: ${hn}`),this._maxSize=hn)}record(e){this.updateByIncrement(e,1)}setStartTime(e){this.startTime=e}toPointValue(){return{hasMinMax:this._recordMinMax,min:this.min,max:this.max,sum:this.sum,positive:{offset:this.positive.offset,bucketCounts:this.positive.counts()},negative:{offset:this.negative.offset,bucketCounts:this.negative.counts()},count:this.count,scale:this.scale,zeroCount:this.zeroCount}}get sum(){return this._sum}get min(){return this._min}get max(){return this._max}get count(){return this._count}get zeroCount(){return this._zeroCount}get scale(){return this._count===this._zeroCount?0:this._mapping.scale}get positive(){return this._positive}get negative(){return this._negative}updateByIncrement(e,t){if(!Number.isNaN(e)){if(e>this._max&&(this._max=e),e<this._min&&(this._min=e),this._count+=t,e===0){this._zeroCount+=t;return}this._sum+=e*t,e>0?this._updateBuckets(this._positive,e,t):this._updateBuckets(this._negative,-e,t)}}merge(e){this._count===0?(this._min=e.min,this._max=e.max):e.count!==0&&(e.min<this.min&&(this._min=e.min),e.max>this.max&&(this._max=e.max)),this.startTime=e.startTime,this._sum+=e.sum,this._count+=e.count,this._zeroCount+=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._mergeBuckets(this.positive,e,e.positive,t),this._mergeBuckets(this.negative,e,e.negative,t)}diff(e){this._min=1/0,this._max=-1/0,this._sum-=e.sum,this._count-=e.count,this._zeroCount-=e.zeroCount;let t=this._minScale(e);this._downscale(this.scale-t),this._diffBuckets(this.positive,e,e.positive,t),this._diffBuckets(this.negative,e,e.negative,t)}clone(){return new e(this.startTime,this._maxSize,this._recordMinMax,this._sum,this._count,this._zeroCount,this._min,this._max,this.positive.clone(),this.negative.clone(),this._mapping)}_updateBuckets(e,t,n){let r=this._mapping.mapToIndex(t),i=!1,a=0,o=0;if(e.length===0?(e.indexStart=r,e.indexEnd=e.indexStart,e.indexBase=e.indexStart):r<e.indexStart&&e.indexEnd-r>=this._maxSize?(i=!0,o=r,a=e.indexEnd):r>e.indexEnd&&r-e.indexStart>=this._maxSize&&(i=!0,o=e.indexStart,a=r),i){let e=this._changeScale(a,o);this._downscale(e),r=this._mapping.mapToIndex(t)}this._incrementIndexBy(e,r,n)}_incrementIndexBy(e,t,n){if(n===0)return;if(e.length===0&&(e.indexStart=e.indexEnd=e.indexBase=t),t<e.indexStart){let n=e.indexEnd-t;n>=e.backing.length&&this._grow(e,n+1),e.indexStart=t}else if(t>e.indexEnd){let n=t-e.indexStart;n>=e.backing.length&&this._grow(e,n+1),e.indexEnd=t}let r=t-e.indexBase;r<0&&(r+=e.backing.length),e.incrementBucket(r,n)}_grow(e,t){let n=e.backing.length,r=e.indexBase-e.indexStart,i=n-r,a=on(t);a>this._maxSize&&(a=this._maxSize);let o=a-r;e.backing.growTo(a,i,o)}_changeScale(e,t){let n=0;for(;e-t>=this._maxSize;)e>>=1,t>>=1,n++;return n}_downscale(e){if(e===0)return;if(e<0)throw Error(`impossible change of scale: ${this.scale}`);let t=this._mapping.scale-e;this._positive.downscale(e),this._negative.downscale(e),this._mapping=fn(t)}_minScale(e){let t=Math.min(this.scale,e.scale),n=z.combine(this._highLowAtScale(this.positive,this.scale,t),this._highLowAtScale(e.positive,e.scale,t)),r=z.combine(this._highLowAtScale(this.negative,this.scale,t),this._highLowAtScale(e.negative,e.scale,t));return Math.min(t-this._changeScale(n.high,n.low),t-this._changeScale(r.high,r.low))}_highLowAtScale(e,t,n){if(e.length===0)return new z(0,-1);let r=t-n;return new z(e.indexStart>>r,e.indexEnd>>r)}_mergeBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++)this._incrementIndexBy(e,i+t>>a,n.at(t))}_diffBuckets(e,t,n,r){let i=n.offset,a=t.scale-r;for(let t=0;t<n.length;t++){let r=(i+t>>a)-e.indexBase;r<0&&(r+=e.backing.length),e.decrementBucket(r,n.at(t))}e.trim()}},_n=class{constructor(e,t){i(this,`kind`,L.EXPONENTIAL_HISTOGRAM),i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAccumulation(e){return new gn(e,this._maxSize,this._recordMinMax)}merge(e,t){let n=t.clone();return n.merge(e),n}diff(e,t){let n=t.clone();return n.diff(e),n}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:F.EXPONENTIAL_HISTOGRAM,dataPoints:n.map(([t,n])=>{let i=n.toPointValue(),a=e.type===P.GAUGE||e.type===P.UP_DOWN_COUNTER||e.type===P.OBSERVABLE_GAUGE||e.type===P.OBSERVABLE_UP_DOWN_COUNTER;return{attributes:t,startTime:n.startTime,endTime:r,value:{min:i.hasMinMax?i.min:void 0,max:i.hasMinMax?i.max:void 0,sum:a?void 0:i.sum,positive:{offset:i.positive.offset,bucketCounts:i.positive.bucketCounts},negative:{offset:i.negative.offset,bucketCounts:i.negative.bucketCounts},count:i.count,scale:i.scale,zeroCount:i.zeroCount}}})}}};D(),r();var vn=class{constructor(e,t=0,n=[0,0]){i(this,`startTime`,void 0),i(this,`_current`,void 0),i(this,`sampleTime`,void 0),this.startTime=e,this._current=t,this.sampleTime=n}record(e){this._current=e,this.sampleTime=S(Date.now())}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},yn=class{constructor(){i(this,`kind`,L.LAST_VALUE)}createAccumulation(e){return new vn(e)}merge(e,t){let n=E(t.sampleTime)>=E(e.sampleTime)?t:e;return new vn(e.startTime,n.toPointValue(),n.sampleTime)}diff(e,t){let n=E(t.sampleTime)>=E(e.sampleTime)?t:e;return new vn(t.startTime,n.toPointValue(),n.sampleTime)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:F.GAUGE,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()}))}}};r();var B=class{constructor(e,t,n=0,r=!1){i(this,`startTime`,void 0),i(this,`monotonic`,void 0),i(this,`_current`,void 0),i(this,`reset`,void 0),this.startTime=e,this.monotonic=t,this._current=n,this.reset=r}record(e){this.monotonic&&e<0||(this._current+=e)}setStartTime(e){this.startTime=e}toPointValue(){return this._current}},bn=class{constructor(e){i(this,`kind`,L.SUM),i(this,`monotonic`,void 0),this.monotonic=e}createAccumulation(e){return new B(e,this.monotonic)}merge(e,t){let n=e.toPointValue(),r=t.toPointValue();return t.reset?new B(t.startTime,this.monotonic,r,t.reset):new B(e.startTime,this.monotonic,n+r)}diff(e,t){let n=e.toPointValue(),r=t.toPointValue();return this.monotonic&&n>r?new B(t.startTime,this.monotonic,r,!0):new B(t.startTime,this.monotonic,r-n)}toMetricData(e,t,n,r){return{descriptor:e,aggregationTemporality:t,dataPointType:F.SUM,dataPoints:n.map(([e,t])=>({attributes:e,startTime:t.startTime,endTime:r,value:t.toPointValue()})),isMonotonic:this.monotonic}}};p(),r();var xn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(xn,`DEFAULT_INSTANCE`,new Wt);var Sn=class e{createAggregator(t){switch(t.type){case P.COUNTER:case P.OBSERVABLE_COUNTER:case P.HISTOGRAM:return e.MONOTONIC_INSTANCE;default:return e.NON_MONOTONIC_INSTANCE}}};i(Sn,`MONOTONIC_INSTANCE`,new bn(!0)),i(Sn,`NON_MONOTONIC_INSTANCE`,new bn(!1));var Cn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(Cn,`DEFAULT_INSTANCE`,new yn);var wn=class e{createAggregator(t){return e.DEFAULT_INSTANCE}};i(wn,`DEFAULT_INSTANCE`,new qt([0,5,10,25,50,75,100,250,500,750,1e3,2500,5e3,7500,1e4],!0));var Tn=class{constructor(e,t=!0){if(i(this,`_boundaries`,void 0),i(this,`_recordMinMax`,void 0),e==null)throw Error(`ExplicitBucketHistogramAggregation should be created with explicit boundaries, if a single bucket histogram is required, please pass an empty array`);e=e.concat(),e=e.sort((e,t)=>e-t);let n=e.lastIndexOf(-1/0),r=e.indexOf(1/0);r===-1&&(r=void 0),this._boundaries=e.slice(n+1,r),this._recordMinMax=t}createAggregator(e){return new qt(this._boundaries,this._recordMinMax)}},En=class{constructor(e=160,t=!0){i(this,`_maxSize`,void 0),i(this,`_recordMinMax`,void 0),this._maxSize=e,this._recordMinMax=t}createAggregator(e){return new _n(this._maxSize,this._recordMinMax)}},Dn=class{_resolve(e){switch(e.type){case P.COUNTER:case P.UP_DOWN_COUNTER:case P.OBSERVABLE_COUNTER:case P.OBSERVABLE_UP_DOWN_COUNTER:return kn;case P.GAUGE:case P.OBSERVABLE_GAUGE:return An;case P.HISTOGRAM:return e.advice.explicitBucketBoundaries?new Tn(e.advice.explicitBucketBoundaries):jn}return m.warn(`Unable to recognize instrument type: ${e.type}`),On}createAggregator(e){return this._resolve(e).createAggregator(e)}},On=new xn,kn=new Sn,An=new Cn,jn=new wn;new En;var Mn=new Dn,V;(function(e){e[e.DEFAULT=0]=`DEFAULT`,e[e.DROP=1]=`DROP`,e[e.SUM=2]=`SUM`,e[e.LAST_VALUE=3]=`LAST_VALUE`,e[e.EXPLICIT_BUCKET_HISTOGRAM=4]=`EXPLICIT_BUCKET_HISTOGRAM`,e[e.EXPONENTIAL_HISTOGRAM=5]=`EXPONENTIAL_HISTOGRAM`})(V||(V={}));function Nn(e){switch(e.type){case V.DEFAULT:return Mn;case V.DROP:return On;case V.SUM:return kn;case V.LAST_VALUE:return An;case V.EXPONENTIAL_HISTOGRAM:{let t=e;return new En(t.options?.maxSize,t.options?.recordMinMax)}case V.EXPLICIT_BUCKET_HISTOGRAM:{let t=e;return t.options==null?jn:new Tn(t.options?.boundaries,t.options?.recordMinMax)}default:throw Error(`Unsupported Aggregation`)}}var Pn=e=>({type:V.DEFAULT}),Fn=e=>N.CUMULATIVE,In=`otel.component.name`,Ln=`otel.component.type`,Rn=`periodic_metric_reader`,zn=`otel.sdk.metric_reader.collection.duration`,Bn=`error.type`;r();var Vn=new Map,Hn=class{constructor(e,t){i(this,`collectionDuration`,void 0),i(this,`standardAttrs`,void 0);let n=Vn.get(e)??0;Vn.set(e,n+1),this.standardAttrs={[Ln]:e,[In]:`${e}/${n}`},this.collectionDuration=t.createHistogram(zn,{unit:`s`,description:`The duration of the collect operation of the metric reader.`,advice:{explicitBucketBoundaries:[]}})}recordCollection(e,t){let n=t?{...this.standardAttrs,[Bn]:t}:this.standardAttrs;this.collectionDuration.record(e,n)}},Un=`2.9.0`;p(),D(),r();var Wn=class{constructor(e){i(this,`_shutdown`,!1),i(this,`_metricProducers`,void 0),i(this,`_sdkMetricProducer`,void 0),i(this,`_selfObsMetrics`,void 0),i(this,`_aggregationTemporalitySelector`,void 0),i(this,`_aggregationSelector`,void 0),i(this,`_cardinalitySelector`,void 0),i(this,`_otelComponentType`,void 0),this._aggregationSelector=e?.aggregationSelector??Pn,this._aggregationTemporalitySelector=e?.aggregationTemporalitySelector??Fn,this._metricProducers=e?.metricProducers??[],this._cardinalitySelector=e?.cardinalitySelector,this._otelComponentType=e?.otelComponentType??this.constructor.name,this._selfObsMetrics=new Hn(this._otelComponentType,a())}setMetricProducer(e){if(this._sdkMetricProducer)throw Error(`MetricReader can not be bound to a MeterProvider again.`);this._sdkMetricProducer=e,this.onInitialized()}_setSelfObsMeterProvider(e){let t=e.getMeter(`@opentelemetry/sdk-metrics`,Un);this._selfObsMetrics=new Hn(this._otelComponentType,t)}selectAggregation(e){return this._aggregationSelector(e)}selectAggregationTemporality(e){return this._aggregationTemporalitySelector(e)}selectCardinalityLimit(e){return this._cardinalitySelector?this._cardinalitySelector(e):2e3}onInitialized(){}async collect(e){if(this._sdkMetricProducer===void 0)throw Error(`MetricReader is not bound to a MetricProducer`);if(this._shutdown)throw Error(`MetricReader is shutdown`);let t=ue(),[n,...r]=await Promise.all([this._sdkMetricProducer.collect({timeoutMillis:e?.timeoutMillis}),...this._metricProducers.map(t=>t.collect({timeoutMillis:e?.timeoutMillis}))]),i=ue(),a=n.errors.concat(r.flatMap(e=>e.errors)),o=ce(he(t,i));return this._selfObsMetrics.recordCollection(o,a.length>0?a[0].name??`collect_error`:void 0),{resourceMetrics:{resource:n.resourceMetrics.resource,scopeMetrics:n.resourceMetrics.scopeMetrics.concat(r.flatMap(e=>e.resourceMetrics.scopeMetrics))},errors:a}}async shutdown(e){if(this._shutdown){m.error(`Cannot call shutdown twice.`);return}e?.timeoutMillis==null?await this.onShutdown():await I(this.onShutdown(),e.timeoutMillis),this._shutdown=!0}async forceFlush(e){if(this._shutdown){m.warn(`Cannot forceFlush on already shutdown MetricReader.`);return}if(e?.timeoutMillis==null){await this.onForceFlush();return}await I(this.onForceFlush(),e.timeoutMillis)}};function Gn(e,t){if(!Number.isInteger(t)||t<=0)throw Error(`maxExportBatchSize must be a positive integer`);let n=[],r=0,i=[];function a(){i.length>0&&(n.push({resource:e.resource,scopeMetrics:i}),i=[],r=0)}for(let n of e.scopeMetrics){let e=null;for(let o of n.metrics){let s=o.dataPoints;if(s.length===0){e||(e={scope:n.scope,metrics:[]},i.push(e)),e.metrics.push(o);continue}let c=0;for(;c<s.length;){let l=t-r,u=Math.min(l,s.length-c);e||(e={scope:n.scope,metrics:[]},i.push(e));let d={...o,dataPoints:s.slice(c,c+u)};e.metrics.push(d),c+=u,r+=u,r===t&&(a(),e=null)}}}return a(),n}p(),D(),r();var Kn=class extends Wn{constructor(e){let{exporter:t,exportIntervalMillis:n=6e4,metricProducers:r,cardinalityLimits:a,maxExportBatchSize:o}=e,{exportTimeoutMillis:s=3e4}=e;if(super({aggregationSelector:t.selectAggregation?.bind(t),aggregationTemporalitySelector:t.selectAggregationTemporality?.bind(t),otelComponentType:Rn,metricProducers:r,cardinalitySelector:e=>{let t={default:2e3,...a};switch(e){case P.COUNTER:return t.counter??t.default;case P.GAUGE:return t.gauge??t.default;case P.HISTOGRAM:return t.histogram??t.default;case P.OBSERVABLE_COUNTER:return t.observableCounter??t.default;case P.OBSERVABLE_UP_DOWN_COUNTER:return t.observableUpDownCounter??t.default;case P.OBSERVABLE_GAUGE:return t.observableGauge??t.default;case P.UP_DOWN_COUNTER:return t.upDownCounter??t.default;default:return t.default}}}),i(this,`_interval`,void 0),i(this,`_exporter`,void 0),i(this,`_exportInterval`,void 0),i(this,`_exportTimeout`,void 0),i(this,`_maxExportBatchSize`,void 0),i(this,`_ongoingExportPromise`,null),n<=0)throw Error(`exportIntervalMillis must be greater than 0`);if(s<=0)throw Error(`exportTimeoutMillis must be greater than 0`);if(o!==void 0&&(!Number.isInteger(o)||o<=0))throw Error(`maxExportBatchSize must be a positive integer`);if(n<s){if(`exportIntervalMillis`in e&&`exportTimeoutMillis`in e)throw Error(`exportIntervalMillis must be greater than or equal to exportTimeoutMillis`);m.info(`Timeout of ${s} exceeds the interval of ${n}. Clamping timeout to interval duration.`),s=n}this._exportInterval=n,this._exportTimeout=s,this._exporter=t,this._maxExportBatchSize=o}async _runOnce(){try{await this._doRun()}catch(e){y(e)}}async _doRun(){if(this._ongoingExportPromise){m.debug(`PeriodicExportingMetricReader: export already in progress, skipping`);return}let e=async()=>{let{resourceMetrics:e,errors:t}=await this.collect({timeoutMillis:this._exportTimeout});if(t.length>0&&m.error(`PeriodicExportingMetricReader: metrics collection errors`,...t),e.resource.asyncAttributesPending)try{await e.resource.waitForAsyncAttributes?.()}catch(e){m.debug(`Error while resolving async portion of resource: `,e),y(e)}if(e.scopeMetrics.length===0)return;let n=this._maxExportBatchSize?Gn(e,this._maxExportBatchSize):[e],r=null;for(let e of n)try{let t=await I(Me._export(this._exporter,e),this._exportTimeout);t.code!==O.SUCCESS&&(r=Error(`PeriodicExportingMetricReader: metrics export failed (error ${t.error})`))}catch(e){if(e instanceof Bt){m.error(`PeriodicExportingMetricReader: metrics export timed out after ${this._exportTimeout}ms`);break}else m.error(`PeriodicExportingMetricReader: metrics export threw error`,e),r=e instanceof Error?e:Error(String(e))}if(r)throw r};this._ongoingExportPromise=e();try{await this._ongoingExportPromise}finally{this._ongoingExportPromise=null}}onInitialized(){this._interval=setInterval(()=>{this._runOnce()},this._exportInterval),typeof this._interval!=`number`&&this._interval.unref()}async onForceFlush(){await this._awaitOngoingExport(),this._ongoingExportPromise?await this._awaitOngoingExport():await this._runOnce(),await this._exporter.forceFlush()}async _awaitOngoingExport(){if(this._ongoingExportPromise){m.debug(`PeriodicExportingMetricReader: export already in progress, awaiting ongoing export`);try{await this._ongoingExportPromise}catch{}}}async onShutdown(){this._interval&&clearInterval(this._interval),await this.onForceFlush(),await this._exporter.shutdown()}};D(),r();var qn=class e{constructor(e){i(this,`_shutdown`,!1),i(this,`_temporalitySelector`,void 0),this._temporalitySelector=e?.temporalitySelector??Fn}export(t,n){if(this._shutdown){n({code:O.FAILED});return}return e._sendMetrics(t,n)}forceFlush(){return Promise.resolve()}selectAggregationTemporality(e){return this._temporalitySelector(e)}shutdown(){return this._shutdown=!0,Promise.resolve()}static _sendMetrics(e,t){for(let t of e.scopeMetrics)for(let e of t.metrics)console.dir({descriptor:e.descriptor,dataPointType:e.dataPointType,dataPoints:e.dataPoints},{depth:null});t({code:O.SUCCESS})}};r();var Jn=class{constructor(){i(this,`_registeredViews`,[])}addView(e){this._registeredViews.push(e)}findViews(e,t){return this._registeredViews.filter(n=>this._matchInstrument(n.instrumentSelector,e)&&this._matchMeter(n.meterSelector,t))}_matchInstrument(e,t){return(e.getType()===void 0||t.type===e.getType())&&e.getNameFilter().match(t.name)&&e.getUnitFilter().match(t.unit)}_matchMeter(e,t){return e.getNameFilter().match(t.name)&&(t.version===void 0||e.getVersionFilter().match(t.version))&&(t.schemaUrl===void 0||e.getSchemaUrlFilter().match(t.schemaUrl))}};p();function H(e,t,n){return Qn(e)||m.warn(`Invalid metric name: "${e}". The metric name should be a ASCII string with a length no greater than 255 characters.`),{name:e,type:t,description:n?.description??``,unit:n?.unit??``,valueType:n?.valueType??h.DOUBLE,advice:n?.advice??{}}}function Yn(e,t){return{name:e.name??t.name,description:e.description??t.description,type:t.type,unit:t.unit,valueType:t.valueType,advice:t.advice}}function Xn(e,t){return Ut(e.name,t.name)&&e.unit===t.unit&&e.type===t.type&&e.valueType===t.valueType}var Zn=/^[a-z][a-z0-9_.\-/]{0,254}$/i;function Qn(e){return Zn.test(e)}p(),r();var U=class{constructor(e,t){i(this,`_writableMetricStorage`,void 0),i(this,`_descriptor`,void 0),this._writableMetricStorage=e,this._descriptor=t}_record(e,t={},n){if(typeof e!=`number`){m.warn(`non-number value provided to metric ${this._descriptor.name}: ${e}`);return}this._descriptor.valueType===h.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._descriptor.name}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._writableMetricStorage.record(e,t,n,Date.now())}},$n=class extends U{add(e,t,n){this._record(e,t,n)}},er=class extends U{add(e,t,n){if(e<0){m.warn(`negative value provided to counter ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},tr=class extends U{record(e,t,n){this._record(e,t,n)}},nr=class extends U{record(e,t,n){if(e<0){m.warn(`negative value provided to histogram ${this._descriptor.name}: ${e}`);return}this._record(e,t,n)}},W=class{constructor(e,t,n){i(this,`_metricStorages`,void 0),i(this,`_descriptor`,void 0),i(this,`_observableRegistry`,void 0),this._descriptor=e,this._metricStorages=t,this._observableRegistry=n}addCallback(e){this._observableRegistry.addCallback(e,this)}removeCallback(e){this._observableRegistry.removeCallback(e,this)}},rr=class extends W{},ir=class extends W{},ar=class extends W{};function or(e){return e instanceof W}r();var sr=class{constructor(e){i(this,`_meterSharedState`,void 0),this._meterSharedState=e}createGauge(e,t){let n=H(e,P.GAUGE,t);return new tr(this._meterSharedState.registerMetricStorage(n),n)}createHistogram(e,t){let n=H(e,P.HISTOGRAM,t);return new nr(this._meterSharedState.registerMetricStorage(n),n)}createCounter(e,t){let n=H(e,P.COUNTER,t);return new er(this._meterSharedState.registerMetricStorage(n),n)}createUpDownCounter(e,t){let n=H(e,P.UP_DOWN_COUNTER,t);return new $n(this._meterSharedState.registerMetricStorage(n),n)}createObservableGauge(e,t){let n=H(e,P.OBSERVABLE_GAUGE,t);return new ir(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableCounter(e,t){let n=H(e,P.OBSERVABLE_COUNTER,t);return new rr(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}createObservableUpDownCounter(e,t){let n=H(e,P.OBSERVABLE_UP_DOWN_COUNTER,t);return new ar(n,this._meterSharedState.registerAsyncMetricStorage(n),this._meterSharedState.observableRegistry)}addBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.addBatchCallback(e,t)}removeBatchObservableCallback(e,t){this._meterSharedState.observableRegistry.removeBatchCallback(e,t)}};r();var cr=class{constructor(e){i(this,`_instrumentDescriptor`,void 0),this._instrumentDescriptor=e}getInstrumentDescriptor(){return this._instrumentDescriptor}updateDescription(e){this._instrumentDescriptor=H(this._instrumentDescriptor.name,this._instrumentDescriptor.type,{description:e,valueType:this._instrumentDescriptor.valueType,unit:this._instrumentDescriptor.unit,advice:this._instrumentDescriptor.advice})}};r();var lr=class{constructor(e){i(this,`_valueMap`,new Map),i(this,`_keyMap`,new Map),i(this,`_hash`,void 0),this._hash=e}get(e,t){return t??(t=this._hash(e)),this._valueMap.get(t)}getOrDefault(e,t){let n=this._hash(e);if(this._valueMap.has(n))return this._valueMap.get(n);let r=t();return this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,r),r}set(e,t,n){n??(n=this._hash(e)),this._keyMap.has(n)||this._keyMap.set(n,e),this._valueMap.set(n,t)}has(e,t){return t??(t=this._hash(e)),this._valueMap.has(t)}*keys(){let e=this._keyMap.entries(),t=e.next();for(;t.done!==!0;)yield[t.value[1],t.value[0]],t=e.next()}*entries(){let e=this._valueMap.entries(),t=e.next();for(;t.done!==!0;)yield[this._keyMap.get(t.value[0]),t.value[1],t.value[0]],t=e.next()}get size(){return this._valueMap.size}},G=class extends lr{constructor(){super(Rt)}};D(),r();var ur=class{constructor(e,t){i(this,`_activeCollectionStorage`,new G),i(this,`_cumulativeMemoStorage`,new G),i(this,`_cardinalityLimit`,void 0),i(this,`_overflowAttributes`,{"otel.metric.overflow":!0}),i(this,`_overflowHashCode`,void 0),i(this,`_aggregator`,void 0),this._aggregator=e,this._cardinalityLimit=(t??2e3)-1,this._overflowHashCode=Rt(this._overflowAttributes)}record(e,t,n){let r=this._activeCollectionStorage.get(t);if(!r){let i=S(n);if(this._activeCollectionStorage.size>=this._cardinalityLimit){this._activeCollectionStorage.getOrDefault(this._overflowAttributes,()=>this._aggregator.createAccumulation(i))?.record(e);return}r=this._aggregator.createAccumulation(i),this._activeCollectionStorage.set(t,r)}r?.record(e)}batchCumulate(e,t){for(let[n,r,i]of e.entries()){let e=n,a=i,o=this._aggregator.createAccumulation(t);o?.record(r);let s=o;if(this._cumulativeMemoStorage.has(e,a)){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}else if(this._cumulativeMemoStorage.size>=this._cardinalityLimit&&(e=this._overflowAttributes,a=this._overflowHashCode,this._cumulativeMemoStorage.has(e,a))){let t=this._cumulativeMemoStorage.get(e,a);s=this._aggregator.diff(t,o)}if(this._activeCollectionStorage.has(e,a)){let t=this._activeCollectionStorage.get(e,a);s=this._aggregator.merge(t,s)}this._cumulativeMemoStorage.set(e,o,a),this._activeCollectionStorage.set(e,s,a)}}collect(){let e=this._activeCollectionStorage;return this._activeCollectionStorage=new G,e}};r();var dr=class e{constructor(e,t){i(this,`_aggregator`,void 0),i(this,`_unreportedAccumulations`,new Map),i(this,`_reportHistory`,new Map),this._aggregator=e,t.forEach(e=>{this._unreportedAccumulations.set(e,[])})}buildMetrics(t,n,r,i){this._stashAccumulations(r);let a=this._getMergedUnreportedAccumulations(t),o=a,s;if(this._reportHistory.has(t)){let n=this._reportHistory.get(t),r=n.collectionTime;s=n.aggregationTemporality,o=s===N.CUMULATIVE?e.merge(n.accumulations,a,this._aggregator):e.calibrateStartTime(n.accumulations,a,r)}else s=t.selectAggregationTemporality(n.type);this._reportHistory.set(t,{accumulations:o,collectionTime:i,aggregationTemporality:s});let c=fr(o);if(c.length!==0)return this._aggregator.toMetricData(n,s,c,i)}_stashAccumulations(e){let t=this._unreportedAccumulations.keys();for(let n of t){let t=this._unreportedAccumulations.get(n);t===void 0&&(t=[],this._unreportedAccumulations.set(n,t)),t.push(e)}}_getMergedUnreportedAccumulations(t){let n=new G,r=this._unreportedAccumulations.get(t);if(this._unreportedAccumulations.set(t,[]),r===void 0)return n;for(let t of r)n=e.merge(n,t,this._aggregator);return n}static merge(e,t,n){let r=e,i=t.entries(),a=i.next();for(;a.done!==!0;){let[t,o,s]=a.value;if(e.has(t,s)){let i=e.get(t,s),a=n.merge(i,o);r.set(t,a,s)}else r.set(t,o,s);a=i.next()}return r}static calibrateStartTime(e,t,n){for(let[r,i]of e.keys())t.get(r,i)?.setStartTime(n);return t}};function fr(e){return Array.from(e.entries())}r();var pr=class extends cr{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new ur(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new dr(t,r),this._attributesProcessor=n}record(e,t){if(this._attributesProcessor===void 0){this._deltaMetricStorage.batchCumulate(e,t);return}let n=new G;for(let[t,r]of e.entries())n.set(this._attributesProcessor.process(t),r);this._deltaMetricStorage.batchCumulate(n,t)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};function mr(e,t){let n=``;return e.unit!==t.unit&&(n+=`\t- Unit '${e.unit}' does not match '${t.unit}'\n`),e.type!==t.type&&(n+=`\t- Type '${e.type}' does not match '${t.type}'\n`),e.valueType!==t.valueType&&(n+=`\t- Value Type '${e.valueType}' does not match '${t.valueType}'\n`),e.description!==t.description&&(n+=`\t- Description '${e.description}' does not match '${t.description}'\n`),n}function hr(e,t){return`\t- use valueType '${e.valueType}' on instrument creation or use an instrument name other than '${t.name}'`}function gr(e,t){return`\t- use unit '${e.unit}' on instrument creation or use an instrument name other than '${t.name}'`}function _r(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'`}function vr(e,t){let n={name:t.name,type:t.type,unit:t.unit},r=JSON.stringify(n);return`\t- create a new view with a name other than '${e.name}' and InstrumentSelector '${r}'
3
+ \t- OR - create a new view with the name ${e.name} and description '${e.description}' and InstrumentSelector ${r}
4
+ \t- OR - create a new view with the name ${t.name} and description '${e.description}' and InstrumentSelector ${r}`}function yr(e,t){return e.valueType===t.valueType?e.unit===t.unit?e.type===t.type?e.description===t.description?``:vr(e,t):_r(e,t):gr(e,t):hr(e,t)}p(),r();var br=class e{constructor(){i(this,`_sharedRegistry`,new Map),i(this,`_perCollectorRegistry`,new Map)}static create(){return new e}getStorages(e){let t=[];for(let e of this._sharedRegistry.values())t=t.concat(e);let n=this._perCollectorRegistry.get(e);if(n!=null)for(let e of n.values())t=t.concat(e);return t}register(e){this._registerStorage(e,this._sharedRegistry)}registerForCollector(e,t){let n=this._perCollectorRegistry.get(e);n??(n=new Map,this._perCollectorRegistry.set(e,n)),this._registerStorage(t,n)}findOrUpdateCompatibleStorage(e){let t=this._sharedRegistry.get(e.name);return t===void 0?null:this._findOrUpdateCompatibleStorage(e,t)}findOrUpdateCompatibleCollectorStorage(e,t){let n=this._perCollectorRegistry.get(e);if(n===void 0)return null;let r=n.get(t.name);return r===void 0?null:this._findOrUpdateCompatibleStorage(t,r)}_registerStorage(e,t){let n=e.getInstrumentDescriptor(),r=t.get(n.name);if(r===void 0){t.set(n.name,[e]);return}r.push(e)}_findOrUpdateCompatibleStorage(e,t){let n=null;for(let r of t){let t=r.getInstrumentDescriptor();Xn(t,e)?(t.description!==e.description&&(e.description.length>t.description.length&&r.updateDescription(e.description),m.warn(`A view or instrument with the name `,e.name,` has already been registered, but has a different description and is incompatible with another registered view.
5
+ `,`Details:
6
+ `,mr(t,e),`The longer description will be used.
7
+ To resolve the conflict:`,yr(t,e))),n=r):m.warn(`A view or instrument with the name `,e.name,` has already been registered and is incompatible with another registered view.
8
+ `,`Details:
9
+ `,mr(t,e),`To resolve the conflict:
10
+ `,yr(t,e))}return n}};p(),r();var xr=class{constructor(e){i(this,`_backingStorages`,void 0),i(this,`hasAttributeProcessor`,void 0),this._backingStorages=e,this.hasAttributeProcessor=e.some(e=>e.hasAttributeProcessor)}record(e,t,n,r){this.hasAttributeProcessor&&n===void 0&&(n=f.active());let i=this._backingStorages;for(let a=0;a<i.length;a++)i[a].record(e,t,n,r)}};p(),r();var Sr=class{constructor(e,t){i(this,`_buffer`,new G),i(this,`_instrumentName`,void 0),i(this,`_valueType`,void 0),this._instrumentName=e,this._valueType=t}observe(e,t={}){if(typeof e!=`number`){m.warn(`non-number value provided to metric ${this._instrumentName}: ${e}`);return}this._valueType===h.INT&&!Number.isInteger(e)&&(m.warn(`INT value type cannot accept a floating-point value for ${this._instrumentName}, ignoring the fractional digits.`),e=Math.trunc(e),!Number.isInteger(e))||this._buffer.set(t,e)}},Cr=class{constructor(){i(this,`_buffer`,new Map)}observe(e,t,n={}){if(!or(e))return;let r=this._buffer.get(e);if(r??(r=new G,this._buffer.set(e,r)),typeof t!=`number`){m.warn(`non-number value provided to metric ${e._descriptor.name}: ${t}`);return}e._descriptor.valueType===h.INT&&!Number.isInteger(t)&&(m.warn(`INT value type cannot accept a floating-point value for ${e._descriptor.name}, ignoring the fractional digits.`),t=Math.trunc(t),!Number.isInteger(t))||r.set(n,t)}};p(),r();var wr=class{constructor(){i(this,`_callbacks`,[]),i(this,`_batchCallbacks`,[])}addCallback(e,t){this._findCallback(e,t)>=0||this._callbacks.push({callback:e,instrument:t})}removeCallback(e,t){let n=this._findCallback(e,t);n<0||this._callbacks.splice(n,1)}addBatchCallback(e,t){let n=new Set(t.filter(or));if(n.size===0){m.error(`BatchObservableCallback is not associated with valid instruments`,t);return}this._findBatchCallback(e,n)>=0||this._batchCallbacks.push({callback:e,instruments:n})}removeBatchCallback(e,t){let n=new Set(t.filter(or)),r=this._findBatchCallback(e,n);r<0||this._batchCallbacks.splice(r,1)}async observe(e,t){let n=this._observeCallbacks(e,t),r=this._observeBatchCallbacks(e,t);return(await Promise.allSettled([...n,...r])).filter(e=>e.status===`rejected`).map(e=>e.reason)}_observeCallbacks(e,t){return this._callbacks.map(async({callback:n,instrument:r})=>{let i=new Sr(r._descriptor.name,r._descriptor.valueType),a=Promise.resolve(n(i));t!=null&&(a=I(a,t)),await a,r._metricStorages.forEach(t=>{t.record(i._buffer,e)})})}_observeBatchCallbacks(e,t){return this._batchCallbacks.map(async({callback:n,instruments:r})=>{let i=new Cr,a=Promise.resolve(n(i));t!=null&&(a=I(a,t)),await a,r.forEach(t=>{let n=i._buffer.get(t);n!=null&&t._metricStorages.forEach(t=>{t.record(n,e)})})})}_findCallback(e,t){return this._callbacks.findIndex(n=>n.callback===e&&n.instrument===t)}_findBatchCallback(e,t){return this._batchCallbacks.findIndex(n=>n.callback===e&&Vt(n.instruments,t))}};p(),r();var Tr=class extends cr{constructor(e,t,n,r,a){super(e),i(this,`_aggregationCardinalityLimit`,void 0),i(this,`_deltaMetricStorage`,void 0),i(this,`_temporalMetricStorage`,void 0),i(this,`_attributesProcessor`,void 0),i(this,`hasAttributeProcessor`,void 0),this._aggregationCardinalityLimit=a,this._deltaMetricStorage=new ur(t,this._aggregationCardinalityLimit),this._temporalMetricStorage=new dr(t,r),this._attributesProcessor=n,this.hasAttributeProcessor=n!==void 0}record(e,t,n,r){this._attributesProcessor!==void 0&&(t=this._attributesProcessor.process(t,n??f.active())),this._deltaMetricStorage.record(e,t,r)}collect(e,t){let n=this._deltaMetricStorage.collect();return this._temporalMetricStorage.buildMetrics(e,this._instrumentDescriptor,n,t)}};r();var Er=class{constructor(e,t){i(this,`metricStorageRegistry`,new br),i(this,`observableRegistry`,new wr),i(this,`meter`,void 0),i(this,`_meterProviderSharedState`,void 0),i(this,`_instrumentationScope`,void 0),this.meter=new sr(this),this._meterProviderSharedState=e,this._instrumentationScope=t}registerMetricStorage(e){let t=this._registerMetricStorage(e,Tr);return t.length===1?t[0]:new xr(t)}registerAsyncMetricStorage(e){return this._registerMetricStorage(e,pr)}async collect(e,t,n){let r=await this.observableRegistry.observe(t,n?.timeoutMillis),i=this.metricStorageRegistry.getStorages(e);if(i.length===0)return null;let a=[];return i.forEach(n=>{let r=n.collect(e,t);r!=null&&a.push(r)}),a.length===0?{errors:r}:{scopeMetrics:{scope:this._instrumentationScope,metrics:a},errors:r}}_registerMetricStorage(e,t){let n=this._meterProviderSharedState.viewRegistry.findViews(e,this._instrumentationScope).map(n=>{let r=Yn(n,e),i=this.metricStorageRegistry.findOrUpdateCompatibleStorage(r);if(i!=null)return i;let a=new t(r,n.aggregation.createAggregator(r),n.attributesProcessor,this._meterProviderSharedState.metricCollectors,n.aggregationCardinalityLimit);return this.metricStorageRegistry.register(a),a});if(n.length===0){let r=this._meterProviderSharedState.selectAggregations(e.type).map(([n,r])=>{let i=this.metricStorageRegistry.findOrUpdateCompatibleCollectorStorage(n,e);if(i!=null)return i;let a=r.createAggregator(e),o=n.selectCardinalityLimit(e.type),s=new t(e,a,void 0,[n],o);return this.metricStorageRegistry.registerForCollector(n,s),s});n=n.concat(r)}return n}};r();var Dr=class{constructor(e){i(this,`viewRegistry`,new Jn),i(this,`metricCollectors`,[]),i(this,`meterSharedStates`,new Map),i(this,`resource`,void 0),this.resource=e}getMeterSharedState(e){let t=zt(e),n=this.meterSharedStates.get(t);return n??(n=new Er(this,e),this.meterSharedStates.set(t,n)),n}selectAggregations(e){let t=[];for(let n of this.metricCollectors)t.push([n,Nn(n.selectAggregation(e))]);return t}};D(),r();var Or=class{constructor(e,t){i(this,`_sharedState`,void 0),i(this,`_metricReader`,void 0),this._sharedState=e,this._metricReader=t}async collect(e){let t=S(Date.now()),n=[],r=[],i=Array.from(this._sharedState.meterSharedStates.values()).map(async i=>{let a=await i.collect(this,t,e);a?.scopeMetrics!=null&&n.push(a.scopeMetrics),a?.errors!=null&&r.push(...a.errors)});return await Promise.all(i),{resourceMetrics:{resource:this._sharedState.resource,scopeMetrics:n},errors:r}}async forceFlush(e){await this._metricReader.forceFlush(e)}async shutdown(e){await this._metricReader.shutdown(e)}selectAggregationTemporality(e){return this._metricReader.selectAggregationTemporality(e)}selectAggregation(e){return this._metricReader.selectAggregation(e)}selectCardinalityLimit(e){return this._metricReader.selectCardinalityLimit?.(e)??2e3}};r();var kr=/[\^$\\.+?()[\]{}|]/g,Ar=class e{constructor(t){i(this,`_matchAll`,void 0),i(this,`_regexp`,void 0),t===`*`?(this._matchAll=!0,this._regexp=/.*/):(this._matchAll=!1,this._regexp=new RegExp(e.escapePattern(t)))}match(e){return this._matchAll?!0:this._regexp.test(e)}static escapePattern(e){return`^${e.replace(kr,`\\$&`).replace(`*`,`.*`)}$`}static hasWildcard(e){return e.includes(`*`)}},K=class{constructor(e){i(this,`_matchAll`,void 0),i(this,`_pattern`,void 0),this._matchAll=e===void 0,this._pattern=e}match(e){return!!(this._matchAll||e===this._pattern)}};r();var jr=class{process(e,t){return e}},Mr=class{constructor(e){i(this,`_processors`,void 0),this._processors=e}process(e,t){let n=e;for(let e of this._processors)n=e.process(n,t);return n}};function Nr(){return Fr}function Pr(e){return new Mr(e)}var Fr=new jr;r();var Ir=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_type`,void 0),i(this,`_unitFilter`,void 0),this._nameFilter=new Ar(e?.name??`*`),this._type=e?.type,this._unitFilter=new K(e?.unit)}getType(){return this._type}getNameFilter(){return this._nameFilter}getUnitFilter(){return this._unitFilter}};r();var Lr=class{constructor(e){i(this,`_nameFilter`,void 0),i(this,`_versionFilter`,void 0),i(this,`_schemaUrlFilter`,void 0),this._nameFilter=new K(e?.name),this._versionFilter=new K(e?.version),this._schemaUrlFilter=new K(e?.schemaUrl)}getNameFilter(){return this._nameFilter}getVersionFilter(){return this._versionFilter}getSchemaUrlFilter(){return this._schemaUrlFilter}};r();function Rr(e){return e.instrumentName==null&&e.instrumentType==null&&e.instrumentUnit==null&&e.meterName==null&&e.meterVersion==null&&e.meterSchemaUrl==null}function zr(e){if(Rr(e))throw Error(`Cannot create view with no selector arguments supplied`);if(e.name!=null&&(e?.instrumentName==null||Ar.hasWildcard(e.instrumentName)))throw Error(`Views with a specified name must be declared with an instrument selector that selects at most one instrument per meter.`)}var Br=class{constructor(e){i(this,`name`,void 0),i(this,`description`,void 0),i(this,`aggregation`,void 0),i(this,`attributesProcessor`,void 0),i(this,`instrumentSelector`,void 0),i(this,`meterSelector`,void 0),i(this,`aggregationCardinalityLimit`,void 0),zr(e),e.attributesProcessors==null?this.attributesProcessor=Nr():this.attributesProcessor=Pr(e.attributesProcessors),this.name=e.name,this.description=e.description,this.aggregation=Nn(e.aggregation??{type:V.DEFAULT}),this.instrumentSelector=new Ir({name:e.instrumentName,type:e.instrumentType,unit:e.instrumentUnit}),this.meterSelector=new Lr({name:e.meterName,version:e.meterVersion,schemaUrl:e.meterSchemaUrl}),this.aggregationCardinalityLimit=e.aggregationCardinalityLimit}};p(),ye(),r();var Vr=class{constructor(e){if(i(this,`_sharedState`,void 0),i(this,`_shutdown`,!1),this._sharedState=new Dr(e?.resource??xe()),e?.views!=null&&e.views.length>0)for(let t of e.views)this._sharedState.viewRegistry.addView(new Br(t));if(e?.readers!=null&&e.readers.length>0)for(let t of e.readers){let n=new Or(this._sharedState,t);t.setMetricProducer(n),this._sharedState.metricCollectors.push(n),e.sdkMetricsEnabled&&t instanceof Wn&&t._setSelfObsMeterProvider(this)}}getMeter(e,t=``,n={}){return this._shutdown?(m.warn(`A shutdown MeterProvider cannot provide a Meter`),a()):this._sharedState.getMeterSharedState({name:e,version:t,schemaUrl:n.schemaUrl}).meter}async shutdown(e){if(this._shutdown){m.warn(`shutdown may only be called once per MeterProvider`);return}this._shutdown=!0,await Promise.all(this._sharedState.metricCollectors.map(t=>t.shutdown(e)))}async forceFlush(e){if(this._shutdown){m.warn(`invalid attempt to force flush after MeterProvider shutdown`);return}await Promise.all(this._sharedState.metricCollectors.map(t=>t.forceFlush(e)))}},Hr=`exception`,Ur=Symbol.for(`nodejs.util.inspect.custom`);function Wr(e){let t={};for(let[n,r]of e.getRawAttributes())typeof r?.then!=`function`&&r!=null&&(t[n]??(t[n]=r));return t}function Gr(e,t,n,r,i){if(typeof n==`number`&&n<0){let t=`[${e}]`;return r?.stylize?r.stylize(t,`special`):t}return typeof i!=`function`||!r?t:`${e} ${i(t,{...r,depth:r.depth==null?r.depth:r.depth-1})}`}p(),D(),v(),r();var Kr=class{constructor(e){i(this,`_spanContext`,void 0),i(this,`kind`,void 0),i(this,`parentSpanContext`,void 0),i(this,`attributes`,{}),i(this,`links`,[]),i(this,`events`,[]),i(this,`startTime`,void 0),i(this,`resource`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_droppedAttributesCount`,0),i(this,`_droppedEventsCount`,0),i(this,`_droppedLinksCount`,0),i(this,`_attributesCount`,0),i(this,`name`,void 0),i(this,`status`,{code:l.UNSET}),i(this,`endTime`,[0,0]),i(this,`_ended`,!1),i(this,`_duration`,[-1,-1]),i(this,`_spanProcessor`,void 0),i(this,`_spanLimits`,void 0),i(this,`_attributeValueLengthLimit`,void 0),i(this,`_recordEndMetrics`,void 0),i(this,`_performanceStartTime`,void 0),i(this,`_performanceOffset`,void 0),i(this,`_startTimeProvided`,void 0);let t=Date.now();if(this._spanContext=e.spanContext,this._performanceStartTime=b.now(),this._performanceOffset=t-(this._performanceStartTime+b.timeOrigin),this._startTimeProvided=e.startTime!=null,this._spanLimits=e.spanLimits,this._attributeValueLengthLimit=this._spanLimits.attributeValueLengthLimit??0,this._spanProcessor=e.spanProcessor,this.name=e.name,this.parentSpanContext=e.parentSpanContext,this.kind=e.kind,e.links)for(let t of e.links)this.addLink(t);this.startTime=this._getTime(e.startTime??t),this.resource=e.resource,this.instrumentationScope=e.scope,this._recordEndMetrics=e.recordEndMetrics,e.attributes!=null&&this.setAttributes(e.attributes),this._spanProcessor.onStart(this,e.context)}spanContext(){return this._spanContext}setAttribute(e,t){if(t==null||this._isSpanEnded())return this;if(e.length===0)return m.warn(`Invalid attribute key: ${e}`),this;if(!_e(t))return m.warn(`Invalid attribute value set for key: ${e}`),this;let{attributeCountLimit:n}=this._spanLimits,r=!Object.prototype.hasOwnProperty.call(this.attributes,e);return n!==void 0&&this._attributesCount>=n&&r?(this._droppedAttributesCount++,this):(this.attributes[e]=this._truncateToSize(t),r&&this._attributesCount++,this)}setAttributes(e){for(let t in e)Object.prototype.hasOwnProperty.call(e,t)&&this.setAttribute(t,e[t]);return this}addEvent(e,t,n){if(this._isSpanEnded())return this;let{eventCountLimit:r}=this._spanLimits;if(r===0)return m.warn(`No events allowed.`),this._droppedEventsCount++,this;r!==void 0&&this.events.length>=r&&(this._droppedEventsCount===0&&m.debug(`Dropping extra events.`),this.events.shift(),this._droppedEventsCount++),pe(t)&&(pe(n)||(n=t),t=void 0);let i=C(t),{attributePerEventCountLimit:a}=this._spanLimits,o={},s=0,c=0;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e))continue;let t=i[e];if(a!==void 0&&c>=a){s++;continue}o[e]=this._truncateToSize(t),c++}return this.events.push({name:e,attributes:o,time:this._getTime(n),droppedAttributesCount:s}),this}addLink(e){if(this._isSpanEnded())return this;let{linkCountLimit:t}=this._spanLimits;if(t===0)return this._droppedLinksCount++,this;t!==void 0&&this.links.length>=t&&(this._droppedLinksCount===0&&m.debug(`Dropping extra links.`),this.links.shift(),this._droppedLinksCount++);let{attributePerLinkCountLimit:n}=this._spanLimits,r=C(e.attributes),i={},a=0,o=0;for(let e in r){if(!Object.prototype.hasOwnProperty.call(r,e))continue;let t=r[e];if(n!==void 0&&o>=n){a++;continue}i[e]=this._truncateToSize(t),o++}let s={context:e.context};return o>0&&(s.attributes=i),a>0&&(s.droppedAttributesCount=a),this.links.push(s),this}addLinks(e){for(let t of e)this.addLink(t);return this}setStatus(e){if(this._isSpanEnded()||e.code===l.UNSET||this.status.code===l.OK)return this;let t={code:e.code};return e.code===l.ERROR&&(typeof e.message==`string`?t.message=e.message:e.message!=null&&m.warn(`Dropping invalid status.message of type '${typeof e.message}', expected 'string'`)),this.status=t,this}updateName(e){return this._isSpanEnded()||(this.name=e),this}end(e){if(this._isSpanEnded()){m.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`);return}this.endTime=this._getTime(e),this._duration=he(this.startTime,this.endTime),this._duration[0]<0&&(m.warn(`Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.`,this.startTime,this.endTime),this.endTime=this.startTime.slice(),this._duration=[0,0]),this._droppedEventsCount>0&&m.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`),this._droppedLinksCount>0&&m.warn(`Dropped ${this._droppedLinksCount} links because linkCountLimit reached`),this._spanProcessor.onEnding&&this._spanProcessor.onEnding(this),this._recordEndMetrics?.(),this._ended=!0,this._spanProcessor.onEnd(this)}_getTime(e){if(typeof e==`number`&&e<=b.now())return ue(e+this._performanceOffset);if(typeof e==`number`)return S(e);if(e instanceof Date)return S(e.getTime());if(me(e))return e;if(this._startTimeProvided)return S(Date.now());let t=b.now()-this._performanceStartTime;return de(this.startTime,S(t))}isRecording(){return this._ended===!1}recordException(e,t){let n={};typeof e==`string`?n[_]=e:e&&(e.code?n[ie]=e.code.toString():e.name&&(n[ie]=e.name),e.message&&(n[_]=e.message),e.stack&&(n[oe]=e.stack)),n[`exception.type`]||n[`exception.message`]?this.addEvent(Hr,n,t):m.warn(`Failed to record an exception ${e}`)}get duration(){return this._duration}get ended(){return this._ended}get droppedAttributesCount(){return this._droppedAttributesCount}get droppedEventsCount(){return this._droppedEventsCount}get droppedLinksCount(){return this._droppedLinksCount}_isSpanEnded(){if(this._ended){let e=Error(`Operation attempted on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`);m.warn(`Cannot execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`,e)}return this._ended}_truncateToLimitUtil(e,t){return e.length<=t?e:e.substring(0,t)}_truncateToSize(e){let t=this._attributeValueLengthLimit;return t<=0?(m.warn(`Attribute value limit must be positive, got ${t}`),e):typeof e==`string`?this._truncateToLimitUtil(e,t):Array.isArray(e)?e.map(e=>typeof e==`string`?this._truncateToLimitUtil(e,t):e):e}[Ur](e,t,n){return Gr(`SpanImpl`,{name:this.name,kind:this.kind,spanContext:this._spanContext,parentSpanContext:this.parentSpanContext,status:this.status,startTime:this.startTime,endTime:this.endTime,duration:this._duration,ended:this._ended,attributes:this.attributes,events:this.events,links:this.links,droppedAttributesCount:this._droppedAttributesCount,droppedEventsCount:this._droppedEventsCount,droppedLinksCount:this._droppedLinksCount,instrumentationScope:this.instrumentationScope,resource:{attributes:Wr(this.resource)}},e,t,n)}},q;(function(e){e[e.NOT_RECORD=0]=`NOT_RECORD`,e[e.RECORD=1]=`RECORD`,e[e.RECORD_AND_SAMPLED=2]=`RECORD_AND_SAMPLED`})(q||(q={}));var qr=`otel.component.name`,Jr=`otel.component.type`,Yr=`otel.span.parent.origin`,Xr=`otel.span.sampling_result`,Zr=`otel.sdk.processor.span.processed`,Qr=`otel.sdk.processor.span.queue.capacity`,$r=`otel.sdk.processor.span.queue.size`,ei=`otel.sdk.span.live`,ti=`otel.sdk.span.started`,ni=`batching_span_processor`;r();var ri=class{constructor(e){i(this,`startedSpans`,void 0),i(this,`liveSpans`,void 0),this.startedSpans=e.createCounter(ti,{unit:`{span}`,description:`The number of created spans.`}),this.liveSpans=e.createUpDownCounter(ei,{unit:`{span}`,description:`The number of currently live spans.`})}startSpan(e,t){let n=ai(t);if(this.startedSpans.add(1,{[Yr]:ii(e),[Xr]:n}),t===q.NOT_RECORD)return()=>{};let r={[Xr]:n};return this.liveSpans.add(1,r),()=>{this.liveSpans.add(-1,r)}}};function ii(e){return e?e.isRemote?`remote`:`local`:`none`}function ai(e){switch(e){case q.RECORD_AND_SAMPLED:return`RECORD_AND_SAMPLE`;case q.RECORD:return`RECORD_ONLY`;case q.NOT_RECORD:return`DROP`}}var oi=`2.9.0`;p(),D(),r();var si=class{constructor(e,t){i(this,`_sampler`,void 0),i(this,`_spanLimits`,void 0),i(this,`_idGenerator`,void 0),i(this,`instrumentationScope`,void 0),i(this,`_resource`,void 0),i(this,`_spanProcessor`,void 0),i(this,`_tracerMetrics`,void 0),this.instrumentationScope=e,this._sampler=t.sampler,this._spanLimits=t.spanLimits,this._resource=t.resource,this._idGenerator=t.idGenerator,this._spanProcessor=t.spanProcessor;let n=t.meterProvider.getMeter(`@opentelemetry/sdk-trace`,oi);this._tracerMetrics=new ri(n)}startSpan(e,t={},n=f.active()){t.root&&(n=d.deleteSpan(n));let r=d.getSpan(n);if(fe(n))return m.debug(`Instrumentation suppressed, returning Noop Span`),d.wrapSpanContext(c);let i=r?.spanContext(),a=this._idGenerator.generateSpanId(),o,l,p;!i||!d.isSpanContextValid(i)?l=this._idGenerator.generateTraceId():(l=i.traceId,p=i.traceState,o=i);let te=t.kind??ee.INTERNAL,h=(t.links??[]).map(e=>({context:e.context,attributes:C(e.attributes)})),ne=C(t.attributes),g=this._sampler.shouldSample(n,l,e,te,ne,h),re=this._tracerMetrics.startSpan(i,g.decision);p=g.traceState??p;let ie=g.decision===u.RECORD_AND_SAMPLED?s.SAMPLED:s.NONE,_={traceId:l,spanId:a,traceFlags:ie,traceState:p};if(g.decision===u.NOT_RECORD)return m.debug(`Recording is off, propagating context in a non-recording span`),d.wrapSpanContext(_);let v=C(Object.assign(ne,g.attributes));return new Kr({resource:this._resource,scope:this.instrumentationScope,context:n,spanContext:_,name:e,kind:te,links:h,parentSpanContext:o,attributes:v,startTime:t.startTime,spanProcessor:this._spanProcessor,spanLimits:this._spanLimits,recordEndMetrics:re})}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??f.active(),c=this.startSpan(e,i,s),l=d.setSpan(s,c);return f.with(l,o,void 0,c)}[Ur](e,t,n){return Gr(`Tracer`,{instrumentationScope:this.instrumentationScope,resource:{attributes:Wr(this._resource)},spanLimits:this._spanLimits},e,t,n)}};D(),r();var ci=class{constructor(e){i(this,`_spanProcessors`,void 0),this._spanProcessors=e}forceFlush(){let e=[];for(let t of this._spanProcessors)e.push(t.forceFlush());return new Promise(t=>{Promise.all(e).then(()=>{t()}).catch(e=>{y(e||Error(`MultiSpanProcessor: forceFlush failed`)),t()})})}onStart(e,t){for(let n of this._spanProcessors)n.onStart(e,t)}onEnding(e){for(let t of this._spanProcessors)t.onEnding&&t.onEnding(e)}onEnd(e){for(let t of this._spanProcessors)t.onEnd(e)}shutdown(){let e=[];for(let t of this._spanProcessors)e.push(t.shutdown());return new Promise((t,n)=>{Promise.all(e).then(()=>{t()},n)})}},J=class{shouldSample(){return{decision:q.NOT_RECORD}}toString(){return`AlwaysOffSampler`}},Y=class{shouldSample(){return{decision:q.RECORD_AND_SAMPLED}}toString(){return`AlwaysOnSampler`}};p(),D(),r();var X=class{constructor(e){i(this,`_root`,void 0),i(this,`_remoteParentSampled`,void 0),i(this,`_remoteParentNotSampled`,void 0),i(this,`_localParentSampled`,void 0),i(this,`_localParentNotSampled`,void 0),this._root=e.root,this._root||(y(Error(`ParentBasedSampler must have a root sampler configured`)),this._root=new Y),this._remoteParentSampled=e.remoteParentSampled??new Y,this._remoteParentNotSampled=e.remoteParentNotSampled??new J,this._localParentSampled=e.localParentSampled??new Y,this._localParentNotSampled=e.localParentNotSampled??new J}shouldSample(e,t,n,r,i,a){let o=d.getSpanContext(e);return!o||!te(o)?this._root.shouldSample(e,t,n,r,i,a):o.isRemote?o.traceFlags&s.SAMPLED?this._remoteParentSampled.shouldSample(e,t,n,r,i,a):this._remoteParentNotSampled.shouldSample(e,t,n,r,i,a):o.traceFlags&s.SAMPLED?this._localParentSampled.shouldSample(e,t,n,r,i,a):this._localParentNotSampled.shouldSample(e,t,n,r,i,a)}toString(){return`ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`}};v(),r();var li=new Map,ui=class{constructor(e,t,n){i(this,`processedSpans`,void 0),i(this,`queueSize`,void 0),i(this,`queueSizeCallback`,void 0),i(this,`standardAttrs`,void 0),i(this,`droppedAttrs`,void 0);let r=li.get(e)??0;if(li.set(e,r+1),this.standardAttrs={[Jr]:e,[qr]:`${e}/${r}`},this.droppedAttrs={...this.standardAttrs,[se]:`queue_full`},this.processedSpans=t.createCounter(Zr,{unit:`{span}`,description:`The number of spans for which the processing has finished, either successful or failed.`}),n){let{capacity:e,getQueueSize:r}=n;t.createUpDownCounter(Qr,{unit:`{span}`,description:`The maximum number of spans the queue of a given instance of an SDK span processor can hold.`}).add(e,this.standardAttrs),this.queueSize=t.createObservableUpDownCounter($r,{unit:`{span}`,description:`The number of spans in the queue of a given instance of an SDK span processor.`}),this.queueSizeCallback=e=>e.observe(r(),this.standardAttrs),this.queueSize.addCallback(this.queueSizeCallback)}}dropSpans(e){this.processedSpans.add(e,this.droppedAttrs)}finishSpans(e,t){if(!t){this.processedSpans.add(e,this.standardAttrs);return}let n={...this.standardAttrs,[se]:t.name};this.processedSpans.add(e,n)}shutdown(){this.queueSize&&this.queueSizeCallback&&this.queueSize.removeCallback(this.queueSizeCallback)}};p(),D(),r();var di=class{constructor(e){i(this,`_maxExportBatchSize`,void 0),i(this,`_maxQueueSize`,void 0),i(this,`_scheduledDelayMillis`,void 0),i(this,`_exportTimeoutMillis`,void 0),i(this,`_exporter`,void 0),i(this,`_metrics`,void 0),i(this,`_isExporting`,!1),i(this,`_finishedSpans`,[]),i(this,`_timer`,void 0),i(this,`_shutdownOnce`,void 0),i(this,`_droppedSpansCount`,0),this._exporter=e.exporter,this._maxExportBatchSize=e.maxExportBatchSize??512,this._maxQueueSize=e.maxQueueSize??2048,this._scheduledDelayMillis=e.scheduledDelayMillis??5e3,this._exportTimeoutMillis=e.exportTimeoutMillis??3e4,this._shutdownOnce=new ve(this._shutdown,this),this._maxExportBatchSize>this._maxQueueSize&&(m.warn(`BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize`),this._maxExportBatchSize=this._maxQueueSize);let t=e.selfObsMeterProvider?e.selfObsMeterProvider.getMeter(`@opentelemetry/sdk-trace`):a();this._metrics=new ui(ni,t,{capacity:this._maxQueueSize,getQueueSize:()=>this._finishedSpans.length})}forceFlush(){return this._shutdownOnce.isCalled?this._shutdownOnce.promise:this._flushAll()}onStart(e,t){}onEnd(e){this._shutdownOnce.isCalled||(e.spanContext().traceFlags&s.SAMPLED)!==0&&this._addToBuffer(e)}shutdown(){return this._shutdownOnce.call()}_shutdown(){return Promise.resolve().then(()=>this.onShutdown()).then(()=>this._flushAll()).then(()=>(this._metrics.shutdown(),this._exporter.shutdown()))}_addToBuffer(e){if(this._finishedSpans.length>=this._maxQueueSize){this._droppedSpansCount===0&&m.debug(`maxQueueSize reached, dropping spans`),this._droppedSpansCount++,this._metrics.dropSpans(1);return}this._droppedSpansCount>0&&(m.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`),this._droppedSpansCount=0),this._finishedSpans.push(e),this._maybeStartTimer()}_flushAll(){return new Promise((e,t)=>{let n=[],r=Math.ceil(this._finishedSpans.length/this._maxExportBatchSize);for(let e=0,t=r;e<t;e++)n.push(this._flushOneBatch());Promise.all(n).then(()=>{e()}).catch(t)})}_flushOneBatch(){return this._clearTimer(),this._finishedSpans.length===0?Promise.resolve():new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout`))},this._exportTimeoutMillis);f.with(ke(f.active()),()=>{let r;this._finishedSpans.length<=this._maxExportBatchSize?(r=this._finishedSpans,this._finishedSpans=[]):r=this._finishedSpans.splice(0,this._maxExportBatchSize);let i=()=>this._exporter.export(r,i=>{clearTimeout(n),this._metrics.finishSpans(r.length,i.error),i.code===O.SUCCESS?e():t(i.error??Error(`BatchSpanProcessor: span export failed`))}),a=null;for(let e=0,t=r.length;e<t;e++){let t=r[e];t.resource.asyncAttributesPending&&t.resource.waitForAsyncAttributes&&(a??(a=[]),a.push(t.resource.waitForAsyncAttributes()))}a===null?i():Promise.all(a).then(i,e=>{y(e),t(e)})})})}_maybeStartTimer(){if(this._isExporting)return;let e=()=>{this._isExporting=!0,this._flushOneBatch().finally(()=>{this._isExporting=!1,this._finishedSpans.length>0&&(this._clearTimer(),this._maybeStartTimer())}).catch(e=>{this._isExporting=!1,y(e)})};if(this._finishedSpans.length>=this._maxExportBatchSize)return e();this._timer===void 0&&(this._timer=setTimeout(()=>e(),this._scheduledDelayMillis),typeof this._timer!=`number`&&this._timer.unref())}_clearTimer(){this._timer!==void 0&&(clearTimeout(this._timer),this._timer=void 0)}},fi=class extends di{onShutdown(){}};r();var pi=8,mi=16,hi=class{constructor(){i(this,`generateTraceId`,_i(mi)),i(this,`generateSpanId`,_i(pi))}},gi=Buffer.allocUnsafe(mi);function _i(e){return function(){for(let t=0;t<e/4;t++)gi.writeUInt32BE(Math.random()*2**32>>>0,t*4);for(let t=0;t<e&&!(gi[t]>0);t++)t===e-1&&(gi[e-1]=1);return gi.toString(`hex`,0,e)}}p(),ye(),r();var Z;(function(e){e[e.resolved=0]=`resolved`,e[e.timeout=1]=`timeout`,e[e.error=2]=`error`,e[e.unresolved=3]=`unresolved`})(Z||(Z={}));var vi=class{constructor(e={}){i(this,`_resource`,void 0),i(this,`_activeSpanProcessor`,void 0),i(this,`_forceFlushTimeoutMillis`,void 0),i(this,`_tracerOptions`,void 0),i(this,`_tracers`,new Map),this._forceFlushTimeoutMillis=e.forceFlushTimeoutMillis??3e4,this._resource=e.resource??xe();let t=e.spanProcessors??[];this._activeSpanProcessor=new ci(t),this._tracerOptions={resource:this._resource,sampler:e.sampler??new X({root:new Y}),spanLimits:{attributeCountLimit:e.spanLimits?.attributeCountLimit??128,attributeValueLengthLimit:e.spanLimits?.attributeValueLengthLimit??1/0,eventCountLimit:e.spanLimits?.eventCountLimit??128,linkCountLimit:e.spanLimits?.linkCountLimit??128,attributePerEventCountLimit:e.spanLimits?.attributePerEventCountLimit??128,attributePerLinkCountLimit:e.spanLimits?.attributePerLinkCountLimit??128},idGenerator:e.idGenerator||new hi,spanProcessor:this._activeSpanProcessor,meterProvider:e.meterProvider??{getMeter(){return a()}}}}getTracer(e,t,n){let r=`${e}@${t||``}:${n?.schemaUrl||``}`;return this._tracers.has(r)||this._tracers.set(r,new si({name:e,version:t,schemaUrl:n?.schemaUrl},this._tracerOptions)),this._tracers.get(r)}forceFlush(){let e=this._forceFlushTimeoutMillis,t=this._activeSpanProcessor._spanProcessors.map(t=>new Promise(n=>{let r,i=setTimeout(()=>{n(Error(`Span processor did not completed within timeout period of ${e} ms`)),r=Z.timeout},e);t.forceFlush().then(()=>{clearTimeout(i),r!==Z.timeout&&(r=Z.resolved,n(r))}).catch(e=>{clearTimeout(i),r=Z.error,n(e)})}));return new Promise((e,n)=>{Promise.all(t).then(t=>{let r=t.filter(e=>e!==Z.resolved);r.length>0?n(r):e()}).catch(e=>n([e]))})}shutdown(){return this._activeSpanProcessor.shutdown()}[Ur](e,t,n){let r=this._activeSpanProcessor._spanProcessors;return Gr(`TracerProvider`,{resource:{attributes:Wr(this._resource)},tracers:Array.from(this._tracers.keys()),spanProcessors:r.map(e=>e.constructor?.name??`SpanProcessor`)},e,t,n)}};D();var yi=class{export(e,t){return this._sendSpans(e,t)}shutdown(){return this._sendSpans([]),this.forceFlush()}forceFlush(){return Promise.resolve()}_exportInfo(e){return{resource:{attributes:e.resource.attributes},instrumentationScope:e.instrumentationScope,traceId:e.spanContext().traceId,parentSpanContext:e.parentSpanContext,traceState:e.spanContext().traceState?.serialize(),name:e.name,id:e.spanContext().spanId,kind:e.kind,timestamp:E(e.startTime),duration:E(e.duration),attributes:e.attributes,status:e.status,events:e.events,links:e.links}}_sendSpans(e,t){for(let t of e)console.dir(this._exportInfo(t),{depth:3});if(t)return t({code:O.SUCCESS})}};p(),r();var bi=class{constructor(e=0){i(this,`_ratio`,void 0),i(this,`_upperBound`,void 0),this._ratio=this._normalize(e),this._upperBound=Math.floor(this._ratio*4294967295)}shouldSample(e,t){return{decision:ne(t)&&this._accumulate(t)<this._upperBound?q.RECORD_AND_SAMPLED:q.NOT_RECORD}}toString(){return`TraceIdRatioBased{${this._ratio}}`}_normalize(e){return typeof e!=`number`||isNaN(e)?0:e>=1?1:e<=0?0:e}_accumulate(e){let t=0;for(let n=0;n<32;n+=8){let r=0;for(let t=0;t<8;t++){let i=e.charCodeAt(n+t),a=i<58?i-48:i<71?i-55:i-87;r=r<<4|a}t=(t^r)>>>0}return t}};p(),D();var Q;(function(e){e.AlwaysOff=`always_off`,e.AlwaysOn=`always_on`,e.ParentBasedAlwaysOff=`parentbased_always_off`,e.ParentBasedAlwaysOn=`parentbased_always_on`,e.ParentBasedTraceIdRatio=`parentbased_traceidratio`,e.TraceIdRatio=`traceidratio`})(Q||(Q={}));var $=1;function xi(){return{sampler:Si(),forceFlushTimeoutMillis:3e4,generalLimits:{attributeValueLengthLimit:x(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:x(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128},spanLimits:{attributeValueLengthLimit:x(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,attributeCountLimit:x(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??128,linkCountLimit:x(`OTEL_SPAN_LINK_COUNT_LIMIT`)??128,eventCountLimit:x(`OTEL_SPAN_EVENT_COUNT_LIMIT`)??128,attributePerEventCountLimit:x(`OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT`)??128,attributePerLinkCountLimit:x(`OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT`)??128}}}function Si(){let e=ge(`OTEL_TRACES_SAMPLER`)??Q.ParentBasedAlwaysOn;switch(e){case Q.AlwaysOn:return new Y;case Q.AlwaysOff:return new J;case Q.ParentBasedAlwaysOn:return new X({root:new Y});case Q.ParentBasedAlwaysOff:return new X({root:new J});case Q.TraceIdRatio:return new bi(Ci());case Q.ParentBasedTraceIdRatio:return new X({root:new bi(Ci())});default:return m.error(`OTEL_TRACES_SAMPLER value "${e}" invalid, defaulting to "${Q.ParentBasedAlwaysOn}".`),new X({root:new Y})}}function Ci(){let e=x(`OTEL_TRACES_SAMPLER_ARG`);return e==null?(m.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${$}.`),$):e<0||e>1?(m.error(`OTEL_TRACES_SAMPLER_ARG=${e} was given, but it is out of range ([0..1]), defaulting to ${$}.`),$):e}D();function wi(e){let t=Object.assign({},e.spanLimits);return t.attributeCountLimit=e.spanLimits?.attributeCountLimit??e.generalLimits?.attributeCountLimit??x(`OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT`)??x(`OTEL_ATTRIBUTE_COUNT_LIMIT`)??128,t.attributeValueLengthLimit=e.spanLimits?.attributeValueLengthLimit??e.generalLimits?.attributeValueLengthLimit??x(`OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??x(`OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT`)??1/0,Object.assign({},e,{spanLimits:t})}D();var Ti=class extends vi{constructor(e={}){let t=le({},xi(),wi(e));delete t.generalLimits,super(t)}};D();var Ei=class extends fi{constructor(e,t){t||(t={});for(let[e,n]of[[`maxExportBatchSize`,`OTEL_BSP_MAX_EXPORT_BATCH_SIZE`],[`maxQueueSize`,`OTEL_BSP_MAX_QUEUE_SIZE`],[`scheduledDelayMillis`,`OTEL_BSP_SCHEDULE_DELAY`],[`exportTimeoutMillis`,`OTEL_BSP_EXPORT_TIMEOUT`]])if(t[e]===void 0){let r=x(n);r!==void 0&&(t[e]=r)}super({exporter:e,...t})}};n(),Se(),We(),Ye(),Qe(),ut(),dt(),et(),At(),St(),Ot(),wt(),Mt(),Ae(),Pe(),_t(),nt(),j(),qe(),gt(),st(),Fe(),at(),we();var Di=3600*1e3,Oi=1440*60*1e3;async function ki(){let e=pt();if(e.error)throw Error(`Auth error: ${e.error}`);let t={"Content-Type":`application/json`,"User-Agent":Oe(),...e.headers};return(await Ne.get(`https://api.anthropic.com/api/claude_code/organizations/metrics_enabled`,{headers:t,timeout:5e3})).data}async function Ai(){if(ot())return{enabled:!1,hasError:!1};try{let e=await ht(ki,{also403Revoked:!0});return A(`Metrics opt-out API response: enabled=${e.metrics_logging_enabled}`),{enabled:e.metrics_logging_enabled,hasError:!1}}catch(e){return A(`Failed to check metrics opt-out status: ${Je(e)}`),M(e),{enabled:!1,hasError:!0}}}var ji=Ie(Ai,Di);async function Mi(){let e=await ji();if(e.hasError)return e;let t=tt().metricsStatusCache;return t!==void 0&&t.enabled===e.enabled&&Date.now()-t.timestamp<Oi||it(t=>({...t,metricsStatusCache:{enabled:e.enabled,timestamp:Date.now()}})),e}async function Ni(){if(vt()&&!bt())return{enabled:!1,hasError:!1};let e=tt().metricsStatusCache;return e?(Date.now()-e.timestamp>Oi&&Mi().catch(M),{enabled:e.enabled,hasError:!1}):Mi()}D(),Pe(),_t(),nt(),j(),qe(),gt(),st(),we(),r();var Pi=class{constructor(e={}){i(this,`endpoint`,void 0),i(this,`timeout`,void 0),i(this,`pendingExports`,[]),i(this,`isShutdown`,!1),this.endpoint=`https://api.anthropic.com/api/claude_code/metrics`,this.timeout=e.timeout||5e3}async export(e,t){if(this.isShutdown){t({code:O.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{if(!(rt()||ze())){A(`BigQuery metrics export: trust not established, skipping`),t({code:O.SUCCESS});return}if(!(await Ni()).enabled){A(`Metrics export disabled by organization setting`),t({code:O.SUCCESS});return}let n=this.transformMetricsForInternal(e),r=pt();if(r.error){A(`Metrics export failed: ${r.error}`),t({code:O.FAILED,error:Error(r.error)});return}let i={"Content-Type":`application/json`,"User-Agent":Oe(),...r.headers},a=await Ne.post(this.endpoint,n,{timeout:this.timeout,headers:i});A(`BigQuery metrics exported successfully`),A(`BigQuery API Response: ${Ge(a.data,null,2)}`),t({code:O.SUCCESS})}catch(e){A(`BigQuery metrics export failed: ${Je(e)}`),M(e),t({code:O.FAILED,error:Ke(e)})}}transformMetricsForInternal(e){let t=e.resource.attributes,n={"service.name":t[`service.name`]||`workmate`,"service.version":t[`service.version`]||`unknown`,"os.type":t[`os.type`]||`unknown`,"os.version":t[`os.version`]||`unknown`,"host.arch":t[`host.arch`]||`unknown`,"aggregation.temporality":this.selectAggregationTemporality()===N.DELTA?`delta`:`cumulative`};if(t[`wsl.version`]&&(n[`wsl.version`]=t[`wsl.version`]),vt()){n[`user.customer_type`]=`claude_ai`;let e=xt();e&&(n[`user.subscription_type`]=e)}else n[`user.customer_type`]=`api`;return{resource_attributes:n,metrics:e.scopeMetrics.flatMap(e=>e.metrics.map(e=>({name:e.descriptor.name,description:e.descriptor.description,unit:e.descriptor.unit,data_points:this.extractDataPoints(e)})))}}extractDataPoints(e){return(e.dataPoints||[]).filter(e=>typeof e.value==`number`).map(e=>({attributes:this.convertAttributes(e.attributes),value:e.value,timestamp:this.hrTimeToISOString(e.endTime||e.startTime||[Date.now()/1e3,0])}))}async shutdown(){this.isShutdown=!0,await this.forceFlush(),A(`BigQuery metrics exporter shutdown complete`)}async forceFlush(){await Promise.all(this.pendingExports),A(`BigQuery metrics exporter flush complete`)}convertAttributes(e){let t={};if(e)for(let[n,r]of Object.entries(e))r!=null&&(t[n]=String(r));return t}hrTimeToISOString(e){let[t,n]=e;return new Date(t*1e3+n/1e6).toISOString()}selectAggregationTemporality(){return N.DELTA}};j(),st();var Fi=class{error(e,...t){M(Error(e)),A(`[3P telemetry] OTEL diag error: ${e}`,{level:`error`})}warn(e,...t){M(Error(e)),A(`[3P telemetry] OTEL diag warn: ${e}`,{level:`warn`})}info(e,...t){}debug(e,...t){}verbose(e,...t){}};p(),ye(),v(),We(),_t(),j(),qe(),Qe(),Ft(),Pt();var Ii=6e4,Li=5e3,Ri=5e3,zi=class extends Error{};function Bi(e,t){return new Promise((n,r)=>{setTimeout((e,t)=>e(new zi(t)),e,r,t).unref()})}function Vi(){process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE||(process.env.OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE=`delta`)}function Hi(e){return(e||``).trim().split(`,`).filter(Boolean).map(e=>e.trim()).filter(e=>e!==`none`)}async function Ui(){let t=Hi(process.env.OTEL_METRICS_EXPORTER),n=parseInt(process.env.OTEL_METRIC_EXPORT_INTERVAL||Ii.toString(),10),r=[];for(let n of t)if(n===`console`){let e=new qn,t=e.export.bind(e);e.export=(e,n)=>(e.resource?.attributes&&(A(`
11
+ === Resource Attributes ===`),A(Ge(e.resource.attributes)),A(`===========================
12
+ `)),t(e,n)),r.push(e)}else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_METRICS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),t=$i();switch(e){case`http/json`:{let{OTLPMetricExporter:e}=await import(`./esm-BadZVa27.js`);r.push(new e(t));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else if(n===`prometheus`){let{PrometheusExporter:t}=await import(`./src-BacxF9BD.js`).then(t=>e(t.default,1));r.push(new t)}else throw Error(`Unknown exporter type set in OTEL_EXPORTER_OTLP_METRICS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${n}`);return r.map(e=>`export`in e?new Kn({exporter:e,exportIntervalMillis:n}):e)}async function Wi(){let e=Hi(process.env.OTEL_LOGS_EXPORTER),t=process.env.OTEL_EXPORTER_OTLP_LOGS_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;A(`[3P telemetry] getOtlpLogExporters: types=${Ge(e)}, protocol=${t}, endpoint=${n}`);let r=[];for(let n of e)if(n===`console`)r.push(new Ce);else if(n===`otlp`){let e=$i();switch(t){case`http/json`:{let{OTLPLogExporter:t}=await import(`./esm-BCmY8V0C.js`);r.push(new t(e));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_LOGS_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${t}`)}}else throw Error(`Unknown exporter type set in OTEL_LOGS_EXPORTER env var: ${n}`);return r}async function Gi(){let e=Hi(process.env.OTEL_TRACES_EXPORTER),t=[];for(let n of e)if(n===`console`)t.push(new yi);else if(n===`otlp`){let e=process.env.OTEL_EXPORTER_OTLP_TRACES_PROTOCOL?.trim()||process.env.OTEL_EXPORTER_OTLP_PROTOCOL?.trim(),n=$i();switch(e){case`http/json`:{let{OTLPTraceExporter:e}=await import(`./esm-BUJtY-Rb.js`);t.push(new e(n));break}default:throw Error(`Unknown protocol set in OTEL_EXPORTER_OTLP_TRACES_PROTOCOL or OTEL_EXPORTER_OTLP_PROTOCOL env var: ${e}`)}}else throw Error(`Unknown exporter type set in OTEL_TRACES_EXPORTER env var: ${n}`);return t}function Ki(){return t(process.env.CLAUDE_CODE_ENABLE_TELEMETRY)}function qi(){return new Kn({exporter:new Pi,exportIntervalMillis:300*1e3})}function Ji(){let e=xt(),t=vt()&&(e===`enterprise`||e===`team`);return mt()||t}async function Yi(e){let t=process.env.BETA_TRACING_ENDPOINT;if(!t)return;let[{OTLPTraceExporter:n},{OTLPLogExporter:r}]=await Promise.all([import(`./esm-BUJtY-Rb.js`),import(`./esm-BCmY8V0C.js`)]),i={url:`${t}/v1/traces`},a={url:`${t}/v1/logs`},o=new Ti({resource:e,spanProcessors:[new Ei(new n(i),{scheduledDelayMillis:Ri})]});d.setGlobalTracerProvider(o),Re(o);let s=new Ee({resource:e,processors:[new Te(new r(a),{scheduledDelayMillis:Li})]});T.setGlobalLoggerProvider(s),Be(s),He(T.getLogger(`com.anthropic.claude_code.events`,`0.0.22`)),process.on(`beforeExit`,async()=>{await s?.forceFlush(),await o?.forceFlush()}),process.on(`exit`,()=>{s?.forceFlush(),o?.forceFlush()})}async function Xi(){if(ft(`telemetry_init_start`),Vi(),Xe())for(let e of[`OTEL_METRICS_EXPORTER`,`OTEL_LOGS_EXPORTER`,`OTEL_TRACES_EXPORTER`]){let t=process.env[e];t?.includes(`console`)&&(process.env[e]=t.split(`,`).map(e=>e.trim()).filter(e=>e!==`console`).join(`,`))}m.setLogger(new Fi,o.ERROR),Nt();let e=[],t=Ki();A(`[3P telemetry] isTelemetryEnabled=${t} (CLAUDE_CODE_ENABLE_TELEMETRY=${process.env.CLAUDE_CODE_ENABLE_TELEMETRY})`),t&&e.push(...await Ui()),Ji()&&e.push(qi());let n=lt(),r={[re]:`workmate`,[ae]:`0.0.22`};if(n===`wsl`){let e=ct();e&&(r[`wsl.version`]=e)}let i=w(r),a=w(je.detect().attributes||{}),s=be.detect(),c=w(s.attributes?.[`host.arch`]?{[g]:s.attributes[g]}:{}),l=w(De.detect().attributes||{}),u=i.merge(a).merge(c).merge(l);if(jt()){Yi(u).catch(e=>A(`Beta tracing init failed: ${e}`,{level:`error`}));let t=new Vr({resource:u,views:[],readers:e});return Le(t),Ze(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{Lt();let n=Ve(),r=k(),i=[t.shutdown()];n&&i.push(n.forceFlush().then(()=>n.shutdown())),r&&i.push(r.forceFlush().then(()=>r.shutdown())),await Promise.race([Promise.all(i),Bi(e,`OpenTelemetry shutdown timeout`)])}catch{}}),t.getMeter(`com.anthropic.claude_code`,`0.0.22`)}let f=new Vr({resource:u,views:[],readers:e});if(Le(f),t){let e=await Wi();if(A(`[3P telemetry] Created ${e.length} log exporter(s)`),e.length>0){let t=new Ee({resource:u,processors:e.map(e=>new Te(e,{scheduledDelayMillis:parseInt(process.env.OTEL_LOGS_EXPORT_INTERVAL||Li.toString(),10)}))});T.setGlobalLoggerProvider(t),Be(t),He(T.getLogger(`com.anthropic.claude_code.events`,`0.0.22`)),A(`[3P telemetry] Event logger set successfully`),process.on(`beforeExit`,async()=>{await t?.forceFlush(),await k()?.forceFlush()}),process.on(`exit`,()=>{t?.forceFlush(),k()?.forceFlush()})}}if(t&&It()){let e=await Gi();if(e.length>0){let t=new Ti({resource:u,spanProcessors:e.map(e=>new Ei(e,{scheduledDelayMillis:parseInt(process.env.OTEL_TRACES_EXPORT_INTERVAL||Ri.toString(),10)}))});d.setGlobalTracerProvider(t),Re(t)}}return Ze(async()=>{let e=parseInt(process.env.CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS||`2000`,10);try{Lt();let t=[f.shutdown()],n=Ve();n&&t.push(n.shutdown());let r=k();r&&t.push(r.shutdown()),await Promise.race([Promise.all(t),Bi(e,`OpenTelemetry shutdown timeout`)])}catch(t){throw t instanceof Error&&t.message.includes(`timeout`)&&A(`
13
+ OpenTelemetry telemetry flush timed out after ${e}ms
14
+
15
+ To resolve this issue, you can:
16
+ 1. Increase the timeout by setting CLAUDE_CODE_OTEL_SHUTDOWN_TIMEOUT_MS env var (e.g., 5000 for 5 seconds)
17
+ 2. Check if your OpenTelemetry backend is experiencing scalability issues
18
+ 3. Disable OpenTelemetry by unsetting CLAUDE_CODE_ENABLE_TELEMETRY env var
19
+
20
+ Current timeout: ${e}ms
21
+ `,{level:`error`}),t}}),f.getMeter(`com.anthropic.claude_code`,`0.0.22`)}async function Zi(){let e=Ue();if(!e)return;let t=parseInt(process.env.CLAUDE_CODE_OTEL_FLUSH_TIMEOUT_MS||`5000`,10);try{let n=[e.forceFlush()],r=Ve();r&&n.push(r.forceFlush());let i=k();i&&n.push(i.forceFlush()),await Promise.race([Promise.all(n),Bi(t,`OpenTelemetry flush timeout`)]),A(`Telemetry flushed successfully`)}catch(e){e instanceof zi?A(`Telemetry flush timed out after ${t}ms. Some metrics may not be exported.`,{level:`warn`}):A(`Telemetry flush failed: ${Je(e)}`,{level:`error`})}}function Qi(){let e={},t=process.env.OTEL_EXPORTER_OTLP_HEADERS;if(t)for(let n of t.split(`,`)){let[t,...r]=n.split(`=`);t&&r.length>0&&(e[t.trim()]=r.join(`=`).trim())}return e}function $i(){let e=Ct(),t=Tt(),n=$e(),r={},i=Qi();n?.otelHeadersHelper?r.headers=async()=>{let e=yt();return{...i,...e}}:Object.keys(i).length>0&&(r.headers=async()=>i);let a=process.env.OTEL_EXPORTER_OTLP_ENDPOINT;if(!e||a&&Dt(a)){let e=Et();return(t||e)&&(r.httpAgentOptions={...t,...e&&{ca:e}}),r}let o=Et();return r.httpAgentOptions=n=>t||o?new kt(e,{...t&&{cert:t.cert,key:t.key,passphrase:t.passphrase},...o&&{ca:o}}):new kt(e),r}export{Zi as flushTelemetry,Xi as initializeTelemetry};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,n){let r=n?n.trim().split(/\s+/):[],i=r[0]||`list`,a=[],o=console.log,s=console.error;console.log=(...e)=>a.push(e.map(String).join(` `)),console.error=(...e)=>a.push(e.map(String).join(` `));try{let{templatesMain:e}=await import(`./templateJobs-fiKuu4DK.js`);await e([i,...r.slice(1)])}finally{console.log=o,console.error=s}return e(a.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";async function t(e,t,n){let r=n?n.trim().split(/\s+/):[],i=r[0]||`list`,a=[],o=console.log,s=console.error;console.log=(...e)=>a.push(e.map(String).join(` `)),console.error=(...e)=>a.push(e.map(String).join(` `));try{let{templatesMain:e}=await import(`./templateJobs-BdFzE9XG.js`);await e([i,...r.slice(1)])}finally{console.log=o,console.error=s}return e(a.join(`
2
2
  `)||`Done.`,{display:`system`}),null}e((()=>{}))();export{t as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bw as t,Jw as n,Kw as r,Lw as i,Rw as a,Ww as o,Yw as s,qw as c}from"./loadAgentsDir-C1LkW7gl.js";import{C as l,L as u,P as d,x as f}from"./debug-8DCufdSp.js";import{r as p,t as m}from"./promptEditor-CmQ9p4oe.js";import{dirname as h}from"path";import{mkdir as g,writeFile as _}from"fs/promises";function v(e){let t=new Set(o.map(e=>c(e.key)));return e.map(e=>{let n={};for(let[r,i]of Object.entries(e.bindings))t.has(c(r))||(n[r]=i);return{context:e.context,bindings:n}}).filter(e=>Object.keys(e.bindings).length>0)}function y(){return`${l({$schema:`https://www.schemastore.org/claude-code-keybindings.json`,$docs:`https://code.workmate.com/docs/en/keybindings`,bindings:v(n)},null,2)}\n`}var b=e((()=>{f(),s(),r()}));async function x(){if(!t())return{type:`text`,value:`Keybinding customization is not enabled. This feature is currently in preview.`};let e=i(),n=!1;await g(h(e),{recursive:!0});try{await _(e,y(),{encoding:`utf-8`,flag:`wx`})}catch(e){if(d(e)===`EEXIST`)n=!0;else throw e}let r=await m(e);return r.error?{type:`text`,value:`${n?`Opened`:`Created`} ${e}. Could not open in editor: ${r.error}`}:{type:`text`,value:n?`Opened ${e} in your editor.`:`Created ${e} with template. Opened in your editor.`}}e((()=>{a(),b(),u(),p()}))();export{x as call};
@@ -0,0 +1,3 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Bc as n,Gc as r,Hc as i,Kc as a,Rc as o,Uc as s,Vc as c,Wc as l,qc as u,zc as d}from"./loadAgentsDir-C1LkW7gl.js";import{I as f,P as p,ai as m,hn as h,t as g,y as _}from"./src-DL3w8VPk.js";import{t as v}from"./jsx-runtime-Bb4Xn-E0.js";import{n as y,t as b}from"./TextInput-7uqPhq9T.js";function x(e){return e.mode===`list`?e.stores.length===0?(0,S.jsx)(f,{children:(0,S.jsx)(p,{dimColor:!0,children:`No memory stores found. Use /local-memory create <store> to create one.`})}):(0,S.jsxs)(f,{flexDirection:`column`,children:[(0,S.jsx)(f,{marginBottom:1,children:(0,S.jsxs)(p,{bold:!0,children:[`Local Memory Stores (`,e.stores.length,`)`]})}),e.stores.map(e=>(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{children:` `}),(0,S.jsx)(p,{color:`success`,children:`◆`}),(0,S.jsxs)(p,{children:[` `,e]})]},e))]}):e.mode===`created`?(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{color:`success`,children:`✓`}),(0,S.jsx)(p,{children:` Store created: `}),(0,S.jsx)(p,{bold:!0,children:e.store})]}):e.mode===`stored`?(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{color:`success`,children:`✓`}),(0,S.jsx)(p,{children:` Stored entry `}),(0,S.jsx)(p,{bold:!0,children:e.key}),(0,S.jsx)(p,{children:` in `}),(0,S.jsx)(p,{bold:!0,children:e.store})]}):e.mode===`fetched`?(0,S.jsxs)(f,{flexDirection:`column`,children:[(0,S.jsxs)(f,{marginBottom:1,children:[(0,S.jsx)(p,{bold:!0,children:e.store}),(0,S.jsx)(p,{dimColor:!0,children:`/`}),(0,S.jsx)(p,{bold:!0,children:e.key})]}),(0,S.jsx)(f,{children:(0,S.jsx)(p,{children:e.value})})]}):e.mode===`not-found`?(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{color:`error`,children:`Not found: `}),(0,S.jsx)(p,{bold:!0,children:e.store}),e.key?(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(p,{dimColor:!0,children:`/`}),(0,S.jsx)(p,{bold:!0,children:e.key})]}):null]}):e.mode===`entries`?e.keys.length===0?(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{dimColor:!0,children:`No entries in `}),(0,S.jsx)(p,{bold:!0,children:e.store}),(0,S.jsxs)(p,{dimColor:!0,children:[`. Use /local-memory store `,e.store,` <key> <value> to add one.`]})]}):(0,S.jsxs)(f,{flexDirection:`column`,children:[(0,S.jsxs)(f,{marginBottom:1,children:[(0,S.jsx)(p,{bold:!0,children:e.store}),(0,S.jsxs)(p,{dimColor:!0,children:[` (`,e.keys.length,` entries)`]})]}),e.keys.map(e=>(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{children:` `}),(0,S.jsx)(p,{color:`success`,children:`·`}),(0,S.jsxs)(p,{children:[` `,e]})]},e))]}):e.mode===`archived`?(0,S.jsxs)(f,{children:[(0,S.jsx)(p,{color:`success`,children:`✓`}),(0,S.jsx)(p,{children:` Archived store: `}),(0,S.jsx)(p,{bold:!0,children:e.store}),(0,S.jsxs)(p,{dimColor:!0,children:[` (renamed to `,e.store,`.archived)`]})]}):(0,S.jsx)(f,{children:(0,S.jsxs)(p,{color:`error`,children:[`Error: `,e.message]})})}var S,C=e((()=>{g(),S=v()}));function w(e){let t=e.trim();if(t===``||t===`list`)return{action:`list`};let n=t.split(/\s+/),r=n[0];if(r===`list`)return{action:`list`};if(r===`create`){let e=n[1];return e?{action:`create`,store:e}:{action:`invalid`,reason:`create requires a store name. ${T}`}}if(r===`store`){let e=n[1],t=n[2];if(!e)return{action:`invalid`,reason:`store requires a store name. ${T}`};if(!t)return{action:`invalid`,reason:`store requires a key. ${T}`};let r=n.slice(3).join(` `);return r?{action:`store`,store:e,key:t,value:r}:{action:`invalid`,reason:`store requires a value. ${T}`}}if(r===`fetch`){let e=n[1],t=n[2];return e?t?{action:`fetch`,store:e,key:t}:{action:`invalid`,reason:`fetch requires a key. ${T}`}:{action:`invalid`,reason:`fetch requires a store name. ${T}`}}if(r===`entries`){let e=n[1];return e?{action:`entries`,store:e}:{action:`invalid`,reason:`entries requires a store name. ${T}`}}if(r===`archive`){let e=n[1];return e?{action:`archive`,store:e}:{action:`invalid`,reason:`archive requires a store name. ${T}`}}return{action:`invalid`,reason:`Unknown sub-command "${r}". ${T}`}}var T,E=e((()=>{T=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`}));function D(e){return async(t,n,r)=>{let i=e.parseArgs(r??``);if(O(i))return t(`Invalid args: ${i.reason}`,{display:`system`}),e.errorView(i.reason);try{let r=await e.dispatch(i,t,n);return r===null?null:k.createElement(e.View,r)}catch(n){let r=n instanceof Error?n.message:String(n);return e.onDispatchError?.(n),t(`${e.commandName} failed: ${r}`,{display:`system`}),e.errorView(r)}}}function O(e){return typeof e==`object`&&!!e&&`action`in e&&e.action===`invalid`}var k,A=e((()=>{k=t(m(),1)}));function j(e){return e.length===0?`No memory stores found.`:[`Local Memory Stores`,...e.map(e=>`- ${e}`)].join(`
2
+ `)}function M(e,t){return t.length===0?`No entries in "${e}".`:[`Entries in "${e}"`,...t.map(e=>`- ${e}`)].join(`
3
+ `)}function N({onDone:e}){let[t,a]=F.useState({kind:`menu`}),[c,m]=F.useState(0),[g,v]=F.useState(``),[y,x]=F.useState(0),[S,C]=F.useState(null),w=F.useCallback(e=>{a(e),v(``),x(0),C(null)},[]),T=F.useCallback(t=>e(t,{display:`system`}),[e]),E=F.useCallback((e,t,i,a,c={})=>{try{if(e===`list`){T(j(l()));return}if(e===`about`){T(L);return}if(!t){C(`Internal: missing store`);return}if(e===`create`){d(t),T(`Store created: ${t}`);return}if(e===`entries`){let e=s(t);T(M(t,e));return}if(e===`archive`){o(t),T(`Archived store: ${t}`);return}if(e===`fetch`){if(!i){C(`Internal: missing key`);return}let e=n(t,i);if(e===null){T(`Entry not found: ${t}/${i}`);return}T(`Entry fetched: ${t}/${i}\n\n${e}`);return}if(e===`store`){if(!i||a===void 0){C(`Internal: missing key or value`);return}if(!c.confirmedOverwrite&&n(t,i)!==null){w({kind:`confirm-overwrite`,store:t,key:i,value:a});return}r(t,i,a),T(`Stored ${t}/${i} (${a.length} chars)`);return}}catch(e){C(e instanceof Error?e.message:String(e))}},[T,w]);if(h((e,n)=>{if(t.kind!==`menu`)return;if(n.upArrow){m(e=>Math.max(0,e-1));return}if(n.downArrow){m(e=>Math.min(z.length-1,e+1));return}if(n.return){let e=z[c];if(!e)return;if(e.kind===`list`||e.kind===`about`){E(e.kind,void 0,void 0,void 0);return}w({kind:`collect-store`,action:e.kind});return}let r=Number(e);Number.isInteger(r)&&r>=1&&r<=z.length&&m(r-1)},{isActive:t.kind===`menu`}),h((e,n)=>{if(t.kind!==`confirm-archive`&&t.kind!==`confirm-overwrite`)return;if(n.escape){w({kind:`menu`});return}let r=e.toLowerCase();r===`y`||n.return?t.kind===`confirm-archive`?E(`archive`,t.store,void 0,void 0):E(`store`,t.store,t.key,t.value,{confirmedOverwrite:!0}):r===`n`&&w({kind:`menu`})},{isActive:t.kind===`confirm-archive`||t.kind===`confirm-overwrite`}),h((e,n)=>{if(!(t.kind!==`collect-store`&&t.kind!==`collect-key`&&t.kind!==`collect-value`)&&n.escape){if(t.kind===`collect-value`){w({kind:`collect-key`,action:t.action,store:t.store});return}if(t.kind===`collect-key`){w({kind:`collect-store`,action:t.action});return}w({kind:`menu`})}},{isActive:t.kind===`collect-store`||t.kind===`collect-key`||t.kind===`collect-value`}),t.kind===`menu`)return(0,I.jsx)(_,{title:`Local Memory`,subtitle:`${z.length} actions`,onCancel:()=>T(`Local memory panel dismissed`),color:`background`,hideInputGuide:!0,children:(0,I.jsxs)(f,{flexDirection:`column`,children:[z.map((e,t)=>(0,I.jsxs)(f,{flexDirection:`row`,children:[(0,I.jsx)(p,{children:`${t===c?`›`:` `} ${e.label}`.padEnd(R)}),(0,I.jsx)(p,{dimColor:!0,children:e.description})]},e.kind)),(0,I.jsx)(f,{marginTop:1,children:(0,I.jsx)(p,{dimColor:!0,children:`↑/↓ or 1-7 select · Enter run · Esc close`})})]})});if(t.kind===`confirm-archive`)return(0,I.jsx)(_,{title:`Confirm Archive`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,I.jsxs)(f,{flexDirection:`column`,children:[(0,I.jsxs)(p,{children:[`Archive store "`,t.store,`"? This renames it to *.archived.`]}),(0,I.jsx)(f,{marginTop:1,children:(0,I.jsx)(p,{dimColor:!0,children:`y/Enter = archive · n/Esc = cancel`})})]})});if(t.kind===`confirm-overwrite`)return(0,I.jsx)(_,{title:`Confirm Overwrite`,onCancel:()=>w({kind:`menu`}),color:`warning`,hideInputGuide:!0,children:(0,I.jsxs)(f,{flexDirection:`column`,children:[(0,I.jsxs)(p,{children:[`Entry "`,t.store,`/`,t.key,`" already exists. Overwrite with new value (`,t.value.length,` chars)?`]}),(0,I.jsx)(f,{marginTop:1,children:(0,I.jsx)(p,{dimColor:!0,children:`y/Enter = overwrite · n/Esc = cancel`})})]})});let D=t.kind===`collect-store`?`STORE NAME`:t.kind===`collect-key`?`KEY NAME`:`VALUE`,O=t.kind===`collect-store`?`e.g. my-notes`:t.kind===`collect-key`?`e.g. todo-2026-05-08`:`free text`;return(0,I.jsx)(_,{title:`Local Memory · ${t.kind.replace(`collect-`,``).toUpperCase()}`,onCancel:()=>w({kind:`menu`}),color:`background`,hideInputGuide:!0,children:(0,I.jsxs)(f,{flexDirection:`column`,children:[(0,I.jsx)(f,{children:(0,I.jsx)(p,{dimColor:!0,children:D})}),(0,I.jsxs)(f,{children:[(0,I.jsx)(p,{children:`> `}),(0,I.jsx)(b,{value:g,onChange:e=>{v(e),C(null)},cursorOffset:y,onChangeCursorOffset:x,onSubmit:e=>{let n=e.trim();if(t.kind===`collect-store`){if(!n){C(`Store name required`);return}if(!i(n)){C(`Invalid store name (no /, \\, :, null byte, or leading dot; max 255 chars)`);return}t.action===`create`||t.action===`entries`||t.action===`archive`?t.action===`archive`?w({kind:`confirm-archive`,store:n}):E(t.action,n,void 0,void 0):w({kind:`collect-key`,action:t.action,store:n});return}if(t.kind===`collect-key`){if(!n){C(`Key required`);return}if(!u(n)){C(`Invalid key (allowed: letters/digits/._- only; no leading dot; not a Windows reserved name)`);return}t.action===`fetch`?E(`fetch`,t.store,n,void 0):w({kind:`collect-value`,action:`store`,store:t.store,key:n});return}t.kind===`collect-value`&&E(`store`,t.store,t.key,e)},placeholder:O,columns:70,showCursor:!0})]}),S!==null&&(0,I.jsx)(f,{marginTop:0,children:(0,I.jsxs)(p,{color:`warning`,children:[`✗ `,S]})}),(0,I.jsx)(f,{marginTop:1,children:(0,I.jsx)(p,{dimColor:!0,children:`Enter = next · Esc = back`})})]})})}async function P(e,t){if(e.action===`list`)return t(j(l()),{display:`system`}),null;if(e.action===`create`){let{store:n}=e;return d(n),t(`Store created: ${n}`,{display:`system`}),null}if(e.action===`store`){let{store:n,key:i,value:a}=e;return r(n,i,a),t(`Stored entry "${i}" in store "${n}".`,{display:`system`}),null}if(e.action===`fetch`){let{store:r,key:i}=e,a=n(r,i);return a===null?(t(`Entry not found: ${r}/${i}`,{display:`system`}),null):(t(`Entry fetched: ${r}/${i}\n${a}`,{display:`system`}),null)}if(e.action===`entries`){let{store:n}=e;return t(M(n,s(n)),{display:`system`}),null}if(e.action===`archive`){let{store:n}=e;return o(n),t(`Archived store: ${n}`,{display:`system`}),null}return t(L,{display:`system`}),null}var F,I,L,R,z,B,V;e((()=>{F=t(m(),1),g(),c(),a(),y(),C(),E(),A(),I=v(),L=`Usage: /local-memory list | create STORE | store STORE KEY VALUE | fetch STORE KEY | entries STORE | archive STORE`,R=26,z=[{kind:`list`,label:`List`,description:`显示所有 store`},{kind:`create`,label:`Create`,description:`创建一个新的记忆 store`},{kind:`store`,label:`Store`,description:`写入条目:store 名 + key + value`},{kind:`fetch`,label:`Fetch`,description:`按 store 名 + key 读取条目`},{kind:`entries`,label:`Entries`,description:`列出某个 store 里的 entry key`},{kind:`archive`,label:`Archive`,description:`归档 store(重命名为 *.archived)`},{kind:`about`,label:`About`,description:`显示命令语法`}],B=D({commandName:`local-memory`,parseArgs:e=>{let t=w(e);return t.action===`invalid`?{action:`invalid`,reason:`${L}\n${t.reason}`}:t},dispatch:P,View:x,errorView:e=>F.createElement(x,{mode:`error`,message:e})}),V=async(e,t,n)=>(n??``).trim()===``?(0,I.jsx)(N,{onDone:e}):B(e,t,n)}))();export{V as callLocalMemory};
@@ -0,0 +1,8 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,I as n,P as r,t as i,x as a}from"./src-DL3w8VPk.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{_ as s,c,m as l,v as u}from"./config-BddEvZZl.js";import{n as d,r as f}from"./analytics-DJobLaWP.js";import{n as p,t as m}from"./ThemePicker-DT9zVy-0.js";function h(e){return e}function g(e){let t=e.trim().toLowerCase();return t===``||t===`reset`?{sub:`full`}:b.has(t)?{sub:t}:{sub:`full`,unknownArg:t}}function _({onDone:e}){let[,n]=t();return(0,y.jsx)(a,{color:`permission`,children:(0,y.jsx)(m,{onThemeSelect:t=>{n(t),f(`tengu_onboarding_step`,{stepId:h(`theme`)}),e(`Theme set to ${t}.`)},onCancel:()=>e(`Theme picker dismissed.`),skipExitHandling:!0})})}function v({theme:e,hasCompletedOnboarding:t,lastOnboardingVersion:i}){return(0,y.jsxs)(n,{flexDirection:`column`,paddingLeft:1,children:[(0,y.jsx)(r,{bold:!0,children:`Onboarding status`}),(0,y.jsxs)(r,{children:[`- Theme: `,(0,y.jsx)(r,{bold:!0,children:e})]}),(0,y.jsxs)(r,{children:[`- Onboarding completed:`,` `,(0,y.jsx)(r,{bold:!0,color:t?`success`:`warning`,children:t?`yes`:`no`})]}),(0,y.jsxs)(r,{children:[`- Last onboarding version: `,(0,y.jsx)(r,{bold:!0,children:i})]}),(0,y.jsx)(r,{dimColor:!0,children:`Run /onboarding (no args) to re-run the full flow, or /onboarding theme | trust | model | mcp for a specific step.`})]})}var y,b,x;e((()=>{i(),d(),p(),l(),y=o(),b=new Set([`full`,`theme`,`trust`,`model`,`mcp`,`status`]),x=async(e,t,n)=>{let{sub:r,unknownArg:i}=g(n);if(f(`tengu_onboarding_step`,{stepId:h(`slash_${r}`)}),i!==void 0)return e(`Unknown /onboarding subcommand: \`${i}\`.\nValid: full | theme | trust | model | mcp | status`,{display:`system`}),null;if(r===`theme`)return(0,y.jsx)(_,{onDone:t=>e(t)});if(r===`trust`)return s(e=>({...e,hasTrustDialogAccepted:!1})),e("Workspace trust cleared for the current project. The trust dialog will appear on the next `claude` launch.",{display:`system`}),null;if(r===`model`)return e("Run `/model` to pick the AI model. Onboarding does not own the model picker; this entry exists for discoverability only.",{display:`system`}),null;if(r===`mcp`)return e("MCP server setup:\n - `/mcp` — list configured MCP servers\n - `claude mcp add <name> <command>` — add a server (in your shell)\n - `claude mcp remove <name>` — remove a server\nServers also load from `.mcp.json` in the workspace and from `~/.workmate.json` globally.",{display:`system`}),null;if(r===`status`){let e=c();return(0,y.jsx)(v,{theme:e.theme??`(unset)`,hasCompletedOnboarding:e.hasCompletedOnboarding===!0,lastOnboardingVersion:e.lastOnboardingVersion??`(unset)`})}return u(e=>({...e,hasCompletedOnboarding:!1})),e(`Onboarding flag cleared. The full first-run setup (theme, OAuth/API key, security notes, terminal-setup) will run on the next \`claude\` launch.
2
+
3
+ For individual steps in this session, use:
4
+ /onboarding theme — re-pick theme inline
5
+ /onboarding trust — re-confirm workspace trust on next launch
6
+ /onboarding model — open /model picker
7
+ /onboarding mcp — show MCP setup hints
8
+ /onboarding status — show current onboarding state`,{display:`system`}),null}}))();export{x as callOnboarding};