@readmagic/workmate 0.0.2 → 0.0.3

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 (490) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-BgNp7glC.js → AddWorkspaceDirectory-mANiG0xj.js} +1 -1
  2. package/dist/chunks/{App-Coboqa8H.js → App-aUVaOLeo.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-CYpBbj0k.js → ApproveApiKey-36iUE5CW.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-DPdcp1CQ.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-DxKsTdqj.js → AssistantSessionChooser-BLcvdkgb.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-DyjVt81B.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-Cx3QGFz-.js → BypassPermissionsModeDialog-CTlpvTuz.js} +1 -1
  8. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BAK9fxwg.js → ClaudeMdExternalIncludesDialog-5pipE8m8.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-Dn7Le--z.js +1 -0
  10. package/dist/chunks/ConsoleOAuthFlow-BDr1Vx5K.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-BsHgLlTy.js → DesktopHandoff-Blg1TVut.js} +1 -1
  12. package/dist/chunks/{DiffDialog-BgTW2Znv.js → DiffDialog-CUEpuocY.js} +2 -2
  13. package/dist/chunks/Doctor-B540I-gq.js +1 -0
  14. package/dist/chunks/Doctor-DlE1Mbb9.js +3 -0
  15. package/dist/chunks/ExitFlow-DCIhnP5h.js +2 -0
  16. package/dist/chunks/Feedback-CDTqPqsM.js +2 -0
  17. package/dist/chunks/{Grove-Dsi4yU08.js → Grove-D9lSG_Lh.js} +1 -1
  18. package/dist/chunks/Grove-DLYXL8hv.js +1 -0
  19. package/dist/chunks/{HybridTransport-8qA64lCx.js → HybridTransport-8j0AviF6.js} +4 -4
  20. package/dist/chunks/{InvalidConfigDialog-CAZ1z5WG.js → InvalidConfigDialog-I3t-0nU3.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-D82Qk_MR.js → InvalidSettingsDialog-BnthOxGT.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-zdocEDgk.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-8ZueNqAd.js → McpParsingWarnings-D0XvLirX.js} +1 -1
  24. package/dist/chunks/MessageSelector-BBhCstBa.js +3 -0
  25. package/dist/chunks/Messages-Dv2VrytX.js +11 -0
  26. package/dist/chunks/{Onboarding-CUztnbbv.js → Onboarding-B1WRpoBI.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-DSgrZvMv.js → OverageCreditUpsell-BSmgq089.js} +1 -1
  28. package/dist/chunks/PluginSettings-DN9rpwc_.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-IaihWay3.js → PromptInputFooterSuggestions-3rjz6zhK.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-okS2rQ4k.js → PromptInputHelpMenu-DgDJHZqC.js} +1 -1
  31. package/dist/chunks/QueryEngine-BnaHDZVZ.js +1 -0
  32. package/dist/chunks/REPL-B3RbzeV7.js +1 -0
  33. package/dist/chunks/{REPL-Dto012J0.js → REPL-CA8FEO7J.js} +44 -44
  34. package/dist/chunks/{RemoteCallout-C_UIYnuT.js → RemoteCallout-BFzCx_Pn.js} +1 -1
  35. package/dist/chunks/{RemoteSessionManager-CuSSHAXN.js → RemoteSessionManager-BhUrtejX.js} +2 -2
  36. package/dist/chunks/ResumeConversation-BseKUFRI.js +1 -0
  37. package/dist/chunks/{SSETransport-Chj_yfPv.js → SSETransport-DGIytG74.js} +3 -3
  38. package/dist/chunks/SearchExtraToolsTool-h6OunbMd.js +1 -0
  39. package/dist/chunks/Settings-BvhG1XoW.js +2 -0
  40. package/dist/chunks/{TeleportProgress-DP1a8jit.js → TeleportProgress-Bens06DU.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-B6sTwXuZ.js → TeleportRepoMismatchDialog-BtLBCZUe.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-CKUuRQSG.js → TeleportResumeWrapper-t50LfWyN.js} +1 -1
  43. package/dist/chunks/{ThemePicker-Dyq1YVhb.js → ThemePicker-BTfuZZ7E.js} +1 -1
  44. package/dist/chunks/TrustDialog-CgE_pYUK.js +1 -0
  45. package/dist/chunks/{ValidationErrorsList-DUNh4BNa.js → ValidationErrorsList-Bl68E-2-.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-TPbOXGrO.js → WelcomeV2-C93xQYAF.js} +1 -1
  47. package/dist/chunks/{add-dir-Bf_5tCeR.js → add-dir-C3IhJYVH.js} +1 -1
  48. package/dist/chunks/{agentDisplay-CCeYiAta.js → agentDisplay-Cju-aXCx.js} +1 -1
  49. package/dist/chunks/{agents-Bt72Gz1v.js → agents-Bhg0CtXR.js} +7 -7
  50. package/dist/chunks/{agents-T8xHY5Wk.js → agents-Du3FQ82k.js} +1 -1
  51. package/dist/chunks/{allErrors-CDWTJcMw.js → allErrors-DJYCAtab.js} +1 -1
  52. package/dist/chunks/{ant-DRF-v5bA.js → ant-CVvy4SuO.js} +1 -1
  53. package/dist/chunks/api-CI8HXREw.js +1 -0
  54. package/dist/chunks/api-gJBnC8z3.js +1 -0
  55. package/dist/chunks/asciicast-BsWpcxrc.js +1 -0
  56. package/dist/chunks/{asciicast-CQJlNTae.js → asciicast-CbAjUHT_.js} +4 -4
  57. package/dist/chunks/{assistant-z1ojxEET.js → assistant-C_SkUDk_.js} +1 -1
  58. package/dist/chunks/auth-B9V3i5oZ.js +1 -0
  59. package/dist/chunks/auth-CgEABs3i.js +15 -0
  60. package/dist/chunks/auth-fSFfSKy_.js +1 -0
  61. package/dist/chunks/{autoMode-DW_H3i37.js → autoMode-CZyb-mMY.js} +5 -5
  62. package/dist/chunks/{autonomy-46hnmyAi.js → autonomy-BpINX4jw.js} +1 -1
  63. package/dist/chunks/{autonomy-OxhciwYa.js → autonomy-DJZ25xZp.js} +7 -7
  64. package/dist/chunks/{autonomyPanel-CTEjq0Bd.js → autonomyPanel-ssoiIOx5.js} +1 -1
  65. package/dist/chunks/{backgroundHousekeeping-Cpxq4krt.js → backgroundHousekeeping-BHncba6e.js} +3 -3
  66. package/dist/chunks/backgroundHousekeeping-QK8iEXoI.js +1 -0
  67. package/dist/chunks/{banner-BVkLvJiB.js → banner-CWkrK10u.js} +1 -1
  68. package/dist/chunks/bg-B0iMGM9C.js +1 -0
  69. package/dist/chunks/{bg-zWGqkcST.js → bg-WnYN5ifx.js} +2 -2
  70. package/dist/chunks/{branch-DJzijRGm.js → branch-BXo5z2al.js} +1 -1
  71. package/dist/chunks/{bridge-Dpr2AWpc.js → bridge-CbKc1HeD.js} +2 -2
  72. package/dist/chunks/bridgeConfig-CLHy-BiF.js +1 -0
  73. package/dist/chunks/{bridgeConfig-DDF3teRE.js → bridgeConfig-DbqUHe0H.js} +1 -1
  74. package/dist/chunks/bridgeEnabled-BWSUZ7Xg.js +1 -0
  75. package/dist/chunks/{bridgeEnabled-D4JDZd0y.js → bridgeEnabled-CM3SaumJ.js} +1 -1
  76. package/dist/chunks/bridgeMain-BESKzpm0.js +1 -0
  77. package/dist/chunks/bridgeMain-CzhBVCsN.js +68 -0
  78. package/dist/chunks/bridgeMessaging-lfa_v3oi.js +1 -0
  79. package/dist/chunks/bridgePointer-MqLe5Asm.js +1 -0
  80. package/dist/chunks/{browser-BKiu1max.js → browser-BmZuQom6.js} +1 -1
  81. package/dist/chunks/{btw-DG9CCeq4.js → btw-Cp0whJaJ.js} +1 -1
  82. package/dist/chunks/{caches-BB5_91gU.js → caches-CmW7idg5.js} +2 -2
  83. package/dist/chunks/caches-CpqTC0Lb.js +1 -0
  84. package/dist/chunks/ccrClient-BPXmxWHw.js +1 -0
  85. package/dist/chunks/{claudeDesktop-9xfIgkzE.js → claudeDesktop-Cx31Ugjp.js} +1 -1
  86. package/dist/chunks/{clear-ueMvDelv.js → clear-DjGPxX7T.js} +1 -1
  87. package/dist/chunks/{cliLaunch-BJ9o-rIV.js → cliLaunch-BkPAatcs.js} +1 -1
  88. package/dist/chunks/client-DPUvQ6Rf.js +1 -0
  89. package/dist/chunks/{color-B0-MIfsq.js → color-DYYBN52b.js} +1 -1
  90. package/dist/chunks/commands-D7l3P1k9.js +1 -0
  91. package/dist/chunks/commitAttribution-B7NUPJ8E.js +1 -0
  92. package/dist/chunks/{commitAttribution-DKun9CeU.js → commitAttribution-Bmzgtqc6.js} +2 -2
  93. package/dist/chunks/compact-D6xqZN4Q.js +2 -0
  94. package/dist/chunks/{completionCache-CdHCuiqq.js → completionCache-MN3_MqK8.js} +2 -2
  95. package/dist/chunks/completionCache-c4aiyZ_f.js +1 -0
  96. package/dist/chunks/config-DiT2Z8dY.js +3 -0
  97. package/dist/chunks/config-huQaTcNb.js +1 -0
  98. package/dist/chunks/config-qLaiAn7z.js +1 -0
  99. package/dist/chunks/{context-DBswG0EY.js → context-Bh_iUj76.js} +1 -1
  100. package/dist/chunks/context-noninteractive-CNot6jbs.js +1 -0
  101. package/dist/chunks/{context-noninteractive-CTvyNimw.js → context-noninteractive-Cb3EM2Oz.js} +2 -2
  102. package/dist/chunks/conversation-CSpwF3Ha.js +1 -0
  103. package/dist/chunks/conversation-CvCQta8e.js +1 -0
  104. package/dist/chunks/{createSSHSession-BdO35H6o.js → createSSHSession-B0s839mX.js} +5 -5
  105. package/dist/chunks/createSession-GNSNbUbN.js +1 -0
  106. package/dist/chunks/{createSession-Br1g8qSD.js → createSession-VMTMXOHu.js} +1 -1
  107. package/dist/chunks/crossProjectResume-DGpgCUfk.js +40 -0
  108. package/dist/chunks/{daemon-BQiSFjc-.js → daemon-YtZbMQtn.js} +1 -1
  109. package/dist/chunks/datadog-D9rlcN12.js +1 -0
  110. package/dist/chunks/{debug-DiuXEmUq.js → debug-BrXObCdR.js} +1 -1
  111. package/dist/chunks/{debugUtils-3YYWvb3H.js → debugUtils-NO5KtXqi.js} +1 -1
  112. package/dist/chunks/{desktop-W7SA8BFk.js → desktop-DidI-4N5.js} +1 -1
  113. package/dist/chunks/{detached-Cv9gAylK.js → detached-TYk4hMFj.js} +1 -1
  114. package/dist/chunks/{detectRepository-B1PMTLAU.js → detectRepository-BPr0VWNO.js} +1 -1
  115. package/dist/chunks/detectRepository-BTPgN89l.js +1 -0
  116. package/dist/chunks/{diff-CMtRjFUb.js → diff-CZg5qL2n.js} +1 -1
  117. package/dist/chunks/{directoryCompletion-CeV63gvu.js → directoryCompletion-CW2ckkQg.js} +1 -1
  118. package/dist/chunks/doctor-CKUXGCri.js +1 -0
  119. package/dist/chunks/{effort-BAlVDBHq.js → effort-BcvNemuq.js} +2 -2
  120. package/dist/chunks/{entry-DLqeVq5C.js → entry-dA1UCfC0.js} +4 -4
  121. package/dist/chunks/envLessBridgeConfig-BFjJ8Kt4.js +1 -0
  122. package/dist/chunks/envLessBridgeConfig-bei51W3H.js +1 -0
  123. package/dist/chunks/esm-DjGYYlQe.js +1 -0
  124. package/dist/chunks/{execFileNoThrow-DResQRvR.js → execFileNoThrow-D244NytW.js} +1 -1
  125. package/dist/chunks/execSyncWrapper-CCMQShK-.js +1 -0
  126. package/dist/chunks/exit-COMnVxzw.js +1 -0
  127. package/dist/chunks/extra-usage-BTv_OwGN.js +1 -0
  128. package/dist/chunks/extra-usage-By33zGLT.js +1 -0
  129. package/dist/chunks/{extra-usage-core-Dh4rVUI-.js → extra-usage-core-RZMzaH0L.js} +1 -1
  130. package/dist/chunks/{extra-usage-noninteractive-D4Ya5KPm.js → extra-usage-noninteractive-BB-BQ3kh.js} +1 -1
  131. package/dist/chunks/{extraUsage-DtWi8E78.js → extraUsage-CTn9FWSk.js} +1 -1
  132. package/dist/chunks/extractMemories-CXGZGe0h.js +1 -0
  133. package/dist/chunks/fast-BXzdzzXU.js +1 -0
  134. package/dist/chunks/{fast-DkUxqWhE.js → fast-CNXgsvnE.js} +1 -1
  135. package/dist/chunks/{feedback-Cn7Sbqxa.js → feedback-DeJ2gvw2.js} +1 -1
  136. package/dist/chunks/{file-BZriE-XU.js → file-DcZWPH2V.js} +5 -5
  137. package/dist/chunks/firstPartyEventLogger-CQdJn3LV.js +5 -0
  138. package/dist/chunks/firstPartyEventLogger-CdLshdJY.js +1 -0
  139. package/dist/chunks/{flushGate-ebqQZF1t.js → flushGate-CJ73xcaK.js} +1 -1
  140. package/dist/chunks/gemini-Cn9bMXwP.js +1 -0
  141. package/dist/chunks/generateRecap-BO9kzRon.js +1 -0
  142. package/dist/chunks/{generateSessionName-DEAw5x_h.js → generateSessionName-CGpL6ATy.js} +1 -1
  143. package/dist/chunks/{genericProcessUtils-DO7Fy0RJ.js → genericProcessUtils-CdQTApYX.js} +1 -1
  144. package/dist/chunks/git-CbcnOf0E.js +1 -0
  145. package/dist/chunks/git-Do0wJvux.js +6 -0
  146. package/dist/chunks/{githubRepoPathMapping-Tt-LdYFZ.js → githubRepoPathMapping-C4umZ1oC.js} +1 -1
  147. package/dist/chunks/{goal-DCaI1NPN.js → goal-C8Qzl7_i.js} +3 -3
  148. package/dist/chunks/{grok-CKlngG3b.js → grok-CDT9P_BL.js} +1 -1
  149. package/dist/chunks/{grove-DSWe6psK.js → grove-BGXzEyH9.js} +2 -2
  150. package/dist/chunks/{heapdump-OVbV05On.js → heapdump-CFHvdSZv.js} +5 -5
  151. package/dist/chunks/{help-CRtX5VX9.js → help-DUZ7Y7Em.js} +1 -1
  152. package/dist/chunks/{hooks-tpf90xd5.js → hooks-RHwUCXcT.js} +2 -2
  153. package/dist/chunks/hooks-fZ1r0jUF.js +1 -0
  154. package/dist/chunks/{hostGuard-t7QfbijF.js → hostGuard-C5xydXZI.js} +1 -1
  155. package/dist/chunks/inboundAttachments-Cfl4_n0S.js +1 -0
  156. package/dist/chunks/inboundAttachments-YMxf4fmR.js +1 -0
  157. package/dist/chunks/initReplBridge-GH3-LHF4.js +1 -0
  158. package/dist/chunks/install-OkuNmjmB.js +1 -0
  159. package/dist/chunks/{instrumentation--Sx0y1Gk.js → instrumentation-hrXeo-G4.js} +6 -6
  160. package/dist/chunks/{job-D7B35Usp.js → job-DjmIpwJl.js} +1 -1
  161. package/dist/chunks/jwtUtils-DE2GPUcx.js +1 -0
  162. package/dist/chunks/keybindings-B8U17bhs.js +2 -0
  163. package/dist/chunks/{language-8Rnu_qxl.js → language-BA5WprZv.js} +1 -1
  164. package/dist/chunks/language-BbaOTWm3.js +1 -0
  165. package/dist/chunks/{launchAgentsPlatform-CNPkOVzu.js → launchAgentsPlatform-DnxH2SAn.js} +1 -1
  166. package/dist/chunks/{launchLocalMemory-BxmDhENs.js → launchLocalMemory-CgXtGng1.js} +2 -2
  167. package/dist/chunks/{launchLocalVault-DQlTGA-g.js → launchLocalVault-Bs6Km3Ua.js} +3 -3
  168. package/dist/chunks/{launchMemoryStores-EYAwxI8i.js → launchMemoryStores-DxVAIJuB.js} +1 -1
  169. package/dist/chunks/{launchOnboarding-CTu5Zf4E.js → launchOnboarding-Cn0t_o2k.js} +1 -1
  170. package/dist/chunks/{launchSchedule-CeHHSvO7.js → launchSchedule-Chwr3Nzd.js} +1 -1
  171. package/dist/chunks/{launchSkillStore-Bqh2Fru2.js → launchSkillStore-6zxJfWVU.js} +1 -1
  172. package/dist/chunks/{launchTeleport-Crc3XVZX.js → launchTeleport-Ba_Hj13c.js} +1 -1
  173. package/dist/chunks/{launchVault-BHLgpth_.js → launchVault-hGVrHy33.js} +1 -1
  174. package/dist/chunks/{v4-jw6qOKwQ.js → lazySchema-DcIJE_0i.js} +1 -1
  175. package/dist/chunks/loadAgentsDir-BHOyHxwz.js +1 -0
  176. package/dist/chunks/{loadAgentsDir-ZQwvbURI.js → loadAgentsDir-DrDu5yYy.js} +685 -683
  177. package/dist/chunks/loadPluginHooks-s7bvGtns.js +1 -0
  178. package/dist/chunks/localSearch-CebU5BA9.js +1 -0
  179. package/dist/chunks/{localSearch-H0LchlTi.js → localSearch-_bQhk9W6.js} +1 -1
  180. package/dist/chunks/{log-Duzb4o6h.js → log-BMCygSzM.js} +1 -1
  181. package/dist/chunks/{logoV2Utils-5lcUu53m.js → logoV2Utils-CoC4nheD.js} +1 -1
  182. package/dist/chunks/{magicDocs-D1FIPmYg.js → magicDocs-kMjYpjCA.js} +3 -3
  183. package/dist/chunks/{main-B8XtFN2P.js → main-C_rVSWfm.js} +78 -78
  184. package/dist/chunks/{main-CR7cXdgy.js → main-D862LI_d.js} +2 -2
  185. package/dist/chunks/{mappers-DKU4RgE3.js → mappers-D0CNXG32.js} +1 -1
  186. package/dist/chunks/mcp-1ZuFesM9.js +2 -0
  187. package/dist/chunks/mcp-CKvGBEjz.js +1 -0
  188. package/dist/chunks/mcp-DtxIl6aN.js +6 -0
  189. package/dist/chunks/{memoize-DgMjqLtn.js → memoize-B0zhbT8Z.js} +1 -1
  190. package/dist/chunks/{memory-D-Q62bJ7.js → memory-DE2jtkd_.js} +1 -1
  191. package/dist/chunks/{mode-DFZgqKBd.js → mode-B4WIxCMW.js} +2 -2
  192. package/dist/chunks/model-C4RHNhDQ.js +1 -0
  193. package/dist/chunks/model-fi472PRc.js +1 -0
  194. package/dist/chunks/{model-fDWtIRVr.js → model-j9GNZDFr.js} +1 -1
  195. package/dist/chunks/nativeInstaller-DktvrWRd.js +1 -0
  196. package/dist/chunks/{onChangeAppState-DaQ0R9Tw.js → onChangeAppState-CGVeNkt7.js} +1 -1
  197. package/dist/chunks/{openai-DNS0-ivj.js → openai-BSVjSJiF.js} +3 -3
  198. package/dist/chunks/{overageCreditGrant-qHN3tnp2.js → overageCreditGrant-BVxlYgeU.js} +1 -1
  199. package/dist/chunks/{panelCall-BvKpHquo.js → panelCall-Cp6fpQeL.js} +1 -1
  200. package/dist/chunks/parser-Bf6iasPV.js +1 -0
  201. package/dist/chunks/{parser-TYEkLFgh.js → parser-DFwaTGf7.js} +1 -1
  202. package/dist/chunks/{partition-Cv11dD5P.js → partition-RjCtgt9J.js} +1 -1
  203. package/dist/chunks/{passes-DQdM2Ssq.js → passes-ByTLy6pj.js} +1 -1
  204. package/dist/chunks/{path-Cu_AKqg6.js → path-D5U-tm91.js} +1 -1
  205. package/dist/chunks/permissions-B3df_htx.js +3 -0
  206. package/dist/chunks/pidLock-CdNZ0Wfg.js +3 -0
  207. package/dist/chunks/{pipeTransport-7GIO6GCA.js → pipeTransport-CqCnc-Ys.js} +1 -1
  208. package/dist/chunks/{plan-D8dQDl8W.js → plan-BxTA-b4l.js} +1 -1
  209. package/dist/chunks/{platform-B5dCGT8t.js → platform-BrYefG_2.js} +1 -1
  210. package/dist/chunks/{plugin-w8MqsKHn.js → plugin-DOpl5e1t.js} +1 -1
  211. package/dist/chunks/{pluginAutoupdate-7FFHzSRz.js → pluginAutoupdate-L09CQ-ph.js} +1 -1
  212. package/dist/chunks/pluginBlocklist-B32eWmzn.js +1 -0
  213. package/dist/chunks/pluginCliCommands-CDMWnO3d.js +1 -0
  214. package/dist/chunks/{pluginFlagging-_WUQP3Lq.js → pluginFlagging-3FQGvIfq.js} +1 -1
  215. package/dist/chunks/pluginOperations-ClzXYNQe.js +2 -0
  216. package/dist/chunks/{pluginStartupCheck-BelpzwZI.js → pluginStartupCheck-BNd2QNzZ.js} +1 -1
  217. package/dist/chunks/pluginStartupCheck-RiZxW-WU.js +1 -0
  218. package/dist/chunks/plugins-CcDG95Bs.js +4 -0
  219. package/dist/chunks/policyLimits-Bwi9VqDF.js +1 -0
  220. package/dist/chunks/pollConfig-DH2oCtFS.js +1 -0
  221. package/dist/chunks/{poor-D3T_8wwf.js → poor-DekfGNT7.js} +1 -1
  222. package/dist/chunks/poorMode-AE4WNYZo.js +1 -0
  223. package/dist/chunks/{poorMode-BqyVuBu-.js → poorMode-CtcqaiwD.js} +1 -1
  224. package/dist/chunks/print-Cc_QOSPF.js +23 -0
  225. package/dist/chunks/{privacy-settings-D5zxu4Aa.js → privacy-settings-ChNsgGUs.js} +1 -1
  226. package/dist/chunks/processBashCommand-Bx6_oZoE.js +1 -0
  227. package/dist/chunks/processSlashCommand-AltWgIFt.js +5 -0
  228. package/dist/chunks/prompt-C0nU0VK3.js +139 -0
  229. package/dist/chunks/prompt-CYx145pp.js +1 -0
  230. package/dist/chunks/prompt-DH3lKFag.js +1 -0
  231. package/dist/chunks/{promptEditor-D6HzjcMS.js → promptEditor-Cumef6hJ.js} +2 -2
  232. package/dist/chunks/{protocolHandler-BXlx1N7v.js → protocolHandler-z2zxAtB1.js} +4 -4
  233. package/dist/chunks/{proxy-CHnxhNZI.js → proxy-CRN7jYIi.js} +3 -3
  234. package/dist/chunks/{rate-limit-options-1hc-RyNR.js → rate-limit-options-VL7S3SCx.js} +1 -1
  235. package/dist/chunks/rcDebugLog-2-1XSyFV.js +11 -0
  236. package/dist/chunks/reconciler-DHRE_gV2.js +4 -0
  237. package/dist/chunks/{referral-Cu9bEOFE.js → referral-DrebVwqx.js} +1 -1
  238. package/dist/chunks/{refresh-vJbxW4a1.js → refresh-pFezssA8.js} +1 -1
  239. package/dist/chunks/{registerProtocol-B_XbLDQO.js → registerProtocol-CukLQuxJ.js} +3 -3
  240. package/dist/chunks/{release-notes-CavWoMQR.js → release-notes-D7vrFNXp.js} +1 -1
  241. package/dist/chunks/{releaseNotes-Di6OaHF7.js → releaseNotes-CDx2P0fb.js} +2 -2
  242. package/dist/chunks/{reload-plugins-ofeLn07p.js → reload-plugins-CltHfg-l.js} +1 -1
  243. package/dist/chunks/{remote-env-dXzHAuD6.js → remote-env-SvvSuP0J.js} +1 -1
  244. package/dist/chunks/remoteBridgeCore-BOeljn2c.js +1 -0
  245. package/dist/chunks/remoteManagedSettings-CaY_ZH8r.js +1 -0
  246. package/dist/chunks/{rename-CtjP0lop.js → rename-CbqrCCBO.js} +1 -1
  247. package/dist/chunks/{renderOptions-DOXmueQV.js → renderOptions-BUJB9nAm.js} +1 -1
  248. package/dist/chunks/{resume-C5h5JvY1.js → resume-DockJaY9.js} +2 -2
  249. package/dist/chunks/{ripgrep-BN_g-F7X.js → ripgrep-BXmXjAzA.js} +1 -1
  250. package/dist/chunks/ripgrep-BfIpz5uC.js +1 -0
  251. package/dist/chunks/{runtimeObserver-DOZFrqJu.js → runtimeObserver-DSUuYKfs.js} +1 -1
  252. package/dist/chunks/{runtimeObserver-B93v1AxE.js → runtimeObserver-XufSllVw.js} +4 -4
  253. package/dist/chunks/sandbox-adapter-CEZnHq0U.js +1 -0
  254. package/dist/chunks/{sandbox-toggle-TiLGFwaZ.js → sandbox-toggle-CZI5fuK3.js} +1 -1
  255. package/dist/chunks/searchExtraTools-iQfI39wB.js +1 -0
  256. package/dist/chunks/{session-v9tKHhU9.js → session-B-Z3DU9o.js} +2 -2
  257. package/dist/chunks/{sessionDiscovery-4byQKOnc.js → sessionDiscovery-C3pMZkBM.js} +1 -1
  258. package/dist/chunks/sessionFileAccessHooks-DyrZmoA7.js +1 -0
  259. package/dist/chunks/sessionMemory-CqRpgwtU.js +1 -0
  260. package/dist/chunks/sessionMemory-D_HQmhj7.js +1 -0
  261. package/dist/chunks/sessionMemoryUtils-CZOIKrn0.js +1 -0
  262. package/dist/chunks/sessionObserver-B400YG3s.js +1 -0
  263. package/dist/chunks/{sessionObserver-OgY9BUP4.js → sessionObserver-B_09FQKV.js} +1 -1
  264. package/dist/chunks/sessionStorage-DRnvtrpU.js +1 -0
  265. package/dist/chunks/sessionTitle-CmLWNFuX.js +14 -0
  266. package/dist/chunks/{sessionTracing-BBxhPccY.js → sessionTracing-lArOaj9u.js} +3 -3
  267. package/dist/chunks/settings-DfWP5y6X.js +19 -0
  268. package/dist/chunks/settingsSync-BlDk6rsM.js +1 -0
  269. package/dist/chunks/setup-DdbmxSZh.js +3 -0
  270. package/dist/chunks/{shadowedRuleDetection-DDSOFi1W.js → shadowedRuleDetection-E2wF1UjU.js} +1 -1
  271. package/dist/chunks/{shellQuote-yXoC_y5m.js → shellQuote-DkSy9MYE.js} +1 -1
  272. package/dist/chunks/{sideQuestion-CAiA6jAf.js → sideQuestion-BjHCLSR9.js} +1 -1
  273. package/dist/chunks/sinks-Cb--pqr-.js +2 -0
  274. package/dist/chunks/sinks-DbwDBd-E.js +1 -0
  275. package/dist/chunks/{skill-learning-Dx1o4mMo.js → skill-learning-B0dyBT1_.js} +1 -1
  276. package/dist/chunks/skillChangeDetector-DQof8SUY.js +1 -0
  277. package/dist/chunks/{skillGapStore-Zvqiyxds.js → skillGapStore-75ZYlfwi.js} +2 -2
  278. package/dist/chunks/{skillGapStore-BV_6qzxU.js → skillGapStore-D2fqmnKx.js} +1 -1
  279. package/dist/chunks/{skillGenerator-jJQDphQ8.js → skillGenerator-CwXUfM4Y.js} +2 -2
  280. package/dist/chunks/{skillLearning-BTT3_yGc.js → skillLearning-CB-5fdMl.js} +1 -1
  281. package/dist/chunks/skillLearning-CSY5R5Jn.js +1 -0
  282. package/dist/chunks/{skillPanel-OW2M6SZr.js → skillPanel-Bum7xpgo.js} +3 -3
  283. package/dist/chunks/{skillSearchPanel-C0Y56c5N.js → skillSearchPanel-LSPwZIOw.js} +4 -4
  284. package/dist/chunks/{skills-BFsyLP33.js → skills-G8WBeffd.js} +1 -1
  285. package/dist/chunks/startupProfiler-DIWVcO4e.js +1 -0
  286. package/dist/chunks/{startupProfiler-BquH_Yqm.js → startupProfiler-xa3NmN7Z.js} +2 -2
  287. package/dist/chunks/{stats-CrPmPT8f.js → stats-DmFubHpI.js} +1 -1
  288. package/dist/chunks/{status-DHJbK4pV.js → status-ClSsvm1N.js} +2 -2
  289. package/dist/chunks/{status-BO5J2MAe.js → status-i5beKggW.js} +1 -1
  290. package/dist/chunks/{statusNoticeHelpers-CqeUBySi.js → statusNoticeHelpers-BK-54uGY.js} +1 -1
  291. package/dist/chunks/{stickers-BLFmyHZV.js → stickers-D5teCKMN.js} +1 -1
  292. package/dist/chunks/{stringUtils-D_g2L6A4.js → stringUtils-DGLPkqJ4.js} +1 -1
  293. package/dist/chunks/{tag-M2AEtXjW.js → tag-DYYq4H_i.js} +2 -2
  294. package/dist/chunks/{tasks-CoOs_Qkj.js → tasks-BySzm_YJ.js} +1 -1
  295. package/dist/chunks/teleport-dxtBcM01.js +1 -0
  296. package/dist/chunks/{templateJobs-Cl50Qw0s.js → templateJobs-CT5VxeRr.js} +1 -1
  297. package/dist/chunks/terminalSetup-BNs9nLbT.js +33 -0
  298. package/dist/chunks/{terminalSetup-Bdh9K31U.js → terminalSetup-RDKg8dVa.js} +1 -1
  299. package/dist/chunks/{theme-DgCIr0jU.js → theme-CVTVsRwt.js} +1 -1
  300. package/dist/chunks/thinkback-B-GpXG9U.js +1 -0
  301. package/dist/chunks/{thinkback-ERCQ86CR.js → thinkback-CXsRbDYN.js} +1 -1
  302. package/dist/chunks/thinkback-play-BhfCaIye.js +1 -0
  303. package/dist/chunks/{tmux-ZZk68JBq.js → tmux-BY7IdQ1f.js} +1 -1
  304. package/dist/chunks/{toolEventObserver-9XCQXiMx.js → toolEventObserver--4fqXxQZ.js} +1 -1
  305. package/dist/chunks/{toolEventObserver-9-5Ne25Z.js → toolEventObserver-DdhPsAs1.js} +1 -1
  306. package/dist/chunks/toolPool-DvHECcbN.js +1 -0
  307. package/dist/chunks/trustedDevice-DvpN4J1F.js +1 -0
  308. package/dist/chunks/trustedDevice-e6iF1X7C.js +1 -0
  309. package/dist/chunks/{types-Cnorfsss.js → types-C-MRCL8J.js} +3 -3
  310. package/dist/chunks/udsClient-BuCtv7dN.js +1 -0
  311. package/dist/chunks/{ultrareviewCommand-BMBHepdu.js → ultrareviewCommand-i3PfFKly.js} +2 -2
  312. package/dist/chunks/undercover-CPvoDtJ1.js +1 -0
  313. package/dist/chunks/{undercover-DDgIKbO5.js → undercover-Q24TWRw0.js} +1 -1
  314. package/dist/chunks/{up-D6bNw_tT.js → up-BHkC97_C.js} +1 -1
  315. package/dist/chunks/updateCCB-CEXA6dax.js +11 -0
  316. package/dist/chunks/{upgrade-BN20nsCH.js → upgrade-7OrBbrzS.js} +1 -1
  317. package/dist/chunks/upgrade-uR7SIVtx.js +1 -0
  318. package/dist/chunks/upload-B-lNHpWe.js +1 -0
  319. package/dist/chunks/{upstreamproxy-os5rw0Vg.js → upstreamproxy-DyR_eXO8.js} +4 -4
  320. package/dist/chunks/usage-7jOeIVv9.js +1 -0
  321. package/dist/chunks/{usage-D_sqm8us.js → usage-CZdPfUqP.js} +1 -1
  322. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-vzUoPY51.js → useExitOnCtrlCDWithKeybindings-CzFtdlnD.js} +1 -1
  323. package/dist/chunks/useMainLoopModel-DegH12LZ.js +1 -0
  324. package/dist/chunks/useManagePlugins-BkK1zydO.js +1 -0
  325. package/dist/chunks/{useMergedTools-Bb4XbC9d.js → useMergedTools-DMGRA1ga.js} +1 -1
  326. package/dist/chunks/{useSearchInput-B1UOjxAI.js → useSearchInput-D5VU9IDU.js} +1 -1
  327. package/dist/chunks/{useSettingsErrors-BLbvu4--.js → useSettingsErrors-B5PSF1va.js} +1 -1
  328. package/dist/chunks/{util-CxlfALM4.js → util-CNa1ib_4.js} +1 -1
  329. package/dist/chunks/validatePlugin-Dw-RGCrm.js +1 -0
  330. package/dist/chunks/{vim-DLWBHwVM.js → vim-C0KTnJJs.js} +1 -1
  331. package/dist/chunks/{which-sEFQXpaX.js → which-CKQnSouy.js} +1 -1
  332. package/dist/chunks/windowsPaths-9pEkw0oV.js +1 -0
  333. package/dist/chunks/windowsPaths-DtapVxOo.js +1 -0
  334. package/dist/chunks/{workSecret-DvniZR71.js → workSecret-CNWiR2uQ.js} +1 -1
  335. package/dist/chunks/{workerRegistry-CFnGtb3L.js → workerRegistry-B2QD2sKq.js} +1 -1
  336. package/dist/chunks/worktree-D38cJ23W.js +1 -0
  337. package/dist/cli.js +1 -1
  338. package/package.json +4 -5
  339. package/dist/chunks/ApproveApiKey-CQsQdQBC.js +0 -1
  340. package/dist/chunks/BackgroundTasksDialog-AiVi-1pI.js +0 -2
  341. package/dist/chunks/ClaudeMdExternalIncludesDialog-DUu6iRJk.js +0 -1
  342. package/dist/chunks/ConsoleOAuthFlow-DVTPwR5I.js +0 -1
  343. package/dist/chunks/Doctor-BXhz8eUa.js +0 -3
  344. package/dist/chunks/Doctor-D75dsEyb.js +0 -1
  345. package/dist/chunks/ExitFlow-B1XNACQP.js +0 -2
  346. package/dist/chunks/Feedback-Cvz80lAn.js +0 -2
  347. package/dist/chunks/Grove-B7hhBvFw.js +0 -1
  348. package/dist/chunks/MCPConnectionManager-BLfKm4H2.js +0 -1
  349. package/dist/chunks/MessageSelector-DmKtBYX9.js +0 -3
  350. package/dist/chunks/Messages-CaFdI1kk.js +0 -11
  351. package/dist/chunks/PluginSettings-0FSNch8O.js +0 -17
  352. package/dist/chunks/QueryEngine-WYDWzQuY.js +0 -1
  353. package/dist/chunks/REPL-vV_jzAVx.js +0 -1
  354. package/dist/chunks/ResumeConversation-g_JyOWbl.js +0 -1
  355. package/dist/chunks/SearchExtraToolsTool-Daedym7_.js +0 -1
  356. package/dist/chunks/Settings-DUXA-qac.js +0 -2
  357. package/dist/chunks/TrustDialog-CdZS9t-T.js +0 -1
  358. package/dist/chunks/ajv-5vMo9UcX.js +0 -8
  359. package/dist/chunks/api-CLLIHLpn.js +0 -1
  360. package/dist/chunks/api-DMpNA1s8.js +0 -1
  361. package/dist/chunks/asciicast-BIr75_x9.js +0 -1
  362. package/dist/chunks/auth-Ce0jllLf.js +0 -1
  363. package/dist/chunks/auth-DV3P8Qup.js +0 -1
  364. package/dist/chunks/auth-DpFfHy1W.js +0 -15
  365. package/dist/chunks/backgroundHousekeeping-BycL9lOe.js +0 -1
  366. package/dist/chunks/bg-H849G7Sc.js +0 -1
  367. package/dist/chunks/bridgeConfig-CcANVX0P.js +0 -1
  368. package/dist/chunks/bridgeEnabled-Cn-u7P4_.js +0 -1
  369. package/dist/chunks/bridgeMain-CtgVyLjI.js +0 -68
  370. package/dist/chunks/bridgeMain-Dh0gWRVo.js +0 -1
  371. package/dist/chunks/bridgeMessaging-CRG6HqUb.js +0 -1
  372. package/dist/chunks/bridgePointer-Cug5fQ3e.js +0 -1
  373. package/dist/chunks/caches-C3NINY3K.js +0 -1
  374. package/dist/chunks/ccrClient-CRXGlUCe.js +0 -1
  375. package/dist/chunks/client-AnWHs0gW.js +0 -1
  376. package/dist/chunks/commands-DsKH3ogN.js +0 -1
  377. package/dist/chunks/commitAttribution-D7NrwLhc.js +0 -1
  378. package/dist/chunks/compact-BhWCO-oD.js +0 -2
  379. package/dist/chunks/completionCache-C9zlWBRz.js +0 -1
  380. package/dist/chunks/config-662VDD70.js +0 -3
  381. package/dist/chunks/config-CUN8YbOa.js +0 -1
  382. package/dist/chunks/config-DklnhNx1.js +0 -1
  383. package/dist/chunks/config-Wk3svGdH.js +0 -1
  384. package/dist/chunks/context-noninteractive-C3dICmA9.js +0 -1
  385. package/dist/chunks/conversation-CooSju3g.js +0 -1
  386. package/dist/chunks/conversation-DLLIOKYV.js +0 -1
  387. package/dist/chunks/createSession-CVG8SiEm.js +0 -1
  388. package/dist/chunks/crossProjectResume-DiKJb83I.js +0 -40
  389. package/dist/chunks/datadog-BE6D_6m0.js +0 -1
  390. package/dist/chunks/datadog-C69i7cfI.js +0 -1
  391. package/dist/chunks/debug-8kgDrUfj.js +0 -1
  392. package/dist/chunks/detectRepository-_Kj817Vi.js +0 -1
  393. package/dist/chunks/doctor-DEz8BHAz.js +0 -1
  394. package/dist/chunks/envLessBridgeConfig-3kCrKZl7.js +0 -1
  395. package/dist/chunks/envLessBridgeConfig-BfgXw47_.js +0 -1
  396. package/dist/chunks/esm-C8Zkk1Ux.js +0 -1
  397. package/dist/chunks/execSyncWrapper-CWxMek26.js +0 -1
  398. package/dist/chunks/exit-cyepwuyy.js +0 -1
  399. package/dist/chunks/extra-usage-DlFeNGQD.js +0 -1
  400. package/dist/chunks/extra-usage-nRFfBiXh.js +0 -1
  401. package/dist/chunks/extractMemories-BqN8fWZ5.js +0 -1
  402. package/dist/chunks/fast-NvqW2-t1.js +0 -1
  403. package/dist/chunks/firstPartyEventLogger-AhXYSrkP.js +0 -1
  404. package/dist/chunks/firstPartyEventLogger-BQYrBdvD.js +0 -5
  405. package/dist/chunks/gemini-Sr_00TsL.js +0 -1
  406. package/dist/chunks/generateRecap-5d4l_ODy.js +0 -1
  407. package/dist/chunks/git-Cc1jAz6r.js +0 -1
  408. package/dist/chunks/git-Cgc8X5l2.js +0 -6
  409. package/dist/chunks/hooks-DvtnNoYE.js +0 -1
  410. package/dist/chunks/inboundAttachments-BZ6MKpxd.js +0 -1
  411. package/dist/chunks/inboundAttachments-D5Ux2kCl.js +0 -1
  412. package/dist/chunks/initReplBridge-CjuO6in6.js +0 -1
  413. package/dist/chunks/install-DqpM2brU.js +0 -1
  414. package/dist/chunks/jwtUtils-CqXPjf-a.js +0 -1
  415. package/dist/chunks/keybindings-JvAmBpLt.js +0 -2
  416. package/dist/chunks/language-DaxZe0Xw.js +0 -1
  417. package/dist/chunks/lazySchema-uxlVVNM1.js +0 -1
  418. package/dist/chunks/loadAgentsDir-D7npVvsj.js +0 -1
  419. package/dist/chunks/loadPluginHooks-CaKvZVZI.js +0 -1
  420. package/dist/chunks/localSearch-BU5oulbF.js +0 -1
  421. package/dist/chunks/mcp-B06Mqsur.js +0 -6
  422. package/dist/chunks/mcp-C0AjA07u.js +0 -1
  423. package/dist/chunks/mcp-ghioDl7W.js +0 -2
  424. package/dist/chunks/metadata-CIx5CsoY.js +0 -1
  425. package/dist/chunks/model-BgrLt7P7.js +0 -1
  426. package/dist/chunks/model-aVc5c3Lz.js +0 -1
  427. package/dist/chunks/nativeInstaller-DKe1pWoL.js +0 -1
  428. package/dist/chunks/parser-Bj3gOqFv.js +0 -1
  429. package/dist/chunks/permissions-DB_2mmCl.js +0 -3
  430. package/dist/chunks/pidLock-DchmaAK6.js +0 -3
  431. package/dist/chunks/pluginBlocklist-Cw_l-yal.js +0 -1
  432. package/dist/chunks/pluginCliCommands-BtYWRxhS.js +0 -1
  433. package/dist/chunks/pluginOperations-BOkST1qE.js +0 -2
  434. package/dist/chunks/pluginStartupCheck-XBLJZZys.js +0 -1
  435. package/dist/chunks/plugins-6px6K1fh.js +0 -4
  436. package/dist/chunks/policyLimits-C07tQ0Wr.js +0 -1
  437. package/dist/chunks/pollConfig-C2Ac8WMU.js +0 -1
  438. package/dist/chunks/poorMode-BdBDiOFD.js +0 -1
  439. package/dist/chunks/print-DcQSuK0v.js +0 -23
  440. package/dist/chunks/processBashCommand-CEqA4QZi.js +0 -1
  441. package/dist/chunks/processSlashCommand-DMpFk59M.js +0 -5
  442. package/dist/chunks/prompt-CKvoqUC3.js +0 -1
  443. package/dist/chunks/prompt-aXZPR3q8.js +0 -1
  444. package/dist/chunks/prompt-wys9CwDo.js +0 -132
  445. package/dist/chunks/rcDebugLog-CivJaJ3V.js +0 -11
  446. package/dist/chunks/reconciler-BKX4jh34.js +0 -4
  447. package/dist/chunks/remoteBridgeCore-CmwkjiTK.js +0 -1
  448. package/dist/chunks/remoteManagedSettings-Co-CxR67.js +0 -1
  449. package/dist/chunks/ripgrep-hOjrgpMp.js +0 -1
  450. package/dist/chunks/sandbox-adapter-CO5GuywY.js +0 -1
  451. package/dist/chunks/searchExtraTools-CXZJU2Kv.js +0 -1
  452. package/dist/chunks/sessionFileAccessHooks-BUyIQVzL.js +0 -1
  453. package/dist/chunks/sessionMemory-ZsxCLHYd.js +0 -1
  454. package/dist/chunks/sessionMemory-e6YpTUhW.js +0 -1
  455. package/dist/chunks/sessionMemoryUtils-BD_dqyYB.js +0 -1
  456. package/dist/chunks/sessionObserver-DNItJztR.js +0 -1
  457. package/dist/chunks/sessionStorage-xvxpRETp.js +0 -1
  458. package/dist/chunks/sessionTitle-Bph6GO4F.js +0 -14
  459. package/dist/chunks/settings-BhvhCpVh.js +0 -19
  460. package/dist/chunks/settingsSync-D2B5K4BT.js +0 -1
  461. package/dist/chunks/setup-CEnNEK6Z.js +0 -3
  462. package/dist/chunks/sink-CyKOf5TT.js +0 -1
  463. package/dist/chunks/sink-DxPJ4khU.js +0 -1
  464. package/dist/chunks/sinks-BNo3DvxO.js +0 -2
  465. package/dist/chunks/sinks-CHgtwDha.js +0 -1
  466. package/dist/chunks/skillChangeDetector-BRBCwQ2w.js +0 -1
  467. package/dist/chunks/skillLearning-BH7EAU1m.js +0 -1
  468. package/dist/chunks/src-xRRBgNzF.js +0 -25
  469. package/dist/chunks/startupProfiler-CYCH-qos.js +0 -1
  470. package/dist/chunks/stdio-4S7b8Uhx.js +0 -1
  471. package/dist/chunks/stdio-W_Kokrkh.js +0 -3
  472. package/dist/chunks/teleport-DjIgQeBB.js +0 -1
  473. package/dist/chunks/terminalSetup-nvS3KCDG.js +0 -33
  474. package/dist/chunks/thinkback-BSv_fvbV.js +0 -1
  475. package/dist/chunks/thinkback-play-DNB0IWYt.js +0 -1
  476. package/dist/chunks/toolPool-uQKZRMKg.js +0 -1
  477. package/dist/chunks/trustedDevice-0ej6e3nx.js +0 -1
  478. package/dist/chunks/trustedDevice-nqhuw4tp.js +0 -1
  479. package/dist/chunks/udsClient-CiFj4M_h.js +0 -1
  480. package/dist/chunks/undercover-6UUO38fQ.js +0 -1
  481. package/dist/chunks/updateCCB-B-OlpLjA.js +0 -11
  482. package/dist/chunks/upgrade-DYqlCH80.js +0 -1
  483. package/dist/chunks/upload-BQGByiXE.js +0 -1
  484. package/dist/chunks/usage-DolSCKGi.js +0 -1
  485. package/dist/chunks/useMainLoopModel-cZd8EKo5.js +0 -1
  486. package/dist/chunks/useManagePlugins-DgGZBvXV.js +0 -1
  487. package/dist/chunks/validatePlugin-n8a4W_jI.js +0 -1
  488. package/dist/chunks/windowsPaths-BLevJOlm.js +0 -1
  489. package/dist/chunks/windowsPaths-N_YmYY6k.js +0 -1
  490. package/dist/chunks/worktree-Dr_WzlXs.js +0 -1
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n,t as r,y as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{Nb as o,Pb as s,ah as c,da as l,fa as u,ih as d,oh as f,rh as p}from"./loadAgentsDir-ZQwvbURI.js";import{n as m,r as h}from"./analytics-BotDBGh0.js";import{It as g,Mt as _,Pt as v,Vt as y,ci as b,oi as x}from"./model-BgrLt7P7.js";import{n as S,t as C}from"./extra-usage-nRFfBiXh.js";import{n as w,t as T}from"./upgrade-BN20nsCH.js";function E({onDone:e,context:t}){let[n,r]=(0,O.useState)(null),a=d(),s=g(),l=v(),f=_()?.hasExtraUsageEnabled===!0,p=s===`max`&&l===`default_claude_max_20x`,m=s===`team`||s===`enterprise`,y=(0,O.useMemo)(()=>{let e=[];if(c.isEnabled()){let t=x(),n=m&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}return!p&&!m&&u.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`}),[{label:`Stop and wait for limit to reset`,value:`cancel`},...e]},[!1,p,m,f,a.overageStatus,a.overageDisabledReason]);function b(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function S(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),T(e,t).then(e=>{e&&r(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),C(e,t).then(e=>{e&&r(e)})):n===`cancel`&&b()}return n||(0,k.jsx)(i,{title:`What do you want to do?`,onCancel:b,color:`suggestion`,children:(0,k.jsx)(o,{options:y,onChange:S,visibleOptionCount:y.length})})}async function D(e,t){return(0,k.jsx)(E,{onDone:e,context:t})}var O,k;e((()=>{O=t(n(),1),s(),r(),m(),p(),y(),b(),S(),f(),l(),w(),k=a()}))();export{D as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n,t as r,y as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{_x as o,ah as s,da as c,fa as l,ih as u,oh as d,rh as f,vx as p}from"./loadAgentsDir-DrDu5yYy.js";import{n as m,r as h}from"./analytics-BotDBGh0.js";import{It as g,Mt as _,Pt as v,Vt as y,ci as b,oi as x}from"./model-fi472PRc.js";import{n as S,t as C}from"./extra-usage-BTv_OwGN.js";import{n as w,t as T}from"./upgrade-7OrBbrzS.js";function E({onDone:e,context:t}){let[n,r]=(0,O.useState)(null),a=u(),c=g(),d=v(),f=_()?.hasExtraUsageEnabled===!0,p=c===`max`&&d===`default_claude_max_20x`,m=c===`team`||c===`enterprise`,y=(0,O.useMemo)(()=>{let e=[];if(s.isEnabled()){let t=x(),n=m&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}return!p&&!m&&l.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`}),[{label:`Stop and wait for limit to reset`,value:`cancel`},...e]},[!1,p,m,f,a.overageStatus,a.overageDisabledReason]);function b(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function S(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),T(e,t).then(e=>{e&&r(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),C(e,t).then(e=>{e&&r(e)})):n===`cancel`&&b()}return n||(0,k.jsx)(i,{title:`What do you want to do?`,onCancel:b,color:`suggestion`,children:(0,k.jsx)(o,{options:y,onChange:S,visibleOptionCount:y.length})})}async function D(e,t){return(0,k.jsx)(E,{onDone:e,context:t})}var O,k;e((()=>{O=t(n(),1),p(),r(),m(),f(),y(),b(),S(),d(),c(),w(),k=a()}))();export{D as call};
@@ -0,0 +1,11 @@
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{l as n,o as r}from"./envUtils-DSxRz_kt.js";import{en as i,gt as a,ht as o,sr as s,z as c}from"./state-ix0xIunV.js";import{F as l,a as u,d,l as f,nt as p,p as m,rt as h,z as g}from"./debug-BrXObCdR.js";import{M as _,j as ee}from"./git-Do0wJvux.js";import{Fr as te,Ir as ne,Nr as v,Pr as re}from"./model-fi472PRc.js";import{join as ie}from"node:path";import{appendFileSync as ae,existsSync as oe,mkdirSync as se}from"node:fs";import{homedir as ce}from"node:os";import{randomUUID as y}from"crypto";var le=e((()=>{})),ue,de=e((()=>{ue={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),fe=e((()=>{}));function pe(e){return e}var me=e((()=>{})),he=e((()=>{le(),de(),fe(),me()}));function ge(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function _e(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=ge(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return ve[t]??t}var ve,ye=e((()=>{ve={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function be(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function xe(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function Se(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=be(t),r=xe();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return b[t]?b[t]:n&&x[n]?x[n]:t}var b,x,Ce=e((()=>{b={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},x={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function we(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Te(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=we(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var Ee=e((()=>{})),S,C=e((()=>{S=`_geminiThoughtSignature`}));function w(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function De(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=je(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=ke(t,r);e.parts.length>0&&n.push(e)}}let i=Oe(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function Oe(e){return!e||e.length===0?``:e.filter(Boolean).join(`
2
+
3
+ `)}function ke(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:T(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>Ae(e,t))}:{role:`user`,parts:[]}}function Ae(e,t){if(typeof e==`string`)return T(e);if(e.type===`text`)return T(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Pe(n)}}]}if(e.type===`image`){let t=e.source;if(t?.type===`base64`&&typeof t.data==`string`)return[{inlineData:{mimeType:t.media_type||`image/png`,data:t.data}}];if(t?.type===`url`&&typeof t.url==`string`)return T(`[image: ${t.url}]`)}return[]}function je(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:T(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...T(e));continue}if(e.type===`text`){n.push(...T(e.text,E(e)));continue}if(e.type===`thinking`){let t=Me(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Ne(t.input)},...E(e)&&{thoughtSignature:E(e)}})}}return{role:`model`,parts:n}}function T(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Me(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Ne(e){if(typeof e==`string`){let t=w(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:t===null?{}:{value:t}}return e&&typeof e==`object`&&!Array.isArray(e)?e:e===void 0?{}:{value:e}}function Pe(e){let t=Fe(e.content);return t&&typeof t==`object`&&!Array.isArray(t)?e.is_error?{...t,is_error:!0}:t:{result:t,...e.is_error?{is_error:!0}:{}}}function Fe(e){if(typeof e==`string`)return w(e)??e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
4
+ `);return w(t)??t}return e??``}function E(e){let t=e[S];return typeof t==`string`&&t.length>0?t:void 0}var Ie=e((()=>{C()}));function Le(e){if(typeof e==`string`)return O.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&O.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function Re(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;if(typeof e==`string`)return`string`;if(typeof e==`boolean`)return`boolean`;if(typeof e==`number`)return Number.isInteger(e)?`integer`:`number`;if(typeof e==`object`)return`object`}function ze(e){let t=e.map(Re).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function Be(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function Ve(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,D(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function He(e){if(!Array.isArray(e))return;let t=e.map(e=>D(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function D(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=Le(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??ze(t.enum)):(n.enum=[t.const],r=r??Re(t.const)),r||(t.properties&&typeof t.properties==`object`?r=`object`:(t.items!==void 0||t.prefixItems!==void 0)&&(r=`array`)),t.nullable===!0&&(r=Be(r)),r&&(n.type=r),typeof t.title==`string`&&(n.title=t.title),typeof t.description==`string`&&(n.description=t.description),typeof t.format==`string`&&(n.format=t.format),typeof t.pattern==`string`&&(n.pattern=t.pattern),typeof t.minimum==`number`?n.minimum=t.minimum:typeof t.exclusiveMinimum==`number`&&(n.minimum=t.exclusiveMinimum),typeof t.maximum==`number`?n.maximum=t.maximum:typeof t.exclusiveMaximum==`number`&&(n.maximum=t.exclusiveMaximum),typeof t.minItems==`number`&&(n.minItems=t.minItems),typeof t.maxItems==`number`&&(n.maxItems=t.maxItems),typeof t.minLength==`number`&&(n.minLength=t.minLength),typeof t.maxLength==`number`&&(n.maxLength=t.maxLength),typeof t.minProperties==`number`&&(n.minProperties=t.minProperties),typeof t.maxProperties==`number`&&(n.maxProperties=t.maxProperties);let i=Ve(t.properties);if(i&&(n.properties=i,n.propertyOrdering=Object.keys(i)),Array.isArray(t.required)){let e=t.required.filter(e=>typeof e==`string`);e.length>0&&(n.required=e)}if(typeof t.additionalProperties==`boolean`)n.additionalProperties=t.additionalProperties;else{let e=D(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=D(t.items);Object.keys(a).length>0&&(n.items=a);let o=He(t.prefixItems);o&&(n.prefixItems=o);let s=He(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function Ue(e){let t=D(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function We(e){let t=e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e;return{name:t.name||``,description:t.description||``,parametersJsonSchema:Ue(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function Ge(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return{mode:`AUTO`};case`any`:return{mode:`ANY`};case`tool`:return{mode:`ANY`,allowedFunctionNames:typeof t.name==`string`?[t.name]:void 0};default:return}}var O,Ke=e((()=>{O=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*qe(e,t){let n=`msg_${y().replace(/-/g,``).slice(0,24)}`,r=!1,i=!1,a=0,o=null,s=!1,c,l=0,u=0,d=0;for await(let i of e){let e=i.usageMetadata;e&&(l=e.promptTokenCount??l,u=(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0),d=e.cachedContentTokenCount??d),r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}});let f=i.candidates?.[0],p=f?.content?.parts??[];for(let e of p){if(e.functionCall){o&&(yield{type:`content_block_stop`,index:o.index},o=null),s=!0;let t=a++;yield{type:`content_block_start`,index:t,content_block:{type:`tool_use`,id:`toolu_${y().replace(/-/g,``).slice(0,24)}`,name:e.functionCall.name||``,input:{}}},e.thoughtSignature&&(yield{type:`content_block_delta`,index:t,delta:{type:`signature_delta`,signature:e.thoughtSignature}}),e.functionCall.args&&Object.keys(e.functionCall.args).length>0&&(yield{type:`content_block_delta`,index:t,delta:{type:`input_json_delta`,partial_json:JSON.stringify(e.functionCall.args)}}),yield{type:`content_block_stop`,index:t};continue}let t=Je(e);if(t){(!o||o.type!==t)&&(o&&(yield{type:`content_block_stop`,index:o.index}),o={index:a++,type:t},yield{type:`content_block_start`,index:o.index,content_block:t===`thinking`?{type:`thinking`,thinking:``,signature:``}:{type:`text`,text:``}}),e.text&&(yield{type:`content_block_delta`,index:o.index,delta:t===`thinking`?{type:`thinking_delta`,thinking:e.text}:{type:`text_delta`,text:e.text}}),e.thoughtSignature&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}});continue}e.thoughtSignature&&o&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}})}f?.finishReason&&(c=f.finishReason)}r&&(o&&(yield{type:`content_block_stop`,index:o.index}),i||(yield{type:`message_delta`,delta:{stop_reason:Ye(c,s),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_creation_input_tokens:0,cache_read_input_tokens:d}},yield{type:`message_stop`},i=!0))}function Je(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function Ye(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var Xe=e((()=>{}));function k(e){if(!e||typeof e!=`object`)return null;let t=e,n=0;for(;t&&n<5;){if(t instanceof Error&&`code`in t&&typeof t.code==`string`){let e=t.code,n=nt.has(e);return{code:e,message:t.message,isSSLError:n}}if(t instanceof Error&&`cause`in t&&t.cause!==t)t=t.cause,n++;else break}return null}function Ze(e){let t=k(e);return t?.isSSLError?`SSL certificate error (${t.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`:null}function A(e){if(e.includes(`<!DOCTYPE html`)||e.includes(`<html`)){let t=e.match(/<title>([^<]+)<\/title>/);return t&&t[1]?t[1].trim():``}return e}function Qe(e){let t=e.message;return t?A(t):``}function $e(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function et(e){if(!$e(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=A(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=A(r);if(e.length>0)return e}return null}function tt(e){let t=k(e);if(t){let{code:e,isSSLError:n}=t;if(e===`ETIMEDOUT`)return`Request timed out. Check your internet connection and proxy settings`;if(n)switch(e){case`UNABLE_TO_VERIFY_LEAF_SIGNATURE`:case`UNABLE_TO_GET_ISSUER_CERT`:case`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`:return`Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates`;case`CERT_HAS_EXPIRED`:return`Unable to connect to API: SSL certificate has expired`;case`CERT_REVOKED`:return`Unable to connect to API: SSL certificate has been revoked`;case`DEPTH_ZERO_SELF_SIGNED_CERT`:case`SELF_SIGNED_CERT_IN_CHAIN`:return`Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates`;case`ERR_TLS_CERT_ALTNAME_INVALID`:case`HOSTNAME_MISMATCH`:return`Unable to connect to API: SSL certificate hostname mismatch`;case`CERT_NOT_YET_VALID`:return`Unable to connect to API: SSL certificate is not yet valid`;default:return`Unable to connect to API: SSL error (${e})`}}if(e.message===`Connection error.`)return t?.code?`Unable to connect to API (${t.code})`:`Unable to connect to API. Check your internet connection`;if(!e.message)return et(e)??`API error (status ${e.status??`unknown`})`;let n=Qe(e);return n!==e.message&&n.length>0?n:e.message}var nt,rt=e((()=>{nt=new Set([`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_SIGNATURE_FAILURE`,`CERT_NOT_YET_VALID`,`CERT_HAS_EXPIRED`,`CERT_REVOKED`,`CERT_REJECTED`,`CERT_UNTRUSTED`,`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`CERT_CHAIN_TOO_LONG`,`PATH_LENGTH_EXCEEDED`,`ERR_TLS_CERT_ALTNAME_INVALID`,`HOSTNAME_MISMATCH`,`ERR_TLS_HANDSHAKE_TIMEOUT`,`ERR_SSL_WRONG_VERSION_NUMBER`,`ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC`])}));function it(e,t,n){let r=[],i=at(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...ot(t));break;case`assistant`:r.push(...ct(t));break;default:break}return r}function at(e){return!e||e.length===0?``:e.filter(Boolean).join(`
5
+
6
+ `)}function ot(e){let t=[],n=e.message.content;if(typeof n==`string`)t.push({role:`user`,content:n});else if(Array.isArray(n)){let e=[],r=[],i=[];for(let t of n)if(typeof t==`string`)e.push(t);else if(t.type===`text`)e.push(t.text);else if(t.type===`tool_result`)r.push(t);else if(t.type===`image`){let e=lt(t);e&&i.push(e)}for(let e of r)t.push(st(e));if(i.length>0){let n=[];e.length>0&&n.push({type:`text`,text:e.join(`
7
+ `)}),n.push(...i),t.push({role:`user`,content:n})}else e.length>0&&t.push({role:`user`,content:e.join(`
8
+ `)})}return t}function st(e){let t;return t=typeof e.content==`string`?e.content:Array.isArray(e.content)?e.content.map(e=>typeof e==`string`?e:`text`in e?e.text:``).filter(Boolean).join(`
9
+ `):``,{role:`tool`,tool_call_id:e.tool_use_id,content:t}}function ct(e){let t=e.message.content;if(typeof t==`string`)return[{role:`assistant`,content:t}];if(!Array.isArray(t))return[{role:`assistant`,content:``}];let n=[],r=[],i=[];for(let e of t)if(typeof e==`string`)n.push(e);else if(e.type===`text`)n.push(e.text);else if(e.type===`tool_use`){let t=e;r.push({id:t.id,type:`function`,function:{name:t.name,arguments:typeof t.input==`string`?t.input:JSON.stringify(t.input)}})}else if(e.type===`thinking`){let t=e.thinking;typeof t==`string`&&i.push(t)}return[{role:`assistant`,content:n.length>0?n.join(`
10
+ `):null,...r.length>0&&{tool_calls:r},...i.length>0&&{reasoning_content:i.join(`
11
+ `)}}]}function lt(e){let t=e.source;return t?t.type===`base64`&&typeof t.data==`string`?{type:`image_url`,image_url:{url:`data:${t.media_type||`image/png`};base64,${t.data}`}}:t.type===`url`&&typeof t.url==`string`?{type:`image_url`,image_url:{url:t.url}}:null:null}var ut=e((()=>{}));function dt(e){return e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e,n=t.name||``,r=t.description||``,i=t.input_schema;return{type:`function`,function:{name:n,description:r,parameters:j(i||{type:`object`,properties:{}})}}})}function j(e){if(!e||typeof e!=`object`)return e;let t={...e};`const`in t&&(t.enum=[t.const],delete t.const);for(let e of[`properties`,`definitions`,`$defs`,`patternProperties`]){let n=t[e];if(n&&typeof n==`object`){let r={};for(let[e,t]of Object.entries(n))r[e]=t&&typeof t==`object`?j(t):t;t[e]=r}}for(let e of[`items`,`additionalProperties`,`not`,`if`,`then`,`else`,`contains`,`propertyNames`]){let n=t[e];n&&typeof n==`object`&&!Array.isArray(n)&&(t[e]=j(n))}for(let e of[`anyOf`,`oneOf`,`allOf`]){let n=t[e];Array.isArray(n)&&(t[e]=n.map(e=>e&&typeof e==`object`?j(e):e))}return t}function ft(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return`auto`;case`any`:return`required`;case`tool`:return{type:`function`,function:{name:t.name}};default:return}}var pt=e((()=>{}));async function*mt(e,t){let n=`msg_${y().replace(/-/g,``).slice(0,24)}`,r=!1,i=-1,a=new Map,o=!1,s=!1,c=0,l=0,u=0,d=0,f=new Set,p=null,m=!1;for await(let h of e){let e=h.choices?.[0],g=e?.delta;if(h.usage){c=h.usage.prompt_tokens??c;let e=h.usage.prompt_tokens_details?.cached_tokens??d;l=Math.max(0,c-e),u=h.usage.completion_tokens??u,d=e}if(r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}}),!g)continue;let _=g.reasoning_content;if(_!=null&&(o||(i++,o=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`thinking`,thinking:``,signature:``}}),_!==``&&(yield{type:`content_block_delta`,index:i,delta:{type:`thinking_delta`,thinking:_}})),g.content!=null&&g.content!==``&&(s||(o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),i++,s=!0,f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:i,delta:{type:`text_delta`,text:g.content}}),g.tool_calls)for(let e of g.tool_calls){let t=e.index;if(!a.has(t)){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1),i++;let n=e.id||`toolu_${y().replace(/-/g,``).slice(0,24)}`,r=e.function?.name||``;a.set(t,{contentIndex:i,id:n,name:r,arguments:``}),f.add(i),yield{type:`content_block_start`,index:i,content_block:{type:`tool_use`,id:n,name:r,input:{}}}}let n=e.function?.arguments;n&&(a.get(t).arguments+=n,yield{type:`content_block_delta`,index:a.get(t).contentIndex,delta:{type:`input_json_delta`,partial_json:n}})}if(e?.finish_reason){o&&(yield{type:`content_block_stop`,index:i},f.delete(i),o=!1),s&&(yield{type:`content_block_stop`,index:i},f.delete(i),s=!1);for(let[,e]of a)f.has(e.contentIndex)&&(yield{type:`content_block_stop`,index:e.contentIndex},f.delete(e.contentIndex));p=e.finish_reason,m=a.size>0}}for(let e of f)yield{type:`content_block_stop`,index:e};p!==null&&(yield{type:`message_delta`,delta:{stop_reason:p===`length`?`max_tokens`:m?`tool_use`:ht(p),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_read_input_tokens:d,cache_creation_input_tokens:0}},yield{type:`message_stop`})}function ht(e){switch(e){case`stop`:return`end_turn`;case`tool_calls`:return`tool_use`;case`length`:return`max_tokens`;case`content_filter`:return`end_turn`;default:return`end_turn`}}var gt=e((()=>{})),_t=e((()=>{he(),ye(),Ce(),Ee(),Ie(),Ke(),Xe(),C(),rt(),ut(),pt(),gt()}));function M(e){c()&&(N.length>=bt&&N.shift(),N.push(e))}function vt(){return N.length===0?[]:N.splice(0).map(e=>({...e,uuid:y(),session_id:o()}))}function yt(e,t,n){M({type:`system`,subtype:`task_notification`,task_id:e,tool_use_id:n?.toolUseId,status:t,output_file:n?.outputFile??``,summary:n?.summary??``,usage:n?.usage})}var bt,N,xt=e((()=>{i(),bt=1e3,N=[]}));function St(){let e=a();if(e!==void 0)return e;let t=process.env.CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR;if(!t){let e=ne(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??v,`session ingress token`);return s(e),e}let n=parseInt(t,10);if(Number.isNaN(n))return f(`CLAUDE_CODE_WEBSOCKET_AUTH_FILE_DESCRIPTOR must be a valid file descriptor number, got: ${t}`,{level:`error`}),s(null),null;try{let e=d(),t=process.platform===`darwin`||process.platform===`freebsd`?`/dev/fd/${n}`:`/proc/self/fd/${n}`,r=e.readFileSync(t,{encoding:`utf8`}).trim();return r?(f(`Successfully read token from file descriptor ${n}`),s(r),te(v,r,`session ingress token`),r):(f(`File descriptor contained empty token`,{level:`error`}),s(null),null)}catch(e){f(`Failed to read token from file descriptor ${n}: ${l(e)}`,{level:`error`});let t=ne(process.env.CLAUDE_SESSION_INGRESS_TOKEN_FILE??v,`session ingress token`);return s(t),t}}function Ct(){return process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN||St()}function wt(){let e=Ct();if(!e)return{};if(e.startsWith(`sk-ant-sid`)){let t={Cookie:`sessionKey=${e}`},n=process.env.CLAUDE_CODE_ORGANIZATION_UUID;return n&&(t[`X-Organization-Uuid`]=n),t}return{Authorization:`Bearer ${e}`}}function Tt(e){process.env.CLAUDE_CODE_SESSION_ACCESS_TOKEN=e}var Et=e((()=>{i(),re(),u(),g(),m()})),Dt=t({activateProactive:()=>Ot,deactivateProactive:()=>kt,getActivationSource:()=>Lt,getNextTickAt:()=>It,isContextBlocked:()=>Pt,isProactiveActive:()=>F,isProactivePaused:()=>At,pauseProactive:()=>jt,resumeProactive:()=>Mt,setContextBlocked:()=>Nt,setNextTickAt:()=>Ft,shouldTick:()=>zt,subscribeToProactiveChanges:()=>Rt});function P(){for(let e of V)try{e()}catch{}}function F(){return I}function Ot(e){I||(I=!0,L=!1,R=!1,B=e,P())}function kt(){I&&(I=!1,L=!1,R=!1,z=null,B=void 0,P())}function At(){return L}function jt(){!I||L||(L=!0,z=null,P())}function Mt(){!I||!L||(L=!1,P())}function Nt(e){R!==e&&(R=e,e&&(z=null),P())}function Pt(){return R}function Ft(e){z=e,P()}function It(){return!I||L||R?null:z}function Lt(){return B}function Rt(e){return V.add(e),()=>{V.delete(e)}}function zt(){return I&&!L&&!R}var I,L,R,z,B,V,Bt=e((()=>{I=!1,L=!1,R=!1,z=null,V=new Set}));function Vt(e){Qt=e}function Ht(e,t){if(U=e,!e||!t?.replayCurrent)return;let n=qt();Object.keys(n).length!==0&&e(n)}function Ut(e){$t=e}function Wt(e){return!e||e.enabled!==!0?null:{enabled:!0,phase:e.phase===`standby`||e.phase===`sleeping`?e.phase:null,next_tick_at:typeof e.next_tick_at==`number`?e.next_tick_at:null,sleep_until:typeof e.sleep_until==`number`?e.sleep_until:null}}function Gt(e){return JSON.stringify(e)}function Kt(e){let t={...K};for(let n of Object.keys(e)){let r=e[n];if(r===void 0){delete t[n];continue}t[n]=r}K=t}function qt(){let e={...K};return G?e.automation_state={...G}:`automation_state`in K&&(e.automation_state=K.automation_state??null),e}function Jt(){return en}function Yt(e,t){en=e,Qt?.(e,t),e===`requires_action`&&t?(W=!0,H({pending_action:t})):W&&(W=!1,H({pending_action:null})),e===`idle`&&H({task_summary:null}),e!==`idle`&&Xt(F()?{enabled:!0,phase:null,next_tick_at:null,sleep_until:null}:null),n(process.env.CLAUDE_CODE_EMIT_SESSION_STATE_EVENTS)&&M({type:`system`,subtype:`session_state_changed`,state:e})}function H(e){Kt(e),U?.(e)}function Xt(e){let t=Wt(e);Gt(t)!==Gt(G)&&(G=t,Kt({automation_state:t}),U?.({automation_state:t}))}function Zt(e){$t?.(e)}var Qt,U,$t,W,en,G,K,tn=e((()=>{Bt(),r(),xt(),Qt=null,U=null,$t=null,W=!1,en=`idle`,G=null,K={}}));function nn(){an(),Z=setInterval(()=>{_(`debug`,`session_keepalive_heartbeat`,{refcount:J}),n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&q?.()},fn)}function rn(){an(),q!==null&&(Q=setTimeout(()=>{_(`info`,`session_idle_30s`),Q=null},fn))}function an(){Q!==null&&(clearTimeout(Q),Q=null)}function on(e){q=e,J>0&&Z===null&&nn()}function sn(){q=null,Z!==null&&(clearInterval(Z),Z=null),an()}function cn(){n(process.env.CLAUDE_CODE_REMOTE_SEND_KEEPALIVES)&&q?.()}function ln(){return q!==null}function un(e){J++,Y.set(e,(Y.get(e)??0)+1),J===1&&(X=Date.now(),q!==null&&Z===null&&nn()),pn||(pn=!0,h(async()=>{_(`info`,`session_activity_at_shutdown`,{refcount:J,active:Object.fromEntries(Y),oldest_activity_ms:J>0&&X!==null?Date.now()-X:null})}))}function dn(e){J>0&&J--;let t=(Y.get(e)??0)-1;t>0?Y.set(e,t):Y.delete(e),J===0&&Z!==null&&(clearInterval(Z),Z=null,rn())}var fn,q,J,Y,X,Z,Q,pn,mn=e((()=>{p(),ee(),r(),fn=3e4,q=null,J=0,Y=new Map,X=null,Z=null,Q=null,pn=!1}));function hn(){let e=ie(ce(),`.claude`);oe(e)||se(e,{recursive:!0})}function gn(e){try{$||(hn(),ae(_n,`\n===== RC-DEBUG session ${new Date().toISOString()} =====\n`),$=!0);let t=new Date().toISOString().slice(11,23);ae(_n,`[${t}] ${e}\n`)}catch{}}var _n,$,vn=e((()=>{_n=ie(ce(),`.claude`,`rc-debug.log`),$=!1}));export{S as $,vt as A,it as B,Dt as C,Ct as D,wt as E,mt as F,rt as G,k as H,gt as I,Ge as J,qe as K,ft as L,M,xt as N,Et as O,_t as P,Ie as Q,dt as R,At as S,zt as T,tt as U,ut as V,Ze as W,Ke as X,We as Y,De as Z,Ht as _,on as a,ye as at,Pt as b,dn as c,me as ct,tn as d,C as et,Xt as f,Ut as g,Yt as h,ln as i,Se as it,yt as j,Tt as k,sn as l,ue as lt,H as m,gn as n,Te as nt,cn as o,_e as ot,Zt as p,Xe as q,mn as r,Ce as rt,un as s,pe as st,vn as t,Ee as tt,Jt as u,de as ut,Vt as v,Ft as w,F as x,Bt as y,pt as z};
@@ -0,0 +1,4 @@
1
+ import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,E as r,M as i,N as a,P as o,S as s,T as c,d as l,f as u,g as d,h as f,i as p,m as ee,n as m,r as h,t as g,v as te,x as _}from"./lazySchema-DcIJE_0i.js";import{en as ne,nt as v}from"./state-ix0xIunV.js";import{$w as re,Dn as ie,En as ae,Ew as y,Fs as oe,G as se,Gt as ce,Hs as le,Ls as ue,On as de,QT as fe,Tn as pe,Vs as me,W as he,ZT as ge,du as _e,eT as ve,fu as ye,ww as b,xw as x,yn as be}from"./loadAgentsDir-DrDu5yYy.js";import{C as xe,D as Se,F as Ce,S,a as C,l as w,w as T,z as E}from"./debug-BrXObCdR.js";import{Ct as we,St as Te}from"./settings-DfWP5y6X.js";import{n as Ee,o as De}from"./process-gEbdy6uY.js";import{M as Oe,_ as ke,j as Ae,n as je}from"./git-Do0wJvux.js";import{o as Me,s as D}from"./log-BMCygSzM.js";import{_ as Ne,f as Pe}from"./file-DcZWPH2V.js";import{dr as Fe,fr as Ie}from"./model-fi472PRc.js";import{d as Le,h as Re}from"./rcDebugLog-2-1XSyFV.js";import{t as ze}from"./controlMessageCompat-IFu4Gc1y.js";import{isAbsolute as Be,resolve as Ve}from"path";import{randomUUID as O}from"crypto";h(),g();var k=m(()=>r({inputTokens:c(),outputTokens:c(),cacheReadInputTokens:c(),cacheCreationInputTokens:c(),webSearchRequests:c(),costUSD:c(),contextWindow:c(),maxOutputTokens:c()})),He=m(()=>s(`json_schema`));m(()=>r({type:He()}));var Ue=m(()=>r({type:s(`json_schema`),schema:n(i(),o())}));m(()=>Ue());var We=m(()=>l([`user`,`project`,`org`,`temporary`,`oauth`]));m(()=>l([`local`,`user`,`project`]).describe(`Config scope for settings.`)),m(()=>s(`context-1m-2025-08-07`));var Ge=m(()=>r({type:s(`adaptive`)}).describe(`Claude decides when and how much to think (Opus 4.6+).`)),Ke=m(()=>r({type:s(`enabled`),budgetTokens:c().optional()}).describe(`Fixed thinking token budget (older models)`)),qe=m(()=>r({type:s(`disabled`)}).describe(`No extended thinking`));m(()=>a([Ge(),Ke(),qe()]).describe(`Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var Je=m(()=>r({type:s(`stdio`).optional(),command:i(),args:f(i()).optional(),env:n(i(),i()).optional()})),Ye=m(()=>r({type:s(`sse`),url:i(),headers:n(i(),i()).optional()})),Xe=m(()=>r({type:s(`http`),url:i(),headers:n(i(),i()).optional()})),Ze=m(()=>r({type:s(`sdk`),name:i()})),A=m(()=>a([Je(),Ye(),Xe(),Ze()])),Qe=m(()=>r({type:s(`claudeai-proxy`),url:i(),id:i()})),$e=m(()=>a([A(),Qe()])),j=m(()=>r({name:i().describe(`Server name as configured`),status:l([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:r({name:i(),version:i()}).optional().describe(`Server information (available when connected)`),error:i().optional().describe(`Error message (available when status is 'failed')`),config:$e().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:i().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:f(r({name:i(),description:i().optional(),annotations:r({readOnly:d().optional(),destructive:d().optional(),openWorld:d().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:r({experimental:n(i(),o()).optional()}).optional().describe(`@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.`)}).describe(`Status information for an MCP server connection.`));m(()=>r({added:f(i()).describe(`Names of servers that were added`),removed:f(i()).describe(`Names of servers that were removed`),errors:n(i(),i()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var M=m(()=>l([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),N=m(()=>l([`allow`,`deny`,`ask`])),P=m(()=>r({toolName:i(),ruleContent:i().optional()})),F=m(()=>te(`type`,[r({type:s(`addRules`),rules:f(P()),behavior:N(),destination:M()}),r({type:s(`replaceRules`),rules:f(P()),behavior:N(),destination:M()}),r({type:s(`removeRules`),rules:f(P()),behavior:N(),destination:M()}),r({type:s(`setMode`),mode:_(()=>L()),destination:M()}),r({type:s(`addDirectories`),directories:f(i()),destination:M()}),r({type:s(`removeDirectories`),directories:f(i()),destination:M()})])),I=m(()=>l([`user_temporary`,`user_permanent`,`user_reject`]).describe(`Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs).`));m(()=>a([r({behavior:s(`allow`),updatedInput:n(i(),o()).optional(),updatedPermissions:f(F()).optional(),toolUseID:i().optional(),decisionClassification:I().optional()}),r({behavior:s(`deny`),message:i(),interrupt:d().optional(),toolUseID:i().optional(),decisionClassification:I().optional()})]));var L=m(()=>l([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`]).describe(`Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Automatic mode (transcript classifier).`)),et=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`),tt=m(()=>l(et)),R=m(()=>r({session_id:i(),transcript_path:i(),cwd:i(),permission_mode:i().optional(),agent_id:i().optional().describe(`Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.`),agent_type:i().optional().describe(`Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).`)})),nt=m(()=>R().and(r({hook_event_name:s(`PreToolUse`),tool_name:i(),tool_input:o(),tool_use_id:i()}))),rt=m(()=>R().and(r({hook_event_name:s(`PermissionRequest`),tool_name:i(),tool_input:o(),permission_suggestions:f(F()).optional()}))),it=m(()=>R().and(r({hook_event_name:s(`PostToolUse`),tool_name:i(),tool_input:o(),tool_response:o(),tool_use_id:i()}))),at=m(()=>R().and(r({hook_event_name:s(`PostToolUseFailure`),tool_name:i(),tool_input:o(),tool_use_id:i(),error:i(),is_interrupt:d().optional()}))),ot=m(()=>R().and(r({hook_event_name:s(`PermissionDenied`),tool_name:i(),tool_input:o(),tool_use_id:i(),reason:i()}))),st=m(()=>R().and(r({hook_event_name:s(`Notification`),message:i(),title:i().optional(),notification_type:i()}))),ct=m(()=>R().and(r({hook_event_name:s(`UserPromptSubmit`),prompt:i()}))),lt=m(()=>R().and(r({hook_event_name:s(`SessionStart`),source:l([`startup`,`resume`,`clear`,`compact`]),agent_type:i().optional(),model:i().optional()}))),ut=m(()=>R().and(r({hook_event_name:s(`Setup`),trigger:l([`init`,`maintenance`])}))),dt=m(()=>R().and(r({hook_event_name:s(`Stop`),stop_hook_active:d(),last_assistant_message:i().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),ft=m(()=>R().and(r({hook_event_name:s(`StopFailure`),error:U(),error_details:i().optional(),last_assistant_message:i().optional()}))),pt=m(()=>R().and(r({hook_event_name:s(`SubagentStart`),agent_id:i(),agent_type:i()}))),mt=m(()=>R().and(r({hook_event_name:s(`SubagentStop`),stop_hook_active:d(),agent_id:i(),agent_transcript_path:i(),agent_type:i(),last_assistant_message:i().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),ht=m(()=>R().and(r({hook_event_name:s(`PreCompact`),trigger:l([`manual`,`auto`]),custom_instructions:i().nullable()}))),gt=m(()=>R().and(r({hook_event_name:s(`PostCompact`),trigger:l([`manual`,`auto`]),compact_summary:i().describe(`The conversation summary produced by compaction`)}))),_t=m(()=>R().and(r({hook_event_name:s(`TeammateIdle`),teammate_name:i(),team_name:i()}))),vt=m(()=>R().and(r({hook_event_name:s(`TaskCreated`),task_id:i(),task_subject:i(),task_description:i().optional(),teammate_name:i().optional(),team_name:i().optional()}))),yt=m(()=>R().and(r({hook_event_name:s(`TaskCompleted`),task_id:i(),task_subject:i(),task_description:i().optional(),teammate_name:i().optional(),team_name:i().optional()}))),bt=m(()=>R().and(r({hook_event_name:s(`Elicitation`),mcp_server_name:i(),message:i(),mode:l([`form`,`url`]).optional(),url:i().optional(),elicitation_id:i().optional(),requested_schema:n(i(),o()).optional()})).describe(`Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.`)),xt=m(()=>R().and(r({hook_event_name:s(`ElicitationResult`),mcp_server_name:i(),elicitation_id:i().optional(),mode:l([`form`,`url`]).optional(),action:l([`accept`,`decline`,`cancel`]),content:n(i(),o()).optional()})).describe(`Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.`)),St=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],Ct=m(()=>R().and(r({hook_event_name:s(`ConfigChange`),source:l(St),file_path:i().optional()}))),wt=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],Tt=[`User`,`Project`,`Local`,`Managed`],Et=m(()=>R().and(r({hook_event_name:s(`InstructionsLoaded`),file_path:i(),memory_type:l(Tt),load_reason:l(wt),globs:f(i()).optional(),trigger_file_path:i().optional(),parent_file_path:i().optional()}))),Dt=m(()=>R().and(r({hook_event_name:s(`WorktreeCreate`),name:i()}))),Ot=m(()=>R().and(r({hook_event_name:s(`WorktreeRemove`),worktree_path:i()}))),kt=m(()=>R().and(r({hook_event_name:s(`CwdChanged`),old_cwd:i(),new_cwd:i()}))),At=m(()=>R().and(r({hook_event_name:s(`FileChanged`),file_path:i(),event:l([`change`,`add`,`unlink`])}))),jt=[`clear`,`resume`,`logout`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],Mt=m(()=>l(jt)),Nt=m(()=>R().and(r({hook_event_name:s(`SessionEnd`),reason:Mt()}))),Pt=m(()=>a([nt(),it(),at(),ot(),st(),ct(),lt(),Nt(),dt(),ft(),pt(),mt(),ht(),gt(),rt(),ut(),_t(),vt(),yt(),bt(),xt(),Ct(),Et(),Dt(),Ot(),kt(),At()])),Ft=m(()=>r({async:s(!0),asyncTimeout:c().optional()})),It=m(()=>r({hookEventName:s(`PreToolUse`),permissionDecision:N().optional(),permissionDecisionReason:i().optional(),updatedInput:n(i(),o()).optional(),additionalContext:i().optional()})),Lt=m(()=>r({hookEventName:s(`UserPromptSubmit`),additionalContext:i().optional()})),Rt=m(()=>r({hookEventName:s(`SessionStart`),additionalContext:i().optional(),initialUserMessage:i().optional(),watchPaths:f(i()).optional()})),zt=m(()=>r({hookEventName:s(`Setup`),additionalContext:i().optional()})),Bt=m(()=>r({hookEventName:s(`SubagentStart`),additionalContext:i().optional()})),Vt=m(()=>r({hookEventName:s(`PostToolUse`),additionalContext:i().optional(),updatedMCPToolOutput:o().optional()})),Ht=m(()=>r({hookEventName:s(`PostToolUseFailure`),additionalContext:i().optional()})),Ut=m(()=>r({hookEventName:s(`PermissionDenied`),retry:d().optional()})),Wt=m(()=>r({hookEventName:s(`Notification`),additionalContext:i().optional()})),Gt=m(()=>r({hookEventName:s(`PermissionRequest`),decision:a([r({behavior:s(`allow`),updatedInput:n(i(),o()).optional(),updatedPermissions:f(F()).optional()}),r({behavior:s(`deny`),message:i().optional(),interrupt:d().optional()})])})),Kt=m(()=>r({hookEventName:s(`CwdChanged`),watchPaths:f(i()).optional()})),qt=m(()=>r({hookEventName:s(`FileChanged`),watchPaths:f(i()).optional()})),Jt=m(()=>r({continue:d().optional(),suppressOutput:d().optional(),stopReason:i().optional(),decision:l([`approve`,`block`]).optional(),systemMessage:i().optional(),reason:i().optional(),hookSpecificOutput:a([It(),Lt(),Rt(),zt(),Bt(),Vt(),Ht(),Ut(),Wt(),Gt(),Yt(),Xt(),Kt(),qt(),Zt()]).optional()})),Yt=m(()=>r({hookEventName:s(`Elicitation`),action:l([`accept`,`decline`,`cancel`]).optional(),content:n(i(),o()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),Xt=m(()=>r({hookEventName:s(`ElicitationResult`),action:l([`accept`,`decline`,`cancel`]).optional(),content:n(i(),o()).optional()}).describe(`Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.`)),Zt=m(()=>r({hookEventName:s(`WorktreeCreate`),worktreePath:i()}).describe(`Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.`));m(()=>a([Ft(),Jt()]));var Qt=m(()=>r({key:i().describe(`Unique key for this option, returned in the response`),label:i().describe(`Display text for this option`),description:i().optional().describe(`Optional description shown below the label`)}));m(()=>r({prompt:i().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:i().describe(`The prompt message to display to the user`),options:f(Qt()).describe(`Available options for the user to choose from`)})),m(()=>r({prompt_response:i().describe(`The request ID from the corresponding prompt request`),selected:i().describe(`The key of the selected option`)}));var z=m(()=>r({name:i().describe(`Skill name (without the leading slash)`),description:i().describe(`Description of what the skill does`),argumentHint:i().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),B=m(()=>r({name:i().describe(`Agent type identifier (e.g., "Explore")`),description:i().describe(`Description of when to use this agent`),model:i().optional().describe(`Model alias this agent uses. If omitted, inherits the parent's model`)}).describe(`Information about an available subagent that can be invoked via the Task tool.`)),$t=m(()=>r({value:i().describe(`Model identifier to use in API calls`),displayName:i().describe(`Human-readable display name`),description:i().describe(`Description of the model's capabilities`),supportsEffort:d().optional().describe(`Whether this model supports effort levels`),supportedEffortLevels:f(l([`low`,`medium`,`high`,`xhigh`,`max`])).optional().describe(`Available effort levels for this model`),supportsAdaptiveThinking:d().optional().describe(`Whether this model supports adaptive thinking (Claude decides when and how much to think)`),supportsFastMode:d().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:d().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),en=m(()=>r({email:i().optional(),organization:i().optional(),subscriptionType:i().optional(),tokenSource:i().optional(),apiKeySource:i().optional(),apiProvider:l([`firstParty`,`bedrock`,`vertex`,`foundry`]).optional().describe(`Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).`)}).describe(`Information about the logged in user's account.`)),tn=m(()=>a([i(),n(i(),A())])),nn=m(()=>r({description:i().describe(`Natural language description of when to use this agent`),tools:f(i()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:f(i()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:i().describe(`The agent's system prompt`),model:i().optional().describe(`Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model`),mcpServers:f(tn()).optional(),criticalSystemReminder_EXPERIMENTAL:i().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:f(i()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:i().optional().describe(`Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.`),maxTurns:c().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:d().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:l([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.claude/agent-memory/<agentType>/, 'project' - .claude/agent-memory/<agentType>/, 'local' - .claude/agent-memory-local/<agentType>/`),effort:a([l([`low`,`medium`,`high`,`xhigh`,`max`]),c().int()]).optional().describe(`Reasoning effort level for this agent. Either a named level or an integer`),permissionMode:L().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));m(()=>l([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.claude/settings.json). 'project' - Project settings (.claude/settings.json). 'local' - Local settings (.claude/settings.local.json).`)),m(()=>r({type:s(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:i().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),m(()=>r({canRewind:d(),error:i().optional(),filesChanged:f(i()).optional(),insertions:c().optional(),deletions:c().optional()}).describe(`Result of a rewindFiles operation.`));var rn=m(()=>o()),an=m(()=>o()),on=m(()=>o()),V=m(()=>i()),H=m(()=>o()),U=m(()=>l([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),sn=m(()=>a([s(`compacting`),u()])),W=m(()=>r({type:s(`user`),message:rn(),parent_tool_use_id:i().nullable(),isSynthetic:d().optional(),tool_use_result:o().optional(),priority:l([`now`,`next`,`later`]).optional(),timestamp:i().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),G=m(()=>W().extend({uuid:V().optional(),session_id:i().optional()})),cn=m(()=>W().extend({uuid:V(),session_id:i(),isReplay:s(!0)})),ln=m(()=>r({status:l([`allowed`,`allowed_warning`,`rejected`]),resetsAt:c().optional(),rateLimitType:l([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:c().optional(),overageStatus:l([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:c().optional(),overageDisabledReason:l([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`org_service_zero_credit_limit`,`no_limits_configured`,`unknown`]).optional(),isUsingOverage:d().optional(),surpassedThreshold:c().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),un=m(()=>r({type:s(`assistant`),message:an(),parent_tool_use_id:i().nullable(),error:U().optional(),uuid:V(),session_id:i()})),dn=m(()=>r({type:s(`rate_limit_event`),rate_limit_info:ln(),uuid:V(),session_id:i()}).describe(`Rate limit event emitted when rate limit info changes.`)),fn=m(()=>r({type:s(`streamlined_text`),text:i().describe(`Text content preserved from the assistant message`),session_id:i(),uuid:V()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),pn=m(()=>r({type:s(`streamlined_tool_use_summary`),tool_summary:i().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:i(),uuid:V()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),K=m(()=>r({tool_name:i(),tool_use_id:i(),tool_input:n(i(),o())})),mn=m(()=>r({type:s(`result`),subtype:s(`success`),duration_ms:c(),duration_api_ms:c(),is_error:d(),num_turns:c(),result:i(),stop_reason:i().nullable(),total_cost_usd:c(),usage:H(),modelUsage:n(i(),k()),permission_denials:f(K()),structured_output:o().optional(),fast_mode_state:q().optional(),uuid:V(),session_id:i()})),hn=m(()=>r({type:s(`result`),subtype:l([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:c(),duration_api_ms:c(),is_error:d(),num_turns:c(),stop_reason:i().nullable(),total_cost_usd:c(),usage:H(),modelUsage:n(i(),k()),permission_denials:f(K()),errors:f(i()),fast_mode_state:q().optional(),uuid:V(),session_id:i()})),gn=m(()=>a([mn(),hn()])),_n=m(()=>r({type:s(`system`),subtype:s(`init`),agents:f(i()).optional(),apiKeySource:We(),betas:f(i()).optional(),claude_code_version:i(),cwd:i(),tools:f(i()),mcp_servers:f(r({name:i(),status:i()})),model:i(),permissionMode:L(),slash_commands:f(i()),output_style:i(),skills:f(i()),plugins:f(r({name:i(),path:i(),source:i().optional().describe(`@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.`)})),fast_mode_state:q().optional(),uuid:V(),session_id:i()})),vn=m(()=>r({type:s(`stream_event`),event:on(),parent_tool_use_id:i().nullable(),uuid:V(),session_id:i()})),yn=m(()=>r({type:s(`system`),subtype:s(`compact_boundary`),compact_metadata:r({trigger:l([`manual`,`auto`]),pre_tokens:c(),preserved_segment:r({head_uuid:V(),anchor_uuid:V(),tail_uuid:V()}).optional().describe(`Relink info for messagesToKeep. Loaders splice the preserved segment at anchor_uuid (summary for suffix-preserving, boundary for prefix-preserving partial compact) so resume includes preserved content. Unset when compaction summarizes everything (no messagesToKeep).`)}),uuid:V(),session_id:i()})),bn=m(()=>r({type:s(`system`),subtype:s(`status`),status:sn(),permissionMode:L().optional(),uuid:V(),session_id:i()})),xn=m(()=>r({type:s(`system`),subtype:s(`post_turn_summary`),summarizes_uuid:i(),status_category:l([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:i(),is_noteworthy:d(),title:i(),description:i(),recent_action:i(),needs_action:i(),artifact_urls:f(i()),uuid:V(),session_id:i()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Sn=m(()=>r({type:s(`system`),subtype:s(`api_retry`),attempt:c(),max_retries:c(),retry_delay_ms:c(),error_status:c().nullable(),error:U(),uuid:V(),session_id:i()}).describe(`Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.`)),Cn=m(()=>r({type:s(`system`),subtype:s(`local_command_output`),content:i(),uuid:V(),session_id:i()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),wn=m(()=>r({type:s(`system`),subtype:s(`hook_started`),hook_id:i(),hook_name:i(),hook_event:i(),uuid:V(),session_id:i()})),Tn=m(()=>r({type:s(`system`),subtype:s(`hook_progress`),hook_id:i(),hook_name:i(),hook_event:i(),stdout:i(),stderr:i(),output:i(),uuid:V(),session_id:i()})),En=m(()=>r({type:s(`system`),subtype:s(`hook_response`),hook_id:i(),hook_name:i(),hook_event:i(),output:i(),stdout:i(),stderr:i(),exit_code:c().optional(),outcome:l([`success`,`error`,`cancelled`]),uuid:V(),session_id:i()})),Dn=m(()=>r({type:s(`tool_progress`),tool_use_id:i(),tool_name:i(),parent_tool_use_id:i().nullable(),elapsed_time_seconds:c(),task_id:i().optional(),uuid:V(),session_id:i()})),On=m(()=>r({type:s(`auth_status`),isAuthenticating:d(),output:f(i()),error:i().optional(),uuid:V(),session_id:i()})),kn=m(()=>r({type:s(`system`),subtype:s(`files_persisted`),files:f(r({filename:i(),file_id:i()})),failed:f(r({filename:i(),error:i()})),processed_at:i(),uuid:V(),session_id:i()})),An=m(()=>r({type:s(`system`),subtype:s(`task_notification`),task_id:i(),tool_use_id:i().optional(),status:l([`completed`,`failed`,`stopped`]),output_file:i(),summary:i(),usage:r({total_tokens:c(),tool_uses:c(),duration_ms:c()}).optional(),uuid:V(),session_id:i()})),jn=m(()=>r({type:s(`system`),subtype:s(`task_started`),task_id:i(),tool_use_id:i().optional(),description:i(),task_type:i().optional(),workflow_name:i().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:i().optional(),uuid:V(),session_id:i()})),Mn=m(()=>r({type:s(`system`),subtype:s(`session_state_changed`),state:l([`idle`,`running`,`requires_action`]),uuid:V(),session_id:i()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),Nn=m(()=>r({type:s(`system`),subtype:s(`task_progress`),task_id:i(),tool_use_id:i().optional(),description:i(),usage:r({total_tokens:c(),tool_uses:c(),duration_ms:c()}),last_tool_name:i().optional(),summary:i().optional(),uuid:V(),session_id:i()})),Pn=m(()=>r({type:s(`tool_use_summary`),summary:i(),preceding_tool_use_ids:f(i()),uuid:V(),session_id:i()})),Fn=m(()=>r({type:s(`system`),subtype:s(`elicitation_complete`),mcp_server_name:i(),elicitation_id:i(),uuid:V(),session_id:i()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),In=m(()=>r({type:s(`prompt_suggestion`),suggestion:i(),uuid:V(),session_id:i()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));m(()=>r({sessionId:i().describe(`Unique session identifier (UUID).`),summary:i().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:c().describe(`Last modified time in milliseconds since epoch.`),fileSize:c().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:i().optional().describe(`User-set session title via /rename.`),firstPrompt:i().optional().describe(`First meaningful user prompt in the session.`),gitBranch:i().optional().describe(`Git branch at the end of the session.`),cwd:i().optional().describe(`Working directory for the session.`),tag:i().optional().describe(`User-set session tag.`),createdAt:c().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var Ln=m(()=>a([un(),G(),cn(),gn(),_n(),vn(),yn(),bn(),Sn(),Cn(),wn(),Tn(),En(),Dn(),On(),An(),jn(),Nn(),Mn(),kn(),Pn(),dn(),Fn(),In()])),q=m(()=>l([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));h(),g();var Rn=m(()=>o()),zn=m(()=>r({matcher:i().optional(),hookCallbackIds:f(i()),timeout:c().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),Bn=m(()=>r({subtype:s(`initialize`),hooks:n(tt(),f(zn())).optional(),sdkMcpServers:f(i()).optional(),jsonSchema:n(i(),o()).optional(),systemPrompt:i().optional(),appendSystemPrompt:i().optional(),agents:n(i(),nn()).optional(),promptSuggestions:d().optional(),agentProgressSummaries:d().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));m(()=>r({commands:f(z()),agents:f(B()),output_style:i(),available_output_styles:f(i()),models:f($t()),account:en(),pid:c().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:q().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var Vn=m(()=>r({subtype:s(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),Hn=m(()=>r({subtype:s(`can_use_tool`),tool_name:i(),input:n(i(),o()),permission_suggestions:f(F()).optional(),blocked_path:i().optional(),decision_reason:i().optional(),title:i().optional(),display_name:i().optional(),tool_use_id:i(),agent_id:i().optional(),description:i().optional()}).describe(`Requests permission to use a tool with the given input.`)),Un=m(()=>r({subtype:s(`set_permission_mode`),mode:L(),ultraplan:d().optional().describe(`@internal CCR ultraplan session marker.`)}).describe(`Sets the permission mode for tool execution handling.`)),Wn=m(()=>r({subtype:s(`set_model`),model:i().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Gn=m(()=>r({subtype:s(`set_max_thinking_tokens`),max_thinking_tokens:c().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Kn=m(()=>r({subtype:s(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));m(()=>r({mcpServers:f(j())}).describe(`Response containing the current status of all MCP server connections.`));var qn=m(()=>r({subtype:s(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Jn=m(()=>r({name:i(),tokens:c(),color:i(),isDeferred:d().optional()})),Yn=m(()=>r({color:i(),isFilled:d(),categoryName:i(),tokens:c(),percentage:c(),squareFullness:c()}));m(()=>r({categories:f(Jn()),totalTokens:c(),maxTokens:c(),rawMaxTokens:c(),percentage:c(),gridRows:f(f(Yn())),model:i(),memoryFiles:f(r({path:i(),type:i(),tokens:c()})),mcpTools:f(r({name:i(),serverName:i(),tokens:c(),isLoaded:d().optional()})),deferredBuiltinTools:f(r({name:i(),tokens:c(),isLoaded:d()})).optional(),systemTools:f(r({name:i(),tokens:c()})).optional(),systemPromptSections:f(r({name:i(),tokens:c()})).optional(),agents:f(r({agentType:i(),source:i(),tokens:c()})),slashCommands:r({totalCommands:c(),includedCommands:c(),tokens:c()}).optional(),skills:r({totalSkills:c(),includedSkills:c(),tokens:c(),skillFrontmatter:f(r({name:i(),source:i(),tokens:c()}))}).optional(),autoCompactThreshold:c().optional(),isAutoCompactEnabled:d(),messageBreakdown:r({toolCallTokens:c(),toolResultTokens:c(),attachmentTokens:c(),assistantMessageTokens:c(),userMessageTokens:c(),toolCallsByType:f(r({name:i(),callTokens:c(),resultTokens:c()})),attachmentsByType:f(r({name:i(),tokens:c()}))}).optional(),apiUsage:r({input_tokens:c(),output_tokens:c(),cache_creation_input_tokens:c(),cache_read_input_tokens:c()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Xn=m(()=>r({subtype:s(`rewind_files`),user_message_id:i(),dry_run:d().optional()}).describe(`Rewinds file changes made since a specific user message.`));m(()=>r({canRewind:d(),error:i().optional(),filesChanged:f(i()).optional(),insertions:c().optional(),deletions:c().optional()}).describe(`Result of a rewindFiles operation.`));var Zn=m(()=>r({subtype:s(`cancel_async_message`),message_uuid:i()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));m(()=>r({cancelled:d()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var Qn=m(()=>r({subtype:s(`seed_read_state`),path:i(),mtime:c()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),$n=m(()=>r({subtype:s(`hook_callback`),callback_id:i(),input:Pt(),tool_use_id:i().optional()}).describe(`Delivers a hook callback with its input data.`)),er=m(()=>r({subtype:s(`mcp_message`),server_name:i(),message:Rn()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),tr=m(()=>r({subtype:s(`mcp_set_servers`),servers:n(i(),A())}).describe(`Replaces the set of dynamically managed MCP servers.`));m(()=>r({added:f(i()),removed:f(i()),errors:n(i(),i())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var nr=m(()=>r({subtype:s(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));m(()=>r({commands:f(z()),agents:f(B()),plugins:f(r({name:i(),path:i(),source:i().optional()})),mcpServers:f(j()),error_count:c()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var rr=m(()=>r({subtype:s(`mcp_reconnect`),serverName:i()}).describe(`Reconnects a disconnected or failed MCP server.`)),ir=m(()=>r({subtype:s(`mcp_toggle`),serverName:i(),enabled:d()}).describe(`Enables or disables an MCP server.`)),ar=m(()=>r({subtype:s(`stop_task`),task_id:i()}).describe(`Stops a running task.`)),or=m(()=>r({subtype:s(`apply_flag_settings`),settings:n(i(),o())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),sr=m(()=>r({subtype:s(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));m(()=>r({effective:n(i(),o()),sources:f(r({source:l([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:n(i(),o())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:r({model:i(),effort:l([`low`,`medium`,`high`,`xhigh`,`max`]).nullable()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var cr=m(()=>r({subtype:s(`elicitation`),mcp_server_name:i(),message:i(),mode:l([`form`,`url`]).optional(),url:i().optional(),elicitation_id:i().optional(),requested_schema:n(i(),o()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),lr=m(()=>r({action:l([`accept`,`decline`,`cancel`]),content:n(i(),o()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),ur=m(()=>a([Vn(),Hn(),Bn(),Un(),Wn(),Gn(),Kn(),qn(),$n(),er(),Xn(),Zn(),Qn(),tr(),nr(),rr(),ir(),ar(),or(),sr(),cr()])),J=m(()=>r({type:s(`control_request`),request_id:i(),request:ur()})),dr=m(()=>r({subtype:s(`success`),request_id:i(),response:n(i(),o()).optional()})),fr=m(()=>r({subtype:s(`error`),request_id:i(),error:i(),pending_permission_requests:f(_(()=>J())).optional()})),Y=m(()=>r({type:s(`control_response`),response:a([dr(),fr()])})),pr=m(()=>r({type:s(`control_cancel_request`),request_id:i()}).describe(`Cancels a currently open control request.`)),X=m(()=>r({type:s(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),mr=m(()=>r({type:s(`update_environment_variables`),variables:n(i(),i())}).describe(`Updates environment variables at runtime.`));m(()=>a([Ln(),fn(),pn(),xn(),Y(),J(),pr(),X()])),m(()=>a([G(),J(),Y(),X(),mr()])),e(),ne(),E(),S(),Ee(),Ae(),ae(),h(),C(),g(),b(),ie(),m(()=>p.object({tool_name:p.string().describe(`The name of the tool requesting permission`),input:p.record(p.string(),p.unknown()).describe(`The input for the tool`),tool_use_id:p.string().optional().describe(`The unique tool use request ID`)}));var Z=m(()=>p.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),hr=m(()=>p.object({behavior:p.literal(`allow`),updatedInput:p.record(p.string(),p.unknown()),updatedPermissions:p.array(de()).optional().catch(e=>{w(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:p.string().optional(),decisionClassification:Z()})),gr=m(()=>p.object({behavior:p.literal(`deny`),message:p.string(),interrupt:p.boolean().optional(),toolUseID:p.string().optional(),decisionClassification:Z()})),Q=m(()=>p.union([hr(),gr()]));function $(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:x(e.toolPermissionContext,t)})),y(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(w(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}Me(),Pe(),Te(),re(),Le(),ye(),be(),se();var _r=/\u2028|\u2029/g;function vr(e){return e.replace(_r,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function yr(e){return vr(T(e))}C(),S(),h(),b();var br=`SandboxNetworkAccess`;function xr(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function Sr(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var Cr=1e3,wr=class{constructor(e,n){t(this,`input`,void 0),t(this,`replayUserMessages`,void 0),t(this,`structuredInput`,void 0),t(this,`pendingRequests`,new Map),t(this,`restoredWorkerState`,Promise.resolve(null)),t(this,`inputClosed`,!1),t(this,`unexpectedResponseCallback`,void 0),t(this,`resolvedToolUseIds`,new Set),t(this,`prependedLines`,[]),t(this,`onControlRequestSent`,void 0),t(this,`onControlRequestResolved`,void 0),t(this,`outbound`,new _e),this.input=e,this.replayUserMessages=n,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>Cr)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(T({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})+`
2
+ `)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
3
+ `);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&(Oe(`info`,`cli_stdin_message_parsed`,{type:r.type}),yield r)}}.bind(this);yield*t();for await(let n of this.input)e+=n,yield*t();if(e){let t=await this.processLine(e);t&&(yield t)}this.inputClosed=!0;for(let e of this.pendingRequests.values())e.reject(Error(`Tool permission stream closed before response received`))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map(e=>e.request).filter(e=>e.request.subtype===`can_use_tool`)}setUnexpectedResponseCallback(e){this.unexpectedResponseCallback=e}injectControlResponse(e){let t=e.response,n=t?.request_id;if(!n)return;let r=this.pendingRequests.get(n);if(r)if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n),this.write({type:`control_cancel_request`,request_id:n}),t.subtype===`error`)r.reject(Error(t.error));else{let e=t.response;if(r.schema)try{r.resolve(r.schema.parse(e))}catch(e){r.reject(e)}else r.resolve({})}}setOnControlRequestSent(e){this.onControlRequestSent=e}setOnControlRequestResolved(e){this.onControlRequestResolved=e}async processLine(e){if(e)try{let t=ze(xe(e));if(t.type===`keep_alive`)return;if(t.type===`update_environment_variables`){let e=t.variables??{},n=Object.keys(e);for(let[t,n]of Object.entries(e))process.env[t]=n;w(`[structuredIO] applied update_environment_variables: ${n.join(`, `)}`);return}if(t.type===`control_response`){let e=`uuid`in t&&typeof t.uuid==`string`?t.uuid:void 0;e&&ve(e,`completed`);let n=t.response,r=this.pendingRequests.get(n.request_id);if(!r){let e=(n.subtype===`success`?n.response:void 0)?.toolUseID;if(typeof e==`string`&&this.resolvedToolUseIds.has(e)){w(`Ignoring duplicate control_response for already-resolved toolUseID=${e} request_id=${n.request_id}`);return}this.unexpectedResponseCallback&&await this.unexpectedResponseCallback(t);return}if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n.request_id),r.request.request.subtype===`can_use_tool`&&this.onControlRequestResolved&&this.onControlRequestResolved(n.request_id),n.subtype===`error`){r.reject(Error(n.error??`Unknown error`));return}let i=n.response;if(r.schema)try{r.resolve(r.schema.parse(i))}catch(e){r.reject(e)}else r.resolve({});return this.replayUserMessages?t:void 0}if(t.type!==`user`&&t.type!==`control_request`&&t.type!==`assistant`&&t.type!==`system`){w(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||Tr(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&Tr(`Error: Expected message role 'user', got '${t.message?.role}'`),t)}catch(t){console.error(`Error parsing streaming input line: ${e}: ${t}`),process.exit(1)}}async write(e){De(yr(e)+`
4
+ `)}async sendRequest(e,t,n,r=O()){let i={type:`control_request`,request_id:r,request:e};if(this.inputClosed)throw Error(`Stream closed`);if(n?.aborted)throw Error(`Request aborted`);this.outbound.enqueue(i),e.subtype===`can_use_tool`&&this.onControlRequestSent&&this.onControlRequestSent(i);let a=()=>{this.outbound.enqueue({type:`control_cancel_request`,request_id:r});let e=this.pendingRequests.get(r);e&&(this.trackResolvedToolUseId(e.request),e.reject(new Se))};n&&n.addEventListener(`abort`,a,{once:!0});try{return await new Promise((n,i)=>{this.pendingRequests.set(r,{request:{type:`control_request`,request_id:r,request:e},resolve:e=>{n(e)},reject:i,schema:t})})}finally{n&&n.removeEventListener(`abort`,a),this.pendingRequests.delete(r)}}createCanUseTool(e){return async(t,n,r,i,a,o)=>{let s=o??await he(t,n,r,i,a);if(s.behavior===`allow`||s.behavior===`deny`)return s;let c=new AbortController,l=r.abortController.signal,u=()=>c.abort();l.addEventListener(`abort`,u,{once:!0});try{let i=Er(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=O();e?.(Sr(t,n,a,o));let l=this.sendRequest({subtype:`can_use_tool`,tool_name:t.name,input:n,permission_suggestions:s.suggestions,blocked_path:s.blockedPath,decision_reason:xr(s.decisionReason),tool_use_id:a,agent_id:r.agentId},Q(),c.signal,o).then(e=>({source:`sdk`,result:e})),u=await Promise.race([i,l]);return u.source===`hook`?u.decision?(l.catch(()=>{}),c.abort(),u.decision):$((await l).result,t,n,r):$(u.result,t,n,r)}catch(e){return $({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&Re(`running`),l.removeEventListener(`abort`,u)}}}createHookCallback(e,t){return{type:`callback`,timeout:t,callback:async(t,n,r)=>{try{return await this.sendRequest({subtype:`hook_callback`,callback_id:e,input:t,tool_use_id:n||void 0},pe(),r)}catch(t){return console.error(`Error in hook callback ${e}:`,t),{}}}}}async handleElicitation(e,t,n,r,i,a,o){try{return await this.sendRequest({subtype:`elicitation`,mcp_server_name:e,message:t,mode:i,url:a,elicitation_id:o,requested_schema:n},lr(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:br,input:{host:e.host},tool_use_id:O(),description:`Allow network connection to ${e.host}?`},Q())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},r({mcp_response:ee()}))).mcp_response}};function Tr(e){console.error(e),process.exit(1)}async function Er(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=ce(e,t,n,r,a,i,r.abortController.signal);for await(let e of o)if(e.permissionRequestResult&&(e.permissionRequestResult.behavior===`allow`||e.permissionRequestResult.behavior===`deny`)){let t=e.permissionRequestResult;if(t.behavior===`allow`){let e=t.updatedInput||n,i=t.updatedPermissions??[];if(i.length>0){y(i);let e=x(r.getAppState().toolPermissionContext,i);r.setAppState(t=>t.toolPermissionContext===e?t:{...t,toolPermissionContext:e})}return{behavior:`allow`,updatedInput:e,userModified:!1,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}else return{behavior:`deny`,message:t.message||`Permission denied by PermissionRequest hook`,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}}fe();function Dr(e){if(e.type!==`user`)return;let t=e.message?.content;if(!t||Array.isArray(t)&&t.length===0)return;let n=`uuid`in e&&typeof e.uuid==`string`?e.uuid:void 0;return{content:Array.isArray(t)?Or(t):t,uuid:n}}function Or(e){return e.some(kr)?e.map(e=>{if(!kr(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:ge(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function kr(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}Fe(),C(),E(),ke(),me();function Ar(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=Mr(s.source,n?.projectRoot);e?s.sourceIsFallback||Ie(c,e.source)?a.push(o):i.push({name:o,declaredSource:c,materializedSource:e.source}):r.push(o)}return{missing:r,sourceChanged:i,upToDate:a}}async function jr(e){let t=ue();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let n;try{n=await le()}catch(e){D(e),n={}}let r=Ar(t,n,{projectRoot:v()}),i=[...r.missing.map(e=>({name:e,source:Mr(t[e].source),action:`install`})),...r.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],a=[],o=[];for(let t of i){if(e?.skip?.(t.name,t.source)){a.push(t.name);continue}if(t.action===`update`&&we(t.source)&&!await Ne(t.source.path)){w(`[reconcile] '${t.name}' declared path does not exist; keeping materialized entry`),a.push(t.name);continue}o.push(t)}if(o.length===0)return{installed:[],updated:[],failed:[],upToDate:r.upToDate,skipped:a};w(`[reconcile] ${o.length} marketplace(s): ${o.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let s=[],c=[],l=[];for(let t=0;t<o.length;t++){let{name:n,source:r,action:i}=o[t];e?.onProgress?.({type:`installing`,name:n,action:i,index:t+1,total:o.length});try{let t=await oe(r);i===`install`?s.push(n):c.push(n),e?.onProgress?.({type:`installed`,name:n,alreadyMaterialized:t.alreadyMaterialized})}catch(t){let r=Ce(t);l.push({name:n,error:r}),e?.onProgress?.({type:`failed`,name:n,error:r}),D(t)}}return{installed:s,updated:c,failed:l,upToDate:r.upToDate,skipped:a}}function Mr(e,t){if((e.source===`directory`||e.source===`file`)&&!Be(e.path)){let n=t??v(),r=je(n);return{...e,path:Ve(r??n,e.path)}}return e}export{wr as a,$ as c,br as i,jr as n,yr as o,Dr as r,Q as s,Ar as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{t as r}from"./src-CDCSSo0U2.js";import{l as i,p as a}from"./debug-DiuXEmUq.js";import{b as o,c as s,g as c}from"./config-662VDD70.js";import{d as l,f as u,o as d,s as f}from"./log-Duzb4o6h.js";import{l as p,u as m}from"./oauth-BqJqV-2M.js";import{It as h,Kt as g,Mt as _,Vt as v}from"./model-BgrLt7P7.js";import{a as y,l as b,o as x}from"./api-CLLIHLpn.js";var S=e((()=>{r()})),C=e((()=>{r()}));async function w(e=`claude_code_guest_pass`){let{accessToken:n,orgUUID:r}=await b(),i={...y(n),"x-organization-uuid":r},a=`${p().BASE_API_URL}/api/oauth/organizations/${r}/referral/eligibility`;return(await t.get(a,{headers:i,params:{campaign:e},timeout:5e3})).data}async function T(e=`claude_code_guest_pass`){let{accessToken:n,orgUUID:r}=await b(),i={...y(n),"x-organization-uuid":r},a=`${p().BASE_API_URL}/api/oauth/organizations/${r}/referral/redemptions`;return(await t.get(a,{headers:i,params:{campaign:e},timeout:1e4})).data}function E(){return!!(_()?.organizationUuid&&g()&&h()===`max`)}function D(){if(!E())return{eligible:!1,needsRefresh:!1,hasCache:!1};let e=_()?.organizationUuid;if(!e)return{eligible:!1,needsRefresh:!1,hasCache:!1};let t=s().passesEligibilityCache?.[e];if(!t)return{eligible:!1,needsRefresh:!0,hasCache:!1};let{eligible:n,timestamp:r}=t;return{eligible:n,needsRefresh:Date.now()-r>P,hasCache:!0}}function O(e){let t=I[e.currency]??`${e.currency} `,n=e.amount_minor_units/100;return`${t}${n%1==0?n.toString():n.toFixed(2)}`}function k(){let e=_()?.organizationUuid;return e?s().passesEligibilityCache?.[e]?.referrer_reward??null:null}function A(){let e=_()?.organizationUuid;return e?s().passesEligibilityCache?.[e]?.remaining_passes??null:null}async function j(){if(F)return a(`Passes: Reusing in-flight eligibility fetch`),F;let e=_()?.organizationUuid;return e?(F=(async()=>{try{let t=await w(),n={...t,timestamp:Date.now()};return o(t=>({...t,passesEligibilityCache:{...t.passesEligibilityCache,[e]:n}})),a(`Passes eligibility cached for org ${e}: ${t.eligible}`),t}catch(e){return a(`Failed to fetch and cache passes eligibility`),f(e),null}finally{F=null}})(),F):null}async function M(){if(!E())return null;let e=_()?.organizationUuid;if(!e)return null;let t=s().passesEligibilityCache?.[e],n=Date.now();if(!t)return a(`Passes: No cache, fetching eligibility in background (command unavailable this session)`),j(),null;if(n-t.timestamp>P){a(`Passes: Cache stale, returning cached data and refreshing in background`),j();let{timestamp:e,...n}=t;return n}a(`Passes: Using fresh cached eligibility data`);let{timestamp:r,...i}=t;return i}async function N(){u()||M()}var P,F,I,L=e((()=>{n(),m(),v(),c(),i(),d(),l(),x(),P=1440*60*1e3,F=null,I={USD:`$`,EUR:`€`,GBP:`£`,BRL:`R$`,CAD:`CA$`,AUD:`A$`,NZD:`NZ$`,SGD:`S$`}}));export{k as a,N as c,M as i,C as l,T as n,A as o,O as r,L as s,D as t,S as u};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{t as r}from"./src-CDCSSo0U2.js";import{a as i,l as a}from"./debug-BrXObCdR.js";import{b as o,c as s,g as c}from"./config-DiT2Z8dY.js";import{d as l,f as u,o as d,s as f}from"./log-BMCygSzM.js";import{l as p,u as m}from"./oauth-BqJqV-2M.js";import{It as h,Kt as g,Mt as _,Vt as v}from"./model-fi472PRc.js";import{a as y,l as b,o as x}from"./api-gJBnC8z3.js";var S=e((()=>{r()})),C=e((()=>{r()}));async function w(e=`claude_code_guest_pass`){let{accessToken:n,orgUUID:r}=await b(),i={...y(n),"x-organization-uuid":r},a=`${p().BASE_API_URL}/api/oauth/organizations/${r}/referral/eligibility`;return(await t.get(a,{headers:i,params:{campaign:e},timeout:5e3})).data}async function T(e=`claude_code_guest_pass`){let{accessToken:n,orgUUID:r}=await b(),i={...y(n),"x-organization-uuid":r},a=`${p().BASE_API_URL}/api/oauth/organizations/${r}/referral/redemptions`;return(await t.get(a,{headers:i,params:{campaign:e},timeout:1e4})).data}function E(){return!!(_()?.organizationUuid&&g()&&h()===`max`)}function D(){if(!E())return{eligible:!1,needsRefresh:!1,hasCache:!1};let e=_()?.organizationUuid;if(!e)return{eligible:!1,needsRefresh:!1,hasCache:!1};let t=s().passesEligibilityCache?.[e];if(!t)return{eligible:!1,needsRefresh:!0,hasCache:!1};let{eligible:n,timestamp:r}=t;return{eligible:n,needsRefresh:Date.now()-r>P,hasCache:!0}}function O(e){let t=I[e.currency]??`${e.currency} `,n=e.amount_minor_units/100;return`${t}${n%1==0?n.toString():n.toFixed(2)}`}function k(){let e=_()?.organizationUuid;return e?s().passesEligibilityCache?.[e]?.referrer_reward??null:null}function A(){let e=_()?.organizationUuid;return e?s().passesEligibilityCache?.[e]?.remaining_passes??null:null}async function j(){if(F)return a(`Passes: Reusing in-flight eligibility fetch`),F;let e=_()?.organizationUuid;return e?(F=(async()=>{try{let t=await w(),n={...t,timestamp:Date.now()};return o(t=>({...t,passesEligibilityCache:{...t.passesEligibilityCache,[e]:n}})),a(`Passes eligibility cached for org ${e}: ${t.eligible}`),t}catch(e){return a(`Failed to fetch and cache passes eligibility`),f(e),null}finally{F=null}})(),F):null}async function M(){if(!E())return null;let e=_()?.organizationUuid;if(!e)return null;let t=s().passesEligibilityCache?.[e],n=Date.now();if(!t)return a(`Passes: No cache, fetching eligibility in background (command unavailable this session)`),j(),null;if(n-t.timestamp>P){a(`Passes: Cache stale, returning cached data and refreshing in background`),j();let{timestamp:e,...n}=t;return n}a(`Passes: Using fresh cached eligibility data`);let{timestamp:r,...i}=t;return i}async function N(){u()||M()}var P,F,I,L=e((()=>{n(),m(),v(),c(),i(),d(),l(),x(),P=1440*60*1e3,F=null,I={USD:`$`,EUR:`€`,GBP:`£`,BRL:`R$`,CAD:`CA$`,AUD:`A$`,NZD:`NZ$`,SGD:`S$`}}));export{k as a,N as c,M as i,C as l,T as n,A as o,O as r,L as s,D as t,S as u};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,nt as n}from"./state-ix0xIunV.js";import{Cc as r,Df as i,Sc as a,Sm as o,_m as s,fs as c,i as l,kf as u,lc as d,nv as f,o as p,ps as m,rv as h,uc as g,vy as _,xm as v,ym as y,yy as b}from"./loadAgentsDir-ZQwvbURI.js";import{U as x,l as S,p as C,z as w}from"./debug-DiuXEmUq.js";import{o as T,s as E}from"./log-Duzb4o6h.js";async function D(e){C(`refreshActivePlugins: clearing all plugin caches`),d(),i();let t=await m(),[r,s]=await Promise.all([a(),l(n())]),{enabled:c,disabled:u,errors:f}=t,[p,g]=await Promise.all([Promise.all(c.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await h(e,f);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(c.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await o(e,f);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),_=p.reduce((e,t)=>e+t,0),v=g.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:c,disabled:u,commands:r,errors:O(e.plugins.errors,f),needsRefresh:!1},agentDefinitions:s,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),y();let x=!1;try{await b()}catch(e){x=!0,E(e),C(`refreshActivePlugins: loadPluginHooks failed: ${w(e)}`)}let S=c.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return C(`refreshActivePlugins: ${c.length} enabled, ${r.length} commands, ${s.allAgents.length} agents, ${S} hooks, ${_} MCP, ${v} LSP`),{enabled_count:c.length,disabled_count:u.length,command_count:r.length,agent_count:s.allAgents.length,hook_count:S,mcp_count:_,lsp_count:v,error_count:f.length+ +!!x,agentDefinitions:s,pluginCommands:r}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),s(),p(),S(),x(),T(),g(),r(),_(),v(),f(),u(),c()}));export{D as n,A as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,nt as n}from"./state-ix0xIunV.js";import{Cc as r,Df as i,Sc as a,Sm as o,_m as s,fs as c,i as l,kf as u,lc as d,nb as f,nv as p,o as m,ps as h,rb as g,rv as _,uc as v,xm as y,ym as b}from"./loadAgentsDir-DrDu5yYy.js";import{F as x,a as S,l as C,z as w}from"./debug-BrXObCdR.js";import{o as T,s as E}from"./log-BMCygSzM.js";async function D(e){C(`refreshActivePlugins: clearing all plugin caches`),d(),i();let t=await h(),[r,s]=await Promise.all([a(),l(n())]),{enabled:c,disabled:u,errors:f}=t,[p,m]=await Promise.all([Promise.all(c.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await _(e,f);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(c.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await o(e,f);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),v=p.reduce((e,t)=>e+t,0),y=m.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:c,disabled:u,commands:r,errors:O(e.plugins.errors,f),needsRefresh:!1},agentDefinitions:s,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),b();let S=!1;try{await g()}catch(e){S=!0,E(e),C(`refreshActivePlugins: loadPluginHooks failed: ${x(e)}`)}let w=c.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return C(`refreshActivePlugins: ${c.length} enabled, ${r.length} commands, ${s.allAgents.length} agents, ${w} hooks, ${v} MCP, ${y} LSP`),{enabled_count:c.length,disabled_count:u.length,command_count:r.length,agent_count:s.allAgents.length,hook_count:w,mcp_count:v,lsp_count:y,error_count:f.length+ +!!S,agentDefinitions:s,pluginCommands:r}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),s(),m(),S(),w(),T(),v(),r(),f(),y(),p(),u(),c()}));export{D as n,A as t};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{o as n}from"./envUtils-DSxRz_kt.js";import{B as r,U as i,l as a,p as o}from"./debug-DiuXEmUq.js";import{g as s,n as c}from"./settings-BhvhCpVh.js";import{r as l,t as u}from"./execFileNoThrow-DResQRvR.js";import{n as d,t as f}from"./which-sEFQXpaX.js";import{a as p,r as m,t as h}from"./xdg-DcF9ejUM.js";import{n as g,t as _}from"./sanitization-DV-94a9Z.js";import*as v from"os";import*as y from"path";import{promises as b}from"fs";function x(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function S(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${C}:`,`${C}://`):null;if(!t)throw Error(`Invalid deep link: expected ${C}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&x(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>E)throw Error(`Deep link cwd exceeds ${E} characters (got ${r.length})`);if(i&&!w.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=g(a.trim()),x(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>T)throw Error(`Deep link query exceeds ${T} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}var C,w,T,E,D=e((()=>{_(),C=`claude-cli`,w=/^[\w.-]+\/[\w.-]+$/,T=5e3,E=4096})),O=t({MACOS_BUNDLE_ID:()=>z,ensureDeepLinkProtocolRegistered:()=>R,isProtocolHandlerCurrent:()=>L,registerProtocolHandler:()=>F});function k(){return y.join(m(),`applications`,V)}function A(e){return`Exec="${e}" --handle-uri %u`}function j(e){return`"${e}" --handle-uri "%1"`}async function M(e){let t=y.join(H,`Contents`);try{await b.rm(H,{recursive:!0})}catch(e){if(r(e)!==`ENOENT`)throw e}await b.mkdir(y.dirname(U),{recursive:!0});let n=`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{o as n}from"./envUtils-DSxRz_kt.js";import{I as r,a as i,l as a,z as o}from"./debug-BrXObCdR.js";import{g as s,n as c}from"./settings-DfWP5y6X.js";import{r as l,t as u}from"./execFileNoThrow-D244NytW.js";import{n as d,t as f}from"./which-CKQnSouy.js";import{a as p,r as m,t as h}from"./xdg-DcF9ejUM.js";import{n as g,t as _}from"./sanitization-DV-94a9Z.js";import*as v from"os";import*as y from"path";import{promises as b}from"fs";function x(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function S(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${C}:`,`${C}://`):null;if(!t)throw Error(`Invalid deep link: expected ${C}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&x(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>E)throw Error(`Deep link cwd exceeds ${E} characters (got ${r.length})`);if(i&&!w.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=g(a.trim()),x(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>T)throw Error(`Deep link query exceeds ${T} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}var C,w,T,E,D=e((()=>{_(),C=`claude-cli`,w=/^[\w.-]+\/[\w.-]+$/,T=5e3,E=4096})),O=t({MACOS_BUNDLE_ID:()=>z,ensureDeepLinkProtocolRegistered:()=>R,isProtocolHandlerCurrent:()=>L,registerProtocolHandler:()=>F});function k(){return y.join(m(),`applications`,V)}function A(e){return`Exec="${e}" --handle-uri %u`}function j(e){return`"${e}" --handle-uri "%1"`}async function M(e){let t=y.join(H,`Contents`);try{await b.rm(H,{recursive:!0})}catch(e){if(r(e)!==`ENOENT`)throw e}await b.mkdir(y.dirname(U),{recursive:!0});let n=`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
@@ -26,11 +26,11 @@ import{n as e,r as t}from"./rolldown-runtime-DaDcL9Zw.js";import{o as n}from"./e
26
26
  </dict>
27
27
  </array>
28
28
  </dict>
29
- </plist>`;await b.writeFile(y.join(t,`Info.plist`),n),await b.symlink(e,U),await u(`/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister`,[`-R`,H],{useCwd:!1}),o(`Registered ${C}:// protocol handler at ${H}`)}async function N(e){await b.mkdir(y.dirname(k()),{recursive:!0});let t=`[Desktop Entry]
29
+ </plist>`;await b.writeFile(y.join(t,`Info.plist`),n),await b.symlink(e,U),await u(`/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister`,[`-R`,H],{useCwd:!1}),a(`Registered ${C}:// protocol handler at ${H}`)}async function N(e){await b.mkdir(y.dirname(k()),{recursive:!0});let t=`[Desktop Entry]
30
30
  Name=${B}
31
31
  Comment=Handle ${C}:// deep links for Work Mate
32
32
  ${A(e)}
33
33
  Type=Application
34
34
  NoDisplay=true
35
35
  MimeType=x-scheme-handler/${C};
36
- `;await b.writeFile(k(),t);let n=await d(`xdg-mime`);if(n){let{code:e}=await u(n,[`default`,V,`x-scheme-handler/${C}`],{useCwd:!1});if(e!==0)throw Object.assign(Error(`xdg-mime exited with code ${e}`),{code:`XDG_MIME_FAILED`})}o(`Registered ${C}:// protocol handler at ${k()}`)}async function P(e){for(let t of[[`add`,W,`/ve`,`/d`,`URL:${B}`,`/f`],[`add`,W,`/v`,`URL Protocol`,`/d`,``,`/f`],[`add`,G,`/ve`,`/d`,j(e),`/f`]]){let{code:e}=await u(`reg`,t,{useCwd:!1});if(e!==0)throw Object.assign(Error(`reg add exited with code ${e}`),{code:`REG_FAILED`})}o(`Registered ${C}:// protocol handler in Windows registry`)}async function F(e){let t=e??await I();switch(process.platform){case`darwin`:await M(t);break;case`linux`:await N(t);break;case`win32`:await P(t);break;default:throw Error(`Unsupported platform: ${process.platform}`)}}async function I(){let e=process.platform===`win32`?`claude.exe`:`claude`,t=y.join(h(),e);try{return await b.realpath(t),t}catch{return process.execPath}}async function L(e){try{switch(process.platform){case`darwin`:return await b.readlink(U)===e;case`linux`:return(await b.readFile(k(),`utf8`)).includes(A(e));case`win32`:{let{stdout:t,code:n}=await u(`reg`,[`query`,G,`/ve`],{useCwd:!1});return n===0&&t.includes(j(e))}default:return!1}}catch{return!1}}async function R(){c().disableDeepLinkRegistration}var z,B,V,H,U,W,G,K=e((()=>{D(),a(),n(),i(),l(),s(),f(),p(),z=`com.anthropic.claude-code-url-handler`,B=`Claude Code URL Handler`,V=`claude-code-url-handler.desktop`,H=y.join(v.homedir(),`Applications`,`Claude Code URL Handler.app`),U=y.join(H,`Contents`,`MacOS`,`claude`),W=`HKEY_CURRENT_USER\\Software\\Classes\\${C}`,G=`${W}\\shell\\open\\command`}));export{S as a,D as i,K as n,O as r,z as t};
36
+ `;await b.writeFile(k(),t);let n=await d(`xdg-mime`);if(n){let{code:e}=await u(n,[`default`,V,`x-scheme-handler/${C}`],{useCwd:!1});if(e!==0)throw Object.assign(Error(`xdg-mime exited with code ${e}`),{code:`XDG_MIME_FAILED`})}a(`Registered ${C}:// protocol handler at ${k()}`)}async function P(e){for(let t of[[`add`,W,`/ve`,`/d`,`URL:${B}`,`/f`],[`add`,W,`/v`,`URL Protocol`,`/d`,``,`/f`],[`add`,G,`/ve`,`/d`,j(e),`/f`]]){let{code:e}=await u(`reg`,t,{useCwd:!1});if(e!==0)throw Object.assign(Error(`reg add exited with code ${e}`),{code:`REG_FAILED`})}a(`Registered ${C}:// protocol handler in Windows registry`)}async function F(e){let t=e??await I();switch(process.platform){case`darwin`:await M(t);break;case`linux`:await N(t);break;case`win32`:await P(t);break;default:throw Error(`Unsupported platform: ${process.platform}`)}}async function I(){let e=process.platform===`win32`?`claude.exe`:`claude`,t=y.join(h(),e);try{return await b.realpath(t),t}catch{return process.execPath}}async function L(e){try{switch(process.platform){case`darwin`:return await b.readlink(U)===e;case`linux`:return(await b.readFile(k(),`utf8`)).includes(A(e));case`win32`:{let{stdout:t,code:n}=await u(`reg`,[`query`,G,`/ve`],{useCwd:!1});return n===0&&t.includes(j(e))}default:return!1}}catch{return!1}}async function R(){c().disableDeepLinkRegistration}var z,B,V,H,U,W,G,K=e((()=>{D(),i(),n(),o(),l(),s(),f(),p(),z=`com.anthropic.claude-code-url-handler`,B=`Claude Code URL Handler`,V=`claude-code-url-handler.desktop`,H=y.join(v.homedir(),`Applications`,`Claude Code URL Handler.app`),U=y.join(H,`Contents`,`MacOS`,`claude`),W=`HKEY_CURRENT_USER\\Software\\Classes\\${C}`,G=`${W}\\shell\\open\\command`}));export{S as a,D as i,K as n,O as r,z as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,c as n,i as r,o as i,t as a}from"./releaseNotes-Di6OaHF7.js";function o(e){return e.map(([e,t])=>`${`Version ${e}:`}\n${t.map(e=>`· ${e}`).join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{a as t,c as n,i as r,o as i,t as a}from"./releaseNotes-CDx2P0fb.js";function o(e){return e.map(([e,t])=>`${`Version ${e}:`}\n${t.map(e=>`· ${e}`).join(`
2
2
  `)}`).join(`
3
3
 
4
4
  `)}async function s(){let e=[];try{let n=new Promise((e,t)=>{setTimeout(e=>e(Error(`Timeout`)),500,t)});await Promise.race([r(),n]),e=t(await i())}catch{}if(e.length>0)return{type:`text`,value:o(e)};let n=t(await i());return n.length>0?{type:`text`,value:o(n)}:{type:`text`,value:`See the full changelog at: ${a}`}}e((()=>{n()}))();export{s as call};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{t as r}from"./semver-DQo45qGo.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{en as o,z as s}from"./state-ix0xIunV.js";import{J as c,U as l}from"./debug-DiuXEmUq.js";import{b as u,c as d,g as f}from"./config-662VDD70.js";import{d as p,f as m,o as h,s as g}from"./log-Duzb4o6h.js";import{r as _,t as v}from"./semver-BMRJYn3q.js";import{dirname as y,join as b}from"path";import{mkdir as x,readFile as S,writeFile as C}from"fs/promises";function w(){return b(t(),`cache`,`changelog.md`)}async function T(){let e=d();if(!e.cachedChangelog)return;let t=w();try{await x(y(t),{recursive:!0}),await C(t,e.cachedChangelog,{encoding:`utf-8`,flag:`wx`})}catch{}u(({cachedChangelog:e,...t})=>t)}async function E(){if(s()||m())return;let e=await i.get(L);if(e.status===200){let t=e.data;if(t===R)return;let n=w();await x(y(n),{recursive:!0}),await C(n,t,{encoding:`utf-8`}),R=t;let r=Date.now();u(e=>({...e,changelogLastFetched:r}))}}async function D(){if(R!==null)return R;let e=w();try{let t=await S(e,`utf-8`);return R=t,t}catch{return R=``,``}}function O(){return R??``}function k(e){try{if(!e)return{};let t={},n=e.split(/^## /gm).slice(1);for(let e of n){let n=e.trim().split(`
2
- `);if(n.length===0)continue;let r=n[0];if(!r)continue;let i=r.split(` - `)[0]?.trim()||``;if(!i)continue;let a=n.slice(1).filter(e=>e.trim().startsWith(`- `)).map(e=>e.trim().substring(2).trim()).filter(Boolean);a.length>0&&(t[i]=a)}return t}catch(e){return g(c(e)),{}}}function A(e,t,n=O()){try{let r=k(n),i=(0,P.coerce)(e),a=t?(0,P.coerce)(t):null;if(!a||i&&v(i.version,a.version))return Object.entries(r).filter(([e])=>!a||v(e,a.version)).sort(([e],[t])=>v(e,t)?-1:1).flatMap(([e,t])=>t).filter(Boolean).slice(0,F)}catch(e){return g(c(e)),[]}return[]}function j(e=O()){try{let t=k(e);return Object.keys(t).sort((e,t)=>v(e,t)?1:-1).map(e=>{let n=t[e];if(!n||n.length===0)return null;let r=n.filter(Boolean);return r.length===0?null:[e,r]}).filter(e=>e!==null)}catch(e){return g(c(e)),[]}}async function M(e,t=`0.0.2`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=await D();(e!==t||!n)&&E().catch(e=>g(c(e)));let r=A(t,e,n);return{hasReleaseNotes:r.length>0,releaseNotes:r}}function N(e,t=`0.0.2`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=A(t,e);return{hasReleaseNotes:n.length>0,releaseNotes:n}}var P,F,I,L,R,z=e((()=>{a(),P=r(),o(),f(),n(),l(),h(),p(),_(),F=5,I=`https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md`,L=`https://raw.githubusercontent.com/anthropics/claude-code/refs/heads/main/CHANGELOG.md`,R=null}));export{j as a,z as c,E as i,T as l,M as n,D as o,N as r,O as s,I as t,k as u};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{t as r}from"./semver-DQo45qGo.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{en as o,z as s}from"./state-ix0xIunV.js";import{W as c,z as l}from"./debug-BrXObCdR.js";import{b as u,c as d,g as f}from"./config-DiT2Z8dY.js";import{d as p,f as m,o as h,s as g}from"./log-BMCygSzM.js";import{r as _,t as v}from"./semver-BMRJYn3q.js";import{dirname as y,join as b}from"path";import{mkdir as x,readFile as S,writeFile as C}from"fs/promises";function w(){return b(t(),`cache`,`changelog.md`)}async function T(){let e=d();if(!e.cachedChangelog)return;let t=w();try{await x(y(t),{recursive:!0}),await C(t,e.cachedChangelog,{encoding:`utf-8`,flag:`wx`})}catch{}u(({cachedChangelog:e,...t})=>t)}async function E(){if(s()||m())return;let e=await i.get(L);if(e.status===200){let t=e.data;if(t===R)return;let n=w();await x(y(n),{recursive:!0}),await C(n,t,{encoding:`utf-8`}),R=t;let r=Date.now();u(e=>({...e,changelogLastFetched:r}))}}async function D(){if(R!==null)return R;let e=w();try{let t=await S(e,`utf-8`);return R=t,t}catch{return R=``,``}}function O(){return R??``}function k(e){try{if(!e)return{};let t={},n=e.split(/^## /gm).slice(1);for(let e of n){let n=e.trim().split(`
2
+ `);if(n.length===0)continue;let r=n[0];if(!r)continue;let i=r.split(` - `)[0]?.trim()||``;if(!i)continue;let a=n.slice(1).filter(e=>e.trim().startsWith(`- `)).map(e=>e.trim().substring(2).trim()).filter(Boolean);a.length>0&&(t[i]=a)}return t}catch(e){return g(c(e)),{}}}function A(e,t,n=O()){try{let r=k(n),i=(0,P.coerce)(e),a=t?(0,P.coerce)(t):null;if(!a||i&&v(i.version,a.version))return Object.entries(r).filter(([e])=>!a||v(e,a.version)).sort(([e],[t])=>v(e,t)?-1:1).flatMap(([e,t])=>t).filter(Boolean).slice(0,F)}catch(e){return g(c(e)),[]}return[]}function j(e=O()){try{let t=k(e);return Object.keys(t).sort((e,t)=>v(e,t)?1:-1).map(e=>{let n=t[e];if(!n||n.length===0)return null;let r=n.filter(Boolean);return r.length===0?null:[e,r]}).filter(e=>e!==null)}catch(e){return g(c(e)),[]}}async function M(e,t=`0.0.3`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=await D();(e!==t||!n)&&E().catch(e=>g(c(e)));let r=A(t,e,n);return{hasReleaseNotes:r.length>0,releaseNotes:r}}function N(e,t=`0.0.3`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=A(t,e);return{hasReleaseNotes:n.length>0,releaseNotes:n}}var P,F,I,L,R,z=e((()=>{a(),P=r(),o(),f(),n(),l(),h(),p(),_(),F=5,I=`https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md`,L=`https://raw.githubusercontent.com/anthropics/claude-code/refs/heads/main/CHANGELOG.md`,R=null}));export{j as a,z as c,E as i,T as l,M as n,D as o,N as r,O as s,I as t,k as u};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{o as t}from"./envUtils-DSxRz_kt.js";import{en as n}from"./state-ix0xIunV.js";import{BE as r}from"./loadAgentsDir-ZQwvbURI.js";import{l as i,o as a}from"./stringUtils-D_g2L6A4.js";import{t as o}from"./settingsSync-D2B5K4BT.js";import{n as s,t as c}from"./refresh-vJbxW4a1.js";function l(e,t){return`${e} ${i(e,t)}`}var u;e((()=>{n(),o(),t(),c(),r(),a(),u=async(e,t)=>{let n=await s(t.setAppState),r=`Reloaded: ${[l(n.enabled_count,`plugin`),l(n.command_count,`skill`),l(n.agent_count,`agent`),l(n.hook_count,`hook`),l(n.mcp_count,`plugin MCP server`),l(n.lsp_count,`plugin LSP server`)].join(` · `)}`;return n.error_count>0&&(r+=`\n${l(n.error_count,`error`)} during load. Run /doctor for details.`),{type:`text`,value:r}}}))();export{u as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{o as t}from"./envUtils-DSxRz_kt.js";import{en as n}from"./state-ix0xIunV.js";import{wD as r}from"./loadAgentsDir-DrDu5yYy.js";import{l as i,o as a}from"./stringUtils-DGLPkqJ4.js";import{t as o}from"./settingsSync-BlDk6rsM.js";import{n as s,t as c}from"./refresh-pFezssA8.js";function l(e,t){return`${e} ${i(e,t)}`}var u;e((()=>{n(),o(),t(),c(),r(),a(),u=async(e,t)=>{let n=await s(t.setAppState),r=`Reloaded: ${[l(n.enabled_count,`plugin`),l(n.command_count,`skill`),l(n.agent_count,`agent`),l(n.hook_count,`hook`),l(n.mcp_count,`plugin MCP server`),l(n.lsp_count,`plugin LSP server`)].join(` · `)}`;return n.error_count>0&&(r+=`\n${l(n.error_count,`error`)} during load. Run /doctor for details.`),{type:`text`,value:r}}}))();export{u as call};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,P as a,T as o,Wt as s,di as c,fi as l,p as u,t as d,ui as f,y as p}from"./src-CDCSSo0U2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{FS as h,Hb as g,Nb as _,PS as v,Pb as y,Vb as b}from"./loadAgentsDir-ZQwvbURI.js";import{J as x,U as S}from"./debug-DiuXEmUq.js";import{c as C,dn as w,f as T,g as E,in as D,ln as O,y as k}from"./settings-BhvhCpVh.js";import{o as A,s as j}from"./log-Duzb4o6h.js";import{u as M}from"./referral-Cu9bEOFE.js";async function N(){let e=await v();if(e.length===0)return{availableEnvironments:[],selectedEnvironment:null,selectedEnvironmentSource:null};let t=T()?.remote?.defaultEnvironmentId,n=e.find(e=>e.kind!==`bridge`)??e[0],r=null;if(t){let i=e.find(e=>e.environment_id===t);if(i){n=i;for(let e=D.length-1;e>=0;e--){let n=D[e];if(!(!n||n===`flagSettings`)&&C(n)?.remote?.defaultEnvironmentId===t){r=n;break}}}}return{availableEnvironments:e,selectedEnvironment:n,selectedEnvironmentSource:r}}var P=e((()=>{w(),E(),h()}));function F({onDone:e}){let[t,n]=(0,z.useState)(`loading`),[r,i]=(0,z.useState)([]),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[d,m]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;async function t(){try{let t=await N();if(e)return;i(t.availableEnvironments),s(t.selectedEnvironment),l(t.selectedEnvironmentSource),n(null)}catch(t){if(e)return;let r=x(t);j(r),m(r.message),n(null)}}return t(),()=>{e=!0}},[]);function h(t){if(t===`cancel`){e();return}n(`updating`);let i=r.find(e=>e.environment_id===t);if(!i){e(`Error: Selected environment not found`);return}k(`localSettings`,{remote:{defaultEnvironmentId:i.environment_id}}),e(`Set default remote environment to ${f.bold(i.name)} (${i.environment_id})`)}return t===`loading`?(0,B.jsx)(p,{title:V,onCancel:e,hideInputGuide:!0,children:(0,B.jsx)(u,{message:`Loading environments…`})}):d?(0,B.jsx)(p,{title:V,onCancel:e,children:(0,B.jsxs)(a,{color:`error`,children:[`Error: `,d]})}):o?r.length===1?(0,B.jsx)(L,{environment:o,onDone:e}):(0,B.jsx)(R,{environments:r,selectedEnvironment:o,selectedEnvironmentSource:c,loadingState:t,onSelect:h,onCancel:e}):(0,B.jsx)(p,{title:V,subtitle:H,onCancel:e,children:(0,B.jsx)(a,{children:`No remote environments available.`})})}function I({environment:e}){return(0,B.jsxs)(a,{children:[r.tick,` Using `,(0,B.jsx)(a,{bold:!0,children:e.name}),` `,(0,B.jsxs)(a,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]})}function L({environment:e,onDone:t}){return s(`confirm:yes`,t,{context:`Confirmation`}),(0,B.jsx)(p,{title:V,subtitle:H,onCancel:t,children:(0,B.jsx)(I,{environment:e})})}function R({environments:e,selectedEnvironment:t,selectedEnvironmentSource:n,loadingState:r,onSelect:s,onCancel:c}){let l=n&&n!==`localSettings`?` (from ${O(n)} settings)`:``,d=(0,B.jsxs)(a,{children:[`Currently using: `,(0,B.jsx)(a,{bold:!0,children:t.name}),l]});return(0,B.jsxs)(p,{title:V,subtitle:d,onCancel:c,hideInputGuide:!0,children:[(0,B.jsx)(a,{dimColor:!0,children:H}),r===`updating`?(0,B.jsx)(u,{message:`Updating…`}):(0,B.jsx)(_,{options:e.map(e=>({label:(0,B.jsxs)(a,{children:[e.name,` `,(0,B.jsxs)(a,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]}),value:e.environment_id})),defaultValue:t.environment_id,onChange:s,onCancel:()=>s(`cancel`),layout:`compact-vertical`}),(0,B.jsx)(a,{dimColor:!0,children:(0,B.jsxs)(o,{children:[(0,B.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,B.jsx)(b,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})}var z,B,V,H,U=e((()=>{c(),n(),l(),z=t(l(),1),d(),M(),S(),A(),w(),E(),P(),g(),y(),B=m(),V=`Select Remote Environment`,H=`Configure environments at: https://claude.ai/code`}));async function W(e){return(0,G.jsx)(F,{onDone:e})}var G;e((()=>{l(),U(),G=m()}))();export{W as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{D as i,P as a,T as o,Wt as s,di as c,fi as l,p as u,t as d,ui as f,y as p}from"./src-CDCSSo0U2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{Ex as h,Tx as g,_x as _,vC as v,vx as y,yC as b}from"./loadAgentsDir-DrDu5yYy.js";import{W as x,z as S}from"./debug-BrXObCdR.js";import{c as C,dn as w,f as T,g as E,in as D,ln as O,y as k}from"./settings-DfWP5y6X.js";import{o as A,s as j}from"./log-BMCygSzM.js";import{u as M}from"./referral-DrebVwqx.js";async function N(){let e=await v();if(e.length===0)return{availableEnvironments:[],selectedEnvironment:null,selectedEnvironmentSource:null};let t=T()?.remote?.defaultEnvironmentId,n=e.find(e=>e.kind!==`bridge`)??e[0],r=null;if(t){let i=e.find(e=>e.environment_id===t);if(i){n=i;for(let e=D.length-1;e>=0;e--){let n=D[e];if(!(!n||n===`flagSettings`)&&C(n)?.remote?.defaultEnvironmentId===t){r=n;break}}}}return{availableEnvironments:e,selectedEnvironment:n,selectedEnvironmentSource:r}}var P=e((()=>{w(),E(),b()}));function F({onDone:e}){let[t,n]=(0,z.useState)(`loading`),[r,i]=(0,z.useState)([]),[o,s]=(0,z.useState)(null),[c,l]=(0,z.useState)(null),[d,m]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;async function t(){try{let t=await N();if(e)return;i(t.availableEnvironments),s(t.selectedEnvironment),l(t.selectedEnvironmentSource),n(null)}catch(t){if(e)return;let r=x(t);j(r),m(r.message),n(null)}}return t(),()=>{e=!0}},[]);function h(t){if(t===`cancel`){e();return}n(`updating`);let i=r.find(e=>e.environment_id===t);if(!i){e(`Error: Selected environment not found`);return}k(`localSettings`,{remote:{defaultEnvironmentId:i.environment_id}}),e(`Set default remote environment to ${f.bold(i.name)} (${i.environment_id})`)}return t===`loading`?(0,B.jsx)(p,{title:V,onCancel:e,hideInputGuide:!0,children:(0,B.jsx)(u,{message:`Loading environments…`})}):d?(0,B.jsx)(p,{title:V,onCancel:e,children:(0,B.jsxs)(a,{color:`error`,children:[`Error: `,d]})}):o?r.length===1?(0,B.jsx)(L,{environment:o,onDone:e}):(0,B.jsx)(R,{environments:r,selectedEnvironment:o,selectedEnvironmentSource:c,loadingState:t,onSelect:h,onCancel:e}):(0,B.jsx)(p,{title:V,subtitle:H,onCancel:e,children:(0,B.jsx)(a,{children:`No remote environments available.`})})}function I({environment:e}){return(0,B.jsxs)(a,{children:[r.tick,` Using `,(0,B.jsx)(a,{bold:!0,children:e.name}),` `,(0,B.jsxs)(a,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]})}function L({environment:e,onDone:t}){return s(`confirm:yes`,t,{context:`Confirmation`}),(0,B.jsx)(p,{title:V,subtitle:H,onCancel:t,children:(0,B.jsx)(I,{environment:e})})}function R({environments:e,selectedEnvironment:t,selectedEnvironmentSource:n,loadingState:r,onSelect:s,onCancel:c}){let l=n&&n!==`localSettings`?` (from ${O(n)} settings)`:``,d=(0,B.jsxs)(a,{children:[`Currently using: `,(0,B.jsx)(a,{bold:!0,children:t.name}),l]});return(0,B.jsxs)(p,{title:V,subtitle:d,onCancel:c,hideInputGuide:!0,children:[(0,B.jsx)(a,{dimColor:!0,children:H}),r===`updating`?(0,B.jsx)(u,{message:`Updating…`}):(0,B.jsx)(_,{options:e.map(e=>({label:(0,B.jsxs)(a,{children:[e.name,` `,(0,B.jsxs)(a,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]}),value:e.environment_id})),defaultValue:t.environment_id,onChange:s,onCancel:()=>s(`cancel`),layout:`compact-vertical`}),(0,B.jsx)(a,{dimColor:!0,children:(0,B.jsxs)(o,{children:[(0,B.jsx)(i,{shortcut:`Enter`,action:`select`}),(0,B.jsx)(g,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})}var z,B,V,H,U=e((()=>{c(),n(),l(),z=t(l(),1),d(),M(),S(),A(),w(),E(),P(),h(),y(),B=m(),V=`Select Remote Environment`,H=`Configure environments at: https://claude.ai/code`}));async function W(e){return(0,G.jsx)(F,{onDone:e})}var G;e((()=>{l(),U(),G=m()}))();export{W as call};
@@ -0,0 +1 @@
1
+ import{o as e,u as t}from"./envUtils-DSxRz_kt.js";import{n,t as r}from"./axios-DaWTGg7G.js";import{F as i,S as a,a as o,l as s,nt as c,rt as l,w as u,z as d}from"./debug-BrXObCdR.js";import{M as f,j as p}from"./git-Do0wJvux.js";import{n as m,r as h}from"./analytics-BotDBGh0.js";import{vn as g,yn as _}from"./model-fi472PRc.js";import{_ as ee,d as v}from"./rcDebugLog-2-1XSyFV.js";import{c as y,d as b,i as x,o as S,s as C}from"./debugUtils-NO5KtXqi.js";import{a as w,r as T}from"./bridgeConfig-DbqUHe0H.js";import{t as te}from"./jwtUtils-DE2GPUcx.js";import{i as E}from"./trustedDevice-DvpN4J1F.js";import{t as D}from"./workSecret-CNWiR2uQ.js";import{i as O,r as ne}from"./envLessBridgeConfig-BFjJ8Kt4.js";import{a as k,c as A,i as re,n as ie,o as j,r as ae,s as oe,t as M}from"./bridgeMessaging-lfa_v3oi.js";import{r as N,t as se}from"./flushGate-CJ73xcaK.js";e(),c(),p(),m(),g(),y(),v(),O(),r(),o(),d(),a(),S();var P=`2023-06-01`;function F(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":P}}async function ce(e,t,r,a,o){let c=`${e}/v1/code/sessions`,l;try{l=await n.post(c,{title:r,bridge:{},...o?.length?{tags:o}:{}},{headers:F(t),timeout:a,validateStatus:e=>e<500})}catch(e){return s(`[code-session] Session create request failed: ${i(e)}`),null}if(l.status!==200&&l.status!==201){let e=x(l.data);return s(`[code-session] Session create failed ${l.status}${e?`: ${e}`:``}`),null}let d=l.data;return!d||typeof d!=`object`||!(`session`in d)||!d.session||typeof d.session!=`object`||!(`id`in d.session)||typeof d.session.id!=`string`||!d.session.id.startsWith(`cse_`)?(s(`[code-session] No session.id (cse_*) in response: ${u(d).slice(0,200)}`),null):d.session.id}async function I(e,t,r,a,o){let c=`${t}/v1/code/sessions/${e}/bridge`,l=F(r);o&&(l[`X-Trusted-Device-Token`]=o);let d;try{d=await n.post(c,{},{headers:l,timeout:a,validateStatus:e=>e<500})}catch(e){return s(`[code-session] /bridge request failed: ${i(e)}`),null}if(d.status!==200){let e=x(d.data);return s(`[code-session] /bridge failed ${d.status}${e?`: ${e}`:``}`),null}let f=d.data;if(typeof f!=`object`||!f||!(`worker_jwt`in f)||typeof f.worker_jwt!=`string`||!(`expires_in`in f)||typeof f.expires_in!=`number`||!(`api_base_url`in f)||typeof f.api_base_url!=`string`||!(`worker_epoch`in f))return s(`[code-session] /bridge response malformed (need worker_jwt, expires_in, api_base_url, worker_epoch): ${u(f).slice(0,200)}`),null;let p=f.worker_epoch,m=typeof p==`string`?Number(p):p;return typeof m!=`number`||!Number.isFinite(m)||!Number.isSafeInteger(m)?(s(`[code-session] /bridge worker_epoch invalid: ${u(p)}`),null):{worker_jwt:f.worker_jwt,api_base_url:f.api_base_url,expires_in:f.expires_in,worker_epoch:m}}r(),S(),o(),d(),w();var L=`2023-06-01`;function R(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":L}}async function z(e){let{baseUrl:n,orgUUID:r,title:a,getAccessToken:o,onAuth401:c,toSDKMessages:u,initialHistoryCap:d,initialMessages:p,onInboundMessage:m,onUserMessage:g,onPermissionResponse:_,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,onStateChange:S,outboundOnly:w,tags:T}=e,E=await ne(),O=o();if(!O)return s(`[remote-bridge] No OAuth token`),null;let P=await B(()=>ce(n,O,a,E.http_timeout_ms,T),`createCodeSession`,E);if(!P)return S?.(`failed`,`Session creation failed — see debug log`),C(`v2_session_create_failed`,void 0,!0),null;let F=P;s(`[remote-bridge] Created session ${F}`),f(`info`,`bridge_repl_v2_session_created`);let I=await B(()=>V(F,n,O,E.http_timeout_ms),`fetchRemoteCredentials`,E);if(!I)return S?.(`failed`,`Remote credentials fetch failed — see debug log`),C(`v2_remote_creds_failed`,void 0,!0),H(F,n,O,r,E.http_timeout_ms),null;s(`[remote-bridge] Fetched bridge credentials (expires_in=${I.expires_in}s)`);let L=D(I.api_base_url,F);s(`[remote-bridge] v2 session URL: ${L}`);let R;try{R=await N({sessionUrl:L,ingressToken:I.worker_jwt,sessionId:F,epoch:I.worker_epoch,heartbeatIntervalMs:E.heartbeat_interval_ms,heartbeatJitterFraction:E.heartbeat_jitter_fraction,getAuthToken:()=>I.worker_jwt,outboundOnly:w})}catch(e){return s(`[remote-bridge] v2 transport setup failed: ${i(e)}`,{level:`error`}),S?.(`failed`,`Transport setup failed: ${i(e)}`),C(`v2_transport_setup_failed`,void 0,!0),H(F,n,O,r,E.http_timeout_ms),null}s(`[remote-bridge] v2 transport created (epoch=${I.worker_epoch})`),S?.(`ready`);let z=new M(E.uuid_dedup_buffer_size),U=new Set;if(p)for(let e of p)U.add(e.uuid),z.add(e.uuid);let le=new M(E.uuid_dedup_buffer_size),W=new se,G=!1,K=!1,q=!1,J=!g,Y=`initial`,X;function Z(e){K||h(`tengu_bridge_repl_connect_timeout`,{v2:!0,elapsed_ms:E.connect_timeout_ms,cause:e})}ee(e=>{K||R.reportMetadata(e)},{replayCurrent:!0});let Q=te({refreshBufferMs:E.token_refresh_buffer_ms,getAccessToken:async()=>{let e=o();return c&&await c(e??``),o()??e},onRefresh:(e,t)=>{(async()=>{if(q||K){s(`[remote-bridge] Recovery already in flight, skipping proactive refresh`);return}q=!0;try{let r=await B(()=>V(e,n,t,E.http_timeout_ms),`fetchRemoteCredentials (proactive)`,E);if(!r||K)return;await ue(r,`proactive_refresh`),s(`[remote-bridge] Transport rebuilt (proactive refresh)`)}catch(e){s(`[remote-bridge] Proactive refresh rebuild failed: ${i(e)}`,{level:`error`}),f(`error`,`bridge_repl_v2_proactive_refresh_failed`),K||S?.(`failed`,`Refresh failed: ${i(e)}`)}finally{q=!1}})()},label:`remote`});Q.scheduleFromExpiresIn(F,I.expires_in);function $(){R.setOnConnect(()=>{if(clearTimeout(X),s(`[remote-bridge] v2 transport connected`),f(`info`,`bridge_repl_v2_transport_connected`),h(`tengu_bridge_repl_ws_connected`,{v2:!0,cause:Y}),!G&&p&&p.length>0){G=!0;let e=R;pe(p).catch(e=>s(`[remote-bridge] flushHistory failed: ${e}`)).finally(()=>{R!==e||K||q||(fe(),S?.(`connected`))})}else W.active||S?.(`connected`)}),R.setOnData(e=>{ae(e,z,le,m,_?e=>{R.reportState(`running`),_(e)}:void 0,e=>re(e,{transport:R,sessionId:F,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,outboundOnly:w}))}),R.setOnClose(e=>{if(clearTimeout(X),!K){if(s(`[remote-bridge] v2 transport closed (code=${e})`),h(`tengu_bridge_repl_ws_closed`,{code:e,v2:!0}),e===401&&!q){de();return}S?.(`failed`,`Transport closed (code ${e})`)}})}async function ue(e,t){Y=t,W.start();try{let t=R.getLastSequenceNum();if(R.close(),R=await N({sessionUrl:D(e.api_base_url,F),ingressToken:e.worker_jwt,sessionId:F,epoch:e.worker_epoch,heartbeatIntervalMs:E.heartbeat_interval_ms,heartbeatJitterFraction:E.heartbeat_jitter_fraction,initialSequenceNum:t,getAuthToken:()=>e.worker_jwt,outboundOnly:w}),K){R.close();return}$(),R.connect(),X=setTimeout(Z,E.connect_timeout_ms,Y),Q.scheduleFromExpiresIn(F,e.expires_in),fe()}finally{W.drop()}}async function de(){if(!q){q=!0,S?.(`reconnecting`,`JWT expired — refreshing`),s(`[remote-bridge] 401 on SSE — attempting JWT refresh`);try{let e=o();c&&await c(e??``);let t=o()??e;if(!t||K){K||S?.(`failed`,`JWT refresh failed: no OAuth token`);return}let r=await B(()=>V(F,n,t,E.http_timeout_ms),`fetchRemoteCredentials (recovery)`,E);if(!r||K){K||S?.(`failed`,`JWT refresh failed after 401`);return}G=!1,await ue(r,`auth_401_recovery`),s(`[remote-bridge] Transport rebuilt after 401`)}catch(e){s(`[remote-bridge] 401 recovery failed: ${i(e)}`,{level:`error`}),f(`error`,`bridge_repl_v2_jwt_refresh_failed`),K||S?.(`failed`,`JWT refresh failed: ${i(e)}`)}finally{q=!1}}}$(),p&&p.length>0&&W.start(),R.connect(),X=setTimeout(Z,E.connect_timeout_ms,Y);function fe(){let e=W.end();if(e.length===0)return;for(let t of e)z.add(t.uuid);let t=u(e).map(e=>({...e,session_id:F}));A(e)&&R.reportState(`running`),s(`[remote-bridge] Drained ${e.length} queued message(s) after flush`),R.writeBatch(t)}async function pe(e){let t=e.filter(k),n=d>0&&t.length>d?t.slice(-d):t;n.length<t.length&&s(`[remote-bridge] Capped initial flush: ${t.length} -> ${n.length} (cap=${d})`);let r=u(n).map(e=>({...e,session_id:F}));if(r.length===0)return;let i=t.at(-1);i&&oe(i)&&R.reportState(`running`),s(`[remote-bridge] Flushing ${r.length} history events`),await R.writeBatch(r)}async function me(){if(K)return;K=!0,Q.cancelAll(),clearTimeout(X),W.drop(),R.reportState(`idle`);let e={...j(F),session_id:F};R.write(e);let t=o(),a=await H(F,n,t,r,E.teardown_archive_timeout_ms);if(a===401&&c)try{await c(t??``),t=o(),a=await H(F,n,t,r,E.teardown_archive_timeout_ms)}catch(e){s(`[remote-bridge] Teardown 401 retry threw: ${i(e)}`,{level:`error`})}R.close();let l=a===`no_token`?`skipped_no_token`:a===`timeout`||a===`error`?`network_error`:a>=500?`server_5xx`:a>=400?`server_4xx`:`ok`;s(`[remote-bridge] Torn down (archive=${a})`),f(`info`,`bridge_repl_v2_teardown`),h(`tengu_bridge_repl_teardown`,{v2:!0,archive_status:l,archive_ok:typeof a==`number`&&a<400,archive_http_status:typeof a==`number`?a:void 0,archive_timeout:a===`timeout`,archive_no_token:a===`no_token`})}let he=l(me);return h(`tengu_bridge_repl_started`,{has_initial_messages:!!(p&&p.length>0),v2:!0,expires_in_s:I.expires_in,inProtectedNamespace:t()}),{bridgeSessionId:F,environmentId:``,sessionIngressUrl:I.api_base_url,writeMessages(e){let t=e.filter(e=>k(e)&&!U.has(e.uuid)&&!z.has(e.uuid));if(t.length===0)return;if(!J)for(let e of t){let t=ie(e);if(t!==void 0&&g?.(t,F)){J=!0;break}}if(W.enqueue(...t)){s(`[remote-bridge] Queued ${t.length} message(s) during flush`);return}for(let e of t)z.add(e.uuid);let n=u(t).map(e=>({...e,session_id:F}));A(t)&&R.reportState(`running`),s(`[remote-bridge] Sending ${t.length} message(s)`),R.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!z.has(e.uuid));if(t.length===0)return;for(let e of t)e.uuid&&z.add(e.uuid);let n=t.map(e=>({...e,session_id:F}));R.writeBatch(n)},sendControlRequest(e){if(q){s(`[remote-bridge] Dropping control_request during 401 recovery: ${e.request_id}`);return}let t={...e,session_id:F};e.request?.subtype===`can_use_tool`&&R.reportState(`requires_action`),R.write(t),s(`[remote-bridge] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(q){s(`[remote-bridge] Dropping control_response during 401 recovery`);return}let t={...e,session_id:F};R.reportState(`running`),R.write(t),s(`[remote-bridge] Sent control_response`)},sendControlCancelRequest(e){if(q){s(`[remote-bridge] Dropping control_cancel_request during 401 recovery: ${e}`);return}let t={type:`control_cancel_request`,request_id:e,session_id:F};R.reportState(`running`),R.write(t),s(`[remote-bridge] Sent control_cancel_request request_id=${e}`)},sendResult(){if(q){s(`[remote-bridge] Dropping result during 401 recovery`);return}R.reportState(`idle`);let e={...j(F),session_id:F};R.write(e),s(`[remote-bridge] Sent result`)},async teardown(){he(),await me()}}}async function B(e,t,n){let r=n.init_retry_max_attempts;for(let i=1;i<=r;i++){let a=await e();if(a!==null)return a;if(i<r){let e=n.init_retry_base_delay_ms*2**(i-1),a=e*n.init_retry_jitter_fraction*(2*Math.random()-1),o=Math.min(e+a,n.init_retry_max_delay_ms);s(`[remote-bridge] ${t} failed (attempt ${i}/${r}), retrying in ${Math.round(o)}ms`),await _(o)}}return null}async function V(e,t,n,r){let i=await I(e,t,n,r,E());return i?T()?{...i,api_base_url:t}:i:null}async function H(e,t,r,a,o){if(!r)return`no_token`;let c=b(e);try{let e=await n.post(`${t}/v1/sessions/${c}/archive`,{},{headers:{...R(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},timeout:o,validateStatus:()=>!0});return s(`[remote-bridge] Archive ${c} status=${e.status}`),e.status}catch(e){return s(`[remote-bridge] Archive failed: ${i(e)}`),n.isAxiosError(e)&&e.code===`ECONNABORTED`?`timeout`:`error`}}export{z as initEnvLessBridgeCore};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./axios-DaWTGg7G.js";import{A as n,E as r,M as i,P as a,n as o,r as s,t as ee}from"./lazySchema-DcIJE_0i.js";import{Ca as c,Sa as te,TD as l,Xa as u,Za as d,wD as f,wa as p}from"./loadAgentsDir-DrDu5yYy.js";import{I as m,P as h,S as g,a as _,l as v,nt as ne,rt as re,w as y,z as ie}from"./debug-BrXObCdR.js";import{M as b,Sn as x,Tn as S,bn as C,j as w,xn as T}from"./settings-DfWP5y6X.js";import{l as E,s as D,u as O}from"./oauth-BqJqV-2M.js";import{Ct as k,Vt as A,ht as j,kt as M,lr as N,ur as P,vn as F,yn as I}from"./model-fi472PRc.js";import{createHash as L}from"crypto";import{open as R,unlink as z}from"fs/promises";t(),s(),ne(),ie(),g(),_(),ee(),O(),b(),P(),F(),A(),f(),d();function ae(){return Promise.resolve({ok:!0})}function B(){return!0}x(),te();var V=o(()=>r({uuid:i(),checksum:i(),settings:n(i(),a())})),H=1e4,U=5,W=3600*1e3,G=null,K=null,q=null,J=3e4;function oe(){K||c()&&(K=new Promise(e=>{q=e,setTimeout(()=>{q&&(v(`Remote settings: Loading promise timed out, resolving anyway`),q(),q=null)},J)}))}function se(){return`${E().BASE_API_URL}/api/claude_code/settings`}function Y(e){if(Array.isArray(e))return e.map(Y);if(typeof e==`object`&&e){let t={};for(let n of Object.keys(e).sort())t[n]=Y(e[n]);return t}return e}function ce(e){let t=y(Y(e));return`sha256:${L(`sha256`).update(t).digest(`hex`)}`}function le(){return c()}async function ue(){K&&await K}function de(){try{let{key:e}=k({skipRetrievingKeyFromApiKeyHelper:!0});if(e)return{headers:{"x-api-key":e}}}catch{}let e=M();return e?.accessToken?{headers:{Authorization:`Bearer ${e.accessToken}`,"anthropic-beta":D}}:{headers:{},error:`No authentication available`}}async function fe(e){let t=null;for(let n=1;n<=6;n++){if(t=await pe(e),t.success||t.skipRetry||n>U)return t;let r=u(n);v(`Remote settings: Retry ${n}/${U} after ${r}ms`),await I(r)}return t}async function pe(t){try{await j();let n=de();if(n.error)return{success:!1,error:`Authentication required for remote settings`,skipRetry:!0};let r=se(),i={...n.headers,"User-Agent":N()};t&&(i[`If-None-Match`]=`"${t}"`);let a=await e.get(r,{headers:i,timeout:H,validateStatus:e=>e===200||e===204||e===304||e===404});if(a.status===304)return v(`Remote settings: Using cached settings (304)`),{success:!0,settings:null,checksum:t};if(a.status===204||a.status===404)return v(`Remote settings: No settings found (${a.status})`),{success:!0,settings:{},checksum:void 0};let o=V().safeParse(a.data);if(!o.success)return v(`Remote settings: Invalid response format - ${o.error.message}`),{success:!1,error:`Invalid remote settings format`};let s=w().safeParse(o.data.settings);return s.success?(v(`Remote settings: Fetched successfully`),{success:!0,settings:s.data,checksum:o.data.checksum}):(v(`Remote settings: Settings validation failed - ${s.error.message}`),{success:!1,error:`Invalid settings structure`})}catch(e){let{kind:t,status:n,message:r}=h(e);if(n===404)return{success:!0,settings:{},checksum:``};switch(t){case`auth`:return{success:!1,error:`Not authorized for remote settings`,skipRetry:!0};case`timeout`:return{success:!1,error:`Remote settings request timeout`};case`network`:return{success:!1,error:`Cannot connect to server`};default:return{success:!1,error:r}}}}async function me(e){try{let t=T(),n=await R(t,`w`,384);try{await n.writeFile(y(e,null,2),{encoding:`utf-8`}),await n.datasync()}finally{await n.close()}v(`Remote settings: Saved to ${t}`)}catch(e){v(`Remote settings: Failed to save - ${e instanceof Error?e.message:`unknown error`}`)}}async function X(){$(),p(),K=null,q=null;try{await z(T())}catch{}}async function Z(){if(!c())return null;let e=C(),t=e?ce(e):void 0;try{let n=await fe(t);if(!n.success)return e?(v(`Remote settings: Using stale cache after fetch failure`),S(e),e):null;if(n.settings===null&&e)return v(`Remote settings: Cache still valid (304 Not Modified)`),S(e),e;let r=n.settings||{};if(Object.keys(r).length>0)return B(await ae(e,r))?(S(r),await me(r),v(`Remote settings: Applied new settings successfully`),r):(v(`Remote settings: User rejected new settings, using cached settings`),e);S(r);try{await z(T()),v(`Remote settings: Deleted cached file (404 response)`)}catch(e){m(e)!==`ENOENT`&&v(`Remote settings: Failed to delete cached file - ${e instanceof Error?e.message:`unknown error`}`)}return r}catch{return e?(v(`Remote settings: Using stale cache after error`),S(e),e):null}}async function Q(){c()&&!K&&(K=new Promise(e=>{q=e})),C()&&q&&(q(),q=null);try{let e=await Z();c()&&_e(),e!==null&&l.notifyChange(`policySettings`)}finally{q&&(q(),q=null)}}async function he(){if(await X(),!c()){l.notifyChange(`policySettings`);return}await Z(),v(`Remote settings: Refreshed after auth change`),l.notifyChange(`policySettings`)}async function ge(){if(!c())return;let e=C(),t=e?y(e):null;try{await Z();let e=C();(e?y(e):null)!==t&&(v(`Remote settings: Changed during background poll`),l.notifyChange(`policySettings`))}catch{}}function _e(){G===null&&c()&&(G=setInterval(()=>{ge()},W),G.unref(),re(async()=>$()))}function $(){G!==null&&(clearInterval(G),G=null)}export{he as a,Q as i,oe as n,ue as o,le as r,X as t};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-ix0xIunV.js";import{Ao as r,Er as i,hi as a,jr as o,vi as s,zo as c}from"./loadAgentsDir-ZQwvbURI.js";import{a as l,i as u,r as d}from"./bridgeConfig-DDF3teRE.js";import{n as f,t as p}from"./generateSessionName-DEAw5x_h.js";async function m(e,t,o){let c;if(!o||o.trim()===``){let n=await p(r(t.messages),t.abortController.signal);if(!n)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;c=n}else c=o.trim();let l=n(),f=i();await s(l,c,f);let m=t.getAppState().replBridgeSessionId;if(m){let e=u();import(`./createSession-CVG8SiEm.js`).then(({updateBridgeSessionTitle:t})=>t(m,c,{baseUrl:d(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await a(l,c,f),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:c}})),e(`Session renamed to: ${c}`,{display:`system`}),null}e((()=>{t(),l(),c(),o(),f()}))();export{m as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n}from"./state-ix0xIunV.js";import{Ao as r,Er as i,hi as a,jr as o,vi as s,zo as c}from"./loadAgentsDir-DrDu5yYy.js";import{a as l,i as u,r as d}from"./bridgeConfig-DbqUHe0H.js";import{n as f,t as p}from"./generateSessionName-CGpL6ATy.js";async function m(e,t,o){let c;if(!o||o.trim()===``){let n=await p(r(t.messages),t.abortController.signal);if(!n)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;c=n}else c=o.trim();let l=n(),f=i();await s(l,c,f);let m=t.getAppState().replBridgeSessionId;if(m){let e=u();import(`./createSession-GNSNbUbN.js`).then(({updateBridgeSessionTitle:t})=>t(m,c,{baseUrl:d(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await a(l,c,f),t.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:c}})),e(`Session renamed to: ${c}`,{display:`system`}),null}e((()=>{t(),l(),c(),o(),f()}))();export{m as call};
@@ -1 +1 @@
1
- import{l as e,o as t}from"./envUtils-DSxRz_kt.js";import{o as n,s as r}from"./log-Duzb4o6h.js";import{ReadStream as i}from"tty";import{openSync as a}from"fs";t(),n();var o=null;function s(){if(o!==null)return o;if(process.stdin.isTTY){o=void 0;return}if(e(process.env.CI)){o=void 0;return}if(process.argv.includes(`mcp`)){o=void 0;return}if(process.platform===`win32`){o=void 0;return}try{let e=new i(a(`/dev/tty`,`r`));return e.isTTY=!0,o=e,o}catch(e){r(e),o=void 0;return}}function c(e=!1){let t=s(),n={exitOnCtrlC:e};return t&&(n.stdin=t),n}export{c as t};
1
+ import{l as e,o as t}from"./envUtils-DSxRz_kt.js";import{o as n,s as r}from"./log-BMCygSzM.js";import{ReadStream as i}from"tty";import{openSync as a}from"fs";t(),n();var o=null;function s(){if(o!==null)return o;if(process.stdin.isTTY){o=void 0;return}if(e(process.env.CI)){o=void 0;return}if(process.argv.includes(`mcp`)){o=void 0;return}if(process.platform===`win32`){o=void 0;return}try{let e=new i(a(`/dev/tty`,`r`));return e.isTTY=!0,o=e,o}catch(e){r(e),o=void 0;return}}function c(e=!1){let t=s(),n={exitOnCtrlC:e};return t&&(n.stdin=t),n}export{c as t};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,di as o,dr as s,fi as c,ot as l,t as u,ui as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{en as p,ht as m,nt as h}from"./state-ix0xIunV.js";import{$y as g,Cr as _,Dv as v,Fi as y,Fr as b,Kr as x,Nr as S,Ov as C,Pi as w,TS as T,Vr as E,Wr as D,gr as O,jr as k,tb as A,vb as j,wi as M,yb as N}from"./loadAgentsDir-ZQwvbURI.js";import{o as P,s as F}from"./log-Duzb4o6h.js";import{n as I,r as L}from"./modalContext-DFjKLCB6.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-DiKJb83I.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${d.bold(e.arg)} was not found. Run ${d.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${d.bold(e.arg)}. Run ${d.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(i,{flexDirection:`column`,children:[(0,Y.jsxs)(a,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(j,{children:(0,Y.jsx)(a,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[o,c]=J.useState([]),[u,d]=J.useState(!0),[f,p]=J.useState(!1),[v,y]=J.useState(!1),{rows:S}=l(),T=L(),O=J.useCallback(async(t,n)=>{d(!0);try{let i=q(t?await E():await x(n),m());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{d(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await w(h());c(e),O(!1,e)}e()},[O]);let k=J.useCallback(()=>{let e=!v;y(e),O(e,o)},[v,O,o]);async function A(n){let r=C(_(n));if(!r){e(`Failed to resume conversation`);return}let i=b(n)?await D(n):n,a=U(i,v,o);if(a.isCrossProject){if(a.isSameRepoWorktree){p(!0),t(r,i,`slash_command_picker`);return}let n=await s(a.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${a.command}`,``,`(Command copied to clipboard)`,``].join(`
2
- `),{display:`user`});return}p(!0),t(r,i,`slash_command_picker`)}function j(){e(`Resume cancelled`,{display:`system`})}return u?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(g,{}),(0,Y.jsx)(a,{children:` Loading conversations…`})]}):f?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(g,{}),(0,Y.jsx)(a,{children:` Resuming conversation…`})]}):(0,Y.jsx)(R,{logs:n,maxHeight:T?Math.floor(S/2):S-2,onCancel:j,onSelect:A,onLogsChanged:()=>O(v,o),showAllProjects:v,onToggleAllProjects:k,onAgenticSearch:H})}function q(e,t){return e.filter(e=>!e.isSidechain&&_(e)!==t)}var J,Y,X;e((()=>{o(),n(),J=t(c(),1),p(),V(),N(),A(),I(),T(),u(),z(),B(),y(),P(),k(),v(),Y=f(),X=async(e,t,n)=>{let r=async(n,r,i)=>{try{await t.resume?.(n,r,i),e(void 0,{display:`skip`})}catch(t){F(t),e(`Failed to resume: ${t.message}`)}},i=n?.trim();if(!i)return(0,Y.jsx)(K,{onDone:e,onResume:r},Date.now());let a=await x(await w(h()));if(a.length===0){let t=`No conversations found to resume.`;return(0,Y.jsx)(G,{message:t,args:i,onDone:()=>e(t)})}let o=C(i);if(o){let e=a.filter(e=>_(e)===o).sort((e,t)=>t.modified.getTime()-e.modified.getTime());if(e.length>0){let t=e[0];return r(o,b(t)?await D(t):t,`slash_command_session_id`),null}let t=await O(o);if(t)return r(o,t,`slash_command_session_id`),null}if(S()){let t=await M(i,{exact:!0});if(t.length===1){let e=t[0],n=_(e);if(n)return r(n,b(e)?await D(e):e,`slash_command_title`),null}if(t.length>1){let n=W({resultType:`multipleMatches`,arg:i,count:t.length});return(0,Y.jsx)(G,{message:n,args:i,onDone:()=>e(n)})}}let s=W({resultType:`sessionNotFound`,arg:i});return(0,Y.jsx)(G,{message:s,args:i,onDone:()=>e(s)})}}))();export{X as call,q as filterResumableSessions};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{I as i,P as a,di as o,dr as s,fi as c,ot as l,t as u,ui as d}from"./src-CDCSSo0U2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";import{en as p,ht as m,nt as h}from"./state-ix0xIunV.js";import{Cr as g,Fi as _,Fr as v,Kr as y,Lb as b,Nr as x,Pi as S,Vr as C,Wr as w,dy as T,fy as E,gr as D,jr as O,lC as k,nx as A,rx as j,wi as M,zb as N}from"./loadAgentsDir-DrDu5yYy.js";import{o as P,s as F}from"./log-BMCygSzM.js";import{n as I,r as L}from"./modalContext-DFjKLCB6.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-DGpgCUfk.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${d.bold(e.arg)} was not found. Run ${d.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${d.bold(e.arg)}. Run ${d.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(i,{flexDirection:`column`,children:[(0,Y.jsxs)(a,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(A,{children:(0,Y.jsx)(a,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[o,c]=J.useState([]),[u,d]=J.useState(!0),[f,p]=J.useState(!1),[_,x]=J.useState(!1),{rows:T}=l(),D=L(),O=J.useCallback(async(t,n)=>{d(!0);try{let i=q(t?await C():await y(n),m());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{d(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await S(h());c(e),O(!1,e)}e()},[O]);let k=J.useCallback(()=>{let e=!_;x(e),O(e,o)},[_,O,o]);async function A(n){let r=E(g(n));if(!r){e(`Failed to resume conversation`);return}let i=v(n)?await w(n):n,a=U(i,_,o);if(a.isCrossProject){if(a.isSameRepoWorktree){p(!0),t(r,i,`slash_command_picker`);return}let n=await s(a.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${a.command}`,``,`(Command copied to clipboard)`,``].join(`
2
+ `),{display:`user`});return}p(!0),t(r,i,`slash_command_picker`)}function j(){e(`Resume cancelled`,{display:`system`})}return u?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(b,{}),(0,Y.jsx)(a,{children:` Loading conversations…`})]}):f?(0,Y.jsxs)(i,{children:[(0,Y.jsx)(b,{}),(0,Y.jsx)(a,{children:` Resuming conversation…`})]}):(0,Y.jsx)(R,{logs:n,maxHeight:D?Math.floor(T/2):T-2,onCancel:j,onSelect:A,onLogsChanged:()=>O(_,o),showAllProjects:_,onToggleAllProjects:k,onAgenticSearch:H})}function q(e,t){return e.filter(e=>!e.isSidechain&&g(e)!==t)}var J,Y,X;e((()=>{o(),n(),J=t(c(),1),p(),V(),j(),N(),I(),k(),u(),z(),B(),_(),P(),O(),T(),Y=f(),X=async(e,t,n)=>{let r=async(n,r,i)=>{try{await t.resume?.(n,r,i),e(void 0,{display:`skip`})}catch(t){F(t),e(`Failed to resume: ${t.message}`)}},i=n?.trim();if(!i)return(0,Y.jsx)(K,{onDone:e,onResume:r},Date.now());let a=await y(await S(h()));if(a.length===0){let t=`No conversations found to resume.`;return(0,Y.jsx)(G,{message:t,args:i,onDone:()=>e(t)})}let o=E(i);if(o){let e=a.filter(e=>g(e)===o).sort((e,t)=>t.modified.getTime()-e.modified.getTime());if(e.length>0){let t=e[0];return r(o,v(t)?await w(t):t,`slash_command_session_id`),null}let t=await D(o);if(t)return r(o,t,`slash_command_session_id`),null}if(x()){let t=await M(i,{exact:!0});if(t.length===1){let e=t[0],n=g(e);if(n)return r(n,v(e)?await w(e):e,`slash_command_title`),null}if(t.length>1){let n=W({resultType:`multipleMatches`,arg:i,count:t.length});return(0,Y.jsx)(G,{message:n,args:i,onDone:()=>e(n)})}}let s=W({resultType:`sessionNotFound`,arg:i});return(0,Y.jsx)(G,{message:s,args:i,onDone:()=>e(s)})}}))();export{X as call,q as filterResumableSessions};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,o as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{l as s,p as c}from"./debug-DiuXEmUq.js";import{r as l,t as u}from"./execFileNoThrow-DResQRvR.js";import{o as d,s as f}from"./log-Duzb4o6h.js";import{i as p,o as m}from"./platform-B5dCGT8t.js";import{n as h,r as g}from"./analytics-BotDBGh0.js";import{n as _,t as v}from"./bundledMode--fG1S62b.js";import{f as y,o as b,p as x,r as S}from"./stringUtils-D_g2L6A4.js";import{homedir as C}from"os";import*as w from"path";import{existsSync as T}from"fs";import{execFile as E,spawn as D}from"child_process";import{fileURLToPath as O}from"url";var k,A,j,M=e((()=>{k=O(import.meta.url),A=w.dirname(k),j=(()=>{let e=A.split(w.sep),t=e.lastIndexOf(`dist`);if(t!==-1)return e.slice(0,t+1).join(w.sep);let n=e.lastIndexOf(`src`);return n===-1?A:e.slice(0,n).join(w.sep)})()}));function N(e,t,n){let r=n??process.platform;return T(e)?{mode:`builtin`,command:e,args:[]}:(t===void 0?y(`rg`,[]).cmd:t??`rg`)===`rg`?{mode:`builtin`,command:e,args:[],note:`no ripgrep available on ${r}; install ripgrep via apt/pkg/brew`}:{mode:`system`,command:`rg`,args:[]}}function P(){let e=H();return{rgPath:e.command,rgArgs:e.args,argv0:e.argv0}}function F(e){return e.includes(`os error 11`)||e.includes(`Resource temporarily unavailable`)}function I(e,t,n,r,i=!1){let{rgPath:a,rgArgs:o,argv0:s}=P(),c=i?[`-j`,`1`]:[],l=[...o,...c,...e,t],u=p()===`wsl`?6e4:2e4,d=parseInt(process.env.CLAUDE_CODE_GLOB_TIMEOUT_SECONDS||``,10)||0,f=d>0?d*1e3:u;if(s){let e=D(a,l,{argv0:s,signal:n,windowsHide:!0}),t=``,i=``,o=!1,c=!1;e.stdout?.on(`data`,e=>{o||(t+=e.toString(),t.length>U&&(t=t.slice(0,U),o=!0))}),e.stderr?.on(`data`,e=>{c||(i+=e.toString(),i.length>U&&(i=i.slice(0,U),c=!0))});let u,d=setTimeout(()=>{process.platform===`win32`?e.kill():(e.kill(`SIGTERM`),u=setTimeout(e=>e.kill(`SIGKILL`),5e3,e))},f),p=!1;return e.on(`close`,(e,n)=>{if(!p)if(p=!0,clearTimeout(d),clearTimeout(u),e===0||e===1)r(null,t,i);else{let a=Error(`ripgrep exited with code ${e}`);a.code=e??void 0,a.signal=n??void 0,r(a,t,i)}}),e.on(`error`,e=>{p||(p=!0,clearTimeout(d),clearTimeout(u),r(e,t,i))}),e}return E(a,l,{maxBuffer:U,signal:n,timeout:f,killSignal:process.platform===`win32`?void 0:`SIGKILL`},r)}async function L(e,t,n){await B();let{rgPath:r,rgArgs:i,argv0:a}=P();return new Promise((o,s)=>{let c=D(r,[...i,...e,t],{argv0:a,signal:n,windowsHide:!0,stdio:[`ignore`,`pipe`,`ignore`]}),l=0;c.stdout?.on(`data`,e=>{l+=S(e,`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{c as r,o as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{a as s,l as c}from"./debug-BrXObCdR.js";import{r as l,t as u}from"./execFileNoThrow-D244NytW.js";import{o as d,s as f}from"./log-BMCygSzM.js";import{i as p,o as m}from"./platform-BrYefG_2.js";import{n as h,r as g}from"./analytics-BotDBGh0.js";import{n as _,t as v}from"./bundledMode--fG1S62b.js";import{f as y,o as b,p as x,r as S}from"./stringUtils-DGLPkqJ4.js";import{homedir as C}from"os";import*as w from"path";import{existsSync as T}from"fs";import{execFile as E,spawn as D}from"child_process";import{fileURLToPath as O}from"url";var k,A,j,M=e((()=>{k=O(import.meta.url),A=w.dirname(k),j=(()=>{let e=A.split(w.sep),t=e.lastIndexOf(`dist`);if(t!==-1)return e.slice(0,t+1).join(w.sep);let n=e.lastIndexOf(`src`);return n===-1?A:e.slice(0,n).join(w.sep)})()}));function N(e,t,n){let r=n??process.platform;return T(e)?{mode:`builtin`,command:e,args:[]}:(t===void 0?y(`rg`,[]).cmd:t??`rg`)===`rg`?{mode:`builtin`,command:e,args:[],note:`no ripgrep available on ${r}; install ripgrep via apt/pkg/brew`}:{mode:`system`,command:`rg`,args:[]}}function P(){let e=H();return{rgPath:e.command,rgArgs:e.args,argv0:e.argv0}}function F(e){return e.includes(`os error 11`)||e.includes(`Resource temporarily unavailable`)}function I(e,t,n,r,i=!1){let{rgPath:a,rgArgs:o,argv0:s}=P(),c=i?[`-j`,`1`]:[],l=[...o,...c,...e,t],u=p()===`wsl`?6e4:2e4,d=parseInt(process.env.CLAUDE_CODE_GLOB_TIMEOUT_SECONDS||``,10)||0,f=d>0?d*1e3:u;if(s){let e=D(a,l,{argv0:s,signal:n,windowsHide:!0}),t=``,i=``,o=!1,c=!1;e.stdout?.on(`data`,e=>{o||(t+=e.toString(),t.length>U&&(t=t.slice(0,U),o=!0))}),e.stderr?.on(`data`,e=>{c||(i+=e.toString(),i.length>U&&(i=i.slice(0,U),c=!0))});let u,d=setTimeout(()=>{process.platform===`win32`?e.kill():(e.kill(`SIGTERM`),u=setTimeout(e=>e.kill(`SIGKILL`),5e3,e))},f),p=!1;return e.on(`close`,(e,n)=>{if(!p)if(p=!0,clearTimeout(d),clearTimeout(u),e===0||e===1)r(null,t,i);else{let a=Error(`ripgrep exited with code ${e}`);a.code=e??void 0,a.signal=n??void 0,r(a,t,i)}}),e.on(`error`,e=>{p||(p=!0,clearTimeout(d),clearTimeout(u),r(e,t,i))}),e}return E(a,l,{maxBuffer:U,signal:n,timeout:f,killSignal:process.platform===`win32`?void 0:`SIGKILL`},r)}async function L(e,t,n){await B();let{rgPath:r,rgArgs:i,argv0:a}=P();return new Promise((o,s)=>{let c=D(r,[...i,...e,t],{argv0:a,signal:n,windowsHide:!0,stdio:[`ignore`,`pipe`,`ignore`]}),l=0;c.stdout?.on(`data`,e=>{l+=S(e,`
2
2
  `)});let u=!1;c.on(`close`,e=>{u||(u=!0,e===0||e===1?o(l):s(Error(`rg --files exited ${e}`)))}),c.on(`error`,e=>{u||(u=!0,s(e))})})}async function R(e,t,n){return await B(),q().catch(e=>{f(e)}),new Promise((r,i)=>{let a=(o,s,l,u)=>{if(!o){r(s.trim().split(`
3
3
  `).map(e=>e.replace(/\r$/,``)).filter(Boolean));return}if(o.code===1){r([]);return}if([`ENOENT`,`EACCES`,`EPERM`].includes(o.code)){i(o);return}if(!u&&F(l)){c(`rg EAGAIN error detected, retrying with single-threaded mode (-j 1)`),g(`tengu_ripgrep_eagain_retry`,{}),I(e,t,n,(e,t,n)=>{a(e,t,n,!0)},!0);return}let d=s&&s.trim().length>0,m=o.signal===`SIGTERM`||o.signal===`SIGKILL`||o.code===`ABORT_ERR`,h=o.code===`ERR_CHILD_PROCESS_STDIO_MAXBUFFER`,_=[];if(d&&(_=s.trim().split(`
4
4
  `).map(e=>e.replace(/\r$/,``)).filter(Boolean),_.length>0&&(m||h)&&(_=_.slice(0,-1))),c(`rg error (signal=${o.signal}, code=${o.code}, stderr: ${l}), ${_.length} results`),o.code!==2&&o.code!==`ABORT_ERR`&&f(o),m&&_.length===0){i(new W(`Ripgrep search timed out after ${p()===`wsl`?60:20} seconds. The search may have matched files but did not complete in time. Try searching a more specific path or pattern.`,_));return}r(_)};I(e,t,n,(e,t,n)=>{a(e,t,n,!1)})})}function z(){let e=H();return{mode:e.mode,path:e.command,working:K?.working??null,note:K?.note??e.note}}async function B(){if(process.platform!==`darwin`||J)return;J=!0;let e=H();if(e.mode!==`builtin`)return;let t=e.command;if((await u(`codesign`,[`-vv`,`-d`,t],{preserveOutputOnError:!1})).stdout.split(`
@@ -0,0 +1 @@
1
+ import{a as e,i as t}from"./ripgrep-BXmXjAzA.js";e();export{t as getRipgrepStatus};
@@ -1 +1 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-B93v1AxE.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-XufSllVw.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
@@ -1,10 +1,10 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{Qi as r,Vi as i,lw as a,uw as o}from"./loadAgentsDir-ZQwvbURI.js";import{r as s,t as c}from"./featureCheck-HslM03dr.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as ee,s as te,u as ne}from"./instinctParser-Dt-lqnDe.js";import{C as h,S as g,b as _,c as re,f as ie,i as ae,m as oe,o as v,r as se,u as y}from"./skillGenerator-jJQDphQ8.js";import{a as ce,i as b,l as le,n as x,o as ue,t as de}from"./observationStore-DzCdXq8U.js";import{a as fe,s as pe}from"./projectContext-D9MDwJUF.js";import{d as me,i as he,l as ge,p as _e}from"./sessionObserver-OgY9BUP4.js";import{dirname as ve,join as S}from"node:path";import{existsSync as C}from"node:fs";import{randomBytes as ye}from"node:crypto";import{mkdir as w,readFile as be,readdir as T,rename as xe,unlink as Se,writeFile as E}from"node:fs/promises";function D(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Ce(e)),i=Ee(e),a=t?.description??we(e),o=k(r,n,t),s=Te({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function O(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),i(),t)}function k(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??S(t(),`commands`)}function Ce(e){return g([`learned`,...De(e,4)].join(`-`))||`learned-command`}function we(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function Te(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-DSxRz_kt.js";import{Jw as r,Qi as i,Vi as a,qw as o}from"./loadAgentsDir-DrDu5yYy.js";import{r as s,t as c}from"./featureCheck-HslM03dr.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as ee,s as te,u as ne}from"./instinctParser-Dt-lqnDe.js";import{C as h,S as g,b as _,c as re,f as ie,i as ae,m as oe,o as v,r as se,u as y}from"./skillGenerator-CwXUfM4Y.js";import{a as ce,i as b,l as le,n as x,o as ue,t as de}from"./observationStore-DzCdXq8U.js";import{a as fe,s as pe}from"./projectContext-D9MDwJUF.js";import{d as me,i as he,l as ge,p as _e}from"./sessionObserver-B_09FQKV.js";import{dirname as ve,join as S}from"node:path";import{existsSync as C}from"node:fs";import{randomBytes as ye}from"node:crypto";import{mkdir as w,readFile as be,readdir as T,rename as xe,unlink as Se,writeFile as E}from"node:fs/promises";function D(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Ce(e)),i=Ee(e),a=t?.description??we(e),o=k(r,n,t),s=Te({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function O(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),a(),t)}function k(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??S(t(),`commands`)}function Ce(e){return g([`learned`,...De(e,4)].join(`-`))||`learned-command`}function we(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function Te(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
2
2
  `),``,`## Steps`,``,i.map(e=>`- ${e.action}`).join(`
3
3
  `),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).join(`
4
4
  `),``].join(`
5
- `)}function Ee(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function De(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`run`,`use`,`prefer`,`avoid`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var A=e((()=>{n(),r(),_()}));function j(e,t){if(e.length===0)throw Error(`Cannot generate an agent draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Oe(e)),i=je(e),a=t?.description??ke(e),o=N(r,n,t),s=Ae({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function M(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),i(),t)}function N(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`agents`):r?.globalAgentsDir??S(t(),`agents`)}function Oe(e){return g([`learned`,`agent`,...Me(e,4)].join(`-`))||`learned-agent`}function ke(e){return(e[0]?.trigger??`Run the learned multi-step workflow`).replace(/\s+/g,` `).slice(0,120)}function Ae(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`You are the ${t} learned agent.`,``,`## Triggers`,``,i.map(e=>`- ${e.trigger}`).join(`
5
+ `)}function Ee(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function De(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`run`,`use`,`prefer`,`avoid`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var A=e((()=>{n(),i(),_()}));function j(e,t){if(e.length===0)throw Error(`Cannot generate an agent draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Oe(e)),i=je(e),a=t?.description??ke(e),o=N(r,n,t),s=Ae({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function M(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),a(),t)}function N(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`agents`):r?.globalAgentsDir??S(t(),`agents`)}function Oe(e){return g([`learned`,`agent`,...Me(e,4)].join(`-`))||`learned-agent`}function ke(e){return(e[0]?.trigger??`Run the learned multi-step workflow`).replace(/\s+/g,` `).slice(0,120)}function Ae(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`You are the ${t} learned agent.`,``,`## Triggers`,``,i.map(e=>`- ${e.trigger}`).join(`
6
6
  `),``,`## Playbook`,``,i.map(e=>`- ${e.action}`).join(`
7
7
  `),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,20).join(`
8
8
  `),``].join(`
9
- `)}function je(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function Me(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var P=e((()=>{n(),r(),_()}));function F(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Pe(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=f().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:I(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function I(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ne(e,t){return F(e).filter(e=>e.target===`skill`&&h(e.instincts)).map(e=>ae(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function L(e,t){return F(e).filter(e=>e.target===`command`&&h(e.instincts)).map(e=>D(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function R(e,t){return F(e).filter(e=>e.target===`agent`&&h(e.instincts)).map(e=>j(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var z=e((()=>{_(),v(),A(),P(),ne()}));function B(e){let t=x(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?S(t,`global`,`instincts`,`personal`):S(t,`projects`,n.projectId,`instincts`,`personal`)}async function V(e,t){let n=m(e);await w(B(t),{recursive:!0});let r=He(n.id,t),i=`${r}.${ye(6).toString(`hex`)}.tmp`;return await E(i,u(n)),await xe(i,r),n}async function H(e){let t=B(e),n=[];try{n=await T(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await be(S(t,e),`utf8`);r.push(te(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function Fe(e,t){let n=U.then(()=>Ie(e,t));return U=n.catch(()=>{}),n}async function Ie(e,t){let n=await H(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&l(t,e)),i=new Date().toISOString();if(!r)return V(e,t);let a=l(r,e),o=a?-.1:ze(e.evidenceOutcome),s=p(r.confidence+o),c=Le(r.status,s,a);return V(m({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function Le(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function Re(e){let t=await H(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/Ue);if(a<1)continue;let o=-.02*a,s=p(i.confidence+o);s!==i.confidence&&(await V(m({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function ze(e){return e===`failure`?-.05:.05}async function Be(e,t){let n=await H(t);return await w(ve(e),{recursive:!0}),await E(e,`${JSON.stringify(n,null,2)}\n`),n}async function Ve(e,t){let n=await H(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await Se(He(e.id,t)),i.push(e));return i}function He(e,t){return S(B(t),`${e}.json`)}var U,Ue,W=e((()=>{b(),d(),U=Promise.resolve(),Ue=10080*60*1e3}));function We(e){if(G.add(e),G.size>Ye){let e=G.size-Xe,t=G.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;G.delete(e.value)}}}function Ge(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function Ke(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await qe(e.rootDir),i=Ge(r,t,n),a=[];for(let t of i){if(G.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await V({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Je(e.rootDir)}),We(t.instinctId),a.push(t))}return a}async function qe(e){let t=S(x(e?{rootDir:e}:void 0),`projects`);if(!C(t))return[];let n=await T(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await H({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:S(t,i.name)},scope:`project`});r.push(...n)}return r}function Je(e){let t=x(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:S(t,`global`)}}var Ye,Xe,G,Ze=e((()=>{W(),b(),Ye=256,Xe=192,G=new Set}));function Qe(){X=0,Z=0,Q.clear()}function $e(){return J}function et(){if(!q){q=!0;try{_e()}catch{}o(rt),tt().catch(()=>{})}}async function tt(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:pe(process.cwd())};await Promise.allSettled([Re(e),ce(e),Ve(30,e)])}function nt(e){try{let t=x();return e.startsWith(t)}catch{return!1}}async function rt(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(nt(t))return;let n=pe(t),r={project:n};++J;let i=[];for(let t of ot(e.messages,n))i.push(await de(t,r));let a=(await ue(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=f(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,u;if(l)X++,Z=o,u=await ge(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-DNItJztR.js`),t=e.analyze(i,{project:n});u=Array.isArray(t)?t:await t}for(let e of u)await Fe(ee(e),r);await at(r)}function it(){J=0,Y=``,Qe()}async function at(e){let n=await H(e),r=process.cwd(),i=[S(r,`.claude`,`skills`),S(t(),`skills`)],a=F(n).filter(e=>e.target===`skill`&&h(e.instincts));for(let e of a){let t=await se(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;C(S(n.outputPath,`SKILL.md`))||await re(ie(n,await y(`skill`,n,i)))}let o=L(n,{cwd:r});for(let e of o)(await y(`command`,e,[S(r,`.claude`,`commands`),S(t(),`commands`)])).length>0||await O(e);let s=R(n,{cwd:r});for(let e of s)(await y(`agent`,e,[S(r,`.claude`,`agents`),S(t(),`agents`)])).length>0||await M(e);await Ke()}function ot(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>ut){let e=Q.size-$,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=lt(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=st(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=ct(e.message?.content),n=st(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function st(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
10
- `):``}function ct(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{toolName:String(t.name??`unknown_tool`),input:le(t.input)}]:[]}):[]}function lt(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{toolName:String(t.name??t.tool_name??`unknown_tool`),output:le(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,ut,$,dt=e((()=>{a(),ne(),c(),b(),fe(),he(),d(),me(),W(),oe(),z(),v(),_(),A(),P(),Ze(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,ut=1e3,$=500}));export{O as A,j as C,D,M as E,k as O,z as S,P as T,I as _,Qe as a,L as b,Ke as c,Be as d,W as f,Fe as g,V as h,dt as i,A as k,Ge as l,Ve as m,$e as n,it as o,H as p,et as r,rt as s,K as t,Ze as u,F as v,N as w,Ne as x,R as y};
9
+ `)}function je(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function Me(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var P=e((()=>{n(),i(),_()}));function F(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Pe(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=f().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:I(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function I(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ne(e,t){return F(e).filter(e=>e.target===`skill`&&h(e.instincts)).map(e=>ae(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function L(e,t){return F(e).filter(e=>e.target===`command`&&h(e.instincts)).map(e=>D(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function R(e,t){return F(e).filter(e=>e.target===`agent`&&h(e.instincts)).map(e=>j(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var z=e((()=>{_(),v(),A(),P(),ne()}));function B(e){let t=x(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?S(t,`global`,`instincts`,`personal`):S(t,`projects`,n.projectId,`instincts`,`personal`)}async function V(e,t){let n=m(e);await w(B(t),{recursive:!0});let r=He(n.id,t),i=`${r}.${ye(6).toString(`hex`)}.tmp`;return await E(i,u(n)),await xe(i,r),n}async function H(e){let t=B(e),n=[];try{n=await T(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await be(S(t,e),`utf8`);r.push(te(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function Fe(e,t){let n=U.then(()=>Ie(e,t));return U=n.catch(()=>{}),n}async function Ie(e,t){let n=await H(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&l(t,e)),i=new Date().toISOString();if(!r)return V(e,t);let a=l(r,e),o=a?-.1:ze(e.evidenceOutcome),s=p(r.confidence+o),c=Le(r.status,s,a);return V(m({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function Le(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function Re(e){let t=await H(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/Ue);if(a<1)continue;let o=-.02*a,s=p(i.confidence+o);s!==i.confidence&&(await V(m({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function ze(e){return e===`failure`?-.05:.05}async function Be(e,t){let n=await H(t);return await w(ve(e),{recursive:!0}),await E(e,`${JSON.stringify(n,null,2)}\n`),n}async function Ve(e,t){let n=await H(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await Se(He(e.id,t)),i.push(e));return i}function He(e,t){return S(B(t),`${e}.json`)}var U,Ue,W=e((()=>{b(),d(),U=Promise.resolve(),Ue=10080*60*1e3}));function We(e){if(G.add(e),G.size>Ye){let e=G.size-Xe,t=G.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;G.delete(e.value)}}}function Ge(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function Ke(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await qe(e.rootDir),i=Ge(r,t,n),a=[];for(let t of i){if(G.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await V({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Je(e.rootDir)}),We(t.instinctId),a.push(t))}return a}async function qe(e){let t=S(x(e?{rootDir:e}:void 0),`projects`);if(!C(t))return[];let n=await T(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await H({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:S(t,i.name)},scope:`project`});r.push(...n)}return r}function Je(e){let t=x(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:S(t,`global`)}}var Ye,Xe,G,Ze=e((()=>{W(),b(),Ye=256,Xe=192,G=new Set}));function Qe(){X=0,Z=0,Q.clear()}function $e(){return J}function et(){if(!q){q=!0;try{_e()}catch{}r(rt),tt().catch(()=>{})}}async function tt(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:pe(process.cwd())};await Promise.allSettled([Re(e),ce(e),Ve(30,e)])}function nt(e){try{let t=x();return e.startsWith(t)}catch{return!1}}async function rt(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(nt(t))return;let n=pe(t),r={project:n};++J;let i=[];for(let t of ot(e.messages,n))i.push(await de(t,r));let a=(await ue(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=f(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,u;if(l)X++,Z=o,u=await ge(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-B400YG3s.js`),t=e.analyze(i,{project:n});u=Array.isArray(t)?t:await t}for(let e of u)await Fe(ee(e),r);await at(r)}function it(){J=0,Y=``,Qe()}async function at(e){let n=await H(e),r=process.cwd(),i=[S(r,`.claude`,`skills`),S(t(),`skills`)],a=F(n).filter(e=>e.target===`skill`&&h(e.instincts));for(let e of a){let t=await se(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;C(S(n.outputPath,`SKILL.md`))||await re(ie(n,await y(`skill`,n,i)))}let o=L(n,{cwd:r});for(let e of o)(await y(`command`,e,[S(r,`.claude`,`commands`),S(t(),`commands`)])).length>0||await O(e);let s=R(n,{cwd:r});for(let e of s)(await y(`agent`,e,[S(r,`.claude`,`agents`),S(t(),`agents`)])).length>0||await M(e);await Ke()}function ot(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>ut){let e=Q.size-$,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=lt(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=st(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=ct(e.message?.content),n=st(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function st(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
10
+ `):``}function ct(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{toolName:String(t.name??`unknown_tool`),input:le(t.input)}]:[]}):[]}function lt(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{toolName:String(t.name??t.tool_name??`unknown_tool`),output:le(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,ut,$,dt=e((()=>{o(),ne(),c(),b(),fe(),he(),d(),me(),W(),oe(),z(),v(),_(),A(),P(),Ze(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,ut=1e3,$=500}));export{O as A,j as C,D,M as E,k as O,z as S,P as T,I as _,Qe as a,L as b,Ke as c,Be as d,W as f,Fe as g,V as h,dt as i,A as k,Ge as l,Ve as m,$e as n,it as o,H as p,et as r,rt as s,K as t,Ze as u,F as v,N as w,Ne as x,R as y};
@@ -0,0 +1 @@
1
+ import{_D as e,bD as t}from"./loadAgentsDir-DrDu5yYy.js";t();export{e as SandboxManager};