claude-code-best 2.7.1 → 2.7.2

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 (413) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-C7od6sFQ.js → AddWorkspaceDirectory-V2tF7iCY.js} +1 -1
  2. package/dist/chunks/{App-EfHjElWP.js → App-DLdRpU7c.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-B7_TCGwt.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-CSz0291w.js → ApproveApiKey-DPws3jax.js} +1 -1
  5. package/dist/chunks/{AssistantSessionChooser-mLIhDlxW.js → AssistantSessionChooser-D6rS0OVe.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-hGlbm5z5.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-BCdft-m_.js → BypassPermissionsModeDialog-CuEpdRVd.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-BPlrCIo-.js → ClaudeInChromeOnboarding-CTTKMRbt.js} +1 -1
  9. package/dist/chunks/{ClaudeMdExternalIncludesDialog-D8fk-Ib5.js → ClaudeMdExternalIncludesDialog-B-GkVoA_.js} +1 -1
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-DxJK9NiM.js +1 -0
  11. package/dist/chunks/ConsoleOAuthFlow-LPZ97jsm.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-BQwx7qWA.js → DesktopHandoff-BjPylhOT.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-CujM8Ivu.js → DevChannelsDialog-c4YVqBX9.js} +1 -1
  14. package/dist/chunks/{DiffDialog-Byv1UJvS.js → DiffDialog-I5wuXw2C.js} +1 -1
  15. package/dist/chunks/{Doctor-Cv7wbi6C.js → Doctor-Cr_MlSPc.js} +1 -1
  16. package/dist/chunks/Doctor-hgf3dMAW.js +1 -0
  17. package/dist/chunks/{ExitFlow-DKusdm_v.js → ExitFlow-Bz5grDWv.js} +2 -2
  18. package/dist/chunks/{Feedback-Diw8XUr-.js → Feedback-COgMI5tY.js} +1 -1
  19. package/dist/chunks/Grove-Bwmghb-e.js +1 -0
  20. package/dist/chunks/{Grove-CAi037VV.js → Grove-m57x4tY1.js} +1 -1
  21. package/dist/chunks/{HybridTransport-CP0RopXu.js → HybridTransport-Bok4-Ptt.js} +1 -1
  22. package/dist/chunks/{ITermBackend-RvD4VX7c.js → ITermBackend-BBSP-NNa.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-Bhlgysxl.js → InvalidConfigDialog-uTSuSBvO.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-dGStgJZN.js → InvalidSettingsDialog-B-Os12-H.js} +1 -1
  25. package/dist/chunks/{MCPConnectionManager-D5a9ysw2.js → MCPConnectionManager-y97Inszc.js} +1 -1
  26. package/dist/chunks/{McpParsingWarnings-B_z9pZ_8.js → McpParsingWarnings-DMFUZw92.js} +1 -1
  27. package/dist/chunks/MessageSelector-DwdAC2io.js +3 -0
  28. package/dist/chunks/{Messages-DTmFVhRG.js → Messages-FEBcX-cT.js} +3 -3
  29. package/dist/chunks/{Onboarding-BoAtphYb.js → Onboarding-B8qMJaBh.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-DA7Ne7Mj.js → OverageCreditUpsell-DnFv5z-z.js} +1 -1
  31. package/dist/chunks/PluginSettings-B_xVgTTp.js +17 -0
  32. package/dist/chunks/{PromptInputHelpMenu-B__j9zE6.js → PromptInputHelpMenu-CoMkWchC.js} +1 -1
  33. package/dist/chunks/QueryEngine-C7r7O-hH.js +1 -0
  34. package/dist/chunks/{REPL-B1BS9jwx.js → REPL-CmJdJrGO.js} +36 -36
  35. package/dist/chunks/REPL-nP7H_-qa.js +1 -0
  36. package/dist/chunks/{RemoteCallout-Bwe1ESr9.js → RemoteCallout-4JOZROfT.js} +1 -1
  37. package/dist/chunks/{RemoteSessionManager-BKD4YmzY.js → RemoteSessionManager-jcPnywfY.js} +2 -2
  38. package/dist/chunks/ResumeConversation-CZ2Uedkf.js +1 -0
  39. package/dist/chunks/{SSETransport-D3e5KNL3.js → SSETransport-kEH_p4Yq.js} +1 -1
  40. package/dist/chunks/SearchExtraToolsTool-C64oVFUD.js +1 -0
  41. package/dist/chunks/SentryErrorBoundary-2E2qGV11.js +1 -0
  42. package/dist/chunks/{SentryErrorBoundary-D-YZTGQG.js → SentryErrorBoundary-97iY7Nb7.js} +1 -1
  43. package/dist/chunks/Settings-CuljH0mu.js +2 -0
  44. package/dist/chunks/{TeleportProgress-C3Ubx1Se.js → TeleportProgress-Ctdqi7iS.js} +1 -1
  45. package/dist/chunks/{TeleportRepoMismatchDialog-D_ax3xQy.js → TeleportRepoMismatchDialog-DyTBg1YD.js} +1 -1
  46. package/dist/chunks/{TeleportResumeWrapper-DeVKIXQp.js → TeleportResumeWrapper-B66clYsG.js} +1 -1
  47. package/dist/chunks/{ThemePicker-DKmIL5Ku.js → ThemePicker-WKmYvrqz.js} +1 -1
  48. package/dist/chunks/{TmuxBackend-Bm_cRJ2x.js → TmuxBackend-OKX2NP14.js} +2 -2
  49. package/dist/chunks/{TrustDialog-ClXFMKj6.js → TrustDialog-0anSIf-G.js} +1 -1
  50. package/dist/chunks/{ValidationErrorsList-SdQADfvA.js → ValidationErrorsList-CfgC1KJb.js} +1 -1
  51. package/dist/chunks/{WelcomeV2-BijS6i2Z.js → WelcomeV2-BMHXiNt3.js} +1 -1
  52. package/dist/chunks/{WindowsTerminalBackend-CGEQ5ClB.js → WindowsTerminalBackend-fCSGVe4W.js} +2 -2
  53. package/dist/chunks/{add-dir-B7kleB6k.js → add-dir-CMtuW667.js} +1 -1
  54. package/dist/chunks/{agentDisplay-Dr1XbOAu.js → agentDisplay-CgYKW3G7.js} +1 -1
  55. package/dist/chunks/{agents-CpLvvWpO.js → agents-CdqcGm9o.js} +7 -7
  56. package/dist/chunks/{agents-Dy5YOJC9.js → agents-D90TsYOf.js} +1 -1
  57. package/dist/chunks/{ant-gwf-4eGN.js → ant-DZjimiuz.js} +1 -1
  58. package/dist/chunks/{api-CDmgYrwN.js → api-CQWbpxLP.js} +1 -1
  59. package/dist/chunks/api-quOYYOhi.js +1 -0
  60. package/dist/chunks/assistant-B5_xx00q.js +1 -0
  61. package/dist/chunks/{assistant-BULedprW.js → assistant-CEmC_DlU.js} +1 -1
  62. package/dist/chunks/{assistant-1usDIXtk.js → assistant-CyVcFPIR.js} +1 -1
  63. package/dist/chunks/auth-CjtaiRtF.js +1 -0
  64. package/dist/chunks/{auth-CvHVr2A5.js → auth-DsQEVs9W.js} +1 -1
  65. package/dist/chunks/{autoMode-DSMM2seL.js → autoMode-DEbM9UaE.js} +1 -1
  66. package/dist/chunks/{autonomy-TtBO2TAe.js → autonomy-Clap6Swl.js} +1 -1
  67. package/dist/chunks/{autonomy-Dj6Nzxus.js → autonomy-lNpGnyiu.js} +3 -3
  68. package/dist/chunks/{autonomyPanel-CbmU7lPg.js → autonomyPanel-BqEvfI0e.js} +1 -1
  69. package/dist/chunks/backgroundHousekeeping-D-jt-ocx.js +1 -0
  70. package/dist/chunks/{backgroundHousekeeping-Cp2RvmEN.js → backgroundHousekeeping-KvOpP_4M.js} +2 -2
  71. package/dist/chunks/{branch-Cj5TGroO.js → branch-CSYB04xC.js} +1 -1
  72. package/dist/chunks/{bridge-CsqJAoEg.js → bridge-DDgASypO.js} +2 -2
  73. package/dist/chunks/bridgeConfig-BdZVEqhx.js +1 -0
  74. package/dist/chunks/{bridgeConfig-pjDV5Z2l.js → bridgeConfig-DjC4oig1.js} +1 -1
  75. package/dist/chunks/{bridgeEnabled-D9jI6X-w.js → bridgeEnabled-Csn6Ym3k.js} +1 -1
  76. package/dist/chunks/bridgeEnabled-DLRIH243.js +1 -0
  77. package/dist/chunks/{bridgeMain-CNmR9iDD.js → bridgeMain-B5wsmwkN.js} +11 -11
  78. package/dist/chunks/bridgeMain-BN0Sag35.js +1 -0
  79. package/dist/chunks/{bridgeMessaging-DN0X35NX.js → bridgeMessaging-ChOzzVWj.js} +1 -1
  80. package/dist/chunks/{btw-BOg0RTKl.js → btw-BgjcOoeo.js} +1 -1
  81. package/dist/chunks/{buddy-BFuPeIxM.js → buddy-C1wE3noR.js} +1 -1
  82. package/dist/chunks/{bypassPermissionsKillswitch-kxVnIVRs.js → bypassPermissionsKillswitch-C0diGLRB.js} +1 -1
  83. package/dist/chunks/{caches-BumkMuGA.js → caches-CIoVGP24.js} +2 -2
  84. package/dist/chunks/caches-DMYdTEAr.js +1 -0
  85. package/dist/chunks/{ccrClient-BI1QPLmN.js → ccrClient-C1msT1E3.js} +1 -1
  86. package/dist/chunks/changeDetector-DoOBZOt1.js +1 -0
  87. package/dist/chunks/{channelNotification-CoZSFUlb.js → channelNotification-CWlu9ZWs.js} +1 -1
  88. package/dist/chunks/channelNotification-oZ6vG5R5.js +1 -0
  89. package/dist/chunks/{chrome-C_5EZcdc.js → chrome-Bo9uNZ7s.js} +1 -1
  90. package/dist/chunks/clear-BxdX_MUP.js +1 -0
  91. package/dist/chunks/client-BSoJ_vaA.js +1 -0
  92. package/dist/chunks/color-CkzktPHt.js +1 -0
  93. package/dist/chunks/commands-hyVX9-Lh.js +1 -0
  94. package/dist/chunks/commitAttribution-BwT0TbYF.js +1 -0
  95. package/dist/chunks/{commitAttribution-iKd8bTOI.js → commitAttribution-csu3NO7Y.js} +1 -1
  96. package/dist/chunks/{compact-B6Muofhz.js → compact-DNGIVZRN.js} +3 -3
  97. package/dist/chunks/{companion-B_LrjSk5.js → companion-Diuav3lA.js} +1 -1
  98. package/dist/chunks/{config-CQd4IkXo.js → config-B25IrkTA.js} +1 -1
  99. package/dist/chunks/{config-CJd9kJ57.js → config-ODoYZY8i.js} +1 -1
  100. package/dist/chunks/{context-qAHTuazZ.js → context-CZ5enuPE.js} +1 -1
  101. package/dist/chunks/{context-noninteractive-DZsSp-ES.js → context-noninteractive-62P5EnN5.js} +1 -1
  102. package/dist/chunks/context-noninteractive-CjuzL9q5.js +1 -0
  103. package/dist/chunks/conversation-DyhWeHw2.js +1 -0
  104. package/dist/chunks/conversation-uY-V0SNK.js +1 -0
  105. package/dist/chunks/{copy-B2jhZndZ.js → copy-9JLr2-Xs.js} +1 -1
  106. package/dist/chunks/{createSSHSession-CKdoEmAg.js → createSSHSession-B1hTuDpB.js} +1 -1
  107. package/dist/chunks/createSession-Qurw-N4x.js +1 -0
  108. package/dist/chunks/{createSession-WkBw7wdn.js → createSession-fzjzy0aS.js} +1 -1
  109. package/dist/chunks/cron-DwR6OJuW.js +1 -0
  110. package/dist/chunks/{cronJitterConfig-2u6WAlti.js → cronJitterConfig-9OmmYmIT.js} +1 -1
  111. package/dist/chunks/{crossProjectResume-CjJISRBQ.js → crossProjectResume-B6efoIur.js} +3 -3
  112. package/dist/chunks/datadog-C-llbwzP.js +1 -0
  113. package/dist/chunks/{datadog-YsyhnDmr.js → datadog-SSxsxcC-.js} +1 -1
  114. package/dist/chunks/{desktop-BN9pHpK_.js → desktop-CQnMcbex.js} +1 -1
  115. package/dist/chunks/{diff-BTtUFuf-.js → diff-uAwKYa51.js} +1 -1
  116. package/dist/chunks/{doctor-BKBb426q.js → doctor-CBF0fkBF.js} +1 -1
  117. package/dist/chunks/{effort-ClhxMqY6.js → effort-F-bhAM2u.js} +1 -1
  118. package/dist/chunks/{entry-CJlJ47nP.js → entry-DHN_Gr1b.js} +3 -3
  119. package/dist/chunks/envLessBridgeConfig-CDVtIEWT.js +1 -0
  120. package/dist/chunks/{envLessBridgeConfig-C9UUbQCo.js → envLessBridgeConfig-Dg0hNsdi.js} +1 -1
  121. package/dist/chunks/{exit-DxY3yJrp.js → exit-CqcvZJwI.js} +1 -1
  122. package/dist/chunks/{export-DS2esu8D.js → export-c6WoGlsG.js} +1 -1
  123. package/dist/chunks/{exportRenderer-DX2L5fQ7.js → exportRenderer-CaegIP5N.js} +1 -1
  124. package/dist/chunks/{extra-usage-XJxfHsbe.js → extra-usage-Cj8fokgc.js} +1 -1
  125. package/dist/chunks/extra-usage-Dk-wcvAu.js +1 -0
  126. package/dist/chunks/{extra-usage-core-D84ifgBo.js → extra-usage-core-sHzc4eE1.js} +1 -1
  127. package/dist/chunks/{extra-usage-noninteractive-fxqxHnIt.js → extra-usage-noninteractive-D0kqrqsg.js} +1 -1
  128. package/dist/chunks/{extraUsage-P_NGI1-I.js → extraUsage-CbkqfG1U.js} +1 -1
  129. package/dist/chunks/extractMemories-BP8Opsbp.js +1 -0
  130. package/dist/chunks/{fast-CpN8lLnE.js → fast-DS3iQ1CH.js} +1 -1
  131. package/dist/chunks/fast-DklfqySb.js +1 -0
  132. package/dist/chunks/{feedback-CqRsOG3c.js → feedback-QJynmG5q.js} +1 -1
  133. package/dist/chunks/{firstPartyEventLogger-CM0V7Uev.js → firstPartyEventLogger-DlW8BUXq.js} +1 -1
  134. package/dist/chunks/{flushGate-DNutWuOE.js → flushGate-CK5B9-Zn.js} +1 -1
  135. package/dist/chunks/gates-6amRNsYl.js +1 -0
  136. package/dist/chunks/{gates-C4JvRq4i.js → gates-vlrMjO-X.js} +1 -1
  137. package/dist/chunks/{gemini-B0M6SQSG.js → gemini-B5ZRjDrh.js} +1 -1
  138. package/dist/chunks/{generateRecap-DhDOgXn3.js → generateRecap-SgRMdsyN.js} +1 -1
  139. package/dist/chunks/{generateSessionName-CoFR2wgK.js → generateSessionName-sZFzpwsq.js} +1 -1
  140. package/dist/chunks/{githubRepoPathMapping-DGiSNykv.js → githubRepoPathMapping-DUGvTwPB.js} +1 -1
  141. package/dist/chunks/{goal-DRb6pPAp.js → goal-Dy-GGn9r.js} +3 -3
  142. package/dist/chunks/{grok-emDua_hT.js → grok-BG4_buNt.js} +1 -1
  143. package/dist/chunks/{growthbook-COAneL48.js → growthbook-Br1dDRtd.js} +1 -1
  144. package/dist/chunks/{heapdump-CA6DHA8G.js → heapdump-B9PVKMxa.js} +1 -1
  145. package/dist/chunks/{help-XXY7deZm.js → help-BfWF7xij.js} +1 -1
  146. package/dist/chunks/hooks-BVrhxysz.js +1 -0
  147. package/dist/chunks/{hooks-C6zZYnDi.js → hooks-KK32pxq3.js} +2 -2
  148. package/dist/chunks/{hostAdapter-DZbdeXCV.js → hostAdapter-TBJav3vX.js} +1 -1
  149. package/dist/chunks/{ide-BLRNkzVx.js → ide-BU1A79BE.js} +2 -2
  150. package/dist/chunks/{inboundAttachments-60kD5Qt_.js → inboundAttachments-D4tBPCB8.js} +1 -1
  151. package/dist/chunks/inboundAttachments-DWJplT9p.js +1 -0
  152. package/dist/chunks/initReplBridge-99sUBVEk.js +1 -0
  153. package/dist/chunks/{insights-BBugI3tW.js → insights-lDHodCMG.js} +1 -1
  154. package/dist/chunks/{install-CuVHbwyW.js → install-Bg4ZgW81.js} +1 -1
  155. package/dist/chunks/{install-github-app-ByyzrlM9.js → install-github-app-RLbUq5EL.js} +2 -2
  156. package/dist/chunks/{install-slack-app-CJGtmacz.js → install-slack-app-CHmIwsbm.js} +1 -1
  157. package/dist/chunks/{instrumentation-C8zvzMg1.js → instrumentation-BCiV3SKX.js} +3 -3
  158. package/dist/chunks/{job-DBf6aPQX.js → job-xOGf0j5Q.js} +1 -1
  159. package/dist/chunks/{keybindings-Bi7SMp5-.js → keybindings-DMbReZ4p.js} +1 -1
  160. package/dist/chunks/{lang-CVDkUhjk.js → lang-A6LUGP_7.js} +1 -1
  161. package/dist/chunks/language-Bzp5KDCE.js +1 -0
  162. package/dist/chunks/{language-BYeqMX74.js → language-CGfURU2y.js} +1 -1
  163. package/dist/chunks/{launchAgentsPlatform-BKqxMFFn.js → launchAgentsPlatform-Dbpm7Jyo.js} +1 -1
  164. package/dist/chunks/{launchAutofixPr-CauX6gOB.js → launchAutofixPr-RZfqx5eM.js} +3 -3
  165. package/dist/chunks/{launchLocalMemory-Brrd_BJC.js → launchLocalMemory-DIntbsvg.js} +2 -2
  166. package/dist/chunks/{launchLocalVault-DtAn656A.js → launchLocalVault-CCUw0ayu.js} +3 -3
  167. package/dist/chunks/{launchMemoryStores-x7_Id7Yr.js → launchMemoryStores-QJTh8KSP.js} +1 -1
  168. package/dist/chunks/{launchOnboarding-DkamFByn.js → launchOnboarding--Pe30AYd.js} +1 -1
  169. package/dist/chunks/{launchSchedule-DjNQNxW4.js → launchSchedule-DjN1RbRX.js} +1 -1
  170. package/dist/chunks/{launchSkillStore-D2GUGhDD.js → launchSkillStore-CcKmVDz1.js} +1 -1
  171. package/dist/chunks/{launchTeleport-DTfhiZkf.js → launchTeleport-BKlEo0yF.js} +3 -3
  172. package/dist/chunks/{launchVault-BZ2Po4r8.js → launchVault-C7UHA-IG.js} +1 -1
  173. package/dist/chunks/{loadAgentsDir-C_wFhytF.js → loadAgentsDir-ClTeo0nk.js} +560 -560
  174. package/dist/chunks/loadAgentsDir-CshktEpX.js +1 -0
  175. package/dist/chunks/loadPluginHooks-DVZmzYLl.js +1 -0
  176. package/dist/chunks/localSearch-BtLNJRij.js +1 -0
  177. package/dist/chunks/{localSearch-B0p0_bjP.js → localSearch-Koc8naSr.js} +1 -1
  178. package/dist/chunks/login-BngE89_j.js +1 -0
  179. package/dist/chunks/{login-C1uE6Pg9.js → login-C3MZQTDL.js} +1 -1
  180. package/dist/chunks/{logoV2Utils-BJHvwGup.js → logoV2Utils-DAIIwt5R.js} +1 -1
  181. package/dist/chunks/logout-CXZBaUen.js +1 -0
  182. package/dist/chunks/{magicDocs-DPZzG7Z2.js → magicDocs-C_inI3JJ.js} +1 -1
  183. package/dist/chunks/{main-CNwSLti2.js → main-qqcmncHA.js} +36 -36
  184. package/dist/chunks/{mappers-Dxs_kNJH.js → mappers-7BSMbYvH.js} +1 -1
  185. package/dist/chunks/{mcp-CbDDqdzF.js → mcp-DRBiobrN.js} +1 -1
  186. package/dist/chunks/mcp-DV8Prhgi.js +1 -0
  187. package/dist/chunks/mcp-HQ8-nEZ1.js +6 -0
  188. package/dist/chunks/{mcpServer-BJNjQXsU.js → mcpServer-CLIYAgGs.js} +1 -1
  189. package/dist/chunks/{mcpServer-Py4Iz9Hx.js → mcpServer-DS0yRfcu.js} +1 -1
  190. package/dist/chunks/memory-Cz_JaFLF.js +1 -0
  191. package/dist/chunks/{mode-CqGusjoT.js → mode-Kx0kSZkr.js} +1 -1
  192. package/dist/chunks/model-Bwvn_acH.js +1 -0
  193. package/dist/chunks/{model-BBULcn7y.js → model-CNXtfiLg.js} +1 -1
  194. package/dist/chunks/{onChangeAppState-BkRihYau.js → onChangeAppState-C4ic-Mib.js} +1 -1
  195. package/dist/chunks/{openai-yNI_zoao.js → openai-CGGSfpPh.js} +3 -3
  196. package/dist/chunks/{overageCreditGrant-Cbh0_fbM.js → overageCreditGrant-BqW_6R5v.js} +1 -1
  197. package/dist/chunks/{panelCall-t10Sud9A.js → panelCall-DgPjuhQf.js} +1 -1
  198. package/dist/chunks/{passes-D_iS6DaC.js → passes-sYE91Vtr.js} +1 -1
  199. package/dist/chunks/{paths-Ci1iwL5Y.js → paths-DO4WOQtD.js} +2 -2
  200. package/dist/chunks/{permissions-CHvu4-yX.js → permissions-BPerbf1I.js} +3 -3
  201. package/dist/chunks/{pipeTransport-EAYXsubu.js → pipeTransport-CW9zF_UN.js} +1 -1
  202. package/dist/chunks/{plan-CP5nq_EB.js → plan-CDKBVRw6.js} +1 -1
  203. package/dist/chunks/{plugin-8apy_RBT.js → plugin-C6US4b8W.js} +1 -1
  204. package/dist/chunks/{pluginAutoupdate-ClrgF5b3.js → pluginAutoupdate-BQKtcAhC.js} +1 -1
  205. package/dist/chunks/{pluginBlocklist-B1LVo0j_.js → pluginBlocklist-B8DKXi0i.js} +1 -1
  206. package/dist/chunks/{pluginCliCommands-eqyMBWcP.js → pluginCliCommands-DWCeXYTl.js} +1 -1
  207. package/dist/chunks/{pluginFlagging-BiTDVP10.js → pluginFlagging-DFMlWw2P.js} +1 -1
  208. package/dist/chunks/{pluginOperations-gZ-iCmhu.js → pluginOperations-CKmwDC3G.js} +1 -1
  209. package/dist/chunks/{pluginStartupCheck-DCDWHam6.js → pluginStartupCheck-D6IbyWKe.js} +1 -1
  210. package/dist/chunks/pluginStartupCheck-cYnLsWOs.js +1 -0
  211. package/dist/chunks/{plugins-BAIVqfi8.js → plugins-BwZIRMh_.js} +1 -1
  212. package/dist/chunks/policyLimits-CFLBtFh3.js +1 -0
  213. package/dist/chunks/{pollConfig-_2W7bHoW.js → pollConfig-C3NjXYFc.js} +1 -1
  214. package/dist/chunks/{poor-Dii0mpOW.js → poor-BHhbua95.js} +1 -1
  215. package/dist/chunks/poorMode-CCK7Ek5w.js +1 -0
  216. package/dist/chunks/{poorMode-aDmmvJ_e.js → poorMode-mtlnXU-z.js} +1 -1
  217. package/dist/chunks/{print-BwSmcUQu.js → print-kxnXkqGc.js} +12 -12
  218. package/dist/chunks/{privacy-settings-DaAgSLKw.js → privacy-settings-DjY1annR.js} +1 -1
  219. package/dist/chunks/{processBashCommand-BZ1_JKu4.js → processBashCommand-BrqLqSva.js} +1 -1
  220. package/dist/chunks/processSlashCommand-DJGdVGbK.js +6 -0
  221. package/dist/chunks/prompt-BZjXpviP.js +1 -0
  222. package/dist/chunks/{prompt-6ZKyqv6z.js → prompt-CfM_xGPc.js} +1 -1
  223. package/dist/chunks/prompt-CusKF4-p.js +1 -0
  224. package/dist/chunks/{promptEditor-Dz41P-3I.js → promptEditor-FI_ewCpV.js} +2 -2
  225. package/dist/chunks/{protocolHandler-CHGHjfdf.js → protocolHandler-B7ybKpgJ.js} +1 -1
  226. package/dist/chunks/{rate-limit-options-BlU9av7g.js → rate-limit-options-DPJMNNou.js} +1 -1
  227. package/dist/chunks/{rcDebugLog-C42A0pX1.js → rcDebugLog-CwU_wJBE.js} +1 -1
  228. package/dist/chunks/{referral-IIcY3jkp.js → referral-Da4mpbd3.js} +1 -1
  229. package/dist/chunks/{refresh-DTGEx7X_.js → refresh-B6X4xb9r.js} +1 -1
  230. package/dist/chunks/{registerProtocol-BkNncGMI.js → registerProtocol-D8fFnceq.js} +1 -1
  231. package/dist/chunks/registry-y_z3pTg3.js +1 -0
  232. package/dist/chunks/{release-notes-BxzOD-zP.js → release-notes--tnd4K56.js} +1 -1
  233. package/dist/chunks/{releaseNotes-C8KQGZHq.js → releaseNotes-BPA229-J.js} +2 -2
  234. package/dist/chunks/{reload-plugins-gYyC6_g8.js → reload-plugins-yQ7tEUVh.js} +1 -1
  235. package/dist/chunks/{remote-env-CEJH5aJh.js → remote-env-CER5UxTX.js} +1 -1
  236. package/dist/chunks/{remoteBridgeCore-Dte7ZUAN.js → remoteBridgeCore-Bi31i8gt.js} +1 -1
  237. package/dist/chunks/{remoteControlServer-GN-eDbEz.js → remoteControlServer-oUAcWB4i.js} +1 -1
  238. package/dist/chunks/{rename-BEU6BNRp.js → rename-BTngRRZU.js} +1 -1
  239. package/dist/chunks/{resume-D36S2rXg.js → resume-DZHKfBmm.js} +2 -2
  240. package/dist/chunks/{runtimeObserver-CDMCeww2.js → runtimeObserver-B4KekIF0.js} +1 -1
  241. package/dist/chunks/{runtimeObserver-DaKaKNVW.js → runtimeObserver-BUOcYxiK.js} +2 -2
  242. package/dist/chunks/sandbox-adapter-C--j-c76.js +1 -0
  243. package/dist/chunks/{sandbox-toggle-BPO26t48.js → sandbox-toggle-DLBL7myN.js} +1 -1
  244. package/dist/chunks/searchExtraTools-CBYp5XeI.js +1 -0
  245. package/dist/chunks/{sentry-9EbPa1Xu.js → sentry-B7ZBc8fA.js} +1 -1
  246. package/dist/chunks/{session-D18B22u4.js → session-DWYQk9YN.js} +1 -1
  247. package/dist/chunks/{sessionDiscovery-B-OTvXJf.js → sessionDiscovery-BP0nv36F.js} +1 -1
  248. package/dist/chunks/sessionFileAccessHooks-DVilA3Mm.js +1 -0
  249. package/dist/chunks/sessionMemory-cMgcTxtP.js +1 -0
  250. package/dist/chunks/{sessionMemory-Ctauybzs.js → sessionMemory-pT4lc1C-.js} +1 -1
  251. package/dist/chunks/sessionMemoryUtils-BgYf2OvX.js +1 -0
  252. package/dist/chunks/sessionObserver-CzyEF7mg.js +1 -0
  253. package/dist/chunks/{sessionObserver-ardnTJ37.js → sessionObserver-D4SV0Ar3.js} +1 -1
  254. package/dist/chunks/sessionStorage-CXBgVAx-.js +1 -0
  255. package/dist/chunks/{sessionTitle-DEKvIVCK.js → sessionTitle-CkrnWEW1.js} +1 -1
  256. package/dist/chunks/{sessionTracing-CJUUEWZ4.js → sessionTracing-Caw-kvQr.js} +1 -1
  257. package/dist/chunks/{settingsSync-BWt3oUR7.js → settingsSync-Dn_lGonC.js} +1 -1
  258. package/dist/chunks/{setup-CDxkPTCq.js → setup-DGkOT4DX.js} +2 -2
  259. package/dist/chunks/{setup-BECFDOT9.js → setup-Dihjl7jo.js} +1 -1
  260. package/dist/chunks/{setup-CmCTB2T_.js → setup-II1titXI.js} +1 -1
  261. package/dist/chunks/{shadowedRuleDetection-BbALfdxE.js → shadowedRuleDetection-DASW3j9H.js} +1 -1
  262. package/dist/chunks/{sideQuestion-BHK6dd1q.js → sideQuestion-C1qbLTAL.js} +1 -1
  263. package/dist/chunks/sink-BSPyC453.js +1 -0
  264. package/dist/chunks/{sink-Do5fWbUC.js → sink-CqOAfFlL.js} +1 -1
  265. package/dist/chunks/{sinks-Dc9V7k6a.js → sinks-BT_lBY6T.js} +2 -2
  266. package/dist/chunks/sinks-CpuRIC3H.js +1 -0
  267. package/dist/chunks/{skill-learning-BHW9G3Dn.js → skill-learning-kh0HKn6u.js} +1 -1
  268. package/dist/chunks/skillChangeDetector-DQuNepIV.js +1 -0
  269. package/dist/chunks/{skillGapStore-Wa7s6orv.js → skillGapStore-B1gUQXhE.js} +2 -2
  270. package/dist/chunks/{skillGapStore-DVMbI2yy.js → skillGapStore-CFmLJlYm.js} +1 -1
  271. package/dist/chunks/{skillGenerator-CBuoIFsH.js → skillGenerator-DIAwRpPg.js} +2 -2
  272. package/dist/chunks/skillLearning-Bxu1Uzl-.js +1 -0
  273. package/dist/chunks/skillLearning-CxAbHYEk.js +1 -0
  274. package/dist/chunks/{skillPanel-2w82nkOl.js → skillPanel-B9zJLHKV.js} +3 -3
  275. package/dist/chunks/{skillSearchPanel-7BhCBkdh.js → skillSearchPanel-C1O9sxYS.js} +2 -2
  276. package/dist/chunks/{skills-D5rMEo2w.js → skills-C6_3snFY.js} +1 -1
  277. package/dist/chunks/{sprites-uNWgVZT6.js → sprites-59l7vF4l.js} +1 -1
  278. package/dist/chunks/{stats-D0CJB2HV.js → stats-BmGdg4nj.js} +1 -1
  279. package/dist/chunks/{status-nte1Arzy.js → status-KLPT7uYP.js} +1 -1
  280. package/dist/chunks/{statusNoticeHelpers-Lqf99003.js → statusNoticeHelpers-DuqyBY-N.js} +1 -1
  281. package/dist/chunks/{tag-BnvWS9HE.js → tag-0vahEnrx.js} +1 -1
  282. package/dist/chunks/{tasks-CEs-pxkC.js → tasks-zVPemGv7.js} +1 -1
  283. package/dist/chunks/teamHelpers-B83RwCCC.js +1 -0
  284. package/dist/chunks/{teamHelpers-D8R_gGLb.js → teamHelpers-CXAmvFco.js} +1 -1
  285. package/dist/chunks/teammateModeSnapshot-AdUFmPGC.js +1 -0
  286. package/dist/chunks/{teammateModeSnapshot-Bdra3VIJ.js → teammateModeSnapshot-CdiglTzv.js} +1 -1
  287. package/dist/chunks/teleport-D6PvdjPy.js +1 -0
  288. package/dist/chunks/{templateJobs-BDKGtmr3.js → templateJobs-Ox5ZTKjW.js} +1 -1
  289. package/dist/chunks/{terminalSetup-Bbvq-9Xl.js → terminalSetup-Dh70ynBX.js} +1 -1
  290. package/dist/chunks/{terminalSetup-C1X-sXwp.js → terminalSetup-hLCi-2uB.js} +1 -1
  291. package/dist/chunks/{theme-DXv6bV7f.js → theme-DxgUVq9C.js} +1 -1
  292. package/dist/chunks/thinkback-C5vFU8dM.js +1 -0
  293. package/dist/chunks/{thinkback-CMsW7mvG.js → thinkback-DWgU7Qhr.js} +1 -1
  294. package/dist/chunks/{thinkback-play-CFdkpzlj.js → thinkback-play-CDzY6Ux4.js} +1 -1
  295. package/dist/chunks/{toolEventObserver-CF7T7FBH.js → toolEventObserver-DPoMAJwr.js} +1 -1
  296. package/dist/chunks/{toolEventObserver-DDJV8cvW.js → toolEventObserver-jO6-mlFU.js} +1 -1
  297. package/dist/chunks/toolPool-BmA-BnAq.js +1 -0
  298. package/dist/chunks/{toolPool-BJv0sBnR.js → toolPool-Dgn1Clq8.js} +1 -1
  299. package/dist/chunks/{trustedDevice-C9nJhhyZ.js → trustedDevice-CYR5AgSB.js} +1 -1
  300. package/dist/chunks/{trustedDevice-C5s2au0k.js → trustedDevice-D35gYkBT.js} +1 -1
  301. package/dist/chunks/{ultrareviewCommand-BEv1_AS1.js → ultrareviewCommand-o4GjzoXK.js} +2 -2
  302. package/dist/chunks/{undercover-DPVt2WN7.js → undercover-B4xr62Ux.js} +1 -1
  303. package/dist/chunks/undercover-nakrQDLh.js +1 -0
  304. package/dist/chunks/{updateCCB-D-4naIUu.js → updateCCB-Cthn50OV.js} +1 -1
  305. package/dist/chunks/{upgrade-CSld83v7.js → upgrade-D4Id4ebd.js} +1 -1
  306. package/dist/chunks/upgrade-DJTCV8sr.js +1 -0
  307. package/dist/chunks/{upload-DVlE8SRp.js → upload-BFDXvdfb.js} +1 -1
  308. package/dist/chunks/{usage-D4Ubnttz.js → usage-Csbso5mD.js} +1 -1
  309. package/dist/chunks/{usage-B_bY46ep.js → usage-DxudeFLL.js} +1 -1
  310. package/dist/chunks/{useMainLoopModel-D3tJJC3y.js → useMainLoopModel-CEqP4HOc.js} +1 -1
  311. package/dist/chunks/{useManagePlugins-B4kcqcyY.js → useManagePlugins-BmS3Adja.js} +1 -1
  312. package/dist/chunks/{useMergedTools-CTQl4cdV.js → useMergedTools-wR6Bglqq.js} +1 -1
  313. package/dist/chunks/{useSearchInput-JPayBRPC.js → useSearchInput-BhKAGgEN.js} +1 -1
  314. package/dist/chunks/{useSettingsErrors-YTgPxnRZ.js → useSettingsErrors-CjK3P-Ki.js} +1 -1
  315. package/dist/chunks/{useVoice-CaBv3G13.js → useVoice-DP1hHBWA.js} +1 -1
  316. package/dist/chunks/{util-Q70qdjeS.js → util-CMSErQoz.js} +1 -1
  317. package/dist/chunks/utils-CAQfwbv8.js +1 -0
  318. package/dist/chunks/{validatePlugin-6lg9B564.js → validatePlugin-_g0AqWZG.js} +1 -1
  319. package/dist/chunks/{vim-zOsQBIp4.js → vim-8y-2Q09k.js} +1 -1
  320. package/dist/chunks/{voice-DBQevAhk.js → voice-BJAsr0K-.js} +1 -1
  321. package/dist/chunks/{voiceModeEnabled-CjBjjeNR.js → voiceModeEnabled-BD9GZhQ3.js} +1 -1
  322. package/dist/chunks/voiceModeEnabled-DZbxaFIg.js +1 -0
  323. package/dist/chunks/{voiceStreamSTT-B8CTbb_6.js → voiceStreamSTT-B1T-8adN.js} +1 -1
  324. package/dist/chunks/voiceStreamSTT-B39XaGOU.js +1 -0
  325. package/dist/chunks/{web-tools-CGqBqo07.js → web-tools-DVIvcP41.js} +1 -1
  326. package/dist/chunks/{workerRegistry-Bx6FvTZF.js → workerRegistry-60_UCyc3.js} +1 -1
  327. package/dist/chunks/worktree-DNK8NprA.js +1 -0
  328. package/dist/chunks/{xml-CVF7dWfi.js → xml-CTdKuU6f.js} +1 -1
  329. package/dist/cli.js +1 -1
  330. package/package.json +1 -1
  331. package/dist/chunks/ApproveApiKey-Cc5SaLqs.js +0 -1
  332. package/dist/chunks/BackgroundTasksDialog-OkUSMj0I.js +0 -2
  333. package/dist/chunks/ClaudeMdExternalIncludesDialog-BbPaorIs.js +0 -1
  334. package/dist/chunks/ConsoleOAuthFlow-Dyv4mI_o.js +0 -1
  335. package/dist/chunks/Doctor-CRrE5Sf4.js +0 -1
  336. package/dist/chunks/Grove-CgX5Fdeh.js +0 -1
  337. package/dist/chunks/MessageSelector-CEvbAZGv.js +0 -3
  338. package/dist/chunks/PluginSettings-D3bQRsge.js +0 -17
  339. package/dist/chunks/QueryEngine-CMcQGyql.js +0 -1
  340. package/dist/chunks/REPL-C9f3ToGu.js +0 -1
  341. package/dist/chunks/ResumeConversation-DxqbAKA4.js +0 -1
  342. package/dist/chunks/SearchExtraToolsTool-BVAhywUI.js +0 -1
  343. package/dist/chunks/SentryErrorBoundary-M1ipwe1n.js +0 -1
  344. package/dist/chunks/Settings-D5EWYL40.js +0 -2
  345. package/dist/chunks/api-BdbBnz5c.js +0 -1
  346. package/dist/chunks/assistant-BMviqf0l.js +0 -1
  347. package/dist/chunks/auth-ORBmEqnH.js +0 -1
  348. package/dist/chunks/backgroundHousekeeping-BAvSPaZ5.js +0 -1
  349. package/dist/chunks/bridgeConfig-B49H_B9L.js +0 -1
  350. package/dist/chunks/bridgeEnabled-DsG2JvIr.js +0 -1
  351. package/dist/chunks/bridgeMain-DYCShrcV.js +0 -1
  352. package/dist/chunks/caches-BsYvQnWV.js +0 -1
  353. package/dist/chunks/changeDetector-By54zja0.js +0 -1
  354. package/dist/chunks/channelNotification-Cx82K1CD.js +0 -1
  355. package/dist/chunks/clear-BQr2zTyP.js +0 -1
  356. package/dist/chunks/client-BbavFXJZ.js +0 -1
  357. package/dist/chunks/color-DOsgZO2n.js +0 -1
  358. package/dist/chunks/commands-CfwfGt3T.js +0 -1
  359. package/dist/chunks/commitAttribution-CH9C_hoL.js +0 -1
  360. package/dist/chunks/context-noninteractive-DCYvLxWx.js +0 -1
  361. package/dist/chunks/conversation-DYUVAAQt.js +0 -1
  362. package/dist/chunks/conversation-NrAy2em3.js +0 -1
  363. package/dist/chunks/createSession-Czx7_nf6.js +0 -1
  364. package/dist/chunks/cron-g_P3I5uT.js +0 -1
  365. package/dist/chunks/datadog-QSR9B7CZ.js +0 -1
  366. package/dist/chunks/envLessBridgeConfig-DSJqg3Ox.js +0 -1
  367. package/dist/chunks/extra-usage-DaxUQk9I.js +0 -1
  368. package/dist/chunks/extractMemories-B3cTWsph.js +0 -1
  369. package/dist/chunks/fast-CHiQGMBE.js +0 -1
  370. package/dist/chunks/gates-DvjyKZVA.js +0 -1
  371. package/dist/chunks/hooks-DOej0jqp.js +0 -1
  372. package/dist/chunks/inboundAttachments-BBYxcnvj.js +0 -1
  373. package/dist/chunks/initReplBridge-Dt2aQBia.js +0 -1
  374. package/dist/chunks/language-BoKr5ylY.js +0 -1
  375. package/dist/chunks/loadAgentsDir-whRB0phu.js +0 -1
  376. package/dist/chunks/loadPluginHooks-CYZjzxyO.js +0 -1
  377. package/dist/chunks/localSearch-DAwFmV2Y.js +0 -1
  378. package/dist/chunks/login-DOyB64Rv.js +0 -1
  379. package/dist/chunks/logout-DTPo3Myl.js +0 -1
  380. package/dist/chunks/mcp-CVnFM6nR.js +0 -6
  381. package/dist/chunks/mcp-CzfQB8BT.js +0 -1
  382. package/dist/chunks/memory-BdUqEKio.js +0 -1
  383. package/dist/chunks/model-BOc_-7m0.js +0 -1
  384. package/dist/chunks/pluginStartupCheck-EjLvCXru.js +0 -1
  385. package/dist/chunks/policyLimits-Cdp3QwZ1.js +0 -1
  386. package/dist/chunks/poorMode-DzEL0cu0.js +0 -1
  387. package/dist/chunks/processSlashCommand-v1Rvzxwn.js +0 -6
  388. package/dist/chunks/prompt-DPqKtC0b.js +0 -1
  389. package/dist/chunks/prompt-WjMHPk90.js +0 -1
  390. package/dist/chunks/registry-CBqb7wbi.js +0 -1
  391. package/dist/chunks/sandbox-adapter-DqTuhgud.js +0 -1
  392. package/dist/chunks/searchExtraTools-Brae4wmG.js +0 -1
  393. package/dist/chunks/sessionFileAccessHooks-BXsK8Dwf.js +0 -1
  394. package/dist/chunks/sessionMemory-Bv-AYifm.js +0 -1
  395. package/dist/chunks/sessionMemoryUtils-D-bzdsAT.js +0 -1
  396. package/dist/chunks/sessionObserver-j8D9hidw.js +0 -1
  397. package/dist/chunks/sessionStorage-Cw5ibYWA.js +0 -1
  398. package/dist/chunks/sink-DFWgcGHX.js +0 -1
  399. package/dist/chunks/sinks-BnkxTOU9.js +0 -1
  400. package/dist/chunks/skillChangeDetector-DwAvG835.js +0 -1
  401. package/dist/chunks/skillLearning-BI2YDG3K.js +0 -1
  402. package/dist/chunks/skillLearning-BZMJRJPp.js +0 -1
  403. package/dist/chunks/teamHelpers-D4vCj2hP.js +0 -1
  404. package/dist/chunks/teammateModeSnapshot-BDJ1JTcl.js +0 -1
  405. package/dist/chunks/teleport-RxTr4aCi.js +0 -1
  406. package/dist/chunks/thinkback-DRJBz3Is.js +0 -1
  407. package/dist/chunks/toolPool-0zCdXfEu.js +0 -1
  408. package/dist/chunks/undercover-DYa00dVv.js +0 -1
  409. package/dist/chunks/upgrade-BHj8ALep.js +0 -1
  410. package/dist/chunks/utils-Cr-x1Oyd.js +0 -1
  411. package/dist/chunks/voiceModeEnabled-DK6u8Aaj.js +0 -1
  412. package/dist/chunks/voiceStreamSTT-CCkOfmdI.js +0 -1
  413. package/dist/chunks/worktree-DPpgPLLG.js +0 -1
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Tn as t,wn as n}from"./src-Di342QoJ.js";import{Ct as r,cn as i}from"./state-sIHsFpDu.js";import{et as a}from"./log-DSV4Ht5l.js";import{Uo as o,by as s,gy as c,ho as l}from"./loadAgentsDir-C_wFhytF.js";import{fn as u}from"./prompt-6ZKyqv6z.js";import{randomUUID as d}from"crypto";function f(e){return e.flatMap(e=>{switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??d(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function p(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function m(e){let t=e,n=t.preserved_segment;return{trigger:t.trigger,preTokens:t.pre_tokens,...n&&{preservedSegment:{headUuid:n.head_uuid,anchorUuid:n.anchor_uuid,tailUuid:n.tail_uuid}}}}function h(e){return e.flatMap(e=>{switch(e.type){case`assistant`:return[{type:`assistant`,message:v(e),session_id:r(),parent_tool_use_id:null,uuid:e.uuid,error:e.error}];case`user`:return[{type:`user`,message:e.message,session_id:r(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly,...e.toolUseResult===void 0?{}:{tool_use_result:e.toolUseResult}}];case`system`:return e.subtype===`compact_boundary`&&e.compactMetadata?[{type:`system`,subtype:`compact_boundary`,session_id:r(),uuid:e.uuid,compact_metadata:p(e.compactMetadata)}]:e.subtype===`local_command`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))?[g(e.content,e.uuid)]:[];default:return[]}})}function g(e,n){let i=l({content:t(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:i.message?.content,message:i.message,parent_tool_use_id:null,session_id:r(),uuid:n}}function _(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}function v(e){let t=e.message.content;if(!Array.isArray(t))return e.message;let n=t.map(e=>{if(e.type!==`tool_use`)return e;if(e.name===`ExitPlanMode`){let t=c();if(t)return{...e,input:{...e.input,plan:t}}}return e});return{...e.message,content:n}}var y=e((()=>{i(),a(),u(),n(),o(),s()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Tn as t,wn as n}from"./src-Di342QoJ.js";import{Ct as r,cn as i}from"./state-sIHsFpDu.js";import{et as a}from"./log-DSV4Ht5l.js";import{Uo as o,ho as s,my as c,vy as l}from"./loadAgentsDir-ClTeo0nk.js";import{fn as u}from"./prompt-CfM_xGPc.js";import{randomUUID as d}from"crypto";function f(e){return e.flatMap(e=>{switch(e.type){case`assistant`:return[{type:`assistant`,message:e.message,uuid:e.uuid,requestId:void 0,timestamp:new Date().toISOString()}];case`user`:return[{type:`user`,message:e.message,uuid:e.uuid??d(),timestamp:e.timestamp??new Date().toISOString(),isMeta:e.isSynthetic}];default:return[]}})}function p(e){let t=e.preservedSegment;return{trigger:e.trigger,pre_tokens:e.preTokens,...t&&{preserved_segment:{head_uuid:t.headUuid,anchor_uuid:t.anchorUuid,tail_uuid:t.tailUuid}}}}function m(e){let t=e,n=t.preserved_segment;return{trigger:t.trigger,preTokens:t.pre_tokens,...n&&{preservedSegment:{headUuid:n.head_uuid,anchorUuid:n.anchor_uuid,tailUuid:n.tail_uuid}}}}function h(e){return e.flatMap(e=>{switch(e.type){case`assistant`:return[{type:`assistant`,message:v(e),session_id:r(),parent_tool_use_id:null,uuid:e.uuid,error:e.error}];case`user`:return[{type:`user`,message:e.message,session_id:r(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isSynthetic:e.isMeta||e.isVisibleInTranscriptOnly,...e.toolUseResult===void 0?{}:{tool_use_result:e.toolUseResult}}];case`system`:return e.subtype===`compact_boundary`&&e.compactMetadata?[{type:`system`,subtype:`compact_boundary`,session_id:r(),uuid:e.uuid,compact_metadata:p(e.compactMetadata)}]:e.subtype===`local_command`&&(e.content.includes(`<local-command-stdout>`)||e.content.includes(`<local-command-stderr>`))?[g(e.content,e.uuid)]:[];default:return[]}})}function g(e,n){let i=s({content:t(e).replace(/<local-command-stdout>([\s\S]*?)<\/local-command-stdout>/,`$1`).replace(/<local-command-stderr>([\s\S]*?)<\/local-command-stderr>/,`$1`).trim()});return{type:`assistant`,content:i.message?.content,message:i.message,parent_tool_use_id:null,session_id:r(),uuid:n}}function _(e){if(e)return{type:`rate_limit`,status:e.status,...e.resetsAt!==void 0&&{resetsAt:e.resetsAt},...e.rateLimitType!==void 0&&{rateLimitType:e.rateLimitType},...e.utilization!==void 0&&{utilization:e.utilization},...e.overageStatus!==void 0&&{overageStatus:e.overageStatus},...e.overageResetsAt!==void 0&&{overageResetsAt:e.overageResetsAt},...e.overageDisabledReason!==void 0&&{overageDisabledReason:e.overageDisabledReason},...e.isUsingOverage!==void 0&&{isUsingOverage:e.isUsingOverage},...e.surpassedThreshold!==void 0&&{surpassedThreshold:e.surpassedThreshold}}}function v(e){let t=e.message.content;if(!Array.isArray(t))return e.message;let n=t.map(e=>{if(e.type!==`tool_use`)return e;if(e.name===`ExitPlanMode`){let t=c();if(t)return{...e,input:{...e.input,plan:t}}}return e});return{...e.message,content:n}}var y=e((()=>{i(),a(),u(),n(),o(),l()}));export{p as a,f as i,y as n,h as o,g as r,_ as s,m as t};
@@ -1,2 +1,2 @@
1
- import{B as e,M as t,d as n,n as r,t as i}from"./server-DzOdtq8A.js";import{Dr as a,Pr as o}from"./paths-Ci1iwL5Y.js";import{E as s,O as c}from"./debug-otxXY3j-.js";import{o as l,s as u}from"./log-DSV4Ht5l.js";import{$D as d,$u as f,Ba as p,G as m,K as h,Qu as g,Uo as _,bD as v,cl as y,eO as b,fu as x,ho as S,mh as C,ph as w,pu as T,sl as E,yD as D,za as O}from"./loadAgentsDir-C_wFhytF.js";import{Qn as k,Xn as A,Zn as j}from"./prompt-6ZKyqv6z.js";import{a as M,o as N}from"./fileStateCache-BhVfo23e.js";import{n as P,t as F}from"./stdio-Cg20AQ5W.js";r(),P(),e(),v(),O(),k(),f(),b(),N(),l(),_(),o(),h(),w(),s(),T(),E();var I=[p];async function L(e,r,o){let s=M(100);C(e);let l=new i({name:`claude/tengu`,version:`2.7.1`},{capabilities:{tools:{}}});l.setRequestHandler(t,async()=>{let e=j(),t=g(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=y(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:y(n.inputSchema),outputSchema:r}}))}}),l.setRequestHandler(n,async({params:{name:e,arguments:t}})=>{let n=g(j()),i=A(n,e);if(!i)throw Error(`Tool ${e} not found`);let l={abortController:d(),options:{commands:I,tools:n,mainLoopModel:a(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:r,verbose:o,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>D(),setAppState:()=>{},messages:[],readFileState:s,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!i.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await i.validateInput?.(t??{},l);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${`message`in n?n.message:String(n)}`);let r=await i.call(t??{},l,m,S({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:c(r.data)}]}}catch(e){return u(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?x(e):[String(e)]).filter(Boolean).join(`
1
+ import{B as e,M as t,d as n,n as r,t as i}from"./server-DzOdtq8A.js";import{Dr as a,Pr as o}from"./paths-DO4WOQtD.js";import{E as s,O as c}from"./debug-otxXY3j-.js";import{o as l,s as u}from"./log-DSV4Ht5l.js";import{$D as d,Ba as f,G as p,K as m,Kf as h,Uo as g,Xu as _,Zu as v,bD as y,cl as b,eO as x,ho as S,mh as C,ph as w,qf as T,sl as E,yD as D,za as O}from"./loadAgentsDir-ClTeo0nk.js";import{Qn as k,Xn as A,Zn as j}from"./prompt-CfM_xGPc.js";import{a as M,o as N}from"./fileStateCache-BhVfo23e.js";import{n as P,t as F}from"./stdio-Cg20AQ5W.js";r(),P(),e(),y(),O(),k(),v(),x(),N(),l(),g(),o(),m(),w(),s(),T(),E();var I=[f];async function L(e,r,o){let s=M(100);C(e);let l=new i({name:`claude/tengu`,version:`2.7.2`},{capabilities:{tools:{}}});l.setRequestHandler(t,async()=>{let e=j(),t=_(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=b(n.outputSchema);typeof e==`object`&&e&&`type`in e&&e.type===`object`&&(r=e)}return{...n,description:await n.prompt({getToolPermissionContext:async()=>e,tools:t,agents:[]}),inputSchema:b(n.inputSchema),outputSchema:r}}))}}),l.setRequestHandler(n,async({params:{name:e,arguments:t}})=>{let n=_(j()),i=A(n,e);if(!i)throw Error(`Tool ${e} not found`);let l={abortController:d(),options:{commands:I,tools:n,mainLoopModel:a(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:r,verbose:o,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>D(),setAppState:()=>{},messages:[],readFileState:s,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!i.isEnabled())throw Error(`Tool ${e} is not enabled`);let n=await i.validateInput?.(t??{},l);if(n&&!n.result)throw Error(`Tool ${e} input is invalid: ${`message`in n?n.message:String(n)}`);let r=await i.call(t??{},l,p,S({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:c(r.data)}]}}catch(e){return u(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?h(e):[String(e)]).filter(Boolean).join(`
2
2
  `).trim()||`Error`}]}}});async function f(){let e=new F;await l.connect(e)}return await f()}export{L as startMCPServer};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{Q as i,Rn as a,T as o,b as s,f as c,g as l,h as u,nt as d,t as f,tt as p,v as m,x as h}from"./src-Di342QoJ.js";import{t as g}from"./jsx-runtime-D-D469L8.js";import{l as _,u as v}from"./debug-otxXY3j-.js";import{l as y,n as b,o as x}from"./stringUtils-KZoO4GUd.js";import{$C as S,Cw as C,DC as w,EC as T,JC as E,Ky as D,Ow as O,Ry as ee,Tw as k,Wy as A,YC as j,aS as M,dC as te,ew as ne,gw as N,lC as P,uC as F}from"./loadAgentsDir-ClTeo0nk.js";import{D as re,O as ie}from"./rcDebugLog-CwU_wJBE.js";import{t as ae}from"./useKeybinding-DPOUuymz.js";import{i as oe,n as se,r as ce}from"./MCPConnectionManager-y97Inszc.js";import{n as le,t as ue}from"./McpParsingWarnings-DMFUZw92.js";import{a as de,c as I,i as L,l as fe,n as pe,o as R,r as me,s as he,t as ge,u as z}from"./PluginSettings-B_xVgTTp.js";function _e({agentServer:e,onCancel:t,onComplete:n}){let[a]=o(),[d,f]=(0,B.useState)(!1),[g,_]=(0,B.useState)(null),[v,y]=(0,B.useState)(null),x=(0,B.useRef)(null);(0,B.useEffect)(()=>()=>x.current?.abort(),[]),p(`confirm:no`,(0,B.useCallback)(()=>{d&&(x.current?.abort(),x.current=null,f(!1),y(null))},[d]),{context:`Confirmation`,isActive:d});let S=(0,B.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;f(!0),_(null);let t=new AbortController;x.current=t;try{let r={type:e.transport,url:e.url};await ne(e.name,r,y,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof E)&&_(e.message)}finally{f(!1),x.current=null}},[e,n]),C=b(String(e.name));if(d)return(0,V.jsxs)(h,{flexDirection:`column`,gap:1,padding:1,children:[(0,V.jsxs)(s,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,V.jsxs)(h,{children:[(0,V.jsx)(A,{}),(0,V.jsx)(s,{children:` A browser window will open for authentication`})]}),v&&(0,V.jsxs)(h,{flexDirection:`column`,children:[(0,V.jsx)(s,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,V.jsx)(i,{url:v})]}),(0,V.jsx)(h,{marginLeft:3,children:(0,V.jsxs)(s,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,V.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let w=[];return e.needsAuth&&w.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),w.push({label:`Back`,value:`back`}),(0,V.jsxs)(c,{title:`${C} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,V.jsxs)(s,{children:[`Press `,e.keyName,` again to exit`]}):(0,V.jsxs)(u,{children:[(0,V.jsx)(l,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(l,{shortcut:`Enter`,action:`confirm`}),(0,V.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,V.jsxs)(h,{flexDirection:`column`,gap:0,children:[(0,V.jsxs)(h,{children:[(0,V.jsx)(s,{bold:!0,children:`Type: `}),(0,V.jsx)(s,{dimColor:!0,children:e.transport})]}),e.url&&(0,V.jsxs)(h,{children:[(0,V.jsx)(s,{bold:!0,children:`URL: `}),(0,V.jsx)(s,{dimColor:!0,children:e.url})]}),e.command&&(0,V.jsxs)(h,{children:[(0,V.jsx)(s,{bold:!0,children:`Command: `}),(0,V.jsx)(s,{dimColor:!0,children:e.command})]}),(0,V.jsxs)(h,{children:[(0,V.jsx)(s,{bold:!0,children:`Used by: `}),(0,V.jsx)(s,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,V.jsxs)(h,{marginTop:1,children:[(0,V.jsx)(s,{bold:!0,children:`Status: `}),(0,V.jsxs)(s,{children:[m(`inactive`,a)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,V.jsxs)(h,{children:[(0,V.jsx)(s,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,V.jsxs)(s,{children:[m(`success`,a)(r.tick),` authenticated`]}):(0,V.jsxs)(s,{children:[m(`warning`,a)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,V.jsx)(h,{children:(0,V.jsx)(s,{dimColor:!0,children:`This server connects only when running the agent.`})}),g&&(0,V.jsx)(h,{children:(0,V.jsxs)(s,{color:`error`,children:[`Error: `,g]})}),(0,V.jsx)(h,{children:(0,V.jsx)(M,{options:w,onChange:async e=>{switch(e){case`auth`:await S();break;case`back`:t();break}},onCancel:t})})]})}var B,V,H=e((()=>{n(),B=t(a(),1),f(),ae(),S(),x(),w(),ee(),D(),V=g()}));function U(e){switch(e){case`project`:return{label:`Project MCPs`,path:N(e)};case`user`:return{label:`User MCPs`,path:N(e)};case`local`:return{label:`Local MCPs`,path:N(e)};case`enterprise`:return{label:`Enterprise MCPs`};case`dynamic`:return{label:`Built-in MCPs`,path:`always available`};default:return{label:e}}}function ve(e){let t=new Map;for(let n of e){let e=n.scope;t.has(e)||t.set(e,[]),t.get(e).push(n)}for(let[,e]of t)e.sort((e,t)=>e.name.localeCompare(t.name));return t}function ye({servers:e,agentServers:t=[],onSelectServer:n,onSelectAgentServer:a,onComplete:f}){let[p]=o(),[g,_]=(0,W.useState)(0),b=W.useMemo(()=>ve(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),x=W.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),S=W.useMemo(()=>(b.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[b]),C=U(`dynamic`),w=W.useMemo(()=>{let e=[];for(let t of K){let n=b.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of x)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of S)e.push({type:`server`,server:t});return e},[b,x,t,S]),E=(0,W.useCallback)(()=>{f(`MCP dialog dismissed`,{display:`system`})},[f]);d({"confirm:previous":()=>_(e=>e===0?w.length-1:e-1),"confirm:next":()=>_(e=>e===w.length-1?0:e+1),"confirm:yes":(0,W.useCallback)(()=>{let e=w[g];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&a&&a(e.agentServer))},[w,g,n,a]),"confirm:no":E},{context:`Confirmation`});let D=e=>w.findIndex(t=>t.type===`server`&&t.server===e),O=e=>w.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),ee=v(),k=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let A=e=>{let t=D(e),n=g===t,i=``,a=``;if(e.client.type===`disabled`)i=m(`inactive`,p)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=m(`success`,p)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=m(`inactive`,p)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=m(`warning`,p)(r.triangleUpOutline),a=`needs authentication`):(i=m(`error`,p)(r.cross),a=`failed`);return(0,G.jsxs)(h,{children:[(0,G.jsx)(s,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,G.jsx)(s,{color:n?`suggestion`:void 0,children:e.name}),(0,G.jsxs)(s,{dimColor:!n,children:[` · `,i,` `]}),(0,G.jsx)(s,{dimColor:!n,children:a})]},`${e.name}-${t}`)},j=e=>{let t=O(e),n=g===t,i=e.needsAuth?m(`warning`,p)(r.triangleUpOutline):m(`inactive`,p)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,G.jsxs)(h,{children:[(0,G.jsx)(s,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,G.jsx)(s,{color:n?`suggestion`:void 0,children:e.name}),(0,G.jsxs)(s,{dimColor:!n,children:[` · `,i,` `]}),(0,G.jsx)(s,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},M=e.length+t.length;return(0,G.jsxs)(h,{flexDirection:`column`,children:[(0,G.jsx)(ue,{}),(0,G.jsx)(c,{title:`Manage MCP servers`,subtitle:`${M} ${y(M,`server`)}`,onCancel:E,hideInputGuide:!0,children:(0,G.jsxs)(h,{flexDirection:`column`,children:[K.map(e=>{let t=b.get(e);if(!t||t.length===0)return null;let n=U(e);return(0,G.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsxs)(h,{paddingLeft:2,children:[(0,G.jsx)(s,{bold:!0,children:n.label}),n.path&&(0,G.jsxs)(s,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>A(e))]},e)}),x.length>0&&(0,G.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(h,{paddingLeft:2,children:(0,G.jsx)(s,{bold:!0,children:`claude.ai`})}),x.map(e=>A(e))]}),t.length>0&&(0,G.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsx)(h,{paddingLeft:2,children:(0,G.jsx)(s,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,G.jsxs)(h,{flexDirection:`column`,marginTop:1,children:[(0,G.jsx)(h,{paddingLeft:2,children:(0,G.jsxs)(s,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>j(e))]},e))]}),S.length>0&&(0,G.jsxs)(h,{flexDirection:`column`,marginBottom:1,children:[(0,G.jsxs)(h,{paddingLeft:2,children:[(0,G.jsx)(s,{bold:!0,children:C.label}),C.path&&(0,G.jsxs)(s,{dimColor:!0,children:[` (`,C.path,`)`]})]}),S.map(e=>A(e))]}),(0,G.jsxs)(h,{flexDirection:`column`,children:[k&&(0,G.jsx)(s,{dimColor:!0,children:ee?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,G.jsxs)(s,{dimColor:!0,children:[(0,G.jsx)(i,{url:`https://code.claude.com/docs/en/mcp`,children:`https://code.claude.com/docs/en/mcp`}),` for help`]})]})]})}),(0,G.jsx)(h,{paddingX:1,children:(0,G.jsx)(s,{dimColor:!0,italic:!0,children:(0,G.jsxs)(u,{children:[(0,G.jsx)(l,{shortcut:`↑↓`,action:`navigate`}),(0,G.jsx)(l,{shortcut:`Enter`,action:`confirm`}),(0,G.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var W,G,K,be=e((()=>{n(),W=t(a(),1),f(),ae(),O(),_(),x(),w(),le(),G=g(),K=[`project`,`local`,`user`,`enterprise`]}));function xe({serverName:e,onComplete:t}){let[n]=o(),i=te(),a=ce(),[c,l]=(0,q.useState)(!0),[u,d]=(0,q.useState)(null);return(0,q.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){d(`MCP server "${e}" not found`),l(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:l(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:d(`${e} requires authentication`),l(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:d(`Failed to reconnect to ${e}`),l(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);d(n),l(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),c?(0,J.jsxs)(h,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(s,{color:`text`,children:[`Reconnecting to `,(0,J.jsx)(s,{bold:!0,children:e})]}),(0,J.jsxs)(h,{children:[(0,J.jsx)(A,{}),(0,J.jsx)(s,{children:` Establishing connection to MCP server`})]})]}):u?(0,J.jsxs)(h,{flexDirection:`column`,gap:1,padding:1,children:[(0,J.jsxs)(h,{children:[(0,J.jsxs)(s,{children:[m(`error`,n)(r.cross),` `]}),(0,J.jsxs)(s,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,J.jsxs)(s,{dimColor:!0,children:[`Error: `,u]})]}):null}var q,J,Y=e((()=>{n(),q=t(a(),1),f(),se(),P(),D(),J=g()}));function Se({onComplete:e}){let t=F(e=>e.mcp),n=F(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>C(n.allAgents),[n.allAgents]),l=X.useMemo(()=>r.filter(e=>e.name!==`ide`).sort((e,t)=>e.name.localeCompare(t.name)),[r]);switch(X.useEffect(()=>{let e=!1;async function n(){let n=await Promise.all(l.map(async e=>{let n=e.config.scope,r=e.config.type===`sse`,i=e.config.type===`http`,a=e.config.type===`claudeai-proxy`,o;if(r||i){let n=await new j(e.name,e.config).tokens(),r=re()!==null&&e.type===`connected`,i=e.type===`connected`&&k(t.tools,e.name).length>0;o=!!n||r||i}let s={name:e.name,client:e,scope:n};return a?{...s,transport:`claudeai-proxy`,isAuthenticated:!1,config:e.config}:r?{...s,transport:`sse`,isAuthenticated:o,config:e.config}:i?{...s,transport:`http`,isAuthenticated:o,config:e.config}:{...s,transport:`stdio`,config:e.config}}));e||s(n)}return n(),()=>{e=!0}},[l,t.tools]),(0,X.useEffect)(()=>{o.length===0&&l.length>0||o.length===0&&c.length===0&&e("No MCP servers configured. Please run /doctor if this is unexpected. Otherwise, run `claude mcp --help` or visit https://code.claude.com/docs/en/mcp to learn more.")},[o.length,l.length,c.length,e]),i.type){case`list`:return(0,Z.jsx)(ye,{servers:o,agentServers:c,onSelectServer:e=>a({type:`server-menu`,server:e}),onSelectAgentServer:e=>a({type:`agent-server-menu`,agentServer:e}),onComplete:e,defaultTab:i.defaultTab});case`server-menu`:{let n=k(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Claude Code`;return i.server.transport===`stdio`?(0,Z.jsx)(he,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e}):(0,Z.jsx)(fe,{server:i.server,serverToolsCount:n.length,onViewTools:()=>a({type:`server-tools`,server:i.server}),onCancel:()=>a({type:`list`,defaultTab:r}),onComplete:e})}case`server-tools`:return(0,Z.jsx)(me,{server:i.server,onSelectTool:(e,t)=>a({type:`server-tool-detail`,server:i.server,toolIndex:t}),onBack:()=>a({type:`server-menu`,server:i.server})});case`server-tool-detail`:{let e=k(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(de,{tool:e,server:i.server,onBack:()=>a({type:`server-tools`,server:i.server})}):(a({type:`server-tools`,server:i.server}),null)}case`agent-server-menu`:return(0,Z.jsx)(_e,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,Ce=e((()=>{X=t(a(),1),S(),O(),P(),ie(),H(),be(),z(),I(),R(),L(),Z=g()})),we=e((()=>{H(),be(),Y(),z(),Ce(),I(),R(),L()}));function Te({action:e,target:t,onComplete:n}){let r=F(e=>e.mcp.clients),i=oe(),a=(0,Q.useRef)(!1);return(0,Q.useEffect)(()=>{if(a.current)return;a.current=!0;let o=e===`enable`,s=r.filter(e=>e.name!==`ide`),c=t===`all`?s.filter(e=>o?e.type===`disabled`:e.type!==`disabled`):s.filter(e=>e.name===t);if(c.length===0){n(t===`all`?`All MCP servers are already ${o?`enabled`:`disabled`}`:`MCP server "${t}" not found`);return}for(let e of c)i(e.name);n(t===`all`?`${o?`Enabled`:`Disabled`} ${c.length} MCP server(s)`:`MCP server "${t}" ${o?`enabled`:`disabled`}`)},[e,t,r,i,n]),null}async function Ee(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Se,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(xe,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Te,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return process.env.USER_TYPE===`ant`?(0,$.jsx)(ge,{onComplete:e,args:`manage`,showMcpRedirectMessage:!0}):(0,$.jsx)(Se,{onComplete:e})}var Q,$;e((()=>{Q=t(a(),1),we(),Y(),se(),P(),pe(),$=g()}))();export{Ee as call};
@@ -0,0 +1,6 @@
1
+ import{o as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./p-map-D7WEmnBE.js";import{Mt as r,Rn as i,T as a,b as o,f as s,g as c,h as ee,t as l,v as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Sc as p,dc as m,lc as h,yc as g}from"./paths-DO4WOQtD.js";import{K as _,U as v}from"./debug-otxXY3j-.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{n as x,o as S}from"./process-DMKLUQIO.js";import{i as C,o as w}from"./platform-mh9ypxS8.js";import{s as T,u as te}from"./types-KeqFPzY5.js";import{l as E,o as ne}from"./stringUtils-KZoO4GUd.js";import{$C as re,$x as ie,By as ae,DC as oe,Dw as D,EC as O,Fy as k,Gw as A,Iw as j,Ow as M,Py as N,QC as P,Rw as F,SE as I,Vw as L,XC as R,Yx as z,ZC as B,_w as V,cC as H,gw as U,jw as W,lC as G,rw as K,tS as se,tw as ce,wE as q,zw as le,zy as ue}from"./loadAgentsDir-ClTeo0nk.js";import{n as J,t as Y}from"./exit-DOBLl8jN.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";n();var X=e(i(),1);q(),x(),l(),L(),ne(),oe(),ae();var Z=f();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[i,l]=(0,X.useState)({});(0,X.useEffect)(()=>{j().then(({servers:e})=>l(e))},[]);let f=r.filter(e=>i[e]!==void 0);async function p(n){let r=0;for(let a of n){let n=e[a];if(n){let e=a;if(i[e]!==void 0){let t=1;for(;i[`${a}_${t}`]!==void 0;)t++;e=`${a}_${t}`}await W(e,n,t),r++}}h(r)}let[m]=a(),h=(0,X.useCallback)(e=>{S(e>0?`\n${u(`success`,m)(`Successfully imported ${e} MCP ${E(e,`server`)} to ${t} config.`)}\n`:`
2
+ No servers were imported.`),n(),I()},[m,t,n]),g=(0,X.useCallback)(()=>{h(0)},[h]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(s,{title:`Import MCP Servers from Claude Desktop`,subtitle:`Found ${r.length} MCP ${E(r.length,`server`)} in Claude Desktop.`,color:`success`,onCancel:g,hideInputGuide:!0,children:[f.length>0&&(0,Z.jsx)(o,{color:`warning`,children:`Note: Some servers already exist with the same name. If selected, they will be imported with a numbered suffix.`}),(0,Z.jsx)(o,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(ue,{options:r.map(e=>({label:`${e}${f.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!f.includes(e)),onSubmit:p,onCancel:g,hideIndexes:!0})]}),(0,Z.jsx)(d,{paddingX:1,children:(0,Z.jsx)(o,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(ee,{children:[(0,Z.jsx)(c,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(c,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(O,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}l(),k(),y(),re(),se(),L(),M(),G(),g(),v(),q(),T(),w();async function Q(e,t){try{let n=await z(e,t);return n.type===`connected`?`✓ Connected`:n.type===`needs-auth`?`! Needs authentication`:`✗ Failed to connect`}catch{return`✗ Connection error`}}async function me({debug:e,verbose:t}){let n=fe();b(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw _(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-DGkOT4DX.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-DRBiobrN.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let n=F(e),r=()=>{n&&(n.type===`sse`||n.type===`http`)&&(B(e,n),R(e,n))};try{if(t.scope){let n=V(t.scope);b(`tengu_mcp_delete`,{name:e,scope:n}),await A(e,n),r(),process.stdout.write(`Removed MCP server ${e} from ${n} config\n`),J(`File modified: ${U(n)}`)}let n=h(),i=m(),{servers:a}=le(`project`),o=!!a[e],s=[];if(n.mcpServers?.[e]&&s.push(`local`),o&&s.push(`project`),i.mcpServers?.[e]&&s.push(`user`),s.length===0)Y(`No MCP server found with name: "${e}"`);else if(s.length===1){let t=s[0];b(`tengu_mcp_delete`,{name:e,scope:t}),await A(e,t),r(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${U(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),s.forEach(e=>{process.stderr.write(` - ${D(e)} (${U(e)})\n`)}),process.stderr.write(`
3
+ To remove from a specific scope, use:
4
+ `),s.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){b(`tengu_mcp_list`,{});let{servers:e}=await j();if(Object.keys(e).length===0)console.log("No MCP servers configured. Use `claude mcp add` to add a server.");else{console.log(`Checking MCP server health...
5
+ `);let n=await t(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:ie()});for(let{name:e,server:t,status:r}of n)if(t.type===`sse`)console.log(`${e}: ${t.url} (SSE) - ${r}`);else if(t.type===`http`)console.log(`${e}: ${t.url} (HTTP) - ${r}`);else if(t.type===`claudeai-proxy`)console.log(`${e}: ${t.url} - ${r}`);else if(!t.type||t.type===`stdio`){let n=t,i=Array.isArray(n.args)?n.args:[];console.log(`${e}: ${n.command} ${i.join(` `)} - ${r}`)}}await I(0)}async function $(e){b(`tengu_mcp_get`,{name:e});let t=F(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${D(t.scope)}`);let n=await Q(e,t);if(console.log(` Status: ${n}`),t.type===`sse`){if(console.log(` Type: sse`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),P(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`http`){if(console.log(` Type: http`),console.log(` URL: ${t.url}`),t.headers){console.log(` Headers:`);for(let[e,n]of Object.entries(t.headers))console.log(` ${e}: ${n}`)}if(t.oauth?.clientId||t.oauth?.callbackPort){let n=[];t.oauth.clientId&&(n.push(`client_id configured`),P(e,t)?.clientSecret&&n.push(`client_secret configured`)),t.oauth.callbackPort&&n.push(`callback_port ${t.oauth.callbackPort}`),console.log(` OAuth: ${n.join(`, `)}`)}}else if(t.type===`stdio`){console.log(` Type: stdio`),console.log(` Command: ${t.command}`);let e=Array.isArray(t.args)?t.args:[];if(console.log(` Args: ${e.join(` `)}`),t.env){console.log(` Environment:`);for(let[e,n]of Object.entries(t.env))console.log(` ${e}=${n}`)}}console.log(`\nTo remove this server, run: claude mcp remove "${e}" -s ${t.scope}`),await I(0)}async function _e(e,t,n){try{let r=V(n.scope),i=te(t),a=n.clientSecret&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&`oauth`in i&&i.oauth&&typeof i.oauth==`object`&&`clientId`in i.oauth?await ce():void 0;await W(e,i,r);let o=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;a&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&K(e,{type:i.type,url:i.url},a),b(`tengu_mcp_add`,{scope:r,source:`json`,type:o}),J(`Added ${o} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=V(e.scope);b(`tengu_mcp_add`,{scope:t,platform:C(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-BqTW_pbB.js`),i=await n();Object.keys(i).length===0&&J(`No MCP servers found in Claude Desktop configuration or configuration file does not exist.`);let{unmount:a}=await r((0,Z.jsx)(H,{children:(0,Z.jsx)(N,{children:(0,Z.jsx)(pe,{servers:i,scope:t,onDone:()=>{a()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){b(`tengu_mcp_reset_mcpjson_choices`,{}),p(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
6
+ You will be prompted for approval next time you start Claude Code.`)}export{ve as mcpAddFromDesktopHandler,_e as mcpAddJsonHandler,$ as mcpGetHandler,ge as mcpListHandler,he as mcpRemoveHandler,ye as mcpResetChoicesHandler,me as mcpServeHandler};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{B as t,M as n}from"./server-DzOdtq8A.js";import{M as r,oc as i,yc as a,z as o}from"./paths-Ci1iwL5Y.js";import{l as s,p as c}from"./debug-otxXY3j-.js";import{r as l,t as u}from"./datadog-YsyhnDmr.js";import{i as d,r as f,t as p}from"./src-Cu58IYYb.js";import{i as m,t as h}from"./gates-C4JvRq4i.js";import{n as g,t as _}from"./hostAdapter-DZbdeXCV.js";import{n as v,t as y}from"./stdio-Cg20AQ5W.js";import{r as b,t as x}from"./sink-Do5fWbUC.js";import{homedir as S}from"os";function C(e,t){if(k.some(t=>e.startsWith(t)))return!0;if(t){let n=t.endsWith(`/`)?`${t}Applications/`:`${t}/Applications/`;if(e.startsWith(n))return!0}return!1}function w(e){return A.some(t=>t.test(e))}function T(e,t){let n=new Set;return e.map(e=>e.trim()).filter(e=>!e||e.length>N||t&&!M.test(e)||n.has(e)?!1:(n.add(e),!0)).sort((e,t)=>e.localeCompare(t))}function E(e){let t=T(e,!0);return t.length<=P?t:[...t.slice(0,P),`… and ${t.length-P} more`]}function D(e){return T(e,!1)}function O(e,t){let{alwaysKept:n,rest:r}=e.reduce((e,n)=>(j.has(n.bundleId)?e.alwaysKept.push(n.displayName):C(n.path,t)&&!w(n.displayName)&&e.rest.push(n.displayName),e),{alwaysKept:[],rest:[]}),i=D(n),a=new Set(i);return[...i,...E(r).filter(e=>!a.has(e))]}var k,A,j,M,N,P,F=e((()=>{k=[`/Applications/`,`/System/Applications/`],A=[/Helper(?:$|\s\()/,/Agent(?:$|\s\()/,/Service(?:$|\s\()/,/Uninstaller(?:$|\s\()/,/Updater(?:$|\s\()/,/^\./],j=new Set(`com.apple.Safari,com.google.Chrome,com.microsoft.edgemac,org.mozilla.firefox,company.thebrowser.Browser,com.tinyspeck.slackmacgap,us.zoom.xos,com.microsoft.teams2,com.microsoft.teams,com.apple.MobileSMS,com.apple.mail,com.microsoft.Word,com.microsoft.Excel,com.microsoft.Powerpoint,com.microsoft.Outlook,com.apple.iWork.Pages,com.apple.iWork.Numbers,com.apple.iWork.Keynote,com.google.GoogleDocs,notion.id,com.apple.Notes,md.obsidian,com.linear,com.figma.Desktop,com.microsoft.VSCode,com.apple.Terminal,com.googlecode.iterm2,com.github.GitHubDesktop,com.apple.finder,com.apple.iCal,com.apple.systempreferences`.split(`,`)),M=/^[\p{L}\p{M}\p{N}_ .&'()+-]+$/u,N=40,P=50}));async function I(){let e=_().executor.listInstalledApps(),t,n=new Promise(e=>{t=setTimeout(e,z,void 0)}),r=await Promise.race([e,n]).catch(()=>void 0).finally(()=>clearTimeout(t));if(!r){e.catch(()=>{}),c(`[Computer Use MCP] app enumeration exceeded ${z}ms or failed; tool description omits list`);return}return O(r,S())}async function L(){let e=_(),t=h(),r=f(e,t),i=await I(),a=d(e.executor.capabilities,t,i);return r.setRequestHandler(n,async()=>e.isDisabled()?{tools:[]}:{tools:a}),r}async function R(){i(),b();let e=await L(),t=new y,n=!1,r=async()=>{n||(n=!0,await Promise.all([o(),l()]),process.exit(0))};process.stdin.on(`end`,()=>void r()),process.stdin.on(`error`,()=>void r()),c(`[Computer Use MCP] Starting MCP server`),await e.connect(t),c(`[Computer Use MCP] MCP server started`)}var z;e((()=>{p(),x(),v(),t(),u(),r(),a(),s(),F(),m(),g(),z=1e3}))();export{L as createComputerUseMcpServerForCli,R as runComputerUseMcpServer};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{B as t,M as n}from"./server-DzOdtq8A.js";import{M as r,oc as i,yc as a,z as o}from"./paths-DO4WOQtD.js";import{l as s,p as c}from"./debug-otxXY3j-.js";import{r as l,t as u}from"./datadog-SSxsxcC-.js";import{i as d,r as f,t as p}from"./src-Cu58IYYb.js";import{i as m,t as h}from"./gates-vlrMjO-X.js";import{n as g,t as _}from"./hostAdapter-TBJav3vX.js";import{n as v,t as y}from"./stdio-Cg20AQ5W.js";import{r as b,t as x}from"./sink-CqOAfFlL.js";import{homedir as S}from"os";function C(e,t){if(k.some(t=>e.startsWith(t)))return!0;if(t){let n=t.endsWith(`/`)?`${t}Applications/`:`${t}/Applications/`;if(e.startsWith(n))return!0}return!1}function w(e){return A.some(t=>t.test(e))}function T(e,t){let n=new Set;return e.map(e=>e.trim()).filter(e=>!e||e.length>N||t&&!M.test(e)||n.has(e)?!1:(n.add(e),!0)).sort((e,t)=>e.localeCompare(t))}function E(e){let t=T(e,!0);return t.length<=P?t:[...t.slice(0,P),`… and ${t.length-P} more`]}function D(e){return T(e,!1)}function O(e,t){let{alwaysKept:n,rest:r}=e.reduce((e,n)=>(j.has(n.bundleId)?e.alwaysKept.push(n.displayName):C(n.path,t)&&!w(n.displayName)&&e.rest.push(n.displayName),e),{alwaysKept:[],rest:[]}),i=D(n),a=new Set(i);return[...i,...E(r).filter(e=>!a.has(e))]}var k,A,j,M,N,P,F=e((()=>{k=[`/Applications/`,`/System/Applications/`],A=[/Helper(?:$|\s\()/,/Agent(?:$|\s\()/,/Service(?:$|\s\()/,/Uninstaller(?:$|\s\()/,/Updater(?:$|\s\()/,/^\./],j=new Set(`com.apple.Safari,com.google.Chrome,com.microsoft.edgemac,org.mozilla.firefox,company.thebrowser.Browser,com.tinyspeck.slackmacgap,us.zoom.xos,com.microsoft.teams2,com.microsoft.teams,com.apple.MobileSMS,com.apple.mail,com.microsoft.Word,com.microsoft.Excel,com.microsoft.Powerpoint,com.microsoft.Outlook,com.apple.iWork.Pages,com.apple.iWork.Numbers,com.apple.iWork.Keynote,com.google.GoogleDocs,notion.id,com.apple.Notes,md.obsidian,com.linear,com.figma.Desktop,com.microsoft.VSCode,com.apple.Terminal,com.googlecode.iterm2,com.github.GitHubDesktop,com.apple.finder,com.apple.iCal,com.apple.systempreferences`.split(`,`)),M=/^[\p{L}\p{M}\p{N}_ .&'()+-]+$/u,N=40,P=50}));async function I(){let e=_().executor.listInstalledApps(),t,n=new Promise(e=>{t=setTimeout(e,z,void 0)}),r=await Promise.race([e,n]).catch(()=>void 0).finally(()=>clearTimeout(t));if(!r){e.catch(()=>{}),c(`[Computer Use MCP] app enumeration exceeded ${z}ms or failed; tool description omits list`);return}return O(r,S())}async function L(){let e=_(),t=h(),r=f(e,t),i=await I(),a=d(e.executor.capabilities,t,i);return r.setRequestHandler(n,async()=>e.isDisabled()?{tools:[]}:{tools:a}),r}async function R(){i(),b();let e=await L(),t=new y,n=!1,r=async()=>{n||(n=!0,await Promise.all([o(),l()]),process.exit(0))};process.stdin.on(`end`,()=>void r()),process.stdin.on(`error`,()=>void r()),c(`[Computer Use MCP] Starting MCP server`),await e.connect(t),c(`[Computer Use MCP] MCP server started`)}var z;e((()=>{p(),x(),v(),t(),u(),r(),a(),s(),F(),m(),g(),z=1e3}))();export{L as createComputerUseMcpServerForCli,R as runComputerUseMcpServer};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{r,t as i}from"./src-BJz1KAd_.js";import{Cc as a,Jt as o,M as s,S as c,_ as l,dc as u,oc as d,on as f,yc as p,z as m}from"./paths-Ci1iwL5Y.js";import{l as h,p as g}from"./debug-otxXY3j-.js";import{n as _,r as v}from"./analytics-DqMQntaB.js";import{R_ as y,z_ as b}from"./loadAgentsDir-C_wFhytF.js";import{r as x,t as S}from"./datadog-YsyhnDmr.js";import{c as C,i as w,o as T}from"./common-Da57Qwms.js";import{n as E,t as D}from"./stdio-Cg20AQ5W.js";import{r as O,t as k}from"./sink-Do5fWbUC.js";import{format as A}from"util";function j(e){return z.some(t=>t===e)}function M(){if(process.env.USER_TYPE===`ant`||l(`tengu_copper_bridge`,!1))return n(process.env.USE_LOCAL_OAUTH)||n(process.env.LOCAL_BRIDGE)?`ws://localhost:8765`:n(process.env.USE_STAGING_OAUTH)?`wss://bridge-staging.claudeusercontent.com`:`wss://bridge.claudeusercontent.com`}function N(){return n(process.env.USE_LOCAL_OAUTH)||n(process.env.LOCAL_BRIDGE)}function P(e){let t=new B,n=M();t.info(`Bridge URL: ${n??`none (using native socket)`}`);let r=e?.CLAUDE_CHROME_PERMISSION_MODE??process.env.CLAUDE_CHROME_PERMISSION_MODE,i;return r&&(j(r)?i=r:t.warn(`Invalid CLAUDE_CHROME_PERMISSION_MODE "${r}". Valid values: ${z.join(`, `)}`)),{serverName:`Claude in Chrome`,logger:t,socketPath:T(),getSocketPaths:w,clientTypeId:`claude-code`,onAuthenticationError:()=>{t.warn(`Authentication error occurred. Please ensure you are logged into the Claude browser extension with the same claude.ai account as Claude Code.`)},onToolCallDisconnected:()=>`Browser extension is not connected. Please ensure the Claude browser extension is installed and running (${I}), and that you are logged into claude.ai with the same account as Claude Code. If this is your first time connecting to Chrome, you may need to restart Chrome for the installation to take effect. If you continue to experience issues, please report a bug: ${L}`,onExtensionPaired:(e,n)=>{a(t=>t.chromeExtension?.pairedDeviceId===e&&t.chromeExtension?.pairedDeviceName===n?t:{...t,chromeExtension:{pairedDeviceId:e,pairedDeviceName:n}}),t.info(`Paired with "${n}" (${e.slice(0,8)})`)},getPersistedDeviceId:()=>u().chromeExtension?.pairedDeviceId,...n&&{bridgeConfig:{url:n,getUserId:async()=>u().oauthAccount?.accountUuid,getOAuthToken:async()=>o()?.accessToken??``,...N()&&{devUserId:`dev_user_local`}}},...i&&{initialPermissionMode:i},...process.env.USER_TYPE===`ant`&&{callAnthropicMessages:async e=>{let t=await b({model:e.model,system:e.system,messages:e.messages,max_tokens:e.max_tokens,stop_sequences:e.stop_sequences,signal:e.signal,skipSystemPromptPrefix:!0,tools:[],querySource:`chrome_mcp`}),n=[];for(let e of t.content)e.type===`text`&&n.push({type:`text`,text:e.text});return{content:n,stop_reason:t.stop_reason,usage:{input_tokens:t.usage.input_tokens,output_tokens:t.usage.output_tokens}}}},trackEvent:(e,t)=>{let n={};if(t)for(let[e,r]of Object.entries(t)){let t=e===`status`?`bridge_status`:e;(typeof r==`boolean`||typeof r==`number`||typeof r==`string`&&R.has(t))&&(n[t]=r)}v(e,n)}}}async function F(){d(),O();let e=r(P()),t=new D,n=!1,i=async()=>{n||(n=!0,await m(),await x(),process.exit(0))};process.stdin.on(`end`,()=>void i()),process.stdin.on(`error`,()=>void i()),g(`[Claude in Chrome] Starting MCP server`),await e.connect(t),g(`[Claude in Chrome] MCP server started`)}var I,L,R,z,B;e((()=>{i(),k(),E(),S(),s(),c(),_(),f(),p(),h(),t(),y(),C(),I=`https://claude.ai/chrome`,L=`https://github.com/anthropics/claude-code/issues/new?labels=bug,claude-in-chrome`,R=new Set([`bridge_status`,`error_type`,`tool_name`]),z=[`ask`,`skip_all_permission_checks`,`follow_a_plan`],B=class{silly(e,t){g(A(e,t??``),{level:`debug`})}debug(e,t){g(A(e,t??``),{level:`debug`})}info(e,t){g(A(e,t??``),{level:`info`})}warn(e,t){g(A(e,t??``),{level:`warn`})}error(e,t){g(A(e,t??``),{level:`error`})}}}))();export{P as createChromeContext,F as runClaudeInChromeMcpServer};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{r,t as i}from"./src-BJz1KAd_.js";import{Cc as a,Jt as o,M as s,S as c,_ as l,dc as u,oc as d,on as f,yc as p,z as m}from"./paths-DO4WOQtD.js";import{l as h,p as g}from"./debug-otxXY3j-.js";import{n as _,r as v}from"./analytics-DqMQntaB.js";import{R_ as y,z_ as b}from"./loadAgentsDir-ClTeo0nk.js";import{r as x,t as S}from"./datadog-SSxsxcC-.js";import{c as C,i as w,o as T}from"./common-Da57Qwms.js";import{n as E,t as D}from"./stdio-Cg20AQ5W.js";import{r as O,t as k}from"./sink-CqOAfFlL.js";import{format as A}from"util";function j(e){return z.some(t=>t===e)}function M(){if(process.env.USER_TYPE===`ant`||l(`tengu_copper_bridge`,!1))return n(process.env.USE_LOCAL_OAUTH)||n(process.env.LOCAL_BRIDGE)?`ws://localhost:8765`:n(process.env.USE_STAGING_OAUTH)?`wss://bridge-staging.claudeusercontent.com`:`wss://bridge.claudeusercontent.com`}function N(){return n(process.env.USE_LOCAL_OAUTH)||n(process.env.LOCAL_BRIDGE)}function P(e){let t=new B,n=M();t.info(`Bridge URL: ${n??`none (using native socket)`}`);let r=e?.CLAUDE_CHROME_PERMISSION_MODE??process.env.CLAUDE_CHROME_PERMISSION_MODE,i;return r&&(j(r)?i=r:t.warn(`Invalid CLAUDE_CHROME_PERMISSION_MODE "${r}". Valid values: ${z.join(`, `)}`)),{serverName:`Claude in Chrome`,logger:t,socketPath:T(),getSocketPaths:w,clientTypeId:`claude-code`,onAuthenticationError:()=>{t.warn(`Authentication error occurred. Please ensure you are logged into the Claude browser extension with the same claude.ai account as Claude Code.`)},onToolCallDisconnected:()=>`Browser extension is not connected. Please ensure the Claude browser extension is installed and running (${I}), and that you are logged into claude.ai with the same account as Claude Code. If this is your first time connecting to Chrome, you may need to restart Chrome for the installation to take effect. If you continue to experience issues, please report a bug: ${L}`,onExtensionPaired:(e,n)=>{a(t=>t.chromeExtension?.pairedDeviceId===e&&t.chromeExtension?.pairedDeviceName===n?t:{...t,chromeExtension:{pairedDeviceId:e,pairedDeviceName:n}}),t.info(`Paired with "${n}" (${e.slice(0,8)})`)},getPersistedDeviceId:()=>u().chromeExtension?.pairedDeviceId,...n&&{bridgeConfig:{url:n,getUserId:async()=>u().oauthAccount?.accountUuid,getOAuthToken:async()=>o()?.accessToken??``,...N()&&{devUserId:`dev_user_local`}}},...i&&{initialPermissionMode:i},...process.env.USER_TYPE===`ant`&&{callAnthropicMessages:async e=>{let t=await b({model:e.model,system:e.system,messages:e.messages,max_tokens:e.max_tokens,stop_sequences:e.stop_sequences,signal:e.signal,skipSystemPromptPrefix:!0,tools:[],querySource:`chrome_mcp`}),n=[];for(let e of t.content)e.type===`text`&&n.push({type:`text`,text:e.text});return{content:n,stop_reason:t.stop_reason,usage:{input_tokens:t.usage.input_tokens,output_tokens:t.usage.output_tokens}}}},trackEvent:(e,t)=>{let n={};if(t)for(let[e,r]of Object.entries(t)){let t=e===`status`?`bridge_status`:e;(typeof r==`boolean`||typeof r==`number`||typeof r==`string`&&R.has(t))&&(n[t]=r)}v(e,n)}}}async function F(){d(),O();let e=r(P()),t=new D,n=!1,i=async()=>{n||(n=!0,await m(),await x(),process.exit(0))};process.stdin.on(`end`,()=>void i()),process.stdin.on(`error`,()=>void i()),g(`[Claude in Chrome] Starting MCP server`),await e.connect(t),g(`[Claude in Chrome] MCP server started`)}var I,L,R,z,B;e((()=>{i(),k(),E(),S(),s(),c(),_(),f(),p(),h(),t(),y(),C(),I=`https://claude.ai/chrome`,L=`https://github.com/anthropics/claude-code/issues/new?labels=bug,claude-in-chrome`,R=new Set([`bridge_status`,`error_type`,`tool_name`]),z=[`ask`,`skip_all_permission_checks`,`follow_a_plan`],B=class{silly(e,t){g(A(e,t??``),{level:`debug`})}debug(e,t){g(A(e,t??``),{level:`debug`})}info(e,t){g(A(e,t??``),{level:`info`})}warn(e,t){g(A(e,t??``),{level:`warn`})}error(e,t){g(A(e,t??``),{level:`error`})}}}))();export{P as createChromeContext,F as runClaudeInChromeMcpServer};
@@ -0,0 +1 @@
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{In as i,Ln as a,Q as o,Rn as s,b as c,d as l,f as u,t as d,tt as f,x as p}from"./src-Di342QoJ.js";import{t as m}from"./jsx-runtime-D-D469L8.js";import{cn as h,ot as g}from"./state-sIHsFpDu.js";import{Bc as ee,Uc as _,a as v,lo as y,n as te,oo as b,s as x}from"./paths-DO4WOQtD.js";import{B as S,U as C}from"./debug-otxXY3j-.js";import{n as w,r as T}from"./analytics-DqMQntaB.js";import{n as E,t as D}from"./cwd--iizewsn.js";import{r as O,v as k}from"./git-C0IuvuIy.js";import{o as A,s as j}from"./log-DSV4Ht5l.js";import{g as ne,x as M}from"./startupProfiler-CAntGAbs.js";import{Cp as re,Jn as N,Kn as ie,Qk as P,Ry as F,Sp as I,Xk as L,aS as ae,lC as R,ou as oe,qk as se,su as ce,uC as z}from"./loadAgentsDir-ClTeo0nk.js";import{r as le,t as B}from"./browser-Bt-ckCaU.js";import{t as V}from"./useKeybinding-DPOUuymz.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{r as ue,t as de}from"./promptEditor-FI_ewCpV.js";import{homedir as fe}from"os";import{join as W,relative as pe}from"path";import{mkdir as G,writeFile as me}from"fs/promises";function he(e){return O(e)!==null}var ge=e((()=>{k()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(L()),a=W(n(),`CLAUDE.md`),o=W(g(),`CLAUDE.md`),s=r.some(e=>e.path===a),u=r.some(e=>e.path===o),d=[...r.filter(e=>e.type!==`AutoMem`&&e.type!==`TeamMem`).map(e=>({...e,exists:!0})),...s?[]:[{path:a,type:`User`,content:``,exists:!1}],...u?[]:[{path:o,type:`Project`,content:``,exists:!1}]],m=new Map,h=d.map(e=>{let t=ee(e.path),n=e.exists?``:` (new)`,r=e.parent?(m.get(e.parent)??0)+1:0;m.set(e.path,r);let i=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===a?`User memory`:e.type===`Project`&&!e.isNested&&e.path===o?`Project memory`:r>0?`${i}L ${t}${n}`:`${t}`;let c,l=he(g());return c=e.type===`User`&&!e.isNested?`Saved in ~/.claude/CLAUDE.md`:e.type===`Project`&&!e.isNested&&e.path===o?`${l?`Checked in at`:`Saved in`} ./CLAUDE.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),_=[],v=z(e=>e.agentDefinitions);if(x()){_.push({label:`Open auto-memory folder`,value:`${Y}${te()}`,description:``});for(let e of v.activeAgents)if(e.memory){let t=ie(e.agentType,e.memory);_.push({label:`Open ${i.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}h.push(..._);let b=J&&h.some(e=>e.value===J)?J:h[0]?.value||``,[S,C]=(0,K.useState)(x),[w,E]=(0,K.useState)(ce),[D]=(0,K.useState)(x),O=z(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{D&&re().then(A)},[D,O]);let j=O?`running`:k===null?``:k===0?`never`:`last ran ${ne(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,F=+!!D;function I(){let e=!S;y(`userSettings`,{autoMemoryEnabled:e}),C(e),T(`tengu_auto_memory_toggled`,{enabled:e})}function R(){let e=!w;y(`userSettings`,{autoDreamEnabled:e}),E(e),T(`tengu_auto_dream_toggled`,{enabled:e})}return H(),f(`confirm:no`,t,{context:`Confirmation`}),f(`confirm:yes`,()=>{M===0?I():M===1&&R()},{context:`Confirmation`,isActive:P}),f(`select:next`,()=>{N(e=>e!==null&&e<F?e+1:null)},{context:`Select`,isActive:P}),f(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(p,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(p,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(l,{isFocused:M===0,children:(0,q.jsxs)(c,{children:[`Auto-memory: `,S?`on`:`off`]})}),D&&(0,q.jsx)(l,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(c,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(c,{dimColor:!0,children:[` · `,j]}),!O&&w&&(0,q.jsx)(c,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(ae,{defaultFocusValue:b,options:h,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>le(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(F)})]})}var K,q,J,Y,ve=e((()=>{a(),s(),K=t(s(),1),h(),U(),d(),V(),v(),w(),oe(),I(),R(),N(),B(),P(),r(),_(),M(),ge(),b(),F(),q=m(),Y=`__open_folder__`}));function ye(e){let t=fe(),n=D(),r=e.startsWith(t)?`~`+e.slice(t.length):null,i=e.startsWith(n)?`./`+pe(n,e):null;return r&&i?r.length<=i.length?r:i:r||i||e}var X=e((()=>{s(),d(),E(),m()}));function be({onDone:e}){let t=async t=>{try{t.includes(n())&&await G(n(),{recursive:!0});try{await me(t,``,{encoding:`utf8`,flag:`wx`})}catch(e){if(S(e)!==`EEXIST`)throw e}await de(t);let r=`default`,i=``;process.env.VISUAL?(r=`$VISUAL`,i=process.env.VISUAL):process.env.EDITOR&&(r=`$EDITOR`,i=process.env.EDITOR);let a=r===`default`?``:`Using ${r}="${i}".`,o=a?`> ${a} To change editor, set $EDITOR or $VISUAL environment variable.`:`> To use a different editor, set the $EDITOR or $VISUAL environment variable.`;e(`Opened memory file at ${ye(t)}\n\n${o}`,{display:`system`})}catch(t){j(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(u,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(p,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(p,{marginTop:1,children:(0,Q.jsxs)(c,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(o,{url:`https://code.claude.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(s(),1),d(),ve(),X(),P(),r(),C(),A(),ue(),Q=m(),$=async e=>(se(),await L(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i,x as a}from"./src-Di342QoJ.js";import{t as o}from"./jsx-runtime-D-D469L8.js";import{aS as s,gt as c,ht as l,mt as u,oS as d,pt as f}from"./loadAgentsDir-C_wFhytF.js";function p({onDone:e}){let t=l(),n=f(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(r,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(r,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function o(n){c(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function u(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(a,{flexDirection:`column`,children:[(0,h.jsxs)(a,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(r,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(r,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(s,{defaultValue:n,options:i,onChange:o,onCancel:u,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(n(),1),i(),d(),u(),h=o(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=l(),n=t.find(e=>e.slug===r);if(!n){e(`Unknown mode: "${r}"\n\nAvailable modes:\n${t.map(e=>`${e.icon} ${e.slug} — ${e.description}`).join(`
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,t as i,x as a}from"./src-Di342QoJ.js";import{t as o}from"./jsx-runtime-D-D469L8.js";import{aS as s,gt as c,ht as l,mt as u,oS as d,pt as f}from"./loadAgentsDir-ClTeo0nk.js";function p({onDone:e}){let t=l(),n=f(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(r,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(r,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function o(n){c(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function u(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(a,{flexDirection:`column`,children:[(0,h.jsxs)(a,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(r,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(r,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(s,{defaultValue:n,options:i,onChange:o,onCancel:u,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(n(),1),i(),d(),u(),h=o(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=l(),n=t.find(e=>e.slug===r);if(!n){e(`Unknown mode: "${r}"\n\nAvailable modes:\n${t.map(e=>`${e.icon} ${e.slug} — ${e.description}`).join(`
2
2
  `)}`,{display:`system`});return}c(r),e(`${n.icon} Mode switched to: ${n.name} (${n.slug}) — ${n.description}`,{display:`system`});return}return(0,h.jsx)(p,{onDone:e})}}))();export{g as call};
@@ -0,0 +1 @@
1
+ import{Dr as e,Pr as t}from"./paths-DO4WOQtD.js";t();export{e as getMainLoopModel};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Rn as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$r as o,Lr as s,Pr as c,Qr as l,Si as u,Vr as d,Xr as f,Zr as p,ui as m,vi as h,wr as g,xi as _,yi as v}from"./paths-Ci1iwL5Y.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{A as x,et as S,j as C}from"./log-DSV4Ht5l.js";import{Bf as w,b_ as T,fC as E,lC as D,uC as O,v_ as k,y_ as A,zf as j}from"./loadAgentsDir-C_wFhytF.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-P_NGI1-I.js";function I({onDone:e}){let t=O(e=>e.mainLoopModel),r=O(e=>e.mainLoopModelForSession),i=O(e=>e.fastMode),a=E();function o(){b(`tengu_model_command_menu`,{action:`cancel`});let r=H(t);e(`Kept model as ${n.bold(r)}`,{display:`system`})}function c(r,o){b(`tengu_model_command_menu`,{action:r,from_model:t,to_model:r}),a(e=>({...e,mainLoopModel:r,mainLoopModelForSession:null}));let c=`Set model to ${n.bold(H(r))}`;o!==void 0&&(c+=` with ${n.bold(o)} effort`);let l;_()&&(m(),!u(r)&&i?(a(e=>({...e,fastMode:!1})),l=!1):u(r)&&v()&&i&&(c+=` · Fast mode ON`,l=!0)),N(r,l===!0,s())&&(c+=` · Billed as extra usage`),l===!1&&(c+=` · Fast mode OFF`),e(c)}return(0,W.jsx)(P,{initial:t,sessionModel:r,onSelect:c,onCancel:o,isStandaloneCommand:!0,showFastModeNotice:_()&&i&&u(t)&&v()})}function L({args:e,onDone:t}){let r=O(e=>e.fastMode),i=E(),a=e===`default`?null:e;return U.useEffect(()=>{async function e(){if(a&&!p(a)){t(`Model '${a}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(a&&z(a)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(a&&B(a)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!a){o(null);return}if(R(a)){o(a);return}try{let{valid:e,error:n}=await w(a);e?o(a):t(n||`Model '${a}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function o(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let a=`Set model to ${n.bold(H(e))}`,o;_()&&(m(),!u(e)&&r?(i(e=>({...e,fastMode:!1})),o=!1):u(e)&&r&&(a+=` · Fast mode ON`,o=!0)),N(e,o===!0,s())&&(a+=` · Billed as extra usage`),o===!1&&(a+=` · Fast mode OFF`),t(a)}e()},[a,t,i]),null}function R(e){return l.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!k()&&!s()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!A()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=O(e=>e.mainLoopModel),r=O(e=>e.mainLoopModelForSession),i=O(e=>e.effortValue),a=H(t),o=i===void 0?``:` (effort: ${i})`;return e(r?`Current model: ${n.bold(H(r))} (session override from plan mode)\nBase model: ${a}${o}`:`Current model: ${a}${o}`),null}function H(e){let t=d(e??g());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{r(),U=t(i(),1),M(),S(),y(),D(),F(),h(),o(),T(),c(),f(),j(),W=a(),G=async(e,t,n)=>{if(n=n?.trim()||``,C.includes(n))return b(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(x.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(b(`tengu_model_command_inline`,{args:n}),(0,W.jsx)(L,{args:n,onDone:e})):(0,W.jsx)(I,{onDone:e})}}))();export{G as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{In as n,Ln as r,Rn as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$r as o,Lr as s,Pr as c,Qr as l,Si as u,Vr as d,Xr as f,Zr as p,ui as m,vi as h,wr as g,xi as _,yi as v}from"./paths-DO4WOQtD.js";import{n as y,r as b}from"./analytics-DqMQntaB.js";import{A as x,et as S,j as C}from"./log-DSV4Ht5l.js";import{Lf as w,Rf as T,b_ as E,fC as D,lC as O,uC as k,v_ as A,y_ as j}from"./loadAgentsDir-ClTeo0nk.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-CbkqfG1U.js";function I({onDone:e}){let t=k(e=>e.mainLoopModel),r=k(e=>e.mainLoopModelForSession),i=k(e=>e.fastMode),a=D();function o(){b(`tengu_model_command_menu`,{action:`cancel`});let r=H(t);e(`Kept model as ${n.bold(r)}`,{display:`system`})}function c(r,o){b(`tengu_model_command_menu`,{action:r,from_model:t,to_model:r}),a(e=>({...e,mainLoopModel:r,mainLoopModelForSession:null}));let c=`Set model to ${n.bold(H(r))}`;o!==void 0&&(c+=` with ${n.bold(o)} effort`);let l;_()&&(m(),!u(r)&&i?(a(e=>({...e,fastMode:!1})),l=!1):u(r)&&v()&&i&&(c+=` · Fast mode ON`,l=!0)),N(r,l===!0,s())&&(c+=` · Billed as extra usage`),l===!1&&(c+=` · Fast mode OFF`),e(c)}return(0,W.jsx)(P,{initial:t,sessionModel:r,onSelect:c,onCancel:o,isStandaloneCommand:!0,showFastModeNotice:_()&&i&&u(t)&&v()})}function L({args:e,onDone:t}){let r=k(e=>e.fastMode),i=D(),a=e===`default`?null:e;return U.useEffect(()=>{async function e(){if(a&&!p(a)){t(`Model '${a}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(a&&z(a)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(a&&B(a)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.claude.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!a){o(null);return}if(R(a)){o(a);return}try{let{valid:e,error:n}=await T(a);e?o(a):t(n||`Model '${a}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function o(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let a=`Set model to ${n.bold(H(e))}`,o;_()&&(m(),!u(e)&&r?(i(e=>({...e,fastMode:!1})),o=!1):u(e)&&r&&(a+=` · Fast mode ON`,o=!0)),N(e,o===!0,s())&&(a+=` · Billed as extra usage`),o===!1&&(a+=` · Fast mode OFF`),t(a)}e()},[a,t,i]),null}function R(e){return l.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!A()&&!s()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!j()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=k(e=>e.mainLoopModel),r=k(e=>e.mainLoopModelForSession),i=k(e=>e.effortValue),a=H(t),o=i===void 0?``:` (effort: ${i})`;return e(r?`Current model: ${n.bold(H(r))} (session override from plan mode)\nBase model: ${a}${o}`:`Current model: ${a}${o}`),null}function H(e){let t=d(e??g());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{r(),U=t(i(),1),M(),S(),y(),O(),F(),h(),o(),E(),c(),f(),w(),W=a(),G=async(e,t,n)=>{if(n=n?.trim()||``,C.includes(n))return b(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(x.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(b(`tengu_model_command_inline`,{args:n}),(0,W.jsx)(L,{args:n,onDone:e})):(0,W.jsx)(I,{onDone:e})}}))();export{G as call};
@@ -1 +1 @@
1
- import{cn as e,tr as t}from"./state-sIHsFpDu.js";import{As as n,Cc as r,It as i,Lt as a,Rt as o,Ss as s,Ts as c,dc as l,on as u,yc as d}from"./paths-Ci1iwL5Y.js";import{J as f,U as p}from"./debug-otxXY3j-.js";import{o as m,s as h}from"./log-DSV4Ht5l.js";import{Ca as g,Ta as _}from"./loadAgentsDir-C_wFhytF.js";import{d as v,m as y,p as b}from"./rcDebugLog-C42A0pX1.js";e(),u(),d(),p(),m(),_(),s(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:c(e.permission_mode)}}:{},...typeof e.is_ultraplan_mode==`boolean`?{isUltraplanMode:e.is_ultraplan_mode}:{}})}function S({newState:e,oldState:s}){let c=s.toolPermissionContext.mode,u=e.toolPermissionContext.mode;if(c!==u){let t=n(c),r=n(u);t!==r&&y({permission_mode:r,is_ultraplan_mode:r===`plan`&&e.isUltraplanMode&&!s.isUltraplanMode?!0:null}),b(u)}if(e.mainLoopModel!==s.mainLoopModel&&t(e.mainLoopModel),e.expandedView!==s.expandedView){let t=e.expandedView===`tasks`,n=e.expandedView===`teammates`;(l().showExpandedTodos!==t||l().showSpinnerTree!==n)&&r(e=>({...e,showExpandedTodos:t,showSpinnerTree:n}))}if(e.verbose!==s.verbose&&l().verbose!==e.verbose){let t=e.verbose;r(e=>({...e,verbose:t}))}if(process.env.USER_TYPE===`ant`&&e.tungstenPanelVisible!==s.tungstenPanelVisible&&e.tungstenPanelVisible!==void 0&&l().tungstenPanelVisible!==e.tungstenPanelVisible){let t=e.tungstenPanelVisible;r(e=>({...e,tungstenPanelVisible:t}))}if(e.settings!==s.settings)try{i(),a(),o(),e.settings.env!==s.settings.env&&g()}catch(e){h(f(e))}}export{S as n,x as t};
1
+ import{cn as e,tr as t}from"./state-sIHsFpDu.js";import{As as n,Cc as r,It as i,Lt as a,Rt as o,Ss as s,Ts as c,dc as l,on as u,yc as d}from"./paths-DO4WOQtD.js";import{J as f,U as p}from"./debug-otxXY3j-.js";import{o as m,s as h}from"./log-DSV4Ht5l.js";import{Ca as g,Ta as _}from"./loadAgentsDir-ClTeo0nk.js";import{d as v,m as y,p as b}from"./rcDebugLog-CwU_wJBE.js";e(),u(),d(),p(),m(),_(),s(),v();function x(e){return t=>({...t,...typeof e.permission_mode==`string`?{toolPermissionContext:{...t.toolPermissionContext,mode:c(e.permission_mode)}}:{},...typeof e.is_ultraplan_mode==`boolean`?{isUltraplanMode:e.is_ultraplan_mode}:{}})}function S({newState:e,oldState:s}){let c=s.toolPermissionContext.mode,u=e.toolPermissionContext.mode;if(c!==u){let t=n(c),r=n(u);t!==r&&y({permission_mode:r,is_ultraplan_mode:r===`plan`&&e.isUltraplanMode&&!s.isUltraplanMode?!0:null}),b(u)}if(e.mainLoopModel!==s.mainLoopModel&&t(e.mainLoopModel),e.expandedView!==s.expandedView){let t=e.expandedView===`tasks`,n=e.expandedView===`teammates`;(l().showExpandedTodos!==t||l().showSpinnerTree!==n)&&r(e=>({...e,showExpandedTodos:t,showSpinnerTree:n}))}if(e.verbose!==s.verbose&&l().verbose!==e.verbose){let t=e.verbose;r(e=>({...e,verbose:t}))}if(process.env.USER_TYPE===`ant`&&e.tungstenPanelVisible!==s.tungstenPanelVisible&&e.tungstenPanelVisible!==void 0&&l().tungstenPanelVisible!==e.tungstenPanelVisible){let t=e.tungstenPanelVisible;r(e=>({...e,tungstenPanelVisible:t}))}if(e.settings!==s.settings)try{i(),a(),o(),e.settings.env!==s.settings.env&&g()}catch(e){h(f(e))}}export{S as n,x as t};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{l as t,s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{ai as i,ci as a,cr as o,dr as s}from"./paths-Ci1iwL5Y.js";import{l as c,p as l}from"./debug-otxXY3j-.js";import{Eo as u,G_ as d,H_ as f,K_ as p,Qo as m,Tm as ee,U_ as h,Uo as g,W_ as _,Xo as v,aE as y,dD as te,km as b,mo as x,nl as S,oE as C,q_ as w,rl as T,sE as E,st as D,tl as O,uD as k,ut as ne}from"./loadAgentsDir-C_wFhytF.js";import{$n as A,Qn as j,Zn as M,i as N,r as P,t as F}from"./prompt-6ZKyqv6z.js";import{F as I,I as L,L as R,P as z,R as B,Y as V}from"./rcDebugLog-C42A0pX1.js";import{n as H,t as U}from"./openaiShared-C-AuktRP.js";import{randomUUID as W}from"crypto";function G(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(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{l as t,s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{ai as i,ci as a,cr as o,dr as s}from"./paths-DO4WOQtD.js";import{l as c,p as l}from"./debug-otxXY3j-.js";import{Eo as u,G_ as d,H_ as f,Hb as p,Qo as m,Tm as ee,U_ as h,Ub as g,Uo as _,W_ as v,Xo as y,aE as b,dD as te,km as x,mo as S,nl as C,oE as w,rl as T,sE as E,st as D,tl as O,uD as k,ut as ne}from"./loadAgentsDir-ClTeo0nk.js";import{$n as A,Qn as j,Zn as M,i as N,r as P,t as F}from"./prompt-CfM_xGPc.js";import{F as I,I as L,L as R,P as z,R as B,Y as V}from"./rcDebugLog-CwU_wJBE.js";import{n as H,t as U}from"./openaiShared-C-AuktRP.js";import{randomUUID as W}from"crypto";function G(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(`
2
2
  `):``}function re(e){if(typeof e==`string`)return e;if(!Array.isArray(e))return G(e);let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n;if(e.type===`text`&&typeof e.text==`string`)t.push({type:`input_text`,text:e.text});else if(e.type===`image_url`){let n=e.image_url;typeof n?.url==`string`&&t.push({type:`input_image`,image_url:n.url})}}return t.length>0?t:G(e)}function K(e){let t=[],n=[];for(let r of e){if(!r||typeof r!=`object`)continue;let e=r,i=e.role;if(i===`system`||i===`developer`){let t=G(e.content);t&&n.push(t);continue}if(i===`tool`){let n=e.tool_call_id;typeof n==`string`&&t.push({type:`function_call_output`,call_id:n,output:G(e.content)});continue}if(i===`assistant`){let n=G(e.content);n&&t.push({role:`assistant`,content:n});let r=e.tool_calls;if(Array.isArray(r))for(let e of r){if(!e||typeof e!=`object`)continue;let n=e,r=n.function,i=typeof n.id==`string`?n.id:void 0,a=typeof r?.name==`string`?r.name:void 0;!i||!a||t.push({type:`function_call`,call_id:i,name:a,arguments:typeof r?.arguments==`string`?r.arguments:`{}`})}continue}i===`user`&&t.push({role:`user`,content:re(e.content)})}return{input:t,instructions:n.length>0?n.join(`
3
3
 
4
4
  `):void 0}}function q(e){let t=[];for(let n of e){if(!n||typeof n!=`object`)continue;let e=n.function,r=typeof e?.name==`string`?e.name:void 0;r&&t.push({type:`function`,name:r,description:typeof e?.description==`string`?e.description:``,parameters:e?.parameters&&typeof e.parameters==`object`?e.parameters:{type:`object`,properties:{}},strict:!1})}return t}function J(e){if(e===`required`)return`required`;if(e===`auto`)return`auto`;if(!e||typeof e!=`object`)return e;let t=e,n=t.function;return t.type===`function`&&typeof n?.name==`string`?{type:`function`,name:n.name}:e}function Y(e){let{input:t,instructions:n}=K(e.messages),r=q(e.tools);return{model:e.model,stream:!0,store:!1,input:t,...n?{instructions:n}:{},...r.length>0?{tools:r}:{},...e.toolChoice?{tool_choice:J(e.toolChoice)}:{},...e.reasoningEffort?{reasoning:{effort:e.reasoningEffort}}:{},parallel_tool_calls:!0}}async function*X(e){if(!e.body)throw Error(`ChatGPT response did not include a body`);let t=e.body.getReader(),n=new TextDecoder,r=``;for(;;){let{done:e,value:i}=await t.read();if(e)break;r+=n.decode(i,{stream:!0});let a=r.indexOf(`
@@ -6,5 +6,5 @@ import{n as e}from"./chunk-DR8-3Aex.js";import{l as t,s as n,u as r}from"./envUt
6
6
  `);for(;a>=0;){let e=r.slice(0,a);r=r.slice(a+2);let t=e.split(/\r?\n/).filter(e=>e.startsWith(`data:`)).map(e=>e.slice(5).trimStart()).join(`
7
7
  `);if(t&&t!==`[DONE]`){let e=JSON.parse(t);e&&typeof e==`object`&&(yield e)}a=r.indexOf(`
8
8
 
9
- `)}}}function ie(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function ae(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*oe(e,t){let n=`msg_${W().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:ae(e),stop_sequence:null},usage:ie(e)},yield{type:`message_stop`}}}}async function se(e){let t=await y(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`claude-code-best`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return X(i)}var ce=e((()=>{C()}));function Z(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(r(process.env.OPENAI_ENABLE_THINKING))return!0;let n=e.toLowerCase();return n.includes(`deepseek`)||n.includes(`mimo`)}function le(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function ue(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var de=e((()=>{n()}));function Q(e){if(e===`low`)return`low`;if(e===`medium`)return`medium`;if(e===`high`)return`high`;if(e===`xhigh`||e===`max`)return`xhigh`;if(typeof e==`number`)return`high`}function fe(e){let t=process.env.CLAUDE_CODE_EFFORT_LEVEL?.toLowerCase();if(!(t===`auto`||t===`unset`))return Q(t)??Q(e)??`medium`}function pe(e,t,n,r){if(!r||S())return e;let i=t.filter(e=>n.has(e.name)).map(F).sort().join(`
10
- `);return i?[u({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function me(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:s}=e,c=[],l=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return l.length>0&&t&&c.push({message:{...t,content:v(l,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:W(),timestamp:new Date().toISOString()}),o===`max_tokens`&&c.push(x({content:`Output truncated: response exceeded the ${s} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),c}async function*he(e,t,n,r,a){try{let s=V(a.model),c=m(e,n),u=await T(a.model,n,a.getToolPermissionContext||(async()=>M()),a.agents||[],a.querySource),h=new Set;if(u)for(let e of n)N(e)&&h.add(e.name);let g=n;u&&h.size>0&&(g=n.filter(e=>!!(!h.has(e.name)||A(e,`SearchExtraTools`))));let v=await Promise.all(g.map(e=>ne(e,{getToolPermissionContext:a.getToolPermissionContext,tools:n,agents:a.agents,allowedAgentTypes:a.allowedAgentTypes,model:a.model,deferLoading:u&&h.has(e.name)}))),y=v.filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),b=Z(s),x=B(pe(c.filter(me),n,h,u),t,{enableThinking:b}),S=R(y),C=L(a.toolChoice),w=fe(a.effortValue);if(u){let e=g.filter(e=>h.has(e.name)).length;l(`[OpenAI] Tool search enabled: ${e}/${h.size} deferred tools included, total tools=${S.length}`)}else l(`[OpenAI] Tool search disabled, total tools=${S.length}`);let{upperLimit:D}=o(s),O=le(D,a.maxOutputTokensOverride);l(`[OpenAI] Calling model=${s}, messages=${x.length}, tools=${S.length}, thinking=${b}`);let k=E()?oe(await se({request:Y({model:s,messages:x,tools:S,toolChoice:C,reasoningEffort:w}),signal:r,fetchOverride:a.fetchOverride}),s):I(await f({maxRetries:0,fetchOverride:a.fetchOverride,source:a.querySource}).chat.completions.create(ue({model:s,messages:x,tools:S,toolChoice:C,enableThinking:b,maxTokens:O,temperatureOverride:a.temperatureOverride}),{signal:r}),s),j={},P=[],F=null,z=null,U={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},W=0,G=Date.now();for await(let e of k){switch(e.type){case`message_start`:F=e.message,W=Date.now()-G,e.message.usage&&(U={...U,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?j[t]={...n,input:``}:n.type===`text`?j[t]={...n,text:``}:n.type===`thinking`?j[t]={...n,thinking:``,signature:``}:j[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=j[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(U=H(U,t)),e.delta.stop_reason!=null&&(z=e.delta.stop_reason);break}case`message_stop`:if(F){for(let e of $({partialMessage:F,contentBlocks:j,tools:n,agentId:a.agentId,usage:U,stopReason:z,maxTokens:O}))e.type===`assistant`&&P.push(e),yield e;F=null}U.input_tokens+U.output_tokens>0&&ee(i(s,U),U,a.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:W}:void 0}}if(te(a.langfuseTrace??null,{model:s,provider:`openai`,input:_(x),output:d(P),usage:{input_tokens:U.input_tokens,output_tokens:U.output_tokens,cache_creation_input_tokens:U.cache_creation_input_tokens,cache_read_input_tokens:U.cache_read_input_tokens},startTime:new Date(G),endTime:new Date,completionStartTime:W>0?new Date(G+W):void 0,tools:p(v),...b&&{thinking:{type:`enabled`}}}),F)for(let e of $({partialMessage:F,contentBlocks:j,tools:n,agentId:a.agentId,usage:U,stopReason:z,maxTokens:O}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);l(`[OpenAI] Error: ${t}`,{level:`error`}),yield x({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{h(),U(),z(),C(),ce(),g(),D(),j(),c(),b(),a(),de(),k(),w(),s(),O(),P()}))();export{he as queryModelOpenAI};
9
+ `)}}}function ie(e){let t=e?.usage,n=t?.input_tokens_details;return{input_tokens:typeof t?.input_tokens==`number`?t.input_tokens:0,output_tokens:typeof t?.output_tokens==`number`?t.output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:typeof n?.cached_tokens==`number`?n.cached_tokens:0}}function ae(e){return e?.status===`incomplete`?`max_tokens`:`end_turn`}async function*oe(e,t){let n=`msg_${W().replace(/-/g,``).slice(0,24)}`,r=new Map,i=!1,a=-1,o=!1,s=!1,c=async function*(){i||(i=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0}}})};for await(let t of e){for await(let e of c())yield e;let e=t.type;if(e===`response.output_text.delta`){o||(s&&(yield{type:`content_block_stop`,index:a},s=!1),a++,o=!0,yield{type:`content_block_start`,index:a,content_block:{type:`text`,text:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`text_delta`,text:String(t.delta??``)}};continue}if(e===`response.reasoning_text.delta`){s||(o&&(yield{type:`content_block_stop`,index:a},o=!1),a++,s=!0,yield{type:`content_block_start`,index:a,content_block:{type:`thinking`,thinking:``,signature:``}}),yield{type:`content_block_delta`,index:a,delta:{type:`thinking_delta`,thinking:String(t.delta??``)}};continue}if(e===`response.output_item.added`){let e=t.item,n=typeof t.output_index==`number`?t.output_index:-1;if(e?.type===`function_call`&&n>=0){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1),a++;let t=String(e.call_id??e.id??`call_${n}`),i=String(e.name??``);r.set(n,{contentIndex:a,open:!0,name:i,id:t}),yield{type:`content_block_start`,index:a,content_block:{type:`tool_use`,id:t,name:i,input:{}}}}continue}if(e===`response.function_call_arguments.delta`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n&&(yield{type:`content_block_delta`,index:n.contentIndex,delta:{type:`input_json_delta`,partial_json:String(t.delta??``)}});continue}if(e===`response.output_item.done`){let e=typeof t.output_index==`number`?t.output_index:-1,n=r.get(e);n?.open&&(yield{type:`content_block_stop`,index:n.contentIndex},n.open=!1);continue}if(e===`response.error`){let e=t.error;throw Error(String(e?.message??`ChatGPT Responses API error`))}if(e===`response.failed`){let e=t.response?.error;throw Error(String(e?.message??`ChatGPT Responses API failed`))}if(e===`response.completed`||e===`response.incomplete`){o&&(yield{type:`content_block_stop`,index:a},o=!1),s&&(yield{type:`content_block_stop`,index:a},s=!1);let e=t.response;yield{type:`message_delta`,delta:{stop_reason:ae(e),stop_sequence:null},usage:ie(e)},yield{type:`message_stop`}}}}async function se(e){let t=await b(),n=e.fetchOverride??globalThis.fetch,r={Authorization:`Bearer ${t.accessToken}`,"Content-Type":`application/json`,Accept:`text/event-stream`,"OpenAI-Beta":`responses=experimental`,Origin:`https://chatgpt.com`,Referer:`https://chatgpt.com/`,originator:`claude-code-best`};t.accountId&&(r[`ChatGPT-Account-Id`]=t.accountId);let i=await n(`https://chatgpt.com/backend-api/codex/responses`,{method:`POST`,headers:r,body:JSON.stringify(e.request),signal:e.signal});if(!i.ok){let e=await i.text().catch(()=>``);throw Error(`ChatGPT Responses API request failed (${i.status})${e?`: ${e.slice(0,500)}`:``}`)}return X(i)}var ce=e((()=>{w()}));function Z(e){if(t(process.env.OPENAI_ENABLE_THINKING))return!1;if(r(process.env.OPENAI_ENABLE_THINKING))return!0;let n=e.toLowerCase();return n.includes(`deepseek`)||n.includes(`mimo`)}function le(e,t){return t??(process.env.OPENAI_MAX_TOKENS&&parseInt(process.env.OPENAI_MAX_TOKENS,10)||void 0)??(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS&&parseInt(process.env.CLAUDE_CODE_MAX_OUTPUT_TOKENS,10)||void 0)??e}function ue(e){let{model:t,messages:n,tools:r,toolChoice:i,enableThinking:a,maxTokens:o,temperatureOverride:s}=e;return{model:t,messages:n,max_tokens:o,...r.length>0&&{tools:r,...i&&{tool_choice:i}},stream:!0,stream_options:{include_usage:!0},...a&&{thinking:{type:`enabled`},enable_thinking:!0,chat_template_kwargs:{thinking:!0,enable_thinking:!0}},...!a&&s!==void 0&&{temperature:s}}}var de=e((()=>{n()}));function Q(e){if(e===`low`)return`low`;if(e===`medium`)return`medium`;if(e===`high`)return`high`;if(e===`xhigh`||e===`max`)return`xhigh`;if(typeof e==`number`)return`high`}function fe(e){let t=process.env.CLAUDE_CODE_EFFORT_LEVEL?.toLowerCase();if(!(t===`auto`||t===`unset`))return Q(t)??Q(e)??`medium`}function pe(e,t,n,r){if(!r||C())return e;let i=t.filter(e=>n.has(e.name)).map(F).sort().join(`
10
+ `);return i?[u({content:`<available-deferred-tools>\n${i}\n</available-deferred-tools>`,isMeta:!0}),...e]:e}function me(e){return e.type===`assistant`||e.type===`user`}function $(e){let{partialMessage:t,contentBlocks:n,tools:r,agentId:i,usage:a,stopReason:o,maxTokens:s}=e,c=[],l=Object.keys(n).sort((e,t)=>Number(e)-Number(t)).map(e=>n[Number(e)]).filter(Boolean);return l.length>0&&t&&c.push({message:{...t,content:y(l,r,i),usage:a,stop_reason:o,stop_sequence:null},requestId:void 0,type:`assistant`,uuid:W(),timestamp:new Date().toISOString()}),o===`max_tokens`&&c.push(S({content:`Output truncated: response exceeded the ${s} token limit. Set OPENAI_MAX_TOKENS or CLAUDE_CODE_MAX_OUTPUT_TOKENS to override.`,apiError:`max_output_tokens`,error:`max_output_tokens`})),c}async function*he(e,t,n,r,a){try{let s=V(a.model),c=m(e,n),u=await T(a.model,n,a.getToolPermissionContext||(async()=>M()),a.agents||[],a.querySource),d=new Set;if(u)for(let e of n)N(e)&&d.add(e.name);let g=n;u&&d.size>0&&(g=n.filter(e=>!!(!d.has(e.name)||A(e,`SearchExtraTools`))));let _=await Promise.all(g.map(e=>ne(e,{getToolPermissionContext:a.getToolPermissionContext,tools:n,agents:a.agents,allowedAgentTypes:a.allowedAgentTypes,model:a.model,deferLoading:u&&d.has(e.name)}))),y=_.filter(e=>{let t=e;return t.type!==`advisor_20260301`&&t.type!==`computer_20250124`}),b=Z(s),x=B(pe(c.filter(me),n,d,u),t,{enableThinking:b}),S=R(y),C=L(a.toolChoice),w=fe(a.effortValue);if(u){let e=g.filter(e=>d.has(e.name)).length;l(`[OpenAI] Tool search enabled: ${e}/${d.size} deferred tools included, total tools=${S.length}`)}else l(`[OpenAI] Tool search disabled, total tools=${S.length}`);let{upperLimit:D}=o(s),O=le(D,a.maxOutputTokensOverride);l(`[OpenAI] Calling model=${s}, messages=${x.length}, tools=${S.length}, thinking=${b}`);let k=E()?oe(await se({request:Y({model:s,messages:x,tools:S,toolChoice:C,reasoningEffort:w}),signal:r,fetchOverride:a.fetchOverride}),s):I(await p({maxRetries:0,fetchOverride:a.fetchOverride,source:a.querySource}).chat.completions.create(ue({model:s,messages:x,tools:S,toolChoice:C,enableThinking:b,maxTokens:O,temperatureOverride:a.temperatureOverride}),{signal:r}),s),j={},P=[],F=null,z=null,U={input_tokens:0,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0},W=0,G=Date.now();for await(let e of k){switch(e.type){case`message_start`:F=e.message,W=Date.now()-G,e.message.usage&&(U={...U,...e.message.usage});break;case`content_block_start`:{let t=e.index,n=e.content_block;n.type===`tool_use`?j[t]={...n,input:``}:n.type===`text`?j[t]={...n,text:``}:n.type===`thinking`?j[t]={...n,thinking:``,signature:``}:j[t]={...n};break}case`content_block_delta`:{let t=e.index,n=e.delta,r=j[t];if(!r)break;n.type===`text_delta`?r.text=(r.text||``)+n.text:n.type===`input_json_delta`?r.input=(r.input||``)+n.partial_json:n.type===`thinking_delta`?r.thinking=(r.thinking||``)+n.thinking:n.type===`signature_delta`&&(r.signature=n.signature);break}case`content_block_stop`:break;case`message_delta`:{let t=e.usage;t&&(U=H(U,t)),e.delta.stop_reason!=null&&(z=e.delta.stop_reason);break}case`message_stop`:if(F){for(let e of $({partialMessage:F,contentBlocks:j,tools:n,agentId:a.agentId,usage:U,stopReason:z,maxTokens:O}))e.type===`assistant`&&P.push(e),yield e;F=null}U.input_tokens+U.output_tokens>0&&ee(i(s,U),U,a.model);break}yield{type:`stream_event`,event:e,...e.type===`message_start`?{ttftMs:W}:void 0}}if(te(a.langfuseTrace??null,{model:s,provider:`openai`,input:f(x),output:h(P),usage:{input_tokens:U.input_tokens,output_tokens:U.output_tokens,cache_creation_input_tokens:U.cache_creation_input_tokens,cache_read_input_tokens:U.cache_read_input_tokens},startTime:new Date(G),endTime:new Date,completionStartTime:W>0?new Date(G+W):void 0,tools:v(_),...b&&{thinking:{type:`enabled`}}}),F)for(let e of $({partialMessage:F,contentBlocks:j,tools:n,agentId:a.agentId,usage:U,stopReason:z,maxTokens:O}))yield e}catch(e){let t=e instanceof Error?e.message:String(e);l(`[OpenAI] Error: ${t}`,{level:`error`}),yield S({content:`API Error: ${t}`,apiError:`api_error`,error:e instanceof Error?e:Error(String(e))})}}e((()=>{g(),U(),z(),w(),ce(),_(),D(),j(),c(),x(),a(),de(),k(),d(),s(),O(),P()}))();export{he as queryModelOpenAI};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Cc as r,Zt as i,dc as a,on as o,yc as s}from"./paths-Ci1iwL5Y.js";import{l as c,u as l}from"./oauth-CdZEzMww.js";import{d as u,f as d,o as f,s as p}from"./log-DSV4Ht5l.js";import{a as m,l as h,o as g}from"./api-CDmgYrwN.js";async function _(){try{let{accessToken:e,orgUUID:n}=await h(),r=`${c().BASE_API_URL}/api/oauth/organizations/${n}/overage_credit_grant`;return(await t.get(r,{headers:m(e)})).data}catch(e){return p(e),null}}function v(){let e=i()?.organizationUuid;if(!e)return null;let t=a().overageCreditGrantCache?.[e];return!t||Date.now()-t.timestamp>S?null:t.info}function y(){let e=i()?.organizationUuid;if(!e)return;let t=a().overageCreditGrantCache;!t||!(e in t)||r(t=>{let n={...t.overageCreditGrantCache};return delete n[e],{...t,overageCreditGrantCache:n}})}async function b(){if(d())return;let e=i()?.organizationUuid;if(!e)return;let t=await _();t&&r(n=>{let r=n.overageCreditGrantCache?.[e],i=r?.info,a=i&&i.available===t.available&&i.eligible===t.eligible&&i.granted===t.granted&&i.amount_minor_units===t.amount_minor_units&&i.currency===t.currency;if(a&&r&&Date.now()-r.timestamp<=S)return n;let o={info:a?i:t,timestamp:Date.now()};return{...n,overageCreditGrantCache:{...n.overageCreditGrantCache,[e]:o}}})}function x(e){if(e.amount_minor_units==null||!e.currency)return null;if(e.currency.toUpperCase()===`USD`){let t=e.amount_minor_units/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}return null}var S,C=e((()=>{n(),l(),o(),s(),f(),u(),g(),S=3600*1e3}));export{b as a,y as i,v as n,C as r,x as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Cc as r,Zt as i,dc as a,on as o,yc as s}from"./paths-DO4WOQtD.js";import{l as c,u as l}from"./oauth-CdZEzMww.js";import{d as u,f as d,o as f,s as p}from"./log-DSV4Ht5l.js";import{a as m,l as h,o as g}from"./api-CQWbpxLP.js";async function _(){try{let{accessToken:e,orgUUID:n}=await h(),r=`${c().BASE_API_URL}/api/oauth/organizations/${n}/overage_credit_grant`;return(await t.get(r,{headers:m(e)})).data}catch(e){return p(e),null}}function v(){let e=i()?.organizationUuid;if(!e)return null;let t=a().overageCreditGrantCache?.[e];return!t||Date.now()-t.timestamp>S?null:t.info}function y(){let e=i()?.organizationUuid;if(!e)return;let t=a().overageCreditGrantCache;!t||!(e in t)||r(t=>{let n={...t.overageCreditGrantCache};return delete n[e],{...t,overageCreditGrantCache:n}})}async function b(){if(d())return;let e=i()?.organizationUuid;if(!e)return;let t=await _();t&&r(n=>{let r=n.overageCreditGrantCache?.[e],i=r?.info,a=i&&i.available===t.available&&i.eligible===t.eligible&&i.granted===t.granted&&i.amount_minor_units===t.amount_minor_units&&i.currency===t.currency;if(a&&r&&Date.now()-r.timestamp<=S)return n;let o={info:a?i:t,timestamp:Date.now()};return{...n,overageCreditGrantCache:{...n.overageCreditGrantCache,[e]:o}}})}function x(e){if(e.amount_minor_units==null||!e.currency)return null;if(e.currency.toUpperCase()===`USD`){let t=e.amount_minor_units/100;return Number.isInteger(t)?`$${t}`:`$${t.toFixed(2)}`}return null}var S,C=e((()=>{n(),l(),o(),s(),f(),u(),g(),S=3600*1e3}));export{b as a,y as i,v as n,C as r,x as t};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{B as n,Rn as r,b as i,f as a,t as o,x as s,xt as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{nd as u,rd as d}from"./loadAgentsDir-C_wFhytF.js";import{n as f,t as p}from"./SentryErrorBoundary-D-YZTGQG.js";function m(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function h(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function g(e){let t=[];return e.model&&t.push(e.model),t.push(`${h(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var _,v,y,b,x,S=e((()=>{_={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},v={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},y={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},b={running:`●`,done:`✓`,pending:`○`},x={running:`warning`,done:`success`,pending:`subtle`}}));function C(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function w({agents:e,selectedIndex:t,focused:r}){let[a,o]=n(D),c=E[Math.floor(o/D)%E.length];return e.length===0?(0,T.jsx)(i,{color:`subtle`,children:`(no agents in this phase)`}):(0,T.jsx)(s,{ref:a,flexDirection:`column`,children:e.map((e,n)=>{let a=m(e),o=n===t&&r,l=e.status===`running`?c:a.mark,u=C(e.label??`agent-${e.id}`,O);return(0,T.jsxs)(s,{backgroundColor:o?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(i,{color:a.color,children:l}),(0,T.jsxs)(i,{children:[` `,u]})]}),(0,T.jsx)(i,{color:`subtle`,children:g(e)})]},e.id)})})}var T,E,D,O,k=e((()=>{r(),o(),S(),T=l(),E=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],D=120,O=18}));function A(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=a?a.status:`pending`,s=e.agents.filter(e=>e.phase===i);r.push({title:i,status:o,done:s.filter(e=>e.status===`done`).length,total:s.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);return r}function j(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function M(e,t){return`${e}#${t.slice(-4)}`}function N(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var P=e((()=>{}));function F({phases:e,agents:t,selectedIndex:r,focused:a}){let[o,c]=n(R),l=L[Math.floor(c/R)%L.length],u=t.length;return(0,I.jsx)(s,{ref:o,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let n=t===r,o=n&&a,c=e.status===`running`?l:e.status?b[e.status]:` `,u=e.status?x[e.status]:`subtle`;return(0,I.jsxs)(s,{backgroundColor:o?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,I.jsxs)(s,{children:[(0,I.jsx)(i,{color:n?`claude`:void 0,children:o?`>`:` `}),(0,I.jsx)(i,{children:` `}),(0,I.jsx)(i,{color:u,children:c}),(0,I.jsxs)(i,{children:[` `,e.title]})]}),(0,I.jsxs)(i,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var I,L,R,z=e((()=>{r(),o(),S(),P(),I=l(),L=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],R=120}));function B({runs:e,activeRunId:t}){return e.length===0?(0,V.jsx)(i,{color:`subtle`,children:`(no runs)`}):(0,V.jsx)(s,{children:e.map(e=>{let n=e.runId===t,r=M(e.workflowName,e.runId),a=`═`.repeat(r.length+2);return(0,V.jsxs)(s,{flexDirection:`column`,marginRight:2,children:[(0,V.jsxs)(s,{children:[(0,V.jsx)(i,{color:v[e.status],children:_[e.status]}),(0,V.jsx)(i,{children:` `}),(0,V.jsx)(i,{color:n?`claude`:void 0,bold:n,children:r})]}),(0,V.jsx)(i,{color:n?`claude`:void 0,children:n?a:``})]},e.runId)})})}var V,H=e((()=>{r(),o(),S(),P(),V=l()}));function U(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function W(e,t=`normal`){c((n,r)=>{let i=U(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var G=e((()=>{o()}));function K(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function q(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function J({onDone:e,context:t}){let r=u(),o=(0,Y.useSyncExternalStore)(r.subscribe,()=>r.listRuns(),()=>[]),[c,l]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(`phases`),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(0),[_,b]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{r.loadPersistedRuns()},[r]),(0,Y.useEffect)(()=>{if(o.length===0){c!==null&&l(null);return}o.some(e=>e.runId===c)||l(o[0].runId)},[o,c]);let x=o.find(e=>e.runId===c),S=x?A(x):[],C=S.length+1,T=K(p,C),E=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let t=x?{runId:x.runId,status:x.status}:null,n=E.current;if(E.current=t,!q(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[x?.runId,x?.status,e]);let D=T===0?void 0:S[T-1]?.title,O=x?j(x.agents,D):[],k=K(h,O.length),M=e=>{l(e),f(`phases`),m(0),g(0)};W({nextTab:()=>{if(o.length===0)return;let e=o[(o.findIndex(e=>e.runId===c)+1)%o.length];M(e.runId)},prevTab:()=>{if(o.length===0)return;let e=o[(o.findIndex(e=>e.runId===c)-1+o.length)%o.length];M(e.runId)},focusLeft:()=>f(`phases`),focusRight:()=>f(`agents`),moveUp:()=>{d===`phases`?m(e=>K(e-1,C)):g(e=>K(e-1,O.length))},moveDown:()=>{d===`phases`?m(e=>K(e+1,C)):g(e=>K(e+1,O.length))},killAgent:()=>{d!==`agents`||!x||O[k]&&b(`agent`)},killWorkflow:()=>{x&&b(`workflow`)},resumeFocused:()=>{if(!x)return;let n=t.canUseTool;if(!n){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}r.launch({resumeFromRunId:x.runId,name:x.workflowName},t,n).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(_!==null){b(null);return}e()},confirmYes:()=>{if(_===`workflow`&&x){r.kill(x.runId),b(null),e();return}else if(_===`agent`&&x){let e=O[k];e&&r.killAgent(x.runId,e.id)}b(null)},confirmNo:()=>b(null)},_===null?`normal`:`confirm`);let P=o.filter(e=>e.status===`running`).length,I=o.length-P,L=D??`All`,R=x?x.agents.filter(e=>e.status===`done`).length:0,[z]=n(1e3),V=x?Date.now()-x.startedAt:0;return(0,X.jsxs)(s,{ref:z,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,X.jsxs)(s,{justifyContent:`space-between`,children:[(0,X.jsx)(i,{bold:!0,children:x?.workflowName??`Workflows`}),x?(0,X.jsxs)(i,{color:`subtle`,children:[R,`/`,x.agentCount,` agents · `,N(V),` ·`,` `,(0,X.jsx)(i,{color:v[x.status],children:y[x.status]})]}):(0,X.jsxs)(i,{color:`subtle`,children:[P,` running · `,I,` done`]})]}),x?.description?(0,X.jsx)(i,{color:`subtle`,children:x.description}):null,o.length>1?(0,X.jsx)(s,{marginTop:1,children:(0,X.jsx)(B,{runs:o,activeRunId:c})}):null,(0,X.jsxs)(s,{flexDirection:`row`,marginTop:1,children:[(0,X.jsxs)(s,{width:`25%`,flexDirection:`column`,children:[(0,X.jsx)(i,{color:d===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,X.jsx)(F,{phases:S,agents:x?.agents??[],selectedIndex:T,focused:d===`phases`})]}),(0,X.jsx)(i,{color:`subtle`,children:`│`}),(0,X.jsxs)(s,{flexGrow:1,flexDirection:`column`,children:[(0,X.jsxs)(i,{color:d===`agents`?`claude`:`subtle`,bold:!0,children:[L,` · `,O.length,` agents`]}),(0,X.jsx)(w,{agents:O,selectedIndex:k,focused:d===`agents`})]})]}),(0,X.jsx)(s,{marginTop:1,children:(0,X.jsx)(i,{color:`subtle`,children:_===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),_===null?null:(0,X.jsx)(a,{title:_===`workflow`?`Kill workflow "${x?.workflowName??``}"?`:`Kill agent "${O[k]?.label??``}"?`,subtitle:_===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>b(null),color:`warning`,children:(0,X.jsx)(i,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var Y,X,Z=e((()=>{Y=t(r(),1),o(),d(),k(),z(),H(),S(),G(),P(),X=l()})),Q,$;e((()=>{f(),Z(),Q=l(),$=async(e,t,n)=>(0,Q.jsx)(p,{name:`WorkflowsPanel`,children:(0,Q.jsx)(J,{onDone:e,context:t})})}))();export{$ as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{B as n,Rn as r,b as i,f as a,t as o,x as s,xt as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{ed as u,td as d}from"./loadAgentsDir-ClTeo0nk.js";import{n as f,t as p}from"./SentryErrorBoundary-97iY7Nb7.js";function m(e){return e.status===`running`?{mark:`●`,color:`warning`}:e.resultKind===`dead`?{mark:`✗`,color:`error`}:{mark:`✓`,color:`success`}}function h(e){return e?e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e):`0`}function g(e){let t=[];return e.model&&t.push(e.model),t.push(`${h(e.tokenCount)} tok`),t.push(`${e.toolCount??0} tool`),t.join(` · `)}var _,v,y,b,x,S=e((()=>{_={running:`●`,completed:`✓`,failed:`✗`,killed:`■`},v={running:`warning`,completed:`success`,failed:`error`,killed:`subtle`},y={running:`running`,completed:`done`,failed:`failed`,killed:`killed`},b={running:`●`,done:`✓`,pending:`○`},x={running:`warning`,done:`success`,pending:`subtle`}}));function C(e,t){if(e.length<=t)return e;let n=e.match(/#\d+$/);if(!n)return e.slice(0,t);let r=n[0],i=e.slice(0,e.length-r.length),a=t-r.length-1;return`${i.slice(0,a)}…${r}`}function w({agents:e,selectedIndex:t,focused:r}){let[a,o]=n(D),c=E[Math.floor(o/D)%E.length];return e.length===0?(0,T.jsx)(i,{color:`subtle`,children:`(no agents in this phase)`}):(0,T.jsx)(s,{ref:a,flexDirection:`column`,children:e.map((e,n)=>{let a=m(e),o=n===t&&r,l=e.status===`running`?c:a.mark,u=C(e.label??`agent-${e.id}`,O);return(0,T.jsxs)(s,{backgroundColor:o?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,T.jsxs)(s,{children:[(0,T.jsx)(i,{color:a.color,children:l}),(0,T.jsxs)(i,{children:[` `,u]})]}),(0,T.jsx)(i,{color:`subtle`,children:g(e)})]},e.id)})})}var T,E,D,O,k=e((()=>{r(),o(),S(),T=l(),E=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],D=120,O=18}));function A(e){let t=new Map(e.phases.map(e=>[e.title,e])),n=new Set,r=[],i=i=>{if(n.has(i))return;n.add(i);let a=t.get(i),o=a?a.status:`pending`,s=e.agents.filter(e=>e.phase===i);r.push({title:i,status:o,done:s.filter(e=>e.status===`done`).length,total:s.length})};for(let t of e.declaredPhases)i(t);for(let t of e.phases)i(t.title);return r}function j(e,t){return t===void 0||t===`All`?e:e.filter(e=>e.phase===t)}function M(e,t){return`${e}#${t.slice(-4)}`}function N(e){let t=Math.floor(e/1e3);if(t<60)return`${t}s`;let n=Math.floor(t/60),r=t%60;return n<60?`${n}m${String(r).padStart(2,`0`)}s`:`${Math.floor(n/60)}h${String(n%60).padStart(2,`0`)}m`}var P=e((()=>{}));function F({phases:e,agents:t,selectedIndex:r,focused:a}){let[o,c]=n(R),l=L[Math.floor(c/R)%L.length],u=t.length;return(0,I.jsx)(s,{ref:o,flexDirection:`column`,children:[{title:`All`,done:t.filter(e=>e.status===`done`).length,total:u},...e].map((e,t)=>{let n=t===r,o=n&&a,c=e.status===`running`?l:e.status?b[e.status]:` `,u=e.status?x[e.status]:`subtle`;return(0,I.jsxs)(s,{backgroundColor:o?`selectionBg`:void 0,justifyContent:`space-between`,children:[(0,I.jsxs)(s,{children:[(0,I.jsx)(i,{color:n?`claude`:void 0,children:o?`>`:` `}),(0,I.jsx)(i,{children:` `}),(0,I.jsx)(i,{color:u,children:c}),(0,I.jsxs)(i,{children:[` `,e.title]})]}),(0,I.jsxs)(i,{color:`subtle`,children:[e.done,`/`,e.total]})]},e.title)})})}var I,L,R,z=e((()=>{r(),o(),S(),P(),I=l(),L=[`·`,`✢`,`✱`,`✶`,`✻`,`✽`],R=120}));function B({runs:e,activeRunId:t}){return e.length===0?(0,V.jsx)(i,{color:`subtle`,children:`(no runs)`}):(0,V.jsx)(s,{children:e.map(e=>{let n=e.runId===t,r=M(e.workflowName,e.runId),a=`═`.repeat(r.length+2);return(0,V.jsxs)(s,{flexDirection:`column`,marginRight:2,children:[(0,V.jsxs)(s,{children:[(0,V.jsx)(i,{color:v[e.status],children:_[e.status]}),(0,V.jsx)(i,{children:` `}),(0,V.jsx)(i,{color:n?`claude`:void 0,bold:n,children:r})]}),(0,V.jsx)(i,{color:n?`claude`:void 0,children:n?a:``})]},e.runId)})})}var V,H=e((()=>{r(),o(),S(),P(),V=l()}));function U(e,t,n=`normal`){return n===`confirm`?e===`y`||e===`Y`||t.return?`confirmYes`:e===`n`||e===`N`||t.escape||e===`q`?`confirmNo`:null:t.tab||e===` `?t.shift?`prevTab`:`nextTab`:t.escape||e===`q`?`quit`:e===`K`?`killWorkflow`:e===`x`?`killAgent`:e===`r`?`resume`:e===`n`?`newRun`:t.leftArrow?`focusLeft`:t.rightArrow?`focusRight`:t.upArrow?`moveUp`:t.downArrow?`moveDown`:null}function W(e,t=`normal`){c((n,r)=>{let i=U(n,r,t);if(i!==null)switch(i){case`nextTab`:e.nextTab();break;case`prevTab`:e.prevTab();break;case`focusLeft`:e.focusLeft();break;case`focusRight`:e.focusRight();break;case`moveUp`:e.moveUp();break;case`moveDown`:e.moveDown();break;case`killAgent`:e.killAgent();break;case`killWorkflow`:e.killWorkflow();break;case`resume`:e.resumeFocused();break;case`newRun`:e.newRun();break;case`quit`:e.quit();break;case`confirmYes`:e.confirmYes();break;case`confirmNo`:e.confirmNo();break}})}var G=e((()=>{o()}));function K(e,t){if(t===0)return 0;let n=Math.trunc(e);return Number.isNaN(n)||n<0?0:Math.min(n,t-1)}function q(e,t){return!e||!t||e.runId!==t.runId||e.status!==`running`?!1:t.status===`completed`||t.status===`failed`||t.status===`killed`}function J({onDone:e,context:t}){let r=u(),o=(0,Y.useSyncExternalStore)(r.subscribe,()=>r.listRuns(),()=>[]),[c,l]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(`phases`),[p,m]=(0,Y.useState)(0),[h,g]=(0,Y.useState)(0),[_,b]=(0,Y.useState)(null);(0,Y.useEffect)(()=>{r.loadPersistedRuns()},[r]),(0,Y.useEffect)(()=>{if(o.length===0){c!==null&&l(null);return}o.some(e=>e.runId===c)||l(o[0].runId)},[o,c]);let x=o.find(e=>e.runId===c),S=x?A(x):[],C=S.length+1,T=K(p,C),E=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{let t=x?{runId:x.runId,status:x.status}:null,n=E.current;if(E.current=t,!q(n,t))return;let r=setTimeout(()=>e(),800);return()=>{clearTimeout(r)}},[x?.runId,x?.status,e]);let D=T===0?void 0:S[T-1]?.title,O=x?j(x.agents,D):[],k=K(h,O.length),M=e=>{l(e),f(`phases`),m(0),g(0)};W({nextTab:()=>{if(o.length===0)return;let e=o[(o.findIndex(e=>e.runId===c)+1)%o.length];M(e.runId)},prevTab:()=>{if(o.length===0)return;let e=o[(o.findIndex(e=>e.runId===c)-1+o.length)%o.length];M(e.runId)},focusLeft:()=>f(`phases`),focusRight:()=>f(`agents`),moveUp:()=>{d===`phases`?m(e=>K(e-1,C)):g(e=>K(e-1,O.length))},moveDown:()=>{d===`phases`?m(e=>K(e+1,C)):g(e=>K(e+1,O.length))},killAgent:()=>{d!==`agents`||!x||O[k]&&b(`agent`)},killWorkflow:()=>{x&&b(`workflow`)},resumeFocused:()=>{if(!x)return;let n=t.canUseTool;if(!n){e(`resume needs canUseTool context; run /<name> resume from the main session.`);return}r.launch({resumeFromRunId:x.runId,name:x.workflowName},t,n).catch(t=>e(`resume failed: ${t.message}`))},newRun:()=>e(`Tip: start a named workflow with /<name>, or pass name via the Workflow tool.`),quit:()=>{if(_!==null){b(null);return}e()},confirmYes:()=>{if(_===`workflow`&&x){r.kill(x.runId),b(null),e();return}else if(_===`agent`&&x){let e=O[k];e&&r.killAgent(x.runId,e.id)}b(null)},confirmNo:()=>b(null)},_===null?`normal`:`confirm`);let P=o.filter(e=>e.status===`running`).length,I=o.length-P,L=D??`All`,R=x?x.agents.filter(e=>e.status===`done`).length:0,[z]=n(1e3),V=x?Date.now()-x.startedAt:0;return(0,X.jsxs)(s,{ref:z,flexDirection:`column`,borderStyle:`round`,borderColor:`claude`,paddingX:1,children:[(0,X.jsxs)(s,{justifyContent:`space-between`,children:[(0,X.jsx)(i,{bold:!0,children:x?.workflowName??`Workflows`}),x?(0,X.jsxs)(i,{color:`subtle`,children:[R,`/`,x.agentCount,` agents · `,N(V),` ·`,` `,(0,X.jsx)(i,{color:v[x.status],children:y[x.status]})]}):(0,X.jsxs)(i,{color:`subtle`,children:[P,` running · `,I,` done`]})]}),x?.description?(0,X.jsx)(i,{color:`subtle`,children:x.description}):null,o.length>1?(0,X.jsx)(s,{marginTop:1,children:(0,X.jsx)(B,{runs:o,activeRunId:c})}):null,(0,X.jsxs)(s,{flexDirection:`row`,marginTop:1,children:[(0,X.jsxs)(s,{width:`25%`,flexDirection:`column`,children:[(0,X.jsx)(i,{color:d===`phases`?`claude`:`subtle`,bold:!0,children:`Phases`}),(0,X.jsx)(F,{phases:S,agents:x?.agents??[],selectedIndex:T,focused:d===`phases`})]}),(0,X.jsx)(i,{color:`subtle`,children:`│`}),(0,X.jsxs)(s,{flexGrow:1,flexDirection:`column`,children:[(0,X.jsxs)(i,{color:d===`agents`?`claude`:`subtle`,bold:!0,children:[L,` · `,O.length,` agents`]}),(0,X.jsx)(w,{agents:O,selectedIndex:k,focused:d===`agents`})]})]}),(0,X.jsx)(s,{marginTop:1,children:(0,X.jsx)(i,{color:`subtle`,children:_===null?`Tab switch run · ←/→ focus · ↑/↓ move · x kill agent · K kill workflow · r resume · q quit`:`Confirm: y kill · n/Esc cancel`})}),_===null?null:(0,X.jsx)(a,{title:_===`workflow`?`Kill workflow "${x?.workflowName??``}"?`:`Kill agent "${O[k]?.label??``}"?`,subtitle:_===`workflow`?`All in-flight agents will be aborted. Resume will replay from journal.`:`Only this agent aborts; other agents in the workflow keep running.`,onCancel:()=>b(null),color:`warning`,children:(0,X.jsx)(i,{color:`subtle`,children:`Press y to confirm, or n/Esc to cancel.`})})]})}var Y,X,Z=e((()=>{Y=t(r(),1),o(),d(),k(),z(),H(),S(),G(),P(),X=l()})),Q,$;e((()=>{f(),Z(),Q=l(),$=async(e,t,n)=>(0,Q.jsx)(p,{name:`WorkflowsPanel`,children:(0,Q.jsx)(J,{onDone:e,context:t})})}))();export{$ as call};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Q as n,Rn as r,b as i,p as a,t as o,tn as s,tt as c,x as l,xt as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Cc as f,Ps as p,dc as m,yc as h}from"./paths-Ci1iwL5Y.js";import{n as g,r as _}from"./analytics-DqMQntaB.js";import{o as v,s as y}from"./log-DSV4Ht5l.js";import{b,x}from"./teammate-CbskW5G9.js";import{t as S}from"./useKeybinding-DPOUuymz.js";import{n as C,t as w}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{i as T,n as E,o as D,r as O,s as k}from"./referral-IIcY3jkp.js";function A({onDone:e}){let[t,r]=(0,j.useState)(!0),[o,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,v]=(0,j.useState)(void 0),x=C(()=>e(`Guest passes dialog dismissed`,{display:`system`}));if(c(`confirm:no`,(0,j.useCallback)(()=>{e(`Guest passes dialog dismissed`,{display:`system`})},[e]),{context:`Confirmation`}),u((t,n)=>{n.return&&m&&s(m).then(t=>{t&&process.stdout.write(t),_(`tengu_guest_passes_link_copied`,{}),e(`Referral link copied to clipboard!`)})}),(0,j.useEffect)(()=>{async function e(){try{let e=await T();if(!e||!e.eligible){p(!1),r(!1);return}p(!0),e.referral_code_details?.referral_link&&h(e.referral_code_details.referral_link),v(e.referrer_reward);let t=e.referral_code_details?.campaign??`claude_code_guest_pass`,n;try{n=await E(t)}catch(e){y(e),p(!1),r(!1);return}let i=n.redemptions||[],a=n.limit||3,o=[];for(let e=0;e<a;e++){let t=i[e];o.push({passNumber:e+1,isAvailable:!t})}d(o),r(!1)}catch(e){y(e),p(!1),r(!1)}}e()},[]),t)return(0,M.jsx)(a,{children:(0,M.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`Loading guest pass information…`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:x.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});if(!f)return(0,M.jsx)(a,{children:(0,M.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{children:`Guest passes are not currently available.`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:x.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});let S=b(o,e=>e.isAvailable),w=[...o].sort((e,t)=>t.isAvailable-+e.isAvailable),D=e=>e.isAvailable?(0,M.jsxs)(l,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{children:`┌──────────┐`}),(0,M.jsxs)(i,{children:[` ) CC `,(0,M.jsx)(i,{color:`claude`,children:`✻`}),` ┊ ( `]}),(0,M.jsx)(i,{children:`└──────────┘`})]},e.passNumber):(0,M.jsxs)(l,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`┌─────────╱`}),(0,M.jsx)(i,{dimColor:!0,children:` ) CC ✻ ┊╱`}),(0,M.jsx)(i,{dimColor:!0,children:`└───────╱`})]},e.passNumber);return(0,M.jsx)(a,{children:(0,M.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,M.jsxs)(i,{color:`permission`,children:[`Guest passes · `,S,` left`]}),(0,M.jsx)(l,{flexDirection:`row`,marginLeft:2,children:w.slice(0,3).map(e=>D(e))}),m&&(0,M.jsx)(l,{marginLeft:2,children:(0,M.jsx)(i,{children:m})}),(0,M.jsx)(l,{flexDirection:`column`,marginLeft:2,children:(0,M.jsxs)(i,{dimColor:!0,children:[g?`Share a free week of Claude Code with friends. If they love it and subscribe, you'll get ${O(g)} of extra usage to keep building. `:`Share a free week of Claude Code with friends. `,(0,M.jsx)(n,{url:g?`https://support.claude.com/en/articles/13456702-claude-code-guest-passes`:`https://support.claude.com/en/articles/12875061-claude-code-guest-passes`,children:`Terms apply.`})]})}),(0,M.jsx)(l,{children:(0,M.jsx)(i,{dimColor:!0,italic:!0,children:x.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Enter to copy link · Esc to cancel`})})})]})})}var j,M,N=e((()=>{r(),j=t(r(),1),p(),w(),o(),S(),g(),k(),x(),v(),M=d()}));async function P(e){let t=!m().hasVisitedPasses;if(t){let e=D();f(t=>({...t,hasVisitedPasses:!0,passesLastSeenRemaining:e??t.passesLastSeenRemaining}))}return _(`tengu_guest_passes_visited`,{is_first_visit:t}),(0,F.jsx)(A,{onDone:e})}var F;e((()=>{r(),N(),g(),k(),h(),F=d()}))();export{P as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Q as n,Rn as r,b as i,p as a,t as o,tn as s,tt as c,x as l,xt as u}from"./src-Di342QoJ.js";import{t as d}from"./jsx-runtime-D-D469L8.js";import{Cc as f,Ps as p,dc as m,yc as h}from"./paths-DO4WOQtD.js";import{n as g,r as _}from"./analytics-DqMQntaB.js";import{o as v,s as y}from"./log-DSV4Ht5l.js";import{b,x}from"./teammate-CbskW5G9.js";import{t as S}from"./useKeybinding-DPOUuymz.js";import{n as C,t as w}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{i as T,n as E,o as D,r as O,s as k}from"./referral-Da4mpbd3.js";function A({onDone:e}){let[t,r]=(0,j.useState)(!0),[o,d]=(0,j.useState)([]),[f,p]=(0,j.useState)(!1),[m,h]=(0,j.useState)(null),[g,v]=(0,j.useState)(void 0),x=C(()=>e(`Guest passes dialog dismissed`,{display:`system`}));if(c(`confirm:no`,(0,j.useCallback)(()=>{e(`Guest passes dialog dismissed`,{display:`system`})},[e]),{context:`Confirmation`}),u((t,n)=>{n.return&&m&&s(m).then(t=>{t&&process.stdout.write(t),_(`tengu_guest_passes_link_copied`,{}),e(`Referral link copied to clipboard!`)})}),(0,j.useEffect)(()=>{async function e(){try{let e=await T();if(!e||!e.eligible){p(!1),r(!1);return}p(!0),e.referral_code_details?.referral_link&&h(e.referral_code_details.referral_link),v(e.referrer_reward);let t=e.referral_code_details?.campaign??`claude_code_guest_pass`,n;try{n=await E(t)}catch(e){y(e),p(!1),r(!1);return}let i=n.redemptions||[],a=n.limit||3,o=[];for(let e=0;e<a;e++){let t=i[e];o.push({passNumber:e+1,isAvailable:!t})}d(o),r(!1)}catch(e){y(e),p(!1),r(!1)}}e()},[]),t)return(0,M.jsx)(a,{children:(0,M.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`Loading guest pass information…`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:x.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});if(!f)return(0,M.jsx)(a,{children:(0,M.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,M.jsx)(i,{children:`Guest passes are not currently available.`}),(0,M.jsx)(i,{dimColor:!0,italic:!0,children:x.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Esc to cancel`})})]})});let S=b(o,e=>e.isAvailable),w=[...o].sort((e,t)=>t.isAvailable-+e.isAvailable),D=e=>e.isAvailable?(0,M.jsxs)(l,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{children:`┌──────────┐`}),(0,M.jsxs)(i,{children:[` ) CC `,(0,M.jsx)(i,{color:`claude`,children:`✻`}),` ┊ ( `]}),(0,M.jsx)(i,{children:`└──────────┘`})]},e.passNumber):(0,M.jsxs)(l,{flexDirection:`column`,marginRight:1,children:[(0,M.jsx)(i,{dimColor:!0,children:`┌─────────╱`}),(0,M.jsx)(i,{dimColor:!0,children:` ) CC ✻ ┊╱`}),(0,M.jsx)(i,{dimColor:!0,children:`└───────╱`})]},e.passNumber);return(0,M.jsx)(a,{children:(0,M.jsxs)(l,{flexDirection:`column`,gap:1,children:[(0,M.jsxs)(i,{color:`permission`,children:[`Guest passes · `,S,` left`]}),(0,M.jsx)(l,{flexDirection:`row`,marginLeft:2,children:w.slice(0,3).map(e=>D(e))}),m&&(0,M.jsx)(l,{marginLeft:2,children:(0,M.jsx)(i,{children:m})}),(0,M.jsx)(l,{flexDirection:`column`,marginLeft:2,children:(0,M.jsxs)(i,{dimColor:!0,children:[g?`Share a free week of Claude Code with friends. If they love it and subscribe, you'll get ${O(g)} of extra usage to keep building. `:`Share a free week of Claude Code with friends. `,(0,M.jsx)(n,{url:g?`https://support.claude.com/en/articles/13456702-claude-code-guest-passes`:`https://support.claude.com/en/articles/12875061-claude-code-guest-passes`,children:`Terms apply.`})]})}),(0,M.jsx)(l,{children:(0,M.jsx)(i,{dimColor:!0,italic:!0,children:x.pending?(0,M.jsxs)(M.Fragment,{children:[`Press `,x.keyName,` again to exit`]}):(0,M.jsx)(M.Fragment,{children:`Enter to copy link · Esc to cancel`})})})]})})}var j,M,N=e((()=>{r(),j=t(r(),1),p(),w(),o(),S(),g(),k(),x(),v(),M=d()}));async function P(e){let t=!m().hasVisitedPasses;if(t){let e=D();f(t=>({...t,hasVisitedPasses:!0,passesLastSeenRemaining:e??t.passesLastSeenRemaining}))}return _(`tengu_guest_passes_visited`,{is_first_visit:t}),(0,F.jsx)(A,{onDone:e})}var F;e((()=>{r(),N(),g(),k(),h(),F=d()}))();export{P as call};