@readmagic/workmate 0.0.16 → 0.0.17

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 (247) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DAtfMH4o.js → AddWorkspaceDirectory-YAhnVwyN.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog--D4BeNAN.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-BTYgjY5c.js → AgentsMdExternalIncludesDialog-Ba4GYFl3.js} +1 -1
  4. package/dist/chunks/{App-HF0bvxi_.js → App-mri25OrC.js} +1 -1
  5. package/dist/chunks/{ApproveApiKey-BBFLw2B7.js → ApproveApiKey-DCw6d7dm.js} +1 -1
  6. package/dist/chunks/ApproveApiKey-lv4Sg0RR.js +1 -0
  7. package/dist/chunks/{BackgroundTasksDialog-Coc0ecUd.js → BackgroundTasksDialog-CZND8e_Z.js} +1 -1
  8. package/dist/chunks/{BypassPermissionsModeDialog--Gx9ARd4.js → BypassPermissionsModeDialog-B5QBJTB4.js} +1 -1
  9. package/dist/chunks/{DiffDialog-tlINuFS1.js → DiffDialog-Bd-DcTsK.js} +1 -1
  10. package/dist/chunks/{Doctor-Wh7z6CnF.js → Doctor-C9t7udHN.js} +1 -1
  11. package/dist/chunks/Doctor-V-JLC4e3.js +1 -0
  12. package/dist/chunks/{ExitFlow-B1zHTqQt.js → ExitFlow-CShdrKmr.js} +1 -1
  13. package/dist/chunks/{Grove-1Kf7xxIV.js → Grove-CClEZT2e.js} +1 -1
  14. package/dist/chunks/{HybridTransport-DWqWUZCH.js → HybridTransport-DyEuslQB.js} +1 -1
  15. package/dist/chunks/{InvalidConfigDialog-OZPFQSnC.js → InvalidConfigDialog-Wyrk_cXR.js} +1 -1
  16. package/dist/chunks/{InvalidSettingsDialog-BNCm-eyC.js → InvalidSettingsDialog-Cr9fmSyh.js} +1 -1
  17. package/dist/chunks/{MCPConnectionManager-7H84oi5n.js → MCPConnectionManager-BnUw0nYN.js} +1 -1
  18. package/dist/chunks/{MCPToolListView-CVgtg3Iq.js → MCPToolListView-CY2EezWF.js} +1 -1
  19. package/dist/chunks/{McpParsingWarnings-CN8f449l.js → McpParsingWarnings-BF4np2Y3.js} +1 -1
  20. package/dist/chunks/{MessageSelector-B9j6zZ5w.js → MessageSelector-Dtt2Sf65.js} +1 -1
  21. package/dist/chunks/{Messages-yz1m39eI.js → Messages-D5Uuapmf.js} +1 -1
  22. package/dist/chunks/{Onboarding-bFbgae8m.js → Onboarding-BAJXV7Ay.js} +1 -1
  23. package/dist/chunks/{PromptInputFooterSuggestions-CE_yVun1.js → PromptInputFooterSuggestions-Cm4WN3qd.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-TPWuGwAy.js → PromptInputHelpMenu-ESj8sOpK.js} +1 -1
  25. package/dist/chunks/{QueryEngine-CRobcENE.js → QueryEngine-B79JLwG4.js} +1 -1
  26. package/dist/chunks/REPL-B7evbhvN.js +1 -0
  27. package/dist/chunks/{REPL-C33mMf_q.js → REPL-cAXdORs2.js} +5 -5
  28. package/dist/chunks/{RemoteSessionManager-BjVD918g.js → RemoteSessionManager-C5pAD0Lh.js} +1 -1
  29. package/dist/chunks/{ResumeConversation-CXd8d8po.js → ResumeConversation-NSVT3gn7.js} +1 -1
  30. package/dist/chunks/{SSETransport-BSilVN9e.js → SSETransport-CDGMGrxN.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-CddjJcAH.js +1 -0
  32. package/dist/chunks/{Settings-ClcLl0C1.js → Settings-_b5Yxt_9.js} +2 -2
  33. package/dist/chunks/{TeleportProgress-DonJUoPc.js → TeleportProgress-8cS6aHVO.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-ByOuSVVz.js → TeleportRepoMismatchDialog-B0epkMgp.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-BBtELwF1.js → TeleportResumeWrapper-Bb14JeEk.js} +1 -1
  36. package/dist/chunks/{ThemePicker-1QQJFOEv.js → ThemePicker-CnX8faYA.js} +1 -1
  37. package/dist/chunks/{TrustDialog-DwJ9L_u4.js → TrustDialog-6wJF3W6K.js} +1 -1
  38. package/dist/chunks/{add-dir-DOKdPFT2.js → add-dir-LLAv-rGS.js} +1 -1
  39. package/dist/chunks/{agentDisplay-TX1bh-lX.js → agentDisplay-QqGqcHGz.js} +1 -1
  40. package/dist/chunks/{agents-CbRjX9Pj.js → agents-C8wRUTNV.js} +1 -1
  41. package/dist/chunks/{agents-C58tRxpi.js → agents-DFPEienW.js} +1 -1
  42. package/dist/chunks/{allErrors-DRiW7i6Y.js → allErrors-DUYYPpdH.js} +1 -1
  43. package/dist/chunks/{api-CazVavfB.js → api-B3Wnozaf.js} +1 -1
  44. package/dist/chunks/api-BAT--5sp.js +1 -0
  45. package/dist/chunks/{auth-CfrCl9BZ.js → auth-CQGJitIV.js} +1 -1
  46. package/dist/chunks/auth-DaJXqwN5.js +1 -0
  47. package/dist/chunks/auth-DkhPycBL.js +1 -0
  48. package/dist/chunks/{backgroundHousekeeping-CPLlaWcV.js → backgroundHousekeeping-Bjb_Jc7L.js} +2 -2
  49. package/dist/chunks/backgroundHousekeeping-V-dg2j2E.js +1 -0
  50. package/dist/chunks/{branch-pAa0oBaj.js → branch-BWq5ynjm.js} +1 -1
  51. package/dist/chunks/{bridgeConfig-DnFfCpGd.js → bridgeConfig-B3mR0kJ0.js} +1 -1
  52. package/dist/chunks/bridgeConfig-D31i4BRi.js +1 -0
  53. package/dist/chunks/{bridgeMessaging-B_hnuUHb.js → bridgeMessaging-wZ5EKxW_.js} +1 -1
  54. package/dist/chunks/{bridgeStatusUtil-Dwz4YHNA.js → bridgeStatusUtil-mvVQSVN-.js} +1 -1
  55. package/dist/chunks/{btw-CkVkYeRr.js → btw-XNgXHnNr.js} +1 -1
  56. package/dist/chunks/{caches-BLQUkrIG.js → caches-ByLjTvdy.js} +1 -1
  57. package/dist/chunks/caches-ckqJ4Qso.js +1 -0
  58. package/dist/chunks/{ccrClient-AfdUbWzY.js → ccrClient-EisctZbc.js} +1 -1
  59. package/dist/chunks/{clear-Ac3qYi_-.js → clear-BjtPf2Jb.js} +1 -1
  60. package/dist/chunks/client-Bl43xcRk.js +1 -0
  61. package/dist/chunks/commands-BDhn7EPO.js +1 -0
  62. package/dist/chunks/{compact-CXuDr5qM.js → compact-w8AhLkr6.js} +1 -1
  63. package/dist/chunks/config-CbAvTdZ7.js +1 -0
  64. package/dist/chunks/{context-C2plOqH4.js → context-Btn2JU2y.js} +1 -1
  65. package/dist/chunks/{context-noninteractive-fVQtwEkw.js → context-noninteractive-044464Vs.js} +1 -1
  66. package/dist/chunks/context-noninteractive-ulRLlYg5.js +1 -0
  67. package/dist/chunks/conversation-D08lU377.js +1 -0
  68. package/dist/chunks/{conversation-DQpS6nvg.js → conversation-a82khZ_n.js} +1 -1
  69. package/dist/chunks/{createSSHSession-CfyFuJMH.js → createSSHSession-C0KSI0fJ.js} +1 -1
  70. package/dist/chunks/{createSession-qk9C66lK.js → createSession-8ScCWTKb.js} +1 -1
  71. package/dist/chunks/createSession-CnlPXXkA.js +1 -0
  72. package/dist/chunks/{crossProjectResume-DY1ZBO5P.js → crossProjectResume-BCN462Wa.js} +1 -1
  73. package/dist/chunks/{datadog-Cr0VKbct.js → datadog-BqINRWAW.js} +1 -1
  74. package/dist/chunks/{diff-BNjcCXDr.js → diff-CcrSQNvQ.js} +1 -1
  75. package/dist/chunks/doctor-DRFDBrH1.js +1 -0
  76. package/dist/chunks/{entry-o9IZPS4g.js → entry-oVZ7Z59B.js} +1 -1
  77. package/dist/chunks/{esm-BI3tFLyy.js → esm-BZciQG9N.js} +1 -1
  78. package/dist/chunks/{exit-Dlyj7nY8.js → exit-jikLI2Zh.js} +1 -1
  79. package/dist/chunks/{extraUsage-5Ueiyw6W.js → extraUsage-BT3in1Aj.js} +1 -1
  80. package/dist/chunks/extractMemories-BsQU2bVO.js +1 -0
  81. package/dist/chunks/fast-B9vVL3sY.js +1 -0
  82. package/dist/chunks/{fast-ClOKONyD.js → fast-CKhtBOx7.js} +1 -1
  83. package/dist/chunks/fetchModelList-BeL40TyR.js +1 -0
  84. package/dist/chunks/{fetchModelList-gh_jFYai.js → fetchModelList-DmaMgpa2.js} +1 -1
  85. package/dist/chunks/{fileSuggestions-DK7W8kLF.js → fileSuggestions-BfG3sbET.js} +1 -1
  86. package/dist/chunks/firstPartyEventLogger-6GwZ6VLr.js +1 -0
  87. package/dist/chunks/{firstPartyEventLogger-BMnXb9cv.js → firstPartyEventLogger-Q3fMF0BR.js} +2 -2
  88. package/dist/chunks/{flushGate-n4kK6H1U.js → flushGate-COa_KO98.js} +1 -1
  89. package/dist/chunks/{gemini-C8-QHnsC.js → gemini-L8Gj2B4H.js} +1 -1
  90. package/dist/chunks/{generateSessionName-C8DnAVaa.js → generateSessionName-cAL5T7pG.js} +1 -1
  91. package/dist/chunks/{goal-DMmzlZOF.js → goal-D-x2WXm7.js} +1 -1
  92. package/dist/chunks/{grok-LLjpAwP_.js → grok-DtypRM4d.js} +1 -1
  93. package/dist/chunks/{grove-CQBCzeHf.js → grove-CSivzrhe.js} +1 -1
  94. package/dist/chunks/{help-JH7WzjZP.js → help-DKZhC0lL.js} +1 -1
  95. package/dist/chunks/{hooks-DD2jpRfx.js → hooks-D_afUDcs.js} +1 -1
  96. package/dist/chunks/hooks-DvVuNKRx.js +1 -0
  97. package/dist/chunks/{initReplBridge-BDaN0hpY.js → initReplBridge-sTaq4a0K.js} +1 -1
  98. package/dist/chunks/{install-CD4or0vj.js → install-BWe3Jz4M.js} +1 -1
  99. package/dist/chunks/{instrumentation-n-otwpYf.js → instrumentation-IljwxX0V.js} +3 -3
  100. package/dist/chunks/{job-B-pEWgXI.js → job-N25KhSUu.js} +1 -1
  101. package/dist/chunks/{keybindings-qed9q9tx.js → keybindings-DLEorhlY.js} +1 -1
  102. package/dist/chunks/{launchLocalMemory-cBovdGMT.js → launchLocalMemory-DJsuNLIf.js} +1 -1
  103. package/dist/chunks/{launchOnboarding-B__wtt7p.js → launchOnboarding-CVvuxeH-.js} +1 -1
  104. package/dist/chunks/{loadAgentsDir-PPiD2Mfq.js → loadAgentsDir-CbtNPJV3.js} +23 -23
  105. package/dist/chunks/loadAgentsDir-D0gl_H2S.js +1 -0
  106. package/dist/chunks/{loadPluginHooks-DUCuU3_8.js → loadPluginHooks-BxkDBFd6.js} +1 -1
  107. package/dist/chunks/{localSearch-Cvs9WfoX.js → localSearch-B5mTHBwK.js} +1 -1
  108. package/dist/chunks/localSearch-D3UrYUre.js +1 -0
  109. package/dist/chunks/{logoV2Utils-Bkj74dtY.js → logoV2Utils-D5nRpirL.js} +1 -1
  110. package/dist/chunks/{magicDocs-3U6peChg.js → magicDocs-C9aIo4Oe.js} +1 -1
  111. package/dist/chunks/{main-DkjxhBIC.js → main-DeUt_aE2.js} +9 -9
  112. package/dist/chunks/managedEnv-ADMKY7-G.js +1 -0
  113. package/dist/chunks/{managedEnv-BUrzwaD3.js → managedEnv-CDxyrUw1.js} +1 -1
  114. package/dist/chunks/{mappers-ZGgwqDOK.js → mappers-Del1KoA7.js} +1 -1
  115. package/dist/chunks/{mcp-COZxwgJZ.js → mcp-Bh3MNBIj.js} +2 -2
  116. package/dist/chunks/{mcp-CdyNeNzh.js → mcp-D7vMhEOV.js} +1 -1
  117. package/dist/chunks/{mcp-CysOyBIn.js → mcp-nnBVM5Lt.js} +1 -1
  118. package/dist/chunks/{memory-B5h2TTSS.js → memory-DtqQhHu8.js} +1 -1
  119. package/dist/chunks/{mode-D3yY1fdK.js → mode-DPbrxU32.js} +1 -1
  120. package/dist/chunks/{model-Bz4JHoU0.js → model-B50j-O5v.js} +1 -1
  121. package/dist/chunks/model-DLG1nrnf.js +1 -0
  122. package/dist/chunks/{model-sviY1inu.js → model-DlLO7TSx.js} +1 -1
  123. package/dist/chunks/{modelOptions-DYQqTLPi.js → modelOptions-SMq3one0.js} +1 -1
  124. package/dist/chunks/{nativeInstaller-N1xiUpCP.js → nativeInstaller-DTJ4clp-.js} +1 -1
  125. package/dist/chunks/{omit-BOILu8jW.js → omit-CMldTqqy.js} +1 -1
  126. package/dist/chunks/{onChangeAppState-COFFZAXb.js → onChangeAppState-EAnsmOuo.js} +1 -1
  127. package/dist/chunks/{openai-BHM5kEFo.js → openai-D9KvLMrj.js} +1 -1
  128. package/dist/chunks/{partition-C1SFDk_L.js → partition-B8Y4jvjW.js} +1 -1
  129. package/dist/chunks/{permissions-uy_NFbfy.js → permissions-cDtIZRM1.js} +1 -1
  130. package/dist/chunks/{pidLock-DuMVSwnN.js → pidLock-Br3_YNi_.js} +2 -2
  131. package/dist/chunks/{plan-DF9YSB5M.js → plan-dG2H4eQl.js} +1 -1
  132. package/dist/chunks/{plugin-GRPzqgTr.js → plugin-CzQHuIlP.js} +1 -1
  133. package/dist/chunks/{pluginAutoupdate-AMD-FvKB.js → pluginAutoupdate-B9W_vxOG.js} +1 -1
  134. package/dist/chunks/{pluginBlocklist-DNxkAxH6.js → pluginBlocklist-BvdBsnJG.js} +1 -1
  135. package/dist/chunks/{pluginCliCommands-BFoR1ZXx.js → pluginCliCommands-NKIgFTUF.js} +1 -1
  136. package/dist/chunks/{pluginFlagging-CW2IZWSI.js → pluginFlagging-C0PtAJEg.js} +1 -1
  137. package/dist/chunks/{pluginOperations-DlWE0idP.js → pluginOperations-wUUdFpu9.js} +1 -1
  138. package/dist/chunks/pluginStartupCheck-hDT6pEAd.js +1 -0
  139. package/dist/chunks/{pluginStartupCheck-AQGV0DCS.js → pluginStartupCheck-p0njap1l.js} +1 -1
  140. package/dist/chunks/{plugins-CwUSTE4E.js → plugins-B9WBqOAW.js} +1 -1
  141. package/dist/chunks/{print-9wR_ijrL.js → print-G3DgPTxy.js} +3 -3
  142. package/dist/chunks/{processBashCommand-Deqwq1IE.js → processBashCommand-zLWgCRws.js} +1 -1
  143. package/dist/chunks/{processSlashCommand-U9LJ4Keq.js → processSlashCommand-BHBnHBjj.js} +1 -1
  144. package/dist/chunks/{prompt-CQmEvnKN.js → prompt-BRGC5U9Y.js} +1 -1
  145. package/dist/chunks/prompt-Ct3Ryb3C.js +1 -0
  146. package/dist/chunks/prompt-TZJKyomz.js +1 -0
  147. package/dist/chunks/{promptEditor-Bf72KNF-.js → promptEditor-CRIw6vJS.js} +1 -1
  148. package/dist/chunks/{reconciler-Css9bs07.js → reconciler-DiU1RvGD.js} +1 -1
  149. package/dist/chunks/{refresh-B87z39Zs.js → refresh-DEXe3Lmx.js} +1 -1
  150. package/dist/chunks/{reload-plugins-BpmUIkfm.js → reload-plugins-Cl6wvT6V.js} +1 -1
  151. package/dist/chunks/{remoteBridgeCore-BCLIIygk.js → remoteBridgeCore-DnFZoXaw.js} +1 -1
  152. package/dist/chunks/{remoteManagedSettings-Ahgn2e80.js → remoteManagedSettings-BboLJ46D.js} +1 -1
  153. package/dist/chunks/{rename-BUt3PliQ.js → rename-CdzxOzN5.js} +1 -1
  154. package/dist/chunks/{resume-uZI9p_FE.js → resume-DgFXYWTN.js} +1 -1
  155. package/dist/chunks/{runtimeObserver-AKOWfdZ_.js → runtimeObserver-CwtRE2cj.js} +1 -1
  156. package/dist/chunks/{runtimeObserver-By59MZKJ.js → runtimeObserver-Dov-m2dl.js} +2 -2
  157. package/dist/chunks/sandbox-adapter-CtEngx-6.js +1 -0
  158. package/dist/chunks/{sandbox-toggle-BdvylnWS.js → sandbox-toggle-DWCrG9zV.js} +1 -1
  159. package/dist/chunks/searchExtraTools-zFMN5MqY.js +1 -0
  160. package/dist/chunks/{session-Tm2-rzBY.js → session-L5191BSn.js} +1 -1
  161. package/dist/chunks/sessionFileAccessHooks-C2VjT-PU.js +1 -0
  162. package/dist/chunks/sessionObserver-BuhXr3FP.js +1 -0
  163. package/dist/chunks/{sessionObserver-BAr8AWeL.js → sessionObserver-DpY0DOjI.js} +1 -1
  164. package/dist/chunks/{sessionState-BTFowSpR.js → sessionState-BlbRQ3Y6.js} +1 -1
  165. package/dist/chunks/sessionStorage-CiYSwyY3.js +1 -0
  166. package/dist/chunks/sessionTitle-k4wpUS5l.js +2 -0
  167. package/dist/chunks/{sessionTracing-CvY4udYI.js → sessionTracing-DqVx8aFD.js} +1 -1
  168. package/dist/chunks/{settingsSync-nxeaGM2-.js → settingsSync-BhlegQAU.js} +1 -1
  169. package/dist/chunks/{setup-D4FPeBnM.js → setup-DvnKMqDy.js} +2 -2
  170. package/dist/chunks/{shadowedRuleDetection-Co8m1q1D.js → shadowedRuleDetection-Gerk3t93.js} +1 -1
  171. package/dist/chunks/{sideQuestion-4TJYn-Az.js → sideQuestion-RndkXExy.js} +1 -1
  172. package/dist/chunks/sinks-Cf4vx9UX.js +1 -0
  173. package/dist/chunks/{sinks-Bb2i50kz.js → sinks-CfzgqLH5.js} +1 -1
  174. package/dist/chunks/{skillChangeDetector-BU9AFG0i.js → skillChangeDetector-BQx4xe_b.js} +1 -1
  175. package/dist/chunks/{skillGapStore-BcVP3ZUb.js → skillGapStore-CLxhWLyq.js} +2 -2
  176. package/dist/chunks/{skillLifecycle-CG2XmS8f.js → skillLifecycle-CSNX2qOH.js} +2 -2
  177. package/dist/chunks/{skillSearchPanel-DOJmUBXB.js → skillSearchPanel-CsQDjy_E.js} +2 -2
  178. package/dist/chunks/{skills-DIgCWvzX.js → skills-DM9ACPW-.js} +1 -1
  179. package/dist/chunks/status-C3z0CSBw.js +1 -0
  180. package/dist/chunks/{status-Ber2xOXc.js → status-C5v7KsX4.js} +1 -1
  181. package/dist/chunks/{statusNoticeHelpers-CYkrPUpN.js → statusNoticeHelpers-BY_8pK19.js} +1 -1
  182. package/dist/chunks/switcher-C9VsM-ip.js +1 -0
  183. package/dist/chunks/{switcher-BIP3rbQn.js → switcher-CnBKuiNp.js} +1 -1
  184. package/dist/chunks/{syncCache-AMQMQ_HR.js → syncCache-Dff4hbz4.js} +1 -1
  185. package/dist/chunks/{tasks-BKERIO4G.js → tasks-qVyXOLBf.js} +1 -1
  186. package/dist/chunks/{teleport-DOXbf2sQ.js → teleport-Deq_ecN9.js} +1 -1
  187. package/dist/chunks/{templateJobs-dg2F45ZJ.js → templateJobs-CntPyct-.js} +1 -1
  188. package/dist/chunks/{theme-BGxytGjA.js → theme-DVWYzSct.js} +1 -1
  189. package/dist/chunks/{toolEventObserver-CJhg_p3P.js → toolEventObserver-BZn8ZJB5.js} +1 -1
  190. package/dist/chunks/{toolPool-C0d7Bznl.js → toolPool-Dzp1ob3I.js} +1 -1
  191. package/dist/chunks/trustedDevice-1Q4FTNyX.js +1 -0
  192. package/dist/chunks/{trustedDevice-BtXHXu-T.js → trustedDevice-CdLAZK6m.js} +1 -1
  193. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-C9orgrub.js → useExitOnCtrlCDWithKeybindings-YSWYVWk6.js} +1 -1
  194. package/dist/chunks/useMainLoopModel-C1JRp4zE.js +1 -0
  195. package/dist/chunks/{useManagePlugins-Bt-DYAnX.js → useManagePlugins-DfuI4Nhd.js} +1 -1
  196. package/dist/chunks/{useMergedTools-CZeQBdky.js → useMergedTools-B4qRVJ8b.js} +1 -1
  197. package/dist/chunks/{useSearchInput-DdKrVHJS.js → useSearchInput-DfUNYhqC.js} +1 -1
  198. package/dist/chunks/{useSettingsErrors-BR9Wws7D.js → useSettingsErrors-Bls74ocI.js} +1 -1
  199. package/dist/chunks/{userAgent-DUt0q-Vl.js → userAgent-CNPTS7ix.js} +1 -1
  200. package/dist/chunks/{util-h-Hmdke_.js → util-6aJHnBQ_.js} +1 -1
  201. package/dist/chunks/{validatePlugin-mWVKNtJa.js → validatePlugin-BajM6yNf.js} +1 -1
  202. package/dist/chunks/{workerRegistry-dlfqtySm.js → workerRegistry-BwJ54Lzk.js} +2 -2
  203. package/dist/chunks/worktree-BFP10vim.js +1 -0
  204. package/dist/cli.js +1 -1
  205. package/package.json +1 -1
  206. package/dist/chunks/AgentsMdExternalIncludesDialog-C6VH6JG6.js +0 -1
  207. package/dist/chunks/ApproveApiKey-B7mKgSqY.js +0 -1
  208. package/dist/chunks/Doctor-BJf49FWX.js +0 -1
  209. package/dist/chunks/REPL-BhCC0JP6.js +0 -1
  210. package/dist/chunks/SearchExtraToolsTool-DoiCI2uJ.js +0 -1
  211. package/dist/chunks/api-C8uOHD-v.js +0 -1
  212. package/dist/chunks/auth-BL238vgr.js +0 -1
  213. package/dist/chunks/auth-D3GkU6d7.js +0 -1
  214. package/dist/chunks/backgroundHousekeeping-Du2tN2WE.js +0 -1
  215. package/dist/chunks/bridgeConfig-joBqeK0j.js +0 -1
  216. package/dist/chunks/caches-DsFl83sh.js +0 -1
  217. package/dist/chunks/client-BX0r6K3I.js +0 -1
  218. package/dist/chunks/commands-BKLsl6gK.js +0 -1
  219. package/dist/chunks/config-DrY1SvhQ.js +0 -1
  220. package/dist/chunks/context-noninteractive-DpVlZ-wP.js +0 -1
  221. package/dist/chunks/conversation-C0yysXds.js +0 -1
  222. package/dist/chunks/createSession-CmBawnsh.js +0 -1
  223. package/dist/chunks/doctor-BkCtT7H1.js +0 -1
  224. package/dist/chunks/extractMemories-DnTBWFOW.js +0 -1
  225. package/dist/chunks/fast-B3fRp1xO.js +0 -1
  226. package/dist/chunks/fetchModelList-B8KG79EK.js +0 -1
  227. package/dist/chunks/firstPartyEventLogger-YYOb8aIo.js +0 -1
  228. package/dist/chunks/hooks-COhKt_pF.js +0 -1
  229. package/dist/chunks/loadAgentsDir-qvqrTVuS.js +0 -1
  230. package/dist/chunks/localSearch-CDk_stXJ.js +0 -1
  231. package/dist/chunks/managedEnv-XOUMOtEF.js +0 -1
  232. package/dist/chunks/model-g6XBcNAG.js +0 -1
  233. package/dist/chunks/pluginStartupCheck-DWpquqxx.js +0 -1
  234. package/dist/chunks/prompt-BBeDQXIs.js +0 -1
  235. package/dist/chunks/prompt-CXhdqgB7.js +0 -1
  236. package/dist/chunks/sandbox-adapter-D4Uho1vF.js +0 -1
  237. package/dist/chunks/searchExtraTools-BHMkqGBf.js +0 -1
  238. package/dist/chunks/sessionFileAccessHooks-BaWZ8sqn.js +0 -1
  239. package/dist/chunks/sessionObserver-KB1UL_n2.js +0 -1
  240. package/dist/chunks/sessionStorage-D6nlmaI-.js +0 -1
  241. package/dist/chunks/sessionTitle-SCqmSDYM.js +0 -14
  242. package/dist/chunks/sinks-D1opmy_x.js +0 -1
  243. package/dist/chunks/status-CVcXPoOZ.js +0 -1
  244. package/dist/chunks/switcher-zbG6T9dN.js +0 -1
  245. package/dist/chunks/trustedDevice-hw3iq84W.js +0 -1
  246. package/dist/chunks/useMainLoopModel-BigVcn2T.js +0 -1
  247. package/dist/chunks/worktree-IxcFe7g-.js +0 -1
@@ -1,5 +1,5 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Bx as n,Cx as r,Dp as i,Ex as a,Gb as o,Ix as s,Jb as c,Kb as l,Mx as u,Nx as d,Op as f,Ou as p,Qb as m,Sx as h,Tb as ee,Xb as te,Xh as ne,Yh as g,Zd as _,dx as v,ed as re,fx as y,jb as ie,jx as b,kb as ae,ku as oe,qb as x,td as se,vE as S,yE as C}from"./loadAgentsDir-PPiD2Mfq.js";import{D as w,H as T,I as E,P as D,T as O,ai as k,j as A,kn as j,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{R as F,V as I}from"./debug-BQj6h99Q.js";import{c as L,h as R,o as z,v as B}from"./config-BSkuQZNf.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-DVeTi9mp.js";import{s as W,u as G}from"./types-BomO8WUz.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-BjnclTLB.js";import{n as J,t as Y}from"./exit-s9XGerrH.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";S();var X=e(k(),1);t(),V(),M(),s(),ue(),f(),se();var Z=P();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[o,s]=(0,X.useState)({});(0,X.useEffect)(()=>{b().then(({servers:e})=>s(e))},[]);let c=r.filter(e=>o[e]!==void 0);async function l(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(o[e]!==void 0){let t=1;for(;o[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await a(e,n,t),r++}}d(r)}let[u]=T(),d=(0,X.useCallback)(e=>{ce(e>0?`\n${A(`success`,u)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
2
- No servers were imported.`),n(),_()},[u,t,n]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Work Mate Desktop`,subtitle:`Found ${r.length} MCP ${q(r.length,`server`)} in Work Mate Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[c.length>0&&(0,Z.jsx)(D,{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)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(re,{options:r.map(e=>({label:`${e}${c.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!c.includes(e)),onSubmit:l,onCancel:f,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),oe(),le(),c(),ie(),s(),r(),ne(),R(),F(),t(),W(),U();async function Q(e,t){try{let n=await ee(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();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw I(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-D4FPeBnM.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-CdyNeNzh.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let r=u(e),i=()=>{r&&(r.type===`sse`||r.type===`http`)&&(l(e,r),o(e,r))};try{if(t.scope){let r=y(t.scope);K(`tengu_mcp_delete`,{name:e,scope:r}),await n(e,r),i(),process.stdout.write(`Removed MCP server ${e} from ${r} config\n`),J(`File modified: ${v(r)}`)}let r=z(),a=L(),{servers:o}=d(`project`),s=!!o[e],c=[];if(r.mcpServers?.[e]&&c.push(`local`),s&&c.push(`project`),a.mcpServers?.[e]&&c.push(`user`),c.length===0)Y(`No MCP server found with name: "${e}"`);else if(c.length===1){let t=c[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await n(e,t),i(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${v(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),c.forEach(e=>{process.stderr.write(` - ${h(e)} (${v(e)})\n`)}),process.stderr.write(`
1
+ import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$d as t,Bx as n,Cx as r,Dp as i,Ex as a,Gb as o,Ix as s,Jb as c,Kb as l,Mx as u,Nx as d,Op as f,Ou as p,Qb as m,Sx as h,Tb as ee,Xb as te,Xh as ne,Yh as g,Zd as _,dx as v,ed as re,fx as y,jb as ie,jx as b,kb as ae,ku as oe,qb as x,td as se,vE as S,yE as C}from"./loadAgentsDir-CbtNPJV3.js";import{D as w,H as T,I as E,P as D,T as O,ai as k,j as A,kn as j,t as M,y as N}from"./src-DL3w8VPk2.js";import{t as P}from"./jsx-runtime-Bb4Xn-E0.js";import{R as F,V as I}from"./debug-BQj6h99Q.js";import{c as L,h as R,o as z,v as B}from"./config-BSkuQZNf.js";import{n as V,o as ce}from"./process-gEbdy6uY.js";import{i as H,o as U}from"./platform-DVeTi9mp.js";import{s as W,u as G}from"./types-BomO8WUz.js";import{n as le,r as K}from"./analytics-DJobLaWP.js";import{l as q,o as ue}from"./stringUtils-BjnclTLB.js";import{n as J,t as Y}from"./exit-s9XGerrH.js";import{stat as de}from"fs/promises";import{cwd as fe}from"process";S();var X=e(k(),1);t(),V(),M(),s(),ue(),f(),se();var Z=P();function pe({servers:e,scope:t,onDone:n}){let r=Object.keys(e),[o,s]=(0,X.useState)({});(0,X.useEffect)(()=>{b().then(({servers:e})=>s(e))},[]);let c=r.filter(e=>o[e]!==void 0);async function l(n){let r=0;for(let i of n){let n=e[i];if(n){let e=i;if(o[e]!==void 0){let t=1;for(;o[`${i}_${t}`]!==void 0;)t++;e=`${i}_${t}`}await a(e,n,t),r++}}d(r)}let[u]=T(),d=(0,X.useCallback)(e=>{ce(e>0?`\n${A(`success`,u)(`Successfully imported ${e} MCP ${q(e,`server`)} to ${t} config.`)}\n`:`
2
+ No servers were imported.`),n(),_()},[u,t,n]),f=(0,X.useCallback)(()=>{d(0)},[d]);return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(N,{title:`Import MCP Servers from Work Mate Desktop`,subtitle:`Found ${r.length} MCP ${q(r.length,`server`)} in Work Mate Desktop.`,color:`success`,onCancel:f,hideInputGuide:!0,children:[c.length>0&&(0,Z.jsx)(D,{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)(D,{children:`Please select the servers you want to import:`}),(0,Z.jsx)(re,{options:r.map(e=>({label:`${e}${c.includes(e)?` (already exists)`:``}`,value:e})),defaultValue:r.filter(e=>!c.includes(e)),onSubmit:l,onCancel:f,hideIndexes:!0})]}),(0,Z.jsx)(E,{paddingX:1,children:(0,Z.jsx)(D,{dimColor:!0,italic:!0,children:(0,Z.jsxs)(O,{children:[(0,Z.jsx)(w,{shortcut:`Space`,action:`select`}),(0,Z.jsx)(w,{shortcut:`Enter`,action:`confirm`}),(0,Z.jsx)(i,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}M(),oe(),le(),c(),ie(),s(),r(),ne(),R(),F(),t(),W(),U();async function Q(e,t){try{let n=await ee(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();K(`tengu_mcp_start`,{});try{await de(n)}catch(e){throw I(e)&&Y(`Error: Directory ${n} does not exist`),e}try{let{setup:r}=await import(`./setup-DvnKMqDy.js`);await r(n,`default`,!1,!1,void 0,!1);let{startMCPServer:i}=await import(`./mcp-D7vMhEOV.js`);await i(n,e??!1,t??!1)}catch(e){Y(`Error: Failed to start MCP server: ${e}`)}}async function he(e,t){let r=u(e),i=()=>{r&&(r.type===`sse`||r.type===`http`)&&(l(e,r),o(e,r))};try{if(t.scope){let r=y(t.scope);K(`tengu_mcp_delete`,{name:e,scope:r}),await n(e,r),i(),process.stdout.write(`Removed MCP server ${e} from ${r} config\n`),J(`File modified: ${v(r)}`)}let r=z(),a=L(),{servers:o}=d(`project`),s=!!o[e],c=[];if(r.mcpServers?.[e]&&c.push(`local`),s&&c.push(`project`),a.mcpServers?.[e]&&c.push(`user`),c.length===0)Y(`No MCP server found with name: "${e}"`);else if(c.length===1){let t=c[0];K(`tengu_mcp_delete`,{name:e,scope:t}),await n(e,t),i(),process.stdout.write(`Removed MCP server "${e}" from ${t} config\n`),J(`File modified: ${v(t)}`)}else process.stderr.write(`MCP server "${e}" exists in multiple scopes:\n`),c.forEach(e=>{process.stderr.write(` - ${h(e)} (${v(e)})\n`)}),process.stderr.write(`
3
3
  To remove from a specific scope, use:
4
4
  `),c.forEach(t=>{process.stderr.write(` claude mcp remove "${e}" -s ${t}\n`)}),Y()}catch(e){Y(e.message)}}async function ge(){K(`tengu_mcp_list`,{});let{servers:e}=await b();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
5
  `);let t=await C(Object.entries(e),async([e,t])=>({name:e,server:t,status:await Q(e,t)}),{concurrency:ae()});for(let{name:e,server:n,status:r}of t)if(n.type===`sse`)console.log(`${e}: ${n.url} (SSE) - ${r}`);else if(n.type===`http`)console.log(`${e}: ${n.url} (HTTP) - ${r}`);else if(n.type===`claudeai-proxy`)console.log(`${e}: ${n.url} - ${r}`);else if(!n.type||n.type===`stdio`){let t=n,i=Array.isArray(t.args)?t.args:[];console.log(`${e}: ${t.command} ${i.join(` `)} - ${r}`)}}await _(0)}async function $(e){K(`tengu_mcp_get`,{name:e});let t=u(e);t||Y(`No MCP server found with name: ${e}`),console.log(`${e}:`),console.log(` Scope: ${h(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`),x(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`),x(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 _(0)}async function _e(e,t,n){try{let r=y(n.scope),i=G(t),o=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 te():void 0;await a(e,i,r);let s=i&&typeof i==`object`&&`type`in i?String(i.type||`stdio`):`stdio`;o&&i&&typeof i==`object`&&`type`in i&&(i.type===`sse`||i.type===`http`)&&`url`in i&&typeof i.url==`string`&&m(e,{type:i.type,url:i.url},o),K(`tengu_mcp_add`,{scope:r,source:`json`,type:s}),J(`Added ${s} MCP server ${e} to ${r} config`)}catch(e){Y(e.message)}}async function ve(e){try{let t=y(e.scope);K(`tengu_mcp_add`,{scope:t,platform:H(),source:`desktop`});let{readClaudeDesktopMcpServers:n}=await import(`./claudeDesktop-CB3UCt7U.js`),r=await n();Object.keys(r).length===0&&J(`No MCP servers found in Work Mate Desktop configuration or configuration file does not exist.`);let{unmount:i}=await j((0,Z.jsx)(g,{children:(0,Z.jsx)(p,{children:(0,Z.jsx)(pe,{servers:r,scope:t,onDone:()=>{i()}})})}),{exitOnCtrlC:!0})}catch(e){Y(e.message)}}async function ye(){K(`tengu_mcp_reset_mcpjson_choices`,{}),B(e=>({...e,enabledMcpjsonServers:[],disabledMcpjsonServers:[],enableAllProjectMcpServers:!1})),J(`All project-scoped (.mcp.json) server approvals and rejections have been reset.
@@ -1,2 +1,2 @@
1
- import{$y as e,AS as t,B as n,BS as r,B_ as i,Bb as a,Bl as o,CS as s,DS as c,ES as l,FC as u,FS as d,IS as f,JS as p,KS as m,Kc as h,LS as ee,La as te,MS as ne,NS as g,OS as _,PC as v,PS as y,Qs as b,Qy as x,RS as S,SS as C,TS as w,US as T,V as E,Vl as D,WS as O,XS as k,YS as A,Zs as j,_S as M,bS as N,gS as P,hS as F,mS as re,ma as I,pS as L,qS as R,qc as z,vS as B,wS as V,xS as H,yS as U,zS as W,z_ as G,zb as K}from"./loadAgentsDir-PPiD2Mfq.js";import{C as q,x as J}from"./debug-BQj6h99Q.js";import{o as Y,s as X}from"./log-BlJ7CcKG.js";import{_ as ie,u as ae}from"./model-sviY1inu.js";import{_n as oe,vn as Z,yn as se}from"./prompt-CQmEvnKN.js";import Q from"node:process";p(),C(),N(),m();var ce=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},l,t)}elicitInputStream(e,n){let r=this._server.getClientCapabilities(),i=e.mode??`form`;switch(i){case`url`:if(!r?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!r?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let a=i===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:a},t,n)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};m(),B();var le=class extends H{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(W.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new U,this.setRequestHandler(y,e=>this._oninitialize(e)),this.setNotificationHandler(d,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(O,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=W.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ce(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=s(this._capabilities,e)}setRequestHandler(e,t){let n=R(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let i;if(A(n)){let e=n;i=e._zod?.def?.value??e.value}else{let e=n;i=e._def?.value??e.value}if(typeof i!=`string`)throw Error(`Schema method literal must be a string`);return i===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let i=k(V,e);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new r(g.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(t(e,n));if(a.task){let e=k(_,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new r(g.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=k(w,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new r(g.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){P(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&M(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:T.includes(t)?t:f,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},ne)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},c,t):this.request({method:`sampling/createMessage`,params:e},l,t)}async elicitInput(e,n){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let r=e;return this.request({method:`elicitation/create`,params:r},t,n)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let i=e.mode===`form`?e:{...e,mode:`form`},a=await this.request({method:`elicitation/create`,params:i},t,n);if(a.action===`accept`&&a.content&&i.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!e.valid)throw new r(g.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof r?e:new r(g.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},ee,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};re();var $=class{constructor(e=Q.stdin,t=Q.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new L,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=F(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};m(),b(),se(),z(),a(),e(),Y(),te(),ie(),E(),v(),J(),D(),G();var ue=[];async function de(e,t,r){let a=x(100);u(e);let s=new le({name:`claude/tengu`,version:`0.0.16`},{capabilities:{tools:{}}});s.setRequestHandler(S,async()=>{let e=Z(),t=h(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=i(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:i(n.inputSchema),outputSchema:r}}))}}),s.setRequestHandler(V,async({params:{name:e,arguments:i}})=>{let s=h(Z()),c=oe(s,e);if(!c)throw Error(`Tool ${e} not found`);let l={abortController:K(),options:{commands:ue,tools:s,mainLoopModel:ae(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>j(),setAppState:()=>{},messages:[],readFileState:a,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await c.validateInput?.(i??{},l);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let r=await c.call(i??{},l,n,I({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:q(r.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?o(e):[String(e)]).filter(Boolean).join(`
1
+ import{$y as e,AS as t,B as n,BS as r,B_ as i,Bb as a,Bl as o,CS as s,DS as c,ES as l,FC as u,FS as d,IS as f,JS as p,KS as m,Kc as h,LS as ee,La as te,MS as ne,NS as g,OS as _,PC as v,PS as y,Qs as b,Qy as x,RS as S,SS as C,TS as w,US as T,V as E,Vl as D,WS as O,XS as k,YS as A,Zs as j,_S as M,bS as N,gS as P,hS as F,mS as re,ma as I,pS as L,qS as R,qc as z,vS as B,wS as V,xS as H,yS as U,zS as W,z_ as G,zb as K}from"./loadAgentsDir-CbtNPJV3.js";import{C as q,x as J}from"./debug-BQj6h99Q.js";import{o as Y,s as X}from"./log-BlJ7CcKG.js";import{_ as ie,u as ae}from"./model-DlLO7TSx.js";import{_n as oe,vn as Z,yn as se}from"./prompt-BRGC5U9Y.js";import Q from"node:process";p(),C(),N(),m();var ce=class{constructor(e){this._server=e}requestStream(e,t,n){return this._server.requestStream(e,t,n)}createMessageStream(e,t){let n=this._server.getClientCapabilities();if((e.tools||e.toolChoice)&&!n?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return this.requestStream({method:`sampling/createMessage`,params:e},l,t)}elicitInputStream(e,n){let r=this._server.getClientCapabilities(),i=e.mode??`form`;switch(i){case`url`:if(!r?.elicitation?.url)throw Error(`Client does not support url elicitation.`);break;case`form`:if(!r?.elicitation?.form)throw Error(`Client does not support form elicitation.`);break}let a=i===`form`&&e.mode===void 0?{...e,mode:`form`}:e;return this.requestStream({method:`elicitation/create`,params:a},t,n)}async getTask(e,t){return this._server.getTask({taskId:e},t)}async getTaskResult(e,t,n){return this._server.getTaskResult({taskId:e},t,n)}async listTasks(e,t){return this._server.listTasks(e?{cursor:e}:void 0,t)}async cancelTask(e,t){return this._server.cancelTask({taskId:e},t)}};m(),B();var le=class extends H{constructor(e,t){super(t),this._serverInfo=e,this._loggingLevels=new Map,this.LOG_LEVEL_SEVERITY=new Map(W.options.map((e,t)=>[e,t])),this.isMessageIgnored=(e,t)=>{let n=this._loggingLevels.get(t);return n?this.LOG_LEVEL_SEVERITY.get(e)<this.LOG_LEVEL_SEVERITY.get(n):!1},this._capabilities=t?.capabilities??{},this._instructions=t?.instructions,this._jsonSchemaValidator=t?.jsonSchemaValidator??new U,this.setRequestHandler(y,e=>this._oninitialize(e)),this.setNotificationHandler(d,()=>this.oninitialized?.()),this._capabilities.logging&&this.setRequestHandler(O,async(e,t)=>{let n=t.sessionId||t.requestInfo?.headers[`mcp-session-id`]||void 0,{level:r}=e.params,i=W.safeParse(r);return i.success&&this._loggingLevels.set(n,i.data),{}})}get experimental(){return this._experimental||(this._experimental={tasks:new ce(this)}),this._experimental}registerCapabilities(e){if(this.transport)throw Error(`Cannot register capabilities after connecting to transport`);this._capabilities=s(this._capabilities,e)}setRequestHandler(e,t){let n=R(e)?.method;if(!n)throw Error(`Schema is missing a method literal`);let i;if(A(n)){let e=n;i=e._zod?.def?.value??e.value}else{let e=n;i=e._def?.value??e.value}if(typeof i!=`string`)throw Error(`Schema method literal must be a string`);return i===`tools/call`?super.setRequestHandler(e,async(e,n)=>{let i=k(V,e);if(!i.success){let e=i.error instanceof Error?i.error.message:String(i.error);throw new r(g.InvalidParams,`Invalid tools/call request: ${e}`)}let{params:a}=i.data,o=await Promise.resolve(t(e,n));if(a.task){let e=k(_,o);if(!e.success){let t=e.error instanceof Error?e.error.message:String(e.error);throw new r(g.InvalidParams,`Invalid task creation result: ${t}`)}return e.data}let s=k(w,o);if(!s.success){let e=s.error instanceof Error?s.error.message:String(s.error);throw new r(g.InvalidParams,`Invalid tools/call result: ${e}`)}return s.data}):super.setRequestHandler(e,t)}assertCapabilityForMethod(e){switch(e){case`sampling/createMessage`:if(!this._clientCapabilities?.sampling)throw Error(`Client does not support sampling (required for ${e})`);break;case`elicitation/create`:if(!this._clientCapabilities?.elicitation)throw Error(`Client does not support elicitation (required for ${e})`);break;case`roots/list`:if(!this._clientCapabilities?.roots)throw Error(`Client does not support listing roots (required for ${e})`);break;case`ping`:break}}assertNotificationCapability(e){switch(e){case`notifications/message`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`notifications/resources/updated`:case`notifications/resources/list_changed`:if(!this._capabilities.resources)throw Error(`Server does not support notifying about resources (required for ${e})`);break;case`notifications/tools/list_changed`:if(!this._capabilities.tools)throw Error(`Server does not support notifying of tool list changes (required for ${e})`);break;case`notifications/prompts/list_changed`:if(!this._capabilities.prompts)throw Error(`Server does not support notifying of prompt list changes (required for ${e})`);break;case`notifications/elicitation/complete`:if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for ${e})`);break;case`notifications/cancelled`:break;case`notifications/progress`:break}}assertRequestHandlerCapability(e){if(this._capabilities)switch(e){case`completion/complete`:if(!this._capabilities.completions)throw Error(`Server does not support completions (required for ${e})`);break;case`logging/setLevel`:if(!this._capabilities.logging)throw Error(`Server does not support logging (required for ${e})`);break;case`prompts/get`:case`prompts/list`:if(!this._capabilities.prompts)throw Error(`Server does not support prompts (required for ${e})`);break;case`resources/list`:case`resources/templates/list`:case`resources/read`:if(!this._capabilities.resources)throw Error(`Server does not support resources (required for ${e})`);break;case`tools/call`:case`tools/list`:if(!this._capabilities.tools)throw Error(`Server does not support tools (required for ${e})`);break;case`tasks/get`:case`tasks/list`:case`tasks/result`:case`tasks/cancel`:if(!this._capabilities.tasks)throw Error(`Server does not support tasks capability (required for ${e})`);break;case`ping`:case`initialize`:break}}assertTaskCapability(e){P(this._clientCapabilities?.tasks?.requests,e,`Client`)}assertTaskHandlerCapability(e){this._capabilities&&M(this._capabilities.tasks?.requests,e,`Server`)}async _oninitialize(e){let t=e.params.protocolVersion;return this._clientCapabilities=e.params.capabilities,this._clientVersion=e.params.clientInfo,{protocolVersion:T.includes(t)?t:f,capabilities:this.getCapabilities(),serverInfo:this._serverInfo,...this._instructions&&{instructions:this._instructions}}}getClientCapabilities(){return this._clientCapabilities}getClientVersion(){return this._clientVersion}getCapabilities(){return this._capabilities}async ping(){return this.request({method:`ping`},ne)}async createMessage(e,t){if((e.tools||e.toolChoice)&&!this._clientCapabilities?.sampling?.tools)throw Error(`Client does not support sampling tools capability.`);if(e.messages.length>0){let t=e.messages[e.messages.length-1],n=Array.isArray(t.content)?t.content:[t.content],r=n.some(e=>e.type===`tool_result`),i=e.messages.length>1?e.messages[e.messages.length-2]:void 0,a=i?Array.isArray(i.content)?i.content:[i.content]:[],o=a.some(e=>e.type===`tool_use`);if(r){if(n.some(e=>e.type!==`tool_result`))throw Error(`The last message must contain only tool_result content if any is present`);if(!o)throw Error(`tool_result blocks are not matching any tool_use from the previous message`)}if(o){let e=new Set(a.filter(e=>e.type===`tool_use`).map(e=>e.id)),t=new Set(n.filter(e=>e.type===`tool_result`).map(e=>e.toolUseId));if(e.size!==t.size||![...e].every(e=>t.has(e)))throw Error(`ids of tool_result blocks and tool_use blocks from previous message do not match`)}}return e.tools?this.request({method:`sampling/createMessage`,params:e},c,t):this.request({method:`sampling/createMessage`,params:e},l,t)}async elicitInput(e,n){switch(e.mode??`form`){case`url`:{if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support url elicitation.`);let r=e;return this.request({method:`elicitation/create`,params:r},t,n)}case`form`:{if(!this._clientCapabilities?.elicitation?.form)throw Error(`Client does not support form elicitation.`);let i=e.mode===`form`?e:{...e,mode:`form`},a=await this.request({method:`elicitation/create`,params:i},t,n);if(a.action===`accept`&&a.content&&i.requestedSchema)try{let e=this._jsonSchemaValidator.getValidator(i.requestedSchema)(a.content);if(!e.valid)throw new r(g.InvalidParams,`Elicitation response content does not match requested schema: ${e.errorMessage}`)}catch(e){throw e instanceof r?e:new r(g.InternalError,`Error validating elicitation response: ${e instanceof Error?e.message:String(e)}`)}return a}}}createElicitationCompletionNotifier(e,t){if(!this._clientCapabilities?.elicitation?.url)throw Error(`Client does not support URL elicitation (required for notifications/elicitation/complete)`);return()=>this.notification({method:`notifications/elicitation/complete`,params:{elicitationId:e}},t)}async listRoots(e,t){return this.request({method:`roots/list`,params:e},ee,t)}async sendLoggingMessage(e,t){if(this._capabilities.logging&&!this.isMessageIgnored(e.level,t))return this.notification({method:`notifications/message`,params:e})}async sendResourceUpdated(e){return this.notification({method:`notifications/resources/updated`,params:e})}async sendResourceListChanged(){return this.notification({method:`notifications/resources/list_changed`})}async sendToolListChanged(){return this.notification({method:`notifications/tools/list_changed`})}async sendPromptListChanged(){return this.notification({method:`notifications/prompts/list_changed`})}};re();var $=class{constructor(e=Q.stdin,t=Q.stdout){this._stdin=e,this._stdout=t,this._readBuffer=new L,this._started=!1,this._ondata=e=>{this._readBuffer.append(e),this.processReadBuffer()},this._onerror=e=>{this.onerror?.(e)}}async start(){if(this._started)throw Error(`StdioServerTransport already started! If using Server class, note that connect() calls start() automatically.`);this._started=!0,this._stdin.on(`data`,this._ondata),this._stdin.on(`error`,this._onerror)}processReadBuffer(){for(;;)try{let e=this._readBuffer.readMessage();if(e===null)break;this.onmessage?.(e)}catch(e){this.onerror?.(e)}}async close(){this._stdin.off(`data`,this._ondata),this._stdin.off(`error`,this._onerror),this._stdin.listenerCount(`data`)===0&&this._stdin.pause(),this._readBuffer.clear(),this.onclose?.()}send(e){return new Promise(t=>{let n=F(e);this._stdout.write(n)?t():this._stdout.once(`drain`,t)})}};m(),b(),se(),z(),a(),e(),Y(),te(),ie(),E(),v(),J(),D(),G();var ue=[];async function de(e,t,r){let a=x(100);u(e);let s=new le({name:`claude/tengu`,version:`0.0.17`},{capabilities:{tools:{}}});s.setRequestHandler(S,async()=>{let e=Z(),t=h(e);return{tools:await Promise.all(t.map(async n=>{let r;if(n.outputSchema){let e=i(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:i(n.inputSchema),outputSchema:r}}))}}),s.setRequestHandler(V,async({params:{name:e,arguments:i}})=>{let s=h(Z()),c=oe(s,e);if(!c)throw Error(`Tool ${e} not found`);let l={abortController:K(),options:{commands:ue,tools:s,mainLoopModel:ae(),thinkingConfig:{type:`disabled`},mcpClients:[],mcpResources:{},isNonInteractiveSession:!0,debug:t,verbose:r,agentDefinitions:{activeAgents:[],allAgents:[]}},getAppState:()=>j(),setAppState:()=>{},messages:[],readFileState:a,setInProgressToolUseIDs:()=>{},setResponseLength:()=>{},updateFileHistoryState:()=>{},updateAttributionState:()=>{}};try{if(!c.isEnabled())throw Error(`Tool ${e} is not enabled`);let t=await c.validateInput?.(i??{},l);if(t&&!t.result)throw Error(`Tool ${e} input is invalid: ${`message`in t?t.message:String(t)}`);let r=await c.call(i??{},l,n,I({content:[]}));return{content:[{type:`text`,text:typeof r==`string`?r:q(r.data)}]}}catch(e){return X(e),{isError:!0,content:[{type:`text`,text:(e instanceof Error?o(e):[String(e)]).filter(Boolean).join(`
2
2
  `).trim()||`Error`}]}}});async function c(){let e=new $;await s.connect(e)}return await c()}export{de as startMCPServer};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Cx as i,Dp as a,Jb as o,Mu as s,Op as c,Pu as l,Qh as u,Qu as d,Ub as f,Wb as p,Xh as m,Yb as h,Zh as g,Zu as _,bx as v,dx as y,hC as b,vx as ee}from"./loadAgentsDir-PPiD2Mfq.js";import{D as x,Gt as te,H as S,I as C,Lt as w,P as T,T as E,Wt as D,ai as O,j as k,t as A,y as j}from"./src-DL3w8VPk2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{a as ne,i as re}from"./debug-BQj6h99Q.js";import{l as ie,n as ae,o as N}from"./stringUtils-BjnclTLB.js";import{C as oe,S as se}from"./sessionState-BTFowSpR.js";import{i as ce,n as P,r as le}from"./MCPConnectionManager-7H84oi5n.js";import{n as ue,t as de}from"./McpParsingWarnings-CN8f449l.js";import{a as fe,c as F,i as I,n as L,o as R,r as pe,s as me,t as he}from"./MCPToolListView-CVgtg3Iq.js";function ge({agentServer:e,onCancel:t,onComplete:n}){let[i]=S(),[o,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),g=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>g.current?.abort(),[]),D(`confirm:no`,(0,z.useCallback)(()=>{o&&(g.current?.abort(),g.current=null,c(!1),m(null))},[o]),{context:`Confirmation`,isActive:o});let _=(0,z.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;c(!0),u(null);let t=new AbortController;g.current=t;try{let r={type:e.transport,url:e.url};await h(e.name,r,m,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof f)&&u(e.message)}finally{c(!1),g.current=null}},[e,n]),v=ae(String(e.name));if(o)return(0,B.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,B.jsxs)(T,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,B.jsxs)(C,{children:[(0,B.jsx)(s,{}),(0,B.jsx)(T,{children:` A browser window will open for authentication`})]}),p&&(0,B.jsxs)(C,{flexDirection:`column`,children:[(0,B.jsx)(T,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,B.jsx)(w,{url:p})]}),(0,B.jsx)(C,{marginLeft:3,children:(0,B.jsxs)(T,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,B.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let y=[];return e.needsAuth&&y.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),y.push({label:`Back`,value:`back`}),(0,B.jsxs)(j,{title:`${v} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,B.jsxs)(T,{children:[`Press `,e.keyName,` again to exit`]}):(0,B.jsxs)(E,{children:[(0,B.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,B.jsx)(x,{shortcut:`Enter`,action:`confirm`}),(0,B.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,B.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Type: `}),(0,B.jsx)(T,{dimColor:!0,children:e.transport})]}),e.url&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`URL: `}),(0,B.jsx)(T,{dimColor:!0,children:e.url})]}),e.command&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Command: `}),(0,B.jsx)(T,{dimColor:!0,children:e.command})]}),(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Used by: `}),(0,B.jsx)(T,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,B.jsxs)(C,{marginTop:1,children:[(0,B.jsx)(T,{bold:!0,children:`Status: `}),(0,B.jsxs)(T,{children:[k(`inactive`,i)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,B.jsxs)(T,{children:[k(`success`,i)(r.tick),` authenticated`]}):(0,B.jsxs)(T,{children:[k(`warning`,i)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,B.jsx)(C,{children:(0,B.jsx)(T,{dimColor:!0,children:`This server connects only when running the agent.`})}),l&&(0,B.jsx)(C,{children:(0,B.jsxs)(T,{color:`error`,children:[`Error: `,l]})}),(0,B.jsx)(C,{children:(0,B.jsx)(d,{options:y,onChange:async e=>{switch(e){case`auth`:await _();break;case`back`:t();break}},onCancel:t})})]})}var z,B,_e=e((()=>{n(),z=t(O(),1),A(),b(),o(),N(),c(),_(),l(),B=M()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:y(e)};case`user`:return{label:`User MCPs`,path:y(e)};case`local`:return{label:`Local MCPs`,path:y(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:i,onComplete:o}){let[s]=S(),[c,l]=(0,H.useState)(0),u=H.useMemo(()=>ve(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),d=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=H.useMemo(()=>(u.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[u]),p=V(`dynamic`),m=H.useMemo(()=>{let e=[];for(let t of W){let n=u.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of d)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of f)e.push({type:`server`,server:t});return e},[u,d,t,f]),h=(0,H.useCallback)(()=>{o(`MCP dialog dismissed`,{display:`system`})},[o]);te({"confirm:previous":()=>l(e=>e===0?m.length-1:e-1),"confirm:next":()=>l(e=>e===m.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=m[c];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&i&&i(e.agentServer))},[m,c,n,i]),"confirm:no":h},{context:`Confirmation`});let g=e=>m.findIndex(t=>t.type===`server`&&t.server===e),_=e=>m.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),v=ne(),y=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let b=e=>{let t=g(e),n=c===t,i=``,a=``;if(e.client.type===`disabled`)i=k(`inactive`,s)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=k(`success`,s)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=k(`inactive`,s)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=k(`warning`,s)(r.triangleUpOutline),a=`needs authentication`):(i=k(`error`,s)(r.cross),a=`failed`);return(0,U.jsxs)(C,{children:[(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(T,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(T,{dimColor:!n,children:a})]},`${e.name}-${t}`)},ee=e=>{let t=_(e),n=c===t,i=e.needsAuth?k(`warning`,s)(r.triangleUpOutline):k(`inactive`,s)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(C,{children:[(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(T,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(T,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},D=e.length+t.length;return(0,U.jsxs)(C,{flexDirection:`column`,children:[(0,U.jsx)(de,{}),(0,U.jsx)(j,{title:`Manage MCP servers`,subtitle:`${D} ${ie(D,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,U.jsxs)(C,{flexDirection:`column`,children:[W.map(e=>{let t=u.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(C,{paddingLeft:2,children:[(0,U.jsx)(T,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(T,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>b(e))]},e)}),d.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsx)(T,{bold:!0,children:`claude.ai`})}),d.map(e=>b(e))]}),t.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsx)(T,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsxs)(T,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>ee(e))]},e))]}),f.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(C,{paddingLeft:2,children:[(0,U.jsx)(T,{bold:!0,children:p.label}),p.path&&(0,U.jsxs)(T,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>b(e))]}),(0,U.jsxs)(C,{flexDirection:`column`,children:[y&&(0,U.jsx)(T,{dimColor:!0,children:v?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(T,{dimColor:!0,children:[(0,U.jsx)(w,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(C,{paddingX:1,children:(0,U.jsx)(T,{dimColor:!0,italic:!0,children:(0,U.jsxs)(E,{children:[(0,U.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(x,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(O(),1),A(),b(),i(),re(),N(),c(),ue(),U=M(),W=[`project`,`local`,`user`,`enterprise`]}));function be({serverName:e,onComplete:t}){let[n]=S(),i=u(),a=le(),[o,c]=(0,K.useState)(!0),[l,d]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){d(`MCP server "${e}" not found`),c(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:c(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:d(`${e} requires authentication`),c(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:d(`Failed to reconnect to ${e}`),c(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);d(n),c(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),o?(0,q.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(T,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(T,{bold:!0,children:e})]}),(0,q.jsxs)(C,{children:[(0,q.jsx)(s,{}),(0,q.jsx)(T,{children:` Establishing connection to MCP server`})]})]}):l?(0,q.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(C,{children:[(0,q.jsxs)(T,{children:[k(`error`,n)(r.cross),` `]}),(0,q.jsxs)(T,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(T,{dimColor:!0,children:[`Error: `,l]})]}):null}var K,q,J=e((()=>{n(),K=t(O(),1),A(),P(),m(),l(),q=M()}));function Y({onComplete:e}){let t=g(e=>e.mcp),n=g(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>ee(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 p(e.name,e.config).tokens(),r=se()!==null&&e.type===`connected`,i=e.type===`connected`&&v(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.workmate.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=v(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(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}):(0,Z.jsx)(me,{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)(he,{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=v(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(pe,{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)(ge,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(O(),1),o(),i(),m(),oe(),_e(),G(),F(),R(),I(),L(),Z=M()})),Se=e((()=>{_e(),G(),J(),F(),xe(),R(),I(),L()}));function Ce({action:e,target:t,onComplete:n}){let r=g(e=>e.mcp.clients),i=ce(),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 we(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(be,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Ce,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(O(),1),Se(),J(),P(),m(),$=M()}))();export{we as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,t as r}from"./figures-5ThXQEtq.js";import{Cx as i,Dp as a,Jb as o,Mu as s,Op as c,Pu as l,Qh as u,Qu as d,Ub as f,Wb as p,Xh as m,Yb as h,Zh as g,Zu as _,bx as v,dx as y,hC as b,vx as ee}from"./loadAgentsDir-CbtNPJV3.js";import{D as x,Gt as te,H as S,I as C,Lt as w,P as T,T as E,Wt as D,ai as O,j as k,t as A,y as j}from"./src-DL3w8VPk2.js";import{t as M}from"./jsx-runtime-Bb4Xn-E0.js";import{a as ne,i as re}from"./debug-BQj6h99Q.js";import{l as ie,n as ae,o as N}from"./stringUtils-BjnclTLB.js";import{C as oe,S as se}from"./sessionState-BlbRQ3Y6.js";import{i as ce,n as P,r as le}from"./MCPConnectionManager-BnUw0nYN.js";import{n as ue,t as de}from"./McpParsingWarnings-BF4np2Y3.js";import{a as fe,c as F,i as I,n as L,o as R,r as pe,s as me,t as he}from"./MCPToolListView-CY2EezWF.js";function ge({agentServer:e,onCancel:t,onComplete:n}){let[i]=S(),[o,c]=(0,z.useState)(!1),[l,u]=(0,z.useState)(null),[p,m]=(0,z.useState)(null),g=(0,z.useRef)(null);(0,z.useEffect)(()=>()=>g.current?.abort(),[]),D(`confirm:no`,(0,z.useCallback)(()=>{o&&(g.current?.abort(),g.current=null,c(!1),m(null))},[o]),{context:`Confirmation`,isActive:o});let _=(0,z.useCallback)(async()=>{if(!e.needsAuth||!e.url)return;c(!0),u(null);let t=new AbortController;g.current=t;try{let r={type:e.transport,url:e.url};await h(e.name,r,m,t.signal),n?.(`Authentication successful for ${e.name}. The server will connect when the agent runs.`)}catch(e){e instanceof Error&&!(e instanceof f)&&u(e.message)}finally{c(!1),g.current=null}},[e,n]),v=ae(String(e.name));if(o)return(0,B.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,B.jsxs)(T,{color:`claude`,children:[`Authenticating with `,e.name,`…`]}),(0,B.jsxs)(C,{children:[(0,B.jsx)(s,{}),(0,B.jsx)(T,{children:` A browser window will open for authentication`})]}),p&&(0,B.jsxs)(C,{flexDirection:`column`,children:[(0,B.jsx)(T,{dimColor:!0,children:`If your browser doesn't open automatically, copy this URL manually:`}),(0,B.jsx)(w,{url:p})]}),(0,B.jsx)(C,{marginLeft:3,children:(0,B.jsxs)(T,{dimColor:!0,children:[`Return here after authenticating in your browser.`,` `,(0,B.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})})]});let y=[];return e.needsAuth&&y.push({label:e.isAuthenticated?`Re-authenticate`:`Authenticate`,value:`auth`}),y.push({label:`Back`,value:`back`}),(0,B.jsxs)(j,{title:`${v} MCP Server`,subtitle:`agent-only`,onCancel:t,inputGuide:e=>e.pending?(0,B.jsxs)(T,{children:[`Press `,e.keyName,` again to exit`]}):(0,B.jsxs)(E,{children:[(0,B.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,B.jsx)(x,{shortcut:`Enter`,action:`confirm`}),(0,B.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:[(0,B.jsxs)(C,{flexDirection:`column`,gap:0,children:[(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Type: `}),(0,B.jsx)(T,{dimColor:!0,children:e.transport})]}),e.url&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`URL: `}),(0,B.jsx)(T,{dimColor:!0,children:e.url})]}),e.command&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Command: `}),(0,B.jsx)(T,{dimColor:!0,children:e.command})]}),(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Used by: `}),(0,B.jsx)(T,{dimColor:!0,children:e.sourceAgents.join(`, `)})]}),(0,B.jsxs)(C,{marginTop:1,children:[(0,B.jsx)(T,{bold:!0,children:`Status: `}),(0,B.jsxs)(T,{children:[k(`inactive`,i)(r.radioOff),` not connected (agent-only)`]})]}),e.needsAuth&&(0,B.jsxs)(C,{children:[(0,B.jsx)(T,{bold:!0,children:`Auth: `}),e.isAuthenticated?(0,B.jsxs)(T,{children:[k(`success`,i)(r.tick),` authenticated`]}):(0,B.jsxs)(T,{children:[k(`warning`,i)(r.triangleUpOutline),` may need authentication`]})]})]}),(0,B.jsx)(C,{children:(0,B.jsx)(T,{dimColor:!0,children:`This server connects only when running the agent.`})}),l&&(0,B.jsx)(C,{children:(0,B.jsxs)(T,{color:`error`,children:[`Error: `,l]})}),(0,B.jsx)(C,{children:(0,B.jsx)(d,{options:y,onChange:async e=>{switch(e){case`auth`:await _();break;case`back`:t();break}},onCancel:t})})]})}var z,B,_e=e((()=>{n(),z=t(O(),1),A(),b(),o(),N(),c(),_(),l(),B=M()}));function V(e){switch(e){case`project`:return{label:`Project MCPs`,path:y(e)};case`user`:return{label:`User MCPs`,path:y(e)};case`local`:return{label:`Local MCPs`,path:y(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:i,onComplete:o}){let[s]=S(),[c,l]=(0,H.useState)(0),u=H.useMemo(()=>ve(e.filter(e=>e.client.config.type!==`claudeai-proxy`)),[e]),d=H.useMemo(()=>e.filter(e=>e.client.config.type===`claudeai-proxy`).sort((e,t)=>e.name.localeCompare(t.name)),[e]),f=H.useMemo(()=>(u.get(`dynamic`)??[]).sort((e,t)=>e.name.localeCompare(t.name)),[u]),p=V(`dynamic`),m=H.useMemo(()=>{let e=[];for(let t of W){let n=u.get(t)??[];for(let t of n)e.push({type:`server`,server:t})}for(let t of d)e.push({type:`server`,server:t});for(let n of t)e.push({type:`agent-server`,agentServer:n});for(let t of f)e.push({type:`server`,server:t});return e},[u,d,t,f]),h=(0,H.useCallback)(()=>{o(`MCP dialog dismissed`,{display:`system`})},[o]);te({"confirm:previous":()=>l(e=>e===0?m.length-1:e-1),"confirm:next":()=>l(e=>e===m.length-1?0:e+1),"confirm:yes":(0,H.useCallback)(()=>{let e=m[c];e&&(e.type===`server`?n(e.server):e.type===`agent-server`&&i&&i(e.agentServer))},[m,c,n,i]),"confirm:no":h},{context:`Confirmation`});let g=e=>m.findIndex(t=>t.type===`server`&&t.server===e),_=e=>m.findIndex(t=>t.type===`agent-server`&&t.agentServer===e),v=ne(),y=e.some(e=>e.client.type===`failed`);if(e.length===0&&t.length===0)return null;let b=e=>{let t=g(e),n=c===t,i=``,a=``;if(e.client.type===`disabled`)i=k(`inactive`,s)(r.radioOff),a=`disabled`;else if(e.client.type===`connected`)i=k(`success`,s)(r.tick),a=`connected`;else if(e.client.type===`pending`){i=k(`inactive`,s)(r.radioOff);let{reconnectAttempt:t,maxReconnectAttempts:n}=e.client;a=t&&n?`reconnecting (${t}/${n})…`:`connecting…`}else e.client.type===`needs-auth`?(i=k(`warning`,s)(r.triangleUpOutline),a=`needs authentication`):(i=k(`error`,s)(r.cross),a=`failed`);return(0,U.jsxs)(C,{children:[(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(T,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(T,{dimColor:!n,children:a})]},`${e.name}-${t}`)},ee=e=>{let t=_(e),n=c===t,i=e.needsAuth?k(`warning`,s)(r.triangleUpOutline):k(`inactive`,s)(r.radioOff),a=e.needsAuth?`may need auth`:`agent-only`;return(0,U.jsxs)(C,{children:[(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:n?`${r.pointer} `:` `}),(0,U.jsx)(T,{color:n?`suggestion`:void 0,children:e.name}),(0,U.jsxs)(T,{dimColor:!n,children:[` · `,i,` `]}),(0,U.jsx)(T,{dimColor:!n,children:a})]},`agent-${e.name}-${t}`)},D=e.length+t.length;return(0,U.jsxs)(C,{flexDirection:`column`,children:[(0,U.jsx)(de,{}),(0,U.jsx)(j,{title:`Manage MCP servers`,subtitle:`${D} ${ie(D,`server`)}`,onCancel:h,hideInputGuide:!0,children:(0,U.jsxs)(C,{flexDirection:`column`,children:[W.map(e=>{let t=u.get(e);if(!t||t.length===0)return null;let n=V(e);return(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(C,{paddingLeft:2,children:[(0,U.jsx)(T,{bold:!0,children:n.label}),n.path&&(0,U.jsxs)(T,{dimColor:!0,children:[` (`,n.path,`)`]})]}),t.map(e=>b(e))]},e)}),d.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsx)(T,{bold:!0,children:`claude.ai`})}),d.map(e=>b(e))]}),t.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsx)(T,{bold:!0,children:`Agent MCPs`})}),[...new Set(t.flatMap(e=>e.sourceAgents))].map(e=>(0,U.jsxs)(C,{flexDirection:`column`,marginTop:1,children:[(0,U.jsx)(C,{paddingLeft:2,children:(0,U.jsxs)(T,{dimColor:!0,children:[`@`,e]})}),t.filter(t=>t.sourceAgents.includes(e)).map(e=>ee(e))]},e))]}),f.length>0&&(0,U.jsxs)(C,{flexDirection:`column`,marginBottom:1,children:[(0,U.jsxs)(C,{paddingLeft:2,children:[(0,U.jsx)(T,{bold:!0,children:p.label}),p.path&&(0,U.jsxs)(T,{dimColor:!0,children:[` (`,p.path,`)`]})]}),f.map(e=>b(e))]}),(0,U.jsxs)(C,{flexDirection:`column`,children:[y&&(0,U.jsx)(T,{dimColor:!0,children:v?`※ Error logs shown inline with --debug`:`※ Run claude --debug to see error logs`}),(0,U.jsxs)(T,{dimColor:!0,children:[(0,U.jsx)(w,{url:`https://code.workmate.com/docs/en/mcp`,children:`https://code.workmate.com/docs/en/mcp`}),` for help`]})]})]})}),(0,U.jsx)(C,{paddingX:1,children:(0,U.jsx)(T,{dimColor:!0,italic:!0,children:(0,U.jsxs)(E,{children:[(0,U.jsx)(x,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(x,{shortcut:`Enter`,action:`confirm`}),(0,U.jsx)(a,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})})]})}var H,U,W,G=e((()=>{n(),H=t(O(),1),A(),b(),i(),re(),N(),c(),ue(),U=M(),W=[`project`,`local`,`user`,`enterprise`]}));function be({serverName:e,onComplete:t}){let[n]=S(),i=u(),a=le(),[o,c]=(0,K.useState)(!0),[l,d]=(0,K.useState)(null);return(0,K.useEffect)(()=>{async function n(){try{if(!i.getState().mcp.clients.find(t=>t.name===e)){d(`MCP server "${e}" not found`),c(!1),t(`MCP server "${e}" not found`);return}switch((await a(e)).client.type){case`connected`:c(!1),t(`Successfully reconnected to ${e}`);break;case`needs-auth`:d(`${e} requires authentication`),c(!1),t(`${e} requires authentication. Use /mcp to authenticate.`);break;case`pending`:case`failed`:case`disabled`:d(`Failed to reconnect to ${e}`),c(!1),t(`Failed to reconnect to ${e}`);break}}catch(e){let n=e instanceof Error?e.message:String(e);d(n),c(!1),t(`Error: ${n}`)}}n()},[e,a,i,t]),o?(0,q.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(T,{color:`text`,children:[`Reconnecting to `,(0,q.jsx)(T,{bold:!0,children:e})]}),(0,q.jsxs)(C,{children:[(0,q.jsx)(s,{}),(0,q.jsx)(T,{children:` Establishing connection to MCP server`})]})]}):l?(0,q.jsxs)(C,{flexDirection:`column`,gap:1,padding:1,children:[(0,q.jsxs)(C,{children:[(0,q.jsxs)(T,{children:[k(`error`,n)(r.cross),` `]}),(0,q.jsxs)(T,{color:`error`,children:[`Failed to reconnect to `,e]})]}),(0,q.jsxs)(T,{dimColor:!0,children:[`Error: `,l]})]}):null}var K,q,J=e((()=>{n(),K=t(O(),1),A(),P(),m(),l(),q=M()}));function Y({onComplete:e}){let t=g(e=>e.mcp),n=g(e=>e.agentDefinitions),r=t.clients,[i,a]=X.useState({type:`list`}),[o,s]=X.useState([]),c=(0,X.useMemo)(()=>ee(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 p(e.name,e.config).tokens(),r=se()!==null&&e.type===`connected`,i=e.type===`connected`&&v(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.workmate.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=v(t.tools,i.server.name),r=i.server.transport===`claudeai-proxy`?`claude.ai`:`Work Mate`;return i.server.transport===`stdio`?(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}):(0,Z.jsx)(me,{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)(he,{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=v(t.tools,i.server.name)[i.toolIndex];return e?(0,Z.jsx)(pe,{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)(ge,{agentServer:i.agentServer,onCancel:()=>a({type:`list`,defaultTab:`Agents`}),onComplete:e})}}var X,Z,xe=e((()=>{X=t(O(),1),o(),i(),m(),oe(),_e(),G(),F(),R(),I(),L(),Z=M()})),Se=e((()=>{_e(),G(),J(),F(),xe(),R(),I(),L()}));function Ce({action:e,target:t,onComplete:n}){let r=g(e=>e.mcp.clients),i=ce(),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 we(e,t,n){if(n){let t=n.trim().split(/\s+/);if(t[0]===`no-redirect`)return(0,$.jsx)(Y,{onComplete:e});if(t[0]===`reconnect`&&t[1])return(0,$.jsx)(be,{serverName:t.slice(1).join(` `),onComplete:e});if(t[0]===`enable`||t[0]===`disable`)return(0,$.jsx)(Ce,{action:t[0],target:t.length>1?t.slice(1).join(` `):`all`,onComplete:e})}return(0,$.jsx)(Y,{onComplete:e})}var Q,$;e((()=>{Q=t(O(),1),Se(),J(),P(),m(),$=M()}))();export{we as call};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{Ky as i,Mc as a,Nc as o,Qu as s,Vy as c,Wy as l,Xh as u,Zh as d,Zu as f,aE as ee,aS as p,ff as m,hC as h,pf as te,sE as g,sS as ne}from"./loadAgentsDir-PPiD2Mfq.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,ai as S,di as re,fi as C,t as w,y as T}from"./src-DL3w8VPk2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as D,et as O}from"./state-BPFYBqm1.js";import{n as k,t as A}from"./cwd-Besi3Os3.js";import{F as j,R as M}from"./debug-BQj6h99Q.js";import{g as N,wn as P,x as F,xn as ie}from"./settings-CvhsRFaT.js";import{M as I,P as L,k as ae}from"./config-BSkuQZNf.js";import{m as R,r as z}from"./git-DplvjXEY.js";import{o as oe,s as se}from"./log-BlJ7CcKG.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-2sjXZkIP.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-C9orgrub.js";import{r as ue,t as de}from"./promptEditor-Bf72KNF-.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 z(e)!==null}var ge=e((()=>{R()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(l()),i=W(n(),`AGENTS.md`),a=W(O(),`AGENTS.md`),c=r.some(e=>e.path===i),u=r.some(e=>e.path===a),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...c?[]:[{path:i,type:`User`,content:``,exists:!1}],...u?[]:[{path:a,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let o=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===i?`User memory`:e.type===`Project`&&!e.isNested&&e.path===a?`Project memory`:r>0?`${o}L ${t}${n}`:`${t}`;let c,l=he(O());return c=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===a?`${l?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),h=[],g=d(e=>e.agentDefinitions);if(L()){h.push({label:`Open auto-memory folder`,value:`${Y}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=ee(e.agentType,e.memory);h.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}m.push(...h);let v=J&&m.some(e=>e.value===J)?J:m[0]?.value||``,[S,C]=(0,K.useState)(L),[w,T]=(0,K.useState)(o),[E]=(0,K.useState)(L),D=d(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{E&&te().then(A)},[E,D]);let j=D?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,I=+!!E;function R(){let e=!S;F(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;F(`userSettings`,{autoDreamEnabled:e}),T(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return H(),b(`confirm:no`,t,{context:`Confirmation`}),b(`confirm:yes`,()=>{M===0?R():M===1&&z()},{context:`Confirmation`,isActive:P}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:P}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(x,{isFocused:M===0,children:(0,q.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,q.jsx)(x,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!D&&w&&(0,q.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(s,{defaultFocusValue:v,options:m,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ne(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var K,q,J,Y,ve=e((()=>{C(),K=t(S(),1),D(),U(),w(),h(),I(),ce(),a(),m(),u(),g(),p(),i(),r(),P(),V(),ge(),N(),f(),q=E(),Y=`__open_folder__`}));function ye(e){let t=fe(),n=A(),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((()=>{w(),k(),E()}));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(j(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){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(T,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(_,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(_,{marginTop:1,children:(0,Q.jsxs)(y,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(v,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(S(),1),w(),ve(),X(),i(),r(),M(),oe(),ue(),Q=E(),$=async e=>(c(),await l(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{i as n,o as r}from"./envUtils-DcaKZlRU.js";import{Ky as i,Mc as a,Nc as o,Qu as s,Vy as c,Wy as l,Xh as u,Zh as d,Zu as f,aE as ee,aS as p,ff as m,hC as h,pf as te,sE as g,sS as ne}from"./loadAgentsDir-CbtNPJV3.js";import{I as _,Lt as v,P as y,Wt as b,_ as x,ai as S,di as re,fi as C,t as w,y as T}from"./src-DL3w8VPk2.js";import{t as E}from"./jsx-runtime-Bb4Xn-E0.js";import{Wt as D,et as O}from"./state-BPFYBqm1.js";import{n as k,t as A}from"./cwd-Besi3Os3.js";import{F as j,R as M}from"./debug-BQj6h99Q.js";import{g as N,wn as P,x as F,xn as ie}from"./settings-CvhsRFaT.js";import{M as I,P as L,k as ae}from"./config-BSkuQZNf.js";import{m as R,r as z}from"./git-DplvjXEY.js";import{o as oe,s as se}from"./log-BlJ7CcKG.js";import{n as ce,r as B}from"./analytics-DJobLaWP.js";import{m as le,v as V}from"./startupProfiler-2sjXZkIP.js";import{n as H,t as U}from"./useExitOnCtrlCDWithKeybindings-YSWYVWk6.js";import{r as ue,t as de}from"./promptEditor-CRIw6vJS.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 z(e)!==null}var ge=e((()=>{R()}));function _e({onSelect:e,onCancel:t}){let r=(0,K.use)(l()),i=W(n(),`AGENTS.md`),a=W(O(),`AGENTS.md`),c=r.some(e=>e.path===i),u=r.some(e=>e.path===a),f=[...r.filter(e=>e.type!==`AutoMem`).map(e=>({...e,exists:!0})),...c?[]:[{path:i,type:`User`,content:``,exists:!1}],...u?[]:[{path:a,type:`Project`,content:``,exists:!1}]],p=new Map,m=f.map(e=>{let t=ie(e.path),n=e.exists?``:` (new)`,r=e.parent?(p.get(e.parent)??0)+1:0;p.set(e.path,r);let o=r>0?` `.repeat(r-1):``,s;s=e.type===`User`&&!e.isNested&&e.path===i?`User memory`:e.type===`Project`&&!e.isNested&&e.path===a?`Project memory`:r>0?`${o}L ${t}${n}`:`${t}`;let c,l=he(O());return c=e.type===`User`&&!e.isNested?`Saved in ~/.workmate/AGENTS.md`:e.type===`Project`&&!e.isNested&&e.path===a?`${l?`Checked in at`:`Saved in`} ./AGENTS.md`:e.parent?`@-imported`:e.isNested?`dynamically loaded`:``,{label:s,value:e.path,description:c}}),h=[],g=d(e=>e.agentDefinitions);if(L()){h.push({label:`Open auto-memory folder`,value:`${Y}${ae()}`,description:``});for(let e of g.activeAgents)if(e.memory){let t=ee(e.agentType,e.memory);h.push({label:`Open ${re.bold(e.agentType)} agent memory`,value:`${Y}${t}`,description:`${e.memory} scope`})}}m.push(...h);let v=J&&m.some(e=>e.value===J)?J:m[0]?.value||``,[S,C]=(0,K.useState)(L),[w,T]=(0,K.useState)(o),[E]=(0,K.useState)(L),D=d(e=>Object.values(e.tasks).some(e=>e.type===`dream`&&e.status===`running`)),[k,A]=(0,K.useState)(null);(0,K.useEffect)(()=>{E&&te().then(A)},[E,D]);let j=D?`running`:k===null?``:k===0?`never`:`last ran ${le(new Date(k))}`,[M,N]=(0,K.useState)(null),P=M!==null,I=+!!E;function R(){let e=!S;F(`userSettings`,{autoMemoryEnabled:e}),C(e),B(`tengu_auto_memory_toggled`,{enabled:e})}function z(){let e=!w;F(`userSettings`,{autoDreamEnabled:e}),T(e),B(`tengu_auto_dream_toggled`,{enabled:e})}return H(),b(`confirm:no`,t,{context:`Confirmation`}),b(`confirm:yes`,()=>{M===0?R():M===1&&z()},{context:`Confirmation`,isActive:P}),b(`select:next`,()=>{N(e=>e!==null&&e<I?e+1:null)},{context:`Select`,isActive:P}),b(`select:previous`,()=>{N(e=>e!==null&&e>0?e-1:e)},{context:`Select`,isActive:P}),(0,q.jsxs)(_,{flexDirection:`column`,width:`100%`,children:[(0,q.jsxs)(_,{flexDirection:`column`,marginBottom:1,children:[(0,q.jsx)(x,{isFocused:M===0,children:(0,q.jsxs)(y,{children:[`Auto-memory: `,S?`on`:`off`]})}),E&&(0,q.jsx)(x,{isFocused:M===1,styled:!1,children:(0,q.jsxs)(y,{color:M===1?`suggestion`:void 0,children:[`Auto-dream: `,w?`on`:`off`,j&&(0,q.jsxs)(y,{dimColor:!0,children:[` · `,j]}),!D&&w&&(0,q.jsx)(y,{dimColor:!0,children:` · /dream to run`})]})})]}),(0,q.jsx)(s,{defaultFocusValue:v,options:m,isDisabled:P,onChange:t=>{if(t.startsWith(Y)){let e=t.slice(15);G(e,{recursive:!0}).catch(()=>{}).then(()=>ne(e));return}J=t,e(t)},onCancel:t,onUpFromFirstItem:()=>N(I)})]})}var K,q,J,Y,ve=e((()=>{C(),K=t(S(),1),D(),U(),w(),h(),I(),ce(),a(),m(),u(),g(),p(),i(),r(),P(),V(),ge(),N(),f(),q=E(),Y=`__open_folder__`}));function ye(e){let t=fe(),n=A(),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((()=>{w(),k(),E()}));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(j(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){se(t),e(`Error opening memory file: ${t}`)}},r=()=>{e(`Cancelled memory editing`,{display:`system`})};return(0,Q.jsx)(T,{title:`Memory`,onCancel:r,color:`remember`,children:(0,Q.jsxs)(_,{flexDirection:`column`,children:[(0,Q.jsx)(Z.Suspense,{fallback:null,children:(0,Q.jsx)(_e,{onSelect:t,onCancel:r})}),(0,Q.jsx)(_,{marginTop:1,children:(0,Q.jsxs)(y,{dimColor:!0,children:[`Learn more: `,(0,Q.jsx)(v,{url:`https://code.workmate.com/docs/en/memory`})]})})]})})}var Z,Q,$;e((()=>{Z=t(S(),1),w(),ve(),X(),i(),r(),M(),oe(),ue(),Q=E(),$=async e=>(c(),await l(),(0,Q.jsx)(be,{onDone:e}))}))();export{$ as call};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Qu as r,ct as i,lt as a,st as o,ut as s}from"./loadAgentsDir-PPiD2Mfq.js";import{I as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({onDone:e}){let t=a(),n=o(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(l,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(l,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function u(n){s(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function d(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(c,{flexDirection:`column`,children:[(0,h.jsxs)(c,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(l,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(l,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(r,{defaultValue:n,options:i,onChange:u,onCancel:d,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(u(),1),d(),n(),i(),h=f(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=a(),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"./rolldown-runtime-DaDcL9Zw.js";import{$u as n,Qu as r,ct as i,lt as a,st as o,ut as s}from"./loadAgentsDir-CbtNPJV3.js";import{I as c,P as l,ai as u,t as d}from"./src-DL3w8VPk2.js";import{t as f}from"./jsx-runtime-Bb4Xn-E0.js";function p({onDone:e}){let t=a(),n=o(),i=(0,m.useMemo)(()=>t.map(e=>({label:(0,h.jsxs)(l,{children:[e.icon,` `,e.name,` `,(0,h.jsxs)(l,{dimColor:!0,children:[`(`,e.slug,`) — `,e.description]})]}),value:e.slug})),[t]);function u(n){s(n);let r=t.find(e=>e.slug===n);e(`${r?.icon} Mode switched to: ${r?.name} (${r?.slug}) — ${r?.description}`,{display:`system`})}function d(){e(`Mode selection cancelled.`,{display:`system`})}return(0,h.jsxs)(c,{flexDirection:`column`,children:[(0,h.jsxs)(c,{marginBottom:1,flexDirection:`column`,children:[(0,h.jsx)(l,{color:`remember`,bold:!0,children:`Select mode`}),(0,h.jsx)(l,{dimColor:!0,children:`Arrow keys to navigate, Enter to select, Esc to cancel.`})]}),(0,h.jsx)(r,{defaultValue:n,options:i,onChange:u,onCancel:d,visibleOptionCount:t.length})]})}var m,h,g;e((()=>{m=t(u(),1),d(),n(),i(),h=f(),g=async(e,t,n)=>{let r=n?.trim().toLowerCase();if(r){let t=a(),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}s(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};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Kw as r,Xh as i,Zh as a,bp as o,qw as s,xp as c,yp as l}from"./loadAgentsDir-PPiD2Mfq.js";import{ai as u,di as d,fi as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{D as m,E as h,q as g}from"./log-BlJ7CcKG.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{A as y,B as b,J as x,O as S,Q as C,Y as w,Z as T,_ as E,b as D,j as O,k,s as A,w as j}from"./model-sviY1inu.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-5Ueiyw6W.js";function I({onDone:e}){let t=a(e=>e.mainLoopModel),r=a(e=>e.mainLoopModelForSession),i=a(e=>e.fastMode),o=n();function s(){v(`tengu_model_command_menu`,{action:`cancel`});let n=H(t);e(`Kept model as ${d.bold(n)}`,{display:`system`})}function c(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),o(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let r=`Set model to ${d.bold(H(n))}`,a;T()&&(b(),!C(n)&&i?(o(e=>({...e,fastMode:!1})),a=!1):C(n)&&w()&&i&&(r+=` · Fast mode ON`,a=!0)),N(n,a===!0,D())&&(r+=` · Billed as extra usage`),a===!1&&(r+=` · Fast mode OFF`),e(r)}return(0,W.jsx)(P,{initial:t,sessionModel:r,onSelect:c,onCancel:s,isStandaloneCommand:!0,showFastModeNotice:T()&&i&&C(t)&&w()})}function L({args:e,onDone:t}){let r=a(e=>e.fastMode),i=n(),o=e==="default"?null:e;return U.useEffect(()=>{async function e(){if(o&&!k(o)){t(`Model '${o}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(o&&z(o)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(o&&B(o)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!o){n(null);return}if(R(o)){n(o);return}try{let{valid:e,error:r}=await s(o);e?n(o):t(r||`Model '${o}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function n(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let n=`Set model to ${d.bold(H(e))}`,a;T()&&(b(),!C(e)&&r?(i(e=>({...e,fastMode:!1})),a=!1):C(e)&&r&&(n+=` · Fast mode ON`,a=!0)),N(e,a===!0,D())&&(n+=` · Billed as extra usage`),a===!1&&(n+=` · Fast mode OFF`),t(n)}e()},[o,t,i]),null}function R(e){return y.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!l()&&!D()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!o()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=a(e=>e.mainLoopModel),n=a(e=>e.mainLoopModelForSession),r=H(t);return e(n?`Current model: ${d.bold(H(n))} (session override from plan mode)\nBase model: ${r}`:`Current model: ${r}`),null}function H(e){let t=j(e??A());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{f(),U=t(u(),1),M(),g(),_(),i(),F(),x(),O(),c(),E(),S(),r(),W=p(),G=async(e,t,n)=>{if(n=n?.trim()||``,m.includes(n))return v(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(h.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(v(`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"./rolldown-runtime-DaDcL9Zw.js";import{$h as n,Kw as r,Xh as i,Zh as a,bp as o,qw as s,xp as c,yp as l}from"./loadAgentsDir-CbtNPJV3.js";import{ai as u,di as d,fi as f}from"./src-DL3w8VPk2.js";import{t as p}from"./jsx-runtime-Bb4Xn-E0.js";import{D as m,E as h,q as g}from"./log-BlJ7CcKG.js";import{n as _,r as v}from"./analytics-DJobLaWP.js";import{A as y,B as b,J as x,O as S,Q as C,Y as w,Z as T,_ as E,b as D,j as O,k,s as A,w as j}from"./model-DlLO7TSx.js";import{i as M,n as N,r as P,t as F}from"./extraUsage-BT3in1Aj.js";function I({onDone:e}){let t=a(e=>e.mainLoopModel),r=a(e=>e.mainLoopModelForSession),i=a(e=>e.fastMode),o=n();function s(){v(`tengu_model_command_menu`,{action:`cancel`});let n=H(t);e(`Kept model as ${d.bold(n)}`,{display:`system`})}function c(n){v(`tengu_model_command_menu`,{action:n,from_model:t,to_model:n}),o(e=>({...e,mainLoopModel:n,mainLoopModelForSession:null}));let r=`Set model to ${d.bold(H(n))}`,a;T()&&(b(),!C(n)&&i?(o(e=>({...e,fastMode:!1})),a=!1):C(n)&&w()&&i&&(r+=` · Fast mode ON`,a=!0)),N(n,a===!0,D())&&(r+=` · Billed as extra usage`),a===!1&&(r+=` · Fast mode OFF`),e(r)}return(0,W.jsx)(P,{initial:t,sessionModel:r,onSelect:c,onCancel:s,isStandaloneCommand:!0,showFastModeNotice:T()&&i&&C(t)&&w()})}function L({args:e,onDone:t}){let r=a(e=>e.fastMode),i=n(),o=e==="default"?null:e;return U.useEffect(()=>{async function e(){if(o&&!k(o)){t(`Model '${o}' is not available. Your organization restricts model selection.`,{display:`system`});return}if(o&&z(o)){t(`Opus 4.7 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(o&&B(o)){t(`Sonnet 4.6 with 1M context is not available for your account. Learn more: https://code.workmate.com/docs/en/model-config#extended-context-with-1m`,{display:`system`});return}if(!o){n(null);return}if(R(o)){n(o);return}try{let{valid:e,error:r}=await s(o);e?n(o):t(r||`Model '${o}' not found`,{display:`system`})}catch(e){t(`Failed to validate model: ${e.message}`,{display:`system`})}}function n(e){i(t=>({...t,mainLoopModel:e,mainLoopModelForSession:null}));let n=`Set model to ${d.bold(H(e))}`,a;T()&&(b(),!C(e)&&r?(i(e=>({...e,fastMode:!1})),a=!1):C(e)&&r&&(n+=` · Fast mode ON`,a=!0)),N(e,a===!0,D())&&(n+=` · Billed as extra usage`),a===!1&&(n+=` · Fast mode OFF`),t(n)}e()},[o,t,i]),null}function R(e){return y.includes(e.toLowerCase().trim())}function z(e){let t=e.toLowerCase();return!l()&&!D()&&t.includes(`opus`)&&t.includes(`[1m]`)}function B(e){let t=e.toLowerCase();return!o()&&(t.includes(`sonnet[1m]`)||t.includes(`sonnet-4-6[1m]`))}function V({onDone:e}){let t=a(e=>e.mainLoopModel),n=a(e=>e.mainLoopModelForSession),r=H(t);return e(n?`Current model: ${d.bold(H(n))} (session override from plan mode)\nBase model: ${r}`:`Current model: ${r}`),null}function H(e){let t=j(e??A());return e===null?`${t} (default)`:t}var U,W,G;e((()=>{f(),U=t(u(),1),M(),g(),_(),i(),F(),x(),O(),c(),E(),S(),r(),W=p(),G=async(e,t,n)=>{if(n=n?.trim()||``,m.includes(n))return v(`tengu_model_command_inline_help`,{args:n}),(0,W.jsx)(V,{onDone:e});if(h.includes(n)){e(`Run /model to open the model selection menu, or /model [modelName] to set the model.`,{display:`system`});return}return n?(v(`tengu_model_command_inline`,{args:n}),(0,W.jsx)(L,{args:n,onDone:e})):(0,W.jsx)(I,{onDone:e})}}))();export{G as call};
@@ -0,0 +1 @@
1
+ import{_ as e,u as t}from"./model-DlLO7TSx.js";e();export{t as getMainLoopModel};