@readmagic/workmate 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (490) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-BgNp7glC.js → AddWorkspaceDirectory-mANiG0xj.js} +1 -1
  2. package/dist/chunks/{App-Coboqa8H.js → App-aUVaOLeo.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-CYpBbj0k.js → ApproveApiKey-36iUE5CW.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-DPdcp1CQ.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-DxKsTdqj.js → AssistantSessionChooser-BLcvdkgb.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-DyjVt81B.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-Cx3QGFz-.js → BypassPermissionsModeDialog-CTlpvTuz.js} +1 -1
  8. package/dist/chunks/{ClaudeMdExternalIncludesDialog-BAK9fxwg.js → ClaudeMdExternalIncludesDialog-5pipE8m8.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-Dn7Le--z.js +1 -0
  10. package/dist/chunks/ConsoleOAuthFlow-BDr1Vx5K.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-BsHgLlTy.js → DesktopHandoff-Blg1TVut.js} +1 -1
  12. package/dist/chunks/{DiffDialog-BgTW2Znv.js → DiffDialog-CUEpuocY.js} +2 -2
  13. package/dist/chunks/Doctor-B540I-gq.js +1 -0
  14. package/dist/chunks/Doctor-DlE1Mbb9.js +3 -0
  15. package/dist/chunks/ExitFlow-DCIhnP5h.js +2 -0
  16. package/dist/chunks/Feedback-CDTqPqsM.js +2 -0
  17. package/dist/chunks/{Grove-Dsi4yU08.js → Grove-D9lSG_Lh.js} +1 -1
  18. package/dist/chunks/Grove-DLYXL8hv.js +1 -0
  19. package/dist/chunks/{HybridTransport-8qA64lCx.js → HybridTransport-8j0AviF6.js} +4 -4
  20. package/dist/chunks/{InvalidConfigDialog-CAZ1z5WG.js → InvalidConfigDialog-I3t-0nU3.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-D82Qk_MR.js → InvalidSettingsDialog-BnthOxGT.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-zdocEDgk.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-8ZueNqAd.js → McpParsingWarnings-D0XvLirX.js} +1 -1
  24. package/dist/chunks/MessageSelector-BBhCstBa.js +3 -0
  25. package/dist/chunks/Messages-Dv2VrytX.js +11 -0
  26. package/dist/chunks/{Onboarding-CUztnbbv.js → Onboarding-B1WRpoBI.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-DSgrZvMv.js → OverageCreditUpsell-BSmgq089.js} +1 -1
  28. package/dist/chunks/PluginSettings-DN9rpwc_.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-IaihWay3.js → PromptInputFooterSuggestions-3rjz6zhK.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-okS2rQ4k.js → PromptInputHelpMenu-DgDJHZqC.js} +1 -1
  31. package/dist/chunks/QueryEngine-BnaHDZVZ.js +1 -0
  32. package/dist/chunks/REPL-B3RbzeV7.js +1 -0
  33. package/dist/chunks/{REPL-Dto012J0.js → REPL-CA8FEO7J.js} +44 -44
  34. package/dist/chunks/{RemoteCallout-C_UIYnuT.js → RemoteCallout-BFzCx_Pn.js} +1 -1
  35. package/dist/chunks/{RemoteSessionManager-CuSSHAXN.js → RemoteSessionManager-BhUrtejX.js} +2 -2
  36. package/dist/chunks/ResumeConversation-BseKUFRI.js +1 -0
  37. package/dist/chunks/{SSETransport-Chj_yfPv.js → SSETransport-DGIytG74.js} +3 -3
  38. package/dist/chunks/SearchExtraToolsTool-h6OunbMd.js +1 -0
  39. package/dist/chunks/Settings-BvhG1XoW.js +2 -0
  40. package/dist/chunks/{TeleportProgress-DP1a8jit.js → TeleportProgress-Bens06DU.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-B6sTwXuZ.js → TeleportRepoMismatchDialog-BtLBCZUe.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-CKUuRQSG.js → TeleportResumeWrapper-t50LfWyN.js} +1 -1
  43. package/dist/chunks/{ThemePicker-Dyq1YVhb.js → ThemePicker-BTfuZZ7E.js} +1 -1
  44. package/dist/chunks/TrustDialog-CgE_pYUK.js +1 -0
  45. package/dist/chunks/{ValidationErrorsList-DUNh4BNa.js → ValidationErrorsList-Bl68E-2-.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-TPbOXGrO.js → WelcomeV2-C93xQYAF.js} +1 -1
  47. package/dist/chunks/{add-dir-Bf_5tCeR.js → add-dir-C3IhJYVH.js} +1 -1
  48. package/dist/chunks/{agentDisplay-CCeYiAta.js → agentDisplay-Cju-aXCx.js} +1 -1
  49. package/dist/chunks/{agents-Bt72Gz1v.js → agents-Bhg0CtXR.js} +7 -7
  50. package/dist/chunks/{agents-T8xHY5Wk.js → agents-Du3FQ82k.js} +1 -1
  51. package/dist/chunks/{allErrors-CDWTJcMw.js → allErrors-DJYCAtab.js} +1 -1
  52. package/dist/chunks/{ant-DRF-v5bA.js → ant-CVvy4SuO.js} +1 -1
  53. package/dist/chunks/api-CI8HXREw.js +1 -0
  54. package/dist/chunks/api-gJBnC8z3.js +1 -0
  55. package/dist/chunks/asciicast-BsWpcxrc.js +1 -0
  56. package/dist/chunks/{asciicast-CQJlNTae.js → asciicast-CbAjUHT_.js} +4 -4
  57. package/dist/chunks/{assistant-z1ojxEET.js → assistant-C_SkUDk_.js} +1 -1
  58. package/dist/chunks/auth-B9V3i5oZ.js +1 -0
  59. package/dist/chunks/auth-CgEABs3i.js +15 -0
  60. package/dist/chunks/auth-fSFfSKy_.js +1 -0
  61. package/dist/chunks/{autoMode-DW_H3i37.js → autoMode-CZyb-mMY.js} +5 -5
  62. package/dist/chunks/{autonomy-46hnmyAi.js → autonomy-BpINX4jw.js} +1 -1
  63. package/dist/chunks/{autonomy-OxhciwYa.js → autonomy-DJZ25xZp.js} +7 -7
  64. package/dist/chunks/{autonomyPanel-CTEjq0Bd.js → autonomyPanel-ssoiIOx5.js} +1 -1
  65. package/dist/chunks/{backgroundHousekeeping-Cpxq4krt.js → backgroundHousekeeping-BHncba6e.js} +3 -3
  66. package/dist/chunks/backgroundHousekeeping-QK8iEXoI.js +1 -0
  67. package/dist/chunks/{banner-BVkLvJiB.js → banner-CWkrK10u.js} +1 -1
  68. package/dist/chunks/bg-B0iMGM9C.js +1 -0
  69. package/dist/chunks/{bg-zWGqkcST.js → bg-WnYN5ifx.js} +2 -2
  70. package/dist/chunks/{branch-DJzijRGm.js → branch-BXo5z2al.js} +1 -1
  71. package/dist/chunks/{bridge-Dpr2AWpc.js → bridge-CbKc1HeD.js} +2 -2
  72. package/dist/chunks/bridgeConfig-CLHy-BiF.js +1 -0
  73. package/dist/chunks/{bridgeConfig-DDF3teRE.js → bridgeConfig-DbqUHe0H.js} +1 -1
  74. package/dist/chunks/bridgeEnabled-BWSUZ7Xg.js +1 -0
  75. package/dist/chunks/{bridgeEnabled-D4JDZd0y.js → bridgeEnabled-CM3SaumJ.js} +1 -1
  76. package/dist/chunks/bridgeMain-BESKzpm0.js +1 -0
  77. package/dist/chunks/bridgeMain-CzhBVCsN.js +68 -0
  78. package/dist/chunks/bridgeMessaging-lfa_v3oi.js +1 -0
  79. package/dist/chunks/bridgePointer-MqLe5Asm.js +1 -0
  80. package/dist/chunks/{browser-BKiu1max.js → browser-BmZuQom6.js} +1 -1
  81. package/dist/chunks/{btw-DG9CCeq4.js → btw-Cp0whJaJ.js} +1 -1
  82. package/dist/chunks/{caches-BB5_91gU.js → caches-CmW7idg5.js} +2 -2
  83. package/dist/chunks/caches-CpqTC0Lb.js +1 -0
  84. package/dist/chunks/ccrClient-BPXmxWHw.js +1 -0
  85. package/dist/chunks/{claudeDesktop-9xfIgkzE.js → claudeDesktop-Cx31Ugjp.js} +1 -1
  86. package/dist/chunks/{clear-ueMvDelv.js → clear-DjGPxX7T.js} +1 -1
  87. package/dist/chunks/{cliLaunch-BJ9o-rIV.js → cliLaunch-BkPAatcs.js} +1 -1
  88. package/dist/chunks/client-DPUvQ6Rf.js +1 -0
  89. package/dist/chunks/{color-B0-MIfsq.js → color-DYYBN52b.js} +1 -1
  90. package/dist/chunks/commands-D7l3P1k9.js +1 -0
  91. package/dist/chunks/commitAttribution-B7NUPJ8E.js +1 -0
  92. package/dist/chunks/{commitAttribution-DKun9CeU.js → commitAttribution-Bmzgtqc6.js} +2 -2
  93. package/dist/chunks/compact-D6xqZN4Q.js +2 -0
  94. package/dist/chunks/{completionCache-CdHCuiqq.js → completionCache-MN3_MqK8.js} +2 -2
  95. package/dist/chunks/completionCache-c4aiyZ_f.js +1 -0
  96. package/dist/chunks/config-DiT2Z8dY.js +3 -0
  97. package/dist/chunks/config-huQaTcNb.js +1 -0
  98. package/dist/chunks/config-qLaiAn7z.js +1 -0
  99. package/dist/chunks/{context-DBswG0EY.js → context-Bh_iUj76.js} +1 -1
  100. package/dist/chunks/context-noninteractive-CNot6jbs.js +1 -0
  101. package/dist/chunks/{context-noninteractive-CTvyNimw.js → context-noninteractive-Cb3EM2Oz.js} +2 -2
  102. package/dist/chunks/conversation-CSpwF3Ha.js +1 -0
  103. package/dist/chunks/conversation-CvCQta8e.js +1 -0
  104. package/dist/chunks/{createSSHSession-BdO35H6o.js → createSSHSession-B0s839mX.js} +5 -5
  105. package/dist/chunks/createSession-GNSNbUbN.js +1 -0
  106. package/dist/chunks/{createSession-Br1g8qSD.js → createSession-VMTMXOHu.js} +1 -1
  107. package/dist/chunks/crossProjectResume-DGpgCUfk.js +40 -0
  108. package/dist/chunks/{daemon-BQiSFjc-.js → daemon-YtZbMQtn.js} +1 -1
  109. package/dist/chunks/datadog-D9rlcN12.js +1 -0
  110. package/dist/chunks/{debug-DiuXEmUq.js → debug-BrXObCdR.js} +1 -1
  111. package/dist/chunks/{debugUtils-3YYWvb3H.js → debugUtils-NO5KtXqi.js} +1 -1
  112. package/dist/chunks/{desktop-W7SA8BFk.js → desktop-DidI-4N5.js} +1 -1
  113. package/dist/chunks/{detached-Cv9gAylK.js → detached-TYk4hMFj.js} +1 -1
  114. package/dist/chunks/{detectRepository-B1PMTLAU.js → detectRepository-BPr0VWNO.js} +1 -1
  115. package/dist/chunks/detectRepository-BTPgN89l.js +1 -0
  116. package/dist/chunks/{diff-CMtRjFUb.js → diff-CZg5qL2n.js} +1 -1
  117. package/dist/chunks/{directoryCompletion-CeV63gvu.js → directoryCompletion-CW2ckkQg.js} +1 -1
  118. package/dist/chunks/doctor-CKUXGCri.js +1 -0
  119. package/dist/chunks/{effort-BAlVDBHq.js → effort-BcvNemuq.js} +2 -2
  120. package/dist/chunks/{entry-DLqeVq5C.js → entry-dA1UCfC0.js} +4 -4
  121. package/dist/chunks/envLessBridgeConfig-BFjJ8Kt4.js +1 -0
  122. package/dist/chunks/envLessBridgeConfig-bei51W3H.js +1 -0
  123. package/dist/chunks/esm-DjGYYlQe.js +1 -0
  124. package/dist/chunks/{execFileNoThrow-DResQRvR.js → execFileNoThrow-D244NytW.js} +1 -1
  125. package/dist/chunks/execSyncWrapper-CCMQShK-.js +1 -0
  126. package/dist/chunks/exit-COMnVxzw.js +1 -0
  127. package/dist/chunks/extra-usage-BTv_OwGN.js +1 -0
  128. package/dist/chunks/extra-usage-By33zGLT.js +1 -0
  129. package/dist/chunks/{extra-usage-core-Dh4rVUI-.js → extra-usage-core-RZMzaH0L.js} +1 -1
  130. package/dist/chunks/{extra-usage-noninteractive-D4Ya5KPm.js → extra-usage-noninteractive-BB-BQ3kh.js} +1 -1
  131. package/dist/chunks/{extraUsage-DtWi8E78.js → extraUsage-CTn9FWSk.js} +1 -1
  132. package/dist/chunks/extractMemories-CXGZGe0h.js +1 -0
  133. package/dist/chunks/fast-BXzdzzXU.js +1 -0
  134. package/dist/chunks/{fast-DkUxqWhE.js → fast-CNXgsvnE.js} +1 -1
  135. package/dist/chunks/{feedback-Cn7Sbqxa.js → feedback-DeJ2gvw2.js} +1 -1
  136. package/dist/chunks/{file-BZriE-XU.js → file-DcZWPH2V.js} +5 -5
  137. package/dist/chunks/firstPartyEventLogger-CQdJn3LV.js +5 -0
  138. package/dist/chunks/firstPartyEventLogger-CdLshdJY.js +1 -0
  139. package/dist/chunks/{flushGate-ebqQZF1t.js → flushGate-CJ73xcaK.js} +1 -1
  140. package/dist/chunks/gemini-Cn9bMXwP.js +1 -0
  141. package/dist/chunks/generateRecap-BO9kzRon.js +1 -0
  142. package/dist/chunks/{generateSessionName-DEAw5x_h.js → generateSessionName-CGpL6ATy.js} +1 -1
  143. package/dist/chunks/{genericProcessUtils-DO7Fy0RJ.js → genericProcessUtils-CdQTApYX.js} +1 -1
  144. package/dist/chunks/git-CbcnOf0E.js +1 -0
  145. package/dist/chunks/git-Do0wJvux.js +6 -0
  146. package/dist/chunks/{githubRepoPathMapping-Tt-LdYFZ.js → githubRepoPathMapping-C4umZ1oC.js} +1 -1
  147. package/dist/chunks/{goal-DCaI1NPN.js → goal-C8Qzl7_i.js} +3 -3
  148. package/dist/chunks/{grok-CKlngG3b.js → grok-CDT9P_BL.js} +1 -1
  149. package/dist/chunks/{grove-DSWe6psK.js → grove-BGXzEyH9.js} +2 -2
  150. package/dist/chunks/{heapdump-OVbV05On.js → heapdump-CFHvdSZv.js} +5 -5
  151. package/dist/chunks/{help-CRtX5VX9.js → help-DUZ7Y7Em.js} +1 -1
  152. package/dist/chunks/{hooks-tpf90xd5.js → hooks-RHwUCXcT.js} +2 -2
  153. package/dist/chunks/hooks-fZ1r0jUF.js +1 -0
  154. package/dist/chunks/{hostGuard-t7QfbijF.js → hostGuard-C5xydXZI.js} +1 -1
  155. package/dist/chunks/inboundAttachments-Cfl4_n0S.js +1 -0
  156. package/dist/chunks/inboundAttachments-YMxf4fmR.js +1 -0
  157. package/dist/chunks/initReplBridge-GH3-LHF4.js +1 -0
  158. package/dist/chunks/install-OkuNmjmB.js +1 -0
  159. package/dist/chunks/{instrumentation--Sx0y1Gk.js → instrumentation-hrXeo-G4.js} +6 -6
  160. package/dist/chunks/{job-D7B35Usp.js → job-DjmIpwJl.js} +1 -1
  161. package/dist/chunks/jwtUtils-DE2GPUcx.js +1 -0
  162. package/dist/chunks/keybindings-B8U17bhs.js +2 -0
  163. package/dist/chunks/{language-8Rnu_qxl.js → language-BA5WprZv.js} +1 -1
  164. package/dist/chunks/language-BbaOTWm3.js +1 -0
  165. package/dist/chunks/{launchAgentsPlatform-CNPkOVzu.js → launchAgentsPlatform-DnxH2SAn.js} +1 -1
  166. package/dist/chunks/{launchLocalMemory-BxmDhENs.js → launchLocalMemory-CgXtGng1.js} +2 -2
  167. package/dist/chunks/{launchLocalVault-DQlTGA-g.js → launchLocalVault-Bs6Km3Ua.js} +3 -3
  168. package/dist/chunks/{launchMemoryStores-EYAwxI8i.js → launchMemoryStores-DxVAIJuB.js} +1 -1
  169. package/dist/chunks/{launchOnboarding-CTu5Zf4E.js → launchOnboarding-Cn0t_o2k.js} +1 -1
  170. package/dist/chunks/{launchSchedule-CeHHSvO7.js → launchSchedule-Chwr3Nzd.js} +1 -1
  171. package/dist/chunks/{launchSkillStore-Bqh2Fru2.js → launchSkillStore-6zxJfWVU.js} +1 -1
  172. package/dist/chunks/{launchTeleport-Crc3XVZX.js → launchTeleport-Ba_Hj13c.js} +1 -1
  173. package/dist/chunks/{launchVault-BHLgpth_.js → launchVault-hGVrHy33.js} +1 -1
  174. package/dist/chunks/{v4-jw6qOKwQ.js → lazySchema-DcIJE_0i.js} +1 -1
  175. package/dist/chunks/loadAgentsDir-BHOyHxwz.js +1 -0
  176. package/dist/chunks/{loadAgentsDir-ZQwvbURI.js → loadAgentsDir-DrDu5yYy.js} +685 -683
  177. package/dist/chunks/loadPluginHooks-s7bvGtns.js +1 -0
  178. package/dist/chunks/localSearch-CebU5BA9.js +1 -0
  179. package/dist/chunks/{localSearch-H0LchlTi.js → localSearch-_bQhk9W6.js} +1 -1
  180. package/dist/chunks/{log-Duzb4o6h.js → log-BMCygSzM.js} +1 -1
  181. package/dist/chunks/{logoV2Utils-5lcUu53m.js → logoV2Utils-CoC4nheD.js} +1 -1
  182. package/dist/chunks/{magicDocs-D1FIPmYg.js → magicDocs-kMjYpjCA.js} +3 -3
  183. package/dist/chunks/{main-B8XtFN2P.js → main-C_rVSWfm.js} +78 -78
  184. package/dist/chunks/{main-CR7cXdgy.js → main-D862LI_d.js} +2 -2
  185. package/dist/chunks/{mappers-DKU4RgE3.js → mappers-D0CNXG32.js} +1 -1
  186. package/dist/chunks/mcp-1ZuFesM9.js +2 -0
  187. package/dist/chunks/mcp-CKvGBEjz.js +1 -0
  188. package/dist/chunks/mcp-DtxIl6aN.js +6 -0
  189. package/dist/chunks/{memoize-DgMjqLtn.js → memoize-B0zhbT8Z.js} +1 -1
  190. package/dist/chunks/{memory-D-Q62bJ7.js → memory-DE2jtkd_.js} +1 -1
  191. package/dist/chunks/{mode-DFZgqKBd.js → mode-B4WIxCMW.js} +2 -2
  192. package/dist/chunks/model-C4RHNhDQ.js +1 -0
  193. package/dist/chunks/model-fi472PRc.js +1 -0
  194. package/dist/chunks/{model-fDWtIRVr.js → model-j9GNZDFr.js} +1 -1
  195. package/dist/chunks/nativeInstaller-DktvrWRd.js +1 -0
  196. package/dist/chunks/{onChangeAppState-DaQ0R9Tw.js → onChangeAppState-CGVeNkt7.js} +1 -1
  197. package/dist/chunks/{openai-DNS0-ivj.js → openai-BSVjSJiF.js} +3 -3
  198. package/dist/chunks/{overageCreditGrant-qHN3tnp2.js → overageCreditGrant-BVxlYgeU.js} +1 -1
  199. package/dist/chunks/{panelCall-BvKpHquo.js → panelCall-Cp6fpQeL.js} +1 -1
  200. package/dist/chunks/parser-Bf6iasPV.js +1 -0
  201. package/dist/chunks/{parser-TYEkLFgh.js → parser-DFwaTGf7.js} +1 -1
  202. package/dist/chunks/{partition-Cv11dD5P.js → partition-RjCtgt9J.js} +1 -1
  203. package/dist/chunks/{passes-DQdM2Ssq.js → passes-ByTLy6pj.js} +1 -1
  204. package/dist/chunks/{path-Cu_AKqg6.js → path-D5U-tm91.js} +1 -1
  205. package/dist/chunks/permissions-B3df_htx.js +3 -0
  206. package/dist/chunks/pidLock-CdNZ0Wfg.js +3 -0
  207. package/dist/chunks/{pipeTransport-7GIO6GCA.js → pipeTransport-CqCnc-Ys.js} +1 -1
  208. package/dist/chunks/{plan-D8dQDl8W.js → plan-BxTA-b4l.js} +1 -1
  209. package/dist/chunks/{platform-B5dCGT8t.js → platform-BrYefG_2.js} +1 -1
  210. package/dist/chunks/{plugin-w8MqsKHn.js → plugin-DOpl5e1t.js} +1 -1
  211. package/dist/chunks/{pluginAutoupdate-7FFHzSRz.js → pluginAutoupdate-L09CQ-ph.js} +1 -1
  212. package/dist/chunks/pluginBlocklist-B32eWmzn.js +1 -0
  213. package/dist/chunks/pluginCliCommands-CDMWnO3d.js +1 -0
  214. package/dist/chunks/{pluginFlagging-_WUQP3Lq.js → pluginFlagging-3FQGvIfq.js} +1 -1
  215. package/dist/chunks/pluginOperations-ClzXYNQe.js +2 -0
  216. package/dist/chunks/{pluginStartupCheck-BelpzwZI.js → pluginStartupCheck-BNd2QNzZ.js} +1 -1
  217. package/dist/chunks/pluginStartupCheck-RiZxW-WU.js +1 -0
  218. package/dist/chunks/plugins-CcDG95Bs.js +4 -0
  219. package/dist/chunks/policyLimits-Bwi9VqDF.js +1 -0
  220. package/dist/chunks/pollConfig-DH2oCtFS.js +1 -0
  221. package/dist/chunks/{poor-D3T_8wwf.js → poor-DekfGNT7.js} +1 -1
  222. package/dist/chunks/poorMode-AE4WNYZo.js +1 -0
  223. package/dist/chunks/{poorMode-BqyVuBu-.js → poorMode-CtcqaiwD.js} +1 -1
  224. package/dist/chunks/print-Cc_QOSPF.js +23 -0
  225. package/dist/chunks/{privacy-settings-D5zxu4Aa.js → privacy-settings-ChNsgGUs.js} +1 -1
  226. package/dist/chunks/processBashCommand-Bx6_oZoE.js +1 -0
  227. package/dist/chunks/processSlashCommand-AltWgIFt.js +5 -0
  228. package/dist/chunks/prompt-C0nU0VK3.js +139 -0
  229. package/dist/chunks/prompt-CYx145pp.js +1 -0
  230. package/dist/chunks/prompt-DH3lKFag.js +1 -0
  231. package/dist/chunks/{promptEditor-D6HzjcMS.js → promptEditor-Cumef6hJ.js} +2 -2
  232. package/dist/chunks/{protocolHandler-BXlx1N7v.js → protocolHandler-z2zxAtB1.js} +4 -4
  233. package/dist/chunks/{proxy-CHnxhNZI.js → proxy-CRN7jYIi.js} +3 -3
  234. package/dist/chunks/{rate-limit-options-1hc-RyNR.js → rate-limit-options-VL7S3SCx.js} +1 -1
  235. package/dist/chunks/rcDebugLog-2-1XSyFV.js +11 -0
  236. package/dist/chunks/reconciler-DHRE_gV2.js +4 -0
  237. package/dist/chunks/{referral-Cu9bEOFE.js → referral-DrebVwqx.js} +1 -1
  238. package/dist/chunks/{refresh-vJbxW4a1.js → refresh-pFezssA8.js} +1 -1
  239. package/dist/chunks/{registerProtocol-B_XbLDQO.js → registerProtocol-CukLQuxJ.js} +3 -3
  240. package/dist/chunks/{release-notes-CavWoMQR.js → release-notes-D7vrFNXp.js} +1 -1
  241. package/dist/chunks/{releaseNotes-Di6OaHF7.js → releaseNotes-CDx2P0fb.js} +2 -2
  242. package/dist/chunks/{reload-plugins-ofeLn07p.js → reload-plugins-CltHfg-l.js} +1 -1
  243. package/dist/chunks/{remote-env-dXzHAuD6.js → remote-env-SvvSuP0J.js} +1 -1
  244. package/dist/chunks/remoteBridgeCore-BOeljn2c.js +1 -0
  245. package/dist/chunks/remoteManagedSettings-CaY_ZH8r.js +1 -0
  246. package/dist/chunks/{rename-CtjP0lop.js → rename-CbqrCCBO.js} +1 -1
  247. package/dist/chunks/{renderOptions-DOXmueQV.js → renderOptions-BUJB9nAm.js} +1 -1
  248. package/dist/chunks/{resume-C5h5JvY1.js → resume-DockJaY9.js} +2 -2
  249. package/dist/chunks/{ripgrep-BN_g-F7X.js → ripgrep-BXmXjAzA.js} +1 -1
  250. package/dist/chunks/ripgrep-BfIpz5uC.js +1 -0
  251. package/dist/chunks/{runtimeObserver-DOZFrqJu.js → runtimeObserver-DSUuYKfs.js} +1 -1
  252. package/dist/chunks/{runtimeObserver-B93v1AxE.js → runtimeObserver-XufSllVw.js} +4 -4
  253. package/dist/chunks/sandbox-adapter-CEZnHq0U.js +1 -0
  254. package/dist/chunks/{sandbox-toggle-TiLGFwaZ.js → sandbox-toggle-CZI5fuK3.js} +1 -1
  255. package/dist/chunks/searchExtraTools-iQfI39wB.js +1 -0
  256. package/dist/chunks/{session-v9tKHhU9.js → session-B-Z3DU9o.js} +2 -2
  257. package/dist/chunks/{sessionDiscovery-4byQKOnc.js → sessionDiscovery-C3pMZkBM.js} +1 -1
  258. package/dist/chunks/sessionFileAccessHooks-DyrZmoA7.js +1 -0
  259. package/dist/chunks/sessionMemory-CqRpgwtU.js +1 -0
  260. package/dist/chunks/sessionMemory-D_HQmhj7.js +1 -0
  261. package/dist/chunks/sessionMemoryUtils-CZOIKrn0.js +1 -0
  262. package/dist/chunks/sessionObserver-B400YG3s.js +1 -0
  263. package/dist/chunks/{sessionObserver-OgY9BUP4.js → sessionObserver-B_09FQKV.js} +1 -1
  264. package/dist/chunks/sessionStorage-DRnvtrpU.js +1 -0
  265. package/dist/chunks/sessionTitle-CmLWNFuX.js +14 -0
  266. package/dist/chunks/{sessionTracing-BBxhPccY.js → sessionTracing-lArOaj9u.js} +3 -3
  267. package/dist/chunks/settings-DfWP5y6X.js +19 -0
  268. package/dist/chunks/settingsSync-BlDk6rsM.js +1 -0
  269. package/dist/chunks/setup-DdbmxSZh.js +3 -0
  270. package/dist/chunks/{shadowedRuleDetection-DDSOFi1W.js → shadowedRuleDetection-E2wF1UjU.js} +1 -1
  271. package/dist/chunks/{shellQuote-yXoC_y5m.js → shellQuote-DkSy9MYE.js} +1 -1
  272. package/dist/chunks/{sideQuestion-CAiA6jAf.js → sideQuestion-BjHCLSR9.js} +1 -1
  273. package/dist/chunks/sinks-Cb--pqr-.js +2 -0
  274. package/dist/chunks/sinks-DbwDBd-E.js +1 -0
  275. package/dist/chunks/{skill-learning-Dx1o4mMo.js → skill-learning-B0dyBT1_.js} +1 -1
  276. package/dist/chunks/skillChangeDetector-DQof8SUY.js +1 -0
  277. package/dist/chunks/{skillGapStore-Zvqiyxds.js → skillGapStore-75ZYlfwi.js} +2 -2
  278. package/dist/chunks/{skillGapStore-BV_6qzxU.js → skillGapStore-D2fqmnKx.js} +1 -1
  279. package/dist/chunks/{skillGenerator-jJQDphQ8.js → skillGenerator-CwXUfM4Y.js} +2 -2
  280. package/dist/chunks/{skillLearning-BTT3_yGc.js → skillLearning-CB-5fdMl.js} +1 -1
  281. package/dist/chunks/skillLearning-CSY5R5Jn.js +1 -0
  282. package/dist/chunks/{skillPanel-OW2M6SZr.js → skillPanel-Bum7xpgo.js} +3 -3
  283. package/dist/chunks/{skillSearchPanel-C0Y56c5N.js → skillSearchPanel-LSPwZIOw.js} +4 -4
  284. package/dist/chunks/{skills-BFsyLP33.js → skills-G8WBeffd.js} +1 -1
  285. package/dist/chunks/startupProfiler-DIWVcO4e.js +1 -0
  286. package/dist/chunks/{startupProfiler-BquH_Yqm.js → startupProfiler-xa3NmN7Z.js} +2 -2
  287. package/dist/chunks/{stats-CrPmPT8f.js → stats-DmFubHpI.js} +1 -1
  288. package/dist/chunks/{status-DHJbK4pV.js → status-ClSsvm1N.js} +2 -2
  289. package/dist/chunks/{status-BO5J2MAe.js → status-i5beKggW.js} +1 -1
  290. package/dist/chunks/{statusNoticeHelpers-CqeUBySi.js → statusNoticeHelpers-BK-54uGY.js} +1 -1
  291. package/dist/chunks/{stickers-BLFmyHZV.js → stickers-D5teCKMN.js} +1 -1
  292. package/dist/chunks/{stringUtils-D_g2L6A4.js → stringUtils-DGLPkqJ4.js} +1 -1
  293. package/dist/chunks/{tag-M2AEtXjW.js → tag-DYYq4H_i.js} +2 -2
  294. package/dist/chunks/{tasks-CoOs_Qkj.js → tasks-BySzm_YJ.js} +1 -1
  295. package/dist/chunks/teleport-dxtBcM01.js +1 -0
  296. package/dist/chunks/{templateJobs-Cl50Qw0s.js → templateJobs-CT5VxeRr.js} +1 -1
  297. package/dist/chunks/terminalSetup-BNs9nLbT.js +33 -0
  298. package/dist/chunks/{terminalSetup-Bdh9K31U.js → terminalSetup-RDKg8dVa.js} +1 -1
  299. package/dist/chunks/{theme-DgCIr0jU.js → theme-CVTVsRwt.js} +1 -1
  300. package/dist/chunks/thinkback-B-GpXG9U.js +1 -0
  301. package/dist/chunks/{thinkback-ERCQ86CR.js → thinkback-CXsRbDYN.js} +1 -1
  302. package/dist/chunks/thinkback-play-BhfCaIye.js +1 -0
  303. package/dist/chunks/{tmux-ZZk68JBq.js → tmux-BY7IdQ1f.js} +1 -1
  304. package/dist/chunks/{toolEventObserver-9XCQXiMx.js → toolEventObserver--4fqXxQZ.js} +1 -1
  305. package/dist/chunks/{toolEventObserver-9-5Ne25Z.js → toolEventObserver-DdhPsAs1.js} +1 -1
  306. package/dist/chunks/toolPool-DvHECcbN.js +1 -0
  307. package/dist/chunks/trustedDevice-DvpN4J1F.js +1 -0
  308. package/dist/chunks/trustedDevice-e6iF1X7C.js +1 -0
  309. package/dist/chunks/{types-Cnorfsss.js → types-C-MRCL8J.js} +3 -3
  310. package/dist/chunks/udsClient-BuCtv7dN.js +1 -0
  311. package/dist/chunks/{ultrareviewCommand-BMBHepdu.js → ultrareviewCommand-i3PfFKly.js} +2 -2
  312. package/dist/chunks/undercover-CPvoDtJ1.js +1 -0
  313. package/dist/chunks/{undercover-DDgIKbO5.js → undercover-Q24TWRw0.js} +1 -1
  314. package/dist/chunks/{up-D6bNw_tT.js → up-BHkC97_C.js} +1 -1
  315. package/dist/chunks/updateCCB-CEXA6dax.js +11 -0
  316. package/dist/chunks/{upgrade-BN20nsCH.js → upgrade-7OrBbrzS.js} +1 -1
  317. package/dist/chunks/upgrade-uR7SIVtx.js +1 -0
  318. package/dist/chunks/upload-B-lNHpWe.js +1 -0
  319. package/dist/chunks/{upstreamproxy-os5rw0Vg.js → upstreamproxy-DyR_eXO8.js} +4 -4
  320. package/dist/chunks/usage-7jOeIVv9.js +1 -0
  321. package/dist/chunks/{usage-D_sqm8us.js → usage-CZdPfUqP.js} +1 -1
  322. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-vzUoPY51.js → useExitOnCtrlCDWithKeybindings-CzFtdlnD.js} +1 -1
  323. package/dist/chunks/useMainLoopModel-DegH12LZ.js +1 -0
  324. package/dist/chunks/useManagePlugins-BkK1zydO.js +1 -0
  325. package/dist/chunks/{useMergedTools-Bb4XbC9d.js → useMergedTools-DMGRA1ga.js} +1 -1
  326. package/dist/chunks/{useSearchInput-B1UOjxAI.js → useSearchInput-D5VU9IDU.js} +1 -1
  327. package/dist/chunks/{useSettingsErrors-BLbvu4--.js → useSettingsErrors-B5PSF1va.js} +1 -1
  328. package/dist/chunks/{util-CxlfALM4.js → util-CNa1ib_4.js} +1 -1
  329. package/dist/chunks/validatePlugin-Dw-RGCrm.js +1 -0
  330. package/dist/chunks/{vim-DLWBHwVM.js → vim-C0KTnJJs.js} +1 -1
  331. package/dist/chunks/{which-sEFQXpaX.js → which-CKQnSouy.js} +1 -1
  332. package/dist/chunks/windowsPaths-9pEkw0oV.js +1 -0
  333. package/dist/chunks/windowsPaths-DtapVxOo.js +1 -0
  334. package/dist/chunks/{workSecret-DvniZR71.js → workSecret-CNWiR2uQ.js} +1 -1
  335. package/dist/chunks/{workerRegistry-CFnGtb3L.js → workerRegistry-B2QD2sKq.js} +1 -1
  336. package/dist/chunks/worktree-D38cJ23W.js +1 -0
  337. package/dist/cli.js +1 -1
  338. package/package.json +4 -5
  339. package/dist/chunks/ApproveApiKey-CQsQdQBC.js +0 -1
  340. package/dist/chunks/BackgroundTasksDialog-AiVi-1pI.js +0 -2
  341. package/dist/chunks/ClaudeMdExternalIncludesDialog-DUu6iRJk.js +0 -1
  342. package/dist/chunks/ConsoleOAuthFlow-DVTPwR5I.js +0 -1
  343. package/dist/chunks/Doctor-BXhz8eUa.js +0 -3
  344. package/dist/chunks/Doctor-D75dsEyb.js +0 -1
  345. package/dist/chunks/ExitFlow-B1XNACQP.js +0 -2
  346. package/dist/chunks/Feedback-Cvz80lAn.js +0 -2
  347. package/dist/chunks/Grove-B7hhBvFw.js +0 -1
  348. package/dist/chunks/MCPConnectionManager-BLfKm4H2.js +0 -1
  349. package/dist/chunks/MessageSelector-DmKtBYX9.js +0 -3
  350. package/dist/chunks/Messages-CaFdI1kk.js +0 -11
  351. package/dist/chunks/PluginSettings-0FSNch8O.js +0 -17
  352. package/dist/chunks/QueryEngine-WYDWzQuY.js +0 -1
  353. package/dist/chunks/REPL-vV_jzAVx.js +0 -1
  354. package/dist/chunks/ResumeConversation-g_JyOWbl.js +0 -1
  355. package/dist/chunks/SearchExtraToolsTool-Daedym7_.js +0 -1
  356. package/dist/chunks/Settings-DUXA-qac.js +0 -2
  357. package/dist/chunks/TrustDialog-CdZS9t-T.js +0 -1
  358. package/dist/chunks/ajv-5vMo9UcX.js +0 -8
  359. package/dist/chunks/api-CLLIHLpn.js +0 -1
  360. package/dist/chunks/api-DMpNA1s8.js +0 -1
  361. package/dist/chunks/asciicast-BIr75_x9.js +0 -1
  362. package/dist/chunks/auth-Ce0jllLf.js +0 -1
  363. package/dist/chunks/auth-DV3P8Qup.js +0 -1
  364. package/dist/chunks/auth-DpFfHy1W.js +0 -15
  365. package/dist/chunks/backgroundHousekeeping-BycL9lOe.js +0 -1
  366. package/dist/chunks/bg-H849G7Sc.js +0 -1
  367. package/dist/chunks/bridgeConfig-CcANVX0P.js +0 -1
  368. package/dist/chunks/bridgeEnabled-Cn-u7P4_.js +0 -1
  369. package/dist/chunks/bridgeMain-CtgVyLjI.js +0 -68
  370. package/dist/chunks/bridgeMain-Dh0gWRVo.js +0 -1
  371. package/dist/chunks/bridgeMessaging-CRG6HqUb.js +0 -1
  372. package/dist/chunks/bridgePointer-Cug5fQ3e.js +0 -1
  373. package/dist/chunks/caches-C3NINY3K.js +0 -1
  374. package/dist/chunks/ccrClient-CRXGlUCe.js +0 -1
  375. package/dist/chunks/client-AnWHs0gW.js +0 -1
  376. package/dist/chunks/commands-DsKH3ogN.js +0 -1
  377. package/dist/chunks/commitAttribution-D7NrwLhc.js +0 -1
  378. package/dist/chunks/compact-BhWCO-oD.js +0 -2
  379. package/dist/chunks/completionCache-C9zlWBRz.js +0 -1
  380. package/dist/chunks/config-662VDD70.js +0 -3
  381. package/dist/chunks/config-CUN8YbOa.js +0 -1
  382. package/dist/chunks/config-DklnhNx1.js +0 -1
  383. package/dist/chunks/config-Wk3svGdH.js +0 -1
  384. package/dist/chunks/context-noninteractive-C3dICmA9.js +0 -1
  385. package/dist/chunks/conversation-CooSju3g.js +0 -1
  386. package/dist/chunks/conversation-DLLIOKYV.js +0 -1
  387. package/dist/chunks/createSession-CVG8SiEm.js +0 -1
  388. package/dist/chunks/crossProjectResume-DiKJb83I.js +0 -40
  389. package/dist/chunks/datadog-BE6D_6m0.js +0 -1
  390. package/dist/chunks/datadog-C69i7cfI.js +0 -1
  391. package/dist/chunks/debug-8kgDrUfj.js +0 -1
  392. package/dist/chunks/detectRepository-_Kj817Vi.js +0 -1
  393. package/dist/chunks/doctor-DEz8BHAz.js +0 -1
  394. package/dist/chunks/envLessBridgeConfig-3kCrKZl7.js +0 -1
  395. package/dist/chunks/envLessBridgeConfig-BfgXw47_.js +0 -1
  396. package/dist/chunks/esm-C8Zkk1Ux.js +0 -1
  397. package/dist/chunks/execSyncWrapper-CWxMek26.js +0 -1
  398. package/dist/chunks/exit-cyepwuyy.js +0 -1
  399. package/dist/chunks/extra-usage-DlFeNGQD.js +0 -1
  400. package/dist/chunks/extra-usage-nRFfBiXh.js +0 -1
  401. package/dist/chunks/extractMemories-BqN8fWZ5.js +0 -1
  402. package/dist/chunks/fast-NvqW2-t1.js +0 -1
  403. package/dist/chunks/firstPartyEventLogger-AhXYSrkP.js +0 -1
  404. package/dist/chunks/firstPartyEventLogger-BQYrBdvD.js +0 -5
  405. package/dist/chunks/gemini-Sr_00TsL.js +0 -1
  406. package/dist/chunks/generateRecap-5d4l_ODy.js +0 -1
  407. package/dist/chunks/git-Cc1jAz6r.js +0 -1
  408. package/dist/chunks/git-Cgc8X5l2.js +0 -6
  409. package/dist/chunks/hooks-DvtnNoYE.js +0 -1
  410. package/dist/chunks/inboundAttachments-BZ6MKpxd.js +0 -1
  411. package/dist/chunks/inboundAttachments-D5Ux2kCl.js +0 -1
  412. package/dist/chunks/initReplBridge-CjuO6in6.js +0 -1
  413. package/dist/chunks/install-DqpM2brU.js +0 -1
  414. package/dist/chunks/jwtUtils-CqXPjf-a.js +0 -1
  415. package/dist/chunks/keybindings-JvAmBpLt.js +0 -2
  416. package/dist/chunks/language-DaxZe0Xw.js +0 -1
  417. package/dist/chunks/lazySchema-uxlVVNM1.js +0 -1
  418. package/dist/chunks/loadAgentsDir-D7npVvsj.js +0 -1
  419. package/dist/chunks/loadPluginHooks-CaKvZVZI.js +0 -1
  420. package/dist/chunks/localSearch-BU5oulbF.js +0 -1
  421. package/dist/chunks/mcp-B06Mqsur.js +0 -6
  422. package/dist/chunks/mcp-C0AjA07u.js +0 -1
  423. package/dist/chunks/mcp-ghioDl7W.js +0 -2
  424. package/dist/chunks/metadata-CIx5CsoY.js +0 -1
  425. package/dist/chunks/model-BgrLt7P7.js +0 -1
  426. package/dist/chunks/model-aVc5c3Lz.js +0 -1
  427. package/dist/chunks/nativeInstaller-DKe1pWoL.js +0 -1
  428. package/dist/chunks/parser-Bj3gOqFv.js +0 -1
  429. package/dist/chunks/permissions-DB_2mmCl.js +0 -3
  430. package/dist/chunks/pidLock-DchmaAK6.js +0 -3
  431. package/dist/chunks/pluginBlocklist-Cw_l-yal.js +0 -1
  432. package/dist/chunks/pluginCliCommands-BtYWRxhS.js +0 -1
  433. package/dist/chunks/pluginOperations-BOkST1qE.js +0 -2
  434. package/dist/chunks/pluginStartupCheck-XBLJZZys.js +0 -1
  435. package/dist/chunks/plugins-6px6K1fh.js +0 -4
  436. package/dist/chunks/policyLimits-C07tQ0Wr.js +0 -1
  437. package/dist/chunks/pollConfig-C2Ac8WMU.js +0 -1
  438. package/dist/chunks/poorMode-BdBDiOFD.js +0 -1
  439. package/dist/chunks/print-DcQSuK0v.js +0 -23
  440. package/dist/chunks/processBashCommand-CEqA4QZi.js +0 -1
  441. package/dist/chunks/processSlashCommand-DMpFk59M.js +0 -5
  442. package/dist/chunks/prompt-CKvoqUC3.js +0 -1
  443. package/dist/chunks/prompt-aXZPR3q8.js +0 -1
  444. package/dist/chunks/prompt-wys9CwDo.js +0 -132
  445. package/dist/chunks/rcDebugLog-CivJaJ3V.js +0 -11
  446. package/dist/chunks/reconciler-BKX4jh34.js +0 -4
  447. package/dist/chunks/remoteBridgeCore-CmwkjiTK.js +0 -1
  448. package/dist/chunks/remoteManagedSettings-Co-CxR67.js +0 -1
  449. package/dist/chunks/ripgrep-hOjrgpMp.js +0 -1
  450. package/dist/chunks/sandbox-adapter-CO5GuywY.js +0 -1
  451. package/dist/chunks/searchExtraTools-CXZJU2Kv.js +0 -1
  452. package/dist/chunks/sessionFileAccessHooks-BUyIQVzL.js +0 -1
  453. package/dist/chunks/sessionMemory-ZsxCLHYd.js +0 -1
  454. package/dist/chunks/sessionMemory-e6YpTUhW.js +0 -1
  455. package/dist/chunks/sessionMemoryUtils-BD_dqyYB.js +0 -1
  456. package/dist/chunks/sessionObserver-DNItJztR.js +0 -1
  457. package/dist/chunks/sessionStorage-xvxpRETp.js +0 -1
  458. package/dist/chunks/sessionTitle-Bph6GO4F.js +0 -14
  459. package/dist/chunks/settings-BhvhCpVh.js +0 -19
  460. package/dist/chunks/settingsSync-D2B5K4BT.js +0 -1
  461. package/dist/chunks/setup-CEnNEK6Z.js +0 -3
  462. package/dist/chunks/sink-CyKOf5TT.js +0 -1
  463. package/dist/chunks/sink-DxPJ4khU.js +0 -1
  464. package/dist/chunks/sinks-BNo3DvxO.js +0 -2
  465. package/dist/chunks/sinks-CHgtwDha.js +0 -1
  466. package/dist/chunks/skillChangeDetector-BRBCwQ2w.js +0 -1
  467. package/dist/chunks/skillLearning-BH7EAU1m.js +0 -1
  468. package/dist/chunks/src-xRRBgNzF.js +0 -25
  469. package/dist/chunks/startupProfiler-CYCH-qos.js +0 -1
  470. package/dist/chunks/stdio-4S7b8Uhx.js +0 -1
  471. package/dist/chunks/stdio-W_Kokrkh.js +0 -3
  472. package/dist/chunks/teleport-DjIgQeBB.js +0 -1
  473. package/dist/chunks/terminalSetup-nvS3KCDG.js +0 -33
  474. package/dist/chunks/thinkback-BSv_fvbV.js +0 -1
  475. package/dist/chunks/thinkback-play-DNB0IWYt.js +0 -1
  476. package/dist/chunks/toolPool-uQKZRMKg.js +0 -1
  477. package/dist/chunks/trustedDevice-0ej6e3nx.js +0 -1
  478. package/dist/chunks/trustedDevice-nqhuw4tp.js +0 -1
  479. package/dist/chunks/udsClient-CiFj4M_h.js +0 -1
  480. package/dist/chunks/undercover-6UUO38fQ.js +0 -1
  481. package/dist/chunks/updateCCB-B-OlpLjA.js +0 -11
  482. package/dist/chunks/upgrade-DYqlCH80.js +0 -1
  483. package/dist/chunks/upload-BQGByiXE.js +0 -1
  484. package/dist/chunks/usage-DolSCKGi.js +0 -1
  485. package/dist/chunks/useMainLoopModel-cZd8EKo5.js +0 -1
  486. package/dist/chunks/useManagePlugins-DgGZBvXV.js +0 -1
  487. package/dist/chunks/validatePlugin-n8a4W_jI.js +0 -1
  488. package/dist/chunks/windowsPaths-BLevJOlm.js +0 -1
  489. package/dist/chunks/windowsPaths-N_YmYY6k.js +0 -1
  490. package/dist/chunks/worktree-Dr_WzlXs.js +0 -1
@@ -1,12 +1,12 @@
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,$y as y,Af as b,Ah as x,Bc as S,Bh as ee,Cf as C,Ef as te,Gg as ne,Hb as w,Hd as re,Hn as ie,IS as ae,Jo as oe,KT as se,Kd as ce,LS as le,M_ as ue,Mf as de,N_ as fe,Nb as pe,Nf as me,Oh as he,Pb as ge,Qd as _e,So as ve,Tf as ye,Ud as be,Uh as xe,Un as Se,Vb as T,Vc as Ce,Vh as we,Wg as Te,Wn as Ee,Xd as De,Xu as Oe,Yu as ke,Zd as Ae,_u as je,at as Me,aw as Ne,bf as Pe,c as Fe,dT as Ie,ef as Le,et as Re,ex as ze,fS as Be,hv as Ve,iD as He,iw as Ue,jf as We,kh as Ge,l as Ke,lS as qe,lh as Je,mv as Ye,nt as Xe,o as Ze,of as Qe,qT as $e,qd as et,r as tt,rD as nt,s as rt,sf as it,sh as at,st as ot,t as st,tb as ct,tx as lt,uS as ut,vu as dt,wf as ft,yf as pt,zo as mt}from"./loadAgentsDir-ZQwvbURI.js";import{n as ht,t as gt}from"./cwd-CYmmnQVS.js";import{B as _t,D as vt,E as yt,J as bt,U as xt,Y as St,nt as Ct}from"./debug-DiuXEmUq.js";import{Q as wt,Qt as Tt,_n as Et,ct as Dt,dn as Ot,en as kt,gn as At,ln as jt,lt as Mt,nt as Nt}from"./settings-BhvhCpVh.js";import{I as Pt,P as Ft}from"./config-662VDD70.js";import{o as It,s as Lt}from"./log-Duzb4o6h.js";import{n as Rt,r as zt}from"./analytics-BotDBGh0.js";import{T as Bt,b as Vt}from"./startupProfiler-BquH_Yqm.js";import{l as Ht,n as Ut,o as Wt}from"./stringUtils-D_g2L6A4.js";import{Cn as Gt,Sn as Kt}from"./prompt-wys9CwDo.js";import{st as qt}from"./rcDebugLog-CivJaJ3V.js";import{u as E}from"./referral-Cu9bEOFE.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-CCeYiAta.js";import{n as nn,t as rn}from"./useExitOnCtrlCDWithKeybindings-vzUoPY51.js";import{n as an,t as on}from"./useMergedTools-Bb4XbC9d.js";import{n as sn,r as cn,t as ln}from"./promptEditor-D6HzjcMS.js";import{n as un,t as dn}from"./useMainLoopModel-cZd8EKo5.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,s){return`---
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,AE as y,Af as b,Ah as x,Bc as S,Bh as ee,Cf as C,Ef as te,Ex as w,Gg as ne,HD as re,Hd as ie,Hn as ae,Hw as oe,JS as se,Jo as ce,Kd as le,Lb as ue,M_ as de,Mf as fe,N_ as pe,Nf as me,Oh as he,Qd as ge,Rx as _e,So as ve,Tf as ye,Tx as T,Ud as be,Uh as xe,Un as Se,Uw as Ce,VD as we,Vc as Te,Vh as Ee,Wg as De,Wn as Oe,XS as ke,Xd as Ae,Xu as je,YT as Me,Yu as Ne,Zd as Pe,_u as Fe,_x as Ie,at as Le,bC as Re,bf as ze,c as Be,ef as Ve,et as He,hv as Ue,jE as We,jf as Ge,kh as Ke,l as qe,lh as Je,mv as Ye,nt as Xe,o as Ze,of as Qe,qS as $e,qd as et,r as tt,s as nt,sf as rt,sh as it,st as at,t as ot,vu as st,vx as ct,wf as lt,xC as ut,yf as dt,zb as ft,zo as pt,zx as mt}from"./loadAgentsDir-DrDu5yYy.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{Q as wt,Qt as Tt,_n as Et,ct as Dt,dn as Ot,en as kt,gn as At,ln as jt,lt as Mt,nt as Nt}from"./settings-DfWP5y6X.js";import{I as Pt,P as Ft}from"./config-DiT2Z8dY.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-C0nU0VK3.js";import{st as qt}from"./rcDebugLog-2-1XSyFV.js";import{u as E}from"./referral-DrebVwqx.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-Cju-aXCx.js";import{n as nn,t as rn}from"./useExitOnCtrlCDWithKeybindings-CzFtdlnD.js";import{n as an,t as on}from"./useMergedTools-DMGRA1ga.js";import{n as sn,r as cn,t as ln}from"./promptEditor-Cumef6hJ.js";import{n as un,t as dn}from"./useMainLoopModel-DegH12LZ.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,s){return`---
2
2
  name: ${e}
3
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}`:``}${s===void 0?``:`\neffort: ${s}`}${i?`\ncolor: ${i}`:``}${o?`\nmemory: ${o}`:``}
4
4
  ---
5
5
 
6
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(Tt(),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 rt(e)?`Built-in`:Ke(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,l){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await Cn(e);let u=yn({source:e,agentType:t}),d=gn(t,n,r,i,o,s,c,l);try{await Dn(u,d,a?`wx`:`w`)}catch(e){throw _t(e)===`EEXIST`?Error(`Agent file already exists: ${u}`):e}}async function Tn(e,t,n,r,i,a,o,s){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,s))}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(_t(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(),xt(),hn()}));function kn({agent:e,tools:t,onBack:n}){let r=x(e,t,!1),i=Sn(e),o=_e(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`}),`: `,ee(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`}),`: `,ie(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,` `]})]})}),!rt(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)(at,{children:e.getSystemPrompt()})})]})]})}var k,An=e((()=>{i(),p(),m(),E(),v(),Se(),Ge(),Ze(),xe(),Je(),On(),k=_()}));function jn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,Mn.useState)(Math.max(0,j.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:j.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<j.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=j[r];n(t===`automatic`?void 0:t)}},s=j[r];return(0,A.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,A.jsx)(c,{flexDirection:`column`,children:j.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:Ae[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:Ae[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var Mn,A,j,Nn=e((()=>{i(),Mn=t(p(),1),m(),v(),Wt(),A=_(),j=[`automatic`,...De]}));function Pn({initialModel:e,onComplete:t,onCancel:n}){let r=Fn.useMemo(()=>{let t=we();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,In.jsxs)(c,{flexDirection:`column`,children:[(0,In.jsx)(c,{marginBottom:1,children:(0,In.jsx)(l,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,In.jsx)(pe,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var Fn,In,Ln=e((()=>{Fn=t(p(),1),m(),xe(),ge(),In=_()}));function Rn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([C.name,ye.name,re.name,S.name,ae.name,Qe.name,ce.name,Ye.name,Te.name])},EDIT:{name:`Edit tools`,toolNames:new Set([de.name,b.name,pt.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([je.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 zn(e){let t=new Map;return e.forEach(e=>{if(fe(e)){let n=Mt(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 Bn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,M.useMemo)(()=>he({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[s,u]=(0,M.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[f,p]=(0,M.useState)(0),[m,h]=(0,M.useState)(!1),g=(0,M.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))})},x=()=>{let e=i.map(e=>e.name);n(g.length===e.length&&e.every(e=>g.includes(e))?void 0:g)},S=(0,M.useMemo)(()=>{let e=Rn(),t={readOnly:[],edit:[],execution:[],mcp:[],other:[]};return i.forEach(n=>{fe(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]),ee=e=>{let t=At(e,e=>_.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);b(n,t)}},C=[];C.push({id:`continue`,label:`Continue`,action:x,isContinue:!0}),C.push({id:`bucket-all`,label:`${v?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);b(e,!v)}});let te=Rn();[{id:`bucket-readonly`,name:te.READ_ONLY.name,tools:S.readOnly},{id:`bucket-edit`,name:te.EDIT.name,tools:S.edit},{id:`bucket-execution`,name:te.EXECUTION.name,tools:S.execution},{id:`bucket-mcp`,name:te.MCP.name,tools:S.mcp},{id:`bucket-other`,name:te.OTHER.name,tools:S.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=At(n,e=>_.has(e.name))===n.length;C.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:ee(n)})});let ne=C.length;C.push({id:`toggle-individual`,label:m?`Hide advanced options`:`Show advanced options`,action:()=>{h(!m),m&&f>ne&&p(ne)},isToggle:!0});let w=(0,M.useMemo)(()=>zn(i),[i]);return m&&(w.length>0&&(C.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),w.forEach(({serverName:e,tools:t})=>{let n=At(t,e=>_.has(e.name))===t.length;C.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)}})}),C.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=Mt(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}C.push({id:`tool-${e.name}`,label:`${_.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>y(e.name)})})),d(`confirm:no`,(0,M.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,N.jsxs)(c,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=C[f];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=f-1;for(;t>0&&C[t]?.isHeader;)t--;p(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=f+1;for(;t<C.length-1&&C[t]?.isHeader;)t++;p(Math.min(C.length-1,t))}},children:[(0,N.jsxs)(l,{color:f===0?`suggestion`:void 0,bold:f===0,children:[f===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,N.jsx)(o,{width:40}),C.slice(1).map((e,t)=>{let n=t+1===f,r=e.isToggle,i=e.isHeader;return(0,N.jsxs)(M.Fragment,{children:[r&&(0,N.jsx)(o,{width:40}),i&&t>0&&(0,N.jsx)(c,{marginTop:1}),(0,N.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,N.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,N.jsx)(l,{dimColor:!0,children:v?`All tools selected`:`${_.size} of ${i.length} tools selected`})})]})}var M,N,Vn=e((()=>{i(),M=t(p(),1),Dt(),ue(),Ge(),Nt(),dt(),be(),me(),Ce(),We(),ft(),te(),Ve(),Pe(),ne(),et(),it(),le(),Jt(),m(),E(),Et(),Wt(),N=_()}));function Hn(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:nt(jt(e))}var Un=e((()=>{He(),Ot()}));function Wn({agent:e,tools:t,onSaved:n,onBack:r}){let i=Be(),[o,s]=(0,P.useState)(`menu`),[u,f]=(0,P.useState)(0),[p,m]=(0,P.useState)(null),[g,_]=(0,P.useState)(e.color),v=(0,P.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,P.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)&&!Ke(e)?!1:(await Tn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&Le(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:tt(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,P.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]),x=(0,P.useCallback)(()=>{m(null),o===`menu`?r():s(`menu`)},[o,r]),S=(0,P.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`,x,{context:`Confirmation`});let ee=()=>(0,F.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:S,children:[(0,F.jsxs)(l,{dimColor:!0,children:[`Source: `,Hn(e.source)]}),(0,F.jsx)(c,{marginTop:1,flexDirection:`column`,children:b.map((e,t)=>(0,F.jsxs)(l,{color:t===u?`suggestion`:void 0,children:[t===u?`${a.pointer} `:` `,e.label]},e.label))}),p&&(0,F.jsx)(c,{marginTop:1,children:(0,F.jsx)(l,{color:`error`,children:p})})]});switch(o){case`menu`:return ee();case`edit-tools`:return(0,F.jsx)(Bn,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await y({tools:e})}});case`edit-color`:return(0,F.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,F.jsx)(Pn,{initialModel:e.model,onComplete:async e=>{s(`menu`),await y({model:e})}});default:return null}}var P,F,Gn=e((()=>{f(),i(),p(),P=t(p(),1),qe(),m(),E(),v(),Ze(),cn(),On(),Nn(),Ln(),Vn(),Un(),F=_()}));function Kn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=nn();return(0,qn.jsx)(c,{marginLeft:2,children:(0,qn.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var qn,Jn=e((()=>{p(),rn(),m(),qn=_()}));function Yn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:s}){let[u,d]=I.useState(null),[f,p]=I.useState(!0),m=I.useMemo(()=>[...t].sort(Qt),[t]),h=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),_=()=>(0,L.jsxs)(c,{children:[(0,L.jsx)(l,{color:f?`suggestion`:void 0,children:f?`${a.pointer} `:` `}),(0,L.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,L.jsxs)(c,{children:[(0,L.jsx)(l,{dimColor:o&&!n,color:s,children:t?``:n?`${a.pointer} `:` `}),(0,L.jsx)(l,{dimColor:o&&!n,color:s,children:e.agentType}),d&&(0,L.jsxs)(l,{dimColor:!0,color:s,children:[` · `,d]}),e.memory&&(0,L.jsxs)(l,{dimColor:!0,color:s,children:[` · `,e.memory,` memory`]}),i&&(0,L.jsxs)(l,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,en(i)]})]},`${e.agentType}-${e.source}`)},y=I.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]);I.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))}},x=(e=`Built-in (always available):`)=>{let t=m.filter(e=>e.source===`built-in`);return(0,L.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,L.jsx)(l,{bold:!0,dimColor:!0,children:e}),t.map(v)]})},S=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,L.jsxs)(c,{flexDirection:`column`,marginBottom:1,children:[(0,L.jsxs)(c,{paddingLeft:2,children:[(0,L.jsx)(l,{bold:!0,dimColor:!0,children:e}),n&&(0,L.jsxs)(l,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>v(e))]})},ee=Hn(e),C=m.filter(e=>e.source===`built-in`);return!m.length||e!==`built-in`&&!m.some(e=>e.source!==`built-in`)?(0,L.jsx)(g,{title:ee,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,L.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,L.jsx)(c,{children:_()}),(0,L.jsx)(l,{dimColor:!0,children:`No agents found. Create specialized subagents that Claude can delegate to.`}),(0,L.jsx)(l,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(o,{}),x()]})]})}):(0,L.jsxs)(g,{title:ee,subtitle:`${At(m,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[s&&s.length>0&&(0,L.jsx)(c,{marginTop:1,children:(0,L.jsx)(l,{dimColor:!0,children:s[s.length-1]})}),(0,L.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,L.jsx)(c,{marginBottom:1,children:_()}),e===`all`?(0,L.jsxs)(L.Fragment,{children:[tn.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,L.jsx)(I.Fragment,{children:S(e,m.filter(e=>e.source===t))},t)),C.length>0&&(0,L.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,L.jsxs)(l,{dimColor:!0,children:[(0,L.jsx)(l,{bold:!0,children:`Built-in agents`}),` (always available)`]}),C.map(v)]})]}):e===`built-in`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(l,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,L.jsx)(c,{marginTop:1,flexDirection:`column`,children:m.map(e=>v(e))})]}):(0,L.jsxs)(L.Fragment,{children:[m.filter(e=>e.source!==`built-in`).map(e=>v(e)),m.some(e=>e.source===`built-in`)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(o,{}),x()]})]})]})]})}var I,L,Xn=e((()=>{i(),I=t(p(),1),m(),Zt(),Et(),Un(),L=_()}));function Zn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,R.useState)(0),[l,u]=(0,R.useState)(t),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)([]);nn(),(0,R.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,R.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,R.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,R.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,R.useCallback)(()=>{m([]),r&&r()},[r]),y=(0,R.useCallback)(e=>{u(t=>({...t,...e}))},[]),b=(0,R.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]),x=e[s];return!x||d?null:(0,Qn.jsx)($n.Provider,{value:b,children:i||(0,Qn.jsx)(x,{})})}var R,Qn,$n,er=e((()=>{R=t(p(),1),rn(),Qn=_(),$n=(0,R.createContext)(null)}));function z(){let e=(0,tr.useContext)($n);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var tr,nr=e((()=>{tr=t(p(),1),er()}));function rr({instructions:e=(0,ir.jsxs)(u,{children:[(0,ir.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,ir.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,ir.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=nn();return(0,ir.jsx)(c,{marginLeft:3,marginTop:1,children:(0,ir.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var ir,ar=e((()=>{rn(),m(),w(),ir=_()}));function B({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=z();return(0,or.jsxs)(or.Fragment,{children:[(0,or.jsx)(g,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,or.jsx)(rr,{instructions:i})]})}var or,V=e((()=>{m(),nr(),ar(),or=_()})),H=e((()=>{nr(),V(),ar(),er()}));function sr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z();return d(`confirm:no`,t,{context:`Confirmation`}),(0,U.jsx)(B,{subtitle:`Choose background color`,footerText:(0,U.jsxs)(u,{children:[(0,U.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,U.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,U.jsx)(c,{children:(0,U.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 U,cr=e((()=>{m(),E(),w(),H(),V(),Nn(),U=_()}));function lr(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 ur(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=lr(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 ${Hn(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 dr=e((()=>{Ge(),Un()}));function fr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=z();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=ur(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,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Memory`}),`: `,ie(p.memory)]}):null;return(0,W.jsx)(B,{subtitle:`Confirm and save`,footerText:(0,W.jsxs)(u,{children:[(0,W.jsx)(s,{shortcut:`s/Enter`,action:`save`}),(0,W.jsx)(s,{shortcut:`e`,action:`edit in your editor`}),(0,W.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,W.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Name`}),`: `,p.agentType]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Location`}),`:`,` `,xn({source:o.location,agentType:p.agentType})]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Tools`}),`: `,_(p.tools)]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Model`}),`: `,ee(p.model)]}),v,(0,W.jsx)(c,{marginTop:1,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]})}),(0,W.jsx)(c,{marginLeft:2,marginTop:1,children:(0,W.jsx)(l,{children:g})}),(0,W.jsx)(c,{marginTop:1,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,W.jsx)(c,{marginLeft:2,marginTop:1,children:(0,W.jsx)(l,{children:h})}),m.warnings.length>0&&(0,W.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(l,{color:`warning`,children:`Warnings:`}),m.warnings.map((e,t)=>(0,W.jsxs)(l,{dimColor:!0,children:[` `,`• `,e]},t))]}),m.errors.length>0&&(0,W.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(l,{color:`error`,children:`Errors:`}),m.errors.map((e,t)=>(0,W.jsxs)(l,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(l,{color:`error`,children:i})}),(0,W.jsx)(c,{marginTop:2,children:(0,W.jsxs)(l,{color:`success`,children:[`Press `,(0,W.jsx)(l,{bold:!0,children:`s`}),` or `,(0,W.jsx)(l,{bold:!0,children:`Enter`}),` to save, `,(0,W.jsx)(l,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var W,pr=e((()=>{m(),E(),Ft(),Se(),Vt(),xe(),w(),H(),V(),On(),dr(),W=_()}));function mr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=z(),[i,a]=(0,hr.useState)(null),o=Be(),s=(0,hr.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:tt(t),allAgents:t}}}),st(),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,gr.jsx)(fr,{tools:e,existingAgents:t,onSave:(0,hr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,hr.useCallback)(()=>s(!0),[s]),error:i})}var hr,gr,_r=e((()=>{f(),hr=t(p(),1),Rt(),qe(),Ze(),cn(),H(),On(),pr(),gr=_()}));function vr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z(),[i,a]=(0,yr.useState)(r.whenToUse||``),[o,f]=(0,yr.useState)(i.length),[p,m]=(0,yr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,yr.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,G.jsx)(B,{subtitle:`Description (tell Claude when to use this agent)`,footerText:(0,G.jsxs)(u,{children:[(0,G.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,G.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,G.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,G.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsxs)(c,{flexDirection:`column`,children:[(0,G.jsx)(l,{children:`When should Claude use this agent?`}),(0,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(ze,{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,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(l,{color:`error`,children:p})})]})})}var yr,G,br=e((()=>{yr=t(p(),1),m(),E(),cn(),w(),lt(),H(),V(),G=_()}));async function xr(e,t,n,r){let i=ve({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 se(),o=ot([i],a),s=Pt()?Sr+Cr:Sr,c=await Xe({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=vt(l.trim())}catch{let e=l.match(/\{[\s\S]*\}/);if(!e)throw Error(`No JSON object found in response`);u=vt(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 Sr,Cr,wr=e((()=>{$e(),Re(),Gt(),Nt(),Me(),mt(),Ft(),Rt(),yt(),Ie(),Sr=`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.
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(Tt(),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 nt(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,l){if(e===`built-in`)throw Error(`Cannot save built-in agents`);await Cn(e);let u=yn({source:e,agentType:t}),d=gn(t,n,r,i,o,s,c,l);try{await Dn(u,d,a?`wx`:`w`)}catch(e){throw yt(e)===`EEXIST`?Error(`Agent file already exists: ${u}`):e}}async function Tn(e,t,n,r,i,a,o,s){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,s))}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=ge(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`}),`: `,ee(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`}),`: `,ae(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,` `]})]})}),!nt(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)(it,{children:e.getSystemPrompt()})})]})]})}var k,An=e((()=>{i(),p(),m(),E(),v(),Se(),Ke(),Ze(),xe(),Je(),On(),k=_()}));function jn({agentName:e,currentColor:t=`automatic`,onConfirm:n}){let[r,i]=(0,Mn.useState)(Math.max(0,j.indexOf(t))),o=e=>{if(e.key===`up`)e.preventDefault(),i(e=>e>0?e-1:j.length-1);else if(e.key===`down`)e.preventDefault(),i(e=>e<j.length-1?e+1:0);else if(e.key===`return`){e.preventDefault();let t=j[r];n(t===`automatic`?void 0:t)}},s=j[r];return(0,A.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:o,children:[(0,A.jsx)(c,{flexDirection:`column`,children:j.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:Pe[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:Pe[s],color:`inverseText`,bold:!0,children:[` `,`@`,e,` `]})]})]})}var Mn,A,j,Nn=e((()=>{i(),Mn=t(p(),1),m(),v(),Wt(),A=_(),j=[`automatic`,...Ae]}));function Pn({initialModel:e,onComplete:t,onCancel:n}){let r=Fn.useMemo(()=>{let t=Ee();return e&&!t.some(t=>t.value===e)?[{value:e,label:e,description:`Current model (custom ID)`},...t]:t},[e]);return(0,In.jsxs)(c,{flexDirection:`column`,children:[(0,In.jsx)(c,{marginBottom:1,children:(0,In.jsx)(l,{dimColor:!0,children:`Model determines the agent's reasoning capabilities and speed.`})}),(0,In.jsx)(Ie,{options:r,defaultValue:e??`sonnet`,onChange:t,onCancel:()=>n?n():t(void 0)})]})}var Fn,In,Ln=e((()=>{Fn=t(p(),1),m(),xe(),ct(),In=_()}));function Rn(){return{READ_ONLY:{name:`Read-only tools`,toolNames:new Set([C.name,ye.name,ie.name,S.name,Re.name,Qe.name,le.name,Ye.name,De.name])},EDIT:{name:`Edit tools`,toolNames:new Set([fe.name,b.name,dt.name])},EXECUTION:{name:`Execution tools`,toolNames:new Set([Fe.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 zn(e){let t=new Map;return e.forEach(e=>{if(pe(e)){let n=Mt(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 Bn({tools:e,initialTools:t,onComplete:n,onCancel:r}){let i=(0,M.useMemo)(()=>he({tools:e,isBuiltIn:!1,isAsync:!1}),[e]),[s,u]=(0,M.useState)(!t||t.includes(`*`)?i.map(e=>e.name):t),[f,p]=(0,M.useState)(0),[m,h]=(0,M.useState)(!1),g=(0,M.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))})},x=()=>{let e=i.map(e=>e.name);n(g.length===e.length&&e.every(e=>g.includes(e))?void 0:g)},S=(0,M.useMemo)(()=>{let e=Rn(),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]),ee=e=>{let t=At(e,e=>_.has(e.name))<e.length;return()=>{let n=e.map(e=>e.name);b(n,t)}},C=[];C.push({id:`continue`,label:`Continue`,action:x,isContinue:!0}),C.push({id:`bucket-all`,label:`${v?a.checkboxOn:a.checkboxOff} All tools`,action:()=>{let e=i.map(e=>e.name);b(e,!v)}});let te=Rn();[{id:`bucket-readonly`,name:te.READ_ONLY.name,tools:S.readOnly},{id:`bucket-edit`,name:te.EDIT.name,tools:S.edit},{id:`bucket-execution`,name:te.EXECUTION.name,tools:S.execution},{id:`bucket-mcp`,name:te.MCP.name,tools:S.mcp},{id:`bucket-other`,name:te.OTHER.name,tools:S.other}].forEach(({id:e,name:t,tools:n})=>{if(n.length===0)return;let r=At(n,e=>_.has(e.name))===n.length;C.push({id:e,label:`${r?a.checkboxOn:a.checkboxOff} ${t}`,action:ee(n)})});let w=C.length;C.push({id:`toggle-individual`,label:m?`Hide advanced options`:`Show advanced options`,action:()=>{h(!m),m&&f>w&&p(w)},isToggle:!0});let ne=(0,M.useMemo)(()=>zn(i),[i]);return m&&(ne.length>0&&(C.push({id:`mcp-servers-header`,label:`MCP Servers:`,action:()=>{},isHeader:!0}),ne.forEach(({serverName:e,tools:t})=>{let n=At(t,e=>_.has(e.name))===t.length;C.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)}})}),C.push({id:`tools-header`,label:`Individual Tools:`,action:()=>{},isHeader:!0})),i.forEach(e=>{let t=e.name;if(e.name.startsWith(`mcp__`)){let n=Mt(e.name);t=n?`${n.toolName} (${n.serverName})`:e.name}C.push({id:`tool-${e.name}`,label:`${_.has(e.name)?a.checkboxOn:a.checkboxOff} ${t}`,action:()=>y(e.name)})})),d(`confirm:no`,(0,M.useCallback)(()=>{r?r():n(t)},[r,n,t]),{context:`Confirmation`}),(0,N.jsxs)(c,{flexDirection:`column`,marginTop:1,tabIndex:0,autoFocus:!0,onKeyDown:e=>{if(e.key===`return`){e.preventDefault();let t=C[f];t&&!t.isHeader&&t.action()}else if(e.key===`up`){e.preventDefault();let t=f-1;for(;t>0&&C[t]?.isHeader;)t--;p(Math.max(0,t))}else if(e.key===`down`){e.preventDefault();let t=f+1;for(;t<C.length-1&&C[t]?.isHeader;)t++;p(Math.min(C.length-1,t))}},children:[(0,N.jsxs)(l,{color:f===0?`suggestion`:void 0,bold:f===0,children:[f===0?`${a.pointer} `:` `,`[ Continue ]`]}),(0,N.jsx)(o,{width:40}),C.slice(1).map((e,t)=>{let n=t+1===f,r=e.isToggle,i=e.isHeader;return(0,N.jsxs)(M.Fragment,{children:[r&&(0,N.jsx)(o,{width:40}),i&&t>0&&(0,N.jsx)(c,{marginTop:1}),(0,N.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,N.jsx)(c,{marginTop:1,flexDirection:`column`,children:(0,N.jsx)(l,{dimColor:!0,children:v?`All tools selected`:`${_.size} of ${i.length} tools selected`})})]})}var M,N,Vn=e((()=>{i(),M=t(p(),1),Dt(),de(),Ke(),Nt(),st(),be(),me(),Te(),Ge(),lt(),te(),Ue(),ze(),ne(),et(),rt(),ut(),Jt(),m(),E(),Et(),Wt(),N=_()}));function Hn(e){return e===`all`?`Agents`:e===`built-in`?`Built-in agents`:e===`plugin`?`Plugin agents`:we(jt(e))}var Un=e((()=>{re(),Ot()}));function Wn({agent:e,tools:t,onSaved:n,onBack:r}){let i=ke(),[o,s]=(0,P.useState)(`menu`),[u,f]=(0,P.useState)(0),[p,m]=(0,P.useState)(null),[g,_]=(0,P.useState)(e.color),v=(0,P.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,P.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!Be(e)&&!qe(e)?!1:(await Tn(e,e.whenToUse,r??e.tools,e.getSystemPrompt(),s,o??e.model),u&&s&&Ve(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:tt(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,P.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]),x=(0,P.useCallback)(()=>{m(null),o===`menu`?r():s(`menu`)},[o,r]),S=(0,P.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`,x,{context:`Confirmation`});let ee=()=>(0,F.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:S,children:[(0,F.jsxs)(l,{dimColor:!0,children:[`Source: `,Hn(e.source)]}),(0,F.jsx)(c,{marginTop:1,flexDirection:`column`,children:b.map((e,t)=>(0,F.jsxs)(l,{color:t===u?`suggestion`:void 0,children:[t===u?`${a.pointer} `:` `,e.label]},e.label))}),p&&(0,F.jsx)(c,{marginTop:1,children:(0,F.jsx)(l,{color:`error`,children:p})})]});switch(o){case`menu`:return ee();case`edit-tools`:return(0,F.jsx)(Bn,{tools:t,initialTools:e.tools,onComplete:async e=>{s(`menu`),await y({tools:e})}});case`edit-color`:return(0,F.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,F.jsx)(Pn,{initialModel:e.model,onComplete:async e=>{s(`menu`),await y({model:e})}});default:return null}}var P,F,Gn=e((()=>{f(),i(),p(),P=t(p(),1),$e(),m(),E(),v(),Ze(),cn(),On(),Nn(),Ln(),Vn(),Un(),F=_()}));function Kn({instructions:e=`Press ↑↓ to navigate · Enter to select · Esc to go back`}){let t=nn();return(0,qn.jsx)(c,{marginLeft:2,children:(0,qn.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var qn,Jn=e((()=>{p(),rn(),m(),qn=_()}));function Yn({source:e,agents:t,onBack:n,onSelect:r,onCreateNew:i,changes:s}){let[u,d]=I.useState(null),[f,p]=I.useState(!0),m=I.useMemo(()=>[...t].sort(Qt),[t]),h=e=>({isOverridden:!!e.overriddenBy,overriddenBy:e.overriddenBy||null}),_=()=>(0,L.jsxs)(c,{children:[(0,L.jsx)(l,{color:f?`suggestion`:void 0,children:f?`${a.pointer} `:` `}),(0,L.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,L.jsxs)(c,{children:[(0,L.jsx)(l,{dimColor:o&&!n,color:s,children:t?``:n?`${a.pointer} `:` `}),(0,L.jsx)(l,{dimColor:o&&!n,color:s,children:e.agentType}),d&&(0,L.jsxs)(l,{dimColor:!0,color:s,children:[` · `,d]}),e.memory&&(0,L.jsxs)(l,{dimColor:!0,color:s,children:[` · `,e.memory,` memory`]}),i&&(0,L.jsxs)(l,{dimColor:!n,color:n?`warning`:void 0,children:[` `,a.warning,` shadowed by `,en(i)]})]},`${e.agentType}-${e.source}`)},y=I.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]);I.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))}},x=(e=`Built-in (always available):`)=>{let t=m.filter(e=>e.source===`built-in`);return(0,L.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,L.jsx)(l,{bold:!0,dimColor:!0,children:e}),t.map(v)]})},S=(e,t)=>{if(!t.length)return null;let n=t[0]?.baseDir;return(0,L.jsxs)(c,{flexDirection:`column`,marginBottom:1,children:[(0,L.jsxs)(c,{paddingLeft:2,children:[(0,L.jsx)(l,{bold:!0,dimColor:!0,children:e}),n&&(0,L.jsxs)(l,{dimColor:!0,children:[` (`,n,`)`]})]}),t.map(e=>v(e))]})},ee=Hn(e),C=m.filter(e=>e.source===`built-in`);return!m.length||e!==`built-in`&&!m.some(e=>e.source!==`built-in`)?(0,L.jsx)(g,{title:ee,subtitle:`No agents found`,onCancel:n,hideInputGuide:!0,children:(0,L.jsxs)(c,{flexDirection:`column`,gap:1,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,L.jsx)(c,{children:_()}),(0,L.jsx)(l,{dimColor:!0,children:`No agents found. Create specialized subagents that Claude can delegate to.`}),(0,L.jsx)(l,{dimColor:!0,children:`Each subagent has its own context window, custom system prompt, and specific tools.`}),(0,L.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,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(o,{}),x()]})]})}):(0,L.jsxs)(g,{title:ee,subtitle:`${At(m,e=>!e.overriddenBy)} agents`,onCancel:n,hideInputGuide:!0,children:[s&&s.length>0&&(0,L.jsx)(c,{marginTop:1,children:(0,L.jsx)(l,{dimColor:!0,children:s[s.length-1]})}),(0,L.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:b,children:[i&&(0,L.jsx)(c,{marginBottom:1,children:_()}),e===`all`?(0,L.jsxs)(L.Fragment,{children:[tn.filter(e=>e.source!==`built-in`).map(({label:e,source:t})=>(0,L.jsx)(I.Fragment,{children:S(e,m.filter(e=>e.source===t))},t)),C.length>0&&(0,L.jsxs)(c,{flexDirection:`column`,marginBottom:1,paddingLeft:2,children:[(0,L.jsxs)(l,{dimColor:!0,children:[(0,L.jsx)(l,{bold:!0,children:`Built-in agents`}),` (always available)`]}),C.map(v)]})]}):e===`built-in`?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(l,{dimColor:!0,italic:!0,children:`Built-in agents are provided by default and cannot be modified.`}),(0,L.jsx)(c,{marginTop:1,flexDirection:`column`,children:m.map(e=>v(e))})]}):(0,L.jsxs)(L.Fragment,{children:[m.filter(e=>e.source!==`built-in`).map(e=>v(e)),m.some(e=>e.source===`built-in`)&&(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(o,{}),x()]})]})]})]})}var I,L,Xn=e((()=>{i(),I=t(p(),1),m(),Zt(),Et(),Un(),L=_()}));function Zn({steps:e,initialData:t={},onComplete:n,onCancel:r,children:i,title:a,showStepCounter:o=!0}){let[s,c]=(0,R.useState)(0),[l,u]=(0,R.useState)(t),[d,f]=(0,R.useState)(!1),[p,m]=(0,R.useState)([]);nn(),(0,R.useEffect)(()=>{d&&(m([]),n(l))},[d,l,n]);let h=(0,R.useCallback)(()=>{s<e.length-1?(p.length>0&&m(e=>[...e,s]),c(e=>e+1)):f(!0)},[s,e.length,p]),g=(0,R.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,R.useCallback)(t=>{t>=0&&t<e.length&&(m(e=>[...e,s]),c(t))},[s,e.length]),v=(0,R.useCallback)(()=>{m([]),r&&r()},[r]),y=(0,R.useCallback)(e=>{u(t=>({...t,...e}))},[]),b=(0,R.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]),x=e[s];return!x||d?null:(0,Qn.jsx)($n.Provider,{value:b,children:i||(0,Qn.jsx)(x,{})})}var R,Qn,$n,er=e((()=>{R=t(p(),1),rn(),Qn=_(),$n=(0,R.createContext)(null)}));function z(){let e=(0,tr.useContext)($n);if(!e)throw Error(`useWizard must be used within a WizardProvider`);return e}var tr,nr=e((()=>{tr=t(p(),1),er()}));function rr({instructions:e=(0,ir.jsxs)(u,{children:[(0,ir.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,ir.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,ir.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]})}){let t=nn();return(0,ir.jsx)(c,{marginLeft:3,marginTop:1,children:(0,ir.jsx)(l,{dimColor:!0,children:t.pending?`Press ${t.keyName} again to exit`:e})})}var ir,ar=e((()=>{rn(),m(),w(),ir=_()}));function B({title:e,color:t=`suggestion`,children:n,subtitle:r,footerText:i}){let{currentStepIndex:a,totalSteps:o,title:s,showStepCounter:c,goBack:l}=z();return(0,or.jsxs)(or.Fragment,{children:[(0,or.jsx)(g,{title:`${e||s||`Wizard`}${c===!1?``:` (${a+1}/${o})`}`,subtitle:r,onCancel:l,color:t,hideInputGuide:!0,isCancelActive:!1,children:n}),(0,or.jsx)(rr,{instructions:i})]})}var or,V=e((()=>{m(),nr(),ar(),or=_()})),H=e((()=>{nr(),V(),ar(),er()}));function sr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z();return d(`confirm:no`,t,{context:`Confirmation`}),(0,U.jsx)(B,{subtitle:`Choose background color`,footerText:(0,U.jsxs)(u,{children:[(0,U.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,U.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,U.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,U.jsx)(c,{children:(0,U.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 U,cr=e((()=>{m(),E(),w(),H(),V(),Nn(),U=_()}));function lr(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 ur(e,t,n){let r=[],i=[];if(!e.agentType)r.push(`Agent type is required`);else{let t=lr(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 ${Hn(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 dr=e((()=>{Ke(),Un()}));function fr({tools:e,existingAgents:t,onSave:n,onSaveAndEdit:r,error:i}){let{goBack:a,wizardData:o}=z();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=ur(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,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Memory`}),`: `,ae(p.memory)]}):null;return(0,W.jsx)(B,{subtitle:`Confirm and save`,footerText:(0,W.jsxs)(u,{children:[(0,W.jsx)(s,{shortcut:`s/Enter`,action:`save`}),(0,W.jsx)(s,{shortcut:`e`,action:`edit in your editor`}),(0,W.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,W.jsxs)(c,{flexDirection:`column`,tabIndex:0,autoFocus:!0,onKeyDown:f,children:[(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Name`}),`: `,p.agentType]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Location`}),`:`,` `,xn({source:o.location,agentType:p.agentType})]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Tools`}),`: `,_(p.tools)]}),(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Model`}),`: `,ee(p.model)]}),v,(0,W.jsx)(c,{marginTop:1,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`Description`}),` (tells Claude when to use this agent):`]})}),(0,W.jsx)(c,{marginLeft:2,marginTop:1,children:(0,W.jsx)(l,{children:g})}),(0,W.jsx)(c,{marginTop:1,children:(0,W.jsxs)(l,{children:[(0,W.jsx)(l,{bold:!0,children:`System prompt`}),`:`]})}),(0,W.jsx)(c,{marginLeft:2,marginTop:1,children:(0,W.jsx)(l,{children:h})}),m.warnings.length>0&&(0,W.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(l,{color:`warning`,children:`Warnings:`}),m.warnings.map((e,t)=>(0,W.jsxs)(l,{dimColor:!0,children:[` `,`• `,e]},t))]}),m.errors.length>0&&(0,W.jsxs)(c,{marginTop:1,flexDirection:`column`,children:[(0,W.jsx)(l,{color:`error`,children:`Errors:`}),m.errors.map((e,t)=>(0,W.jsxs)(l,{color:`error`,children:[` `,`• `,e]},t))]}),i&&(0,W.jsx)(c,{marginTop:1,children:(0,W.jsx)(l,{color:`error`,children:i})}),(0,W.jsx)(c,{marginTop:2,children:(0,W.jsxs)(l,{color:`success`,children:[`Press `,(0,W.jsx)(l,{bold:!0,children:`s`}),` or `,(0,W.jsx)(l,{bold:!0,children:`Enter`}),` to save, `,(0,W.jsx)(l,{bold:!0,children:`e`}),` to save and edit`]})})]})})}var W,pr=e((()=>{m(),E(),Ft(),Se(),Vt(),xe(),w(),H(),V(),On(),dr(),W=_()}));function mr({tools:e,existingAgents:t,onComplete:n}){let{wizardData:r}=z(),[i,a]=(0,hr.useState)(null),o=ke(),s=(0,hr.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:tt(t),allAgents:t}}}),ot(),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,gr.jsx)(fr,{tools:e,existingAgents:t,onSave:(0,hr.useCallback)(()=>s(!1),[s]),onSaveAndEdit:(0,hr.useCallback)(()=>s(!0),[s]),error:i})}var hr,gr,_r=e((()=>{f(),hr=t(p(),1),Rt(),$e(),Ze(),cn(),H(),On(),pr(),gr=_()}));function vr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z(),[i,a]=(0,yr.useState)(r.whenToUse||``),[o,f]=(0,yr.useState)(i.length),[p,m]=(0,yr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,yr.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,G.jsx)(B,{subtitle:`Description (tell Claude when to use this agent)`,footerText:(0,G.jsxs)(u,{children:[(0,G.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,G.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,G.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,G.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,G.jsxs)(c,{flexDirection:`column`,children:[(0,G.jsx)(l,{children:`When should Claude use this agent?`}),(0,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(_e,{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,G.jsx)(c,{marginTop:1,children:(0,G.jsx)(l,{color:`error`,children:p})})]})})}var yr,G,br=e((()=>{yr=t(p(),1),m(),E(),cn(),w(),mt(),H(),V(),G=_()}));async function xr(e,t,n,r){let i=ve({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 y(),o=at([i],a),s=Pt()?Sr+Cr:Sr,c=await Xe({messages:ce(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 Sr,Cr,wr=e((()=>{We(),He(),Gt(),Nt(),Le(),pt(),Ft(),Rt(),xt(),Me(),Sr=`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
10
 
11
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
12
 
@@ -97,7 +97,7 @@ Remember: The agents you create should be autonomous experts capable of handling
97
97
  - For a documentation writer: "Update your agent memory as you discover documentation patterns, API structures, and terminology conventions."
98
98
 
99
99
  The memory instructions should be specific to what the agent would naturally learn while performing its core tasks.
100
- `}));function Tr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=z(),[i,a]=(0,K.useState)(r.generationPrompt||``),[o,s]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(i.length),g=un(),_=(0,K.useRef)(null);d(`confirm:no`,(0,K.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,s(!1),p(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),d(`chat:externalEditor`,(0,K.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,K.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=Ue();_.current=r;try{let i=await xr(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 Ct||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}},b=`Describe what this agent should do and when it should be used (be comprehensive for best results)`;return o?(0,q.jsx)(B,{subtitle:b,footerText:(0,q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,q.jsxs)(c,{flexDirection:`row`,alignItems:`center`,children:[(0,q.jsx)(y,{}),(0,q.jsx)(l,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,q.jsx)(B,{subtitle:b,footerText:(0,q.jsxs)(u,{children:[(0,q.jsx)(T,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,q.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsxs)(c,{flexDirection:`column`,children:[f&&(0,q.jsx)(c,{marginBottom:1,children:(0,q.jsx)(l,{color:`error`,children:f})}),(0,q.jsx)(ze,{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 K,q,Er=e((()=>{St(),K=t(p(),1),dn(),m(),E(),Ne(),cn(),w(),ct(),lt(),H(),V(),wr(),q=_()}));function Dr(){let{goNext:e,updateWizardData:t,cancel:n}=z();return(0,J.jsx)(B,{subtitle:`Choose location`,footerText:(0,J.jsxs)(u,{children:[(0,J.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,J.jsx)(c,{children:(0,J.jsx)(pe,{options:[{label:`Project (.claude/agents/)`,value:`projectSettings`},{label:`Personal (~/.claude/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var J,Or=e((()=>{m(),w(),ge(),H(),V(),J=_()}));function kr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z();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,Y.jsx)(B,{subtitle:`Configure agent memory`,footerText:(0,Y.jsxs)(u,{children:[(0,Y.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsx)(c,{children:(0,Y.jsx)(pe,{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+`
100
+ `}));function Tr(){let{updateWizardData:e,goBack:t,goToStep:n,wizardData:r}=z(),[i,a]=(0,K.useState)(r.generationPrompt||``),[o,s]=(0,K.useState)(!1),[f,p]=(0,K.useState)(null),[m,h]=(0,K.useState)(i.length),g=un(),_=(0,K.useRef)(null);d(`confirm:no`,(0,K.useCallback)(()=>{_.current&&(_.current.abort(),_.current=null,s(!1),p(`Generation cancelled`))},[]),{context:`Settings`,isActive:o}),d(`chat:externalEditor`,(0,K.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,K.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=oe();_.current=r;try{let i=await xr(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,q.jsx)(B,{subtitle:y,footerText:(0,q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`cancel`}),children:(0,q.jsxs)(c,{flexDirection:`row`,alignItems:`center`,children:[(0,q.jsx)(ue,{}),(0,q.jsx)(l,{color:`suggestion`,children:` Generating agent from description...`})]})}):(0,q.jsx)(B,{subtitle:y,footerText:(0,q.jsxs)(u,{children:[(0,q.jsx)(T,{action:`confirm:yes`,context:`Confirmation`,fallback:`Enter`,description:`submit`}),(0,q.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,q.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,q.jsxs)(c,{flexDirection:`column`,children:[f&&(0,q.jsx)(c,{marginBottom:1,children:(0,q.jsx)(l,{color:`error`,children:f})}),(0,q.jsx)(_e,{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 K,q,Er=e((()=>{vt(),K=t(p(),1),dn(),m(),E(),Ce(),cn(),w(),ft(),mt(),H(),V(),wr(),q=_()}));function Dr(){let{goNext:e,updateWizardData:t,cancel:n}=z();return(0,J.jsx)(B,{subtitle:`Choose location`,footerText:(0,J.jsxs)(u,{children:[(0,J.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,J.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,J.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]}),children:(0,J.jsx)(c,{children:(0,J.jsx)(Ie,{options:[{label:`Project (.claude/agents/)`,value:`projectSettings`},{label:`Personal (~/.claude/agents/)`,value:`userSettings`}],onChange:n=>{t({location:n}),e()},onCancel:()=>n()},`location-select`)})})}var J,Or=e((()=>{m(),w(),ct(),H(),V(),J=_()}));function kr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z();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,Y.jsx)(B,{subtitle:`Configure agent memory`,footerText:(0,Y.jsxs)(u,{children:[(0,Y.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Y.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Y.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Y.jsx)(c,{children:(0,Y.jsx)(Ie,{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
101
 
102
- `+Ee(a,i):()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Y,Ar=e((()=>{m(),E(),Ft(),Se(),w(),ge(),H(),V(),Y=_()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=z();return(0,X.jsx)(B,{subtitle:`Creation method`,footerText:(0,X.jsxs)(u,{children:[(0,X.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsx)(c,{children:(0,X.jsx)(pe,{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 X,Mr=e((()=>{m(),w(),ge(),H(),V(),X=_()}));function Nr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z();return(0,Pr.jsx)(B,{subtitle:`Select model`,footerText:(0,Pr.jsxs)(u,{children:[(0,Pr.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Pr.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Pr.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Pr.jsx)(Pn,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Pr,Fr=e((()=>{w(),m(),H(),V(),Ln(),Pr=_()}));function Ir(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z(),[i,a]=(0,Lr.useState)(r.systemPrompt||``),[o,f]=(0,Lr.useState)(i.length),[p,m]=(0,Lr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,Lr.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(B,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(u,{children:[(0,Z.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(c,{flexDirection:`column`,children:[(0,Z.jsx)(l,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(l,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(c,{marginTop:1,children:(0,Z.jsx)(ze,{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,Z.jsx)(c,{marginTop:1,children:(0,Z.jsx)(l,{color:`error`,children:p})})]})})}var Lr,Z,Rr=e((()=>{Lr=t(p(),1),m(),E(),cn(),w(),lt(),H(),V(),Z=_()}));function zr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=z(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Br.jsx)(B,{subtitle:`Select tools`,footerText:(0,Br.jsxs)(u,{children:[(0,Br.jsx)(s,{shortcut:`Enter`,action:`toggle selection`}),(0,Br.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Br.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Br.jsx)(Bn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Br,Vr=e((()=>{m(),w(),H(),V(),Vn(),Br=_()}));function Hr(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=z(),[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)(B,{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)(T,{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)(ze,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=lr(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(),w(),lt(),H(),V(),dr(),Q=_()}));function Gr({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Kr.jsx)(Zn,{steps:[Dr,jr,Tr,()=>(0,Kr.jsx)(Hr,{existingAgents:t}),Ir,vr,()=>(0,Kr.jsx)(zr,{tools:e}),Nr,sr,...Pt()?[kr]:[],()=>(0,Kr.jsx)(mr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Kr,qr=e((()=>{Ft(),H(),cr(),_r(),br(),Er(),Or(),Ar(),Mr(),Fr(),Rr(),Vr(),Wr(),Kr=_()}));function Jr({tools:e,onExit:t}){let[n,r]=(0,Yr.useState)({mode:`list-agents`,source:`all`}),i=ut(e=>e.agentDefinitions),a=ut(e=>e.mcp.tools),o=ut(e=>e.toolPermissionContext),s=Be(),{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:tt(n)}}}),p(t=>[...t,`Deleted agent: ${h.bold(e.agentType)}`]),r({mode:`list-agents`,source:`all`})}catch(e){Lt(bt(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)(Yn,{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)(Kn,{})]})}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)(pe,{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)(Kn,{})]})}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)(Kn,{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)(pe,{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)(Kn,{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)(Wn,{agent:e,tools:m,onSaved:e=>{v(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Kn,{})]})}default:return null}}var Yr,$,Xr=e((()=>{f(),p(),Yr=t(p(),1),rn(),on(),m(),qe(),Zt(),Ze(),xt(),It(),ge(),An(),Gn(),Jn(),Xn(),On(),qr(),$=_()}));async function Zr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Qr.jsx)(Jr,{tools:ke(n),onExit:e})}var Qr;e((()=>{p(),Xr(),Oe(),Qr=_()}))();export{Zr as call};
102
+ `+Oe(a,i):()=>r.systemPrompt}:void 0}),e()},onCancel:t},`memory-select`)})})}var Y,Ar=e((()=>{m(),E(),Ft(),Se(),w(),ct(),H(),V(),Y=_()}));function jr(){let{goNext:e,goBack:t,updateWizardData:n,goToStep:r}=z();return(0,X.jsx)(B,{subtitle:`Creation method`,footerText:(0,X.jsxs)(u,{children:[(0,X.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,X.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,X.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,X.jsx)(c,{children:(0,X.jsx)(Ie,{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 X,Mr=e((()=>{m(),w(),ct(),H(),V(),X=_()}));function Nr(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z();return(0,Pr.jsx)(B,{subtitle:`Select model`,footerText:(0,Pr.jsxs)(u,{children:[(0,Pr.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Pr.jsx)(s,{shortcut:`Enter`,action:`select`}),(0,Pr.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Pr.jsx)(Pn,{initialModel:r.selectedModel,onComplete:t=>{n({selectedModel:t}),e()},onCancel:t})})}var Pr,Fr=e((()=>{w(),m(),H(),V(),Ln(),Pr=_()}));function Ir(){let{goNext:e,goBack:t,updateWizardData:n,wizardData:r}=z(),[i,a]=(0,Lr.useState)(r.systemPrompt||``),[o,f]=(0,Lr.useState)(i.length),[p,m]=(0,Lr.useState)(null);return d(`confirm:no`,t,{context:`Settings`}),d(`chat:externalEditor`,(0,Lr.useCallback)(async()=>{let e=await sn(i);e.content!==null&&(a(e.content),f(e.content.length))},[i]),{context:`Chat`}),(0,Z.jsx)(B,{subtitle:`System prompt`,footerText:(0,Z.jsxs)(u,{children:[(0,Z.jsx)(s,{shortcut:`Type`,action:`enter text`}),(0,Z.jsx)(s,{shortcut:`Enter`,action:`continue`}),(0,Z.jsx)(T,{action:`chat:externalEditor`,context:`Chat`,fallback:`ctrl+g`,description:`open in editor`}),(0,Z.jsx)(T,{action:`confirm:no`,context:`Settings`,fallback:`Esc`,description:`go back`})]}),children:(0,Z.jsxs)(c,{flexDirection:`column`,children:[(0,Z.jsx)(l,{children:`Enter the system prompt for your agent:`}),(0,Z.jsx)(l,{dimColor:!0,children:`Be comprehensive for best results`}),(0,Z.jsx)(c,{marginTop:1,children:(0,Z.jsx)(_e,{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,Z.jsx)(c,{marginTop:1,children:(0,Z.jsx)(l,{color:`error`,children:p})})]})})}var Lr,Z,Rr=e((()=>{Lr=t(p(),1),m(),E(),cn(),w(),mt(),H(),V(),Z=_()}));function zr({tools:e}){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=z(),a=e=>{r({selectedTools:e}),t()},o=i.selectedTools;return(0,Br.jsx)(B,{subtitle:`Select tools`,footerText:(0,Br.jsxs)(u,{children:[(0,Br.jsx)(s,{shortcut:`Enter`,action:`toggle selection`}),(0,Br.jsx)(s,{shortcut:`↑↓`,action:`navigate`}),(0,Br.jsx)(T,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`go back`})]}),children:(0,Br.jsx)(Bn,{tools:e,initialTools:o,onComplete:a,onCancel:n})})}var Br,Vr=e((()=>{m(),w(),H(),V(),Vn(),Br=_()}));function Hr(e){let{goNext:t,goBack:n,updateWizardData:r,wizardData:i}=z(),[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)(B,{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)(T,{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)(_e,{value:a,onChange:o,onSubmit:e=>{let n=e.trim(),i=lr(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(),w(),mt(),H(),V(),dr(),Q=_()}));function Gr({tools:e,existingAgents:t,onComplete:n,onCancel:r}){return(0,Kr.jsx)(Zn,{steps:[Dr,jr,Tr,()=>(0,Kr.jsx)(Hr,{existingAgents:t}),Ir,vr,()=>(0,Kr.jsx)(zr,{tools:e}),Nr,sr,...Pt()?[kr]:[],()=>(0,Kr.jsx)(mr,{tools:e,existingAgents:t,onComplete:n})],initialData:{},onComplete:()=>{},onCancel:r,title:`Create new agent`,showStepCounter:!1})}var Kr,qr=e((()=>{Ft(),H(),cr(),_r(),br(),Er(),Or(),Ar(),Mr(),Fr(),Rr(),Vr(),Wr(),Kr=_()}));function Jr({tools:e,onExit:t}){let[n,r]=(0,Yr.useState)({mode:`list-agents`,source:`all`}),i=se(e=>e.agentDefinitions),a=se(e=>e.mcp.tools),o=se(e=>e.toolPermissionContext),s=ke(),{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:tt(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)(Yn,{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)(Kn,{})]})}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)(Ie,{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)(Kn,{})]})}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)(Kn,{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)(Ie,{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)(Kn,{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)(Wn,{agent:e,tools:m,onSaved:e=>{v(e),r(n.previousMode)},onBack:()=>r(n.previousMode)})}),(0,$.jsx)(Kn,{})]})}default:return null}}var Yr,$,Xr=e((()=>{f(),p(),Yr=t(p(),1),rn(),on(),m(),$e(),Zt(),Ze(),Ct(),It(),ct(),An(),Gn(),Jn(),Xn(),On(),qr(),$=_()}));async function Zr(e,t){let n=t.getAppState().toolPermissionContext;return(0,Qr.jsx)(Jr,{tools:Ne(n),onExit:e})}var Qr;e((()=>{p(),Xr(),je(),Qr=_()}))();export{Zr as call};
@@ -1,2 +1,2 @@
1
- import{i as e,o as t,r as n}from"./loadAgentsDir-ZQwvbURI.js";import{n as r,t as i}from"./cwd-CYmmnQVS.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-CCeYiAta.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
1
+ import{i as e,o as t,r as n}from"./loadAgentsDir-DrDu5yYy.js";import{n as r,t as i}from"./cwd-CYmmnQVS.js";import{a,i as o,n as s,o as c,r as l,t as u}from"./agentDisplay-Cju-aXCx.js";o(),t(),r();function d(e){let t=a(e),n=[e.agentType];return t&&n.push(t),e.memory&&n.push(`${e.memory} memory`),n.join(` · `)}async function f(){let{allAgents:t}=await e(i()),r=c(t,n(t)),a=[],o=0;for(let{label:e,source:t}of u){let n=r.filter(e=>e.source===t).sort(s);if(n.length!==0){a.push(`${e}:`);for(let e of n)if(e.overriddenBy){let t=l(e.overriddenBy);a.push(` (shadowed by ${t}) ${d(e)}`)}else a.push(` ${d(e)}`),o++;a.push(``)}}a.length===0?console.log(`No agents found.`):(console.log(`${o} active agents\n`),console.log(a.join(`
2
2
  `).trimEnd()))}export{f as agentsHandler};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{G_ as t,U_ as n}from"./loadAgentsDir-ZQwvbURI.js";import{g as r,u as i}from"./settings-BhvhCpVh.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{G_ as t,U_ as n}from"./loadAgentsDir-DrDu5yYy.js";import{g as r,u as i}from"./settings-DfWP5y6X.js";function a(){let e=i(),t=[`user`,`project`,`local`].flatMap(e=>n(e).errors);return{settings:e.settings,errors:[...e.errors,...t]}}var o=e((()=>{t(),r()}));export{o as n,a as t};
@@ -1 +1 @@
1
- import{GS as e,JS as t,QS as n,US as r,XS as i,qS as a}from"./loadAgentsDir-ZQwvbURI.js";import{s as o,u as s}from"./logoV2Utils-5lcUu53m.js";t(),s();var c=`default`;async function l(e,t){let n=await r(t.list||c,{subject:e,description:t.description||``,status:`pending`,blocks:[],blockedBy:[]});console.log(`Created task ${n}: ${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(t,n){let r=await e(n.list||c,t);if(!r){console.error(`Task not found: ${t}`),process.exitCode=1;return}console.log(JSON.stringify(r,null,2))}async function f(e,t){let r=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 n(r,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(a(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-C9zlWBRz.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{DC as e,IC as t,MC as n,PC as r,jC as i,kC as a}from"./loadAgentsDir-DrDu5yYy.js";import{s as o,u as s}from"./logoV2Utils-CoC4nheD.js";n(),s();var c=`default`;async function l(t,n){let r=await e(n.list||c,{subject:t,description:n.description||``,status:`pending`,blocks:[],blockedBy:[]});console.log(`Created task ${r}: ${t}`)}async function u(e){let t=await r(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,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,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 t(r,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(i(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};
@@ -0,0 +1 @@
1
+ import{a as e,n as t,o as n}from"./api-gJBnC8z3.js";n();export{t as fetchCodeSessionsFromSessionsAPI,e as getOAuthHeaders};
@@ -0,0 +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-DiT2Z8dY.js";import{o as g,s as _}from"./log-BMCygSzM.js";import{l as v,u as y}from"./oauth-BqJqV-2M.js";import{Hr as b,Ur as x,Vt as S,kt as C,vn as w,yn as T}from"./model-fi472PRc.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+`Press W in /login to save your key directly (no restart needed), or 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. Press W in /login to save your key, or set ANTHROPIC_API_KEY.`);return{apiKey:t}}async function N(){let e=C()?.accessToken;if(e===void 0)throw Error(`Work Mate web sessions require authentication with a Claude.ai account. API key authentication is not sufficient. Please run /login to authenticate, or check your authentication status with /status.`);let t=await b();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. Please run /login to sign in again.`):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(),x(),a(),S(),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{r as e}from"./asciicast-CbAjUHT_.js";export{e as renameRecordingForSession};
@@ -1,4 +1,4 @@
1
- import{l as e,n as t,o as n}from"./envUtils-DSxRz_kt.js";import{en as r,ht as i,nt as a}from"./state-ix0xIunV.js";import{E as o,O as s,_ as c,h as l,l as u,lt as d,ot as f,p,st as m,ut as h}from"./debug-DiuXEmUq.js";import{m as g}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{i as _}from"./path-Cu_AKqg6.js";import{basename as v,dirname as y,join as b}from"path";import{appendFile as x,rename as S}from"fs/promises";r(),h(),f(),u(),n(),c(),_(),o();var C={filePath:null,timestamp:0};function w(){if(C.filePath!==null)return C.filePath;if(process.env.USER_TYPE!==`ant`||!e(process.env.CLAUDE_CODE_TERMINAL_RECORDING))return null;let n=b(b(t(),`projects`),g(a()));return C.timestamp=Date.now(),C.filePath=b(n,`${i()}-${C.timestamp}.cast`),C.filePath}async function T(){let e=C.filePath;if(!e||C.timestamp===0)return;let n=b(b(b(t(),`projects`),g(a())),`${i()}-${C.timestamp}.cast`);if(e===n)return;await E?.flush();let r=v(e),o=v(n);try{await S(e,n),C.filePath=n,p(`[asciicast] Renamed recording: ${r} → ${o}`)}catch{p(`[asciicast] Failed to rename recording from ${r} to ${o}`)}}var E=null;function D(){return{cols:process.stdout.columns||80,rows:process.stdout.rows||24}}function O(){let e=w();if(!e)return;let{cols:t,rows:n}=D(),r=performance.now(),i=s({version:2,width:t,height:n,timestamp:Math.floor(Date.now()/1e3),env:{SHELL:process.env.SHELL||``,TERM:process.env.TERM||``}});try{l().mkdirSync(y(e))}catch{}l().appendFileSync(e,i+`
2
- `,{mode:384});let a=Promise.resolve(),o=d({writeFn(e){let t=C.filePath;t&&(a=a.then(()=>x(t,e)).catch(()=>{}))},flushIntervalMs:500,maxBufferSize:50,maxBufferBytes:10*1024*1024}),c=process.stdout.write.bind(process.stdout);process.stdout.write=function(e,t,n){let i=(performance.now()-r)/1e3,a=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);return o.write(s([i,`o`,a])+`
3
- `),typeof t==`function`?c(e,t):c(e,t,n)};function u(){let e=(performance.now()-r)/1e3,{cols:t,rows:n}=D();o.write(s([e,`r`,`${t}x${n}`])+`
4
- `)}process.stdout.on(`resize`,u),E={async flush(){o.flush(),await a},async dispose(){o.dispose(),await a,process.stdout.removeListener(`resize`,u),process.stdout.write=c}},m(async()=>{await E?.dispose(),E=null}),p(`[asciicast] Recording to ${e}`)}export{O as n,T as r,w as t};
1
+ import{l as e,n as t,o as n}from"./envUtils-DSxRz_kt.js";import{en as r,ht as i,nt as a}from"./state-ix0xIunV.js";import{S as o,a as s,at as c,d as l,l as u,nt as d,ot as f,p,rt as m,w as h}from"./debug-BrXObCdR.js";import{m as g}from"./sessionStoragePortable-Cx6JQ5Ye.js";import{i as _}from"./path-D5U-tm91.js";import{basename as v,dirname as y,join as b}from"path";import{appendFile as x,rename as S}from"fs/promises";r(),f(),d(),s(),n(),p(),_(),o();var C={filePath:null,timestamp:0};function w(){if(C.filePath!==null)return C.filePath;if(process.env.USER_TYPE!==`ant`||!e(process.env.CLAUDE_CODE_TERMINAL_RECORDING))return null;let n=b(b(t(),`projects`),g(a()));return C.timestamp=Date.now(),C.filePath=b(n,`${i()}-${C.timestamp}.cast`),C.filePath}async function T(){let e=C.filePath;if(!e||C.timestamp===0)return;let n=b(b(b(t(),`projects`),g(a())),`${i()}-${C.timestamp}.cast`);if(e===n)return;await E?.flush();let r=v(e),o=v(n);try{await S(e,n),C.filePath=n,u(`[asciicast] Renamed recording: ${r} → ${o}`)}catch{u(`[asciicast] Failed to rename recording from ${r} to ${o}`)}}var E=null;function D(){return{cols:process.stdout.columns||80,rows:process.stdout.rows||24}}function O(){let e=w();if(!e)return;let{cols:t,rows:n}=D(),r=performance.now(),i=h({version:2,width:t,height:n,timestamp:Math.floor(Date.now()/1e3),env:{SHELL:process.env.SHELL||``,TERM:process.env.TERM||``}});try{l().mkdirSync(y(e))}catch{}l().appendFileSync(e,i+`
2
+ `,{mode:384});let a=Promise.resolve(),o=c({writeFn(e){let t=C.filePath;t&&(a=a.then(()=>x(t,e)).catch(()=>{}))},flushIntervalMs:500,maxBufferSize:50,maxBufferBytes:10*1024*1024}),s=process.stdout.write.bind(process.stdout);process.stdout.write=function(e,t,n){let i=(performance.now()-r)/1e3,a=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);return o.write(h([i,`o`,a])+`
3
+ `),typeof t==`function`?s(e,t):s(e,t,n)};function d(){let e=(performance.now()-r)/1e3,{cols:t,rows:n}=D();o.write(h([e,`r`,`${t}x${n}`])+`
4
+ `)}process.stdout.on(`resize`,d),E={async flush(){o.flush(),await a},async dispose(){o.dispose(),await a,process.stdout.removeListener(`resize`,d),process.stdout.write=s}},m(async()=>{await E?.dispose(),E=null}),u(`[asciicast] Recording to ${e}`)}export{O as n,T as r,w as t};
@@ -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{Bb as p,Lb as m}from"./loadAgentsDir-ZQwvbURI.js";import{_ as h,r as g}from"./git-Cgc8X5l2.js";import{u as _}from"./referral-Cu9bEOFE.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-BJ9o-rIV.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}){p(`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?m():o()}},{context:`Select`});function m(){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(),m(),_(),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{wx as p,xx as m}from"./loadAgentsDir-DrDu5yYy.js";import{_ as h,r as g}from"./git-Do0wJvux.js";import{u as _}from"./referral-DrebVwqx.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}){p(`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?m():o()}},{context:`Select`});function m(){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(),m(),_(),h(),b(),f(),O=l()}))();export{T as NewInstallWizard,E as call,w as computeDefaultInstallDir};
@@ -0,0 +1 @@
1
+ import{Lt as e,Vt as t,bt as n,ht as r,kt as i}from"./model-fi472PRc.js";t();export{r as checkAndRefreshOAuthTokenIfNeeded,n as clearOAuthTokenCache,i as getClaudeAIOAuthTokens,e as handleOAuth401Error};
@@ -0,0 +1,15 @@
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-DrDu5yYy.js";import{F as c,S as l,a as u,l as d,w as ee,z as f}from"./debug-BrXObCdR.js";import{g as te,n as ne}from"./settings-DfWP5y6X.js";import{b as p,c as re,g as m}from"./config-DiT2Z8dY.js";import{o as h,s as g}from"./log-BMCygSzM.js";import{n as _,r as v}from"./analytics-BotDBGh0.js";import{l as y,u as b}from"./oauth-BqJqV-2M.js";import{Br as x,Cn as ie,Ct as S,Dn as C,Gr as w,It as ae,Jr as T,Lr as E,Mn as oe,Mt as se,Ot as D,Qr as O,Rr as k,Ur as A,Vr as j,Vt as M,Yr as N,Zr as P,_n as F,bt as I,dn as L,er as R,fi as z,hn as B,ir as V,kt as H,lr as U,mi as W,mn as G,pn as K,qr as ce,rn as le,ur as ue,wn as de,zr as q}from"./model-fi472PRc.js";import{P as fe,W as J}from"./rcDebugLog-2-1XSyFV.js";import{d as pe,u as me}from"./firstPartyEventLogger-CQdJn3LV.js";import{n as he,t as ge}from"./browser-BmZuQom6.js";import{n as _e}from"./trustedDevice-DvpN4J1F.js";import{a as ve,i as ye,r as be}from"./grove-BGXzEyH9.js";import{t as xe}from"./remoteManagedSettings-CaY_ZH8r.js";import{d as Se,n as Ce,t as we}from"./status-ClSsvm1N.js";import{createHash as Te,randomBytes as Y}from"crypto";import{createServer as Ee}from"http";ve(),s(),M(),oe(),m(),de(),F(),me();async function X(){H.cache?.clear?.(),_e(),C(),B(),pe(),be.cache?.clear?.(),ye.cache?.clear?.(),await xe(),await o()}async function De({clearOnboarding:e=!1}){let{flushTelemetry:t}=await import(`./instrumentation-hrXeo-G4.js`);await t(),await L(),ie().delete(),await X(),p(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(),f(),l(),u(),_(),te(),W(),O(),A(),fe(),a(),b(),m(),V(),h(),ue();async function Oe(){try{if(re().claudeCodeFirstTokenDate!==void 0)return;let e=R();if(e.error){g(Error(`Failed to get auth headers: ${e.error}`));return}let t=`${y().BASE_API_URL}/api/organization/claude_code_first_token_date`,n=(await i.get(t,{headers:{...e.headers,"User-Agent":U()},timeout:1e4})).data?.first_token_date??null;if(n!==null){let e=new Date(n).getTime();if(isNaN(e)){g(Error(`Received invalid first_token_date from API: ${n}`));return}}p(e=>({...e,claudeCodeFirstTokenDate:n}))}catch(e){g(e)}}ge(),b(),h();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,v(`tengu_oauth_automatic_redirect`,{custom_handler:!0});return}let n=T(e)?y().CLAUDEAI_SUCCESS_URL:y().CONSOLE_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:n}),this.pendingResponse.end(),this.pendingResponse=null,v(`tengu_oauth_automatic_redirect`,{})}handleErrorRedirect(){if(!this.pendingResponse)return;let e=y().CLAUDEAI_SUCCESS_URL;this.pendingResponse.writeHead(302,{Location:e}),this.pendingResponse.end(),this.pendingResponse=null,v(`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){g(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))}_(),A(),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=E({...i,isManual:!0}),o=E({...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;v(`tengu_oauth_auth_code_received`,{automatic:c});try{let e=await q(s,r,this.codeVerifier,this.port,!c,t?.expiresIn),n=await j(e.access_token);if(c){let t=w(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:w(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}};_(),A(),M(),m(),h(),Se();async function $(e){await De({clearOnboarding:!1});let t=e.profile??await P(e.accessToken);t?N({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&&N({accountUuid:e.tokenAccount.uuid,emailAddress:e.tokenAccount.emailAddress,organizationUuid:e.tokenAccount.organizationUuid});let n=K(e);if(I(),n.warning&&v(`tengu_oauth_storage_warning`,{warning:n.warning}),await x(e.accessToken).catch(e=>d(String(e),{level:`error`})),T(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
+ `),process.exit(1));let i=ne(),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
+ Set it to the space-separated scopes the refresh token was issued with
4
+ (e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
5
+ `),process.exit(1));let t=e.split(/\s+/).filter(Boolean);try{v(`tengu_login_from_refresh_token`,{});let e=await ce(s,{scopes:t});await $(e);let n=await G();n.valid||(process.stderr.write(n.message+`
6
+ `),process.exit(1)),p(e=>e.hasCompletedOnboarding?e:{...e,hasCompletedOnboarding:!0}),v(`tengu_oauth_success`,{loginWithClaudeAi:T(e.scopes)}),process.stdout.write(`Login successful.
7
+ `),process.exit(0)}catch(e){g(e);let t=J(e);process.stderr.write(`Login failed: ${c(e)}\n${t?t+`
8
+ `:``}`),process.exit(1)}}let l=t?`sso`:void 0,u=new Q;try{v(`tengu_oauth_flow_start`,{loginWithClaudeAi:a}),await $(await u.startOAuthFlow(async e=>{process.stdout.write(`Opening browser to sign in…
9
+ `),process.stdout.write(`If the browser didn't open, visit: ${e}\n`)},{loginWithClaudeAi:a,loginHint:e,loginMethod:l,orgUUID:o}));let t=await G();t.valid||(process.stderr.write(t.message+`
10
+ `),process.exit(1)),v(`tengu_oauth_success`,{loginWithClaudeAi:a}),process.stdout.write(`Login successful.
11
+ `),process.exit(0)}catch(e){g(e);let t=J(e);process.stderr.write(`Login failed: ${c(e)}\n${t?t+`
12
+ `:``}`),process.exit(1)}finally{u.cleanup()}}async function Pe(t){let{source:n,hasToken:r}=D(),{source:i}=S(),a=!!process.env.ANTHROPIC_API_KEY&&!e(),o=se(),s=ae(),c=le(),l=r||i!==`none`||a||c,u=`none`;if(c?u=`third_party`:n===`claude.ai`?u=`claude.ai`:n===`apiKeyHelper`?u=`api_key_helper`:n===`none`?i===`ANTHROPIC_API_KEY`||a?u=`api_key`:i===`/login managed key`&&(u=`claude.ai`):u=`oauth_token`,t.text){let e=[...Ce(),...we()],t=!1;for(let n of e){let e=typeof n.value==`string`?n.value:Array.isArray(n.value)?n.value.join(`, `):null;e===null||e===`none`||(t=!0,n.label?process.stdout.write(`${n.label}: ${e}\n`):process.stdout.write(`${e}\n`))}!t&&a&&process.stdout.write(`API key: ANTHROPIC_API_KEY
13
+ `),l||process.stdout.write(`Not logged in. Run claude auth login to authenticate.
14
+ `)}else{let e=z(),t=i===`none`?a?`ANTHROPIC_API_KEY`:null:i,n={loggedIn:l,authMethod:u,apiProvider:e};t&&(n.apiKeySource=t),u===`claude.ai`&&(n.email=o?.emailAddress??null,n.orgId=o?.organizationUuid??null,n.orgName=o?.organizationName??null,n.subscriptionType=s??null),process.stdout.write(ee(n,null,2)+`
15
+ `)}process.exit(+!l)}export{Q as i,Pe as n,$ as r,Ne as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./auth-CgEABs3i.js";export{t as authLogin,e as authStatus};
@@ -1,4 +1,4 @@
1
- import{Fh as e,Mh as t,Nh as n,Ph as r,jh as i}from"./loadAgentsDir-ZQwvbURI.js";import{E as a,O as o,U as s,z as c}from"./debug-DiuXEmUq.js";import{g as l,t as u}from"./settings-BhvhCpVh.js";import{C as d,_ as f,h as p,u as m}from"./model-BgrLt7P7.js";import{n as h,t as g}from"./poorMode-BqyVuBu-.js";s(),f(),n(),l(),g(),r(),a();function _(e){process.stdout.write(o(e,null,2)+`
1
+ import{Fh as e,Mh as t,Nh as n,Ph as r,jh as i}from"./loadAgentsDir-DrDu5yYy.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-DfWP5y6X.js";import{C as d,_ as f,h as p,u as m}from"./model-fi472PRc.js";import{n as h,t as g}from"./poorMode-CtcqaiwD.js";c(),f(),n(),l(),g(),r(),o();function _(e){process.stdout.write(s(e,null,2)+`
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.
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:
@@ -19,18 +19,18 @@ Be concise and constructive. Only comment on rules that could be improved. If al
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 a=n.model?d(n.model):h()?p():m(),o=t(),s=i(),l=S(`allow`,r?.allow??[],o.allow)+S(`soft_deny`,r?.soft_deny??[],o.soft_deny)+S(`environment`,r?.environment??[],o.environment);process.stdout.write(`Analyzing your auto mode rules…
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…
23
23
 
24
- `);let f;try{f=await e({querySource:`auto_mode_critique`,model:a,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 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:
25
25
 
26
26
  <classifier_system_prompt>
27
- `+s+`
27
+ `+c+`
28
28
  </classifier_system_prompt>
29
29
 
30
30
  Here are the user's custom rules that REPLACE the corresponding default sections:
31
31
 
32
32
  `+l+`
33
- Please critique these custom rules.`}]})}catch(e){process.stderr.write(`Failed to analyze rules: `+c(e)+`
33
+ Please critique these custom rules.`}]})}catch(e){process.stderr.write(`Failed to analyze rules: `+a(e)+`
34
34
  `),process.exitCode=1;return}let g=f.content.find(e=>e.type===`text`);g?.type===`text`?process.stdout.write(g.text+`
35
35
  `):process.stdout.write(`No critique was generated. Please try again.
36
36
  `)}function S(e,t,n){if(t.length===0)return``;let r=t.map(e=>`- `+e).join(`
@@ -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-OxhciwYa.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-DJZ25xZp.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,15 +1,15 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ot as n}from"./state-ix0xIunV.js";import{$w as r,Aw as i,C as a,Dw as o,E as s,Ew as c,Fw as l,Hw as u,Iw as d,Jw as f,Lw as ee,Mw as p,Nw as m,Ow as h,Pw as g,Tw as _,dd as v,fd as te,jw as ne,kw as y,ud as re,x as ie}from"./loadAgentsDir-ZQwvbURI.js";import{s as ae,u as oe}from"./types-Cnorfsss.js";import{a as se,n as ce,o as le,t as ue}from"./bridgeConfig-DDF3teRE.js";import{i as b,o as x}from"./bg-zWGqkcST.js";import{n as S,t as C}from"./state-Cn_m2NOf.js";import{n as w,r as T}from"./pipeTransport-7GIO6GCA.js";import{join as E}from"path";import"crypto";import{readFile as D,readdir as O}from"fs/promises";function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return typeof e==`string`&&z.includes(e)}function j(e){return typeof e==`string`&&B.includes(e)}function M(e){return!k(e)||typeof e.name!=`string`||!j(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 N(e){if(!k(e)||typeof e.runId!=`string`||typeof e.workflow!=`string`||!A(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(M).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 P(e,t){try{return N(oe(await D(E(e,L,`${t}.json`),`utf-8`),!1))}catch{return null}}async function F(e=n()){let t;try{t=await O(E(e,L))}catch{return[]}let r=t.filter(e=>e.endsWith(`.json`));return(await Promise.all(r.slice(0,R).map(t=>P(e,t.slice(0,-5))))).filter(e=>e!==null).sort((e,t)=>t.updatedAt-e.updatedAt)}function I(e){if(e.length===0)return[`Workflow runs: 0`,` none`].join(`
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ot as n}from"./state-ix0xIunV.js";import{C as r,E as i,ET as a,LT as ee,MT as o,_T as s,bT as c,dT as l,dd as u,fT as d,fd as f,gT as te,hT as p,lT as m,mT as h,pT as g,uT as _,ud as v,vT as ne,x as re,xT as ie,yT as y}from"./loadAgentsDir-DrDu5yYy.js";import{s as ae,u as oe}from"./types-C-MRCL8J.js";import{a as se,n as ce,o as le,t as ue}from"./bridgeConfig-DbqUHe0H.js";import{i as b,o as x}from"./bg-WnYN5ifx.js";import{n as S,t as C}from"./state-Cn_m2NOf.js";import{n as w,r as T}from"./pipeTransport-CqCnc-Ys.js";import{join as E}from"path";import"crypto";import{readFile as D,readdir as O}from"fs/promises";function k(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function A(e){return typeof e==`string`&&z.includes(e)}function j(e){return typeof e==`string`&&B.includes(e)}function M(e){return!k(e)||typeof e.name!=`string`||!j(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 N(e){if(!k(e)||typeof e.runId!=`string`||typeof e.workflow!=`string`||!A(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(M).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 P(e,t){try{return N(oe(await D(E(e,L,`${t}.json`),`utf-8`),!1))}catch{return null}}async function F(e=n()){let t;try{t=await O(E(e,L))}catch{return[]}let r=t.filter(e=>e.endsWith(`.json`));return(await Promise.all(r.slice(0,R).map(t=>P(e,t.slice(0,-5))))).filter(e=>e!==null).sort((e,t)=>t.updatedAt-e.updatedAt)}function I(e){if(e.length===0)return[`Workflow runs: 0`,` none`].join(`
2
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
3
  `)}var L,R,z,B,V=e((()=>{t(),ae(),L=E(`.claude`,`workflow-runs`),R=200,z=[`running`,`completed`,`cancelled`],B=[`pending`,`running`,`completed`,`cancelled`]}));function H(){return E(w(),`registry.json`)}async function U(){try{let e=await D(H(),`utf8`),t=JSON.parse(e);return t.version===1?t:{...W}}catch{return{...W}}}var W,de=e((()=>{T(),W={version:1,mainMachineId:null,main:null,subs:[]}}));async function fe(){return pe(await U())}function pe(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
4
  `)}var me=e((()=>{de()}));function he(){try{let e=le(),t=ue();return[`Remote Control: ${e?`self-hosted`:`official`}`,` base_url=${ce()}`,` token=${t?`present`:`missing`}`,` entitlement=checked at remote-control startup`].join(`
5
5
  `)}catch(e){return[`Remote Control: unknown`,` reason=${e instanceof Error?e.message:String(e)}`].join(`
6
6
  `)}}var ge=e((()=>{se()}));async function _e(){let e=S(),t=await x(),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 ve(){let e=!1,t=null;try{e=s(),t=ie()}catch(e){return[`Auto mode: unknown`,` reason=${e instanceof Error?e.message:String(e)}`].join(`
7
+ `)}function ve(){let e=!1,t=null;try{e=i(),t=re()}catch(e){return[`Auto mode: unknown`,` reason=${e instanceof Error?e.message:String(e)}`].join(`
8
8
  `)}return[`Auto mode: ${e?`available`:`unavailable`}`,` reason=${t??`none`}`].join(`
9
- `)}async function G({runs:e,flows:t,nowMs:n=Date.now()}){return Promise.all([Promise.resolve({id:`auto-mode`,title:`Auto Mode`,content:ve()}),Promise.resolve({id:`runs`,title:`Runs`,content:c(e)}),Promise.resolve({id:`flows`,title:`Flows`,content:m(t)}),F().then(e=>({id:`workflow-runs`,title:`Workflow Runs`,content:I(e)})),fe().then(e=>({id:`pipes`,title:`Pipes`,content:e})),_e().then(e=>({id:`runtime`,title:`Runtime`,content:e})),Promise.resolve({id:`remote-control`,title:`Remote Control`,content:he()}),te().then(e=>({id:`remote-trigger`,title:`RemoteTrigger`,content:re(e)}))])}async function ye(e){return(await G(e)).map((e,t)=>[t===0?`# Autonomy Deep Status`:`## ${e.title}`,e.content].join(`
9
+ `)}async function G({runs:e,flows:t,nowMs:n=Date.now()}){return Promise.all([Promise.resolve({id:`auto-mode`,title:`Auto Mode`,content:ve()}),Promise.resolve({id:`runs`,title:`Runs`,content:_(e)}),Promise.resolve({id:`flows`,title:`Flows`,content:s(t)}),F().then(e=>({id:`workflow-runs`,title:`Workflow Runs`,content:I(e)})),fe().then(e=>({id:`pipes`,title:`Pipes`,content:e})),_e().then(e=>({id:`runtime`,title:`Runtime`,content:e})),Promise.resolve({id:`remote-control`,title:`Remote Control`,content:he()}),f().then(e=>({id:`remote-trigger`,title:`RemoteTrigger`,content:v(e)}))])}async function ye(e){return(await G(e)).map((e,t)=>[t===0?`# Autonomy Deep Status`:`## ${e.title}`,e.content].join(`
10
10
  `)).join(`
11
11
 
12
- `)}var be=e((()=>{C(),b(),l(),o(),a(),v(),V(),me(),ge()}));function xe(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 K,Se=e((()=>{K=`Usage: /autonomy [status [--deep]|runs [limit]|flows [limit]|flow <id>|flow cancel <id>|flow resume <id>]`}));function q(e){let t=typeof e==`number`?e:Number.parseInt(e??``,10);return!Number.isFinite(t)||t<=0?10:Math.min(t,50)}async function J(e){let t=e?.rootDir,[n,r]=await Promise.all([h(t),d(t)]);return e?.deep?ye({runs:n,flows:r}):[c(n),m(r)].join(`
13
- `)}async function Ce(e,t){let[n,r]=await Promise.all([h(t?.rootDir),d(t?.rootDir)]),i=(await G({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 we(e){process.stdout.write(`${await J(e)}\n`)}async function Y(e,t){return _(await h(t?.rootDir),q(e))}async function Te(e){process.stdout.write(`${await Y(e)}\n`)}async function X(e,t){return p(await d(t?.rootDir),q(e))}async function Ee(e){process.stdout.write(`${await X(e)}\n`)}async function Z(e,t){return ne(await g(e,t?.rootDir))}async function De(e){process.stdout.write(`${await Z(e)}\n`)}async function Q(e,t){let n=await ee({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 y(e.autonomy.runId,t?.rootDir)}else{for(let e of n.queuedRunIds)await y(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 i({flowId:e,rootDir:t?.rootDir,currentDir:t?.currentDir});if(!n)return`Autonomy flow is not waiting or was not found.`;if(t?.enqueueInMemory)return u(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=xe(e);switch(n.type){case`status`:return J({deep:n.deep});case`runs`:return Y(n.limit);case`flows`:return X(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 K}}var je=e((()=>{l(),o(),be(),Se(),f()}));export{Te as a,Ae as c,X as d,Y as f,$ as g,q as h,Ee as i,Ce as l,je as m,De as n,we as o,J as p,ke as r,Q as s,Oe as t,Z as u};
12
+ `)}var be=e((()=>{C(),b(),y(),l(),r(),u(),V(),me(),ge()}));function xe(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 K,Se=e((()=>{K=`Usage: /autonomy [status [--deep]|runs [limit]|flows [limit]|flow <id>|flow cancel <id>|flow resume <id>]`}));function q(e){let t=typeof e==`number`?e:Number.parseInt(e??``,10);return!Number.isFinite(t)||t<=0?10:Math.min(t,50)}async function J(e){let t=e?.rootDir,[n,r]=await Promise.all([d(t),c(t)]);return e?.deep?ye({runs:n,flows:r}):[_(n),s(r)].join(`
13
+ `)}async function Ce(e,t){let[n,r]=await Promise.all([d(t?.rootDir),c(t?.rootDir)]),i=(await G({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 we(e){process.stdout.write(`${await J(e)}\n`)}async function Y(e,t){return m(await d(t?.rootDir),q(e))}async function Te(e){process.stdout.write(`${await Y(e)}\n`)}async function X(e,t){return te(await c(t?.rootDir),q(e))}async function Ee(e){process.stdout.write(`${await X(e)}\n`)}async function Z(e,t){return p(await ne(e,t?.rootDir))}async function De(e){process.stdout.write(`${await Z(e)}\n`)}async function Q(e,t){let n=await ie({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 r=0;if(t?.removeQueuedInMemory){let n=ee(t=>t.autonomy?.flowId===e);r=n.length;for(let e of n)e.autonomy?.runId&&await g(e.autonomy.runId,t?.rootDir)}else{for(let e of n.queuedRunIds)await g(e,t?.rootDir);r=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 ${r} queued step(s).`}async function Oe(e){process.stdout.write(`${await Q(e)}\n`)}async function $(e,t){let n=await h({flowId:e,rootDir:t?.rootDir,currentDir:t?.currentDir});if(!n)return`Autonomy flow is not waiting or was not found.`;if(t?.enqueueInMemory)return a(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=xe(e);switch(n.type){case`status`:return J({deep:n.deep});case`runs`:return Y(n.limit);case`flows`:return X(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 K}}var je=e((()=>{y(),l(),be(),Se(),o()}));export{Te as a,Ae as c,X as d,Y as f,$ as g,q as h,Ee as i,Ce as l,je as m,De as n,we as o,J 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{Bb as l,Fw as u,Iw as d,Lb as f}from"./loadAgentsDir-ZQwvbURI.js";import{c as p,l as m,m as h,p as g}from"./autonomy-OxhciwYa.js";function _(){return S}function v({onDone:e}){l(`autonomy-panel`);let[t,i]=(0,b.useState)(0),[o,c]=(0,b.useState)([]);(0,b.useEffect)(()=>{let e=!1;return d().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(),f(),h(),u(),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{bT as l,wx as u,xx as d,yT as f}from"./loadAgentsDir-DrDu5yYy.js";import{c as p,l as m,m as h,p as g}from"./autonomy-DJZ25xZp.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 l().then(t=>{e||c(t.slice(0,5))}),()=>{e=!0}},[]);let d=(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=d[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(d.length-1,e+1));return}t.return&&f()}),(0,x.jsx)(s,{title:`Autonomy`,subtitle:`${d.length} actions`,onCancel:()=>e(`Autonomy panel dismissed`,{display:`system`}),color:`background`,hideInputGuide:!0,children:(0,x.jsxs)(n,{flexDirection:`column`,children:[d.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(),d(),h(),f(),x=c(),S=14,C=24}))();export{y as call,_ as getAutonomyPanelBaseActionCountForTests};
@@ -1,5 +1,5 @@
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{Et as s,Fx as c,Jg as l,Kg as u,Px as d,So as f,To as ee,Xl as te,Yb as ne,Yl as p,aw as m,br as h,dT as g,et as _,ht as v,iw as y,jr as re,lw as ie,nt as ae,qb as oe,wo as se,zo as b}from"./loadAgentsDir-ZQwvbURI.js";import{n as ce,t as le}from"./cwd-CYmmnQVS.js";import{E as ue,J as de,U as x,_ as fe,h as S,l as C,p as w}from"./debug-DiuXEmUq.js";import{f as T,g as E,v as D}from"./settings-BhvhCpVh.js";import{C as O,T as k,w as A}from"./config-662VDD70.js";import{o as j,s as M,v as N,y as P}from"./log-Duzb4o6h.js";import{n as F,r as I}from"./analytics-BotDBGh0.js";import{_ as L,h as R}from"./model-BgrLt7P7.js";import{Cn as z,Sn as B}from"./prompt-wys9CwDo.js";import{st as V}from"./rcDebugLog-CivJaJ3V.js";import{i as H,t as U}from"./nativeInstaller-DKe1pWoL.js";import{n as pe,t as me}from"./allErrors-CDWTJcMw.js";import{n as he,r as ge}from"./magicDocs-D1FIPmYg.js";import{n as _e,t as ve}from"./pluginAutoupdate-7FFHzSRz.js";import{n as ye,r as be}from"./registerProtocol-B_XbLDQO.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(),fe(),C(),P(),E(),L(),z(),ie(),te(),re(),ge(),_(),j(),x(),b(),g(),_(),m(),x(),j(),b(),g();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 ae({messages:[f({content:`You are editing a skill definition file. Apply the following improvements to the skill.
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{Et as s,Hw as c,Jg as l,Kg as u,Nx as d,So as f,To as ee,Uw as te,Xl as ne,YT as p,Yl as m,br as h,et as g,ht as _,jr as v,jx as y,nt as re,qw as ie,vS as ae,wo as oe,yS as se,zo as b}from"./loadAgentsDir-DrDu5yYy.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,v as D}from"./settings-DfWP5y6X.js";import{C as O,T as k,w as A}from"./config-DiT2Z8dY.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-fi472PRc.js";import{Tn as z,wn as B}from"./prompt-C0nU0VK3.js";import{st as V}from"./rcDebugLog-2-1XSyFV.js";import{i as H,t as U}from"./nativeInstaller-DktvrWRd.js";import{n as pe,t as me}from"./allErrors-DJYCAtab.js";import{n as he,r as ge}from"./magicDocs-kMjYpjCA.js";import{n as _e,t as ve}from"./pluginAutoupdate-L09CQ-ph.js";import{n as ye,r as be}from"./registerProtocol-CukLQuxJ.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(),L(),z(),ie(),ne(),v(),ge(),g(),j(),w(),b(),p(),g(),te(),w(),j(),b(),p();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(),l=await re({messages:[f({content:`You are editing a skill definition file. Apply the following improvements to the skill.
3
3
 
4
4
  <current_skill_file>
5
5
  ${a}
@@ -14,4 +14,4 @@ Rules:
14
14
  - Preserve frontmatter (--- block) exactly as-is
15
15
  - Preserve the overall format and style
16
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:y().signal,options:{getToolPermissionContext:async()=>B(),model:s,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),l=se(ee(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(),ne(),O(),j(),U(),c(),pe(),l(),s();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 S().readdir(e);for(let a of i)try{Te(a.name)<t&&(await S().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=S(),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=h(),r=S(),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,u),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=S(),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=S();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=S();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=S(),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){w(`npm cache cleanup: skipping, ran recently`);return}}catch{}try{await A(e,{retries:0,realpath:!1})}catch{w(`npm cache cleanup: skipping, lock held`);return}w(`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?w(`npm cache cleanup: Removed ${l.length} old @anthropic-ai entries in ${u}ms`):w(`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){w(`version cleanup: skipping, ran recently`);return}}catch{}try{await A(e,{retries:0,realpath:!1})}catch{w(`version cleanup: skipping, lock held`);return}w(`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`)){w(`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 oe(),await d(K());let t=await v(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-BqN8fWZ5.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),p(),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};
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:c().signal,options:{getToolPermissionContext:async()=>B(),model:s,toolChoice:void 0,isNonInteractiveSession:!1,hasAppendSystemPrompt:!1,temperatureOverride:0,agents:[],querySource:`skill_improvement_apply`,mcpTools:[]}}),u=oe(ee(Array.isArray(l.message.content)?l.message.content:[]).trim(),`updated_file`);if(!u){M(Error(`Skill improvement apply: no updated_file tag in response`));return}try{await r.writeFile(i,u,`utf-8`)}catch(e){M(de(e))}}F(),d(),O(),j(),U(),se(),pe(),l(),s();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=h(),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,u),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 y(),await ae(K());let t=await _(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-CXGZGe0h.js`).then(({initExtractMemories:e})=>{e()}).catch(()=>{}),m(),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};
@@ -0,0 +1 @@
1
+ import{t as e}from"./backgroundHousekeeping-BHncba6e.js";export{e as startBackgroundHousekeeping};
@@ -1,2 +1,2 @@
1
- import{S as e,T as t,_ as n,s as r}from"./git-Cgc8X5l2.js";import{b as i,h as a,p as o}from"./startupProfiler-BquH_Yqm.js";import{homedir as s}from"os";import{join as c,sep as l}from"path";import{stat as u}from"fs/promises";i(),t(),n();var d=10080*60*1e3,f=1e3;function p(e){let t=[`This session was opened by an external deep link in ${g(e.cwd)}`];if(e.repo){let n=e.lastFetch?a(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>d;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — CLAUDE.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>f?`The prompt below (${o(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
1
+ import{S as e,T as t,_ as n,s as r}from"./git-Do0wJvux.js";import{b as i,h as a,p as o}from"./startupProfiler-xa3NmN7Z.js";import{homedir as s}from"os";import{join as c,sep as l}from"path";import{stat as u}from"fs/promises";i(),t(),n();var d=10080*60*1e3,f=1e3;function p(e){let t=[`This session was opened by an external deep link in ${g(e.cwd)}`];if(e.repo){let n=e.lastFetch?a(e.lastFetch):`never`,r=!e.lastFetch||Date.now()-e.lastFetch.getTime()>d;t.push(`Resolved ${e.repo} from local clones · last fetched ${n}${r?` — CLAUDE.md may be stale`:``}`)}return e.prefillLength&&t.push(e.prefillLength>f?`The prompt below (${o(e.prefillLength)} chars) was supplied by the link — scroll to review the entire prompt before pressing Enter.`:`The prompt below was supplied by the link — review carefully before pressing Enter.`),t.join(`
2
2
  `)}async function m(t){let n=await r(t);if(!n)return;let i=await e(n),[a,o]=await Promise.all([h(c(n,`FETCH_HEAD`)),i?h(c(i,`FETCH_HEAD`)):Promise.resolve(void 0)]);return a&&o?a>o?a:o:a??o}async function h(e){try{let{mtime:t}=await u(e);return t}catch{return}}function g(e){let t=s();return e===t?`~`:e.startsWith(t+l)?`~`+e.slice(t.length):e}export{m as n,p as t};
@@ -0,0 +1 @@
1
+ import{a as e,c as t,i as n,r,s as i,t as a}from"./bg-WnYN5ifx.js";n();export{a as attachHandler,r as handleBgStart,e as killHandler,i as logsHandler,t as psHandler};