@readmagic/workmate 0.0.5 → 0.0.7

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 (415) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DJRkEz7o.js → AddWorkspaceDirectory-CFrrXnt9.js} +1 -1
  2. package/dist/chunks/{App-iJu5qyiF.js → App-Buad9Llp.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-CRejTHUw.js → ApproveApiKey-B2HJUD7h.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-BQbHdvc3.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-CBLQ1v-J.js → AssistantSessionChooser-4lm4eXQ8.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-D4qA0M5O.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-D1FCKVOi.js → BypassPermissionsModeDialog-DllL8dxU.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +1 -0
  9. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CI0yF6sZ.js → ClaudeMdExternalIncludesDialog-BZSyRqeq.js} +1 -1
  10. package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-D1rrMxeP.js → DesktopHandoff-DaP4Riar.js} +1 -1
  12. package/dist/chunks/{DiffDialog-BKcfKx7O.js → DiffDialog-B7hx8i_Y.js} +2 -2
  13. package/dist/chunks/Doctor-89OgoAUA.js +1 -0
  14. package/dist/chunks/Doctor-CuKJ-nGt.js +3 -0
  15. package/dist/chunks/ExitFlow-DnPydE17.js +2 -0
  16. package/dist/chunks/{Feedback-bEUtrHia.js → Feedback-SmGiR3mf.js} +2 -2
  17. package/dist/chunks/Grove-CjN9DO47.js +11 -0
  18. package/dist/chunks/Grove-Cq88VBmM.js +1 -0
  19. package/dist/chunks/{HybridTransport-9fTBC2Pv.js → HybridTransport-rK83Qijz.js} +1 -1
  20. package/dist/chunks/{InvalidConfigDialog-9M-1nfZ6.js → InvalidConfigDialog-DdO0AxyF.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-B2F6pryH.js → InvalidSettingsDialog-s1G0DwXF.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-BPBb7Npe.js → McpParsingWarnings-Du5IxZos.js} +1 -1
  24. package/dist/chunks/MessageSelector-iIroHvXo.js +3 -0
  25. package/dist/chunks/Messages-D4Hm4gaY.js +11 -0
  26. package/dist/chunks/{Onboarding-cHcnsBGp.js → Onboarding-BiZByBK-.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-CWCD_RpM.js → OverageCreditUpsell-BM7szLgm.js} +1 -1
  28. package/dist/chunks/PluginSettings-uY5KTCtK.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-D5sAO6y-.js → PromptInputFooterSuggestions-BmsFdOu9.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-n6hAdsto.js → PromptInputHelpMenu-DX-0wEDo.js} +1 -1
  31. package/dist/chunks/QueryEngine-CGYaShXD.js +1 -0
  32. package/dist/chunks/REPL-CRJB2t2z.js +142 -0
  33. package/dist/chunks/REPL-u4Yq29Du.js +1 -0
  34. package/dist/chunks/{RemoteCallout-CiA4rCEs.js → RemoteCallout-B-tyvQOe.js} +1 -1
  35. package/dist/chunks/{RemoteSessionManager-zdHfmvfj.js → RemoteSessionManager-DCd0O5_l.js} +2 -2
  36. package/dist/chunks/ResumeConversation-DAAXlOCd.js +1 -0
  37. package/dist/chunks/{SSETransport-BPbhCa2f.js → SSETransport-5VK5okFv.js} +1 -1
  38. package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +1 -0
  39. package/dist/chunks/Settings-CUjWlncb.js +2 -0
  40. package/dist/chunks/{TeleportProgress-DrulEQ7z.js → TeleportProgress-DxN0bQL2.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-D3FOLr0P.js → TeleportRepoMismatchDialog-A5Ss0kuk.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-DI5iRFND.js → TeleportResumeWrapper-Bz14mUqR.js} +1 -1
  43. package/dist/chunks/{ThemePicker-CQ7dfFtv.js → ThemePicker-CVSRqTzW.js} +1 -1
  44. package/dist/chunks/TrustDialog-CY8an_Tg.js +1 -0
  45. package/dist/chunks/{ValidationErrorsList-CPYeuppg.js → ValidationErrorsList-BYsDtAvX.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-C-UXdIng.js → WelcomeV2-C1BfrqC5.js} +1 -1
  47. package/dist/chunks/{add-dir-xTz4COgn.js → add-dir-DfLYgwox.js} +1 -1
  48. package/dist/chunks/{agentDisplay-BuSReYxu.js → agentDisplay-CMmHIl86.js} +1 -1
  49. package/dist/chunks/{agents-CiLlKN2I.js → agents-DE_4mAHG.js} +1 -1
  50. package/dist/chunks/agents-DJtPfvnL.js +103 -0
  51. package/dist/chunks/allErrors-CQE2k0zO.js +1 -0
  52. package/dist/chunks/{ant-CBIfqmAb.js → ant-ClQkuQjZ.js} +1 -1
  53. package/dist/chunks/{api-B-5jqiMg.js → api-2cdIPaeq.js} +1 -1
  54. package/dist/chunks/api-CG-lhKe-.js +1 -0
  55. package/dist/chunks/{assistant-XOnU01yl.js → assistant-Bje16tQx.js} +1 -1
  56. package/dist/chunks/auth-DMfEiQrC.js +1 -0
  57. package/dist/chunks/auth-D_cGl8WD.js +1 -0
  58. package/dist/chunks/{auth-DT2yxy94.js → auth-DqcKPbw8.js} +1 -1
  59. package/dist/chunks/{autoMode-CEMflt3g.js → autoMode-ZW70mpr0.js} +5 -5
  60. package/dist/chunks/{autonomy-_N8aDaA8.js → autonomy-CwbWsCnv.js} +1 -1
  61. package/dist/chunks/autonomy-Oui8yK8G.js +15 -0
  62. package/dist/chunks/{autonomyPanel-I4yCy3Fr.js → autonomyPanel-Mq50H7iM.js} +1 -1
  63. package/dist/chunks/backgroundHousekeeping-BpLtI45r.js +1 -0
  64. package/dist/chunks/backgroundHousekeeping-DtJNx4Ja.js +17 -0
  65. package/dist/chunks/{branch-BIX-pyHp.js → branch-DU5O9KZ0.js} +1 -1
  66. package/dist/chunks/{break-cache-BQfgkNAo.js → break-cache-C_p7Kmx2.js} +3 -3
  67. package/dist/chunks/{bridge-CYskzVt8.js → bridge-DNNxtPlz.js} +2 -2
  68. package/dist/chunks/{bridgeConfig-5p_w4s5r.js → bridgeConfig-CE6dMsiJ.js} +1 -1
  69. package/dist/chunks/bridgeConfig-DP9dD1Cv.js +1 -0
  70. package/dist/chunks/{bridgeEnabled-DhFrLTbG.js → bridgeEnabled-Cc0mGlTb.js} +1 -1
  71. package/dist/chunks/bridgeEnabled-D8wP3DWQ.js +1 -0
  72. package/dist/chunks/bridgeMain-CwxMa_pd.js +1 -0
  73. package/dist/chunks/bridgeMain-D11t1BYQ.js +68 -0
  74. package/dist/chunks/{bridgeMessaging-B5Lbzr8e.js → bridgeMessaging-DdvApEqW.js} +1 -1
  75. package/dist/chunks/{bridgePointer-MqLe5Asm.js → bridgePointer-DqHMHa2B.js} +1 -1
  76. package/dist/chunks/{btw-CWWFO7u8.js → btw-CejSEdNl.js} +1 -1
  77. package/dist/chunks/{caches-DPqPIogk.js → caches-5HVQSevy.js} +2 -2
  78. package/dist/chunks/caches-B-nJoHLM.js +1 -0
  79. package/dist/chunks/{ccrClient-CTLnU9Y1.js → ccrClient-BFyfO67b.js} +1 -1
  80. package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-Fe-QL-sN.js} +1 -1
  81. package/dist/chunks/{clear-DCAgZwc4.js → clear-D8m2utXW.js} +1 -1
  82. package/dist/chunks/client-C6MbjvOB.js +17 -0
  83. package/dist/chunks/client-DKXCfdde.js +1 -0
  84. package/dist/chunks/client-xxikkAoZ.js +1 -0
  85. package/dist/chunks/{color-CmJGInHL.js → color-DWhgZH7A.js} +1 -1
  86. package/dist/chunks/commands-CxJpmEKF.js +1 -0
  87. package/dist/chunks/commitAttribution-DM6SBMwl.js +1 -0
  88. package/dist/chunks/{commitAttribution-CGZr7XNO.js → commitAttribution-DPnHHKSA.js} +1 -1
  89. package/dist/chunks/compact-CblM7306.js +2 -0
  90. package/dist/chunks/config-BLVBFi5v.js +1 -0
  91. package/dist/chunks/config-CMnqm6Se.js +1 -0
  92. package/dist/chunks/{config-3m_9zSrj.js → config-DRDuVyzE.js} +2 -2
  93. package/dist/chunks/{context-C9V4GF0n.js → context-CdSMMM-0.js} +1 -1
  94. package/dist/chunks/context-noninteractive-CPkf2vB9.js +1 -0
  95. package/dist/chunks/{context-noninteractive-BmC4o5xo.js → context-noninteractive-DNury4JI.js} +5 -5
  96. package/dist/chunks/conversation-DCMw_rsE.js +1 -0
  97. package/dist/chunks/conversation-pUtvc-cE.js +1 -0
  98. package/dist/chunks/{createSSHSession-BL6j0AU5.js → createSSHSession-BOdTAX3N.js} +1 -1
  99. package/dist/chunks/{createSession-D_sgO1Xy.js → createSession-8Ei-Lj7V.js} +1 -1
  100. package/dist/chunks/createSession-CjqxVh_Q.js +1 -0
  101. package/dist/chunks/crossProjectResume-Bj_Pe8oe.js +40 -0
  102. package/dist/chunks/{datadog-UkGdjL8-.js → datadog-DqHxqiwY.js} +1 -1
  103. package/dist/chunks/{desktop-HbYKh-VK.js → desktop-Z5FAfunZ.js} +1 -1
  104. package/dist/chunks/{diff-nTV17iWX.js → diff-CJEKvOA5.js} +1 -1
  105. package/dist/chunks/doctor-BA2ZLDTl.js +1 -0
  106. package/dist/chunks/{entry-CCFI6-gM.js → entry-DE0uMIf0.js} +4 -4
  107. package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +1 -0
  108. package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +1 -0
  109. package/dist/chunks/{esm-CGoYrggU.js → esm-5w3xFBnt.js} +1 -1
  110. package/dist/chunks/exit-Dt9kHtJO.js +1 -0
  111. package/dist/chunks/{extra-usage-g2Pw4zt_.js → extra-usage-C7E2Z1p1.js} +1 -1
  112. package/dist/chunks/extra-usage-D0Kkjp-2.js +1 -0
  113. package/dist/chunks/{extra-usage-core-DLYHAInT.js → extra-usage-core-DjdaD1qO.js} +1 -1
  114. package/dist/chunks/{extra-usage-noninteractive-D8iszH3c.js → extra-usage-noninteractive-BnD1RhKK.js} +1 -1
  115. package/dist/chunks/{extraUsage-C2Ylufhj.js → extraUsage-CpgRTcMk.js} +1 -1
  116. package/dist/chunks/extractMemories-DhUprYa7.js +1 -0
  117. package/dist/chunks/{fast-Dx2fTmWr.js → fast-C4ZevUNL.js} +1 -1
  118. package/dist/chunks/fast-CChxlAAF.js +1 -0
  119. package/dist/chunks/{feedback-DCQ4pJ3v.js → feedback-BIhBhV6n.js} +1 -1
  120. package/dist/chunks/{firstPartyEventLogger-BNGPPBNP.js → firstPartyEventLogger-BXY1IJ2D.js} +2 -2
  121. package/dist/chunks/firstPartyEventLogger-CnkGSojw.js +1 -0
  122. package/dist/chunks/{flushGate-XaheIZZT.js → flushGate-CgHq81Gw.js} +1 -1
  123. package/dist/chunks/{gemini-BCCLHK3K.js → gemini-C1J-x1g7.js} +1 -1
  124. package/dist/chunks/generateRecap-C0jjCg0Z.js +1 -0
  125. package/dist/chunks/generateSessionName-w0BMtwS7.js +1 -0
  126. package/dist/chunks/{githubRepoPathMapping-B4AM8luI.js → githubRepoPathMapping-8D0kpsif.js} +1 -1
  127. package/dist/chunks/{goal-Bp6fyGqo.js → goal-B4GsR54_.js} +3 -3
  128. package/dist/chunks/grok-ffNyU3Lt.js +1 -0
  129. package/dist/chunks/{grove-DrBVaZSN.js → grove-BQisE2JM.js} +1 -1
  130. package/dist/chunks/{heapdump-JseysNDr.js → heapdump-DiCjAPR3.js} +1 -1
  131. package/dist/chunks/{help-DR9hKneR.js → help-2hn8VK2-.js} +1 -1
  132. package/dist/chunks/hooks-CBmrBO-J.js +1 -0
  133. package/dist/chunks/{hooks-C5n23H1E.js → hooks-CkA9bhHl.js} +2 -2
  134. package/dist/chunks/hostGuard-BHI6Q8Mt.js +1 -0
  135. package/dist/chunks/inboundAttachments-C5K3XPTC.js +1 -0
  136. package/dist/chunks/{inboundAttachments-Cp8XvLMZ.js → inboundAttachments-IH-g95jo.js} +1 -1
  137. package/dist/chunks/initReplBridge-C-P4dgAG.js +1 -0
  138. package/dist/chunks/{install-C7qTB0V5.js → install-Dzlm4u58.js} +1 -1
  139. package/dist/chunks/{instrumentation-CLZttr_u.js → instrumentation-Yt31gxWN.js} +3 -3
  140. package/dist/chunks/{job-BhiazwPH.js → job-BXujwZNa.js} +1 -1
  141. package/dist/chunks/{keybindings-CkL8BzUt.js → keybindings-D8FXoO89.js} +2 -2
  142. package/dist/chunks/language-Baosud0X.js +1 -0
  143. package/dist/chunks/{language-DIw2871r.js → language-Ca4B018X.js} +1 -1
  144. package/dist/chunks/{launchAgentsPlatform-j-mWpwW1.js → launchAgentsPlatform-D6DmNuDt.js} +1 -1
  145. package/dist/chunks/{launchLocalMemory-DmoXp0Xo.js → launchLocalMemory-C0FzUq7x.js} +2 -2
  146. package/dist/chunks/{launchLocalVault-1uKe0HjA.js → launchLocalVault-DkYAre4O.js} +3 -3
  147. package/dist/chunks/{launchMemoryStores-SxDKjHJ3.js → launchMemoryStores-D2rKWAPs.js} +1 -1
  148. package/dist/chunks/{launchOnboarding-CTtpnXcs.js → launchOnboarding-gOVAFEFp.js} +1 -1
  149. package/dist/chunks/{launchSchedule-BDVnGhaL.js → launchSchedule-IZdFstT_.js} +1 -1
  150. package/dist/chunks/{launchSkillStore-SmMLxp4K.js → launchSkillStore-B7LamM1d.js} +1 -1
  151. package/dist/chunks/{launchTeleport-B472ZSGz.js → launchTeleport-C2BQMfYP.js} +3 -3
  152. package/dist/chunks/{launchVault-CsyBgxle.js → launchVault-C60WUcCI.js} +1 -1
  153. package/dist/chunks/{lazySchema-DcIJE_0i.js → lazySchema-DULtBUCI.js} +1 -1
  154. package/dist/chunks/loadAgentsDir-B9c3Emvg.js +1 -0
  155. package/dist/chunks/{loadAgentsDir-Clu7Uk6a.js → loadAgentsDir-x3rlgED4.js} +693 -695
  156. package/dist/chunks/loadPluginHooks-BhNdAjeY.js +1 -0
  157. package/dist/chunks/localSearch-BLCGsdyM.js +1 -0
  158. package/dist/chunks/{localSearch-iA6JTk19.js → localSearch-DtplGF-l.js} +1 -1
  159. package/dist/chunks/{logoV2Utils-YHBJLIrC.js → logoV2Utils-gGK9gErT.js} +1 -1
  160. package/dist/chunks/{magicDocs-Bf1fqnHN.js → magicDocs-qdDB_mKb.js} +2 -2
  161. package/dist/chunks/{main-gtV_TqXP.js → main-OWFSddRx.js} +84 -84
  162. package/dist/chunks/managedEnv-Aq5BXfY7.js +1 -0
  163. package/dist/chunks/managedEnv-BHoeDjpS.js +1 -0
  164. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
  165. package/dist/chunks/{mappers-C8lYERPX.js → mappers-04gNXJ3w.js} +1 -1
  166. package/dist/chunks/mcp-BSNdwbxR.js +1 -0
  167. package/dist/chunks/mcp-CMnDNI-4.js +6 -0
  168. package/dist/chunks/mcp-D1yA9E56.js +2 -0
  169. package/dist/chunks/memory-D1zbyjxN.js +1 -0
  170. package/dist/chunks/{mode-DO6g7nkX.js → mode-DY087x_x.js} +2 -2
  171. package/dist/chunks/model-CZViyZnE.js +1 -0
  172. package/dist/chunks/{model-DLXL0CNu.js → model-D0EfJBuw.js} +1 -1
  173. package/dist/chunks/model-DLLkVV6S.js +1 -0
  174. package/dist/chunks/{nativeInstaller-OPuO2sm_.js → nativeInstaller-yj81F75v.js} +1 -1
  175. package/dist/chunks/onChangeAppState-DhGKPG9g.js +1 -0
  176. package/dist/chunks/{openai-HOebt-8k.js → openai-EYRnUsco.js} +3 -3
  177. package/dist/chunks/{overageCreditGrant-Bi1CTBAx.js → overageCreditGrant-Du3dOYVu.js} +1 -1
  178. package/dist/chunks/{panel-CrTPqXCv.js → panel-BSZGX6jN.js} +1 -1
  179. package/dist/chunks/{panelCall-D0eURklm.js → panelCall-dMvRPAGE.js} +1 -1
  180. package/dist/chunks/{partition-C8RSL3SQ.js → partition-C4FWzYVm.js} +1 -1
  181. package/dist/chunks/{passes-BJci5SM_.js → passes-Daz-ARWD.js} +1 -1
  182. package/dist/chunks/permissions-DF8tAmDF.js +3 -0
  183. package/dist/chunks/{pidLock-Bd2e6xuT.js → pidLock-CbC_il6r.js} +2 -2
  184. package/dist/chunks/{plan-D4gMsK7i.js → plan-rsb_83Fo.js} +1 -1
  185. package/dist/chunks/{plugin-CwCo5Kik.js → plugin-Cm31-nej.js} +1 -1
  186. package/dist/chunks/pluginAutoupdate-0k03PVff.js +1 -0
  187. package/dist/chunks/pluginBlocklist-wPFCUPdm.js +1 -0
  188. package/dist/chunks/pluginCliCommands-DhL9LbH0.js +1 -0
  189. package/dist/chunks/{pluginFlagging-DNPBbJZo.js → pluginFlagging-CAdaFV_D.js} +1 -1
  190. package/dist/chunks/pluginOperations-Cs_Z4C6O.js +2 -0
  191. package/dist/chunks/pluginStartupCheck-BRXGKGjG.js +1 -0
  192. package/dist/chunks/pluginStartupCheck-KeU0efTj.js +1 -0
  193. package/dist/chunks/{plugins-CzJIuPfb.js → plugins-CQNKZmjP.js} +4 -4
  194. package/dist/chunks/policyLimits-D2s8M8P2.js +1 -0
  195. package/dist/chunks/{pollConfig-DH2oCtFS.js → pollConfig-2nFzv6Hy.js} +1 -1
  196. package/dist/chunks/{poor-Dha9p9RF.js → poor-DXumVTR4.js} +1 -1
  197. package/dist/chunks/{poorMode-1NLYiS3Y.js → poorMode-CBOtooa0.js} +1 -1
  198. package/dist/chunks/poorMode-yNZL5uYf.js +1 -0
  199. package/dist/chunks/print-uxCF5ka5.js +23 -0
  200. package/dist/chunks/{privacy-settings-6ZWxR4Qt.js → privacy-settings-BncbJCV0.js} +1 -1
  201. package/dist/chunks/processBashCommand-CGdwvPmD.js +1 -0
  202. package/dist/chunks/processSlashCommand-DQarepEb.js +5 -0
  203. package/dist/chunks/prompt-BgOdcHkd.js +1 -0
  204. package/dist/chunks/{prompt-Bg_1U0gO.js → prompt-CE3sFmZV.js} +5 -5
  205. package/dist/chunks/prompt-CLJKFebn.js +1 -0
  206. package/dist/chunks/{promptEditor-BhYDmwdS.js → promptEditor-CyTzyjwG.js} +2 -2
  207. package/dist/chunks/{protocolHandler-Dnb7lITm.js → protocolHandler-JR8pASdH.js} +1 -1
  208. package/dist/chunks/rate-limit-options-C-EqWjeI.js +1 -0
  209. package/dist/chunks/{rcDebugLog-VKwMl0yg.js → rcDebugLog-DBB9r8aw.js} +1 -1
  210. package/dist/chunks/reconciler-CYD_XpG4.js +4 -0
  211. package/dist/chunks/{referral-BlrMpBAV.js → referral-CKmHHxj_.js} +1 -1
  212. package/dist/chunks/refresh-ZqZdmLK5.js +1 -0
  213. package/dist/chunks/{registerProtocol-CuKZAiCc.js → registerProtocol-wZv2uiW_.js} +1 -1
  214. package/dist/chunks/{release-notes-BgP8u7NE.js → release-notes-B5K7wVqZ.js} +1 -1
  215. package/dist/chunks/{releaseNotes-CunqVlbU.js → releaseNotes-B8gbyFFJ.js} +2 -2
  216. package/dist/chunks/{reload-plugins-CD9TzvFm.js → reload-plugins-B9ApSp2m.js} +1 -1
  217. package/dist/chunks/{remote-env-QaP_W_sv.js → remote-env-CAt1dHIS.js} +1 -1
  218. package/dist/chunks/{remoteBridgeCore-9-HVMo63.js → remoteBridgeCore-Bk3UdSLJ.js} +1 -1
  219. package/dist/chunks/remoteManagedSettings-bswzAB6W.js +1 -0
  220. package/dist/chunks/rename-CE_U6KE6.js +1 -0
  221. package/dist/chunks/{resume-D-SpOy_1.js → resume-BicEjsPd.js} +2 -2
  222. package/dist/chunks/{runtimeObserver-Dm3LIUMp.js → runtimeObserver-BrGF5QWX.js} +4 -4
  223. package/dist/chunks/{runtimeObserver-DOEcrylu.js → runtimeObserver-CiwnPFjK.js} +1 -1
  224. package/dist/chunks/sandbox-adapter-BtMiHImm.js +1 -0
  225. package/dist/chunks/{sandbox-toggle-B61AeBor.js → sandbox-toggle-D8eebdyI.js} +1 -1
  226. package/dist/chunks/searchExtraTools-hLLPuh7c.js +1 -0
  227. package/dist/chunks/{session-RwJCIIcs.js → session-BZIlR9Gc.js} +2 -2
  228. package/dist/chunks/{sessionDiscovery-dkFeWcA3.js → sessionDiscovery-DfDqTrF1.js} +1 -1
  229. package/dist/chunks/sessionFileAccessHooks-Bm8wiqwe.js +1 -0
  230. package/dist/chunks/sessionMemory-D37S0-jX.js +1 -0
  231. package/dist/chunks/sessionMemory-DmlAG3jq.js +1 -0
  232. package/dist/chunks/sessionMemoryUtils-6EWDHSGU.js +1 -0
  233. package/dist/chunks/sessionObserver-BUw2rzKl.js +1 -0
  234. package/dist/chunks/{sessionObserver-CSOYgsvH.js → sessionObserver-KgquhGWw.js} +1 -1
  235. package/dist/chunks/sessionStorage-CucBSK5Q.js +1 -0
  236. package/dist/chunks/{sessionTitle-CLOlPZ_M.js → sessionTitle-DAnM73S0.js} +2 -2
  237. package/dist/chunks/{sessionTracing-D8wr9j4X.js → sessionTracing-_Hh5VXxt.js} +1 -1
  238. package/dist/chunks/settings-BeLFUeie.js +19 -0
  239. package/dist/chunks/settings-Cl16Haug.js +1 -0
  240. package/dist/chunks/settingsSync-BNvFYH3c.js +1 -0
  241. package/dist/chunks/setup-D8kXv3ts.js +3 -0
  242. package/dist/chunks/{shadowedRuleDetection-CXsmUY2o.js → shadowedRuleDetection-C6R5zOUe.js} +1 -1
  243. package/dist/chunks/{sideQuestion-CHpOVzY5.js → sideQuestion-hUhxls9r.js} +3 -3
  244. package/dist/chunks/{sinks-1hFrW9HK.js → sinks-BuE17DeZ.js} +2 -2
  245. package/dist/chunks/sinks-FevoYQqP.js +1 -0
  246. package/dist/chunks/{skill-learning-Ck17rwH8.js → skill-learning-CMdxGtxr.js} +1 -1
  247. package/dist/chunks/skillChangeDetector-C65ZLSYV.js +1 -0
  248. package/dist/chunks/{skillGapStore-DyqNKuNy.js → skillGapStore-D18LRJAM.js} +2 -2
  249. package/dist/chunks/{skillGapStore-BJ1h2LVr.js → skillGapStore-Ep62R-2_.js} +1 -1
  250. package/dist/chunks/{skillGenerator-BT8NGzXT.js → skillGenerator-Bc7WwNT8.js} +2 -2
  251. package/dist/chunks/{skillLearning-Cn9Uw0Kd.js → skillLearning-Cs9fJgkV.js} +1 -1
  252. package/dist/chunks/skillLearning-duPZl69A.js +1 -0
  253. package/dist/chunks/{skillPanel-N0GoWjIi.js → skillPanel-Cyzby746.js} +3 -3
  254. package/dist/chunks/{skillSearchPanel-CTwtgTzy.js → skillSearchPanel-Cll9ccA5.js} +4 -4
  255. package/dist/chunks/{skills-Bv3lH-aA.js → skills-BPPeYBy7.js} +1 -1
  256. package/dist/chunks/{stats-C1Ff6w4i.js → stats-CqfF4Axp.js} +1 -1
  257. package/dist/chunks/{status-FD7HVYS7.js → status-CC9Q-2Yn.js} +1 -1
  258. package/dist/chunks/{status-DyXiBa0m.js → status-D4IQpsNK.js} +2 -2
  259. package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +1 -0
  260. package/dist/chunks/syncCache-CANQZ9mQ.js +1 -0
  261. package/dist/chunks/{tag-RzOSA5T0.js → tag-DDbNqBMu.js} +2 -2
  262. package/dist/chunks/{tasks-eJrOcdhB.js → tasks-CZvWJYGr.js} +1 -1
  263. package/dist/chunks/teleport-Dk5j03Ix.js +1 -0
  264. package/dist/chunks/{templateJobs-BnOBSFtq.js → templateJobs-D1BdhZsv.js} +1 -1
  265. package/dist/chunks/{terminalSetup-D_P5iZmq.js → terminalSetup-3JNy6i_J.js} +5 -5
  266. package/dist/chunks/{terminalSetup-BfvmoJaK.js → terminalSetup-Cn6jeYw1.js} +1 -1
  267. package/dist/chunks/{theme-S0kVMVt4.js → theme-Cg4GNOoQ.js} +1 -1
  268. package/dist/chunks/thinkback-p-vKIRW_.js +1 -0
  269. package/dist/chunks/thinkback-play-DnPTDE8B.js +1 -0
  270. package/dist/chunks/{thinkback-HyW_R_88.js → thinkback-rFA1do6F.js} +1 -1
  271. package/dist/chunks/{toolEventObserver--Z6jENks.js → toolEventObserver-CzsCuUMc.js} +1 -1
  272. package/dist/chunks/{toolEventObserver-BAFzvePj.js → toolEventObserver-SFwURL5F.js} +1 -1
  273. package/dist/chunks/toolPool-BR27AMJO.js +1 -0
  274. package/dist/chunks/trustedDevice-BYt39fui.js +1 -0
  275. package/dist/chunks/{trustedDevice-Dn4rXbxT.js → trustedDevice-CKedohmT.js} +1 -1
  276. package/dist/chunks/{types-C-MRCL8J.js → types-Dut4311z.js} +2 -2
  277. package/dist/chunks/{ultrareviewCommand-mYDTBCFD.js → ultrareviewCommand-C_4OSBTW.js} +2 -2
  278. package/dist/chunks/{undercover-CdapzvNH.js → undercover-D30rKimg.js} +2 -2
  279. package/dist/chunks/undercover-DRSwLozU.js +1 -0
  280. package/dist/chunks/{updateCCB-DPShheOr.js → updateCCB-C2G-U-qA.js} +1 -1
  281. package/dist/chunks/upgrade-Bi-bIz7R.js +1 -0
  282. package/dist/chunks/{upgrade-BOeakAP6.js → upgrade-Chs-OQFd.js} +1 -1
  283. package/dist/chunks/{upload-BXQsDtLW.js → upload-D8FWMSQx.js} +1 -1
  284. package/dist/chunks/{usage-iNQzY960.js → usage-BxVeUt60.js} +1 -1
  285. package/dist/chunks/usage-DUO7Yy1f.js +1 -0
  286. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CntByfTQ.js → useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js} +1 -1
  287. package/dist/chunks/useMainLoopModel-Gy1Vv4Qr.js +1 -0
  288. package/dist/chunks/useManagePlugins-B11_87VN.js +1 -0
  289. package/dist/chunks/useMergedTools-CR56my9t.js +1 -0
  290. package/dist/chunks/{useSearchInput-H-8hJeFD.js → useSearchInput-C5OzQnX6.js} +1 -1
  291. package/dist/chunks/{useSettingsErrors-BF5i5Xju.js → useSettingsErrors-B9vOZL41.js} +1 -1
  292. package/dist/chunks/{util-CoicMvOv.js → util-8EHwfg4A.js} +1 -1
  293. package/dist/chunks/validatePlugin-6q1qmnAC.js +1 -0
  294. package/dist/chunks/{vim-DdvQlLDm.js → vim-CNDzwoTd.js} +1 -1
  295. package/dist/chunks/{workerRegistry-CzqQwCHC.js → workerRegistry-CvyHvwx-.js} +1 -1
  296. package/dist/chunks/worktree-ogmNCIpz.js +1 -0
  297. package/dist/cli.js +1 -1
  298. package/package.json +1 -1
  299. package/dist/chunks/ApproveApiKey-CKfn7U1R.js +0 -1
  300. package/dist/chunks/BackgroundTasksDialog-CyoLEYWH.js +0 -2
  301. package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +0 -1
  302. package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +0 -1
  303. package/dist/chunks/Doctor-CcJUwSQn.js +0 -1
  304. package/dist/chunks/Doctor-Yco1McrL.js +0 -3
  305. package/dist/chunks/ExitFlow-D3csukbB.js +0 -2
  306. package/dist/chunks/Grove-DPkIjqg8.js +0 -1
  307. package/dist/chunks/Grove-Dsd7F39b.js +0 -11
  308. package/dist/chunks/MCPConnectionManager-MWpKjeZT.js +0 -1
  309. package/dist/chunks/MessageSelector-DsQmqFt2.js +0 -3
  310. package/dist/chunks/Messages-B3sGRx5A.js +0 -11
  311. package/dist/chunks/PluginSettings-B0jbwB2M.js +0 -17
  312. package/dist/chunks/QueryEngine-cwdsr4dr.js +0 -1
  313. package/dist/chunks/REPL-CJzScgbZ.js +0 -142
  314. package/dist/chunks/REPL-DlBJIPCw.js +0 -1
  315. package/dist/chunks/ResumeConversation-Rxwd6HAJ.js +0 -1
  316. package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +0 -1
  317. package/dist/chunks/Settings-CxI_KHUj.js +0 -2
  318. package/dist/chunks/TrustDialog-CnVKrdxQ.js +0 -1
  319. package/dist/chunks/agents-Du9KYHqN.js +0 -103
  320. package/dist/chunks/allErrors-P3utlEeA.js +0 -1
  321. package/dist/chunks/api-BiwZmmsh.js +0 -1
  322. package/dist/chunks/auth-BQa4kzQo.js +0 -1
  323. package/dist/chunks/auth-UAJhZNmZ.js +0 -1
  324. package/dist/chunks/autonomy-Cg5zweUa.js +0 -15
  325. package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +0 -1
  326. package/dist/chunks/backgroundHousekeeping-DhF2lrQ9.js +0 -17
  327. package/dist/chunks/bridgeConfig-DWEqKbXk.js +0 -1
  328. package/dist/chunks/bridgeEnabled-CjVCMwnq.js +0 -1
  329. package/dist/chunks/bridgeMain-6lollTtZ.js +0 -1
  330. package/dist/chunks/bridgeMain-BX2AkLPs.js +0 -68
  331. package/dist/chunks/caches-C46fa77L.js +0 -1
  332. package/dist/chunks/client-Bup0Sgcn.js +0 -1
  333. package/dist/chunks/commands-BdB1eFvP.js +0 -1
  334. package/dist/chunks/commitAttribution-D6J3NuhB.js +0 -1
  335. package/dist/chunks/compact-C6-lMHgn.js +0 -2
  336. package/dist/chunks/config-Bxt1UH1T.js +0 -1
  337. package/dist/chunks/config-CjjXZfNi.js +0 -1
  338. package/dist/chunks/context-noninteractive-DvGo1l7b.js +0 -1
  339. package/dist/chunks/conversation-CH9ouFai.js +0 -1
  340. package/dist/chunks/conversation-CYqqk0o7.js +0 -1
  341. package/dist/chunks/createSession-DUfOAeyE.js +0 -1
  342. package/dist/chunks/crossProjectResume-D5hTOfnE.js +0 -40
  343. package/dist/chunks/doctor-7fgVhEKL.js +0 -1
  344. package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +0 -1
  345. package/dist/chunks/envLessBridgeConfig-DXd10GXD.js +0 -1
  346. package/dist/chunks/exit-ropaQiOr.js +0 -1
  347. package/dist/chunks/extra-usage-CLhv1Z4g.js +0 -1
  348. package/dist/chunks/extractMemories-B2IAvbXM.js +0 -1
  349. package/dist/chunks/fast-_G6zcFye.js +0 -1
  350. package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +0 -1
  351. package/dist/chunks/generateRecap-BhvbixY2.js +0 -1
  352. package/dist/chunks/generateSessionName-CN1oh7Fa.js +0 -1
  353. package/dist/chunks/grok-ax26ju8y.js +0 -1
  354. package/dist/chunks/hooks-BUJLxdFJ.js +0 -1
  355. package/dist/chunks/hostGuard-C5xydXZI.js +0 -1
  356. package/dist/chunks/inboundAttachments-C0nMTtCi.js +0 -1
  357. package/dist/chunks/initReplBridge-DJs28ZkI.js +0 -1
  358. package/dist/chunks/language-DfOAuDFc.js +0 -1
  359. package/dist/chunks/loadAgentsDir-DTbJJff-.js +0 -1
  360. package/dist/chunks/loadPluginHooks-Cvd5VdjQ.js +0 -1
  361. package/dist/chunks/localSearch-DKv8PRLD.js +0 -1
  362. package/dist/chunks/mcp-CNuhEGP6.js +0 -6
  363. package/dist/chunks/mcp-Ci0OPVrR.js +0 -1
  364. package/dist/chunks/mcp-CwIYauZl.js +0 -2
  365. package/dist/chunks/memory-DCGqfQ1U.js +0 -1
  366. package/dist/chunks/model-BQF64tZx.js +0 -1
  367. package/dist/chunks/model-DvrvG6BB.js +0 -1
  368. package/dist/chunks/onChangeAppState-CHhRDkM7.js +0 -1
  369. package/dist/chunks/permissions-JU9CGHgI.js +0 -3
  370. package/dist/chunks/pluginAutoupdate-CO-n9bqe.js +0 -1
  371. package/dist/chunks/pluginBlocklist-5qbaTRbV.js +0 -1
  372. package/dist/chunks/pluginCliCommands-I-lsw_us.js +0 -1
  373. package/dist/chunks/pluginOperations-Cz6eQ0Vu.js +0 -2
  374. package/dist/chunks/pluginStartupCheck-CoW7073W.js +0 -1
  375. package/dist/chunks/pluginStartupCheck-DJ9fslCK.js +0 -1
  376. package/dist/chunks/policyLimits-BkjgMQD0.js +0 -1
  377. package/dist/chunks/poorMode-qlxqU8Hm.js +0 -1
  378. package/dist/chunks/print-BL4EUT5Z.js +0 -23
  379. package/dist/chunks/processBashCommand-BZs9wggV.js +0 -1
  380. package/dist/chunks/processSlashCommand-D8lKLNzM.js +0 -5
  381. package/dist/chunks/prompt-CN7gBNKS.js +0 -1
  382. package/dist/chunks/prompt-D-zHhqp8.js +0 -1
  383. package/dist/chunks/rate-limit-options-DVzT3eWH.js +0 -1
  384. package/dist/chunks/reconciler-BdRXZTJf.js +0 -4
  385. package/dist/chunks/refresh-jwqnoK2h.js +0 -1
  386. package/dist/chunks/remoteManagedSettings-jZ6u8ZBT.js +0 -1
  387. package/dist/chunks/rename-29qxHf8W.js +0 -1
  388. package/dist/chunks/sandbox-adapter-LzTcKwBp.js +0 -1
  389. package/dist/chunks/searchExtraTools-CbJJQqzH.js +0 -1
  390. package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +0 -1
  391. package/dist/chunks/sessionMemory-C4JAUZ6V.js +0 -1
  392. package/dist/chunks/sessionMemory-btARBn8H.js +0 -1
  393. package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +0 -1
  394. package/dist/chunks/sessionObserver-DMvWci8-.js +0 -1
  395. package/dist/chunks/sessionStorage-Diyuvt20.js +0 -1
  396. package/dist/chunks/settings-Dlp5JTa_.js +0 -19
  397. package/dist/chunks/settingsSync-QWA0VZSu.js +0 -1
  398. package/dist/chunks/setup-UI9uv2-K.js +0 -3
  399. package/dist/chunks/sinks-CXq8-7Qn.js +0 -1
  400. package/dist/chunks/skillChangeDetector-s0F9Yf9a.js +0 -1
  401. package/dist/chunks/skillLearning-1ZfYIzfL.js +0 -1
  402. package/dist/chunks/statusNoticeHelpers-kTp9Rdk6.js +0 -1
  403. package/dist/chunks/teleport-ABA-hdmP.js +0 -1
  404. package/dist/chunks/thinkback-C6gV2LpU.js +0 -1
  405. package/dist/chunks/thinkback-play-H6md4czq.js +0 -1
  406. package/dist/chunks/toolPool-CR61XXm3.js +0 -1
  407. package/dist/chunks/trustedDevice-DUrFWupL.js +0 -1
  408. package/dist/chunks/undercover-k3JoOKAb.js +0 -1
  409. package/dist/chunks/upgrade-D7iGU0PQ.js +0 -1
  410. package/dist/chunks/usage-DbRdMJog.js +0 -1
  411. package/dist/chunks/useMainLoopModel-DHkRIgNs.js +0 -1
  412. package/dist/chunks/useManagePlugins-B8HD0RUh.js +0 -1
  413. package/dist/chunks/useMergedTools-DfchLQZC.js +0 -1
  414. package/dist/chunks/validatePlugin-z2fcngf8.js +0 -1
  415. package/dist/chunks/worktree-DMhP5T0p.js +0 -1
@@ -0,0 +1,103 @@
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-DSxRz_kt.js";import{n as i,t as a}from"./figures-5ThXQEtq.js";import{C as o,D as s,I as c,P as l,T as u,Wt as d,di as f,fi as p,t as m,ui as h,y as g}from"./src-CDCSSo0U2.js";import{t as _}from"./jsx-runtime-Bb4Xn-E0.js";import{$d as v,Bd as y,CE as b,Cf as ee,Ch as x,Eb as te,Ef as S,Ex as C,FD as ne,FS as re,Fd as ie,Fw as ae,Gd as oe,HT as se,Hn as ce,Hu as le,Id as ue,Iw as de,Kd as fe,LS as pe,Mg as me,Mh as he,Mo as ge,Nc as _e,PD as ve,PS as ye,Pc as be,Ph as xe,Sh as Se,Tf as Ce,Tx as we,Ud as Te,Un as Ee,Uu as De,Vo as Oe,Wd as ke,Wn as Ae,_f as je,at as Me,ax as Ne,b_ as Pe,c as Fe,cC as Ie,du as Le,ef as Re,eh as ze,et as Be,ff as Ve,fx as w,gf as He,ho as Ue,ix as We,jg as Ge,jh as Ke,l as qe,nh as Je,nt as Ye,nv as Xe,o as Ze,pf as Qe,px as T,qd as $e,r as et,s as tt,sC as nt,st as rt,t as it,tv as at,uu as ot,vf as st,wE as ct,wb as lt,wf as ut,xh as dt,y_ as ft,yf as pt,zd as mt}from"./loadAgentsDir-x3rlgED4.js";import{n as ht,t as gt}from"./cwd-CYmmnQVS.js";import{C as _t,G as vt,I as yt,Q as bt,S as xt,W as St,z as Ct}from"./debug-BrXObCdR.js";import{dn as wt,dt as Tt,en as Et,et as Dt,it as Ot,nn as kt,pn as At,ut as jt,vn as Mt,yn as Nt}from"./settings-BeLFUeie.js";import{I as Pt,P as Ft}from"./config-DRDuVyzE.js";import{o as It,s as Lt}from"./log-BMCygSzM.js";import{n as Rt,r as zt}from"./analytics-BotDBGh0.js";import{T as Bt,b as Vt}from"./startupProfiler-xa3NmN7Z.js";import{l as Ht,n as Ut,o as Wt}from"./stringUtils-DGLPkqJ4.js";import{Tn as Gt,wn as Kt}from"./prompt-CE3sFmZV.js";import{st as qt}from"./rcDebugLog-DBB9r8aw.js";import{u as E}from"./referral-CKmHHxj_.js";import{r as Jt,t as Yt}from"./TungstenTool-CxMQVCuF.js";import{a as Xt,i as Zt,n as Qt,o as $t,r as en,t as tn}from"./agentDisplay-CMmHIl86.js";import{n as nn,t as rn}from"./useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js";import{n as an,t as on}from"./useMergedTools-CR56my9t.js";import{n as sn,r as cn,t as ln}from"./promptEditor-CyTzyjwG.js";import{n as un,t as dn}from"./useMainLoopModel-Gy1Vv4Qr.js";import{join as D}from"path";import{mkdir as fn,open as pn,unlink as mn}from"fs/promises";var O,hn=e((()=>{O={FOLDER_NAME:`.claude`,AGENTS_DIR:`agents`}}));function gn(e,t,n,r,i,a,o){return`---
2
+ name: ${e}
3
+ description: "${t.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`).replace(/\n/g,`\\\\n`)}"${n===void 0||n.length===1&&n[0]===`*`?``:`\ntools: ${n.join(`, `)}`}${a?`\nmodel: ${a}`:``}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
4
+ ---
5
+
6
+ ${r}
7
+ `}function _n(e){switch(e){case`flagSettings`:throw Error(`Cannot get directory path for ${e} agents`);case`userSettings`:return D(n(),O.AGENTS_DIR);case`projectSettings`:return D(gt(),O.FOLDER_NAME,O.AGENTS_DIR);case`policySettings`:return D(Et(),O.FOLDER_NAME,O.AGENTS_DIR);case`localSettings`:return D(gt(),O.FOLDER_NAME,O.AGENTS_DIR)}}function vn(e){switch(e){case`projectSettings`:return D(`.`,O.FOLDER_NAME,O.AGENTS_DIR);default:return _n(e)}}function yn(e){return D(_n(e.source),`${e.agentType}.md`)}function bn(e){if(e.source===`built-in`)return`Built-in`;if(e.source===`plugin`)throw Error(`Cannot get file path for plugin agents`);return D(_n(e.source),`${e.filename||e.agentType}.md`)}function xn(e){return e.source===`built-in`?`Built-in`:D(vn(e.source),`${e.agentType}.md`)}function Sn(e){return tt(e)?`Built-in`:qe(e)?`Plugin: ${e.plugin||`Unknown`}`:e.source===`flagSettings`?`CLI argument`:D(vn(e.source),`${e.filename||e.agentType}.md`)}async function Cn(e){let t=_n(e);return await fn(t,{recursive:!0}),t}async function wn(e,t,n,r,i,a=!0,o,s,c){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await Cn(e);let l=yn({source:e,agentType:t}),u=gn(t,n,r,i,o,s,c);try{await Dn(l,u,a?`wx`:`w`)}catch(e){throw yt(e)===`EEXIST`?Error(`Agent file already exists: ${l}`):e}}async function Tn(e,t,n,r,i,a,o){if(e.source===`built-in`)throw Error(`Cannot update built-in agents`);await Dn(bn(e),gn(e.agentType,t,n,r,i,a,o))}async function En(e){if(e.source===`built-in`)throw Error(`Cannot delete built-in agents`);let t=bn(e);try{await mn(t)}catch(e){if(yt(e)!==`ENOENT`)throw e}}async function Dn(e,t,n=`w`){let r=await pn(e,n);try{await r.writeFile(t,{encoding:`utf-8`}),await r.datasync()}finally{await r.close()}}var On=e((()=>{kt(),Ze(),ht(),r(),Ct(),hn()}));function kn({agent:e,tools:t,onBack:n}){let r=x(e,t,!1),i=Sn(e),o=oe(e.agentType);d(`confirm:no`,n,{context:`Confirmation`});let s=e=>{e.key===`return`&&(e.preventDefault(),n())};function u(){return r.hasWildcard?(0,k.jsx)(l,{children:`All tools`}):!e.tools||e.tools.length===0?(0,k.jsx)(l,{children:`None`}):(0,k.jsxs)(k.Fragment,{children:[r.validTools.length>0&&(0,k.jsx)(l,{children:r.validTools.join(`, `)}),r.invalidTools.length>0&&(0,k.jsxs)(l,{color:`warning`,children:[a.warning,` Unrecognized: `,r.invalidTools.join(`, `)]})]})}return(0,k.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:s,children:[(0,k.jsx)(l,{dimColor:!0,children:i}),(0,k.jsxs)(c,{flexDirection:`column`,children:[(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]}),(0,k.jsx)(c,{marginLeft:2,children:(0,k.jsx)(l,{children:e.whenToUse})})]}),(0,k.jsxs)(c,{children:[(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Tools`}),`:`,` `]}),u()]}),(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Model`}),`: `,Ke(e.model)]}),e.permissionMode&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Permission mode`}),`: `,e.permissionMode]}),e.memory&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Memory`}),`: `,ce(e.memory)]}),e.hooks&&Object.keys(e.hooks).length>0&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Hooks`}),`: `,Object.keys(e.hooks).join(`, `)]}),e.skills&&e.skills.length>0&&(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Skills`}),`:`,` `,e.skills.length>10?`${e.skills.length} skills`:e.skills.join(`, `)]}),o&&(0,k.jsx)(c,{children:(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`Color`}),`:`,` `,(0,k.jsxs)(l,{backgroundColor:o,color:`inverseText`,children:[` `,e.agentType,` `]})]})}),!tt(e)&&(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(c,{children:(0,k.jsxs)(l,{children:[(0,k.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,k.jsx)(c,{marginLeft:2,marginRight:2,children:(0,k.jsx)(ze,{children:e.getSystemPrompt()})})]})]})}var k,An=e((()=>{i(),p(),m(),E(),fe(),Ee(),Se(),Ze(),xe(),Je(),On(),k=_()}));function jn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,Mn.useState)(Math.max(0,Nn.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:Nn.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<Nn.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=Nn[r];n(t===`automatic`?void 0:t)}},s=Nn[r];return(0,A.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,A.jsx)(c,{flexDirection:`column`,children:Nn.map((e,t)=>{let n=t===r;return(0,A.jsxs)(c,{flexDirection:`row`,gap:1,children:[(0,A.jsx)(l,{color:n?`suggestion`:void 0,children:n?a.pointer:` `}),e===`automatic`?(0,A.jsx)(l,{bold:n,children:`Automatic color`}):(0,A.jsxs)(c,{gap:1,children:[(0,A.jsx)(l,{backgroundColor:ke[e],color:`inverseText`,children:` `}),(0,A.jsx)(l,{bold:n,children:Ut(e)})]})]},e)})}),(0,A.jsxs)(c,{marginTop:1,children:[(0,A.jsx)(l,{children:`Preview: `}),s===void 0||s===`automatic`?(0,A.jsxs)(l,{inverse:!0,bold:!0,children:[` `,`@`,e,` `]}):(0,A.jsxs)(l,{backgroundColor:ke[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var Mn,A,Nn,Pn=e((()=>{i(),Mn=t(p(),1),m(),fe(),Wt(),A=_(),Nn=[`automatic`,...Te]}));function Fn({initialModel:e,onComplete:t,onCancel:n}){let r=In.useMemo(()=>{let t=he();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,Ln.jsxs)(c,{flexDirection:`column`,children:[(0,Ln.jsx)(c,{marginBottom:1,children:(0,Ln.jsx)(l,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,Ln.jsx)(We,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var In,Ln,Rn=e((()=>{In=t(p(),1),m(),xe(),Ne(),Ln=_()}));function zn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([He.name,st.name,ie.name,_e.name,nt.name,v.name,mt.name,at.name,Ge.name])},EDIT:{name:`Edit tools`,toolNames:new Set([Ce.name,ee.name,Ve.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([ot.name,process.env.USER_TYPE===`ant`?Yt.name:void 0].filter(e=>e!==void 0))},MCP:{name:`MCP tools`,toolNames:new Set,isMcp:!0},OTHER:{name:`Other tools`,toolNames:new Set}}}function Bn(e){let t=new Map;return e.forEach(e=>{if(Pe(e)){let n=Tt(e.name);if(n?.serverName){let r=t.get(n.serverName)||[];r.push(e),t.set(n.serverName,r)}}}),Array.from(t.entries()).map(([e,t])=>({serverName:e,tools:t})).sort((e,t)=>e.serverName.localeCompare(t.serverName))}function Vn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,j.useMemo)(()=>dt({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[s,u]=(0,j.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[f,p]=(0,j.useState)(0),[m,h]=(0,j.useState)(!1),g=(0,j.useMemo)(()=>{let e=new Set(i.map(e=>e.name));return s.filter(t=>e.has(t))},[s,i]),_=new Set(g),v=g.length===i.length&&i.length>0,y=e=>{e&&u(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},b=(e,t)=>{u(n=>{if(t){let t=e.filter(e=>!n.includes(e));return[...n,...t]}else return n.filter(t=>!e.includes(t))})},ee=()=>{let e=i.map(e=>e.name);n(g.length===e.length&&e.every(e=>g.includes(e))?void 0:g)},x=(0,j.useMemo)(()=>{let e=zn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{Pe(n)?t.mcp.push(n):e.READ_ONLY.toolNames.has(n.name)?t.readOnly.push(n):e.EDIT.toolNames.has(n.name)?t.edit.push(n):e.EXECUTION.toolNames.has(n.name)?t.execution.push(n):n.name!==`Agent`&&t.other.push(n)}),t},[i]),te=e=>{let t=Mt(e,e=>_.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);b(n,t)}},S=[];S.push({id:`continue`,label:`Continue`,action:ee,isContinue:!0}),S.push({id:`bucket-all`,label:`${v?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);b(e,!v)}});let C=zn();[{id:`bucket-readonly`,name:C.READ_ONLY.name,tools:x.readOnly},{id:`bucket-edit`,name:C.EDIT.name,tools:x.edit},{id:`bucket-execution`,name:C.EXECUTION.name,tools:x.execution},{id:`bucket-mcp`,name:C.MCP.name,tools:x.mcp},{id:`bucket-other`,name:C.OTHER.name,tools:x.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=Mt(n,e=>_.has(e.name))===n.length;S.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:te(n)})});let ne=S.length;S.push({id:`toggle-individual`,label:m?`Hide advanced options`:`Show advanced options`,action:()=>{h(!m),m&&f>ne&&p(ne)},isToggle:!0});let re=(0,j.useMemo)(()=>Bn(i),[i]);return m&&(re.length>0&&(S.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),re.forEach(({serverName:e,tools:t})=>{let n=Mt(t,e=>_.has(e.name))===t.length;S.push({id:`mcp-server-${e}`,label:`${n?a.checkboxOn:a.checkboxOff} ${e} (${t.length} ${Ht(t.length,`tool`)})`,action:()=>{let e=t.map(e=>e.name);b(e,!n)}})}),S.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=Tt(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}S.push({id:`tool-${e.name}`,label:`${_.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>y(e.name)})})),d(`confirm:no`,(0,j.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,M.jsxs)(c,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=S[f];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=f-1;for(;t>0&&S[t]?.isHeader;)t--;p(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=f+1;for(;t<S.length-1&&S[t]?.isHeader;)t++;p(Math.min(S.length-1,t))}},children:[(0,M.jsxs)(l,{color:f===0?`suggestion`:void 0,bold:f===0,children:[f===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,M.jsx)(o,{width:40}),S.slice(1).map((e,t)=>{let n=t+1===f,r=e.isToggle,i=e.isHeader;return(0,M.jsxs)(j.Fragment,{children:[r&&(0,M.jsx)(o,{width:40}),i&&t>0&&(0,M.jsx)(c,{marginTop:1}),(0,M.jsxs)(l,{color:i?void 0:n?`suggestion`:void 0,dimColor:i,bold:r&&n,children:[i?``:n?`${a.pointer} `:` `,r?`[ ${e.label} ]`:e.label]})]},e.id)}),(0,M.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,M.jsx)(l,{dimColor:!0,children:v?`All tools selected`:`${_.size} of ${i.length} tools selected`})})]})}var j,M,Hn=e((()=>{i(),j=t(p(),1),jt(),ft(),Se(),Ot(),Le(),ue(),S(),be(),ut(),je(),pt(),Xe(),Qe(),me(),y(),Re(),Ie(),Jt(),m(),E(),Nt(),Wt(),M=_()}));function Un(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:ve(wt(e))}var Wn=e((()=>{ne(),At()}));function Gn({agent:e,tools:t,onSaved:n,onBack:r}){let i=pe(),[o,s]=(0,N.useState)(`menu`),[u,f]=(0,N.useState)(0),[p,m]=(0,N.useState)(null),[g,_]=(0,N.useState)(e.color),v=(0,N.useCallback)(async()=>{let t=await ln(bn(e));t.error?m(t.error):n(`Opened ${e.agentType} in editor. If you made edits, restart to load the latest version.`)},[e,n]),y=(0,N.useCallback)(async(t={})=>{let{tools:r,color:a,model:o}=t,s=a??g,c=r!==void 0,l=o!==void 0,u=s!==e.color;if(!c&&!l&&!u)return!1;try{return!Fe(e)&&!qe(e)?!1:(await Tn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&$e(e.agentType,s),i(t=>{let n=t.agentDefinitions.allAgents.map(t=>t.agentType===e.agentType?{...t,tools:r??t.tools,color:s,model:o??t.model}:t);return{...t,agentDefinitions:{...t.agentDefinitions,activeAgents:et(n),allAgents:n}}}),n(`Updated agent: ${h.bold(e.agentType)}`),!0)}catch(e){return m(e instanceof Error?e.message:`Failed to save agent`),!1}},[e,g,n,i]),b=(0,N.useMemo)(()=>[{label:`Open in editor`,action:v},{label:`Edit tools`,action:()=>s(`edit-tools`)},{label:`Edit model`,action:()=>s(`edit-model`)},{label:`Edit color`,action:()=>s(`edit-color`)}],[v]),ee=(0,N.useCallback)(()=>{m(null),o===`menu`?r():s(`menu`)},[o,r]),x=(0,N.useCallback)(e=>{if(e.key===`up`)e.preventDefault(),f(e=>Math.max(0,e-1));else if(e.key===`down`)e.preventDefault(),f(e=>Math.min(b.length-1,e+1));else if(e.key===`return`){e.preventDefault();let t=b[u];t&&t.action()}},[b,u]);d(`confirm:no`,ee,{context:`Confirmation`});let te=()=>(0,P.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:x,children:[(0,P.jsxs)(l,{dimColor:!0,children:[`Source: `,Un(e.source)]}),(0,P.jsx)(c,{marginTop:1,flexDirection:`column`,children:b.map((e,t)=>(0,P.jsxs)(l,{color:t===u?`suggestion`:void 0,children:[t===u?`${a.pointer} `:` `,e.label]},e.label))}),p&&(0,P.jsx)(c,{marginTop:1,children:(0,P.jsx)(l,{color:`error`,children:p})})]});switch(o){case`menu`:return te();case`edit-tools`:return(0,P.jsx)(Vn,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await y({tools:e})}});case`edit-color`:return(0,P.jsx)(jn,{agentName:e.agentType,currentColor:g||e.color||`automatic`,onConfirm:async e=>{_(e),s(`menu`),await y({color:e})}});case`edit-model`:return(0,P.jsx)(Fn,{initialModel:e.model,onComplete:async e=>{s(`menu`),await y({model:e})}});default:return null}}var N,P,Kn=e((()=>{f(),i(),p(),N=t(p(),1),ye(),m(),E(),fe(),Ze(),cn(),On(),Pn(),Rn(),Hn(),Wn(),P=_()}));function qn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=nn();return(0,Jn.jsx)(c,{marginLeft:2,children:(0,Jn.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var Jn,Yn=e((()=>{p(),rn(),m(),Jn=_()}));function Xn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:s}){let[u,d]=Zn.useState(null),[f,p]=Zn.useState(!0),m=Zn.useMemo(()=>[...t].sort(Qt),[t]),h=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),_=()=>(0,F.jsxs)(c,{children:[(0,F.jsx)(l,{color:f?`suggestion`:void 0,children:f?`${a.pointer} `:` `}),(0,F.jsx)(l,{color:f?`suggestion`:void 0,children:`Create new agent`})]}),v=e=>{let t=e.source===`built-in`,n=!t&&!f&&u?.agentType===e.agentType&&u?.source===e.source,{isOverridden:r,overriddenBy:i}=h(e),o=t||r,s=!t&&n?`suggestion`:void 0,d=Xt(e);return(0,F.jsxs)(c,{children:[(0,F.jsx)(l,{dimColor:o&&!n,color:s,children:t?``:n?`${a.pointer} `:` `}),(0,F.jsx)(l,{dimColor:o&&!n,color:s,children:e.agentType}),d&&(0,F.jsxs)(l,{dimColor:!0,color:s,children:[` · `,d]}),e.memory&&(0,F.jsxs)(l,{dimColor:!0,color:s,children:[` · `,e.memory,` memory`]}),i&&(0,F.jsxs)(l,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,en(i)]})]},`${e.agentType}-${e.source}`)},y=Zn.useMemo(()=>{let t=m.filter(e=>e.source!==`built-in`);return e===`all`?tn.filter(e=>e.source!==`built-in`).flatMap(({source:e})=>t.filter(t=>t.source===e)):t},[m,e]);Zn.useEffect(()=>{!u&&!f&&y.length>0&&(i?p(!0):d(y[0]||null))},[y,u,f,i]);let b=e=>{if(e.key===`return`){e.preventDefault(),f&&i?i():u&&r(u);return}if(e.key!==`up`&&e.key!==`down`)return;e.preventDefault();let t=!!i,n=y.length+ +!!t;if(n===0)return;let a=0;if(!f&&u){let e=y.findIndex(e=>e.agentType===u.agentType&&e.source===u.source);e>=0&&(a=t?e+1:e)}let o=e.key===`up`?a===0?n-1:a-1:a===n-1?0:a+1;if(t&&o===0)p(!0),d(null);else{let e=t?o-1:o,n=y[e];n&&(p(!1),d(n))}},ee=(e=`Built-in (always available):`)=>{let t=m.filter(e=>e.source===`built-in`);return(0,F.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,F.jsx)(l,{bold:!0,dimColor:!0,children:e}),t.map(v)]})},x=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,F.jsxs)(c,{flexDirection:`column`,marginBottom:1,children:[(0,F.jsxs)(c,{paddingLeft:2,children:[(0,F.jsx)(l,{bold:!0,dimColor:!0,children:e}),n&&(0,F.jsxs)(l,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>v(e))]})},te=Un(e),S=m.filter(e=>e.source===`built-in`);return!m.length||e!==`built-in`&&!m.some(e=>e.source!==`built-in`)?(0,F.jsx)(g,{title:te,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,F.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,F.jsx)(c,{children:_()}),(0,F.jsx)(l,{dimColor:!0,children:`No agents found. Create specialized subagents that Claude can delegate to.`}),(0,F.jsx)(l,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,F.jsx)(l,{dimColor:!0,children:`Try creating: Code Reviewer, Code Simplifier, Security Reviewer, Tech Lead, or UX Reviewer.`}),e!==`built-in`&&m.some(e=>e.source===`built-in`)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(o,{}),ee()]})]})}):(0,F.jsxs)(g,{title:te,subtitle:`${Mt(m,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[s&&s.length>0&&(0,F.jsx)(c,{marginTop:1,children:(0,F.jsx)(l,{dimColor:!0,children:s[s.length-1]})}),(0,F.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,F.jsx)(c,{marginBottom:1,children:_()}),e===`all`?(0,F.jsxs)(F.Fragment,{children:[tn.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,F.jsx)(Zn.Fragment,{children:x(e,m.filter(e=>e.source===t))},t)),S.length>0&&(0,F.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,F.jsxs)(l,{dimColor:!0,children:[(0,F.jsx)(l,{bold:!0,children:`Built-in agents`}),` (always available)`]}),S.map(v)]})]}):e===`built-in`?(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(l,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,F.jsx)(c,{marginTop:1,flexDirection:`column`,children:m.map(e=>v(e))})]}):(0,F.jsxs)(F.Fragment,{children:[m.filter(e=>e.source!==`built-in`).map(e=>v(e)),m.some(e=>e.source===`built-in`)&&(0,F.jsxs)(F.Fragment,{children:[(0,F.jsx)(o,{}),ee()]})]})]})]})}var Zn,F,Qn=e((()=>{i(),Zn=t(p(),1),m(),Zt(),Nt(),Wn(),F=_()}));function $n({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,I.useState)(0),[l,u]=(0,I.useState)(t),[d,f]=(0,I.useState)(!1),[p,m]=(0,I.useState)([]);nn(),(0,I.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,I.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,I.useCallback)(()=>{if(p.length>0){let e=p[p.length-1];e!==void 0&&(m(e=>e.slice(0,-1)),c(e))}else s>0?c(e=>e-1):r&&r()},[s,p,r]),_=(0,I.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,I.useCallback)(()=>{m([]),r&&r()},[r]),y=(0,I.useCallback)(e=>{u(t=>({...t,...e}))},[]),b=(0,I.useMemo)(()=>({currentStepIndex:s,totalSteps:e.length,wizardData:l,setWizardData:u,updateWizardData:y,goNext:h,goBack:g,goToStep:_,cancel:v,title:a,showStepCounter:o}),[s,e.length,l,y,h,g,_,v,a,o]),ee=e[s];return!ee||d?null:(0,er.jsx)(tr.Provider,{value:b,children:i||(0,er.jsx)(ee,{})})}var I,er,tr,nr=e((()=>{I=t(p(),1),rn(),er=_(),tr=(0,I.createContext)(null)}));function L(){let e=(0,rr.useContext)(tr);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var rr,ir=e((()=>{rr=t(p(),1),nr()}));function ar({instructions:e=(0,or.jsxs)(u,{children:[(0,or.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,or.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,or.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=nn();return(0,or.jsx)(c,{marginLeft:3,marginTop:1,children:(0,or.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var or,sr=e((()=>{rn(),m(),T(),or=_()}));function R({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=L();return(0,cr.jsxs)(cr.Fragment,{children:[(0,cr.jsx)(g,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,cr.jsx)(ar,{instructions:i})]})}var cr,z=e((()=>{m(),ir(),sr(),cr=_()})),B=e((()=>{ir(),z(),sr(),nr()}));function lr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=L();return d(`confirm:no`,t,{context:`Confirmation`}),(0,V.jsx)(R,{subtitle:`Choose background color`,footerText:(0,V.jsxs)(u,{children:[(0,V.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,V.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,V.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,V.jsx)(c,{children:(0,V.jsx)(jn,{agentName:r.agentType||`agent`,currentColor:`automatic`,onConfirm:t=>{n({selectedColor:t,finalAgent:{agentType:r.agentType,whenToUse:r.whenToUse,getSystemPrompt:()=>r.systemPrompt,tools:r.selectedTools,...r.selectedModel?{model:r.selectedModel}:{},...t?{color:t}:{},source:r.location}}),e()}})})})}var V,ur=e((()=>{m(),E(),T(),B(),z(),Pn(),V=_()}));function dr(e){return e?/^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$/.test(e)?e.length<3?`Agent type must be at least 3 characters long`:e.length>50?`Agent type must be less than 50 characters`:null:`Agent type must start and end with alphanumeric characters and contain only letters, numbers, and hyphens`:`Agent type is required`}function fr(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=dr(e.agentType);t&&r.push(t);let i=n.find(t=>t.agentType===e.agentType&&t.source!==e.source);i&&r.push(`Agent type "${e.agentType}" already exists in ${Un(i.source)}`)}if(e.whenToUse?e.whenToUse.length<10?i.push(`Description should be more descriptive (at least 10 characters)`):e.whenToUse.length>5e3&&i.push(`Description is very long (over 5000 characters)`):r.push(`Description (description) is required`),e.tools!==void 0&&!Array.isArray(e.tools))r.push(`Tools must be an array`);else{e.tools===void 0?i.push(`Agent has access to all tools`):e.tools.length===0&&i.push(`No tools selected - agent will have very limited capabilities`);let n=x(e,t,!1);n.invalidTools.length>0&&r.push(`Invalid tools: ${n.invalidTools.join(`, `)}`)}let a=e.getSystemPrompt();return a?a.length<20?r.push(`System prompt is too short (minimum 20 characters)`):a.length>1e4&&i.push(`System prompt is very long (over 10,000 characters)`):r.push(`System prompt is required`),{isValid:r.length===0,errors:r,warnings:i}}var pr=e((()=>{Se(),Wn()}));function mr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=L();d(`confirm:no`,a,{context:`Confirmation`});let f=e=>{e.key===`s`||e.key===`return`?(e.preventDefault(),n()):e.key===`e`&&(e.preventDefault(),r())},p=o.finalAgent,m=fr(p,e,t),h=Bt(p.getSystemPrompt(),240),g=Bt(p.whenToUse,240),_=e=>e===void 0?`All tools`:e.length===0?`None`:e.length===1?e[0]||`None`:e.length===2?e.join(` and `):`${e.slice(0,-1).join(`, `)}, and ${e[e.length-1]}`,v=Pt()?(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`Memory`}),`: `,ce(p.memory)]}):null;return(0,H.jsx)(R,{subtitle:`Confirm and save`,footerText:(0,H.jsxs)(u,{children:[(0,H.jsx)(s,{shortcut:`s/Enter`,action:`save`}),(0,H.jsx)(s,{shortcut:`e`,action:`edit in your editor`}),(0,H.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,H.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`Name`}),`: `,p.agentType]}),(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`Location`}),`:`,` `,xn({source:o.location,agentType:p.agentType})]}),(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`Tools`}),`: `,_(p.tools)]}),(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`Model`}),`: `,Ke(p.model)]}),v,(0,H.jsx)(c,{marginTop:1,children:(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]})}),(0,H.jsx)(c,{marginLeft:2,marginTop:1,children:(0,H.jsx)(l,{children:g})}),(0,H.jsx)(c,{marginTop:1,children:(0,H.jsxs)(l,{children:[(0,H.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,H.jsx)(c,{marginLeft:2,marginTop:1,children:(0,H.jsx)(l,{children:h})}),m.warnings.length>0&&(0,H.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,H.jsx)(l,{color:`warning`,children:`Warnings:`}),m.warnings.map((e,t)=>(0,H.jsxs)(l,{dimColor:!0,children:[` `,`• `,e]},t))]}),m.errors.length>0&&(0,H.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,H.jsx)(l,{color:`error`,children:`Errors:`}),m.errors.map((e,t)=>(0,H.jsxs)(l,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,H.jsx)(c,{marginTop:1,children:(0,H.jsx)(l,{color:`error`,children:i})}),(0,H.jsx)(c,{marginTop:2,children:(0,H.jsxs)(l,{color:`success`,children:[`Press `,(0,H.jsx)(l,{bold:!0,children:`s`}),` or `,(0,H.jsx)(l,{bold:!0,children:`Enter`}),` to save, `,(0,H.jsx)(l,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var H,hr=e((()=>{m(),E(),Ft(),Ee(),Vt(),xe(),T(),B(),z(),On(),pr(),H=_()}));function gr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=L(),[i,a]=(0,_r.useState)(null),o=pe(),s=(0,_r.useCallback)(async e=>{if(r?.finalAgent)try{await wn(r.location,r.finalAgent.agentType,r.finalAgent.whenToUse,r.finalAgent.tools,r.finalAgent.getSystemPrompt(),!0,r.finalAgent.color,r.finalAgent.model,r.finalAgent.memory),o(e=>{if(!r.finalAgent)return e;let t=e.agentDefinitions.allAgents.concat(r.finalAgent);return{...e,agentDefinitions:{...e.agentDefinitions,activeAgents:et(t),allAgents:t}}}),it(),e&&await ln(yn({source:r.location,agentType:r.finalAgent.agentType})),zt(`tengu_agent_created`,{agent_type:r.finalAgent.agentType,generation_method:r.wasGenerated?`generated`:`manual`,source:r.location,tool_count:r.finalAgent.tools?.length??`all`,has_custom_model:!!r.finalAgent.model,has_custom_color:!!r.finalAgent.color,has_memory:!!r.finalAgent.memory,memory_scope:r.finalAgent.memory??`none`,...e?{opened_in_editor:!0}:{}}),n(e?`Created agent: ${h.bold(r.finalAgent.agentType)} and opened in editor. If you made edits, restart to load the latest version.`:`Created agent: ${h.bold(r.finalAgent.agentType)}`)}catch(e){a(e instanceof Error?e.message:`Failed to save agent`)}},[r,n,o]);return(0,vr.jsx)(mr,{tools:e,existingAgents:t,onSave:(0,_r.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,_r.useCallback)(()=>s(!0),[s]),error:i})}var _r,vr,yr=e((()=>{f(),_r=t(p(),1),Rt(),ye(),Ze(),cn(),B(),On(),hr(),vr=_()}));function br(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=L(),[i,a]=(0,xr.useState)(r.whenToUse||``),[o,f]=(0,xr.useState)(i.length),[p,m]=(0,xr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,xr.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,U.jsx)(R,{subtitle:`Description (tell Claude when to use this agent)`,footerText:(0,U.jsxs)(u,{children:[(0,U.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,U.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,U.jsx)(w,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,U.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,U.jsxs)(c,{flexDirection:`column`,children:[(0,U.jsx)(l,{children:`When should Claude use this agent?`}),(0,U.jsx)(c,{marginTop:1,children:(0,U.jsx)(we,{value:i,onChange:a,onSubmit:t=>{let r=t.trim();if(!r){m(`Description is required`);return}m(null),n({whenToUse:r}),e()},placeholder:`e.g., use this agent after you're done writing code...`,columns:80,cursorOffset:o,onChangeCursorOffset:f,focus:!0,showCursor:!0})}),p&&(0,U.jsx)(c,{marginTop:1,children:(0,U.jsx)(l,{color:`error`,children:p})})]})})}var xr,U,Sr=e((()=>{xr=t(p(),1),m(),E(),cn(),T(),C(),B(),z(),U=_()}));async function Cr(e,t,n,r){let i=Ue({content:`Create an agent configuration based on this request: "${e}".${n.length>0?`\n\nIMPORTANT: The following identifiers already exist and must NOT be used: ${n.join(`, `)}`:``}
8
+ Return ONLY the JSON object, no other text.`}),a=await b(),o=rt([i],a),s=Pt()?wr+Tr:wr,c=await Ye({messages:Oe(o),systemPrompt:qt([s]),thinkingConfig:{type:`disabled`},tools:[],signal:r,options:{getToolPermissionContext:async()=>Kt(),model:t,toolChoice:void 0,agents:[],isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,querySource:`agent_creation`,mcpTools:[]}}),l=(Array.isArray(c.message.content)?c.message.content:[]).filter(e=>e.type===`text`).map(e=>e.text).join(`
9
+ `),u;try{u=_t(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=_t(e[0])}if(!u.identifier||!u.whenToUse||!u.systemPrompt)throw Error(`Invalid agent configuration generated`);return zt(`tengu_agent_definition_generated`,{agent_identifier:u.identifier}),{identifier:u.identifier,whenToUse:u.whenToUse,systemPrompt:u.systemPrompt}}var wr,Tr,Er=e((()=>{ct(),Be(),Gt(),Ot(),Me(),ge(),Ft(),Rt(),xt(),se(),wr=`You are an elite AI agent architect specializing in crafting high-performance agent configurations. Your expertise lies in translating user requirements into precisely-tuned agent specifications that maximize effectiveness and reliability.
10
+
11
+ **Important Context**: You may have access to project-specific instructions from CLAUDE.md files and other context that may include coding standards, project structure, and custom requirements. Consider this context when creating agents to ensure they align with the project's established patterns and practices.
12
+
13
+ When a user describes what they want an agent to do, you will:
14
+
15
+ 1. **Extract Core Intent**: Identify the fundamental purpose, key responsibilities, and success criteria for the agent. Look for both explicit requirements and implicit needs. Consider any project-specific context from CLAUDE.md files. For agents that are meant to review code, you should assume that the user is asking to review recently written code and not the whole codebase, unless the user has explicitly instructed you otherwise.
16
+
17
+ 2. **Design Expert Persona**: Create a compelling expert identity that embodies deep domain knowledge relevant to the task. The persona should inspire confidence and guide the agent's decision-making approach.
18
+
19
+ 3. **Architect Comprehensive Instructions**: Develop a system prompt that:
20
+ - Establishes clear behavioral boundaries and operational parameters
21
+ - Provides specific methodologies and best practices for task execution
22
+ - Anticipates edge cases and provides guidance for handling them
23
+ - Incorporates any specific requirements or preferences mentioned by the user
24
+ - Defines output format expectations when relevant
25
+ - Aligns with project-specific coding standards and patterns from CLAUDE.md
26
+
27
+ 4. **Optimize for Performance**: Include:
28
+ - Decision-making frameworks appropriate to the domain
29
+ - Quality control mechanisms and self-verification steps
30
+ - Efficient workflow patterns
31
+ - Clear escalation or fallback strategies
32
+
33
+ 5. **Create Identifier**: Design a concise, descriptive identifier that:
34
+ - Uses lowercase letters, numbers, and hyphens only
35
+ - Is typically 2-4 words joined by hyphens
36
+ - Clearly indicates the agent's primary function
37
+ - Is memorable and easy to type
38
+ - Avoids generic terms like "helper" or "assistant"
39
+
40
+ 6 **Example agent descriptions**:
41
+ - in the 'whenToUse' field of the JSON object, you should include examples of when this agent should be used.
42
+ - examples should be of the form:
43
+ - <example>
44
+ Context: The user is creating a test-runner agent that should be called after a logical chunk of code is written.
45
+ user: "Please write a function that checks if a number is prime"
46
+ assistant: "Here is the relevant function: "
47
+ <function call omitted for brevity only for this example>
48
+ <commentary>
49
+ Since a significant piece of code was written, use the ${Dt} tool to launch the test-runner agent to run the tests.
50
+ </commentary>
51
+ assistant: "Now let me use the test-runner agent to run the tests"
52
+ </example>
53
+ - <example>
54
+ Context: User is creating an agent to respond to the word "hello" with a friendly jok.
55
+ user: "Hello"
56
+ assistant: "I'm going to use the ${Dt} tool to launch the greeting-responder agent to respond with a friendly joke"
57
+ <commentary>
58
+ Since the user is greeting, use the greeting-responder agent to respond with a friendly joke.
59
+ </commentary>
60
+ </example>
61
+ - If the user mentioned or implied that the agent should be used proactively, you should include examples of this.
62
+ - NOTE: Ensure that in the examples, you are making the assistant use the Agent tool and not simply respond directly to the task.
63
+
64
+ Your output must be a valid JSON object with exactly these fields:
65
+ {
66
+ "identifier": "A unique, descriptive identifier using lowercase letters, numbers, and hyphens (e.g., 'test-runner', 'api-docs-writer', 'code-formatter')",
67
+ "whenToUse": "A precise, actionable description starting with 'Use this agent when...' that clearly defines the triggering conditions and use cases. Ensure you include examples as described above.",
68
+ "systemPrompt": "The complete system prompt that will govern the agent's behavior, written in second person ('You are...', 'You will...') and structured for maximum clarity and effectiveness"
69
+ }
70
+
71
+ Key principles for your system prompts:
72
+ - Be specific rather than generic - avoid vague instructions
73
+ - Include concrete examples when they would clarify behavior
74
+ - Balance comprehensiveness with clarity - every instruction should add value
75
+ - Ensure the agent has enough context to handle variations of the core task
76
+ - Make the agent proactive in seeking clarification when needed
77
+ - Build in quality assurance and self-correction mechanisms
78
+
79
+ Remember: The agents you create should be autonomous experts capable of handling their designated tasks with minimal additional guidance. Your system prompts are their complete operational manual.
80
+ `,Tr=`
81
+
82
+ 7. **Agent Memory Instructions**: If the user mentions "memory", "remember", "learn", "persist", or similar concepts, OR if the agent would benefit from building up knowledge across conversations (e.g., code reviewers learning patterns, architects learning codebase structure, etc.), include domain-specific memory update instructions in the systemPrompt.
83
+
84
+ Add a section like this to the systemPrompt, tailored to the agent's specific domain:
85
+
86
+ "**Update your agent memory** as you discover [domain-specific items]. This builds up institutional knowledge across conversations. Write concise notes about what you found and where.
87
+
88
+ Examples of what to record:
89
+ - [domain-specific item 1]
90
+ - [domain-specific item 2]
91
+ - [domain-specific item 3]"
92
+
93
+ Examples of domain-specific memory instructions:
94
+ - For a code-reviewer: "Update your agent memory as you discover code patterns, style conventions, common issues, and architectural decisions in this codebase."
95
+ - For a test-runner: "Update your agent memory as you discover test patterns, common failure modes, flaky tests, and testing best practices."
96
+ - For an architect: "Update your agent memory as you discover codepaths, library locations, key architectural decisions, and component relationships."
97
+ - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
98
+
99
+ The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
100
+ `}));function Dr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=L(),[i,a]=(0,W.useState)(r.generationPrompt||``),[o,s]=(0,W.useState)(!1),[f,p]=(0,W.useState)(null),[m,h]=(0,W.useState)(i.length),g=un(),_=(0,W.useRef)(null);d(`confirm:no`,(0,W.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,s(!1),p(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),d(`chat:externalEditor`,(0,W.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),h(e.content.length))},[i]),{context:`Chat`,isActive:!o}),d(`confirm:no`,(0,W.useCallback)(()=>{e({generationPrompt:``,agentType:``,systemPrompt:``,whenToUse:``,generatedAgent:void 0,wasGenerated:!1}),a(``),p(null),t()},[e,t]),{context:`Settings`,isActive:!o});let v=async()=>{let t=i.trim();if(!t){p(`Please describe what the agent should do`);return}p(null),s(!0),e({generationPrompt:t,isGenerating:!0});let r=ae();_.current=r;try{let i=await Cr(t,g,[],r.signal);e({agentType:i.identifier,whenToUse:i.whenToUse,systemPrompt:i.systemPrompt,generatedAgent:i,isGenerating:!1,wasGenerated:!0}),n(6)}catch(t){t instanceof bt||t instanceof Error&&!t.message.includes(`No assistant message found`)&&p(t.message||`Failed to generate agent`),e({isGenerating:!1})}finally{s(!1),_.current=null}},y=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,G.jsx)(R,{subtitle:y,footerText:(0,G.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,G.jsxs)(c,{flexDirection:`row`,alignItems:`center`,children:[(0,G.jsx)(lt,{}),(0,G.jsx)(l,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,G.jsx)(R,{subtitle:y,footerText:(0,G.jsxs)(u,{children:[(0,G.jsx)(w,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,G.jsx)(w,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,G.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsxs)(c,{flexDirection:`column`,children:[f&&(0,G.jsx)(c,{marginBottom:1,children:(0,G.jsx)(l,{color:`error`,children:f})}),(0,G.jsx)(we,{value:i,onChange:a,onSubmit:v,placeholder:`e.g., Help me write unit tests for my code...`,columns:80,cursorOffset:m,onChangeCursorOffset:h,focus:!0,showCursor:!0})]})})}var W,G,Or=e((()=>{vt(),W=t(p(),1),dn(),m(),E(),de(),cn(),T(),te(),C(),B(),z(),Er(),G=_()}));function kr(){let{goNext:e,updateWizardData:t,cancel:n}=L();return(0,K.jsx)(R,{subtitle:`Choose location`,footerText:(0,K.jsxs)(u,{children:[(0,K.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,K.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,K.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,K.jsx)(c,{children:(0,K.jsx)(We,{options:[{label:`Project (.claude/agents/)`,value:`projectSettings`},{label:`Personal (~/.claude/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var K,Ar=e((()=>{m(),T(),Ne(),B(),z(),K=_()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=L();d(`confirm:no`,t,{context:`Confirmation`});let i=r.location===`userSettings`?[{label:`User scope (~/.claude/agent-memory/) (Recommended)`,value:`user`},{label:`None (no persistent memory)`,value:`none`},{label:`Project scope (.claude/agent-memory/)`,value:`project`},{label:`Local scope (.claude/agent-memory-local/)`,value:`local`}]:[{label:`Project scope (.claude/agent-memory/) (Recommended)`,value:`project`},{label:`None (no persistent memory)`,value:`none`},{label:`User scope (~/.claude/agent-memory/)`,value:`user`},{label:`Local scope (.claude/agent-memory-local/)`,value:`local`}];return(0,q.jsx)(R,{subtitle:`Configure agent memory`,footerText:(0,q.jsxs)(u,{children:[(0,q.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,q.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,q.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsx)(c,{children:(0,q.jsx)(We,{options:i,onChange:t=>{let i=t===`none`?void 0:t,a=r.finalAgent?.agentType;n({selectedMemory:i,finalAgent:r.finalAgent?{...r.finalAgent,memory:i,getSystemPrompt:Pt()&&i&&a?()=>r.systemPrompt+`
101
+
102
+ `+Ae(a,i):()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var q,Mr=e((()=>{m(),E(),Ft(),Ee(),T(),Ne(),B(),z(),q=_()}));function Nr(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=L();return(0,J.jsx)(R,{subtitle:`Creation method`,footerText:(0,J.jsxs)(u,{children:[(0,J.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,J.jsx)(c,{children:(0,J.jsx)(We,{options:[{label:`Generate with Claude (recommended)`,value:`generate`},{label:`Manual configuration`,value:`manual`}],onChange:t=>{let i=t;n({method:i,wasGenerated:i===`generate`}),i===`generate`?e():r(3)},onCancel:()=>t()},`method-select`)})})}var J,Pr=e((()=>{m(),T(),Ne(),B(),z(),J=_()}));function Fr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=L();return(0,Y.jsx)(R,{subtitle:`Select model`,footerText:(0,Y.jsxs)(u,{children:[(0,Y.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsx)(Fn,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Y,Ir=e((()=>{T(),m(),B(),z(),Rn(),Y=_()}));function Lr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=L(),[i,a]=(0,Rr.useState)(r.systemPrompt||``),[o,f]=(0,Rr.useState)(i.length),[p,m]=(0,Rr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,Rr.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,X.jsx)(R,{subtitle:`System prompt`,footerText:(0,X.jsxs)(u,{children:[(0,X.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,X.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,X.jsx)(w,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,X.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsxs)(c,{flexDirection:`column`,children:[(0,X.jsx)(l,{children:`Enter the system prompt for your agent:`}),(0,X.jsx)(l,{dimColor:!0,children:`Be comprehensive for best results`}),(0,X.jsx)(c,{marginTop:1,children:(0,X.jsx)(we,{value:i,onChange:a,onSubmit:()=>{let t=i.trim();if(!t){m(`System prompt is required`);return}m(null),n({systemPrompt:t}),e()},placeholder:`You are a helpful code reviewer who...`,columns:80,cursorOffset:o,onChangeCursorOffset:f,focus:!0,showCursor:!0})}),p&&(0,X.jsx)(c,{marginTop:1,children:(0,X.jsx)(l,{color:`error`,children:p})})]})})}var Rr,X,zr=e((()=>{Rr=t(p(),1),m(),E(),cn(),T(),C(),B(),z(),X=_()}));function Br({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=L(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Z.jsx)(R,{subtitle:`Select tools`,footerText:(0,Z.jsxs)(u,{children:[(0,Z.jsx)(s,{shortcut:`Enter`,action:`toggle selection`}),(0,Z.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Z.jsx)(w,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsx)(Vn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Z,Vr=e((()=>{m(),T(),B(),z(),Hn(),Z=_()}));function Hr(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=L(),[a,o]=(0,Ur.useState)(i.agentType||``),[f,p]=(0,Ur.useState)(null),[m,h]=(0,Ur.useState)(a.length);return d(`confirm:no`,n,{context:`Settings`}),(0,Q.jsx)(R,{subtitle:`Agent type (identifier)`,footerText:(0,Q.jsxs)(u,{children:[(0,Q.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,Q.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,Q.jsx)(w,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Q.jsxs)(c,{flexDirection:`column`,children:[(0,Q.jsx)(l,{children:`Enter a unique identifier for your agent:`}),(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(we,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=dr(n);if(i){p(i);return}p(null),r({agentType:n}),t()},placeholder:`e.g., test-runner, tech-lead, etc`,columns:60,cursorOffset:m,onChangeCursorOffset:h,focus:!0,showCursor:!0})}),f&&(0,Q.jsx)(c,{marginTop:1,children:(0,Q.jsx)(l,{color:`error`,children:f})})]})})}var Ur,Q,Wr=e((()=>{Ur=t(p(),1),m(),E(),T(),C(),B(),z(),pr(),Q=_()}));function Gr({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Kr.jsx)($n,{steps:[kr,Nr,Dr,()=>(0,Kr.jsx)(Hr,{existingAgents:t}),Lr,br,()=>(0,Kr.jsx)(Br,{tools:e}),Fr,lr,...Pt()?[jr]:[],()=>(0,Kr.jsx)(gr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Kr,qr=e((()=>{Ft(),B(),ur(),yr(),Sr(),Or(),Ar(),Mr(),Pr(),Ir(),zr(),Vr(),Wr(),Kr=_()}));function Jr({tools:e,onExit:t}){let[n,r]=(0,Yr.useState)({mode:`list-agents`,source:`all`}),i=re(e=>e.agentDefinitions),a=re(e=>e.mcp.tools),o=re(e=>e.toolPermissionContext),s=pe(),{allAgents:u,activeAgents:d}=i,[f,p]=(0,Yr.useState)([]),m=an(e,a,o);nn();let _=(0,Yr.useMemo)(()=>({"built-in":u.filter(e=>e.source===`built-in`),userSettings:u.filter(e=>e.source===`userSettings`),projectSettings:u.filter(e=>e.source===`projectSettings`),policySettings:u.filter(e=>e.source===`policySettings`),localSettings:u.filter(e=>e.source===`localSettings`),flagSettings:u.filter(e=>e.source===`flagSettings`),plugin:u.filter(e=>e.source===`plugin`),all:u}),[u]),v=(0,Yr.useCallback)(e=>{p(t=>[...t,e]),r({mode:`list-agents`,source:`all`})},[]),y=(0,Yr.useCallback)(async e=>{try{await En(e),s(t=>{let n=t.agentDefinitions.allAgents.filter(t=>!(t.agentType===e.agentType&&t.source===e.source));return{...t,agentDefinitions:{...t.agentDefinitions,allAgents:n,activeAgents:et(n)}}}),p(t=>[...t,`Deleted agent: ${h.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Lt(St(e))}},[s]);switch(n.mode){case`list-agents`:{let e=$t(n.source===`all`?[..._[`built-in`],..._.userSettings,..._.projectSettings,..._.localSettings,..._.policySettings,..._.flagSettings,..._.plugin]:_[n.source],d);return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(Xn,{source:n.source,agents:e,onBack:()=>{t((f.length>0?`Agent changes:\n${f.join(`
103
+ `)}`:void 0)??`Agents dialog dismissed`,{display:f.length===0?`system`:void 0})},onSelect:e=>r({mode:`agent-menu`,agent:e,previousMode:n}),onCreateNew:()=>r({mode:`create-agent`}),changes:f}),(0,$.jsx)(qn,{})]})}case`create-agent`:return(0,$.jsx)(Gr,{tools:m,existingAgents:d,onComplete:v,onCancel:()=>r({mode:`list-agents`,source:`all`})});case`agent-menu`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent,t=[{label:`View agent`,value:`view`},...e.source!==`built-in`&&e.source!==`plugin`&&e.source!==`flagSettings`?[{label:`Edit agent`,value:`edit`},{label:`Delete agent`,value:`delete`}]:[],{label:`Back`,value:`back`}];return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:n.agent.agentType,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsxs)(c,{flexDirection:`column`,children:[(0,$.jsx)(We,{options:t,onChange:t=>{switch(t){case`view`:r({mode:`view-agent`,agent:e,previousMode:n.previousMode});break;case`edit`:r({mode:`edit-agent`,agent:e,previousMode:n});break;case`delete`:r({mode:`delete-confirm`,agent:e,previousMode:n});break;case`back`:r(n.previousMode);break}},onCancel:()=>r(n.previousMode)}),f.length>0&&(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(l,{dimColor:!0,children:f[f.length-1]})})]})}),(0,$.jsx)(qn,{})]})}case`view-agent`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:e.agentType,onCancel:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode}),hideInputGuide:!0,children:(0,$.jsx)(kn,{agent:e,tools:m,allAgents:u,onBack:()=>r({mode:`agent-menu`,agent:e,previousMode:n.previousMode})})}),(0,$.jsx)(qn,{instructions:`Press Enter or Esc to go back`})]})}case`delete-confirm`:return(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(g,{title:`Delete agent`,onCancel:()=>{`previousMode`in n&&r(n.previousMode)},color:`error`,children:[(0,$.jsxs)(l,{children:[`Are you sure you want to delete the agent `,(0,$.jsx)(l,{bold:!0,children:n.agent.agentType}),`?`]}),(0,$.jsx)(c,{marginTop:1,children:(0,$.jsxs)(l,{dimColor:!0,children:[`Source: `,n.agent.source]})}),(0,$.jsx)(c,{marginTop:1,children:(0,$.jsx)(We,{options:[{label:`Yes, delete`,value:`yes`},{label:`No, cancel`,value:`no`}],onChange:e=>{e===`yes`?y(n.agent):`previousMode`in n&&r(n.previousMode)},onCancel:()=>{`previousMode`in n&&r(n.previousMode)}})})]}),(0,$.jsx)(qn,{instructions:`Press ↑↓ to navigate, Enter to select, Esc to cancel`})]});case`edit-agent`:{let e=u.find(e=>e.agentType===n.agent.agentType&&e.source===n.agent.source)||n.agent;return(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(g,{title:`Edit agent: ${e.agentType}`,onCancel:()=>r(n.previousMode),hideInputGuide:!0,children:(0,$.jsx)(Gn,{agent:e,tools:m,onSaved:e=>{v(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(qn,{})]})}default:return null}}var Yr,$,Xr=e((()=>{f(),p(),Yr=t(p(),1),rn(),on(),m(),ye(),Zt(),Ze(),Ct(),It(),Ne(),An(),Kn(),Yn(),Qn(),On(),qr(),$=_()}));async function Zr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Qr.jsx)(Jr,{tools:le(n),onExit:e})}var Qr;e((()=>{p(),Xr(),De(),Qr=_()}))();export{Zr as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A_ as t,M_ as n}from"./loadAgentsDir-x3rlgED4.js";import{g as r,u as i}from"./settings-BeLFUeie.js";function a(){let e=i(),n=[`user`,`project`,`local`].flatMap(e=>t(e).errors);return{settings:e.settings,errors:[...e.errors,...n]}}var o=e((()=>{n(),r()}));export{o as n,a as t};
@@ -1 +1 @@
1
- import{AC as e,CC as t,DC as n,MC as r,OC as i,TC as a}from"./loadAgentsDir-Clu7Uk6a.js";import{s as o,u as s}from"./logoV2Utils-YHBJLIrC.js";i(),s();var c=`default`;async function l(e,n){let r=await t(n.list||c,{subject:e,description:n.description||``,status:`pending`,blocks:[],blockedBy:[]});console.log(`Created task ${r}: ${e}`)}async function u(t){let n=await e(t.list||c);if(t.pending&&(n=n.filter(e=>e.status===`pending`)),t.json){console.log(JSON.stringify(n,null,2));return}if(n.length===0){console.log(`No tasks found.`);return}for(let e of n)console.log(` [${e.status}] ${e.id}: ${e.subject}`),e.description&&console.log(` ${e.description}`),e.owner&&console.log(` owner: ${e.owner}`)}async function d(e,t){let n=await a(t.list||c,e);if(!n){console.error(`Task not found: ${e}`),process.exitCode=1;return}console.log(JSON.stringify(n,null,2))}async function f(e,t){let n=t.list||c,i={};t.status&&(i.status=t.status),t.subject&&(i.subject=t.subject),t.description&&(i.description=t.description),t.owner&&(i.owner=t.owner),t.clearOwner&&(i.owner=void 0);let a=await r(n,e,i);if(!a){console.error(`Task not found: ${e}`),process.exitCode=1;return}console.log(`Updated task ${e}: [${a.status}] ${a.subject}`)}async function p(e){let t=e.list||c;console.log(n(t))}async function m(e){let t=await o();if(e===void 0){if(t.length===0){console.log(`No recent sessions.`);return}for(let e=0;e<Math.min(t.length,20);e++){let n=t[e],r=n.modified?new Date(n.modified).toLocaleString():`unknown`,i=n.title||n.sessionId||`untitled`;console.log(` ${e}: ${i} (${r})`)}return}let n=typeof e==`string`?parseInt(e,10):e,r=Number.isFinite(n)&&n>=0&&n<t.length?t[n]:t.find(t=>t.sessionId===String(e));if(!r){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(JSON.stringify(r,null,2))}async function h(e){let t=await o(),n=e??5;console.log(`Last ${n} sessions:`);for(let e=0;e<Math.min(n,t.length);e++){let n=t[e],r=n.modified?new Date(n.modified).toLocaleString():`unknown`;console.log(` ${e}: ${n.sessionId} (${r})`)}}async function g(e,t,n){let{regenerateCompletionCache:r}=await import(`./completionCache-c4aiyZ_f.js`);t.output,await r(),console.log(`Completion cache regenerated for ${e}.`)}export{g as completionHandler,h as errorHandler,m as logHandler,l as taskCreateHandler,p as taskDirHandler,d as taskGetHandler,u as taskListHandler,f as taskUpdateHandler};
1
+ import{CC as e,gC as t,mC as n,vC as r,xC as i,yC as a}from"./loadAgentsDir-x3rlgED4.js";import{s as o,u as s}from"./logoV2Utils-gGK9gErT.js";a(),s();var c=`default`;async function l(e,t){let r=await n(t.list||c,{subject:e,description:t.description||``,status:`pending`,blocks:[],blockedBy:[]});console.log(`Created task ${r}: ${e}`)}async function u(e){let t=await i(e.list||c);if(e.pending&&(t=t.filter(e=>e.status===`pending`)),e.json){console.log(JSON.stringify(t,null,2));return}if(t.length===0){console.log(`No tasks found.`);return}for(let e of t)console.log(` [${e.status}] ${e.id}: ${e.subject}`),e.description&&console.log(` ${e.description}`),e.owner&&console.log(` owner: ${e.owner}`)}async function d(e,n){let r=await t(n.list||c,e);if(!r){console.error(`Task not found: ${e}`),process.exitCode=1;return}console.log(JSON.stringify(r,null,2))}async function f(t,n){let r=n.list||c,i={};n.status&&(i.status=n.status),n.subject&&(i.subject=n.subject),n.description&&(i.description=n.description),n.owner&&(i.owner=n.owner),n.clearOwner&&(i.owner=void 0);let a=await e(r,t,i);if(!a){console.error(`Task not found: ${t}`),process.exitCode=1;return}console.log(`Updated task ${t}: [${a.status}] ${a.subject}`)}async function p(e){let t=e.list||c;console.log(r(t))}async function m(e){let t=await o();if(e===void 0){if(t.length===0){console.log(`No recent sessions.`);return}for(let e=0;e<Math.min(t.length,20);e++){let n=t[e],r=n.modified?new Date(n.modified).toLocaleString():`unknown`,i=n.title||n.sessionId||`untitled`;console.log(` ${e}: ${i} (${r})`)}return}let n=typeof e==`string`?parseInt(e,10):e,r=Number.isFinite(n)&&n>=0&&n<t.length?t[n]:t.find(t=>t.sessionId===String(e));if(!r){console.error(`Session not found: ${e}`),process.exitCode=1;return}console.log(JSON.stringify(r,null,2))}async function h(e){let t=await o(),n=e??5;console.log(`Last ${n} sessions:`);for(let e=0;e<Math.min(n,t.length);e++){let n=t[e],r=n.modified?new Date(n.modified).toLocaleString():`unknown`;console.log(` ${e}: ${n.sessionId} (${r})`)}}async function g(e,t,n){let{regenerateCompletionCache:r}=await import(`./completionCache-c4aiyZ_f.js`);t.output,await r(),console.log(`Completion cache regenerated for ${e}.`)}export{g as completionHandler,h as errorHandler,m as logHandler,l as taskCreateHandler,p as taskDirHandler,d as taskGetHandler,u as taskListHandler,f as taskUpdateHandler};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-DcIJE_0i.js";import{F as s,S as c,W as l,a as u,l as d,w as f,z as p}from"./debug-BrXObCdR.js";import{c as m,g as h}from"./config-3m_9zSrj.js";import{o as g,s as _}from"./log-BMCygSzM.js";import{l as v,u as y}from"./oauth-BqJqV-2M.js";import{Bt as b,Lr as x,Ot as S,Rr as C,_n as w,vn as T}from"./model-BQF64tZx.js";import{a as E,i as D}from"./detectRepository-BPr0VWNO.js";import{randomUUID as O}from"crypto";function k(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function A(e,n){let r;for(let i=0;i<=V;i++)try{return await t.get(e,n)}catch(e){if(r=e,!k(e))throw e;if(i>=V)throw d(`Teleport request failed after ${i+1} attempts: ${s(e)}`),e;let t=B[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${V+1}), retrying in ${t}ms: ${s(e)}`),await T(t)}throw r}function j(e){return e===null||typeof e==`string`&&e.trim()===``}async function M(){let e=m(),t=process.env.ANTHROPIC_API_KEY?.trim()||e.workspaceApiKey?.trim();if(!t){let t=e.workspaceApiKey,n=j(t)?`Your workspace API key was cleared. `:`A workspace API key (sk-ant-api03-*) is required to use workspace endpoints (/v1/agents, /v1/vaults, /v1/memory_stores, /v1/skills). `;throw Error(n+`Set ANTHROPIC_API_KEY=<key> and restart. Obtain a key from https://console.anthropic.com/settings/keys. Subscription OAuth (claude.ai login) cannot reach these endpoints.`)}if(!t.startsWith(`sk-ant-api03-`))throw Error(`Workspace API key must start with sk-ant-api03-, got prefix "${t.slice(0,4)}...". Obtain a workspace API key from https://console.anthropic.com/settings/keys.`);return{apiKey:t}}async function N(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await x();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function P(){let{accessToken:e,orgUUID:t}=await N(),n=`${v().BASE_API_URL}/v1/sessions`;try{let r=await A(n,{headers:{...F(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=E(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw _(l(e)),e}}function F(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function I(e){let{accessToken:n,orgUUID:r}=await N(),i=`${v().BASE_API_URL}/v1/sessions/${e}`,a={...F(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function L(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function R(e,n,r){try{let{accessToken:i,orgUUID:a}=await N(),o=`${v().BASE_API_URL}/v1/sessions/${e}/events`,s={...F(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},c={events:[{uuid:r?.uuid??O(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let l=await t.post(o,c,{headers:s,validateStatus:e=>e<500,timeout:3e4});return l.status===200||l.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${l.status}: ${f(l.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${s(e)}`),!1}}async function z(e,n){try{let{accessToken:r,orgUUID:i}=await N(),a=`${v().BASE_API_URL}/v1/sessions/${e}`,o={...F(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let s=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return s.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${s.status}: ${f(s.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${s(e)}`),!1}}var B,V,H=e((()=>{n(),y(),C(),a(),b(),h(),u(),D(),p(),o(),g(),w(),c(),B=[2e3,4e3,8e3,16e3],V=B.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{F as a,j as c,R as d,z as f,L as i,N as l,P as n,H as o,I as r,k as s,A as t,M as u};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{i as r,n as i,r as a,t as o}from"./lazySchema-DULtBUCI.js";import{F as s,S as c,W as l,a as u,l as d,w as f,z as p}from"./debug-BrXObCdR.js";import{c as m,g as h}from"./config-DRDuVyzE.js";import{o as g,s as _}from"./log-BMCygSzM.js";import{l as v,u as y}from"./oauth-BqJqV-2M.js";import{Bt as b,Lr as x,Ot as S,Rr as C,_n as w,vn as T}from"./model-CZViyZnE.js";import{a as E,i as D}from"./detectRepository-BPr0VWNO.js";import{randomUUID as O}from"crypto";function k(e){return t.isAxiosError(e)?!e.response||e.response.status>=500:!1}async function A(e,n){let r;for(let i=0;i<=V;i++)try{return await t.get(e,n)}catch(e){if(r=e,!k(e))throw e;if(i>=V)throw d(`Teleport request failed after ${i+1} attempts: ${s(e)}`),e;let t=B[i]??2e3;d(`Teleport request failed (attempt ${i+1}/${V+1}), retrying in ${t}ms: ${s(e)}`),await T(t)}throw r}function j(e){return e===null||typeof e==`string`&&e.trim()===``}async function M(){let e=m(),t=process.env.ANTHROPIC_API_KEY?.trim()||e.workspaceApiKey?.trim();if(!t){let t=e.workspaceApiKey,n=j(t)?`Your workspace API key was cleared. `:`A workspace API key (sk-ant-api03-*) is required to use workspace endpoints (/v1/agents, /v1/vaults, /v1/memory_stores, /v1/skills). `;throw Error(n+`Set ANTHROPIC_API_KEY=<key> and restart. Obtain a key from https://console.anthropic.com/settings/keys. Subscription OAuth (claude.ai login) cannot reach these endpoints.`)}if(!t.startsWith(`sk-ant-api03-`))throw Error(`Workspace API key must start with sk-ant-api03-, got prefix "${t.slice(0,4)}...". Obtain a workspace API key from https://console.anthropic.com/settings/keys.`);return{apiKey:t}}async function N(){let e=S()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient.`);let t=await x();if(!t)throw Error(`Unable to get organization UUID`);return{accessToken:e,orgUUID:t}}async function P(){let{accessToken:e,orgUUID:t}=await N(),n=`${v().BASE_API_URL}/v1/sessions`;try{let r=await A(n,{headers:{...F(e),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":t}});if(r.status!==200)throw Error(`Failed to fetch code sessions: ${r.statusText}`);return r.data.data.map(e=>{let t=e.session_context.sources.find(e=>e.type===`git_repository`),n=null;if(t?.url){let e=E(t.url);if(e){let[r,i]=e.split(`/`);r&&i&&(n={name:i,owner:{login:r},default_branch:t.revision||void 0})}}return{id:e.id,title:e.title||`Untitled`,description:``,status:e.session_status,repo:n,turns:[],created_at:e.created_at,updated_at:e.updated_at}})}catch(e){throw _(l(e)),e}}function F(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":`2023-06-01`}}async function I(e){let{accessToken:n,orgUUID:r}=await N(),i=`${v().BASE_API_URL}/v1/sessions/${e}`,a={...F(n),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":r},o=await t.get(i,{headers:a,timeout:15e3,validateStatus:e=>e<500});if(o.status!==200){let t=o.data?.error?.message;throw o.status===404?Error(`Session not found: ${e}`):o.status===401?Error(`Session expired.`):Error(t||`Failed to fetch session: ${o.status} ${o.statusText}`)}return o.data}function L(e){return(e.session_context.outcomes?.find(e=>e.type===`git_repository`))?.git_info?.branches[0]}async function R(e,n,r){try{let{accessToken:i,orgUUID:a}=await N(),o=`${v().BASE_API_URL}/v1/sessions/${e}/events`,s={...F(i),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":a},c={events:[{uuid:r?.uuid??O(),session_id:e,type:`user`,parent_tool_use_id:null,message:{role:`user`,content:n}}]};d(`[sendEventToRemoteSession] Sending event to session ${e}`);let l=await t.post(o,c,{headers:s,validateStatus:e=>e<500,timeout:3e4});return l.status===200||l.status===201?(d(`[sendEventToRemoteSession] Successfully sent event to session ${e}`),!0):(d(`[sendEventToRemoteSession] Failed with status ${l.status}: ${f(l.data)}`),!1)}catch(e){return d(`[sendEventToRemoteSession] Error: ${s(e)}`),!1}}async function z(e,n){try{let{accessToken:r,orgUUID:i}=await N(),a=`${v().BASE_API_URL}/v1/sessions/${e}`,o={...F(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i};d(`[updateSessionTitle] Updating title for session ${e}: "${n}"`);let s=await t.patch(a,{title:n},{headers:o,validateStatus:e=>e<500});return s.status===200?(d(`[updateSessionTitle] Successfully updated title for session ${e}`),!0):(d(`[updateSessionTitle] Failed with status ${s.status}: ${f(s.data)}`),!1)}catch(e){return d(`[updateSessionTitle] Error: ${s(e)}`),!1}}var B,V,H=e((()=>{n(),y(),C(),a(),b(),h(),u(),D(),p(),o(),g(),w(),c(),B=[2e3,4e3,8e3,16e3],V=B.length,i(()=>r.object({id:r.string(),title:r.string(),description:r.string(),status:r.enum([`idle`,`working`,`waiting`,`completed`,`archived`,`cancelled`,`rejected`]),repo:r.object({name:r.string(),owner:r.object({login:r.string()}),default_branch:r.string().optional()}).nullable(),turns:r.array(r.string()),created_at:r.string(),updated_at:r.string()}))}));export{F as a,j as c,R as d,z as f,L as i,N as l,P as n,H as o,I as r,k as s,A as t,M as u};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n}from"./api-2cdIPaeq.js";n();export{t as fetchCodeSessionsFromSessionsAPI,e as getOAuthHeaders};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,I as r,P as i,_ as a,fi as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{H as u,Pn as d,en as f}from"./state-ix0xIunV.js";import{_x as p,bx as m}from"./loadAgentsDir-Clu7Uk6a.js";import{_ as h,r as g}from"./git-Do0wJvux.js";import{u as _}from"./referral-BlrMpBAV.js";import{t as v}from"./Dialog-vfLXEPed.js";import{t as y}from"./ListItem-vfLXEPed.js";import{i as b,o as x,t as S}from"./cliLaunch-BkPAatcs.js";import{resolve as C}from"path";async function w(){let e=process.cwd();return g(e)||C(e)}function T({defaultDir:e,onInstalled:t,onCancel:o,onError:s}){m(`assistant-install-wizard`);let[l,u]=(0,D.useState)(0),[d,f]=(0,D.useState)(!1);n({"select:next":()=>u(e=>(e+1)%2),"select:previous":()=>u(e=>(e-1+2)%2),"select:accept":()=>{l===0?p():o()}},{context:`Select`});function p(){if(d)return;f(!0);let n=e||C(`.`);try{let e=x(S([`daemon`,`start`,`--dir=${n}`]),{cwd:n,stdio:`ignore`,detached:!0});e.unref(),e.on(`error`,e=>{s(`Failed to start daemon: ${e.message}`)}),setTimeout(()=>{t(n)},1500)}catch(e){s(`Failed to start daemon: ${e instanceof Error?e.message:String(e)}`)}}return d?(0,O.jsx)(c,{title:`Assistant Setup`,onCancel:o,hideInputGuide:!0,children:(0,O.jsxs)(i,{children:[`Starting daemon in `,e,`...`]})}):(0,O.jsx)(c,{title:`Assistant Setup`,onCancel:o,hideInputGuide:!0,children:(0,O.jsxs)(r,{flexDirection:`column`,gap:1,children:[(0,O.jsx)(i,{children:`No active assistant sessions found.`}),(0,O.jsxs)(i,{children:[`Start a daemon in `,(0,O.jsx)(i,{bold:!0,children:e||`.`}),` to create a cloud session?`]}),(0,O.jsxs)(r,{flexDirection:`column`,children:[(0,O.jsx)(a,{isFocused:l===0,children:(0,O.jsx)(i,{children:`Start assistant daemon`})}),(0,O.jsx)(a,{isFocused:l===1,children:(0,O.jsx)(i,{children:`Cancel`})})]}),(0,O.jsx)(i,{dimColor:!0,children:`Enter to select · Esc to cancel`})]})})}async function E(e,t,n){let{setAppState:r,getAppState:i}=t;return u()?(i().assistantPanelVisible?(r(e=>({...e,assistantPanelVisible:!1})),e(`Assistant panel hidden.`,{display:`system`})):(r(e=>({...e,assistantPanelVisible:!0})),e(`Assistant panel opened.`,{display:`system`})),null):(d(!0),r(e=>({...e,kairosEnabled:!0,assistantPanelVisible:!0})),e(`KAIROS assistant mode activated.`,{display:`system`}),null)}var D,O;e((()=>{o(),D=t(o(),1),s(),v(),y(),p(),_(),h(),b(),f(),O=l()}))();export{T as NewInstallWizard,E as call,w as computeDefaultInstallDir};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,I as r,P as i,_ as a,fi as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{H as u,Pn as d,en as f}from"./state-ix0xIunV.js";import{cx as p,dx as m}from"./loadAgentsDir-x3rlgED4.js";import{_ as h,r as g}from"./git-Do0wJvux.js";import{u as _}from"./referral-CKmHHxj_.js";import{t as v}from"./Dialog-vfLXEPed.js";import{t as y}from"./ListItem-vfLXEPed.js";import{i as b,o as x,t as S}from"./cliLaunch-BkPAatcs.js";import{resolve as C}from"path";async function w(){let e=process.cwd();return g(e)||C(e)}function T({defaultDir:e,onInstalled:t,onCancel:o,onError:s}){m(`assistant-install-wizard`);let[l,u]=(0,D.useState)(0),[d,f]=(0,D.useState)(!1);n({"select:next":()=>u(e=>(e+1)%2),"select:previous":()=>u(e=>(e-1+2)%2),"select:accept":()=>{l===0?p():o()}},{context:`Select`});function p(){if(d)return;f(!0);let n=e||C(`.`);try{let e=x(S([`daemon`,`start`,`--dir=${n}`]),{cwd:n,stdio:`ignore`,detached:!0});e.unref(),e.on(`error`,e=>{s(`Failed to start daemon: ${e.message}`)}),setTimeout(()=>{t(n)},1500)}catch(e){s(`Failed to start daemon: ${e instanceof Error?e.message:String(e)}`)}}return d?(0,O.jsx)(c,{title:`Assistant Setup`,onCancel:o,hideInputGuide:!0,children:(0,O.jsxs)(i,{children:[`Starting daemon in `,e,`...`]})}):(0,O.jsx)(c,{title:`Assistant Setup`,onCancel:o,hideInputGuide:!0,children:(0,O.jsxs)(r,{flexDirection:`column`,gap:1,children:[(0,O.jsx)(i,{children:`No active assistant sessions found.`}),(0,O.jsxs)(i,{children:[`Start a daemon in `,(0,O.jsx)(i,{bold:!0,children:e||`.`}),` to create a cloud session?`]}),(0,O.jsxs)(r,{flexDirection:`column`,children:[(0,O.jsx)(a,{isFocused:l===0,children:(0,O.jsx)(i,{children:`Start assistant daemon`})}),(0,O.jsx)(a,{isFocused:l===1,children:(0,O.jsx)(i,{children:`Cancel`})})]}),(0,O.jsx)(i,{dimColor:!0,children:`Enter to select · Esc to cancel`})]})})}async function E(e,t,n){let{setAppState:r,getAppState:i}=t;return u()?(i().assistantPanelVisible?(r(e=>({...e,assistantPanelVisible:!1})),e(`Assistant panel hidden.`,{display:`system`})):(r(e=>({...e,assistantPanelVisible:!0})),e(`Assistant panel opened.`,{display:`system`})),null):(d(!0),r(e=>({...e,kairosEnabled:!0,assistantPanelVisible:!0})),e(`KAIROS assistant mode activated.`,{display:`system`}),null)}var D,O;e((()=>{o(),D=t(o(),1),s(),v(),y(),p(),_(),h(),b(),f(),O=l()}))();export{T as NewInstallWizard,E as call,w as computeDefaultInstallDir};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./auth-DqcKPbw8.js";export{t as authLogin,e as authStatus};
@@ -0,0 +1 @@
1
+ import{Bt as e,It as t,Ot as n,mt as r,yt as i}from"./model-CZViyZnE.js";e();export{r as checkAndRefreshOAuthTokenIfNeeded,i as clearOAuthTokenCache,n as getClaudeAIOAuthTokens,t as handleOAuth401Error};
@@ -1,4 +1,4 @@
1
- import{d as e,o as t}from"./envUtils-DSxRz_kt.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{Ba as o,Va as s}from"./loadAgentsDir-Clu7Uk6a.js";import{F as c,S as l,a as u,l as d,w as f,z as p}from"./debug-BrXObCdR.js";import{g as ee,n as te}from"./settings-Dlp5JTa_.js";import{b as m,c as ne,g as h}from"./config-3m_9zSrj.js";import{o as g,s as _}from"./log-BMCygSzM.js";import{n as v,r as y}from"./analytics-BotDBGh0.js";import{l as b,u as x}from"./oauth-BqJqV-2M.js";import{$n as S,Br as C,Bt as w,Cn as T,Dt as E,En as re,Fr as ie,Ft as ae,Hr as oe,Ir as se,Kr as D,Mr as O,Nr as k,Ot as A,Pr as j,Rr as M,Si as N,Sn as P,St as F,Ur as I,Wr as L,ar as R,fn as z,gn as B,jn as V,jt as H,mn as U,nn as W,or as G,pn as K,qr as ce,rr as le,un as ue,wi as de,yt as q}from"./model-BQF64tZx.js";import{P as fe,W as J}from"./rcDebugLog-VKwMl0yg.js";import{d as pe,u as me}from"./firstPartyEventLogger-BNGPPBNP.js";import{n as he,t as ge}from"./browser-BmZuQom6.js";import{n as _e}from"./trustedDevice-Dn4rXbxT.js";import{a as ve,i as ye,r as be}from"./grove-DrBVaZSN.js";import{t as xe}from"./remoteManagedSettings-jZ6u8ZBT.js";import{d as Se,n as Ce,t as we}from"./status-DyXiBa0m.js";import{createHash as Te,randomBytes as Y}from"crypto";import{createServer as Ee}from"http";ve(),s(),w(),V(),h(),T(),B(),me();async function X(){A.cache?.clear?.(),_e(),re(),U(),pe(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await o()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-CLZttr_u.js`);await t(),await ue(),P().delete(),await X(),m(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),p(),l(),u(),v(),ee(),de(),ce(),M(),fe(),a(),x(),h(),le(),g(),G();async function Oe(){try{if(ne().claudeCodeFirstTokenDate!==void 0)return;let e=S();if(e.error){_(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${b().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":R()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){_(Error(`Received invalid first_token_date from API: ${n}`));return}}m(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){_(e)}}ge(),x(),g();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,y(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=I(e)?b().CLAUDEAI_SUCCESS_URL:b().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,y(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=b().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,y(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){_(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function Z(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ae(){return Z(Y(32))}function je(e){let t=Te(`sha256`);return t.update(e),Z(t.digest())}function Me(){return Z(Y(32))}v(),M(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Ae()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=je(this.codeVerifier),r=Me(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=O({...i,isManual:!0}),o=O({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await he(o))}),c=this.authCodeListener?.hasPendingResponse()??!1;y(`tengu_oauth_auth_code_received`,{automatic:c});try{let e=await j(s,r,this.codeVerifier,this.port,!c,t?.expiresIn),n=await se(e.access_token);if(c){let t=C(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw c&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:C(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};v(),M(),w(),h(),g(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await D(e.accessToken);t?L({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&L({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=z(e);if(q(),n.warning&&y(`tengu_oauth_storage_warning`,{warning:n.warning}),await ie(e.accessToken).catch(e=>d(String(e),{level:`error`})),I(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await k(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await X()}async function Ne({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
1
+ import{d as e,o as t}from"./envUtils-DSxRz_kt.js";import{n,t as r}from"./defineProperty-C-QyHrDq.js";import{n as i,t as a}from"./axios-DaWTGg7G.js";import{Na as o,Pa as s}from"./loadAgentsDir-x3rlgED4.js";import{F as c,S as l,a as u,l as d,w as f,z as p}from"./debug-BrXObCdR.js";import{g as ee,n as te}from"./settings-BeLFUeie.js";import{b as m,c as ne,g as h}from"./config-DRDuVyzE.js";import{o as g,s as _}from"./log-BMCygSzM.js";import{n as v,r as y}from"./analytics-BotDBGh0.js";import{l as b,u as x}from"./oauth-BqJqV-2M.js";import{$n as S,Br as C,Bt as w,Cn as T,Dt as E,En as re,Fr as ie,Ft as ae,Hr as oe,Ir as se,Kr as D,Mr as O,Nr as k,Ot as A,Pr as j,Rr as M,Si as N,Sn as P,St as F,Ur as I,Wr as L,ar as R,fn as z,gn as B,jn as V,jt as H,mn as U,nn as W,or as G,pn as K,qr as ce,rr as le,un as ue,wi as de,yt as q}from"./model-CZViyZnE.js";import{P as fe,W as J}from"./rcDebugLog-DBB9r8aw.js";import{d as pe,u as me}from"./firstPartyEventLogger-BXY1IJ2D.js";import{n as he,t as ge}from"./browser-BmZuQom6.js";import{n as _e}from"./trustedDevice-CKedohmT.js";import{a as ve,i as ye,r as be}from"./grove-BQisE2JM.js";import{t as xe}from"./remoteManagedSettings-bswzAB6W.js";import{d as Se,n as Ce,t as we}from"./status-D4IQpsNK.js";import{createHash as Te,randomBytes as Y}from"crypto";import{createServer as Ee}from"http";ve(),s(),w(),V(),h(),T(),B(),me();async function X(){A.cache?.clear?.(),_e(),re(),U(),pe(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await o()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-Yt31gxWN.js`);await t(),await ue(),P().delete(),await X(),m(t=>{let n={...t};return e&&(n.hasCompletedOnboarding=!1,n.subscriptionNoticeCount=0,n.hasAvailableSubscription=!1,n.customApiKeyResponses?.approved&&(n.customApiKeyResponses={...n.customApiKeyResponses,approved:[]})),n.oauthAccount=void 0,n})}t(),n(),p(),l(),u(),v(),ee(),de(),ce(),M(),fe(),a(),x(),h(),le(),g(),G();async function Oe(){try{if(ne().claudeCodeFirstTokenDate!==void 0)return;let e=S();if(e.error){_(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${b().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":R()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){_(Error(`Received invalid first_token_date from API: ${n}`));return}}m(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){_(e)}}ge(),x(),g();var ke=class{constructor(e=`/callback`){r(this,`localServer`,void 0),r(this,`port`,0),r(this,`promiseResolver`,null),r(this,`promiseRejecter`,null),r(this,`expectedState`,null),r(this,`pendingResponse`,null),r(this,`callbackPath`,void 0),this.localServer=Ee(),this.callbackPath=e}async start(e){return new Promise((t,n)=>{this.localServer.once(`error`,e=>{n(Error(`Failed to start OAuth callback server: ${e.message}`))}),this.localServer.listen(e??0,`localhost`,()=>{let e=this.localServer.address();this.port=e.port,t(this.port)})})}getPort(){return this.port}hasPendingResponse(){return this.pendingResponse!==null}async waitForAuthorization(e,t){return new Promise((n,r)=>{this.promiseResolver=n,this.promiseRejecter=r,this.expectedState=e,this.startLocalListener(t)})}handleSuccessRedirect(e,t){if(!this.pendingResponse)return;if(t){t(this.pendingResponse,e),this.pendingResponse=null,y(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=I(e)?b().CLAUDEAI_SUCCESS_URL:b().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,y(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=b().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,y(`tengu_oauth_automatic_redirect_error`,{})}startLocalListener(e){this.localServer.on(`request`,this.handleRedirect.bind(this)),this.localServer.on(`error`,this.handleError.bind(this)),e()}handleRedirect(e,t){let n=new URL(e.url||``,`http://${e.headers.host||`localhost`}`);if(n.pathname!==this.callbackPath){t.writeHead(404),t.end();return}let r=n.searchParams.get(`code`)??void 0,i=n.searchParams.get(`state`)??void 0;this.validateAndRespond(r,i,t)}validateAndRespond(e,t,n){if(!e){n.writeHead(400),n.end(`Authorization code not found`),this.reject(Error(`No authorization code received`));return}if(t!==this.expectedState){n.writeHead(400),n.end(`Invalid state parameter`),this.reject(Error(`Invalid state parameter`));return}this.pendingResponse=n,this.resolve(e)}handleError(e){_(e),this.close(),this.reject(e)}resolve(e){this.promiseResolver&&(this.promiseResolver(e),this.promiseResolver=null,this.promiseRejecter=null)}reject(e){this.promiseRejecter&&(this.promiseRejecter(e),this.promiseResolver=null,this.promiseRejecter=null)}close(){this.pendingResponse&&this.handleErrorRedirect(),this.localServer&&(this.localServer.removeAllListeners(),this.localServer.close())}};function Z(e){return e.toString(`base64`).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Ae(){return Z(Y(32))}function je(e){let t=Te(`sha256`);return t.update(e),Z(t.digest())}function Me(){return Z(Y(32))}v(),M(),n();var Q=class{constructor(){r(this,`codeVerifier`,void 0),r(this,`authCodeListener`,null),r(this,`port`,null),r(this,`manualAuthCodeResolver`,null),this.codeVerifier=Ae()}async startOAuthFlow(e,t){this.authCodeListener=new ke,this.port=await this.authCodeListener.start();let n=je(this.codeVerifier),r=Me(),i={codeChallenge:n,state:r,port:this.port,loginWithClaudeAi:t?.loginWithClaudeAi,inferenceOnly:t?.inferenceOnly,orgUUID:t?.orgUUID,loginHint:t?.loginHint,loginMethod:t?.loginMethod},a=O({...i,isManual:!0}),o=O({...i,isManual:!1}),s=await this.waitForAuthorizationCode(r,async()=>{t?.skipBrowserOpen?await e(a,o):(await e(a),await he(o))}),c=this.authCodeListener?.hasPendingResponse()??!1;y(`tengu_oauth_auth_code_received`,{automatic:c});try{let e=await j(s,r,this.codeVerifier,this.port,!c,t?.expiresIn),n=await se(e.access_token);if(c){let t=C(e.scope);this.authCodeListener?.handleSuccessRedirect(t)}return this.formatTokens(e,n.subscriptionType,n.rateLimitTier,n.rawProfile)}catch(e){throw c&&this.authCodeListener?.handleErrorRedirect(),e}finally{this.authCodeListener?.close()}}async waitForAuthorizationCode(e,t){return new Promise((n,r)=>{this.manualAuthCodeResolver=n,this.authCodeListener?.waitForAuthorization(e,t).then(e=>{this.manualAuthCodeResolver=null,n(e)}).catch(e=>{this.manualAuthCodeResolver=null,r(e)})})}handleManualAuthCodeInput(e){this.manualAuthCodeResolver&&(this.manualAuthCodeResolver(e.authorizationCode),this.manualAuthCodeResolver=null,this.authCodeListener?.close())}formatTokens(e,t,n,r){return{accessToken:e.access_token,refreshToken:e.refresh_token,expiresAt:Date.now()+e.expires_in*1e3,scopes:C(e.scope),subscriptionType:t,rateLimitTier:n,profile:r,tokenAccount:e.account?{uuid:e.account.uuid,emailAddress:e.account.email_address,organizationUuid:e.organization?.uuid}:void 0}}cleanup(){this.authCodeListener?.close(),this.manualAuthCodeResolver=null}};v(),M(),w(),h(),g(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await D(e.accessToken);t?L({accountUuid:t.account.uuid,emailAddress:t.account.email,organizationUuid:t.organization.uuid,displayName:t.account.display_name||void 0,hasExtraUsageEnabled:t.organization.has_extra_usage_enabled??void 0,billingType:t.organization.billing_type??void 0,subscriptionCreatedAt:t.organization.subscription_created_at??void 0,accountCreatedAt:t.account.created_at}):e.tokenAccount&&L({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=z(e);if(q(),n.warning&&y(`tengu_oauth_storage_warning`,{warning:n.warning}),await ie(e.accessToken).catch(e=>d(String(e),{level:`error`})),I(e.scopes))await Oe().catch(e=>d(String(e),{level:`error`}));else if(!await k(e.accessToken))throw Error(`Unable to create API key. The server accepted the request but did not return a key.`);await X()}async function Ne({email:e,sso:t,console:n,claudeai:r}){n&&r&&(process.stderr.write(`Error: --console and --claudeai cannot be used together.
2
2
  `),process.exit(1));let i=te(),a=i.forceLoginMethod?i.forceLoginMethod===`claudeai`:!n,o=i.forceLoginOrgUUID,s=process.env.CLAUDE_CODE_OAUTH_REFRESH_TOKEN;if(s){let e=process.env.CLAUDE_CODE_OAUTH_SCOPES;e||(process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
3
3
  Set it to the space-separated scopes the refresh token was issued with
4
4
  (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
@@ -1,5 +1,5 @@
1
- import{Fh as e,Mh as t,Nh as n,Ph as r,jh as i}from"./loadAgentsDir-Clu7Uk6a.js";import{F as a,S as o,w as s,z as c}from"./debug-BrXObCdR.js";import{g as l,t as u}from"./settings-Dlp5JTa_.js";import{C as d,_ as f,h as p,u as m}from"./model-BQF64tZx.js";import{n as h,t as g}from"./poorMode-1NLYiS3Y.js";c(),f(),n(),l(),g(),r(),o();function _(e){process.stdout.write(s(e,null,2)+`
2
- `)}function v(){_(t())}function y(){let e=u(),n=t();_({allow:e?.allow?.length?e.allow:n.allow,soft_deny:e?.soft_deny?.length?e.soft_deny:n.soft_deny,environment:e?.environment?.length?e.environment:n.environment})}var b=`You are an expert reviewer of auto mode classifier rules for Work Mate.
1
+ import{Dh as e,Eh as t,Oh as n,Th as r,wh as i}from"./loadAgentsDir-x3rlgED4.js";import{F as a,S as o,w as s,z as c}from"./debug-BrXObCdR.js";import{g as l,t as u}from"./settings-BeLFUeie.js";import{C as d,_ as f,h as p,u as m}from"./model-CZViyZnE.js";import{n as h,t as g}from"./poorMode-CBOtooa0.js";c(),f(),t(),l(),g(),e(),o();function _(e){process.stdout.write(s(e,null,2)+`
2
+ `)}function v(){_(r())}function y(){let e=u(),t=r();_({allow:e?.allow?.length?e.allow:t.allow,soft_deny:e?.soft_deny?.length?e.soft_deny:t.soft_deny,environment:e?.environment?.length?e.environment:t.environment})}var b=`You are an expert reviewer of auto mode classifier rules for Work Mate.
3
3
 
4
4
  Work Mate has an "auto mode" that uses an AI classifier to decide whether tool calls should be auto-approved or require user confirmation. Users can write custom rules in three categories:
5
5
 
@@ -15,13 +15,13 @@ For each rule, evaluate:
15
15
  3. **Conflicts**: Do any of the rules conflict with each other?
16
16
  4. **Actionability**: Is the rule specific enough for the classifier to act on?
17
17
 
18
- Be concise and constructive. Only comment on rules that could be improved. If all rules look good, say so.`;async function x(n){let r=u();if(!((r?.allow?.length??0)>0||(r?.soft_deny?.length??0)>0||(r?.environment?.length??0)>0)){process.stdout.write(`No custom auto mode rules found.
18
+ Be concise and constructive. Only comment on rules that could be improved. If all rules look good, say so.`;async function x(e){let t=u();if(!((t?.allow?.length??0)>0||(t?.soft_deny?.length??0)>0||(t?.environment?.length??0)>0)){process.stdout.write(`No custom auto mode rules found.
19
19
 
20
20
  Add rules to your settings file under autoMode.{allow, soft_deny, environment}.
21
21
  Run \`claude auto-mode defaults\` to see the default rules for reference.
22
- `);return}let o=n.model?d(n.model):h()?p():m(),s=t(),c=i(),l=S(`allow`,r?.allow??[],s.allow)+S(`soft_deny`,r?.soft_deny??[],s.soft_deny)+S(`environment`,r?.environment??[],s.environment);process.stdout.write(`Analyzing your auto mode rules…
22
+ `);return}let o=e.model?d(e.model):h()?p():m(),s=r(),c=i(),l=S(`allow`,t?.allow??[],s.allow)+S(`soft_deny`,t?.soft_deny??[],s.soft_deny)+S(`environment`,t?.environment??[],s.environment);process.stdout.write(`Analyzing your auto mode rules…
23
23
 
24
- `);let f;try{f=await e({querySource:`auto_mode_critique`,model:o,system:b,skipSystemPromptPrefix:!0,max_tokens:4096,messages:[{role:`user`,content:`Here is the full classifier system prompt that the auto mode classifier receives:
24
+ `);let f;try{f=await n({querySource:`auto_mode_critique`,model:o,system:b,skipSystemPromptPrefix:!0,max_tokens:4096,messages:[{role:`user`,content:`Here is the full classifier system prompt that the auto mode classifier receives:
25
25
 
26
26
  <classifier_system_prompt>
27
27
  `+c+`
@@ -1 +1 @@
1
- import{a as e,c as t,i as n,m as r,n as i,o as a,r as o,t as s}from"./autonomy-Cg5zweUa.js";r();export{s as autonomyFlowCancelHandler,i as autonomyFlowHandler,o as autonomyFlowResumeHandler,n as autonomyFlowsHandler,e as autonomyRunsHandler,a as autonomyStatusHandler,t as getAutonomyCommandText};
1
+ import{a as e,c as t,i as n,m as r,n as i,o as a,r as o,t as s}from"./autonomy-Oui8yK8G.js";r();export{s as autonomyFlowCancelHandler,i as autonomyFlowHandler,o as autonomyFlowResumeHandler,n as autonomyFlowsHandler,e as autonomyRunsHandler,a as autonomyStatusHandler,t as getAutonomyCommandText};
@@ -0,0 +1,15 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ot as n}from"./state-ix0xIunV.js";import{AT as r,C as i,E as a,TT as ee,aT as o,ad as te,cT as s,dT as c,fT as l,iT as u,id as d,lT as ne,mT as f,nT as p,oT as m,pT as h,rT as g,rd as _,sT as re,uT as v,x as ie,yT as ae}from"./loadAgentsDir-x3rlgED4.js";import{s as oe,u as se}from"./types-Dut4311z.js";import{a as ce,n as le,o as ue,t as de}from"./bridgeConfig-CE6dMsiJ.js";import{i as y,o as b}from"./bg-WnYN5ifx.js";import{n as x,t as S}from"./state-Cn_m2NOf.js";import{n as C,r as w}from"./pipeTransport-CqCnc-Ys.js";import{join as T}from"path";import"crypto";import{readFile as E,readdir as D}from"fs/promises";function O(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k(e){return typeof e==`string`&&R.includes(e)}function A(e){return typeof e==`string`&&z.includes(e)}function j(e){return!O(e)||typeof e.name!=`string`||!A(e.status)?null:{name:e.name,...typeof e.prompt==`string`?{prompt:e.prompt}:{},status:e.status,...typeof e.startedAt==`number`?{startedAt:e.startedAt}:{},...typeof e.completedAt==`number`?{completedAt:e.completedAt}:{}}}function M(e){if(!O(e)||typeof e.runId!=`string`||typeof e.workflow!=`string`||!k(e.status)||typeof e.createdAt!=`number`||typeof e.updatedAt!=`number`||typeof e.currentStepIndex!=`number`||!Array.isArray(e.steps))return null;let t=e.steps.map(j).filter(e=>e!==null);return t.length===e.steps.length?{runId:e.runId,workflow:e.workflow,...typeof e.args==`string`?{args:e.args}:{},status:e.status,createdAt:e.createdAt,updatedAt:e.updatedAt,currentStepIndex:e.currentStepIndex,steps:t}:null}async function N(e,t){try{return M(se(await E(T(e,I,`${t}.json`),`utf-8`),!1))}catch{return null}}async function P(e=n()){let t;try{t=await D(T(e,I))}catch{return[]}let r=t.filter(e=>e.endsWith(`.json`));return(await Promise.all(r.slice(0,L).map(t=>N(e,t.slice(0,-5))))).filter(e=>e!==null).sort((e,t)=>t.updatedAt-e.updatedAt)}function F(e){if(e.length===0)return[`Workflow runs: 0`,` none`].join(`
2
+ `);let t=e.filter(e=>e.status===`running`).length,n=e.filter(e=>e.status===`completed`).length,r=e.filter(e=>e.status===`cancelled`).length,i=[`Workflow runs: ${e.length}`,` Running: ${t}`,` Completed: ${n}`,` Cancelled: ${r}`];for(let t of e.slice(0,10)){let e=t.steps[t.currentStepIndex];i.push(` ${t.runId}: ${t.workflow}: ${t.status} step=${e?.name??`none`} updated=${new Date(t.updatedAt).toLocaleString()}`)}return e.length>10&&i.push(` ... ${e.length-10} more workflow run(s)`),i.join(`
3
+ `)}var I,L,R,z,B=e((()=>{t(),oe(),I=T(`.claude`,`workflow-runs`),L=200,R=[`running`,`completed`,`cancelled`],z=[`pending`,`running`,`completed`,`cancelled`]}));function V(){return T(C(),`registry.json`)}async function H(){try{let e=await E(V(),`utf8`),t=JSON.parse(e);return t.version===1?t:{...U}}catch{return{...U}}}var U,fe=e((()=>{w(),U={version:1,mainMachineId:null,main:null,subs:[]}}));async function pe(){return me(await H())}function me(e){let t=[`Pipe registry: ${+!!e.main} main, ${e.subs.length} sub(s)`];e.mainMachineId&&t.push(` main_machine=${e.mainMachineId.slice(0,8)}...`),e.main&&t.push(` [main] ${e.main.pipeName} pid=${e.main.pid} host=${e.main.hostname} tcp=${e.main.tcpPort??`none`}`);for(let n of e.subs.slice(0,10))t.push(` [sub-${n.subIndex}] ${n.pipeName} pid=${n.pid} host=${n.hostname} bound=${n.boundToMain??`none`} tcp=${n.tcpPort??`none`}`);return!e.main&&e.subs.length===0&&t.push(` none`),e.subs.length>10&&t.push(` ... ${e.subs.length-10} more sub pipe(s)`),t.join(`
4
+ `)}var he=e((()=>{fe()}));function ge(){try{let e=ue(),t=de();return[`Remote Control: ${e?`self-hosted`:`official`}`,` base_url=${le()}`,` token=${t?`present`:`missing`}`,` entitlement=checked at remote-control startup`].join(`
5
+ `)}catch(e){return[`Remote Control: unknown`,` reason=${e instanceof Error?e.message:String(e)}`].join(`
6
+ `)}}var _e=e((()=>{ce()}));async function ve(){let e=x(),t=await b(),n=[`Daemon: ${e.status}${e.state?` pid=${e.state.pid} workers=${e.state.workerKinds.join(`,`)}`:``}`,`Background sessions: ${t.length}`];for(let e of t.slice(0,8))n.push(` pid=${e.pid} kind=${e.kind} status=${e.status??`unknown`} cwd=${e.cwd}`);return t.length>8&&n.push(` ... ${t.length-8} more session(s)`),n.join(`
7
+ `)}function ye(){let e=!1,t=null;try{e=a(),t=ie()}catch(e){return[`Auto mode: unknown`,` reason=${e instanceof Error?e.message:String(e)}`].join(`
8
+ `)}return[`Auto mode: ${e?`available`:`unavailable`}`,` reason=${t??`none`}`].join(`
9
+ `)}async function W({runs:e,flows:t,nowMs:n=Date.now()}){return Promise.all([Promise.resolve({id:`auto-mode`,title:`Auto Mode`,content:ye()}),Promise.resolve({id:`runs`,title:`Runs`,content:g(e)}),Promise.resolve({id:`flows`,title:`Flows`,content:v(t)}),P().then(e=>({id:`workflow-runs`,title:`Workflow Runs`,content:F(e)})),pe().then(e=>({id:`pipes`,title:`Pipes`,content:e})),ve().then(e=>({id:`runtime`,title:`Runtime`,content:e})),Promise.resolve({id:`remote-control`,title:`Remote Control`,content:ge()}),te().then(e=>({id:`remote-trigger`,title:`RemoteTrigger`,content:_(e)}))])}async function be(e){return(await W(e)).map((e,t)=>[t===0?`# Autonomy Deep Status`:`## ${e.title}`,e.content].join(`
10
+ `)).join(`
11
+
12
+ `)}var xe=e((()=>{S(),y(),l(),u(),i(),d(),B(),he(),_e()}));function Se(e){let[t=`status`,n,r]=e.trim().split(/\s+/,3);return t===``||t===`status`?{type:`status`,deep:n===`--deep`}:t===`runs`?{type:`runs`,limit:n}:t===`flows`?{type:`flows`,limit:n}:t===`flow`?n===`cancel`?r?{type:`flow-cancel`,flowId:r}:{type:`usage`}:n===`resume`?r?{type:`flow-resume`,flowId:r}:{type:`usage`}:n?{type:`flow-detail`,flowId:n}:{type:`usage`}:{type:`usage`}}var G,Ce=e((()=>{G=`Usage: /autonomy [status [--deep]|runs [limit]|flows [limit]|flow <id>|flow cancel <id>|flow resume <id>]`}));function K(e){let t=typeof e==`number`?e:Number.parseInt(e??``,10);return!Number.isFinite(t)||t<=0?10:Math.min(t,50)}async function q(e){let t=e?.rootDir,[n,r]=await Promise.all([o(t),h(t)]);return e?.deep?be({runs:n,flows:r}):[g(n),v(r)].join(`
13
+ `)}async function we(e,t){let[n,r]=await Promise.all([o(t?.rootDir),h(t?.rootDir)]),i=(await W({runs:n,flows:r})).find(t=>t.id===e);return i?[`# ${i.title}`,i.content].join(`
14
+ `):`Autonomy deep status section not found: ${e}`}async function Te(e){process.stdout.write(`${await q(e)}\n`)}async function J(e,t){return p(await o(t?.rootDir),K(e))}async function Ee(e){process.stdout.write(`${await J(e)}\n`)}async function Y(e,t){return ne(await h(t?.rootDir),K(e))}async function X(e){process.stdout.write(`${await Y(e)}\n`)}async function Z(e,t){return s(await c(e,t?.rootDir))}async function De(e){process.stdout.write(`${await Z(e)}\n`)}async function Q(e,t){let n=await f({flowId:e,rootDir:t?.rootDir});if(!n)return`Autonomy flow not found.`;if(!n.accepted)return`Autonomy flow ${e} is already terminal (${n.flow.status}).`;let i=0;if(t?.removeQueuedInMemory){let n=r(t=>t.autonomy?.flowId===e);i=n.length;for(let e of n)e.autonomy?.runId&&await m(e.autonomy.runId,t?.rootDir)}else{for(let e of n.queuedRunIds)await m(e,t?.rootDir);i=n.queuedRunIds.length}return n.flow.status===`running`?`Cancellation requested for flow ${e}. The current step is still running, and no new steps will be started.`:`Cancelled flow ${e}. Removed ${i} queued step(s).`}async function Oe(e){process.stdout.write(`${await Q(e)}\n`)}async function $(e,t){let n=await re({flowId:e,rootDir:t?.rootDir,currentDir:t?.currentDir});if(!n)return`Autonomy flow is not waiting or was not found.`;if(t?.enqueueInMemory)return ae(n),`Queued the next managed step for flow ${e}.`;let r=n.autonomy?.runId??`unknown`;return[`Prepared the next managed step for flow ${e}.`,`Run ID: ${r}`,``,`Prompt:`,typeof n.value==`string`?n.value:String(n.value)].join(`
15
+ `)}async function ke(e){process.stdout.write(`${await $(e)}\n`)}async function Ae(e,t){let n=Se(e);switch(n.type){case`status`:return q({deep:n.deep});case`runs`:return J(n.limit);case`flows`:return Y(n.limit);case`flow-detail`:return Z(n.flowId);case`flow-cancel`:return Q(n.flowId,{removeQueuedInMemory:t?.removeQueuedInMemory});case`flow-resume`:return $(n.flowId,{enqueueInMemory:t?.enqueueInMemory});case`usage`:return G}}var je=e((()=>{l(),u(),xe(),Ce(),ee()}));export{Ee as a,Ae as c,Y as d,J as f,$ as g,K as h,X as i,we as l,je as m,De as n,Te as o,q as p,ke as r,Q as s,Oe as t,Z as u};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{ST as l,_x as u,bx as d,xT as f}from"./loadAgentsDir-Clu7Uk6a.js";import{c as p,l as m,m as h,p as g}from"./autonomy-Cg5zweUa.js";function _(){return S}function v({onDone:e}){d(`autonomy-panel`);let[t,i]=(0,b.useState)(0),[o,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return l().then(t=>{e||c(t.slice(0,5))}),()=>{e=!0}},[]);let u=(0,b.useMemo)(()=>{let e=[{label:`Overview`,description:`Show run and flow counts plus the latest automatic activity`,run:()=>g()},{label:`Full deep status`,description:`Print every local autonomy surface in one diagnostic report`,run:()=>g({deep:!0})},{label:`Auto mode`,description:`Check whether auto permission mode is available and why`,run:()=>m(`auto-mode`)},{label:`Runs summary`,description:`Show queued/running/completed/failed run totals and latest run`,run:()=>m(`runs`)},{label:`Recent runs`,description:`List recent autonomy run IDs, triggers, statuses, and prompts`,run:()=>p(`runs 10`)},{label:`Flows summary`,description:`Show managed flow totals across queued/running/waiting states`,run:()=>m(`flows`)},{label:`Recent flows`,description:`List recent managed flow IDs, status, current step, and goal`,run:()=>p(`flows 10`)},{label:`Workflow runs`,description:`Show persisted WorkflowTool runs and their current workflow step`,run:()=>m(`workflow-runs`)},{label:`Pipes`,description:`Show UDS/named-pipe and LAN registry for terminal messaging`,run:()=>m(`pipes`)},{label:`Runtime`,description:`Show daemon state and live background or interactive sessions`,run:()=>m(`runtime`)},{label:`Remote Control`,description:`Show bridge mode, base URL, token presence, and entitlement note`,run:()=>m(`remote-control`)},{label:`RemoteTrigger`,description:`Show recent remote trigger audit records, failures, and latest call`,run:()=>m(`remote-trigger`)}],t=o.flatMap(e=>{let t=e.flowId.slice(0,8),n=[{label:`Flow ${t}`,description:`${e.status}: ${e.goal}`,run:()=>p(`flow ${e.flowId}`)}];return e.status===`waiting`&&n.push({label:`Resume ${t}`,description:e.currentStep?`Resume waiting step: ${e.currentStep}`:`Resume waiting flow`,run:()=>p(`flow resume ${e.flowId}`,{enqueueInMemory:!0})}),(e.status===`queued`||e.status===`running`||e.status===`waiting`||e.status===`blocked`)&&n.push({label:`Cancel ${t}`,description:`Cancel ${e.status} flow`,run:()=>p(`flow cancel ${e.flowId}`,{removeQueuedInMemory:!0})}),n});return[...e,...t]},[o]),f=()=>{let n=u[t];n&&n.run().then(t=>{e(t,{display:`system`})})};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(u.length-1,e+1));return}t.return&&f()}),(0,x.jsx)(s,{title:`Autonomy`,subtitle:`${u.length} actions`,onCancel:()=>e(`Autonomy panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,x.jsxs)(n,{flexDirection:`column`,children:[u.map((e,i)=>(0,x.jsxs)(n,{flexDirection:`row`,children:[(0,x.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(C)}),(0,x.jsx)(r,{dimColor:!0,children:e.description})]},`${e.label}-${i}`)),(0,x.jsx)(n,{marginTop:1,children:(0,x.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function y(e,t,n){let r=n?.trim()??``;return r?(e(await p(r,{enqueueInMemory:!0,removeQueuedInMemory:!0}),{display:`system`}),null):(0,x.jsx)(v,{onDone:e})}var b,x,S,C;e((()=>{b=t(i(),1),o(),u(),h(),f(),x=c(),S=14,C=24}))();export{y as call,_ as getAutonomyPanelBaseActionCountForTests};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,fi as i,hn as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{cx as l,dx as u,fT as d,pT as f}from"./loadAgentsDir-x3rlgED4.js";import{c as p,l as m,m as h,p as g}from"./autonomy-Oui8yK8G.js";function _(){return S}function v({onDone:e}){u(`autonomy-panel`);let[t,i]=(0,b.useState)(0),[o,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return f().then(t=>{e||c(t.slice(0,5))}),()=>{e=!0}},[]);let l=(0,b.useMemo)(()=>{let e=[{label:`Overview`,description:`Show run and flow counts plus the latest automatic activity`,run:()=>g()},{label:`Full deep status`,description:`Print every local autonomy surface in one diagnostic report`,run:()=>g({deep:!0})},{label:`Auto mode`,description:`Check whether auto permission mode is available and why`,run:()=>m(`auto-mode`)},{label:`Runs summary`,description:`Show queued/running/completed/failed run totals and latest run`,run:()=>m(`runs`)},{label:`Recent runs`,description:`List recent autonomy run IDs, triggers, statuses, and prompts`,run:()=>p(`runs 10`)},{label:`Flows summary`,description:`Show managed flow totals across queued/running/waiting states`,run:()=>m(`flows`)},{label:`Recent flows`,description:`List recent managed flow IDs, status, current step, and goal`,run:()=>p(`flows 10`)},{label:`Workflow runs`,description:`Show persisted WorkflowTool runs and their current workflow step`,run:()=>m(`workflow-runs`)},{label:`Pipes`,description:`Show UDS/named-pipe and LAN registry for terminal messaging`,run:()=>m(`pipes`)},{label:`Runtime`,description:`Show daemon state and live background or interactive sessions`,run:()=>m(`runtime`)},{label:`Remote Control`,description:`Show bridge mode, base URL, token presence, and entitlement note`,run:()=>m(`remote-control`)},{label:`RemoteTrigger`,description:`Show recent remote trigger audit records, failures, and latest call`,run:()=>m(`remote-trigger`)}],t=o.flatMap(e=>{let t=e.flowId.slice(0,8),n=[{label:`Flow ${t}`,description:`${e.status}: ${e.goal}`,run:()=>p(`flow ${e.flowId}`)}];return e.status===`waiting`&&n.push({label:`Resume ${t}`,description:e.currentStep?`Resume waiting step: ${e.currentStep}`:`Resume waiting flow`,run:()=>p(`flow resume ${e.flowId}`,{enqueueInMemory:!0})}),(e.status===`queued`||e.status===`running`||e.status===`waiting`||e.status===`blocked`)&&n.push({label:`Cancel ${t}`,description:`Cancel ${e.status} flow`,run:()=>p(`flow cancel ${e.flowId}`,{removeQueuedInMemory:!0})}),n});return[...e,...t]},[o]),d=()=>{let n=l[t];n&&n.run().then(t=>{e(t,{display:`system`})})};return a((e,t)=>{if(t.upArrow){i(e=>Math.max(0,e-1));return}if(t.downArrow){i(e=>Math.min(l.length-1,e+1));return}t.return&&d()}),(0,x.jsx)(s,{title:`Autonomy`,subtitle:`${l.length} actions`,onCancel:()=>e(`Autonomy panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,x.jsxs)(n,{flexDirection:`column`,children:[l.map((e,i)=>(0,x.jsxs)(n,{flexDirection:`row`,children:[(0,x.jsx)(r,{children:`${i===t?`›`:` `} ${e.label}`.padEnd(C)}),(0,x.jsx)(r,{dimColor:!0,children:e.description})]},`${e.label}-${i}`)),(0,x.jsx)(n,{marginTop:1,children:(0,x.jsx)(r,{dimColor:!0,children:`↑/↓ select · Enter run · Esc close`})})]})})}async function y(e,t,n){let r=n?.trim()??``;return r?(e(await p(r,{enqueueInMemory:!0,removeQueuedInMemory:!0}),{display:`system`}),null):(0,x.jsx)(v,{onDone:e})}var b,x,S,C;e((()=>{b=t(i(),1),o(),l(),h(),d(),x=c(),S=14,C=24}))();export{y as call,_ as getAutonomyPanelBaseActionCountForTests};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-DtJNx4Ja.js";export{e as startBackgroundHousekeeping};
@@ -0,0 +1,17 @@
1
+ import{a as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{n,o as r}from"./envUtils-DSxRz_kt.js";import{K as i,R as a,en as o}from"./state-ix0xIunV.js";import{Bw as s,Et as c,Fg as l,Fw as u,HT as d,Hl as ee,Iw as f,Mo as p,Ng as te,Ul as m,_o as h,aS as g,br as _,bx as v,et as y,ho as b,ht as ne,jr as re,nt as ie,oS as ae,vo as oe,vx as se}from"./loadAgentsDir-x3rlgED4.js";import{n as ce,t as le}from"./cwd-CYmmnQVS.js";import{S as ue,W as de,a as fe,d as x,l as S,p as C,z as w}from"./debug-BrXObCdR.js";import{f as T,g as E,y as D}from"./settings-BeLFUeie.js";import{C as O,T as k,w as A}from"./config-DRDuVyzE.js";import{o as j,s as M,v as N,y as P}from"./log-BMCygSzM.js";import{n as F,r as I}from"./analytics-BotDBGh0.js";import{_ as L,h as R}from"./model-CZViyZnE.js";import{Tn as z,wn as B}from"./prompt-CE3sFmZV.js";import{st as V}from"./rcDebugLog-DBB9r8aw.js";import{i as H,t as U}from"./nativeInstaller-yj81F75v.js";import{n as pe,t as me}from"./allErrors-CQE2k0zO.js";import{n as he,r as ge}from"./magicDocs-qdDB_mKb.js";import{n as _e,t as ve}from"./pluginAutoupdate-0k03PVff.js";import{n as ye,r as be}from"./registerProtocol-wZv2uiW_.js";import{homedir as xe}from"os";import{join as W}from"path";import"crypto";import*as G from"fs/promises";r(),o(),ce(),ue(),C(),fe(),P(),E(),z(),L(),s(),m(),re(),ge(),y(),j(),w(),p(),d(),y(),f(),w(),j(),p(),d();async function Se(e,t){if(!e)return;let{join:n}=await import(`path`),r=await import(`fs/promises`),i=n(le(),`.claude`,`skills`,e,`SKILL.md`),a;try{a=await r.readFile(i,`utf-8`)}catch{M(Error(`Failed to read skill file for improvement: ${i}`));return}let o=t.map(e=>`- ${e.section}: ${e.change}`).join(`
2
+ `),s=R(),c=await ie({messages:[b({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
+
4
+ <current_skill_file>
5
+ ${a}
6
+ </current_skill_file>
7
+
8
+ <improvements>
9
+ ${o}
10
+ </improvements>
11
+
12
+ Rules:
13
+ - Integrate the improvements naturally into the existing structure
14
+ - Preserve frontmatter (--- block) exactly as-is
15
+ - Preserve the overall format and style
16
+ - Do not remove existing content unless an improvement explicitly replaces it
17
+ - Output the complete updated file inside <updated_file> tags`})],systemPrompt:V([`You edit skill definition files to incorporate user preferences. Output only the updated file content.`]),thinkingConfig:{type:`disabled`},tools:[],signal:u().signal,options:{getToolPermissionContext:async()=>B(),model:s,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),l=h(oe(Array.isArray(c.message.content)?c.message.content:[]).trim(),`updated_file`);if(!l){M(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,l,`utf-8`)}catch(e){M(de(e))}}F(),v(),O(),j(),U(),ae(),pe(),l(),c();var Ce=30;function K(){let e=((T()||{}).cleanupPeriodDays??Ce)*24*60*60*1e3;return new Date(Date.now()-e)}function we(e,t){return{messages:e.messages+t.messages,errors:e.errors+t.errors}}function Te(e){let t=e.split(`.`)[0].replace(/T(\d{2})-(\d{2})-(\d{2})-(\d{3})Z/,`T$1:$2:$3.$4Z`);return new Date(t)}async function q(e,t,n){let r={messages:0,errors:0};try{let i=await x().readdir(e);for(let a of i)try{Te(a.name)<t&&(await x().unlink(W(e,a.name)),n?r.messages++:r.errors++)}catch(e){M(e)}}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&M(e)}return r}async function Ee(){let e=x(),t=K(),n=N.errors(),r=N.baseLogs(),i=await q(n,t,!1);try{let n;try{n=await e.readdir(r)}catch{return i}let a=n.filter(e=>e.isDirectory()&&e.name.startsWith(`mcp-logs-`)).map(e=>W(r,e.name));for(let n of a)i=we(i,await q(n,t,!0)),await Y(n,e)}catch(e){e instanceof Error&&`code`in e&&e.code!==`ENOENT`&&M(e)}return i}async function J(e,t,n){return(await n.stat(e)).mtime<t?(await n.unlink(e),!0):!1}async function Y(e,t){try{await t.rmdir(e)}catch{}}async function De(){let e=K(),t={messages:0,errors:0},n=_(),r=x(),i;try{i=await r.readdir(n)}catch{return t}for(let a of i){if(!a.isDirectory())continue;let i=W(n,a.name),o;try{o=await r.readdir(i)}catch{t.errors++;continue}for(let n of o)if(n.isFile()){if(!n.name.endsWith(`.jsonl`)&&!n.name.endsWith(`.cast`))continue;try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}}else if(n.isDirectory()){let a=W(i,n.name),o=W(a,te),s;try{s=await r.readdir(o)}catch{await Y(a,r);continue}for(let n of s)if(n.isFile())try{await J(W(o,n.name),e,r)&&t.messages++}catch{t.errors++}else if(n.isDirectory()){let i=W(o,n.name),a;try{a=await r.readdir(i)}catch{continue}for(let n of a)if(n.isFile())try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}await Y(i,r)}await Y(o,r),await Y(a,r)}await Y(i,r)}return t}async function Oe(e,t,n=!0){let r=K(),i={messages:0,errors:0},a=x(),o;try{o=await a.readdir(e)}catch{return i}for(let n of o)if(!(!n.isFile()||!n.name.endsWith(t)))try{await J(W(e,n.name),r,a)&&i.messages++}catch{i.errors++}return n&&await Y(e,a),i}function ke(){return Oe(W(n(),`plans`),`.md`)}async function Ae(){let e=K(),t={messages:0,errors:0},r=x();try{let i=W(n(),`file-history`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));await Promise.all(o.map(async n=>{try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}})),await Y(i,r)}catch(e){M(e)}return t}async function X(){let e=K(),t={messages:0,errors:0},r=x();try{let i=W(n(),`session-env`),a;try{a=await r.readdir(i)}catch{return t}let o=a.filter(e=>e.isDirectory()).map(e=>W(i,e.name));for(let n of o)try{(await r.stat(n)).mtime<e&&(await r.rm(n,{recursive:!0,force:!0}),t.messages++)}catch{t.errors++}await Y(i,r)}catch(e){M(e)}return t}async function je(){let e=K(),t={messages:0,errors:0},r=x(),i=W(n(),`debug`),a;try{a=await r.readdir(i)}catch{return t}for(let n of a)if(!(!n.isFile()||!n.name.endsWith(`.txt`)||n.name===`latest`))try{await J(W(i,n.name),e,r)&&t.messages++}catch{t.errors++}return t}var Z=1440*60*1e3;async function Q(){let e=W(n(),`.npm-cache-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){S(`npm cache cleanup: skipping, ran recently`);return}}catch{}try{await A(e,{retries:0,realpath:!1})}catch{S(`npm cache cleanup: skipping, lock held`);return}S(`npm cache cleanup: starting`);let r=W(xe(),`.npm`,`_cacache`),i=Date.now();try{let n=await import(`./lib-rQZENxQg.js`).then(e=>t(e.default,1)),a=i-Z,o=n.ls.stream(r),s=[];for await(let e of o)e.key.includes(`@anthropic-ai/claude-`)&&s.push({key:e.key,time:e.time});let c=new Map;for(let e of s){let t=e.key.lastIndexOf(`@`),n=t>0?e.key.slice(0,t):e.key,r=c.get(n)??[];r.push(e),c.set(n,r)}let l=[];for(let[,e]of c){e.sort((e,t)=>t.time-e.time);for(let t=0;t<e.length;t++){let n=e[t];(n.time<a||t>=5)&&l.push(n.key)}}await Promise.all(l.map(e=>n.rm.entry(r,e))),await G.writeFile(e,new Date().toISOString());let u=Date.now()-i;l.length>0?S(`npm cache cleanup: Removed ${l.length} old @anthropic-ai entries in ${u}ms`):S(`npm cache cleanup: completed in ${u}ms`),I(`tengu_npm_cache_cleanup`,{success:!0,durationMs:u,entriesRemoved:l.length})}catch(e){M(e),I(`tengu_npm_cache_cleanup`,{success:!1,durationMs:Date.now()-i})}finally{await k(e,{realpath:!1}).catch(()=>{})}}async function Me(){let e=W(n(),`.version-cleanup`);try{let t=await G.stat(e);if(Date.now()-t.mtimeMs<Z){S(`version cleanup: skipping, ran recently`);return}}catch{}try{await A(e,{retries:0,realpath:!1})}catch{S(`version cleanup: skipping, lock held`);return}S(`version cleanup: starting (throttled)`);try{await H(),await G.writeFile(e,new Date().toISOString())}catch(e){M(e)}finally{await k(e,{realpath:!1}).catch(()=>{})}}async function Ne(){let{errors:e}=me();if(e.length>0&&D(`cleanupPeriodDays`)){S(`Skipping cleanup: settings have validation errors but cleanupPeriodDays was explicitly set. Fix settings errors to enable cleanup.`);return}await Ee(),await De(),await ke(),await Ae(),await X(),await je(),await se(),await g(K());let t=await ne(K());t>0&&I(`tengu_worktree_cleanup`,{removed:t}),process.env.USER_TYPE===`ant`&&await Q()}o(),U(),_e();var Pe=(ye(),e(be)),Fe=1440*60*1e3,$=600*1e3;function Ie(){he(),import(`./extractMemories-DhUprYa7.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),ee(),ve(),a()&&Pe.ensureDeepLinkProtocolRegistered();let e=!0;async function t(){if(a()&&i()>Date.now()-1e3*60){setTimeout(t,$).unref();return}if(e&&(e=!1,await Ne()),a()&&i()>Date.now()-1e3*60){setTimeout(t,$).unref();return}await H()}setTimeout(t,$).unref(),process.env.USER_TYPE===`ant`&&setInterval(()=>{Q(),Me()},Fe).unref()}export{Se as n,Ie as t};
@@ -1,3 +1,3 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-ix0xIunV.js";import{Dr as i,Er as a,Lr as o,jr as s,vi as c,wi as l,yr as u}from"./loadAgentsDir-Clu7Uk6a.js";import{S as d,w as f}from"./debug-BrXObCdR.js";import{c as p,s as m}from"./types-C-MRCL8J.js";import{n as h,r as g}from"./analytics-BotDBGh0.js";import{i as _,o as v}from"./stringUtils-DGLPkqJ4.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let t=y(),s=n(),c=u(r()),l=i(t),d=a();await b(c,{recursive:!0,mode:448});let m;try{m=await x(d)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=p(m),g=h.filter(e=>o(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===s).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let n={...e,sessionId:t,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:s,messageUuid:e.uuid}},r={...e,sessionId:t};w.push(r),C.push(f(n)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:t,replacements:_};C.push(f(e))}return await S(l,C.join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nt as r}from"./state-ix0xIunV.js";import{Dr as i,Er as a,Lr as o,jr as s,vi as c,wi as l,yr as u}from"./loadAgentsDir-x3rlgED4.js";import{S as d,w as f}from"./debug-BrXObCdR.js";import{c as p,s as m}from"./types-Dut4311z.js";import{n as h,r as g}from"./analytics-BotDBGh0.js";import{i as _,o as v}from"./stringUtils-DGLPkqJ4.js";import{randomUUID as y}from"crypto";import{mkdir as b,readFile as x,writeFile as S}from"fs/promises";function C(e){let t=e?.message?.content;if(!t)return`Branched conversation`;let n=typeof t==`string`?t:t.find(e=>e.type===`text`)?.text;return n&&n.replace(/\s+/g,` `).trim().slice(0,100)||`Branched conversation`}async function w(e){let t=y(),s=n(),c=u(r()),l=i(t),d=a();await b(c,{recursive:!0,mode:448});let m;try{m=await x(d)}catch{throw Error(`No conversation to branch`)}if(m.length===0)throw Error(`No conversation to branch`);let h=p(m),g=h.filter(e=>o(e)&&!e.isSidechain),_=h.filter(e=>e.type===`content-replacement`&&e.sessionId===s).flatMap(e=>e.replacements);if(g.length===0)throw Error(`No messages to branch`);let v=null,C=[],w=[];for(let e of g){let n={...e,sessionId:t,parentUuid:v,isSidechain:!1,forkedFrom:{sessionId:s,messageUuid:e.uuid}},r={...e,sessionId:t};w.push(r),C.push(f(n)),e.type!==`progress`&&(v=e.uuid)}if(_.length>0){let e={type:`content-replacement`,sessionId:t,replacements:_};C.push(f(e))}return await S(l,C.join(`
2
2
  `)+`
3
3
  `,{encoding:`utf8`,mode:384}),{sessionId:t,title:e,forkPath:l,serializedMessages:w,contentReplacementRecords:_}}async function T(e){let t=`${e} (Branch)`;if((await l(t,{exact:!0})).length===0)return t;let n=await l(`${e} (Branch`),r=new Set([1]),i=RegExp(`^${_(e)} \\(Branch(?: (\\d+))?\\)$`);for(let e of n){let t=e.customTitle?.match(i);t&&(t[1]?r.add(parseInt(t[1],10)):r.add(1))}let a=2;for(;r.has(a);)a++;return`${e} (Branch ${a})`}async function E(e,t,r){let i=r?.trim()||void 0,a=n();try{let{sessionId:n,title:r,forkPath:o,serializedMessages:s,contentReplacementRecords:l}=await w(i),u=new Date,d=C(s.find(e=>e.type===`user`)),f=await T(r??d);await c(n,f,o),g(`tengu_conversation_forked`,{message_count:s.length,has_custom_title:!!r});let p={date:u.toISOString().split(`T`)[0],messages:s,fullPath:o,value:u.getTime(),created:u,modified:u,firstPrompt:d,messageCount:s.length,isSidechain:!1,sessionId:n,customTitle:f,contentReplacements:l},m=r?` "${r}"`:``,h=`Branched conversation${m}. You are now in the branch.${`\nTo resume the original: claude -r ${a}`}`;return t.resume?(await t.resume(n,p,`fork`),e(h,{display:`system`})):e(`Branched conversation${m}. Resume with: /resume ${n}`),null}catch(t){return e(`Failed to branch conversation: ${t instanceof Error?t.message:`Unknown error occurred`}`),null}}e((()=>{t(),h(),m(),s(),d(),v()}))();export{E as call,C as deriveFirstPrompt};
@@ -2,7 +2,7 @@ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./e
2
2
  `).filter(Boolean).map(e=>{try{return JSON.parse(e)}catch{return null}}).filter(e=>e!==null),t=e.filter(e=>e.kind===`once`),n=e[e.length-1],r=e.filter(e=>e.kind===`always_on`||e.kind===`always_off`),i=r[r.length-1];return{totalBreaks:t.length,lastBreakAt:n?.at??null,alwaysModeEnabled:i?.kind===`always_on`}}catch{return{totalBreaks:0,lastBreakAt:null,alwaysModeEnabled:!1}}}function g(e){let n=m();c(t(),{recursive:!0});let r={at:new Date().toISOString(),kind:e};o(n,JSON.stringify(r)+`
3
3
  `,`utf8`)}function _(){g(`once`)}async function v(e){let t=e.trim().toLowerCase(),n=f(),r=p();if(t===`status`){let e=h(),t=s(n),i=s(r);return{type:`text`,value:[`## Break-Cache Status`,``,` Once marker: ${t?`ACTIVE (next call will bust cache)`:`not set`}`,` Always mode: ${i?`ON (every call busts cache)`:`off`}`,``,`## Stats`,` total_breaks: ${e.totalBreaks}`,` last_break_at: ${e.lastBreakAt??`never`}`].join(`
4
4
  `)}}if(t===`off`){let e=!1;return s(n)&&(u(n),e=!0),s(r)&&(u(r),e=!0),g(`always_off`),{type:`text`,value:e?`Break-cache disabled. Removed once marker and/or always flag.`:`Break-cache was not active.`}}if(t===`--clear`)return s(n)?(u(n),{type:`text`,value:`Cache-break marker cleared.\n \`${n}\``}):{type:`text`,value:`No cache-break marker was set.`};if(t===`always`)return d(r,new Date().toISOString(),`utf8`),g(`always_on`),{type:`text`,value:[`## Always-on cache break enabled`,``,`Flag written: \`${r}\``,``,`Every API call will now append a random nonce to the system prompt,`,`permanently preventing prompt-cache hits for this session.`,``,"To disable: `/break-cache off`"].join(`
5
- `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: Anthropic prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
5
+ `)};if(t===``||t===`once`){let e=new Date().toISOString();d(n,e,`utf8`),_();let t=h();return{type:`text`,value:[`## Cache break scheduled`,``,`Marker written: \`${n}\``,`Timestamp: ${e}`,``,`The next API call will append a random nonce to the system prompt,`,`causing a cache miss. The marker is removed automatically after use.`,``,"To cancel before the next call: `/break-cache --clear`","For every call: `/break-cache always`",``,`Total breaks this session: ${t.totalBreaks}`,``,`_How it works: The prompt cache keys on the system-prompt prefix hash._`,`_A unique nonce invalidates the hash, forcing a fresh compute._`].join(`
6
6
  `)}}return{type:`text`,value:[`Unknown scope: "${t}"`,``,y].join(`
7
- `)}}var y,b,x,S=e((()=>{r(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The Anthropic prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
8
- `),b={type:`local-jsx`,name:`break-cache`,description:`Manage prompt-cache breaking. Open actions or run: once, status, always, off`,isHidden:!1,isEnabled:()=>!i(),argumentHint:`[once|status|always|off|--clear]`,bridgeSafe:!0,getBridgeInvocationError:e=>e.trim()?void 0:`Use /break-cache once/status/always/off over Remote Control.`,load:()=>import(`./panel-CrTPqXCv.js`)},x={type:`local`,name:`break-cache`,description:`Force the next (or all) API call(s) to miss prompt cache. Scopes: once, status, always, off`,isHidden:!1,isEnabled:()=>i(),supportsNonInteractive:!0,bridgeSafe:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
7
+ `)}}var y,b,x,S=e((()=>{r(),n(),y=[`Usage: /break-cache [scope]`,``,` (no args) Schedule a one-time cache break for the next API call`,` once Same as no args`,` always Enable persistent cache-break mode (every request)`,` off Disable always mode and clear any pending marker`,` --clear Clear the pending once marker (cancel before next call)`,` status Show current break-cache status and stats`,``,`How it works:`,` The prompt cache keys on the system-prompt prefix hash.`,` A unique nonce invalidates the hash, forcing a fresh compute.`,` This is useful when you want to ensure a clean context window.`].join(`
8
+ `),b={type:`local-jsx`,name:`break-cache`,description:`Manage prompt-cache breaking. Open actions or run: once, status, always, off`,isHidden:!1,isEnabled:()=>!i(),argumentHint:`[once|status|always|off|--clear]`,bridgeSafe:!0,getBridgeInvocationError:e=>e.trim()?void 0:`Use /break-cache once/status/always/off over Remote Control.`,load:()=>import(`./panel-BSZGX6jN.js`)},x={type:`local`,name:`break-cache`,description:`Force the next (or all) API call(s) to miss prompt cache. Scopes: once, status, always, off`,isHidden:!1,isEnabled:()=>i(),supportsNonInteractive:!0,bridgeSafe:!0,load:async()=>({call:v})}}));export{f as a,p as i,x as n,S as o,v as r,b as t};
@@ -1,2 +1,2 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,I as r,P as i,_ as a,fi as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{KS as u,US as d,WS as f,_x as p,bx as m}from"./loadAgentsDir-Clu7Uk6a.js";import{a as h,l as g}from"./debug-BrXObCdR.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{u as y}from"./referral-BlrMpBAV.js";import{a as b,t as x}from"./bridgeConfig-5p_w4s5r.js";import{n as S,r as C,s as w,t as T}from"./bridgeEnabled-DhFrLTbG.js";import{a as E,i as D,n as O}from"./types-Bh9S_JG5.js";import{t as k}from"./lib-BlVGipXx.js";import{i as A,n as j}from"./envLessBridgeConfig-DXd10GXD.js";import{n as M,r as N}from"./RemoteCallout-CiA4rCEs.js";function P({onDone:e,name:t}){let n=u(),r=f(e=>e.replBridgeConnected),i=f(e=>e.replBridgeEnabled),a=f(e=>e.replBridgeOutboundOnly),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{if((r||i)&&!a){s(!0);return}let o=!1;return(async()=>{let r=await I();if(!o){if(r){v(`tengu_bridge_command`,{action:`preflight_failed`}),e(r,{display:`system`});return}if(N()){n(e=>e.showRemoteCallout?e:{...e,showRemoteCallout:!0,replBridgeInitialName:t}),e(``,{display:`system`});return}v(`tengu_bridge_command`,{action:`connect`}),n(e=>e.replBridgeEnabled&&!e.replBridgeOutboundOnly?e:{...e,replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1,replBridgeInitialName:t}),e(`Remote Control connecting…`,{display:`system`})}})(),()=>{o=!0}},[]),o?(0,B.jsx)(F,{onDone:e}):null}function F({onDone:e}){m(`bridge-disconnect-dialog`);let t=u(),o=f(e=>e.replBridgeSessionUrl),s=f(e=>e.replBridgeConnectUrl),l=f(e=>e.replBridgeSessionActive),[d,p]=(0,z.useState)(2),[h,g]=(0,z.useState)(!1),[_,y]=(0,z.useState)(``),b=l?o:s;(0,z.useEffect)(()=>{if(!h||!b){y(``);return}(0,R.toString)(b,{type:`utf8`,errorCorrectionLevel:`L`,small:!0}).then(y).catch(()=>y(``))},[h,b]);function x(){t(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),v(`tengu_bridge_command`,{action:`disconnect`}),e(D,{display:`system`})}function S(){g(e=>!e)}function C(){e(void 0,{display:`skip`})}n({"select:next":()=>p(e=>(e+1)%3),"select:previous":()=>p(e=>(e-1+3)%3),"select:accept":()=>{d===0?x():d===1?S():C()}},{context:`Select`});let w=_?_.split(`
2
- `).filter(e=>e.length>0):[];return(0,B.jsx)(c,{title:`Remote Control`,onCancel:C,hideInputGuide:!0,children:(0,B.jsxs)(r,{flexDirection:`column`,gap:1,children:[(0,B.jsxs)(i,{children:[`This session is available via Remote Control`,b?` at ${b}`:``,`.`]}),h&&w.length>0&&(0,B.jsx)(r,{flexDirection:`column`,children:w.map((e,t)=>(0,B.jsx)(i,{children:e},t))}),(0,B.jsxs)(r,{flexDirection:`column`,children:[(0,B.jsx)(a,{isFocused:d===0,children:(0,B.jsx)(i,{children:`Disconnect this session`})}),(0,B.jsx)(a,{isFocused:d===1,children:(0,B.jsx)(i,{children:h?`Hide QR code`:`Show QR code`})}),(0,B.jsx)(a,{isFocused:d===2,children:(0,B.jsx)(i,{children:`Continue`})})]}),(0,B.jsx)(i,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function I(){let{waitForPolicyLimitsToLoad:e,isPolicyAllowed:t}=await import(`./policyLimits-BkjgMQD0.js`);if(await e(),!t(`allow_remote_control`))return`Remote Control is disabled by your organization's policy.`;let n=await S();if(n)return n;let r=w();if(r){let{isAssistantMode:e}=await import(`./assistant-z2o4-UJe.js`);e()&&(r=!1)}return(r?await j():T())||(x()?(g(`[bridge] Prerequisites passed, enabling bridge`),null):O)}async function L(e,t,n){return(0,B.jsx)(P,{onDone:e,name:n.trim()||void 0})}var R,z,B;e((()=>{R=k(),o(),z=t(o(),1),b(),C(),A(),E(),s(),M(),p(),y(),_(),d(),h(),B=l()}))();export{L as call};
1
+ import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Gt as n,I as r,P as i,_ as a,fi as o,t as s,y as c}from"./src-CDCSSo0U2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{FS as u,LS as d,PS as f,cx as p,dx as m}from"./loadAgentsDir-x3rlgED4.js";import{a as h,l as g}from"./debug-BrXObCdR.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{u as y}from"./referral-CKmHHxj_.js";import{a as b,t as x}from"./bridgeConfig-CE6dMsiJ.js";import{n as S,r as C,s as w,t as T}from"./bridgeEnabled-Cc0mGlTb.js";import{a as E,i as D,n as O}from"./types-Bh9S_JG5.js";import{t as k}from"./lib-BlVGipXx.js";import{i as A,n as j}from"./envLessBridgeConfig-B-LKYNvv.js";import{n as M,r as N}from"./RemoteCallout-B-tyvQOe.js";function P({onDone:e,name:t}){let n=d(),r=u(e=>e.replBridgeConnected),i=u(e=>e.replBridgeEnabled),a=u(e=>e.replBridgeOutboundOnly),[o,s]=(0,z.useState)(!1);return(0,z.useEffect)(()=>{if((r||i)&&!a){s(!0);return}let o=!1;return(async()=>{let r=await I();if(!o){if(r){v(`tengu_bridge_command`,{action:`preflight_failed`}),e(r,{display:`system`});return}if(N()){n(e=>e.showRemoteCallout?e:{...e,showRemoteCallout:!0,replBridgeInitialName:t}),e(``,{display:`system`});return}v(`tengu_bridge_command`,{action:`connect`}),n(e=>e.replBridgeEnabled&&!e.replBridgeOutboundOnly?e:{...e,replBridgeEnabled:!0,replBridgeExplicit:!0,replBridgeOutboundOnly:!1,replBridgeInitialName:t}),e(`Remote Control connecting…`,{display:`system`})}})(),()=>{o=!0}},[]),o?(0,B.jsx)(F,{onDone:e}):null}function F({onDone:e}){m(`bridge-disconnect-dialog`);let t=d(),o=u(e=>e.replBridgeSessionUrl),s=u(e=>e.replBridgeConnectUrl),l=u(e=>e.replBridgeSessionActive),[f,p]=(0,z.useState)(2),[h,g]=(0,z.useState)(!1),[_,y]=(0,z.useState)(``),b=l?o:s;(0,z.useEffect)(()=>{if(!h||!b){y(``);return}(0,R.toString)(b,{type:`utf8`,errorCorrectionLevel:`L`,small:!0}).then(y).catch(()=>y(``))},[h,b]);function x(){t(e=>e.replBridgeEnabled?{...e,replBridgeEnabled:!1,replBridgeExplicit:!1,replBridgeOutboundOnly:!1}:e),v(`tengu_bridge_command`,{action:`disconnect`}),e(D,{display:`system`})}function S(){g(e=>!e)}function C(){e(void 0,{display:`skip`})}n({"select:next":()=>p(e=>(e+1)%3),"select:previous":()=>p(e=>(e-1+3)%3),"select:accept":()=>{f===0?x():f===1?S():C()}},{context:`Select`});let w=_?_.split(`
2
+ `).filter(e=>e.length>0):[];return(0,B.jsx)(c,{title:`Remote Control`,onCancel:C,hideInputGuide:!0,children:(0,B.jsxs)(r,{flexDirection:`column`,gap:1,children:[(0,B.jsxs)(i,{children:[`This session is available via Remote Control`,b?` at ${b}`:``,`.`]}),h&&w.length>0&&(0,B.jsx)(r,{flexDirection:`column`,children:w.map((e,t)=>(0,B.jsx)(i,{children:e},t))}),(0,B.jsxs)(r,{flexDirection:`column`,children:[(0,B.jsx)(a,{isFocused:f===0,children:(0,B.jsx)(i,{children:`Disconnect this session`})}),(0,B.jsx)(a,{isFocused:f===1,children:(0,B.jsx)(i,{children:h?`Hide QR code`:`Show QR code`})}),(0,B.jsx)(a,{isFocused:f===2,children:(0,B.jsx)(i,{children:`Continue`})})]}),(0,B.jsx)(i,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function I(){let{waitForPolicyLimitsToLoad:e,isPolicyAllowed:t}=await import(`./policyLimits-D2s8M8P2.js`);if(await e(),!t(`allow_remote_control`))return`Remote Control is disabled by your organization's policy.`;let n=await S();if(n)return n;let r=w();if(r){let{isAssistantMode:e}=await import(`./assistant-z2o4-UJe.js`);e()&&(r=!1)}return(r?await j():T())||(x()?(g(`[bridge] Prerequisites passed, enabling bridge`),null):O)}async function L(e,t,n){return(0,B.jsx)(P,{onDone:e,name:n.trim()||void 0})}var R,z,B;e((()=>{R=k(),o(),z=t(o(),1),b(),C(),A(),E(),s(),M(),p(),y(),_(),f(),h(),B=l()}))();export{L as call};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-BqJqV-2M.js";import{Bt as r,Ot as i}from"./model-BQF64tZx.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,u as n}from"./oauth-BqJqV-2M.js";import{Bt as r,Ot as i}from"./model-CZViyZnE.js";function a(){return process.env.CLAUDE_BRIDGE_OAUTH_TOKEN||void 0}function o(){return process.env.CLAUDE_BRIDGE_BASE_URL||void 0}function s(){return a()??i()?.accessToken}function c(){return o()??t().BASE_API_URL}function l(){return!!o()}var u=e((()=>{n(),r()}));export{u as a,a as i,c as n,l as o,o as r,s as t};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n,t as r}from"./bridgeConfig-CE6dMsiJ.js";e();export{r as getBridgeAccessToken,t as getBridgeBaseUrl,n as isSelfHostedBridge};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{o as t}from"./envUtils-DSxRz_kt.js";import{Bt as n,Gt as r,jt as i,zt as a}from"./model-BQF64tZx.js";import{i as o,r as s}from"./semver-BMRJYn3q.js";import{a as c,o as l}from"./bridgeConfig-5p_w4s5r.js";function u(){return l()?!0:p()}async function d(){return l()?!0:p()}async function f(){return l()?null:p()?m()?h()?.organizationUuid?null:`Unable to determine your organization for Remote Control eligibility.`:"Remote Control requires a full-scope login token. Long-lived tokens (from `claude setup-token` or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only for security reasons.":`Remote Control requires a claude.ai subscription.`}function p(){try{return r()}catch{return!1}}function m(){try{return a()}catch{return!1}}function h(){try{return i()}catch{return}}function g(){return!1}function _(){return!0}function v(){{let e={minVersion:`0.0.0`};if(e.minVersion&&o(`0.0.5`,e.minVersion))return`Your version of Work Mate (0.0.5) is too old for Remote Control.\nVersion ${e.minVersion} or higher is required. Run \`claude update\` to update.`}return null}var y=e((()=>{c(),n(),t(),s()}));export{d as a,u as i,f as n,_ as o,y as r,g as s,v as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{o as t}from"./envUtils-DSxRz_kt.js";import{Bt as n,Gt as r,jt as i,zt as a}from"./model-CZViyZnE.js";import{i as o,r as s}from"./semver-BMRJYn3q.js";import{a as c,o as l}from"./bridgeConfig-CE6dMsiJ.js";function u(){return l()?!0:p()}async function d(){return l()?!0:p()}async function f(){return l()?null:p()?m()?h()?.organizationUuid?null:`Unable to determine your organization for Remote Control eligibility.`:"Remote Control requires a full-scope login token. Long-lived tokens (from `claude setup-token` or CLAUDE_CODE_OAUTH_TOKEN) are limited to inference-only for security reasons.":`Remote Control requires a claude.ai subscription.`}function p(){try{return r()}catch{return!1}}function m(){try{return a()}catch{return!1}}function h(){try{return i()}catch{return}}function g(){return!1}function _(){return!0}function v(){{let e={minVersion:`0.0.0`};if(e.minVersion&&o(`0.0.7`,e.minVersion))return`Your version of Work Mate (0.0.7) is too old for Remote Control.\nVersion ${e.minVersion} or higher is required. Run \`claude update\` to update.`}return null}var y=e((()=>{c(),n(),t(),s()}));export{d as a,u as i,f as n,_ as o,y as r,g as s,v as t};
@@ -0,0 +1 @@
1
+ import{n as e,r as t,t as n}from"./bridgeEnabled-Cc0mGlTb.js";t();export{n as checkBridgeMinVersion,e as getBridgeDisabledReason};
@@ -0,0 +1 @@
1
+ import{n as e}from"./bridgeMain-D11t1BYQ.js";export{e as bridgeMain};