claude-code-best 2.8.0 → 2.8.1

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 (451) hide show
  1. package/README.md +3 -0
  2. package/dist/chunks/{AddWorkspaceDirectory-DRO4tbYd.js → AddWorkspaceDirectory-CNyPaerF.js} +1 -1
  3. package/dist/chunks/{App-DJyiiVKi.js → App-hiKxO6UA.js} +1 -1
  4. package/dist/chunks/{ApproveApiKey-DygOEAkM.js → ApproveApiKey-Cd43j9Wa.js} +1 -1
  5. package/dist/chunks/ApproveApiKey-DUoUTxFp.js +1 -0
  6. package/dist/chunks/{AssistantSessionChooser-C67mOxVi.js → AssistantSessionChooser-C8OxwSGM.js} +1 -1
  7. package/dist/chunks/{BackgroundTasksDialog-Bqk_Cn3j.js → BackgroundTasksDialog-VKhuyQLe.js} +2 -2
  8. package/dist/chunks/{BypassPermissionsModeDialog-C4z7RkFV.js → BypassPermissionsModeDialog-Ddjzluka.js} +1 -1
  9. package/dist/chunks/{ClaudeInChromeOnboarding-CyVFdjBe.js → ClaudeInChromeOnboarding-BhvrEJlm.js} +1 -1
  10. package/dist/chunks/ClaudeMdExternalIncludesDialog-COO2W0ij.js +1 -0
  11. package/dist/chunks/{ClaudeMdExternalIncludesDialog-IpqqBuJs.js → ClaudeMdExternalIncludesDialog-DoNd72PS.js} +1 -1
  12. package/dist/chunks/ConsoleOAuthFlow-CPWq7O57.js +1 -0
  13. package/dist/chunks/{DesktopHandoff-CJpa8Xy-.js → DesktopHandoff-DVUOZjb0.js} +1 -1
  14. package/dist/chunks/{DevChannelsDialog-CfAuHVRL.js → DevChannelsDialog-DJbRHAIy.js} +1 -1
  15. package/dist/chunks/Dialog-91X6ZGg9.js +1 -0
  16. package/dist/chunks/{DiffDialog-CV3brWsG.js → DiffDialog-D0RK4t-9.js} +2 -2
  17. package/dist/chunks/{Doctor-D3GysagF.js → Doctor-0Nv3L1Oy.js} +1 -1
  18. package/dist/chunks/Doctor-Ba9zhV0V.js +1 -0
  19. package/dist/chunks/{ExitFlow-L2sh80sm.js → ExitFlow-BPbtGcEg.js} +1 -1
  20. package/dist/chunks/{Feedback-DfkBCvva.js → Feedback-BSagYjmf.js} +1 -1
  21. package/dist/chunks/{Grove-Bo74aZx-.js → Grove-BrP9JNpK.js} +1 -1
  22. package/dist/chunks/Grove-DyvIToPa.js +1 -0
  23. package/dist/chunks/{HybridTransport-BItIDJyC.js → HybridTransport-DLaxmXCR.js} +1 -1
  24. package/dist/chunks/{ITermBackend-3iS8Bvmo.js → ITermBackend-tXN55G2D.js} +1 -1
  25. package/dist/chunks/{InvalidConfigDialog-6lPGcuOX.js → InvalidConfigDialog-BzFQdfwu.js} +1 -1
  26. package/dist/chunks/{InvalidSettingsDialog-D8DwHiys.js → InvalidSettingsDialog-KFg61s41.js} +1 -1
  27. package/dist/chunks/ListItem-DCQhApdJ.js +1 -0
  28. package/dist/chunks/{MCPConnectionManager-CsPizxTx.js → MCPConnectionManager-N-oJu3qn.js} +1 -1
  29. package/dist/chunks/{McpParsingWarnings-Cepe7RPZ.js → McpParsingWarnings-DsHSSgsx.js} +1 -1
  30. package/dist/chunks/{MessageSelector-BzUQUeDn.js → MessageSelector-D10JMnsc.js} +2 -2
  31. package/dist/chunks/Messages-CQdQJ2AA.js +11 -0
  32. package/dist/chunks/{Onboarding-BZUXID6q.js → Onboarding-DBJX6Cnf.js} +1 -1
  33. package/dist/chunks/{OverageCreditUpsell-Dhm7HBuD.js → OverageCreditUpsell-B4beCEX2.js} +1 -1
  34. package/dist/chunks/{PermissionDialog-BrRBxx5o.js → PermissionDialog-R-Vl4Tk-.js} +1 -1
  35. package/dist/chunks/{PluginSettings-BZ-PX9Tg.js → PluginSettings-BBrFCSpQ.js} +1 -1
  36. package/dist/chunks/{PressEnterToContinue-DtA_p3X6.js → PressEnterToContinue-BYdiZwYD.js} +1 -1
  37. package/dist/chunks/{PromptInputFooterSuggestions-Da8Fty6P.js → PromptInputFooterSuggestions-DAFZfAT0.js} +1 -1
  38. package/dist/chunks/{PromptInputHelpMenu-Bz7EPzzq.js → PromptInputHelpMenu-Bjjr3tYl.js} +1 -1
  39. package/dist/chunks/{QueryEngine-CmJK27jU.js → QueryEngine-BSk8-8vB.js} +1 -1
  40. package/dist/chunks/{REPL-DxEJZpIp.js → REPL-CXcCBQuz.js} +13 -13
  41. package/dist/chunks/REPL-D-akKdFc.js +1 -0
  42. package/dist/chunks/{RemoteCallout-DONJj8l2.js → RemoteCallout-CuxqarhC.js} +1 -1
  43. package/dist/chunks/{RemoteSessionManager-BvvNspY8.js → RemoteSessionManager-BhPF41Wn.js} +1 -1
  44. package/dist/chunks/{ResumeConversation-EpjJdFHu.js → ResumeConversation-hmIOkZ2U.js} +1 -1
  45. package/dist/chunks/{SSETransport-D51Jfdaj.js → SSETransport-8yaTbdSK.js} +1 -1
  46. package/dist/chunks/SearchBox-Bu4gYF0J.js +1 -0
  47. package/dist/chunks/SearchExtraToolsTool-wDSdfnRo.js +1 -0
  48. package/dist/chunks/SentryErrorBoundary-Duyg6HeT.js +1 -0
  49. package/dist/chunks/{SentryErrorBoundary-nYTimi4l.js → SentryErrorBoundary-ydwbrVTx.js} +1 -1
  50. package/dist/chunks/{Settings-C2vEJjLx.js → Settings-BSbzT25q.js} +2 -2
  51. package/dist/chunks/{TeleportProgress--jgrqIfW.js → TeleportProgress-CNcl_DxR.js} +1 -1
  52. package/dist/chunks/{TeleportRepoMismatchDialog-BKDaFT_L.js → TeleportRepoMismatchDialog-DJc8_mjE.js} +1 -1
  53. package/dist/chunks/{TeleportResumeWrapper-CxlpiHIz.js → TeleportResumeWrapper-Cw438s-J.js} +1 -1
  54. package/dist/chunks/{ThemePicker-CYL4C-F-.js → ThemePicker-8X6yAwuQ.js} +1 -1
  55. package/dist/chunks/{TmuxBackend-C_N4ww8i.js → TmuxBackend-CqAnVFoI.js} +1 -1
  56. package/dist/chunks/{TrustDialog-CYdftZ1M.js → TrustDialog-Ch1FJzxi.js} +1 -1
  57. package/dist/chunks/{ValidationErrorsList-CaTwOP3f.js → ValidationErrorsList-sgfvJPWZ.js} +1 -1
  58. package/dist/chunks/{WelcomeV2-5rgKm4Mz.js → WelcomeV2-Bu8l3w90.js} +1 -1
  59. package/dist/chunks/{WindowsTerminalBackend-BzoSs0VA.js → WindowsTerminalBackend-Bvq7nHOp.js} +1 -1
  60. package/dist/chunks/{add-dir-RNzFR3XZ.js → add-dir-DqrRNnxe.js} +1 -1
  61. package/dist/chunks/{agentDisplay-DgeOQY1E.js → agentDisplay-DcxzWi1v.js} +1 -1
  62. package/dist/chunks/{agents-D7cgzb3f.js → agents-Do1ynqiW.js} +1 -1
  63. package/dist/chunks/{agents-iMtFurok.js → agents-QqLm1wcM.js} +1 -1
  64. package/dist/chunks/{ant-CF1iRpXD.js → ant-D5gD6O-r.js} +1 -1
  65. package/dist/chunks/api-VMfJpk1G.js +1 -0
  66. package/dist/chunks/{api-DMbWqJlK.js → api-hcsOinLV.js} +1 -1
  67. package/dist/chunks/{artifacts-D2kY_AMp.js → artifacts-DH8c2yG0.js} +1 -1
  68. package/dist/chunks/{assistant-JAqAZqaE.js → assistant-CemNvrYr.js} +1 -1
  69. package/dist/chunks/assistant-D7D1sqTB.js +1 -0
  70. package/dist/chunks/{assistant-CZ4VXgzH.js → assistant-DkECAILU.js} +1 -1
  71. package/dist/chunks/auth-CGdLe3rq.js +1 -0
  72. package/dist/chunks/{auth-BemPA3ot.js → auth-Dm8aWPRh.js} +1 -1
  73. package/dist/chunks/{autoMode-CGovMAzJ.js → autoMode-dygqoN_C.js} +1 -1
  74. package/dist/chunks/{autonomy-BVXyNEj0.js → autonomy-BdxnxJnk.js} +1 -1
  75. package/dist/chunks/{autonomy-BnAHLZWH.js → autonomy-DPeEmb00.js} +1 -1
  76. package/dist/chunks/{autonomyPanel-COMI2iR0.js → autonomyPanel-Bocl2taZ.js} +1 -1
  77. package/dist/chunks/backgroundHousekeeping-4H6yTjsj.js +1 -0
  78. package/dist/chunks/{backgroundHousekeeping-BRtG20l2.js → backgroundHousekeeping-zf-tDimg.js} +2 -2
  79. package/dist/chunks/{banner-D_rqe2XQ.js → banner-DUL-7A0b.js} +1 -1
  80. package/dist/chunks/{branch-BnKwIQtC.js → branch-DwdVgun5.js} +1 -1
  81. package/dist/chunks/{break-cache-CDzQDHwY.js → break-cache-DjCRzxDv.js} +1 -1
  82. package/dist/chunks/{bridge-ChVjEHVq.js → bridge-DkkMogD_.js} +2 -2
  83. package/dist/chunks/bridgeConfig-CTJBoASk.js +1 -0
  84. package/dist/chunks/{bridgeConfig-e0MGfed6.js → bridgeConfig-l6Ldi_hk.js} +1 -1
  85. package/dist/chunks/{bridgeEnabled-DR-v8AXw.js → bridgeEnabled-DYclTb9d.js} +1 -1
  86. package/dist/chunks/bridgeEnabled-SMuWz3Is.js +1 -0
  87. package/dist/chunks/{bridgeMain-OsR-_PRp.js → bridgeMain-Ct5oDosG.js} +11 -11
  88. package/dist/chunks/bridgeMain-UqwOi37W.js +1 -0
  89. package/dist/chunks/{bridgeMessaging-BvBnxgD4.js → bridgeMessaging-CYe1Cixl.js} +1 -1
  90. package/dist/chunks/{btw-_b16RGoh.js → btw-CyOlY5R-.js} +1 -1
  91. package/dist/chunks/{buddy-DJ3QSQyd.js → buddy-q-utA1_5.js} +1 -1
  92. package/dist/chunks/{bypassPermissionsKillswitch-OhGSWZrB.js → bypassPermissionsKillswitch-CTrRxzdz.js} +1 -1
  93. package/dist/chunks/{caches-Bp4F7tZ5.js → caches-Bz4yVQyE.js} +2 -2
  94. package/dist/chunks/caches-DKMoKTAZ.js +1 -0
  95. package/dist/chunks/{ccrClient-D7pEGzQa.js → ccrClient-DXiEw9xU.js} +1 -1
  96. package/dist/chunks/changeDetector--KPj2maX.js +1 -0
  97. package/dist/chunks/{channelNotification-BZFMAWln.js → channelNotification-CLPdvxGZ.js} +1 -1
  98. package/dist/chunks/channelNotification-fJgjqRMx.js +1 -0
  99. package/dist/chunks/{chrome-B5IxDA16.js → chrome-DxbhLWDW.js} +1 -1
  100. package/dist/chunks/clear-CYVCwiwu.js +1 -0
  101. package/dist/chunks/client-DvWRsIpi.js +1 -0
  102. package/dist/chunks/{color-BYVWpzI8.js → color-DiLtK8_L.js} +1 -1
  103. package/dist/chunks/commands-BT2_ICaW.js +1 -0
  104. package/dist/chunks/commitAttribution-Bpbro1a4.js +1 -0
  105. package/dist/chunks/{commitAttribution-ClSlXMPG.js → commitAttribution-CJXF8wMs.js} +1 -1
  106. package/dist/chunks/{compact-B9c12JXf.js → compact-C6xm1N5a.js} +1 -1
  107. package/dist/chunks/{companion-C8e7dVlu.js → companion-rXSt0nmz.js} +1 -1
  108. package/dist/chunks/completionCache-BQgiR45Q.js +1 -0
  109. package/dist/chunks/{completionCache-Br6OwASx.js → completionCache-C7hDqIDL.js} +1 -1
  110. package/dist/chunks/{config-C-yz-f4W.js → config-BE3jrcr-.js} +1 -1
  111. package/dist/chunks/{config-Bxgfx_nO.js → config-CzC08IjE.js} +1 -1
  112. package/dist/chunks/{context-Bf5t6C-a.js → context-BHE99SMA.js} +1 -1
  113. package/dist/chunks/context-noninteractive-BQDOgVUW.js +1 -0
  114. package/dist/chunks/{context-noninteractive-CJu7hZCM.js → context-noninteractive-BZQIUH_y.js} +13 -13
  115. package/dist/chunks/conversation-Bt6QdGd-.js +1 -0
  116. package/dist/chunks/{conversation-BYMS5Hqa.js → conversation-CBPRFDod.js} +1 -1
  117. package/dist/chunks/{copy-C0BZ7Gm0.js → copy-TgphIVzy.js} +1 -1
  118. package/dist/chunks/{createSSHSession-DNXCWneI.js → createSSHSession-CSKEZ4ic.js} +1 -1
  119. package/dist/chunks/createSession-BaHXBnfG.js +1 -0
  120. package/dist/chunks/{createSession-DjM6Ev45.js → createSession-Ce218tQj.js} +1 -1
  121. package/dist/chunks/{cronJitterConfig-CaFkPXKB.js → cronJitterConfig-CnKed5Gi.js} +1 -1
  122. package/dist/chunks/crossProjectResume-BFlsTYOq.js +40 -0
  123. package/dist/chunks/{datadog-ClZjR-jM.js → datadog-D5jSRybW.js} +1 -1
  124. package/dist/chunks/datadog-DgYqUGa-.js +1 -0
  125. package/dist/chunks/desktop-cjA0tGOa.js +1 -0
  126. package/dist/chunks/{diff-D9hjPq4W.js → diff-DMd61IjE.js} +1 -1
  127. package/dist/chunks/{doctor-4-im_J_h.js → doctor-ueUYyjyL.js} +1 -1
  128. package/dist/chunks/{effort-Bz-9GIpe.js → effort-B9IvAstG.js} +1 -1
  129. package/dist/chunks/entry-Bq_KRMWs.js +14 -0
  130. package/dist/chunks/{envLessBridgeConfig-DW4-nPbZ.js → envLessBridgeConfig-CpjlwmvF.js} +1 -1
  131. package/dist/chunks/envLessBridgeConfig-D_GCqhTu.js +1 -0
  132. package/dist/chunks/{exit-DBNDTR4b.js → exit-DtjFIrvJ.js} +1 -1
  133. package/dist/chunks/{export-CQHUM_Nv.js → export-CP638-TO.js} +1 -1
  134. package/dist/chunks/{exportRenderer-CuIDQBLH.js → exportRenderer-B5emJDvn.js} +1 -1
  135. package/dist/chunks/extra-usage-C4dUWLhg.js +1 -0
  136. package/dist/chunks/{extra-usage-DTr6gExD.js → extra-usage-DIm8nrKj.js} +1 -1
  137. package/dist/chunks/{extra-usage-core-D3CwYO_8.js → extra-usage-core-DERKSEe1.js} +1 -1
  138. package/dist/chunks/{extra-usage-noninteractive-d-QVg1D5.js → extra-usage-noninteractive-Dq5dog_-.js} +1 -1
  139. package/dist/chunks/{extraUsage-BNRQOkgU.js → extraUsage-BMvDY0Sk.js} +1 -1
  140. package/dist/chunks/extractMemories-DS7XXeEo.js +1 -0
  141. package/dist/chunks/{fast-bkGXbuHX.js → fast-BP2t1xDM.js} +1 -1
  142. package/dist/chunks/fast-D1xIHYaN.js +1 -0
  143. package/dist/chunks/{feedback-BvFgE_FF.js → feedback-C-mR6zJr.js} +1 -1
  144. package/dist/chunks/{firstPartyEventLogger-D-ifHvWu.js → firstPartyEventLogger-sMmHdYjg.js} +1 -1
  145. package/dist/chunks/{flushGate-BA24vFBg.js → flushGate-C18XwNsa.js} +1 -1
  146. package/dist/chunks/{fpsMetrics-CBFlAGTS.js → fpsMetrics-DH78PzGr.js} +1 -1
  147. package/dist/chunks/{gates-C66Nz9b2.js → gates-Be5r2kKS.js} +1 -1
  148. package/dist/chunks/gates-CUAwAhPL.js +1 -0
  149. package/dist/chunks/{gemini-DuQl4hTA.js → gemini-BberPcp1.js} +1 -1
  150. package/dist/chunks/{generateRecap-CwBU76xi.js → generateRecap-B76UcVUS.js} +1 -1
  151. package/dist/chunks/{generateSessionName-LnmjE9jh.js → generateSessionName-BwtXd8TC.js} +1 -1
  152. package/dist/chunks/{githubRepoPathMapping-DrreQj47.js → githubRepoPathMapping-5IlVgR2l.js} +1 -1
  153. package/dist/chunks/{goal-BIvjF6B7.js → goal-DQ0jNcLO.js} +1 -1
  154. package/dist/chunks/{grok-KNLYSRBQ.js → grok-Dh_thT2_.js} +1 -1
  155. package/dist/chunks/{growthbook-ksjGAskq.js → growthbook-4ADV3CAt.js} +1 -1
  156. package/dist/chunks/{heapdump-Cz8vkcOr.js → heapdump-Dwqmh4SX.js} +1 -1
  157. package/dist/chunks/{help-Cx9OordP.js → help-Bznaywoi.js} +1 -1
  158. package/dist/chunks/hooks-DynUngv2.js +1 -0
  159. package/dist/chunks/{hooks-BW-d9Bdu.js → hooks-F-82cg6M.js} +1 -1
  160. package/dist/chunks/{hostAdapter-DLmaB6eN.js → hostAdapter-DpfLr3hX.js} +1 -1
  161. package/dist/chunks/{ide-CECrIg1r.js → ide-BfAKWufQ.js} +1 -1
  162. package/dist/chunks/{inboundAttachments-B0sGIu79.js → inboundAttachments-CFV_eqMu.js} +1 -1
  163. package/dist/chunks/inboundAttachments-Cug-8Xdy.js +1 -0
  164. package/dist/chunks/{initReplBridge-BAEMZEcg.js → initReplBridge-DV9KhSic.js} +1 -1
  165. package/dist/chunks/{insights-DeWggLxC.js → insights-BNsCwNYa.js} +1 -1
  166. package/dist/chunks/{install-pxH_HR1p.js → install-Bszzs98N.js} +1 -1
  167. package/dist/chunks/{install-github-app-DqKEiHQ1.js → install-github-app-DVxGR2rp.js} +1 -1
  168. package/dist/chunks/{install-slack-app-P1L9x-YI.js → install-slack-app-CjlRL19o.js} +1 -1
  169. package/dist/chunks/{instrumentation-Dx0s2jzr.js → instrumentation-BOYPOtyu.js} +3 -3
  170. package/dist/chunks/{job-CbxxkPgE.js → job-BvD5_lGz.js} +1 -1
  171. package/dist/chunks/{keybindings-BBPC7FAc.js → keybindings-RPmPPGhp.js} +1 -1
  172. package/dist/chunks/{lang-CKp0Tn76.js → lang-9VNaOJMz.js} +1 -1
  173. package/dist/chunks/language-CjFs6_la.js +1 -0
  174. package/dist/chunks/{language-iERMuOEu.js → language-Ct5Nkqm6.js} +1 -1
  175. package/dist/chunks/{launchAgentsPlatform-DQvKVtl2.js → launchAgentsPlatform-CnoxFIXV.js} +1 -1
  176. package/dist/chunks/{launchAutofixPr-B7hu9C8h.js → launchAutofixPr-ChaDUtvx.js} +1 -1
  177. package/dist/chunks/{launchCommand-CJsikSlW.js → launchCommand-9eYsPG7W.js} +1 -1
  178. package/dist/chunks/{launchLocalMemory-Cpz7L5j5.js → launchLocalMemory-MwZfEJxz.js} +1 -1
  179. package/dist/chunks/{launchLocalVault-XLfOQtP7.js → launchLocalVault-B6Ib5WXx.js} +1 -1
  180. package/dist/chunks/{launchMemoryStores-Cz04PaDE.js → launchMemoryStores-D6xyGwQ1.js} +1 -1
  181. package/dist/chunks/{launchOnboarding-XPbUNdHS.js → launchOnboarding-BtdAOO3p.js} +1 -1
  182. package/dist/chunks/{launchSchedule-B1VEe3o-.js → launchSchedule-XVljzNKg.js} +1 -1
  183. package/dist/chunks/{launchSkillStore-Cy59z5xx.js → launchSkillStore-QT8Qcc5N.js} +1 -1
  184. package/dist/chunks/{launchTeleport-ZPM_DvzK.js → launchTeleport-DwxPesKQ.js} +1 -1
  185. package/dist/chunks/{launchVault-BhnTOZq8.js → launchVault-Dbti6pph.js} +1 -1
  186. package/dist/chunks/{loadAgentsDir-CQF8qhne.js → loadAgentsDir-BYWykYwn.js} +777 -777
  187. package/dist/chunks/loadAgentsDir-tPgCg0WD.js +1 -0
  188. package/dist/chunks/{loadPluginHooks-TyULD8KH.js → loadPluginHooks-2U3UO__Q.js} +1 -1
  189. package/dist/chunks/localSearch-CxwxzM8W.js +1 -0
  190. package/dist/chunks/{localSearch-BNYypHsK.js → localSearch-eWjZxMc8.js} +1 -1
  191. package/dist/chunks/login-CVVFklZw.js +1 -0
  192. package/dist/chunks/{login-CxbcJk9_.js → login-D1aQCqp0.js} +1 -1
  193. package/dist/chunks/{logoV2Utils-Br_w1z39.js → logoV2Utils-CPNvLtol.js} +1 -1
  194. package/dist/chunks/logout-BYsszpXx.js +1 -0
  195. package/dist/chunks/{magicDocs-DnxdS9yV.js → magicDocs-DAvjAbAJ.js} +1 -1
  196. package/dist/chunks/{main-FBmdv32j.js → main-BKlQiSuc.js} +31 -31
  197. package/dist/chunks/{mappers-BNI_df3v.js → mappers-BBkM1aA5.js} +1 -1
  198. package/dist/chunks/{mcp-esqdO_lV.js → mcp-C3jlClk0.js} +3 -3
  199. package/dist/chunks/{mcp-BhAGhDQE.js → mcp-Cmw8ecKk.js} +1 -1
  200. package/dist/chunks/{mcp-DbqUZ1Cf.js → mcp-ya96irNP.js} +1 -1
  201. package/dist/chunks/{mcpServer-DeL2ADSF.js → mcpServer-B1q9blAc.js} +1 -1
  202. package/dist/chunks/{mcpServer-Ct-GVL-y.js → mcpServer-BJB5g6j2.js} +1 -1
  203. package/dist/chunks/{memory-DwapBEsD.js → memory-CxiukAGg.js} +1 -1
  204. package/dist/chunks/{mobile-D7MSmMhc.js → mobile-DLGq6g08.js} +1 -1
  205. package/dist/chunks/{modalContext-DxfeT_3m.js → modalContext-CuTwi_eD.js} +1 -1
  206. package/dist/chunks/{mode-B5cmHCvz.js → mode-DqAJ2y6R.js} +1 -1
  207. package/dist/chunks/{model-BePO0VaC.js → model-C8TW-qjl.js} +1 -1
  208. package/dist/chunks/model-VB4ItNVB.js +1 -0
  209. package/dist/chunks/{onChangeAppState-B3d5iy6T.js → onChangeAppState-BG1pF7ht.js} +1 -1
  210. package/dist/chunks/{openai-fRhGOIQq.js → openai-CHoRhRtf.js} +1 -1
  211. package/dist/chunks/{overageCreditGrant-B6sx7IFi.js → overageCreditGrant-DYMg1lV4.js} +1 -1
  212. package/dist/chunks/{panel-CAVG5BOM.js → panel-BY6q16am.js} +1 -1
  213. package/dist/chunks/{panel-DU8y_jcf.js → panel-BdRBXAv3.js} +1 -1
  214. package/dist/chunks/panelCall-SYrmrKt9.js +1 -0
  215. package/dist/chunks/{passes-CWPPUigp.js → passes-CSV-SZJc.js} +1 -1
  216. package/dist/chunks/{paths-4ZWdjPP4.js → paths-BZjPDxMm.js} +3 -3
  217. package/dist/chunks/{permissions-DW8CRuJp.js → permissions-DBddT2NP.js} +1 -1
  218. package/dist/chunks/{pipeTransport-CUeYRWJn.js → pipeTransport-uK7GxbSG.js} +1 -1
  219. package/dist/chunks/{plan-Cf-tHvGq.js → plan-DEbo-Adi.js} +1 -1
  220. package/dist/chunks/plugin-Cops24hg.js +1 -0
  221. package/dist/chunks/{pluginAutoupdate-CdmKzIRf.js → pluginAutoupdate-Bg7JMOHN.js} +1 -1
  222. package/dist/chunks/{pluginBlocklist-C9XwbFSo.js → pluginBlocklist-DEM_RWc2.js} +1 -1
  223. package/dist/chunks/{pluginCliCommands-CmY_maYg.js → pluginCliCommands-DyYEg7Cv.js} +1 -1
  224. package/dist/chunks/{pluginFlagging-DyzxZolj.js → pluginFlagging-DwChUZMJ.js} +1 -1
  225. package/dist/chunks/{pluginOperations-mr4I7Jw9.js → pluginOperations-COyT4tHs.js} +1 -1
  226. package/dist/chunks/{pluginStartupCheck-B6OdK29Z.js → pluginStartupCheck-DCxJJkYs.js} +1 -1
  227. package/dist/chunks/pluginStartupCheck-DjfIaOch.js +1 -0
  228. package/dist/chunks/{plugins-rdPgpjF8.js → plugins-BanQjHmw.js} +1 -1
  229. package/dist/chunks/policyLimits-D-Y_soHx.js +1 -0
  230. package/dist/chunks/{pollConfig-DLbuHBse.js → pollConfig-DBNHhvHf.js} +1 -1
  231. package/dist/chunks/{poor-pmz2b7zu.js → poor-aPQce502.js} +1 -1
  232. package/dist/chunks/{poorMode-DD-q_w6Z.js → poorMode-CFRuV-nB.js} +1 -1
  233. package/dist/chunks/poorMode-DQagHYWe.js +1 -0
  234. package/dist/chunks/{print-luaON-Cg.js → print-Cf2tY__0.js} +4 -4
  235. package/dist/chunks/{privacy-settings-BpigC4oX.js → privacy-settings-CYkM3Aem.js} +1 -1
  236. package/dist/chunks/{processBashCommand-f_84bSlP.js → processBashCommand-BLSC8o8M.js} +1 -1
  237. package/dist/chunks/{processSlashCommand-BkBqV3Jd.js → processSlashCommand-Ch9B-6nh.js} +1 -1
  238. package/dist/chunks/projectContext-2CzYVggO.js +1 -0
  239. package/dist/chunks/projectContext-CVk2Ix1r.js +1 -0
  240. package/dist/chunks/{prompt-CogZQuTN.js → prompt-BGNhFY1n.js} +1 -1
  241. package/dist/chunks/prompt-CrNwH5kr.js +1 -0
  242. package/dist/chunks/prompt-dH0MMivt.js +1 -0
  243. package/dist/chunks/{promptEditor-C___2FFs.js → promptEditor-U03qQWbq.js} +1 -1
  244. package/dist/chunks/{protocolHandler-qwll5gSY.js → protocolHandler-3yBj9w5N.js} +1 -1
  245. package/dist/chunks/{rate-limit-options-nQcTipEp.js → rate-limit-options-D-xl_9PO.js} +1 -1
  246. package/dist/chunks/{rcDebugLog-DOXxIr8l.js → rcDebugLog-ClX1msJX.js} +1 -1
  247. package/dist/chunks/{referral-CMPZjf3I.js → referral-qe-yqXJE.js} +1 -1
  248. package/dist/chunks/{refresh-CP7Dnjp4.js → refresh-CO_P3WKA.js} +1 -1
  249. package/dist/chunks/{registerProtocol-DCNuqdCC.js → registerProtocol-CClQph00.js} +1 -1
  250. package/dist/chunks/{registry-DLqZJleQ.js → registry-C0zdU2Hb.js} +1 -1
  251. package/dist/chunks/{release-notes-BsDW6T9f.js → release-notes-CyZHxWTF.js} +1 -1
  252. package/dist/chunks/{releaseNotes-Tbd018Qz.js → releaseNotes-BtxL5R5Q.js} +2 -2
  253. package/dist/chunks/{reload-plugins-iG9ZE9wF.js → reload-plugins-B0eR8JHH.js} +1 -1
  254. package/dist/chunks/{remote-env-BFntnltf.js → remote-env-B_sIjY87.js} +1 -1
  255. package/dist/chunks/{remoteBridgeCore-Dpko9c-J.js → remoteBridgeCore-C3WRaLpU.js} +1 -1
  256. package/dist/chunks/{remoteControlServer-D3P82kVF.js → remoteControlServer-BOj9qmgH.js} +1 -1
  257. package/dist/chunks/{rename-Codm2nfB.js → rename-BFAC3WLD.js} +1 -1
  258. package/dist/chunks/{resume-BB1ceL_x.js → resume-CpivBr9S.js} +1 -1
  259. package/dist/chunks/{runtimeObserver-BpRn0RiL.js → runtimeObserver-C2_7Vsnd.js} +1 -1
  260. package/dist/chunks/{runtimeObserver-D6aF77Dq.js → runtimeObserver-sOnfVR7t.js} +2 -2
  261. package/dist/chunks/sandbox-adapter-jX_WzvnK.js +1 -0
  262. package/dist/chunks/{sandbox-toggle-DZ-8qXDS.js → sandbox-toggle-Bv68-Ca7.js} +1 -1
  263. package/dist/chunks/searchExtraTools-xPuOKDpi.js +1 -0
  264. package/dist/chunks/{sentry-CVdHlmNQ.js → sentry-BBCn6RGP.js} +1 -1
  265. package/dist/chunks/{session-B4j1ViVc.js → session-DfvxYP8o.js} +1 -1
  266. package/dist/chunks/{sessionDiscovery-DkIIFsWX.js → sessionDiscovery-CyuRBTAm.js} +1 -1
  267. package/dist/chunks/sessionFileAccessHooks-DiKsr7H7.js +1 -0
  268. package/dist/chunks/sessionMemory-C34-eFnJ.js +1 -0
  269. package/dist/chunks/{sessionMemory-CnT3-Mj7.js → sessionMemory-kYQnpcyG.js} +1 -1
  270. package/dist/chunks/sessionMemoryUtils-CcJcgftx.js +1 -0
  271. package/dist/chunks/sessionObserver-B73s6yu8.js +1 -0
  272. package/dist/chunks/{sessionObserver-gjdJ91cv.js → sessionObserver-CTkIYplM.js} +1 -1
  273. package/dist/chunks/sessionStorage-BHi7PKs-.js +1 -0
  274. package/dist/chunks/{sessionTitle-CSU5-VK9.js → sessionTitle-ePQRpeV2.js} +1 -1
  275. package/dist/chunks/{sessionTracing-BDN64fWh.js → sessionTracing-81-RIJBo.js} +1 -1
  276. package/dist/chunks/{settingsSync-Nixbcaox.js → settingsSync-DEFWnE1o.js} +1 -1
  277. package/dist/chunks/{setup-CZxLEcQh.js → setup-2611vmGJ.js} +1 -1
  278. package/dist/chunks/{setup-n3Ixr_gs.js → setup-BJSk1czd.js} +2 -2
  279. package/dist/chunks/{setup-9nXlu56r.js → setup-CTfYsKsz.js} +1 -1
  280. package/dist/chunks/{shadowedRuleDetection-CCS7R7F1.js → shadowedRuleDetection-CGD7Nx03.js} +1 -1
  281. package/dist/chunks/{sideQuestion-MzExGTvn.js → sideQuestion-BcP9Mm-5.js} +1 -1
  282. package/dist/chunks/{sink-BL75jACh.js → sink-D_t1TIt9.js} +1 -1
  283. package/dist/chunks/sink-i8NmYch9.js +1 -0
  284. package/dist/chunks/sinks-3w0mLszx.js +1 -0
  285. package/dist/chunks/{sinks-C-gxj_Eu.js → sinks-DXsozhmS.js} +2 -2
  286. package/dist/chunks/{skill-learning-B9Msm4jG.js → skill-learning-CZm2iMik.js} +2 -2
  287. package/dist/chunks/{skillChangeDetector-DlWPJTny.js → skillChangeDetector-1aFn40GC.js} +1 -1
  288. package/dist/chunks/{skillGapStore-Cpmbwyo3.js → skillGapStore-DzHv8v-D.js} +1 -1
  289. package/dist/chunks/{skillGapStore-CsADiV5a.js → skillGapStore-cWo6Ra90.js} +2 -2
  290. package/dist/chunks/{skillGenerator-_khb-Gmc.js → skillGenerator-D_W1IeP3.js} +2 -2
  291. package/dist/chunks/skillLearning-Bddmbx8E.js +1 -0
  292. package/dist/chunks/skillLearning-C-uI_jZB.js +1 -0
  293. package/dist/chunks/{skillPanel-DQmj3Yh1.js → skillPanel-ChmOZu4F.js} +3 -3
  294. package/dist/chunks/{skillSearchPanel-6w_zzoI3.js → skillSearchPanel-CVx2b4Pr.js} +2 -2
  295. package/dist/chunks/{skills-B3LN9tp9.js → skills-CWX1SydA.js} +1 -1
  296. package/dist/chunks/{sprites-8JVWnXzp.js → sprites-BuvEFwW6.js} +1 -1
  297. package/dist/chunks/{src-KjMLauwe.js → src-Di342QoJ.js} +1 -1
  298. package/dist/chunks/{src-BJM0zMNO.js → src-poaoYkuc.js} +1 -1
  299. package/dist/chunks/startupProfiler-CBcN1Chw.js +3 -0
  300. package/dist/chunks/startupProfiler-DtTgsdnI.js +1 -0
  301. package/dist/chunks/{staticRender-DboURbK0.js → staticRender-DKFIRhkH.js} +1 -1
  302. package/dist/chunks/{stats-BDlygx5X.js → stats-wjMQA-CA.js} +1 -1
  303. package/dist/chunks/status-CyU7IQhO.js +1 -0
  304. package/dist/chunks/{statusNoticeHelpers-Cd_LDPvn.js → statusNoticeHelpers-JNibsI_v.js} +1 -1
  305. package/dist/chunks/{tag-BLPgXlQZ.js → tag-opEEZI5B.js} +1 -1
  306. package/dist/chunks/tasks-CCtnU5u1.js +1 -0
  307. package/dist/chunks/{teamHelpers-B-poMJeE.js → teamHelpers-BJJs8taN.js} +1 -1
  308. package/dist/chunks/teamHelpers-D41zdxpl.js +1 -0
  309. package/dist/chunks/{teammateModeSnapshot-B1_3D1CQ.js → teammateModeSnapshot-CLiiOCkO.js} +1 -1
  310. package/dist/chunks/teammateModeSnapshot-q-bARbLL.js +1 -0
  311. package/dist/chunks/{teleport-CSo3PT05.js → teleport-ClxQigSQ.js} +1 -1
  312. package/dist/chunks/{templateJobs-BVebX2BK.js → templateJobs-C6D7GC-Q.js} +1 -1
  313. package/dist/chunks/{terminalSetup-DHWL0gnz.js → terminalSetup-2ioFcRAA.js} +1 -1
  314. package/dist/chunks/{terminalSetup-DZTEKKne.js → terminalSetup-B3bN4Cj8.js} +1 -1
  315. package/dist/chunks/{theme-BHQSNwSe.js → theme-Dgq_Og2P.js} +1 -1
  316. package/dist/chunks/thinkback-BE8NNmAo.js +1 -0
  317. package/dist/chunks/{thinkback-DOzxcgMy.js → thinkback-C43WBHis.js} +1 -1
  318. package/dist/chunks/{thinkback-play-CK1C_F7G.js → thinkback-play-D2_n_aoQ.js} +1 -1
  319. package/dist/chunks/{toolEventObserver-BIjUIh4k.js → toolEventObserver-B7EA-nNa.js} +1 -1
  320. package/dist/chunks/{toolEventObserver-XPorjjtG.js → toolEventObserver-BG_3sGCL.js} +1 -1
  321. package/dist/chunks/toolPool-BLshLuvo.js +1 -0
  322. package/dist/chunks/{toolPool-hQlvQn-j.js → toolPool-HYKCHxDA.js} +1 -1
  323. package/dist/chunks/{trustedDevice-D-L5uAor.js → trustedDevice-DeNxe6bl.js} +1 -1
  324. package/dist/chunks/{trustedDevice-CyfQd_GU.js → trustedDevice-S34i6Jc9.js} +1 -1
  325. package/dist/chunks/{tui-C7aBeORE.js → tui-DcXIK0fP.js} +1 -1
  326. package/dist/chunks/{ultrareviewCommand-rnMsUWTn.js → ultrareviewCommand-C45bmZqN.js} +1 -1
  327. package/dist/chunks/undercover-B4sdXe12.js +1 -0
  328. package/dist/chunks/{undercover-ClLYK52H.js → undercover-DoUSM8d6.js} +1 -1
  329. package/dist/chunks/{updateCCB-pqkACWbs.js → updateCCB-BuAm25MX.js} +1 -1
  330. package/dist/chunks/{upgrade-DpfZlPyC.js → upgrade-BDKg286g.js} +1 -1
  331. package/dist/chunks/upgrade-BiWGhm2d.js +1 -0
  332. package/dist/chunks/{upload-D98tqZnO.js → upload-CMptZXZs.js} +1 -1
  333. package/dist/chunks/{usage-CRquq5_O.js → usage-Bw_LK9YI.js} +1 -1
  334. package/dist/chunks/{usage-BWd5R6DU.js → usage-DEWsKPXj.js} +1 -1
  335. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-Dkcp6EkA.js → useExitOnCtrlCDWithKeybindings-BHi41Ku_.js} +1 -1
  336. package/dist/chunks/useKeybinding-DPOUuymz.js +1 -0
  337. package/dist/chunks/useMainLoopModel-D0PmGDuy.js +1 -0
  338. package/dist/chunks/{useManagePlugins-DMY74XAk.js → useManagePlugins-B-ejJsXy.js} +1 -1
  339. package/dist/chunks/{useMergedTools-NN58Kguw.js → useMergedTools-B6x9qtfj.js} +1 -1
  340. package/dist/chunks/{useSearchInput-CodP_5SB.js → useSearchInput-BpMLsxaS.js} +1 -1
  341. package/dist/chunks/{useSettingsErrors-BRxaYl6B.js → useSettingsErrors-DUe4k_RK.js} +1 -1
  342. package/dist/chunks/useTerminalSize-Du-EamDN.js +1 -0
  343. package/dist/chunks/{useVoice-ByU-q_w4.js → useVoice-C3ryR2HE.js} +1 -1
  344. package/dist/chunks/{util-SpgBY5_I.js → util-DWl5gjmI.js} +1 -1
  345. package/dist/chunks/utils-DP3EtI6F.js +1 -0
  346. package/dist/chunks/{validatePlugin-CxCXNV8o.js → validatePlugin-8EMSASvV.js} +1 -1
  347. package/dist/chunks/{vim-ByXlYzf9.js → vim-CaZ20SrQ.js} +1 -1
  348. package/dist/chunks/{voice-BnLS_SdQ.js → voice-BrnKguEV.js} +1 -1
  349. package/dist/chunks/{voiceModeEnabled-D070o6QK.js → voiceModeEnabled-3eg8vSqy.js} +1 -1
  350. package/dist/chunks/voiceModeEnabled-B1ARFTcz.js +1 -0
  351. package/dist/chunks/voiceStreamSTT-CONK4g-B.js +1 -0
  352. package/dist/chunks/{voiceStreamSTT-vkQ-Aop7.js → voiceStreamSTT-D7jWIYwz.js} +1 -1
  353. package/dist/chunks/{web-tools-1yM0ZBfA.js → web-tools-BT3TbzG5.js} +1 -1
  354. package/dist/chunks/{workerRegistry-7xGv_sNB.js → workerRegistry-C_i5wwjL.js} +1 -1
  355. package/dist/chunks/worktree-CFNQKVGn.js +1 -0
  356. package/dist/chunks/{xml-BUaEXGXx.js → xml-DOXio8vw.js} +1 -1
  357. package/dist/cli.js +1 -1
  358. package/package.json +1 -1
  359. package/dist/chunks/ApproveApiKey-oTZKoMvB.js +0 -1
  360. package/dist/chunks/ClaudeMdExternalIncludesDialog-5FCT81WS.js +0 -1
  361. package/dist/chunks/ConsoleOAuthFlow-BmGziW64.js +0 -1
  362. package/dist/chunks/Dialog-C8eGKH-e.js +0 -1
  363. package/dist/chunks/Doctor-DohPtIKu.js +0 -1
  364. package/dist/chunks/Grove-C_ocvHd3.js +0 -1
  365. package/dist/chunks/ListItem-DDMe4CJ3.js +0 -1
  366. package/dist/chunks/Messages-KmeXIJqL.js +0 -11
  367. package/dist/chunks/REPL-BBmn_itf.js +0 -1
  368. package/dist/chunks/SearchBox-CciJ8giD.js +0 -1
  369. package/dist/chunks/SearchExtraToolsTool-kjVFsFkT.js +0 -1
  370. package/dist/chunks/SentryErrorBoundary-DsrmgmKF.js +0 -1
  371. package/dist/chunks/api-DkgaFAzq.js +0 -1
  372. package/dist/chunks/assistant-CiNV3Q0f.js +0 -1
  373. package/dist/chunks/auth-CbQCc9vz.js +0 -1
  374. package/dist/chunks/backgroundHousekeeping-LYpOamcN.js +0 -1
  375. package/dist/chunks/bridgeConfig-Budgp2Go.js +0 -1
  376. package/dist/chunks/bridgeEnabled-DmvmwuUY.js +0 -1
  377. package/dist/chunks/bridgeMain-KYR5iq6H.js +0 -1
  378. package/dist/chunks/caches-CkH9F-Fd.js +0 -1
  379. package/dist/chunks/ccshareResume-DPP1blaU.js +0 -1
  380. package/dist/chunks/changeDetector-IFbty4jj.js +0 -1
  381. package/dist/chunks/channelNotification-CIyWY0hs.js +0 -1
  382. package/dist/chunks/clear-BVjSQsUL.js +0 -1
  383. package/dist/chunks/client-BUUsZdSe.js +0 -1
  384. package/dist/chunks/commands-pTQdOvN6.js +0 -1
  385. package/dist/chunks/commitAttribution-QPrKt_BF.js +0 -1
  386. package/dist/chunks/completionCache-BB7-y2BX.js +0 -1
  387. package/dist/chunks/context-noninteractive-OUTZ6BKj.js +0 -1
  388. package/dist/chunks/conversation-Bs8l0KNl.js +0 -1
  389. package/dist/chunks/createSession-DpqtD4ML.js +0 -1
  390. package/dist/chunks/crossProjectResume-BCr6jfGz.js +0 -40
  391. package/dist/chunks/datadog-DlzPb5oG.js +0 -1
  392. package/dist/chunks/desktop-WH8s-9-6.js +0 -1
  393. package/dist/chunks/entry-CEBaLwEG.js +0 -14
  394. package/dist/chunks/envLessBridgeConfig-izoVnE8s.js +0 -1
  395. package/dist/chunks/extra-usage-VSASGlte.js +0 -1
  396. package/dist/chunks/extractMemories-hQlhiVOD.js +0 -1
  397. package/dist/chunks/fast-2gWrhEFZ.js +0 -1
  398. package/dist/chunks/gates-dO6m4Hdp.js +0 -1
  399. package/dist/chunks/hooks-BWoN0nQP.js +0 -1
  400. package/dist/chunks/inboundAttachments-D8vq1NQO.js +0 -1
  401. package/dist/chunks/language-CSDpzbTz.js +0 -1
  402. package/dist/chunks/loadAgentsDir-B-4D2dVE.js +0 -1
  403. package/dist/chunks/localSearch-DsFH9yls.js +0 -1
  404. package/dist/chunks/login-CEJEl2mW.js +0 -1
  405. package/dist/chunks/logout-BXr4jzNY.js +0 -1
  406. package/dist/chunks/model-CgH43-hO.js +0 -1
  407. package/dist/chunks/panelCall-DUQdjDee.js +0 -1
  408. package/dist/chunks/plugin-DXhCgoNC.js +0 -1
  409. package/dist/chunks/pluginStartupCheck-BFuZqpnX.js +0 -1
  410. package/dist/chunks/policyLimits-B3dtp_Fe.js +0 -1
  411. package/dist/chunks/poorMode-BPIUnFFi.js +0 -1
  412. package/dist/chunks/projectContext-2Z2w8AI8.js +0 -1
  413. package/dist/chunks/projectContext-fS1t-xRh.js +0 -1
  414. package/dist/chunks/prompt-CriAIdkT.js +0 -1
  415. package/dist/chunks/prompt-TGc_H1cL.js +0 -1
  416. package/dist/chunks/sandbox-adapter-DrHD1mch.js +0 -1
  417. package/dist/chunks/searchExtraTools-Dwg6ZafS.js +0 -1
  418. package/dist/chunks/sessionFileAccessHooks-n7HcOfZ7.js +0 -1
  419. package/dist/chunks/sessionMemory-DVq43VXP.js +0 -1
  420. package/dist/chunks/sessionMemoryUtils-BjkdLRvh.js +0 -1
  421. package/dist/chunks/sessionObserver-CrfmnMzL.js +0 -1
  422. package/dist/chunks/sessionStorage-BTbr9wkZ.js +0 -1
  423. package/dist/chunks/sink-CoUVbLFs.js +0 -1
  424. package/dist/chunks/sinks-wuo1yQ_m.js +0 -1
  425. package/dist/chunks/skillLearning-CFnZiM5J.js +0 -1
  426. package/dist/chunks/skillLearning-D6mvGN90.js +0 -1
  427. package/dist/chunks/startupProfiler-BmnoJtfF.js +0 -1
  428. package/dist/chunks/startupProfiler-rCtNuhXz.js +0 -3
  429. package/dist/chunks/status-DlT1tUmc.js +0 -1
  430. package/dist/chunks/tasks-Bf1Nf3WX.js +0 -1
  431. package/dist/chunks/teamHelpers-DeQCfdgu.js +0 -1
  432. package/dist/chunks/teammateModeSnapshot-BRuKcJNr.js +0 -1
  433. package/dist/chunks/thinkback-CVYpxAyO.js +0 -1
  434. package/dist/chunks/toolPool-CDEeuQd2.js +0 -1
  435. package/dist/chunks/undercover-BviGW-bQ.js +0 -1
  436. package/dist/chunks/upgrade-DAuhXFVI.js +0 -1
  437. package/dist/chunks/useKeybinding-DOjEx42R.js +0 -1
  438. package/dist/chunks/useMainLoopModel-BZoZdEdj.js +0 -1
  439. package/dist/chunks/useTerminalSize-mqo2Swmk.js +0 -1
  440. package/dist/chunks/utils-CM5oEyAY.js +0 -1
  441. package/dist/chunks/voiceModeEnabled-B3njLfhA.js +0 -1
  442. package/dist/chunks/voiceStreamSTT-BkeyhhFJ.js +0 -1
  443. package/dist/chunks/worktree-UA9gKCwL.js +0 -1
  444. /package/dist/chunks/{chromeNativeHost-DfYuJafI.js → chromeNativeHost-BldB1Zzi.js} +0 -0
  445. /package/dist/chunks/{claudeDesktop-CEQCLZmG.js → claudeDesktop-BqTW_pbB.js} +0 -0
  446. /package/dist/chunks/{cleanup-DUVwlFl7.js → cleanup-rCLlo4w8.js} +0 -0
  447. /package/dist/chunks/{eventLoopStallDetector-MNrFR4OH.js → eventLoopStallDetector-bYy0fesH.js} +0 -0
  448. /package/dist/chunks/{postCommitAttribution-Br4g4R6h.js → postCommitAttribution-D8MoHFoz.js} +0 -0
  449. /package/dist/chunks/{sdkHeapDumpMonitor-DTHI5WbD.js → sdkHeapDumpMonitor-DLMMNeqo.js} +0 -0
  450. /package/dist/chunks/{sessionDataUploader-BgmJTXQr.js → sessionDataUploader-CsNePsOb.js} +0 -0
  451. /package/dist/chunks/{udsClient-B85rNglp.js → udsClient-CBF_cZFW.js} +0 -0
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{F as i,In as a,J as o,Ln as s,Rn as c,Ut as l,_ as u,a as d,b as f,f as p,i as m,n as h,o as g,p as ee,r as te,t as _,tt as ne,x as v,xt as y}from"./src-KjMLauwe.js";import{t as b}from"./jsx-runtime-D-D469L8.js";import{cn as re,ot as x}from"./state-sIHsFpDu.js";import{Ao as S,Do as C,Gs as w,Xa as T,ko as E,oo as D,zs as O}from"./paths-4ZWdjPP4.js";import{E as k,O as A}from"./debug-otxXY3j-.js";import{l as j,o as M}from"./stringUtils-KZoO4GUd.js";import{Dp as ie,FA as ae,FD as N,H as oe,ID as se,K as ce,MA as P,Op as le,U as ue,Uo as F,V as de,W as fe,aS as I,bo as L,dS as pe,fC as me,fS as R,jD as z,lC as he,oS as B,q as ge,uC as _e,vu as V,yu as ve}from"./loadAgentsDir-CQF8qhne.js";import{t as ye}from"./useKeybinding-DOjEx42R.js";import{t as be}from"./useTerminalSize-mqo2Swmk.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-Dkcp6EkA.js";import{n as Ce,t as we}from"./AddWorkspaceDirectory-DRO4tbYd.js";import{t as Te}from"./SearchBox-CciJ8giD.js";import{n as Ee,t as De}from"./useSearchInput-CodP_5SB.js";import{n as H,t as Oe}from"./shadowedRuleDetection-CCS7R7F1.js";import{n as ke,t as Ae}from"./autoModeDenials-BDpcFLb7.js";function je({ruleValue:e}){switch(e.toolName){case V.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,U.jsxs)(f,{dimColor:!0,children:[`Any Bash command starting with `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,U.jsxs)(f,{dimColor:!0,children:[`The Bash command `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent})]}):(0,U.jsx)(f,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,U.jsxs)(f,{dimColor:!0,children:[`Any use of the `,(0,U.jsx)(f,{bold:!0,children:e.toolName}),` tool`]})}}var U,Me=e((()=>{c(),_(),ve(),U=b()}));function Ne(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${T(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${T(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function Pe({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=O.map(Ne),s=(0,Fe.useCallback)(o=>{if(o===`cancel`){t();return}else if(O.includes(o)){let t=o,s=z(i,{type:`addRules`,rules:n,behavior:r,destination:t});se({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Oe(s,{sandboxAutoAllowEnabled:P.isSandboxingEnabled()&&P.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,W.jsxs)(p,{title:`Add ${r} permission ${j(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,W.jsx)(v,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,W.jsxs)(v,{flexDirection:`column`,children:[(0,W.jsx)(f,{bold:!0,children:S(e)}),(0,W.jsx)(je,{ruleValue:e})]},S(e)))}),(0,W.jsxs)(v,{flexDirection:`column`,marginY:1,children:[(0,W.jsx)(f,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,W.jsx)(I,{options:o,onChange:s})]})]})}var Fe,W,Ie=e((()=>{c(),Fe=t(c(),1),B(),_(),N(),C(),H(),ae(),w(),D(),M(),Me(),W=b()}));function Le({onCancel:e,onSubmit:t,ruleBehavior:n}){let[a,s]=(0,Re.useState)(``),[c,l]=(0,Re.useState)(0),u=xe();ne(`confirm:no`,e,{context:`Settings`});let{columns:d}=i(),p=d-6;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,G.jsxs)(f,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,G.jsxs)(v,{flexDirection:`column`,children:[(0,G.jsxs)(f,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,G.jsx)(o,{}),`e.g., `,(0,G.jsx)(f,{bold:!0,children:S({toolName:ie.name})}),(0,G.jsx)(f,{bold:!1,children:` or `}),(0,G.jsx)(f,{bold:!0,children:S({toolName:V.name,ruleContent:`ls:*`})})]}),(0,G.jsx)(v,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,G.jsx)(pe,{showCursor:!0,value:a,onChange:s,onSubmit:e=>{let r=e.trim();r.length!==0&&t(E(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:c,onChangeCursorOffset:l})})]})]}),(0,G.jsx)(v,{marginLeft:3,children:u.pending?(0,G.jsxs)(f,{dimColor:!0,children:[`Press `,u.keyName,` again to exit`]}):(0,G.jsx)(f,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Re,G,ze=e((()=>{n(),c(),Re=t(c(),1),R(),Se(),be(),_(),ye(),ve(),le(),C(),G=b()}));function Be({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=m();(0,K.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,K.useState)(()=>Ae()),[a,o]=(0,K.useState)(()=>new Set),[s,c]=(0,K.useState)(()=>new Set),[l,u]=(0,K.useState)(0);(0,K.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,K.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),p=(0,K.useCallback)(e=>{u(Number(e))},[]);if(y((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,q.jsx)(f,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let h=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,q.jsxs)(f,{children:[(0,q.jsx)(g,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,q.jsx)(f,{dimColor:!0,children:r})]}),value:String(t)}});return(0,q.jsxs)(v,{flexDirection:`column`,children:[(0,q.jsx)(f,{children:`Commands recently denied by the auto mode classifier.`}),(0,q.jsx)(v,{marginTop:1,children:(0,q.jsx)(I,{options:h,onChange:d,onFocus:p,visibleOptionCount:Math.min(10,h.length),isDisabled:n,onUpFromFirstItem:r})})]})}var K,q,Ve=e((()=>{c(),K=t(c(),1),_(),ke(),B(),q=b()}));function He({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,J.useCallback)(()=>{i(z(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,J.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(p,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(v,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(f,{bold:!0,children:e})}),(0,Y.jsx)(f,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(I,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var J,Y,Ue=e((()=>{c(),J=t(c(),1),B(),_(),N(),Y=b()}));function We({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=m();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=Ge.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ge.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(v,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(v,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(f,{children:`- ${x()}`}),(0,Z.jsx)(f,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(I,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var Ge,X,Z,Ke=e((()=>{n(),Ge=t(c(),1),X=t(c(),1),re(),B(),_(),Z=b()}));function qe({rule:e}){return(0,$.jsx)(f,{dimColor:!0,children:`From ${ge(e.source)}`})}function Je(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Ye({rule:e,onDelete:t,onCancel:n}){let r=xe();ne(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(v,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(f,{bold:!0,children:S(e.ruleValue)}),(0,$.jsx)(je,{ruleValue:e.ruleValue}),(0,$.jsx)(qe,{rule:e})]}),a=(0,$.jsx)(v,{marginLeft:3,children:r.pending?(0,$.jsxs)(f,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(f,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(f,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(f,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{F as i,In as a,J as o,Ln as s,Rn as c,Ut as l,_ as u,a as d,b as f,f as p,i as m,n as h,o as g,p as ee,r as te,t as _,tt as ne,x as v,xt as y}from"./src-Di342QoJ.js";import{t as b}from"./jsx-runtime-D-D469L8.js";import{cn as re,ot as x}from"./state-sIHsFpDu.js";import{Ao as S,Do as C,Gs as w,Xa as T,ko as E,oo as D,zs as O}from"./paths-BZjPDxMm.js";import{E as k,O as A}from"./debug-otxXY3j-.js";import{l as j,o as M}from"./stringUtils-KZoO4GUd.js";import{Dp as ie,FA as ae,FD as N,H as oe,ID as se,K as ce,MA as P,Op as le,U as ue,Uo as F,V as de,W as fe,aS as I,bo as L,dS as pe,fC as me,fS as R,jD as z,lC as he,oS as B,q as ge,uC as _e,vu as V,yu as ve}from"./loadAgentsDir-BYWykYwn.js";import{t as ye}from"./useKeybinding-DPOUuymz.js";import{t as be}from"./useTerminalSize-Du-EamDN.js";import{n as xe,t as Se}from"./useExitOnCtrlCDWithKeybindings-BHi41Ku_.js";import{n as Ce,t as we}from"./AddWorkspaceDirectory-CNyPaerF.js";import{t as Te}from"./SearchBox-Bu4gYF0J.js";import{n as Ee,t as De}from"./useSearchInput-BpMLsxaS.js";import{n as H,t as Oe}from"./shadowedRuleDetection-CGD7Nx03.js";import{n as ke,t as Ae}from"./autoModeDenials-BDpcFLb7.js";function je({ruleValue:e}){switch(e.toolName){case V.name:return e.ruleContent?e.ruleContent.endsWith(`:*`)?(0,U.jsxs)(f,{dimColor:!0,children:[`Any Bash command starting with `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent.slice(0,-2)})]}):(0,U.jsxs)(f,{dimColor:!0,children:[`The Bash command `,(0,U.jsx)(f,{bold:!0,children:e.ruleContent})]}):(0,U.jsx)(f,{dimColor:!0,children:`Any Bash command`});default:return e.ruleContent?null:(0,U.jsxs)(f,{dimColor:!0,children:[`Any use of the `,(0,U.jsx)(f,{bold:!0,children:e.toolName}),` tool`]})}}var U,Me=e((()=>{c(),_(),ve(),U=b()}));function Ne(e){switch(e){case`localSettings`:return{label:`Project settings (local)`,description:`Saved in ${T(`localSettings`)}`,value:e};case`projectSettings`:return{label:`Project settings`,description:`Checked in at ${T(`projectSettings`)}`,value:e};case`userSettings`:return{label:`User settings`,description:`Saved in at ~/.claude/settings.json`,value:e}}}function Pe({onAddRules:e,onCancel:t,ruleValues:n,ruleBehavior:r,initialContext:i,setToolPermissionContext:a}){let o=O.map(Ne),s=(0,Fe.useCallback)(o=>{if(o===`cancel`){t();return}else if(O.includes(o)){let t=o,s=z(i,{type:`addRules`,rules:n,behavior:r,destination:t});se({type:`addRules`,rules:n,behavior:r,destination:t}),a(s);let c=n.map(e=>({ruleValue:e,ruleBehavior:r,source:t})),l=Oe(s,{sandboxAutoAllowEnabled:P.isSandboxingEnabled()&&P.isAutoAllowBashIfSandboxedEnabled()}).filter(e=>n.some(t=>t.toolName===e.rule.ruleValue.toolName&&t.ruleContent===e.rule.ruleValue.ruleContent));e(c,l.length>0?l:void 0)}},[e,t,n,r,i,a]);return(0,W.jsxs)(p,{title:`Add ${r} permission ${j(n.length,`rule`)}`,onCancel:t,color:`permission`,children:[(0,W.jsx)(v,{flexDirection:`column`,paddingX:2,children:n.map(e=>(0,W.jsxs)(v,{flexDirection:`column`,children:[(0,W.jsx)(f,{bold:!0,children:S(e)}),(0,W.jsx)(je,{ruleValue:e})]},S(e)))}),(0,W.jsxs)(v,{flexDirection:`column`,marginY:1,children:[(0,W.jsx)(f,{children:n.length===1?`Where should this rule be saved?`:`Where should these rules be saved?`}),(0,W.jsx)(I,{options:o,onChange:s})]})]})}var Fe,W,Ie=e((()=>{c(),Fe=t(c(),1),B(),_(),N(),C(),H(),ae(),w(),D(),M(),Me(),W=b()}));function Le({onCancel:e,onSubmit:t,ruleBehavior:n}){let[a,s]=(0,Re.useState)(``),[c,l]=(0,Re.useState)(0),u=xe();ne(`confirm:no`,e,{context:`Settings`});let{columns:d}=i(),p=d-6;return(0,G.jsxs)(G.Fragment,{children:[(0,G.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,G.jsxs)(f,{bold:!0,color:`permission`,children:[`Add `,n,` permission rule`]}),(0,G.jsxs)(v,{flexDirection:`column`,children:[(0,G.jsxs)(f,{children:[`Permission rules are a tool name, optionally followed by a specifier in parentheses.`,(0,G.jsx)(o,{}),`e.g., `,(0,G.jsx)(f,{bold:!0,children:S({toolName:ie.name})}),(0,G.jsx)(f,{bold:!1,children:` or `}),(0,G.jsx)(f,{bold:!0,children:S({toolName:V.name,ruleContent:`ls:*`})})]}),(0,G.jsx)(v,{borderDimColor:!0,borderStyle:`round`,marginY:1,paddingLeft:1,children:(0,G.jsx)(pe,{showCursor:!0,value:a,onChange:s,onSubmit:e=>{let r=e.trim();r.length!==0&&t(E(r),n)},placeholder:`Enter permission rule${r.ellipsis}`,columns:p,cursorOffset:c,onChangeCursorOffset:l})})]})]}),(0,G.jsx)(v,{marginLeft:3,children:u.pending?(0,G.jsxs)(f,{dimColor:!0,children:[`Press `,u.keyName,` again to exit`]}):(0,G.jsx)(f,{dimColor:!0,children:`Enter to submit · Esc to cancel`})})]})}var Re,G,ze=e((()=>{n(),c(),Re=t(c(),1),R(),Se(),be(),_(),ye(),ve(),le(),C(),G=b()}));function Be({onHeaderFocusChange:e,onStateChange:t}){let{headerFocused:n,focusHeader:r}=m();(0,K.useEffect)(()=>{e?.(n)},[n,e]);let[i]=(0,K.useState)(()=>Ae()),[a,o]=(0,K.useState)(()=>new Set),[s,c]=(0,K.useState)(()=>new Set),[l,u]=(0,K.useState)(0);(0,K.useEffect)(()=>{t({approved:a,retry:s,denials:i})},[a,s,i,t]);let d=(0,K.useCallback)(e=>{let t=Number(e);o(e=>{let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n})},[]),p=(0,K.useCallback)(e=>{u(Number(e))},[]);if(y((e,t)=>{e===`r`&&(c(e=>{let t=new Set(e);return t.has(l)?t.delete(l):t.add(l),t}),o(e=>{if(e.has(l))return e;let t=new Set(e);return t.add(l),t}))},{isActive:i.length>0}),i.length===0)return(0,q.jsx)(f,{dimColor:!0,children:`No recent denials. Commands denied by the auto mode classifier will appear here.`});let h=i.map((e,t)=>{let n=a.has(t),r=s.has(t)?` (retry)`:``;return{label:(0,q.jsxs)(f,{children:[(0,q.jsx)(g,{status:n?`success`:`error`,withSpace:!0}),e.display,(0,q.jsx)(f,{dimColor:!0,children:r})]}),value:String(t)}});return(0,q.jsxs)(v,{flexDirection:`column`,children:[(0,q.jsx)(f,{children:`Commands recently denied by the auto mode classifier.`}),(0,q.jsx)(v,{marginTop:1,children:(0,q.jsx)(I,{options:h,onChange:d,onFocus:p,visibleOptionCount:Math.min(10,h.length),isDisabled:n,onUpFromFirstItem:r})})]})}var K,q,Ve=e((()=>{c(),K=t(c(),1),_(),ke(),B(),q=b()}));function He({directoryPath:e,onRemove:t,onCancel:n,permissionContext:r,setPermissionContext:i}){let a=(0,J.useCallback)(()=>{i(z(r,{type:`removeDirectories`,directories:[e],destination:`session`})),t()},[e,r,i,t]),o=(0,J.useCallback)(e=>{e===`yes`?a():n()},[a,n]);return(0,Y.jsxs)(p,{title:`Remove directory from workspace?`,onCancel:n,color:`error`,children:[(0,Y.jsx)(v,{marginX:2,flexDirection:`column`,children:(0,Y.jsx)(f,{bold:!0,children:e})}),(0,Y.jsx)(f,{children:`Claude Code will no longer have access to files in this directory.`}),(0,Y.jsx)(I,{onChange:o,onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]})}var J,Y,Ue=e((()=>{c(),J=t(c(),1),B(),_(),N(),Y=b()}));function We({onExit:e,toolPermissionContext:t,onRequestAddDirectory:n,onRequestRemoveDirectory:i,onHeaderFocusChange:a}){let{headerFocused:o,focusHeader:s}=m();(0,X.useEffect)(()=>{a?.(o)},[o,a]);let c=Ge.useMemo(()=>Array.from(t.additionalWorkingDirectories.keys()).map(e=>({path:e,isCurrent:!1,isDeletable:!0})),[t.additionalWorkingDirectories]),l=(0,X.useCallback)(e=>{if(e===`add-directory`){n();return}let t=c.find(t=>t.path===e);t&&t.isDeletable&&i(t.path)},[c,n,i]),u=(0,X.useCallback)(()=>e(`Workspace dialog dismissed`,{display:`system`}),[e]),d=Ge.useMemo(()=>{let e=c.map(e=>({label:e.path,value:e.path}));return e.push({label:`Add directory${r.ellipsis}`,value:`add-directory`}),e},[c]);return(0,Z.jsxs)(v,{flexDirection:`column`,marginBottom:1,children:[(0,Z.jsxs)(v,{flexDirection:`row`,marginTop:1,marginLeft:2,gap:1,children:[(0,Z.jsx)(f,{children:`- ${x()}`}),(0,Z.jsx)(f,{dimColor:!0,children:`(Original working directory)`})]}),(0,Z.jsx)(I,{options:d,onChange:l,onCancel:u,visibleOptionCount:Math.min(10,d.length),onUpFromFirstItem:s,isDisabled:o})]})}var Ge,X,Z,Ke=e((()=>{n(),Ge=t(c(),1),X=t(c(),1),re(),B(),_(),Z=b()}));function qe({rule:e}){return(0,$.jsx)(f,{dimColor:!0,children:`From ${ge(e.source)}`})}function Je(e){switch(e){case`allow`:return`allowed`;case`deny`:return`denied`;case`ask`:return`ask`}}function Ye({rule:e,onDelete:t,onCancel:n}){let r=xe();ne(`confirm:no`,n,{context:`Confirmation`});let i=(0,$.jsxs)(v,{flexDirection:`column`,marginX:2,children:[(0,$.jsx)(f,{bold:!0,children:S(e.ruleValue)}),(0,$.jsx)(je,{ruleValue:e.ruleValue}),(0,$.jsx)(qe,{rule:e})]}),a=(0,$.jsx)(v,{marginLeft:3,children:r.pending?(0,$.jsxs)(f,{dimColor:!0,children:[`Press `,r.keyName,` again to exit`]}):(0,$.jsx)(f,{dimColor:!0,children:`Esc to cancel`})});return e.source===`policySettings`?(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`permission`,children:[(0,$.jsx)(f,{bold:!0,color:`permission`,children:`Rule details`}),i,(0,$.jsxs)(f,{italic:!0,children:[`This rule is configured by managed settings and cannot be modified.`,`
2
2
  `,`Contact your system administrator for more information.`]})]}),a]}):(0,$.jsxs)($.Fragment,{children:[(0,$.jsxs)(v,{flexDirection:`column`,gap:1,borderStyle:`round`,paddingLeft:1,paddingRight:1,borderColor:`error`,children:[(0,$.jsxs)(f,{bold:!0,color:`error`,children:[`Delete `,Je(e.ruleBehavior),` tool?`]}),i,(0,$.jsx)(f,{children:`Are you sure you want to delete this permission rule?`}),(0,$.jsx)(I,{onChange:e=>e===`yes`?t():n(),onCancel:n,options:[{label:`Yes`,value:`yes`},{label:`No`,value:`no`}]})]}),a]})}function Xe(e){let{options:t,searchQuery:n,isSearchMode:r,isFocused:i,onSelect:a,onCancel:o,lastFocusedRuleKey:s,cursorOffset:c,onHeaderFocusChange:l}=e,f=d(),{headerFocused:p,focusHeader:h,blurHeader:g}=m();return(0,Q.useEffect)(()=>{r&&p&&g()},[r,p,g]),(0,Q.useEffect)(()=>{l?.(p)},[p,l]),(0,$.jsxs)(v,{flexDirection:`column`,children:[(0,$.jsx)(v,{marginBottom:1,flexDirection:`column`,children:(0,$.jsx)(u,{query:n,isFocused:r&&!p,isTerminalFocused:i,width:f,cursorOffset:c})}),(0,$.jsx)(I,{options:t,onChange:a,onCancel:o,visibleOptionCount:Math.min(10,t.length),isDisabled:r||p,defaultFocusValue:s,onUpFromFirstItem:h})]})}function Ze({tab:e,getRulesOptions:t,handleToolSelect:n,...r}){return(0,$.jsxs)(v,{flexDirection:`column`,flexShrink:e===`allow`?0:void 0,children:[(0,$.jsx)(f,{children:{allow:`Claude Code won't ask before using allowed tools.`,ask:`Claude Code will always ask for confirmation before using these tools.`,deny:`Claude Code will always reject requests to use denied tools.`}[e]}),(0,$.jsx)(Xe,{options:t(e,r.searchQuery).options,onSelect:t=>n(t,e),...r})]})}function Qe({onExit:e,initialTab:t,onRetryDenials:n}){let i=Ae().length>0,o=t??(i?`recent`:`allow`),[s,c]=(0,Q.useState)([]),u=_e(e=>e.toolPermissionContext),d=me(),p=l(),m=(0,Q.useRef)({approved:new Set,retry:new Set,denials:[]}),g=(0,Q.useCallback)(e=>{m.current=e},[]),[_,y]=(0,Q.useState)(),[b,re]=(0,Q.useState)(),[x,C]=(0,Q.useState)(null),[w,T]=(0,Q.useState)(null),[E,D]=(0,Q.useState)(!1),[O,k]=(0,Q.useState)(null),[j,M]=(0,Q.useState)(!1),[ie,ae]=(0,Q.useState)(!0),N=(0,Q.useCallback)(e=>{ae(e)},[]),ce=(0,Q.useMemo)(()=>{let e=new Map;return oe(u).forEach(t=>{e.set(A(t),t)}),e},[u]),P=(0,Q.useMemo)(()=>{let e=new Map;return fe(u).forEach(t=>{e.set(A(t),t)}),e},[u]),le=(0,Q.useMemo)(()=>{let e=new Map;return ue(u).forEach(t=>{e.set(A(t),t)}),e},[u]),F=(0,Q.useCallback)((e,t=``)=>{let n=(()=>{switch(e){case`allow`:return ce;case`deny`:return P;case`ask`:return le;case`workspace`:case`recent`:return new Map}})(),i=[];e!==`workspace`&&e!==`recent`&&!t&&i.push({label:`Add a new rule${r.ellipsis}`,value:`add-new-rule`});let a=Array.from(n.keys()).sort((e,t)=>{let r=n.get(e),i=n.get(t);if(r&&i){let e=S(r.ruleValue).toLowerCase(),t=S(i.ruleValue).toLowerCase();return e.localeCompare(t)}return 0}),o=t.toLowerCase();for(let e of a){let r=n.get(e);if(r){let n=S(r.ruleValue);if(t&&!n.toLowerCase().includes(o))continue;i.push({label:n,value:e})}}return{options:i,rulesByKey:n}},[ce,P,le]),I=xe(),L=!_&&!x&&!w&&!E&&!O,{query:pe,setQuery:R,cursorOffset:he}=Ee({isActive:L&&j,onExit:()=>{M(!1)}}),B=(0,Q.useCallback)(e=>{L&&(j||e.ctrl||e.meta||(e.key===`/`?(e.preventDefault(),M(!0),R(``)):e.key.length===1&&e.key!==`j`&&e.key!==`k`&&e.key!==`m`&&e.key!==`i`&&e.key!==`r`&&e.key!==` `&&(e.preventDefault(),M(!0),R(e.key))))},[L,j,R]),ge=(0,Q.useCallback)((e,t)=>{let{rulesByKey:n}=F(t);if(e===`add-new-rule`){C(t);return}else{y(n.get(e));return}},[F]),V=(0,Q.useCallback)(()=>{C(null)},[]),ve=(0,Q.useCallback)((e,t)=>{T({ruleValue:e,ruleBehavior:t}),C(null)},[]),ye=(0,Q.useCallback)((e,t)=>{T(null);for(let t of e)c(e=>[...e,`Added ${t.ruleBehavior} rule ${a.bold(S(t.ruleValue))}`]);if(t&&t.length>0)for(let e of t){let t=e.shadowType===`deny`?`blocked`:`shadowed`;c(n=>[...n,a.yellow(`${r.warning} Warning: ${S(e.rule.ruleValue)} is ${t}`),a.dim(` ${e.reason}`),a.dim(` Fix: ${e.fix}`)])}},[]),be=(0,Q.useCallback)(()=>{T(null)},[]),Se=(0,Q.useCallback)(()=>D(!0),[]),Ce=(0,Q.useCallback)(e=>k(e),[]),Te=(0,Q.useCallback)(()=>{let t=m.current,r=e=>Array.from(e).map(e=>t.denials[e]).filter(e=>e!==void 0),i=r(t.retry);if(i.length>0){let t=i.map(e=>e.display);n?.(t),e(void 0,{shouldQuery:!0,metaMessages:[`Permission granted for: ${t.join(`, `)}. You may now retry ${t.length===1?`this command`:`these commands`} if you would like.`]});return}let o=r(t.approved);o.length>0||s.length>0?e([...o.length>0?[`Approved ${o.map(e=>a.bold(e.display)).join(`, `)}`]:[],...s].join(`
3
3
  `)):e(`Permissions dialog dismissed`,{display:`system`})},[s,e,n]);ne(`confirm:no`,Te,{context:`Settings`,isActive:L&&!j});let De=()=>{if(!_)return;let{options:e}=F(_.ruleBehavior),t=A(_),n=e.filter(e=>e.value!==`add-new-rule`).map(e=>e.value),r=n.indexOf(t),i;r!==-1&&(r<n.length-1?i=n[r+1]:r>0&&(i=n[r-1])),re(i),de({rule:_,initialContext:u,setToolPermissionContext(e){d(t=>({...t,toolPermissionContext:e}))}}),c(e=>[...e,`Deleted ${_.ruleBehavior} rule ${a.bold(S(_.ruleValue))}`]),y(void 0)};if(_)return(0,$.jsx)(Ye,{rule:_,onDelete:De,onCancel:()=>y(void 0)});if(x&&x!==`workspace`&&x!==`recent`)return(0,$.jsx)(Le,{onCancel:V,onSubmit:ve,ruleBehavior:x});if(w)return(0,$.jsx)(Pe,{onAddRules:ye,onCancel:be,ruleValues:[w.ruleValue],ruleBehavior:w.ruleBehavior,initialContext:u,setToolPermissionContext:e=>{d(t=>({...t,toolPermissionContext:e}))}});if(E)return(0,$.jsx)(we,{onAddDirectory:(e,t)=>{let n={type:`addDirectories`,directories:[e],destination:t?`localSettings`:`session`},r=z(u,n);d(e=>({...e,toolPermissionContext:r})),t&&se(n),c(n=>[...n,`Added directory ${a.bold(e)} to workspace${t?` and saved to local settings`:` for this session`}`]),D(!1)},onCancel:()=>D(!1),permissionContext:u});if(O)return(0,$.jsx)(He,{directoryPath:O,onRemove:()=>{c(e=>[...e,`Removed directory ${a.bold(O)} from workspace`]),k(null)},onCancel:()=>k(null),permissionContext:u,setPermissionContext:e=>{d(t=>({...t,toolPermissionContext:e}))}});let H={searchQuery:pe,isSearchMode:j,isFocused:p,onCancel:Te,lastFocusedRuleKey:b,cursorOffset:he,getRulesOptions:F,handleToolSelect:ge,onHeaderFocusChange:N};return(0,$.jsx)(v,{flexDirection:`column`,onKeyDown:B,children:(0,$.jsxs)(ee,{color:`permission`,children:[(0,$.jsxs)(te,{title:`Permissions:`,color:`permission`,defaultTab:o,hidden:!!_||!!x||!!w||E||!!O,initialHeaderFocused:!i,navFromContent:!j,children:[(0,$.jsx)(h,{id:`recent`,title:`Recently denied`,children:(0,$.jsx)(Be,{onHeaderFocusChange:N,onStateChange:g})}),(0,$.jsx)(h,{id:`allow`,title:`Allow`,children:(0,$.jsx)(Ze,{tab:`allow`,...H})}),(0,$.jsx)(h,{id:`ask`,title:`Ask`,children:(0,$.jsx)(Ze,{tab:`ask`,...H})}),(0,$.jsx)(h,{id:`deny`,title:`Deny`,children:(0,$.jsx)(Ze,{tab:`deny`,...H})}),(0,$.jsx)(h,{id:`workspace`,title:`Workspace`,children:(0,$.jsxs)(v,{flexDirection:`column`,children:[(0,$.jsx)(f,{children:`Claude Code can read files in the workspace, and make edits when auto-accept edits is on.`}),(0,$.jsx)(We,{onExit:e,toolPermissionContext:u,onRequestAddDirectory:Se,onRequestRemoveDirectory:Ce,onHeaderFocusChange:N})]})})]}),(0,$.jsx)(v,{marginTop:1,paddingLeft:1,children:(0,$.jsx)(f,{dimColor:!0,children:I.pending?(0,$.jsxs)($.Fragment,{children:[`Press `,I.keyName,` again to exit`]}):ie?(0,$.jsx)($.Fragment,{children:`←/→ tab switch · ↓ return · Esc cancel`}):j?(0,$.jsx)($.Fragment,{children:`Type to filter · Enter/↓ select · ↑ tabs · Esc clear`}):i&&o===`recent`?(0,$.jsx)($.Fragment,{children:`Enter approve · r retry · ↑↓ navigate · ←/→ switch · Esc cancel`}):(0,$.jsx)($.Fragment,{children:`↑↓ navigate · Enter select · Type to search · ←/→ switch · Esc cancel`})})})]})})}var Q,$,$e=e((()=>{s(),n(),c(),Q=t(c(),1),he(),N(),B(),Se(),De(),_(),ye(),ke(),C(),ce(),k(),Te(),Ie(),Ce(),Me(),ze(),Ve(),Ue(),Ke(),$=b()})),et,tt;e((()=>{$e(),F(),et=b(),tt=async(e,t)=>(0,et.jsx)(Qe,{onExit:e,onRetryDenials:e=>{t.setMessages(t=>[...t,L(e)])}})}))();export{tt as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{o as r}from"./log-DSV4Ht5l.js";import{a as i,o as a}from"./teamHelpers-B-poMJeE.js";import{join as o}from"path";import"fs/promises";import"net";import"events";function s(e){let t=a(e);if(!t)return[];let n=new Set(t.hiddenPaneIds??[]),r=[];for(let e of t.members){if(e.name===`team-lead`)continue;let t=e.isActive===!1?`idle`:`running`;r.push({name:e.name,agentId:e.agentId,agentType:e.agentType,model:e.model,prompt:e.prompt,status:t,color:e.color,tmuxPaneId:e.tmuxPaneId,cwd:e.cwd,worktreePath:e.worktreePath,isHidden:n.has(e.tmuxPaneId),backendType:e.backendType,mode:e.mode})}return r}var c=e((()=>{i()}));function l(){return o(t(),`pipes`)}function u(e){return e?.pipeIpc??d}var d,f=e((()=>{n(),r(),d={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{c as a,s as i,l as n,f as r,u as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{o as r}from"./log-DSV4Ht5l.js";import{a as i,o as a}from"./teamHelpers-BJJs8taN.js";import{join as o}from"path";import"fs/promises";import"net";import"events";function s(e){let t=a(e);if(!t)return[];let n=new Set(t.hiddenPaneIds??[]),r=[];for(let e of t.members){if(e.name===`team-lead`)continue;let t=e.isActive===!1?`idle`:`running`;r.push({name:e.name,agentId:e.agentId,agentType:e.agentType,model:e.model,prompt:e.prompt,status:t,color:e.color,tmuxPaneId:e.tmuxPaneId,cwd:e.cwd,worktreePath:e.worktreePath,isHidden:n.has(e.tmuxPaneId),backendType:e.backendType,mode:e.mode})}return r}var c=e((()=>{i()}));function l(){return o(t(),`pipes`)}function u(e){return e?.pipeIpc??d}var d,f=e((()=>{n(),r(),d={role:`main`,subIndex:null,displayRole:`main`,serverName:null,attachedBy:null,localIp:null,hostname:null,machineId:null,mac:null,statusVisible:!1,selectorOpen:!1,selectedPipes:[],routeMode:`selected`,slaves:{},discoveredPipes:[]}}));export{c as a,s as i,l as n,f as r,u as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-KjMLauwe.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{cn as o,rn as s}from"./state-sIHsFpDu.js";import{Ax as c,FD as l,hy as u,j as d,jD as f,my as p,vy as m,w as h,zx as g}from"./loadAgentsDir-CQF8qhne.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-C___2FFs.js";import{r as x,t as S}from"./staticRender-DboURbK0.js";function C({planContent:e,planPath:t,editorName:r}){return(0,T.jsxs)(i,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:t}),(0,T.jsx)(i,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),r&&(0,T.jsxs)(i,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:r})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){s(a,`plan`),i(e=>({...e,toolPermissionContext:f(d(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let o=p(),c=u();if(!o)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(c);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${c}`),null}let l=v();return e(await x((0,T.jsx)(C,{planContent:o,planPath:c,editorName:l?g(l):void 0}))),null}var T;e((()=>{t(),o(),r(),_(),c(),l(),h(),m(),y(),S(),T=a()}))();export{w as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t,b as n,t as r,x as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{cn as o,rn as s}from"./state-sIHsFpDu.js";import{Ax as c,FD as l,hy as u,j as d,jD as f,my as p,vy as m,w as h,zx as g}from"./loadAgentsDir-BYWykYwn.js";import{a as _,i as v,r as y,t as b}from"./promptEditor-U03qQWbq.js";import{r as x,t as S}from"./staticRender-DKFIRhkH.js";function C({planContent:e,planPath:t,editorName:r}){return(0,T.jsxs)(i,{flexDirection:`column`,children:[(0,T.jsx)(n,{bold:!0,children:`Current Plan`}),(0,T.jsx)(n,{dimColor:!0,children:t}),(0,T.jsx)(i,{marginTop:1,children:(0,T.jsx)(n,{children:e})}),r&&(0,T.jsxs)(i,{marginTop:1,children:[(0,T.jsx)(n,{dimColor:!0,children:`"/plan open"`}),(0,T.jsx)(n,{dimColor:!0,children:` to edit this plan in `}),(0,T.jsx)(n,{bold:!0,dimColor:!0,children:r})]})]})}async function w(e,t,n){let{getAppState:r,setAppState:i}=t,a=r().toolPermissionContext.mode;if(a!==`plan`){s(a,`plan`),i(e=>({...e,toolPermissionContext:f(d(e.toolPermissionContext),{type:`setMode`,mode:`plan`,destination:`session`})}));let t=n.trim();return t&&t!==`open`?e(`Enabled plan mode`,{shouldQuery:!0}):e(`Enabled plan mode`),null}let o=p(),c=u();if(!o)return e(`Already in plan mode. No plan written yet.`),null;if(n.trim().split(/\s+/)[0]===`open`){let t=await b(c);return t.error?e(`Failed to open plan in editor: ${t.error}`):e(`Opened plan in editor: ${c}`),null}let l=v();return e(await x((0,T.jsx)(C,{planContent:o,planPath:c,editorName:l?g(l):void 0}))),null}var T;e((()=>{t(),o(),r(),_(),c(),l(),h(),m(),y(),S(),T=a()}))();export{w as call};
@@ -0,0 +1 @@
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,t as i}from"./PluginSettings-BBrFCSpQ.js";async function a(e,t,n){return(0,o.jsx)(i,{onComplete:e,args:n})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{ps as t,us as n,wc as r,yc as i}from"./paths-4ZWdjPP4.js";import{U as a,l as o,p as s,z as c}from"./debug-otxXY3j-.js";import{o as l,s as u}from"./log-DSV4Ht5l.js";import{Js as d,Ls as f,Ms as p,Ps as m,Us as h,Zs as g,qs as _}from"./loadAgentsDir-CQF8qhne.js";import{i as v,o as y}from"./xml-BUaEXGXx.js";import{f as b,s as x}from"./pluginOperations-mr4I7Jw9.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await d(),n=h(),r=new Set;for(let[i,a]of Object.entries(e)){let e=n[i]?.autoUpdate;(e===void 0?t(i,a):e)&&r.add(i.toLowerCase())}return r}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,s(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||s(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){s(`Plugin autoupdate: error updating ${e}: ${c(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=f(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=y(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let a=i.filter(m);return a.length===0?null:w(n,a)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(r()){s(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await g(e,void 0,{disableCredentialHelper:!0})}catch(t){s(`Plugin autoupdate: failed to refresh marketplace ${e}: ${c(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&s(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),s(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){u(e)}})()}var O,k,A=e((()=>{x(),i(),o(),a(),l(),p(),_(),v(),n(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{ps as t,us as n,wc as r,yc as i}from"./paths-BZjPDxMm.js";import{U as a,l as o,p as s,z as c}from"./debug-otxXY3j-.js";import{o as l,s as u}from"./log-DSV4Ht5l.js";import{Js as d,Ls as f,Ms as p,Ps as m,Us as h,Zs as g,qs as _}from"./loadAgentsDir-BYWykYwn.js";import{i as v,o as y}from"./xml-DOXio8vw.js";import{f as b,s as x}from"./pluginOperations-COyT4tHs.js";function S(e){return O=e,k!==null&&k.length>0&&(e(k),k=null),()=>{O=null}}async function C(){let e=await d(),n=h(),r=new Set;for(let[i,a]of Object.entries(e)){let e=n[i]?.autoUpdate;(e===void 0?t(i,a):e)&&r.add(i.toLowerCase())}return r}async function w(e,t){let n=!1;for(let{scope:r}of t)try{let t=await b(e,r);t.success&&!t.alreadyUpToDate?(n=!0,s(`Plugin autoupdate: updated ${e} from ${t.oldVersion} to ${t.newVersion}`)):t.alreadyUpToDate||s(`Plugin autoupdate: failed to update ${e}: ${t.message}`,{level:`warn`})}catch(t){s(`Plugin autoupdate: error updating ${e}: ${c(t)}`,{level:`warn`})}return n?e:null}async function T(e){let t=f(),n=Object.keys(t.plugins);return n.length===0?[]:(await Promise.allSettled(n.map(async n=>{let{marketplace:r}=y(n);if(!r||!e.has(r.toLowerCase()))return null;let i=t.plugins[n];if(!i||i.length===0)return null;let a=i.filter(m);return a.length===0?null:w(n,a)}))).filter(e=>e.status===`fulfilled`&&e.value!==null).map(e=>e.value)}async function E(e){return T(e)}function D(){(async()=>{if(r()){s(`Plugin autoupdate: skipped (auto-updater disabled)`);return}try{let e=await C();if(e.size===0)return;let t=(await Promise.allSettled(Array.from(e).map(async e=>{try{await g(e,void 0,{disableCredentialHelper:!0})}catch(t){s(`Plugin autoupdate: failed to refresh marketplace ${e}: ${c(t)}`,{level:`warn`})}}))).filter(e=>e.status===`rejected`);t.length>0&&s(`Plugin autoupdate: ${t.length} marketplace refresh(es) failed`,{level:`warn`}),s(`Plugin autoupdate: checking installed plugins`);let n=await E(e);n.length>0&&(O?O(n):k=n)}catch(e){u(e)}})()}var O,k,A=e((()=>{x(),i(),o(),a(),l(),p(),_(),v(),n(),O=null,k=null}));export{T as i,A as n,S as r,D as t};
@@ -1 +1 @@
1
- import{U as e,l as t,p as n,z as r}from"./debug-otxXY3j-.js";import{Ms as i,Rs as a,Ws as o,Ys as s,qs as c}from"./loadAgentsDir-CQF8qhne.js";import{d as l,s as u}from"./pluginOperations-mr4I7Jw9.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-DyzxZolj.js";u(),t(),e(),i(),c(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=a(),t=f(),i=await s(),c=[];for(let a of Object.keys(i))try{let i=await o(a);if(!i.forceRemoveDeletedPlugins)continue;let s=h(e,i,a);for(let i of s){if(i in t)continue;let a=e.plugins[i]??[];if(a.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of a){let{scope:t}=e;if(!(t!==`user`&&t!==`project`&&t!==`local`))try{await l(i,t)}catch(e){n(`Failed to auto-uninstall delisted plugin ${i} from ${t}: ${r(e)}`,{level:`error`})}}await m(i),c.push(i)}}}catch(e){n(`Failed to check for delisted plugins in "${a}": ${r(e)}`,{level:`warn`})}return c}export{g as t};
1
+ import{U as e,l as t,p as n,z as r}from"./debug-otxXY3j-.js";import{Ms as i,Rs as a,Ws as o,Ys as s,qs as c}from"./loadAgentsDir-BYWykYwn.js";import{d as l,s as u}from"./pluginOperations-COyT4tHs.js";import{i as d,n as f,r as p,t as m}from"./pluginFlagging-DwChUZMJ.js";u(),t(),e(),i(),c(),p();function h(e,t,n){let r=new Set(t.plugins.map(e=>e.name)),i=`@${n}`,a=[];for(let t of Object.keys(e.plugins)){if(!t.endsWith(i))continue;let e=t.slice(0,-i.length);r.has(e)||a.push(t)}return a}async function g(){await d();let e=a(),t=f(),i=await s(),c=[];for(let a of Object.keys(i))try{let i=await o(a);if(!i.forceRemoveDeletedPlugins)continue;let s=h(e,i,a);for(let i of s){if(i in t)continue;let a=e.plugins[i]??[];if(a.some(e=>e.scope===`user`||e.scope===`project`||e.scope===`local`)){for(let e of a){let{scope:t}=e;if(!(t!==`user`&&t!==`project`&&t!==`local`))try{await l(i,t)}catch(e){n(`Failed to auto-uninstall delisted plugin ${i} from ${t}: ${r(e)}`,{level:`error`})}}await m(i),c.push(i)}}}catch(e){n(`Failed to check for delisted plugins in "${a}": ${r(e)}`,{level:`warn`})}return c}export{g as t};
@@ -1 +1 @@
1
- import{n as e,t}from"./figures-gfT9mM8P.js";import{U as n,z as r}from"./debug-otxXY3j-.js";import{n as i,r as a}from"./analytics-DqMQntaB.js";import{n as o,o as s}from"./process-DMKLUQIO.js";import{o as c,s as l}from"./log-DSV4Ht5l.js";import{As as u,SE as d,_v as f,gv as p,js as m,vv as h,wE as g}from"./loadAgentsDir-CQF8qhne.js";import{i as _,o as v}from"./xml-BUaEXGXx.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-mr4I7Jw9.js";e(),n(),g(),c(),m(),_(),o(),h(),i(),T();function E(e,n,i){l(e);let o=i?`${n} plugin "${i}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${o}: ${r(e)}`);let s=i?(()=>{let{name:e,marketplace:t}=v(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...p(e,t,u())}})():{};a(`tengu_plugin_command_failed`,{command:n,error_category:f(e),...s}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope||n,install_source:`cli-explicit`,...p(i,o,u())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:o,marketplace:s}=v(i.pluginId||e);a(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...s&&{_PROTO_marketplace_name:s},scope:i.scope||n,...p(o,s,u())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...p(i,o,u())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...p(i,o,u())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),a(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{s(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(s(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=v(r.pluginId||e);a(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...p(t,n,u())})}await d(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
1
+ import{n as e,t}from"./figures-gfT9mM8P.js";import{U as n,z as r}from"./debug-otxXY3j-.js";import{n as i,r as a}from"./analytics-DqMQntaB.js";import{n as o,o as s}from"./process-DMKLUQIO.js";import{o as c,s as l}from"./log-DSV4Ht5l.js";import{As as u,SE as d,_v as f,gv as p,js as m,vv as h,wE as g}from"./loadAgentsDir-BYWykYwn.js";import{i as _,o as v}from"./xml-DOXio8vw.js";import{a as y,c as b,d as x,f as S,i as C,r as w,s as T}from"./pluginOperations-COyT4tHs.js";e(),n(),g(),c(),m(),_(),o(),h(),i(),T();function E(e,n,i){l(e);let o=i?`${n} plugin "${i}"`:n===`disable-all`?`disable all plugins`:`${n} plugins`;console.error(`${t.cross} Failed to ${o}: ${r(e)}`);let s=i?(()=>{let{name:e,marketplace:t}=v(i);return{_PROTO_plugin_name:e,...t&&{_PROTO_marketplace_name:t},...p(e,t,u())}})():{};a(`tengu_plugin_command_failed`,{command:n,error_category:f(e),...s}),process.exit(1)}async function D(e,n=`user`){try{console.log(`Installing plugin "${e}"...`);let r=await b(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_installed_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope||n,install_source:`cli-explicit`,...p(i,o,u())}),process.exit(0)}catch(t){E(t,`install`,e)}}async function O(e,n=`user`,r=!1){try{let i=await x(e,n,!r);if(!i.success)throw Error(i.message);console.log(`${t.tick} ${i.message}`);let{name:o,marketplace:s}=v(i.pluginId||e);a(`tengu_plugin_uninstalled_cli`,{_PROTO_plugin_name:o,...s&&{_PROTO_marketplace_name:s},scope:i.scope||n,...p(o,s,u())}),process.exit(0)}catch(t){E(t,`uninstall`,e)}}async function k(e,n){try{let r=await y(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_enabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...p(i,o,u())}),process.exit(0)}catch(t){E(t,`enable`,e)}}async function A(e,n){try{let r=await C(e,n);if(!r.success)throw Error(r.message);console.log(`${t.tick} ${r.message}`);let{name:i,marketplace:o}=v(r.pluginId||e);a(`tengu_plugin_disabled_cli`,{_PROTO_plugin_name:i,...o&&{_PROTO_marketplace_name:o},scope:r.scope,...p(i,o,u())}),process.exit(0)}catch(t){E(t,`disable`,e)}}async function j(){try{let e=await w();if(!e.success)throw Error(e.message);console.log(`${t.tick} ${e.message}`),a(`tengu_plugin_disabled_all_cli`,{}),process.exit(0)}catch(e){E(e,`disable-all`)}}async function M(e,n){try{s(`Checking for updates for plugin "${e}" at ${n} scope…\n`);let r=await S(e,n);if(!r.success)throw Error(r.message);if(s(`${t.tick} ${r.message}\n`),!r.alreadyUpToDate){let{name:t,marketplace:n}=v(r.pluginId||e);a(`tengu_plugin_updated_cli`,{_PROTO_plugin_name:t,...n&&{_PROTO_marketplace_name:n},old_version:r.oldVersion||`unknown`,new_version:r.newVersion||`unknown`,...p(t,n,u())})}await d(0)}catch(t){E(t,`update`,e)}}export{O as a,D as i,A as n,M as o,k as r,j as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{D as t,E as n,O as r,_ as i,h as a,l as o,p as s}from"./debug-otxXY3j-.js";import{o as c,s as l}from"./log-DSV4Ht5l.js";import{AA as u,kA as d}from"./loadAgentsDir-CQF8qhne.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(d(),D)}function y(e){let n=t(e);if(typeof n!=`object`||!n||!(`plugins`in n)||typeof n.plugins!=`object`||n.plugins===null)return{};let r=n.plugins,i={};for(let[e,t]of Object.entries(r))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),n=`${t}.${p(8).toString(`hex`)}.tmp`;try{await a().mkdir(d()),await _(n,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(n,t),k=e}catch(e){l(e);try{await g(n)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),s(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{o(),i(),c(),n(),u(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{D as t,E as n,O as r,_ as i,h as a,l as o,p as s}from"./debug-otxXY3j-.js";import{o as c,s as l}from"./log-DSV4Ht5l.js";import{AA as u,kA as d}from"./loadAgentsDir-BYWykYwn.js";import{join as f}from"path";import{randomBytes as p}from"crypto";import{readFile as m,rename as h,unlink as g,writeFile as _}from"fs/promises";function v(){return f(d(),D)}function y(e){let n=t(e);if(typeof n!=`object`||!n||!(`plugins`in n)||typeof n.plugins!=`object`||n.plugins===null)return{};let r=n.plugins,i={};for(let[e,t]of Object.entries(r))if(t&&typeof t==`object`&&`flaggedAt`in t&&typeof t.flaggedAt==`string`){let n={flaggedAt:t.flaggedAt};`seenAt`in t&&typeof t.seenAt==`string`&&(n.seenAt=t.seenAt),i[e]=n}return i}async function b(){try{return y(await m(v(),{encoding:`utf-8`}))}catch{return{}}}async function x(e){let t=v(),n=`${t}.${p(8).toString(`hex`)}.tmp`;try{await a().mkdir(d()),await _(n,r({plugins:e},null,2),{encoding:`utf-8`,mode:384}),await h(n,t),k=e}catch(e){l(e);try{await g(n)}catch{}}}async function S(){let e=await b(),t=Date.now(),n=!1;for(let[r,i]of Object.entries(e))i.seenAt&&t-new Date(i.seenAt).getTime()>=O&&(delete e[r],n=!0);k=e,n&&await x(e)}function C(){return k??{}}async function w(e){k===null&&(k=await b()),await x({...k,[e]:{flaggedAt:new Date().toISOString()}}),s(`Flagged plugin: ${e}`)}async function T(e){k===null&&(k=await b());let t=new Date().toISOString(),n=!1,r={...k};for(let i of e){let e=r[i];e&&!e.seenAt&&(r[i]={...e,seenAt:t},n=!0)}n&&await x(r)}async function E(e){if(k===null&&(k=await b()),!(e in k))return;let{[e]:t,...n}=k;k=n,await x(n)}var D,O,k,A=e((()=>{o(),i(),c(),n(),u(),D=`flagged-plugins.json`,O=2880*60*1e3,k=null}));export{T as a,S as i,C as n,E as o,A as r,w as t};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{Qa as r,lo as i,oo as a}from"./paths-4ZWdjPP4.js";import{G as o,J as s,U as c,_ as l,h as u}from"./debug-otxXY3j-.js";import{o as d,s as f}from"./log-DSV4Ht5l.js";import{l as p,o as m}from"./stringUtils-KZoO4GUd.js";import{AA as h,Bs as g,Cs as _,EA as v,Es as y,Js as b,Ks as x,Ls as S,Ms as ee,Oh as C,Os as w,Rs as T,Ws as te,_c as E,_s as D,aT as O,gc as k,gs as A,hc as j,hs as ne,ij as re,kh as ie,ks as ae,nj as M,ps as oe,qs as se,rT as ce,rj as N,vs as P,ws as F,xs as I,ys as L,zs as R}from"./loadAgentsDir-CQF8qhne.js";import{i as z,m as B,o as V,p as H,s as U}from"./xml-BUaEXGXx.js";import{n as W,t as G}from"./pluginStartupCheck-B6OdK29Z.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return r(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let i=r(U(n))?.enabledPlugins;if(i){for(let r of Object.keys(i))if(t?r===e:r.startsWith(`${e}@`))return{pluginId:r,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=V(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=V(e),n=T();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=V(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=T().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=V(e),i,a,o;if(r){let t=await x(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await b();for(let[t,r]of Object.entries(e))try{let e=(await te(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){f(s(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let c=i,l=`${c.name}@${a}`,u=await y({pluginId:l,entry:c,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:_(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:c.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:a,disabled:o}=await L(),s=[...a,...o],c=pe(e,s),l=U(t),u=r(l),d,f;if(c)d=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===c.name||t.startsWith(`${c.name}@`))??(e.includes(`@`)?e:c.name),f=c.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};d=t.pluginId,f=t.pluginName}let p=J(t),m=T().plugins[d],h=m?.find(e=>e.scope===t&&e.projectPath===p);if(!h){let{scope:n}=Y(d);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let g=h.installPath,_={...u?.enabledPlugins};_[d]=void 0,i(l,{enabledPlugins:_}),j(),R(d,t,p);let y=T().plugins[d],b=!y||y.length===0;b&&g&&await E(g),b&&(ce(d),n&&await v(d));let x=M(d,s),S=N(x);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${S}`,pluginId:d,pluginName:f,scope:t,reverseDependents:x.length>0?x:void 0}}async function X(e,t,n){let a=t?`enable`:`disable`;if(B(e)){let{error:n}=i(`userSettings`,{enabledPlugins:{...r(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${a} built-in plugin: ${n.message}`};j();let{name:o}=V(e);return{success:!0,message:`Successfully ${a}d built-in plugin: ${o}`,pluginId:e,pluginName:o,scope:`user`}}n&&q(n);let o,s,c=fe(e);if(n)if(s=n,c)o=c.pluginId;else if(e.includes(`@`))o=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)o=c.pluginId,s=c.scope;else if(e.includes(`@`))o=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&ie(o))return{success:!1,message:`Plugin "${o}" is blocked by your organization's policy and cannot be enabled`};let l=U(s),u=r(l)?.enabledPlugins?.[o],d={user:0,project:1,local:2},f=n&&c&&d[n]>d[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!f)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!f?u===!0:G().has(o)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let p;if(!t){let{enabled:e,disabled:t}=await L(),n=M(o,[...e,...t]);n.length>0&&(p=n)}let{error:m}=i(l,{enabledPlugins:{...r(l)?.enabledPlugins,[o]:t}});if(m)return{success:!1,message:`Failed to ${a} plugin: ${m.message}`};j();let{name:h}=V(o),g=N(p);return{success:!0,message:`Successfully ${a}d plugin: ${h} (scope: ${s})${g}`,pluginId:o,pluginName:h,scope:s,reverseDependents:p}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${p(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{Qa as r,lo as i,oo as a}from"./paths-BZjPDxMm.js";import{G as o,J as s,U as c,_ as l,h as u}from"./debug-otxXY3j-.js";import{o as d,s as f}from"./log-DSV4Ht5l.js";import{l as p,o as m}from"./stringUtils-KZoO4GUd.js";import{AA as h,Bs as g,Cs as _,EA as v,Es as y,Js as b,Ks as x,Ls as S,Ms as ee,Oh as C,Os as w,Rs as T,Ws as te,_c as E,_s as D,aT as O,gc as k,gs as A,hc as j,hs as ne,ij as re,kh as ie,ks as ae,nj as M,ps as oe,qs as se,rT as ce,rj as N,vs as P,ws as F,xs as I,ys as L,zs as R}from"./loadAgentsDir-BYWykYwn.js";import{i as z,m as B,o as V,p as H,s as U}from"./xml-DOXio8vw.js";import{n as W,t as G}from"./pluginStartupCheck-DCxJJkYs.js";import{dirname as le,join as K}from"path";function q(e){if(!Q.includes(e))throw Error(`Invalid scope "${e}". Must be one of: ${Q.join(`, `)}`)}function ue(e){return Q.includes(e)}function J(e){return e===`project`||e===`local`?n():void 0}function de(e){return r(`projectSettings`)?.enabledPlugins?.[e]===!0}function fe(e){let t=e.includes(`@`);for(let n of[`local`,`project`,`user`]){let i=r(U(n))?.enabledPlugins;if(i){for(let r of Object.keys(i))if(t?r===e:r.startsWith(`${e}@`))return{pluginId:r,scope:n}}}return null}function pe(e,t){let{name:n,marketplace:r}=V(e);return t.find(t=>t.name===e||t.name===n?!0:r&&t.source?t.name===n&&t.source.includes(`@${r}`):!1)}function me(e){let{name:t}=V(e),n=T();if(n.plugins[e]?.length)return{pluginId:e,pluginName:t};let r=Object.keys(n.plugins).find(e=>{let{name:r}=V(e);return r===t&&(n.plugins[e]?.length??0)>0});return r?{pluginId:r,pluginName:t}:null}function Y(e){let t=T().plugins[e];if(!t||t.length===0)return{scope:`user`};let r=n(),i=t.find(e=>e.scope===`local`&&e.projectPath===r);if(i)return{scope:i.scope,projectPath:i.projectPath};let a=t.find(e=>e.scope===`project`&&e.projectPath===r);if(a)return{scope:a.scope,projectPath:a.projectPath};let o=t.find(e=>e.scope===`user`);return o?{scope:o.scope}:{scope:t[0].scope,projectPath:t[0].projectPath}}async function he(e,t=`user`){q(t);let{name:n,marketplace:r}=V(e),i,a,o;if(r){let t=await x(e);t&&(i=t.entry,a=r,o=t.marketplaceInstallLocation)}else{let e=await b();for(let[t,r]of Object.entries(e))try{let e=(await te(t)).plugins.find(e=>e.name===n);if(e){i=e,a=t,o=r.installLocation;break}}catch(e){f(s(e))}}if(!i||!a)return{success:!1,message:`Plugin "${n}" not found in ${r?`marketplace "${r}"`:`any configured marketplace`}`};let c=i,l=`${c.name}@${a}`,u=await y({pluginId:l,entry:c,scope:t,marketplaceInstallLocation:o});if(!u.ok){let e=u;switch(e.reason){case`local-source-no-location`:return{success:!1,message:`Cannot install local plugin "${e.pluginName}" without marketplace install location`};case`settings-write-failed`:return{success:!1,message:`Failed to update settings: ${e.message}`};case`resolution-failed`:return{success:!1,message:_(e.resolution)};case`blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" is blocked by your organization's policy and cannot be installed`};case`dependency-blocked-by-policy`:return{success:!1,message:`Plugin "${e.pluginName}" depends on "${e.blockedDependency}", which is blocked by your organization's policy`}}}return{success:!0,message:`Successfully installed plugin: ${l} (scope: ${t})${u.depNote}`,pluginId:l,pluginName:c.name,scope:t}}async function ge(e,t=`user`,n=!0){q(t);let{enabled:a,disabled:o}=await L(),s=[...a,...o],c=pe(e,s),l=U(t),u=r(l),d,f;if(c)d=Object.keys(u?.enabledPlugins??{}).find(t=>t===e||t===c.name||t.startsWith(`${c.name}@`))??(e.includes(`@`)?e:c.name),f=c.name;else{let t=me(e);if(!t)return{success:!1,message:`Plugin "${e}" not found in installed plugins`};d=t.pluginId,f=t.pluginName}let p=J(t),m=T().plugins[d],h=m?.find(e=>e.scope===t&&e.projectPath===p);if(!h){let{scope:n}=Y(d);return n!==t&&m&&m.length>0?n===`project`?{success:!1,message:`Plugin "${e}" is enabled at project scope (.claude/settings.json, shared with your team). To disable just for you: claude plugin disable ${e} --scope local`}:{success:!1,message:`Plugin "${e}" is installed in ${n} scope, not ${t}. Use --scope ${n} to uninstall.`}:{success:!1,message:`Plugin "${e}" is not installed in ${t} scope. Use --scope to specify the correct scope.`}}let g=h.installPath,_={...u?.enabledPlugins};_[d]=void 0,i(l,{enabledPlugins:_}),j(),R(d,t,p);let y=T().plugins[d],b=!y||y.length===0;b&&g&&await E(g),b&&(ce(d),n&&await v(d));let x=M(d,s),S=N(x);return{success:!0,message:`Successfully uninstalled plugin: ${f} (scope: ${t})${S}`,pluginId:d,pluginName:f,scope:t,reverseDependents:x.length>0?x:void 0}}async function X(e,t,n){let a=t?`enable`:`disable`;if(B(e)){let{error:n}=i(`userSettings`,{enabledPlugins:{...r(`userSettings`)?.enabledPlugins,[e]:t}});if(n)return{success:!1,message:`Failed to ${a} built-in plugin: ${n.message}`};j();let{name:o}=V(e);return{success:!0,message:`Successfully ${a}d built-in plugin: ${o}`,pluginId:e,pluginName:o,scope:`user`}}n&&q(n);let o,s,c=fe(e);if(n)if(s=n,c)o=c.pluginId;else if(e.includes(`@`))o=e;else return{success:!1,message:`Plugin "${e}" not found in settings. Use plugin@marketplace format.`};else if(c)o=c.pluginId,s=c.scope;else if(e.includes(`@`))o=e,s=`user`;else return{success:!1,message:`Plugin "${e}" not found in any editable settings scope. Use plugin@marketplace format.`};if(t&&ie(o))return{success:!1,message:`Plugin "${o}" is blocked by your organization's policy and cannot be enabled`};let l=U(s),u=r(l)?.enabledPlugins?.[o],d={user:0,project:1,local:2},f=n&&c&&d[n]>d[c.scope];if(n&&u===void 0&&c&&c.scope!==n&&!f)return{success:!1,message:`Plugin "${e}" is installed at ${c.scope} scope, not ${n}. Use --scope ${c.scope} or omit --scope to auto-detect.`};if(t===(n&&!f?u===!0:G().has(o)))return{success:!1,message:`Plugin "${e}" is already ${t?`enabled`:`disabled`}${n?` at ${n} scope`:``}`};let p;if(!t){let{enabled:e,disabled:t}=await L(),n=M(o,[...e,...t]);n.length>0&&(p=n)}let{error:m}=i(l,{enabledPlugins:{...r(l)?.enabledPlugins,[o]:t}});if(m)return{success:!1,message:`Failed to ${a} plugin: ${m.message}`};j();let{name:h}=V(o),g=N(p);return{success:!0,message:`Successfully ${a}d plugin: ${h} (scope: ${s})${g}`,pluginId:o,pluginName:h,scope:s,reverseDependents:p}}async function _e(e,t){return X(e,!0,t)}async function ve(e,t){return X(e,!1,t)}async function Z(){let e=G();if(e.size===0)return{success:!0,message:`No enabled plugins to disable`};let t=[],n=[];for(let[r]of e){let e=await X(r,!1);e.success?t.push(r):n.push(`${r}: ${e.message}`)}return n.length>0?{success:!1,message:`Disabled ${t.length} ${p(t.length,`plugin`)}, ${n.length} failed:\n${n.join(`
2
2
  `)}`}:{success:!0,message:`Disabled ${t.length} ${p(t.length,`plugin`)}`}}async function ye(e,t){let{name:n,marketplace:r}=V(e),i=r?`${n}@${r}`:e,a=await x(e);if(!a)return{success:!1,message:`Plugin "${n}" not found`,pluginId:i,scope:t};let{entry:o,marketplaceInstallLocation:s}=a,c=S().plugins[i];if(!c||c.length===0)return{success:!1,message:`Plugin "${n}" is not installed`,pluginId:i,scope:t};let l=J(t),u=c.find(e=>e.scope===t&&e.projectPath===l);return u?be({pluginId:i,pluginName:n,entry:o,marketplaceInstallLocation:s,installation:u,scope:t,projectPath:l}):{success:!1,message:`Plugin "${n}" is not installed at scope ${l?`${t} (${l})`:t}`,pluginId:i,scope:t}}async function be({pluginId:e,pluginName:t,entry:n,marketplaceInstallLocation:r,installation:i,scope:a,projectPath:s}){let c=u(),l=i.version,d,f,p=!1,m;if(typeof n.source!=`string`){let t=await oe(n.source,{manifest:{name:n.name}});d=t.path,p=!0,m=t.gitCommitSha,f=await w(e,n.source,t.manifest,t.path,n.version,t.gitCommitSha)}else{let t;try{t=await c.stat(r)}catch(t){if(o(t))return{success:!1,message:`Marketplace directory not found at ${r}`,pluginId:e,scope:a};throw t}d=K(t.isDirectory()?r:le(r),n.source);try{await c.stat(d)}catch(t){if(o(t))return{success:!1,message:`Plugin source not found at ${d}`,pluginId:e,scope:a};throw t}let i,s=K(d,`.claude-plugin`,`plugin.json`);try{i=await I(s,n.name,n.source)}catch{}f=await w(e,n.source,i,d,n.version)}try{let r=A(e,f),o=D(e,f);if(i.version===f||i.installPath===r||i.installPath===o)return{success:!0,message:`${t} is already at the latest version (${f}).`,pluginId:e,newVersion:f,oldVersion:l,alreadyUpToDate:!0,scope:a};r=await ne(d,e,f,n);let c=i.installPath;if(g(e,a,s,r,f,m),c&&c!==r){let e=S();Object.values(e.plugins).some(e=>e.some(e=>e.installPath===c))||await E(c)}let u=s?`${a} (${s})`:a;return{success:!0,message:`Plugin "${t}" updated from ${l||`unknown`} to ${f} for scope ${u}. Restart to apply changes.`,pluginId:e,newVersion:f,oldVersion:l,scope:a}}finally{p&&d!==A(e,f)&&await c.rm(d,{recursive:!0,force:!0})}}var Q,$,xe=e((()=>{t(),H(),c(),l(),d(),k(),re(),ee(),se(),h(),z(),F(),P(),O(),C(),W(),ae(),a(),m(),Q=[`user`,`project`,`local`],$=[`user`,`project`,`local`,`managed`]}));export{_e as a,he as c,ge as d,ye as f,ve as i,ue as l,$ as n,Y as o,Z as r,xe as s,Q as t,de as u};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Qa as t,fs as n,lo as r,oo as i,us as a}from"./paths-4ZWdjPP4.js";import{l as o,p as s}from"./debug-otxXY3j-.js";import{n as c,t as l}from"./cwd--iizewsn.js";import{o as u,s as d}from"./log-DSV4Ht5l.js";import{Ds as f,Ks as p,Ms as m,Ss as h,aj as g,oj as _,qs as v,ws as y}from"./loadAgentsDir-CQF8qhne.js";import{i as b,s as x}from"./xml-BUaEXGXx.js";import{join as S}from"path";function C(){let e=new Map,n=g();for(let[t,r]of Object.entries(n))t.includes(`@`)&&(r===!0?e.set(t,`flag`):r===!1&&e.delete(t));for(let{scope:r,source:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=t(i);if(a?.enabledPlugins)for(let[t,o]of Object.entries(a.enabledPlugins))t.includes(`@`)&&(t in n&&n[t]!==o&&s(`Plugin ${t} from --add-dir (${n[t]}) overridden by ${i} (${o})`),o===!0?e.set(t,r):o===!1&&e.delete(t))}return s(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,i,a=`user`){let o=a===`user`?void 0:l(),s=x(a),c=t(s),u={...c?.enabledPlugins},m=[],g=[];for(let t=0;t<e.length;t++){let r=e[t];if(r){i&&i(r,t+1,e.length);try{let e=await p(r);if(!e){g.push({name:r,error:`Plugin not found in any marketplace`});continue}let{entry:t,marketplaceInstallLocation:i}=e;n(t.source)?f({pluginId:r,installPath:S(i,t.source),version:t.version},a,o):await h(r,t,a,o),u[r]=!0,m.push(r)}catch(e){let t=e instanceof Error?e.message:String(e);g.push({name:r,error:t}),d(e)}}}return r(s,{...c,enabledPlugins:u}),{installed:m,failed:g}}var T=e((()=>{c(),o(),u(),i(),_(),m(),v(),b(),y(),a()}));export{T as n,w as r,C as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Qa as t,fs as n,lo as r,oo as i,us as a}from"./paths-BZjPDxMm.js";import{l as o,p as s}from"./debug-otxXY3j-.js";import{n as c,t as l}from"./cwd--iizewsn.js";import{o as u,s as d}from"./log-DSV4Ht5l.js";import{Ds as f,Ks as p,Ms as m,Ss as h,aj as g,oj as _,qs as v,ws as y}from"./loadAgentsDir-BYWykYwn.js";import{i as b,s as x}from"./xml-DOXio8vw.js";import{join as S}from"path";function C(){let e=new Map,n=g();for(let[t,r]of Object.entries(n))t.includes(`@`)&&(r===!0?e.set(t,`flag`):r===!1&&e.delete(t));for(let{scope:r,source:i}of[{scope:`managed`,source:`policySettings`},{scope:`user`,source:`userSettings`},{scope:`project`,source:`projectSettings`},{scope:`local`,source:`localSettings`},{scope:`flag`,source:`flagSettings`}]){let a=t(i);if(a?.enabledPlugins)for(let[t,o]of Object.entries(a.enabledPlugins))t.includes(`@`)&&(t in n&&n[t]!==o&&s(`Plugin ${t} from --add-dir (${n[t]}) overridden by ${i} (${o})`),o===!0?e.set(t,r):o===!1&&e.delete(t))}return s(`Found ${e.size} enabled plugins with scopes: ${Array.from(e.entries()).map(([e,t])=>`${e}(${t})`).join(`, `)}`),e}async function w(e,i,a=`user`){let o=a===`user`?void 0:l(),s=x(a),c=t(s),u={...c?.enabledPlugins},m=[],g=[];for(let t=0;t<e.length;t++){let r=e[t];if(r){i&&i(r,t+1,e.length);try{let e=await p(r);if(!e){g.push({name:r,error:`Plugin not found in any marketplace`});continue}let{entry:t,marketplaceInstallLocation:i}=e;n(t.source)?f({pluginId:r,installPath:S(i,t.source),version:t.version},a,o):await h(r,t,a,o),u[r]=!0,m.push(r)}catch(e){let t=e instanceof Error?e.message:String(e);g.push({name:r,error:t}),d(e)}}}return r(s,{...c,enabledPlugins:u}),{installed:m,failed:g}}var T=e((()=>{c(),o(),u(),i(),_(),m(),v(),b(),y(),a()}));export{T as n,w as r,C as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./pluginStartupCheck-DCxJJkYs.js";e();export{t as getPluginEditableScopes};
@@ -1,4 +1,4 @@
1
- import{n as e,t}from"./figures-gfT9mM8P.js";import{Or as n,cn as r}from"./state-sIHsFpDu.js";import{E as i,O as a,U as o,z as s}from"./debug-otxXY3j-.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{o as u,s as d}from"./log-DSV4Ht5l.js";import{l as f,o as p}from"./stringUtils-KZoO4GUd.js";import{$s as m,Is as h,Js as g,Ms as _,Rs as v,Vs as y,Xs as ee,Zs as te,ac as b,cj as x,dc as S,gc as C,hc as w,nT as T,pc as ne,qs as E,sj as D,tT as O,tc as k,vs as A,ys as j}from"./loadAgentsDir-CQF8qhne.js";import{i as M,o as N,s as P}from"./xml-BUaEXGXx.js";import{n as F,t as I}from"./exit-DOBLl8jN.js";import{n as L,t as R}from"./pluginOperations-mr4I7Jw9.js";import{a as z,i as B,n as V,o as H,r as U,t as W}from"./pluginCliCommands-CmY_maYg.js";import{a as re,c as G,i as K,n as q,r as J,s as Y,t as X}from"./validatePlugin-CxCXNV8o.js";import{basename as ie,dirname as Z}from"path";e(),r(),c(),x(),o(),u(),C(),G(),_(),S(),E(),O(),K(),M(),A(),X(),i(),p();function Q(e,n){d(e),I(`${t.cross} Failed to ${n}: ${s(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${f(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${f(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function ae(e,r){r.cowork&&n(!0);try{let n=await q(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ie(e)===`.claude-plugin`){r=await J(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){d(e),console.error(`${t.cross} Unexpected error during validation: ${s(e)}`),process.exit(2)}}async function oe(e){e.cowork&&n(!0),l(`tengu_plugin_list_command`,{});let r=v(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-BFuZqpnX.js`),o=i(),s=Object.keys(r.plugins),{enabled:c,disabled:u,errors:d}=await j(),f=[...c,...u],p=f.filter(e=>e.source.endsWith(`@inline`)),m=d.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(f.map(e=>[e.source,e])),n=[];for(let e of s.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let a=N(e).name,s=d.filter(t=>t.source===e||`plugin`in t&&t.plugin===a).map(D);for(let r of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await T(i);e&&Object.keys(e).length>0&&(a=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:o.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:a,errors:s.length>0?s:void 0})}}for(let e of p){let t=e.mcpServers||await T(e),r=m.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(D);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of m.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[D(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([g(),Y()]),{marketplaces:r}=await ne(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=b(r.name,t);h(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}F(a({installed:n,available:e},null,2))}else F(a(n,null,2))}s.length===0&&p.length===0&&m.length===0&&F("No plugins installed. Use `claude plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
1
+ import{n as e,t}from"./figures-gfT9mM8P.js";import{Or as n,cn as r}from"./state-sIHsFpDu.js";import{E as i,O as a,U as o,z as s}from"./debug-otxXY3j-.js";import{n as c,r as l}from"./analytics-DqMQntaB.js";import{o as u,s as d}from"./log-DSV4Ht5l.js";import{l as f,o as p}from"./stringUtils-KZoO4GUd.js";import{$s as m,Is as h,Js as g,Ms as _,Rs as v,Vs as y,Xs as ee,Zs as te,ac as b,cj as x,dc as S,gc as C,hc as w,nT as T,pc as ne,qs as E,sj as D,tT as O,tc as k,vs as A,ys as j}from"./loadAgentsDir-BYWykYwn.js";import{i as M,o as N,s as P}from"./xml-DOXio8vw.js";import{n as F,t as I}from"./exit-DOBLl8jN.js";import{n as L,t as R}from"./pluginOperations-COyT4tHs.js";import{a as z,i as B,n as V,o as H,r as U,t as W}from"./pluginCliCommands-DyYEg7Cv.js";import{a as re,c as G,i as K,n as q,r as J,s as Y,t as X}from"./validatePlugin-8EMSASvV.js";import{basename as ie,dirname as Z}from"path";e(),r(),c(),x(),o(),u(),C(),G(),_(),S(),E(),O(),K(),M(),A(),X(),i(),p();function Q(e,n){d(e),I(`${t.cross} Failed to ${n}: ${s(e)}`)}function $(e){e.errors.length>0&&(console.log(`${t.cross} Found ${e.errors.length} ${f(e.errors.length,`error`)}:\n`),e.errors.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``)),e.warnings.length>0&&(console.log(`${t.warning} Found ${e.warnings.length} ${f(e.warnings.length,`warning`)}:\n`),e.warnings.forEach(e=>{console.log(` ${t.pointer} ${e.path}: ${e.message}`)}),console.log(``))}async function ae(e,r){r.cowork&&n(!0);try{let n=await q(e);console.log(`Validating ${n.fileType} manifest: ${n.filePath}\n`),$(n);let r=[];if(n.fileType===`plugin`){let e=Z(n.filePath);if(ie(e)===`.claude-plugin`){r=await J(Z(e));for(let e of r)console.log(`Validating ${e.fileType}: ${e.filePath}\n`),$(e)}}let i=n.success&&r.every(e=>e.success),a=n.warnings.length>0||r.some(e=>e.warnings.length>0);i?F(a?`${t.tick} Validation passed with warnings`:`${t.tick} Validation passed`):(console.log(`${t.cross} Validation failed`),process.exit(1))}catch(e){d(e),console.error(`${t.cross} Unexpected error during validation: ${s(e)}`),process.exit(2)}}async function oe(e){e.cowork&&n(!0),l(`tengu_plugin_list_command`,{});let r=v(),{getPluginEditableScopes:i}=await import(`./pluginStartupCheck-DjfIaOch.js`),o=i(),s=Object.keys(r.plugins),{enabled:c,disabled:u,errors:d}=await j(),f=[...c,...u],p=f.filter(e=>e.source.endsWith(`@inline`)),m=d.filter(e=>e.source.endsWith(`@inline`)||e.source.startsWith(`inline[`));if(e.json){let t=new Map(f.map(e=>[e.source,e])),n=[];for(let e of s.sort()){let i=r.plugins[e];if(!i||i.length===0)continue;let a=N(e).name,s=d.filter(t=>t.source===e||`plugin`in t&&t.plugin===a).map(D);for(let r of i){let i=t.get(e),a;if(i){let e=i.mcpServers||await T(i);e&&Object.keys(e).length>0&&(a=e)}n.push({id:e,version:r.version||`unknown`,scope:r.scope,enabled:o.has(e),installPath:r.installPath,installedAt:r.installedAt,lastUpdated:r.lastUpdated,projectPath:r.projectPath,mcpServers:a,errors:s.length>0?s:void 0})}}for(let e of p){let t=e.mcpServers||await T(e),r=m.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name).map(D);n.push({id:e.source,version:e.manifest.version??`unknown`,scope:`session`,enabled:e.enabled!==!1,installPath:e.path,mcpServers:t&&Object.keys(t).length>0?t:void 0,errors:r.length>0?r:void 0})}for(let e of m.filter(e=>e.source.startsWith(`inline[`)))n.push({id:e.source,version:`unknown`,scope:`session`,enabled:!1,installPath:`path`in e?e.path:``,errors:[D(e)]});if(e.available){let e=[];try{let[t,n]=await Promise.all([g(),Y()]),{marketplaces:r}=await ne(t);for(let{name:t,data:i}of r)if(i)for(let r of i.plugins){let i=b(r.name,t);h(i)||e.push({pluginId:i,name:r.name,description:r.description,marketplaceName:t,version:r.version,source:r.source,installCount:n?.get(i)})}}catch{}F(a({installed:n,available:e},null,2))}else F(a(n,null,2))}s.length===0&&p.length===0&&m.length===0&&F("No plugins installed. Use `claude plugin install` to install a plugin."),s.length>0&&console.log(`Installed plugins:
2
2
  `);for(let e of s.sort()){let n=r.plugins[e];if(!n||n.length===0)continue;let i=N(e).name,a=d.filter(t=>t.source===e||`plugin`in t&&t.plugin===i);for(let r of n){let n=o.has(e),i=a.length>0?`${t.cross} failed to load`:n?`${t.tick} enabled`:`${t.cross} disabled`,s=r.version||`unknown`,c=r.scope;console.log(` ${t.pointer} ${e}`),console.log(` Version: ${s}`),console.log(` Scope: ${c}`),console.log(` Status: ${i}`);for(let e of a)console.log(` Error: ${D(e)}`);console.log(``)}}if(p.length>0||m.length>0){console.log(`Session-only plugins (--plugin-dir):
3
3
  `);for(let e of p){let n=m.filter(t=>t.source===e.source||`plugin`in t&&t.plugin===e.name),r=n.length>0?`${t.cross} loaded with errors`:`${t.tick} loaded`;console.log(` ${t.pointer} ${e.source}`),console.log(` Version: ${e.manifest.version??`unknown`}`),console.log(` Path: ${e.path}`),console.log(` Status: ${r}`);for(let e of n)console.log(` Error: ${D(e)}`);console.log(``)}for(let e of m.filter(e=>e.source.startsWith(`inline[`)))console.log(` ${t.pointer} ${e.source}: ${t.cross} ${D(e)}\n`)}F()}async function se(e,r){r.cowork&&n(!0);try{let n=await re(e);n||I(`${t.cross} Invalid marketplace source format. Try: owner/repo, https://..., or ./path`),`error`in n&&I(`${t.cross} ${n.error}`);let i=r.scope??`user`;i!==`user`&&i!==`project`&&i!==`local`&&I(`${t.cross} Invalid scope '${i}'. Use: user, project, or local`);let a=P(i),o=n;r.sparse&&r.sparse.length>0&&(o.source===`github`||o.source===`git`?o={...o,sparsePaths:r.sparse}:I(`${t.cross} --sparse is only supported for github and git marketplace sources (got: ${o.source})`)),console.log(`Adding marketplace...`);let{name:s,alreadyMaterialized:c,resolvedSource:u}=await y(o,e=>{console.log(e)});k(s,{source:u},a),w();let d=o.source;o.source===`github`&&(d=o.repo),l(`tengu_marketplace_added`,{source_type:d}),F(c?`${t.tick} Marketplace '${s}' already on disk — declared in ${i} settings`:`${t.tick} Successfully added marketplace: ${s} (declared in ${i} settings)`)}catch(e){Q(e,`add marketplace`)}}async function ce(e){e.cowork&&n(!0);try{let n=await g(),r=Object.keys(n);e.json&&F(a(r.sort().map(e=>{let t=n[e],r=t?.source;return{name:e,source:r?.source,...r?.source===`github`&&{repo:r.repo},...r?.source===`git`&&{url:r.url},...r?.source===`url`&&{url:r.url},...r?.source===`directory`&&{path:r.path},...r?.source===`file`&&{path:r.path},installLocation:t?.installLocation}}),null,2)),r.length===0&&F(`No marketplaces configured`),console.log(`Configured marketplaces:
4
4
  `),r.forEach(e=>{let r=n[e];if(console.log(` ${t.pointer} ${e}`),r?.source){let e=r.source;e.source===`github`?console.log(` Source: GitHub (${e.repo})`):e.source===`git`?console.log(` Source: Git (${e.url})`):e.source===`url`?console.log(` Source: URL (${e.url})`):e.source===`directory`?console.log(` Source: Directory (${e.path})`):e.source===`file`&&console.log(` Source: File (${e.path})`)}console.log(``)}),F()}catch(e){Q(e,`list marketplaces`)}}async function le(e,r){r.cowork&&n(!0);try{await m(e),w(),l(`tengu_marketplace_removed`,{marketplace_name:e}),F(`${t.tick} Successfully removed marketplace: ${e}`)}catch(e){Q(e,`remove marketplace`)}}async function ue(e,r){r.cowork&&n(!0);try{if(e)console.log(`Updating marketplace: ${e}...`),await te(e,e=>{console.log(e)}),w(),l(`tengu_marketplace_updated`,{marketplace_name:e}),F(`${t.tick} Successfully updated marketplace: ${e}`);else{let e=await g(),n=Object.keys(e);n.length===0&&F(`No marketplaces configured`),console.log(`Updating ${n.length} marketplace(s)...`),await ee(),w(),l(`tengu_marketplace_updated_all`,{count:n.length}),F(`${t.tick} Successfully updated ${n.length} marketplace(s)`)}}catch(e){Q(e,`update marketplace(s)`)}}async function de(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&I(`--cowork can only be used with user scope`),R.includes(r)||I(`Invalid scope: ${r}. Must be one of: ${R.join(`, `)}.`);let{name:i,marketplace:a}=N(e);l(`tengu_plugin_install_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r}),await B(e,r)}async function fe(e,t){t.cowork&&n(!0);let r=t.scope||`user`;t.cowork&&r!==`user`&&I(`--cowork can only be used with user scope`),R.includes(r)||I(`Invalid scope: ${r}. Must be one of: ${R.join(`, `)}.`);let{name:i,marketplace:a}=N(e);l(`tengu_plugin_uninstall_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r}),await z(e,r,t.keepData)}async function pe(e,t){t.cowork&&n(!0);let r;t.scope&&(R.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${R.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=N(e);l(`tengu_plugin_enable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r??`auto`}),await U(e,r)}async function me(e,t){if(t.all&&e&&I(`Cannot use --all with a specific plugin`),!t.all&&!e&&I(`Please specify a plugin name or use --all to disable all plugins`),t.cowork&&n(!0),t.all){t.scope&&I(`Cannot use --scope with --all`),l(`tengu_plugin_disable_command`,{}),await W();return}let r;t.scope&&(R.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${R.join(`, `)}`),r=t.scope),t.cowork&&r!==void 0&&r!==`user`&&I(`--cowork can only be used with user scope`),t.cowork&&r===void 0&&(r=`user`);let{name:i,marketplace:a}=N(e);l(`tengu_plugin_disable_command`,{_PROTO_plugin_name:i,...a&&{_PROTO_marketplace_name:a},scope:r??`auto`}),await V(e,r)}async function he(e,t){t.cowork&&n(!0);let{name:r,marketplace:i}=N(e);l(`tengu_plugin_update_command`,{_PROTO_plugin_name:r,...i&&{_PROTO_marketplace_name:i}});let a=`user`;t.scope&&(L.includes(t.scope)||I(`Invalid scope "${t.scope}". Valid scopes: ${L.join(`, `)}`),a=t.scope),t.cowork&&a!==`user`&&I(`--cowork can only be used with user scope`),await H(e,a)}export{se as marketplaceAddHandler,ce as marketplaceListHandler,le as marketplaceRemoveHandler,ue as marketplaceUpdateHandler,me as pluginDisableHandler,pe as pluginEnableHandler,de as pluginInstallHandler,oe as pluginListHandler,fe as pluginUninstallHandler,he as pluginUpdateHandler,ae as pluginValidateHandler};
@@ -0,0 +1 @@
1
+ import{Ka as e,Qa as t,Wa as n}from"./loadAgentsDir-BYWykYwn.js";n();export{e as isPolicyAllowed,t as waitForPolicyLimitsToLoad};
@@ -1 +1 @@
1
- import{Cn as e,wn as t}from"./schemas-BGAvj1T4.js";import{t as n}from"./v4-f1i_CNUT.js";import{S as r,v as i}from"./paths-4ZWdjPP4.js";import{n as a,t as o}from"./lazySchema-B0QShMaQ.js";n(),o(),r();var s=2e3,c=6e5,l={poll_interval_ms_not_at_capacity:s,poll_interval_ms_at_capacity:c,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:s,multisession_poll_interval_ms_partial_capacity:s,multisession_poll_interval_ms_at_capacity:c,reclaim_older_than_ms:5e3,session_keepalive_interval_v2_ms:12e4},u={message:`must be 0 (disabled) or ≥100ms`},d=a(()=>t({poll_interval_ms_not_at_capacity:e().int().min(100),poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u),non_exclusive_heartbeat_interval_ms:e().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u).default(l.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:e().int().min(1).default(5e3),session_keepalive_interval_v2_ms:e().int().min(0).default(12e4)}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0`}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.multisession_poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0`}));function f(){let e=i(`tengu_bridge_poll_interval_config`,l,300*1e3),t=d().safeParse(e);return t.success?t.data:l}export{l as n,f as t};
1
+ import{Cn as e,wn as t}from"./schemas-BGAvj1T4.js";import{t as n}from"./v4-f1i_CNUT.js";import{S as r,v as i}from"./paths-BZjPDxMm.js";import{n as a,t as o}from"./lazySchema-B0QShMaQ.js";n(),o(),r();var s=2e3,c=6e5,l={poll_interval_ms_not_at_capacity:s,poll_interval_ms_at_capacity:c,non_exclusive_heartbeat_interval_ms:0,multisession_poll_interval_ms_not_at_capacity:s,multisession_poll_interval_ms_partial_capacity:s,multisession_poll_interval_ms_at_capacity:c,reclaim_older_than_ms:5e3,session_keepalive_interval_v2_ms:12e4},u={message:`must be 0 (disabled) or ≥100ms`},d=a(()=>t({poll_interval_ms_not_at_capacity:e().int().min(100),poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u),non_exclusive_heartbeat_interval_ms:e().int().min(0).default(0),multisession_poll_interval_ms_not_at_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_not_at_capacity),multisession_poll_interval_ms_partial_capacity:e().int().min(100).default(l.multisession_poll_interval_ms_partial_capacity),multisession_poll_interval_ms_at_capacity:e().int().refine(e=>e===0||e>=100,u).default(l.multisession_poll_interval_ms_at_capacity),reclaim_older_than_ms:e().int().min(1).default(5e3),session_keepalive_interval_v2_ms:e().int().min(0).default(12e4)}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or poll_interval_ms_at_capacity > 0`}).refine(e=>e.non_exclusive_heartbeat_interval_ms>0||e.multisession_poll_interval_ms_at_capacity>0,{message:`at-capacity liveness requires non_exclusive_heartbeat_interval_ms > 0 or multisession_poll_interval_ms_at_capacity > 0`}));function f(){let e=i(`tengu_bridge_poll_interval_config`,l,300*1e3),t=d().safeParse(e);return t.success?t.data:l}export{l as n,f as t};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,n,t as r}from"./poorMode-DD-q_w6Z.js";var i;e((()=>{r(),i=async(e,r)=>{let i=!n();return t(i),i?r.setAppState(e=>({...e,promptSuggestionEnabled:!1})):r.setAppState(e=>({...e,promptSuggestionEnabled:!0})),{type:`text`,value:`Poor mode ${i?`ON`:`OFF`} — ${i?`extract_memories and prompt_suggestion are disabled`:`extract_memories and prompt_suggestion are restored`}`}}}))();export{i as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{i as t,n,t as r}from"./poorMode-CFRuV-nB.js";var i;e((()=>{r(),i=async(e,r)=>{let i=!n();return t(i),i?r.setAppState(e=>({...e,promptSuggestionEnabled:!1})):r.setAppState(e=>({...e,promptSuggestionEnabled:!0})),{type:`text`,value:`Poor mode ${i?`ON`:`OFF`} — ${i?`extract_memories and prompt_suggestion are disabled`:`extract_memories and prompt_suggestion are restored`}`}}}))();export{i as call};
@@ -1 +1 @@
1
- import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{Ka as n,lo as r,oo as i}from"./paths-4ZWdjPP4.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=n().poorMode===!0),c}function s(e){c=e,r(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{i(),c=null}));export{s as i,o as n,a as r,l as t};
1
+ import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{Ka as n,lo as r,oo as i}from"./paths-BZjPDxMm.js";var a=t({isPoorModeActive:()=>o,setPoorMode:()=>s});function o(){return c===null&&(c=n().poorMode===!0),c}function s(e){c=e,r(`userSettings`,{poorMode:e||void 0})}var c,l=e((()=>{i(),c=null}));export{s as i,o as n,a as r,l as t};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./poorMode-CFRuV-nB.js";t();export{e as isPoorModeActive};
@@ -1,4 +1,4 @@
1
- import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,Et as oe,Fa as T,Ki as se,Ma as E,Na as ce,Ot as D,Pr as O,Qo as le,Rr as ue,S as de,Si as fe,Xn as pe,Xo as me,Yn as k,_ as he,a as ge,bl as _e,c as ve,cl as ye,hl as A,kt as be,ll as xe,ml as Se,no as Ce,on as j,oo as we,pi as Te,qi as Ee,rs as De,to as Oe,us as M,vi as ke,xi as N,xl as Ae,yi as je,zo as Me}from"./paths-4ZWdjPP4.js";import{D as Ne,E as Pe,J as Fe,O as P,Q as Ie,U as Le,Z as Re,_ as ze,h as Be,l as F,p as I,u as L,z as R}from"./debug-otxXY3j-.js";import{n as Ve,r as z}from"./analytics-DqMQntaB.js";import{n as He,t as Ue}from"./cwd--iizewsn.js";import{i as We,n as B,o as V}from"./process-DMKLUQIO.js";import{F as Ge,I as Ke,P as H}from"./git-C0IuvuIy.js";import{J as qe,K as Je,c as Ye,et as U,i as Xe,o as Ze,s as W}from"./log-DSV4Ht5l.js";import{i as Qe,n as $e}from"./path-BE28AJwZ.js";import{s as et,u as tt}from"./types-KeqFPzY5.js";import{C as nt,c as rt,d as it,l as at,m as ot,s as st,x as G}from"./teammate-CbskW5G9.js";import{n as ct,t as lt}from"./sleep-C6koP5Ka.js";import{$C as ut,$D as dt,$T as ft,$v as pt,Ay as mt,BA as ht,Bc as gt,Bf as _t,CD as vt,CE as K,Cc as yt,Cg as bt,Cn as xt,D as St,DD as Ct,DO as wt,Dc as Tt,Dg as Et,Dj as Dt,Dn as Ot,ED as kt,Ec as At,Eg as jt,Ey as Mt,F as Nt,FA as Pt,Fb as Ft,Fr as It,Fw as Lt,G as Rt,GO as zt,Gi as Bt,Gt as Vt,Gv as Ht,Hc as Ut,Hs as Wt,Hw as Gt,IC as Kt,IE as qt,Ij as Jt,Iw as Yt,Ji as Xt,Ju as Zt,Jv as Qt,Jx as $t,K as en,KE as tn,KO as nn,Ka as rn,Kw as an,Kx as on,LE as sn,LO as cn,Ll as ln,MA as un,Mi as dn,Ni as fn,Nr as pn,O as mn,OD as hn,Oj as gn,On as _n,Ow as vn,Pr as yn,QO as bn,Qs as xn,Qv as Sn,Qx as Cn,RC as wn,RE as Tn,RO as En,Rj as Dn,Rl as On,Rw as kn,S as An,SD as jn,SE as Mn,Sc as Nn,Sy as Pn,TE as Fn,Tc as In,Tj as Ln,Tw as Rn,Ty as zn,Uo as Bn,Us as Vn,Vc as Hn,Vw as Un,WA as Wn,WO as Gn,Wa as Kn,XE as qn,Xb as Jn,YE as Yn,YO as Xn,Yb as Zn,Ys as Qn,Yv as $n,Yx as er,Zi as tr,Zu as nr,_i as rr,_p as ir,ak as ar,bc as or,bi as sr,bs as cr,cE as lr,cO as ur,cb as dr,cu as fr,dO as pr,ds as mr,du as hr,dv as gr,eE as _r,eO as vr,ew as yr,ey as br,fO as xr,fs as Sr,gD as Cr,gO as wr,gi as Tr,gj as Er,gp as Dr,hD as Or,hE as kr,hO as Ar,ha as jr,hg as Mr,hw as Nr,iD as Pr,iS as Fr,ii as Ir,ik as Lr,jj as Rr,jy as zr,lO as Br,lr as Vr,lu as Hr,mC as Ur,mO as Wr,mr as Gr,ms as Kr,nD as qr,na as Jr,nw as Yr,o as Xr,oO as q,p as Zr,pC as Qr,pE as $r,pO as ei,qE as ti,qs as ni,qu as ri,rS as ii,s as ai,sO as oi,sb as si,tS as ci,ty as li,u as ui,uO as di,uv as fi,vE as pi,vO as mi,vc as hi,vs as gi,w as _i,wD as vi,wE as yi,wO as bi,wc as xi,wi as Si,wy as Ci,x as wi,xc as Ti,xi as Ei,yE as Di,yO as Oi,yc as ki,yo as Ai,zC as ji,zE as Mi,zO as J,zb as Ni,zc as Pi,zf as Fi}from"./loadAgentsDir-CQF8qhne.js";import{$n as Ii,$t as Li,F as Ri,Gt as zi,M as Bi,Mn as Vi,Ot as Hi,Qn as Ui,Wt as Wi,kt as Gi,wn as Ki}from"./prompt-CogZQuTN.js";import{i as qi,o as Ji}from"./xml-BUaEXGXx.js";import{a as Yi,o as Xi,s as Zi}from"./fileStateCache-BhVfo23e.js";import{A as Qi,C as $i,D as ea,N as ta,O as na,P as ra,Z as ia,_ as aa,d as oa,g as sa,h as ca,m as la,u as ua,v as da,y as fa}from"./rcDebugLog-DOXxIr8l.js";import{c as pa,l as ma}from"./commitAttribution-ClSlXMPG.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-B-poMJeE.js";import{t as ya}from"./pollConfig-DLbuHBse.js";import{r as ba}from"./inboundAttachments-B0sGIu79.js";import{i as xa,n as Sa,s as Ca}from"./mappers-BNI_df3v.js";import{n as wa,r as Ta}from"./sessionTitle-CSU5-VK9.js";import{n as Ea,t as Da}from"./ccrClient-D7pEGzQa.js";import{n as Oa,t as ka}from"./HybridTransport-BItIDJyC.js";import{n as Aa,t as ja}from"./SSETransport-D51Jfdaj.js";import{t as Ma}from"./pluginBlocklist-C9XwbFSo.js";import{c as Na,d as Pa,f as Fa,l as Ia,o as La,r as Ra,s as za,u as Ba}from"./channelNotification-BZFMAWln.js";import{t as Va}from"./onChangeAppState-B3d5iy6T.js";import{t as Ha}from"./settingsSync-Nixbcaox.js";import{a as Ua,c as Wa,d as Ga,f as Ka,l as qa,m as Ja,o as Ya,p as Xa,r as Za,t as Qa}from"./cronJitterConfig-CaFkPXKB.js";import{i as $a,n as eo}from"./toolPool-hQlvQn-j.js";import{n as to,r as no}from"./QueryEngine-CmJK27jU.js";import{n as ro,r as io}from"./sideQuestion-MzExGTvn.js";import{n as ao,r as oo}from"./context-noninteractive-CJu7hZCM.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-DlWPJTny.js";import{n as uo,t as fo}from"./refresh-CP7Dnjp4.js";import{dirname as po,join as mo}from"path";import{PassThrough as ho}from"stream";import{randomUUID as Y}from"crypto";import{readFile as go,stat as _o}from"fs/promises";import{URL as vo}from"url";import{cwd as X}from"process";a(),_(),He(),Re(),Le(),Pe(),ze(),B(),F(),H(),U(),Ze(),Qe(),et(),G(),M(),we(),T(),E(),Ee(),O(),k(),lt(),j(),at(),de(),ge(),Ui(),Vi(),ht(),Pt(),nn(),di(),vr(),Cr(),ta(),ti(),ha(),yi(),lr(),na(),fi(),oa(),Hn(),gt(),Sr(),Bn(),Jr(),It(),_n(),xt(),Ha(),r(),Aa();function yo(e,t={},n,r){if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let i=new vo(e.href);return i.protocol===`wss:`?i.protocol=`https:`:i.protocol===`ws:`&&(i.protocol=`http:`),i.pathname=i.pathname.replace(/\/$/,``)+`/worker/events/stream`,new ja(i,t,n,r)}if(e.protocol===`ws:`||e.protocol===`wss:`)return i(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ka(e,t,n,r):new Oa(e,t,n,r);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Aa();var bo=class extends Ga{constructor(e,t,n){let r=new ho({encoding:`utf8`});super(r,n),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=r,this.url=new vo(e);let a={},s=ea();s?a.Authorization=`Bearer ${s}`:I(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;if(c&&(a[`x-environment-runner-version`]=c),this.transport=yo(this.url,a,u(),()=>{let e={},t=ea();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e}),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=L(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&V(e.endsWith(`
1
+ import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,Et as oe,Fa as T,Ki as se,Ma as E,Na as ce,Ot as D,Pr as O,Qo as le,Rr as ue,S as de,Si as fe,Xn as pe,Xo as me,Yn as k,_ as he,a as ge,bl as _e,c as ve,cl as ye,hl as A,kt as be,ll as xe,ml as Se,no as Ce,on as j,oo as we,pi as Te,qi as Ee,rs as De,to as Oe,us as M,vi as ke,xi as N,xl as Ae,yi as je,zo as Me}from"./paths-BZjPDxMm.js";import{D as Ne,E as Pe,J as Fe,O as P,Q as Ie,U as Le,Z as Re,_ as ze,h as Be,l as F,p as I,u as L,z as R}from"./debug-otxXY3j-.js";import{n as Ve,r as z}from"./analytics-DqMQntaB.js";import{n as He,t as Ue}from"./cwd--iizewsn.js";import{i as We,n as B,o as V}from"./process-DMKLUQIO.js";import{F as Ge,I as Ke,P as H}from"./git-C0IuvuIy.js";import{J as qe,K as Je,c as Ye,et as U,i as Xe,o as Ze,s as W}from"./log-DSV4Ht5l.js";import{i as Qe,n as $e}from"./path-BE28AJwZ.js";import{s as et,u as tt}from"./types-KeqFPzY5.js";import{C as nt,c as rt,d as it,l as at,m as ot,s as st,x as G}from"./teammate-CbskW5G9.js";import{n as ct,t as lt}from"./sleep-C6koP5Ka.js";import{$C as ut,$D as dt,$T as ft,$v as pt,Ay as mt,BA as ht,Bc as gt,Bf as _t,CD as vt,CE as K,Cc as yt,Cg as bt,Cn as xt,D as St,DD as Ct,DO as wt,Dc as Tt,Dg as Et,Dj as Dt,Dn as Ot,ED as kt,Ec as At,Eg as jt,Ey as Mt,F as Nt,FA as Pt,Fb as Ft,Fr as It,Fw as Lt,G as Rt,GO as zt,Gi as Bt,Gt as Vt,Gv as Ht,Hc as Ut,Hs as Wt,Hw as Gt,IC as Kt,IE as qt,Ij as Jt,Iw as Yt,Ji as Xt,Ju as Zt,Jv as Qt,Jx as $t,K as en,KE as tn,KO as nn,Ka as rn,Kw as an,Kx as on,LE as sn,LO as cn,Ll as ln,MA as un,Mi as dn,Ni as fn,Nr as pn,O as mn,OD as hn,Oj as gn,On as _n,Ow as vn,Pr as yn,QO as bn,Qs as xn,Qv as Sn,Qx as Cn,RC as wn,RE as Tn,RO as En,Rj as Dn,Rl as On,Rw as kn,S as An,SD as jn,SE as Mn,Sc as Nn,Sy as Pn,TE as Fn,Tc as In,Tj as Ln,Tw as Rn,Ty as zn,Uo as Bn,Us as Vn,Vc as Hn,Vw as Un,WA as Wn,WO as Gn,Wa as Kn,XE as qn,Xb as Jn,YE as Yn,YO as Xn,Yb as Zn,Ys as Qn,Yv as $n,Yx as er,Zi as tr,Zu as nr,_i as rr,_p as ir,ak as ar,bc as or,bi as sr,bs as cr,cE as lr,cO as ur,cb as dr,cu as fr,dO as pr,ds as mr,du as hr,dv as gr,eE as _r,eO as vr,ew as yr,ey as br,fO as xr,fs as Sr,gD as Cr,gO as wr,gi as Tr,gj as Er,gp as Dr,hD as Or,hE as kr,hO as Ar,ha as jr,hg as Mr,hw as Nr,iD as Pr,iS as Fr,ii as Ir,ik as Lr,jj as Rr,jy as zr,lO as Br,lr as Vr,lu as Hr,mC as Ur,mO as Wr,mr as Gr,ms as Kr,nD as qr,na as Jr,nw as Yr,o as Xr,oO as q,p as Zr,pC as Qr,pE as $r,pO as ei,qE as ti,qs as ni,qu as ri,rS as ii,s as ai,sO as oi,sb as si,tS as ci,ty as li,u as ui,uO as di,uv as fi,vE as pi,vO as mi,vc as hi,vs as gi,w as _i,wD as vi,wE as yi,wO as bi,wc as xi,wi as Si,wy as Ci,x as wi,xc as Ti,xi as Ei,yE as Di,yO as Oi,yc as ki,yo as Ai,zC as ji,zE as Mi,zO as J,zb as Ni,zc as Pi,zf as Fi}from"./loadAgentsDir-BYWykYwn.js";import{$n as Ii,$t as Li,F as Ri,Gt as zi,M as Bi,Mn as Vi,Ot as Hi,Qn as Ui,Wt as Wi,kt as Gi,wn as Ki}from"./prompt-BGNhFY1n.js";import{i as qi,o as Ji}from"./xml-DOXio8vw.js";import{a as Yi,o as Xi,s as Zi}from"./fileStateCache-BhVfo23e.js";import{A as Qi,C as $i,D as ea,N as ta,O as na,P as ra,Z as ia,_ as aa,d as oa,g as sa,h as ca,m as la,u as ua,v as da,y as fa}from"./rcDebugLog-ClX1msJX.js";import{c as pa,l as ma}from"./commitAttribution-CJXF8wMs.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-BJJs8taN.js";import{t as ya}from"./pollConfig-DBNHhvHf.js";import{r as ba}from"./inboundAttachments-CFV_eqMu.js";import{i as xa,n as Sa,s as Ca}from"./mappers-BBkM1aA5.js";import{n as wa,r as Ta}from"./sessionTitle-ePQRpeV2.js";import{n as Ea,t as Da}from"./ccrClient-DXiEw9xU.js";import{n as Oa,t as ka}from"./HybridTransport-DLaxmXCR.js";import{n as Aa,t as ja}from"./SSETransport-8yaTbdSK.js";import{t as Ma}from"./pluginBlocklist-DEM_RWc2.js";import{c as Na,d as Pa,f as Fa,l as Ia,o as La,r as Ra,s as za,u as Ba}from"./channelNotification-CLPdvxGZ.js";import{t as Va}from"./onChangeAppState-BG1pF7ht.js";import{t as Ha}from"./settingsSync-DEFWnE1o.js";import{a as Ua,c as Wa,d as Ga,f as Ka,l as qa,m as Ja,o as Ya,p as Xa,r as Za,t as Qa}from"./cronJitterConfig-CnKed5Gi.js";import{i as $a,n as eo}from"./toolPool-HYKCHxDA.js";import{n as to,r as no}from"./QueryEngine-BSk8-8vB.js";import{n as ro,r as io}from"./sideQuestion-BcP9Mm-5.js";import{n as ao,r as oo}from"./context-noninteractive-BZQIUH_y.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-1aFn40GC.js";import{n as uo,t as fo}from"./refresh-CO_P3WKA.js";import{dirname as po,join as mo}from"path";import{PassThrough as ho}from"stream";import{randomUUID as Y}from"crypto";import{readFile as go,stat as _o}from"fs/promises";import{URL as vo}from"url";import{cwd as X}from"process";a(),_(),He(),Re(),Le(),Pe(),ze(),B(),F(),H(),U(),Ze(),Qe(),et(),G(),M(),we(),T(),E(),Ee(),O(),k(),lt(),j(),at(),de(),ge(),Ui(),Vi(),ht(),Pt(),nn(),di(),vr(),Cr(),ta(),ti(),ha(),yi(),lr(),na(),fi(),oa(),Hn(),gt(),Sr(),Bn(),Jr(),It(),_n(),xt(),Ha(),r(),Aa();function yo(e,t={},n,r){if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let i=new vo(e.href);return i.protocol===`wss:`?i.protocol=`https:`:i.protocol===`ws:`&&(i.protocol=`http:`),i.pathname=i.pathname.replace(/\/$/,``)+`/worker/events/stream`,new ja(i,t,n,r)}if(e.protocol===`ws:`||e.protocol===`wss:`)return i(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ka(e,t,n,r):new Oa(e,t,n,r);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Aa();var bo=class extends Ga{constructor(e,t,n){let r=new ho({encoding:`utf8`});super(r,n),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=r,this.url=new vo(e);let a={},s=ea();s?a.Authorization=`Bearer ${s}`:I(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;if(c&&(a[`x-environment-runner-version`]=c),this.transport=yo(this.url,a,u(),()=>{let e={},t=ea();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e}),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=L(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&V(e.endsWith(`
2
2
  `)?e:e+`
3
3
  `)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ge(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${R(e)}`)),Mn(1,`other`)}),Ie(async()=>this.ccrClient?.close()),fn((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),dn(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};xr((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),da((e,t)=>{this.ccrClient?.reportState(e,t)}),aa(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let l=ya().session_keepalive_interval_v2_ms;if(this.isBridge&&l>0&&(this.keepAliveTimer=setInterval(()=>{I(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{I(`[remote-io] keep_alive write failed: ${R(e)}`)})},l),this.keepAliveTimer.unref?.()),Ie(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
4
4
  `)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&V(Ka(e)+`
@@ -28,12 +28,12 @@ Shut down your team and prepare your final response for the user.`,Ro=1e4,zo=new
28
28
  `);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:V(w.result.endsWith(`
29
29
  `)?w.result:w.result+`
30
30
  `);break;case`error_during_execution`:V(`Execution error`);break;case`error_max_turns`:V(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:V(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:V(`Error: Failed to provide valid structured output after maximum retries.
31
- Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(Br(),ve())try{let{drainPendingExtraction:e}=await import(`./extractMemories-hQlhiVOD.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),Mn(0)}),Ie(async()=>{let t={};for(let e of Yn(g()))dr(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},le;v.enableAuthStatus&&(le=se.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let de=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};ar.add(de);let k=s,ge=qr(s,X(),100),_e=Yi(100),ve=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ve&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),J({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let ye=Fi().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=Dt(n),i=Dn(n),a=fe(e.value),o=pe(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:gn(n)?[...Er]:Er.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Ai(e,ue(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await wn(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await ji(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),Vt({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Fr(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(me(t)))),...we]}})),hn(j)}}De();let M={clients:[],tools:[],configs:{}},ke=e=>{let t=ri(e.toolPermissionContext,e.mcp.tools),n=xe($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Ii(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Hi(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Ne=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Pe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(me(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Ne=Ne.then(t,t),Ne}function Le(){let e=g(),t=e.mcp.clients,n=xe([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Rn(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>$r())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),F=a,L=te;async function Ve(){let{agentDefinitions:e}=await uo(_);F=await tr(X());let t=L.filter(e=>e.source===`flagSettings`);L=[...e.allAgents,...t]}async function He(){let{servers:e}=await Yt(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Pe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Bt(),tr(X()).then(e=>{F=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Oi({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await ei({commands:e});return}for(let t of e)J({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};bn(()=>{E&&Gn(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),q(`run_entry`),await De(),q(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-TyULD8KH.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=cn(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wo(r,Xn(t));)i.push(cn(t));let a=await Wr(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=ke(s);for(let e of o)pr(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&vt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=dt(),q(`before_ask`),hr();let h=r,ee=!1;try{if(await be(h.workload??v.workload,async()=>{for await(let t of to({commands:xe([...F,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?ge:Zi(ge,_e),setReadFileCache:e=>{ge=e;for(let[e,t]of _e.entries()){let n=ge.get(e);(!n||t.timestamp>n.timestamp)&&ge.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:L,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);Yn(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&dr(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await Ar({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Ar({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)J({...t,uuid:Y()})}}catch(e){throw await Ar({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)pr(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=ln();if(!t)vi(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await kt(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){vi(`aborted`,void 0,void 0,`sdk`);return}W(Fe(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}Br(),Hr(),oi()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=Yn(g()).some(e=>dr(e)&&e.type!==`in_process_teammate`),n=Xn(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[R(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Fn()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Xn(t)===void 0&&!C){We();return}if(Xn(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await Et(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await jt(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=bt(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}J({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
31
+ Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(Br(),ve())try{let{drainPendingExtraction:e}=await import(`./extractMemories-DS7XXeEo.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,T=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),Mn(0)}),Ie(async()=>{let t={};for(let e of Yn(g()))dr(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},le;v.enableAuthStatus&&(le=se.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let de=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};ar.add(de);let k=s,ge=qr(s,X(),100),_e=Yi(100),ve=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ve&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),J({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let ye=Fi().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=Dt(n),i=Dn(n),a=fe(e.value),o=pe(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:gn(n)?[...Er]:Er.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Ai(e,ue(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await wn(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await ji(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),Vt({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await Fr(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(me(t)))),...we]}})),hn(j)}}De();let M={clients:[],tools:[],configs:{}},ke=e=>{let t=ri(e.toolPermissionContext,e.mcp.tools),n=xe($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Ii(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Hi(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Ne=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Pe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(me(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Ne=Ne.then(t,t),Ne}function Le(){let e=g(),t=e.mcp.clients,n=xe([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?Rn(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>$r())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),F=a,L=te;async function Ve(){let{agentDefinitions:e}=await uo(_);F=await tr(X());let t=L.filter(e=>e.source===`flagSettings`);L=[...e.allAgents,...t]}async function He(){let{servers:e}=await Yt(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Pe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Bt(),tr(X()).then(e=>{F=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Oi({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await ei({commands:e});return}for(let t of e)J({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};bn(()=>{E&&Gn(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),q(`run_entry`),await De(),q(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-2U3UO__Q.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=cn(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wo(r,Xn(t));)i.push(cn(t));let a=await Wr(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=ke(s);for(let e of o)pr(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&vt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=dt(),q(`before_ask`),hr();let h=r,ee=!1;try{if(await be(h.workload??v.workload,async()=>{for await(let t of to({commands:xe([...F,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?ge:Zi(ge,_e),setReadFileCache:e=>{ge=e;for(let[e,t]of _e.entries()){let n=ge.get(e);(!n||t.timestamp>n.timestamp)&&ge.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:L,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);Yn(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&dr(e))?T=t:(T=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await Ar({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Ar({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)J({...t,uuid:Y()})}}catch(e){throw await Ar({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)pr(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=ln();if(!t)vi(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await kt(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};T?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){vi(`aborted`,void 0,void 0,`sdk`);return}W(Fe(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}Br(),Hr(),oi()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=Yn(g()).some(e=>dr(e)&&e.type!==`in_process_teammate`),n=Xn(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);T&&(D.enqueue(T),T=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[R(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Fn()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Xn(t)===void 0&&!C){We();return}if(Xn(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await Et(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await jt(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=bt(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}J({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
32
32
 
33
33
  `),uuid:Y()}),B();return}if(C&&!re){re=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),J({mode:`prompt`,value:Lo,uuid:Y()}),B();return}await ct(500)}}}C&&(await(async()=>{let e=g();rt(e)&&await ot(_,e);let t=g(),n=t.teamContext;return n&&Object.keys(n.teammates).length>0||st(t)})()?(J({mode:`prompt`,value:Lo,uuid:Y()}),B()):(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Pi(),Ue(),le?.(),ar.delete(de),D.done()))},V=null;if(Io.isKairosCronEnabled()){let e=e=>{C||(async()=>{let t=await mi({basePrompt:e.basePrompt,trigger:`scheduled-task`,currentDir:X(),sourceId:e.sourceId,sourceLabel:e.sourceLabel,workload:oe,shouldCreate:()=>!C});if(t){if(C){await ei({commands:[t]});return}await e.onSuccess(t)}})().catch(t=>{W(t),I(`[ScheduledTasks] failed to enqueue headless task${e.logSuffix}: ${t}`,{level:`error`})})},t=e=>{J({...e,uuid:Y()}),B()};V=Po.createCronScheduler({onFire:n=>{e({basePrompt:n,sourceId:n,sourceLabel:n,logSuffix:``,onSuccess:t})},onFireTask:n=>{if(n.agentId){e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:async e=>{await wt(e.autonomy.runId,`No teammate runtime available for scheduled task owner ${n.agentId} in headless mode.`,e.autonomy.rootDir)}});return}e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:t})},isLoading:()=>x||C,getJitterConfig:Fo?.getCronJitterConfig,isKilled:()=>!Io?.isKairosCronEnabled()}),V.start()}let H=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},U=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ze=new Set;e.setUnexpectedResponseCallback(async e=>{await is({message:e,setAppState:_,handledToolUseIds:Ze,onEnqueued:()=>{B()}})});let Qe=new Map,et=new Map,tt=new Set,at=new Map,G=null;return(async()=>{let t=!1;Ge(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&pr(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);else if(o.subtype===`end_session`){I(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)h[e]={type:`sdk`,name:e};await Yo(i.request,i.request_id,t,D,a,ye,e,!!v.enableAuthStatus,v,te,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&he(`tengu_slate_prism`,!0)&&ee(!0),t=!0,zt()&&B()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Zo(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e===`default`?ie():e;Se=t,b(t),la({model:t}),Ce(e,t),H(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?v.thinkingConfig=void 0:i.request.max_thinking_tokens===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},H(i);else if(i.request.subtype===`mcp_status`)H(i,{mcpServers:Le()});else if(i.request.subtype===`get_context_usage`)try{let e=g();H(i,{...await ao({messages:k,getAppState:g,options:{mainLoopModel:ae(),tools:ke(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt}})})}catch(e){U(i,R(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=j.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),H(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await Xo(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?H(i,t):U(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid;H(i,{cancelled:En(t=>t.uuid===e).length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=$e(i.request.path),t=Math.floor((await _o(e)).mtimeMs);if(t<=i.request.mtime){let n=await go(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
34
34
  `,`
35
- `);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Pe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=L.filter(e=>e.source===`flagSettings`);L=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([tr(X()),He(),cr()]);r.status===`fulfilled`?F=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:F.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Xt(e),argumentHint:e.argumentHint||``})),agents:L.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,R(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=kn(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await ii(t,n),r=me(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...A(n.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:Ae(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=kn(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){an(t,!0);let e=await ii(t,a),n=me(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...A(r.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:Ae(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{an(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await $t(t,a);let o=me(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:A(e.mcp.tools,e=>e.name?.startsWith(o)),commands:A(e.mcp.commands,e=>Nr(e,t)),resources:Ae(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=kn(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=yr(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(Gt(e)||tt.has(e))return;let t=await ii(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,R(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new ft,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Jn(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,R(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ce()}})},e=>U(i,R(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=kn(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Yr(e,n);let t=await ii(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),Wn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=Dt(t)?Rr(t,e.effortValue):void 0;H(i,{...Oe(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await ir(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,R(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:dt()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{Ei(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,R(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=ln();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:dt()}}:await no({tools:ke(g()),commands:F,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:ge,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:L})})).response})}catch(e){U(i,R(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:qt(N.bridgeSessionId,N.sessionIngressUrl),connect_url:Ft(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-BAEMZEcg.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;J({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:qt(r.bridgeSessionId,r.sessionIngressUrl),connect_url:Ft(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,R(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await Vr(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&pr(o.uuid,`completed`);continue}Vo(o.uuid)}J({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{Ir(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Pi(),Ue(),le?.(),ar.delete(de),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Rt(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=Ot(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Rt(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Ii(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),K(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Zr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!ai(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=Ce()?.outputStyle||`default`,p=await mr(Ue()),m=ne();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Xt(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ce()},pid:process.pid};if(N()&&je()){let e=d();ee.fast_mode_state=Te(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=se.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!zn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Ci(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Mt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await mt(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${R(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(mn())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!St()){let e=An();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${wi(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Nt(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),J({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),J({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
35
+ `);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Pe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=L.filter(e=>e.source===`flagSettings`);L=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([tr(X()),He(),cr()]);r.status===`fulfilled`?F=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:F.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Xt(e),argumentHint:e.argumentHint||``})),agents:L.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,R(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=kn(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await ii(t,n),r=me(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...A(n.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:Ae(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=kn(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){an(t,!0);let e=await ii(t,a),n=me(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...A(r.mcp.commands,e=>Nr(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:Ae(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{an(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await $t(t,a);let o=me(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:A(e.mcp.tools,e=>e.name?.startsWith(o)),commands:A(e.mcp.commands,e=>Nr(e,t)),resources:Ae(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=kn(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=yr(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(Gt(e)||tt.has(e))return;let t=await ii(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,R(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new ft,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Jn(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,R(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ce()}})},e=>U(i,R(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=kn(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Yr(e,n);let t=await ii(e,n),r=me(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Nr(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:Ae(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),Wn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=Dt(t)?Rr(t,e.effortValue):void 0;H(i,{...Oe(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await ir(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,R(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:dt()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{Ei(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,R(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=ln();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:dt()}}:await no({tools:ke(g()),commands:F,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:ge,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:L})})).response})}catch(e){U(i,R(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:qt(N.bridgeSessionId,N.sessionIngressUrl),connect_url:Ft(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-DV9KhSic.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;J({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:qt(r.bridgeSessionId,r.sessionIngressUrl),connect_url:Ft(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,R(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await Vr(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&pr(o.uuid,`completed`);continue}Vo(o.uuid)}J({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{Ir(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await Pi(),Ue(),le?.(),ar.delete(de),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Rt(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=Ot(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Rt(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>Ii(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),K(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Zr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!ai(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=Ce()?.outputStyle||`default`,p=await mr(Ue()),m=ne();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:jr(e),description:Xt(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ce()},pid:process.pid};if(N()&&je()){let e=d();ee.fast_mode_state=Te(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=se.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!zn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Ci(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Mt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await mt(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${R(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(mn())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!St()){let e=An();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${wi(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Nt(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),J({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),J({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
36
36
  `)}else process.stderr.write(e+`
37
37
  `)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{z(`tengu_continue_print`,{});let i=await $n(void 0,void 0);if(i){if(Q){let n=Q.matchSessionMode(i.mode);if(n){process.stderr.write(n+`
38
- `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Xr(),e(ui));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return n.forkSession||i.sessionId&&(te(tn(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await Tr()),co(i,t),rr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&Si(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),K(1),{messages:[]}}if(n.teleport)try{if(!rn(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(z(`tengu_teleport_print`,{}),typeof n.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:t,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-CSo3PT05.js`);await i();let a=await r(n.teleport),{branchError:o}=await e(a.branch);return{messages:t(a.log,o)}}catch(e){return W(e),K(1),{messages:[]}}if(n.resume)try{z(`tengu_resume_print`,{});let a=Do(typeof n.resume==`string`?n.resume:``);if(!a){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof n.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${n.resume}" is not a valid UUID`),es(e,n.outputFormat),K(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([pn(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&b(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await yn(a.sessionId,a.ingressUrl);let o=await $n(a.sessionId,a.jsonlFile||void 0);if(!o||o.messages.length===0)return a.isUrl||i(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(n.sessionStartHooksPromise??pt(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),K(1),{messages:[]});if(n.resumeSessionAt){let e=o.messages.findIndex(e=>e.uuid===n.resumeSessionAt);if(e<0)return es(`No message found with message.uuid of: ${n.resumeSessionAt}`,n.outputFormat),K(1),{messages:[]};o.messages=e>=0?o.messages.slice(0,e+1):[]}if(Q){let n=Q.matchSessionMode(o.mode);if(n){process.stderr.write(n+`
38
+ `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Xr(),e(ui));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return n.forkSession||i.sessionId&&(te(tn(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await Tr()),co(i,t),rr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&Si(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),K(1),{messages:[]}}if(n.teleport)try{if(!rn(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(z(`tengu_teleport_print`,{}),typeof n.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:t,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-ClxQigSQ.js`);await i();let a=await r(n.teleport),{branchError:o}=await e(a.branch);return{messages:t(a.log,o)}}catch(e){return W(e),K(1),{messages:[]}}if(n.resume)try{z(`tengu_resume_print`,{});let a=Do(typeof n.resume==`string`?n.resume:``);if(!a){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof n.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${n.resume}" is not a valid UUID`),es(e,n.outputFormat),K(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([pn(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&b(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await yn(a.sessionId,a.ingressUrl);let o=await $n(a.sessionId,a.jsonlFile||void 0);if(!o||o.messages.length===0)return a.isUrl||i(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(n.sessionStartHooksPromise??pt(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),K(1),{messages:[]});if(n.resumeSessionAt){let e=o.messages.findIndex(e=>e.uuid===n.resumeSessionAt);if(e<0)return es(`No message found with message.uuid of: ${n.resumeSessionAt}`,n.outputFormat),K(1),{messages:[]};o.messages=e>=0?o.messages.slice(0,e+1):[]}if(Q){let n=Q.matchSessionMode(o.mode);if(n){process.stderr.write(n+`
39
39
  `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Xr(),e(ui));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return!n.forkSession&&o.sessionId&&(te(tn(o.sessionId),o.fullPath?po(o.fullPath):null),r&&await Tr()),co(o,t),rr(n.forkSession?{...o,worktreeSession:void 0}:o),Q&&Si(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:o.messages,turnInterruptionState:o.turnInterruptionState,agentSetting:o.agentSetting}}catch(e){return W(e),es(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,n.outputFormat),K(1),{messages:[]}}return{messages:await(n.sessionStartHooksPromise??pt(`startup`))}}function rs(e,t){let n;return n=typeof e==`string`?e.trim()===``?Or([]):Or([P({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new bo(t.sdkUrl,n,t.replayUserMessages):new Ga(n,t.replayUserMessages)}async function is({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(I(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return I(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await Gr(t);return a?(r.add(t),I(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),J({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(I(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function as(e){return{...e,scope:`dynamic`}}async function os(e,t,n,r){let{allowed:i,blocked:a}=Lt(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await ss(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function ss(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i?!0:!on(r,as(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){W(e)}await $t(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=as(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await er(t,r);if(d.push(e),e.type===`connected`){let t=await Cn(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Fe(e);u[t]=n.message,W(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=as(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Go as runHeadless};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-KjMLauwe.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{_E as a,gE as o,vE as s,yE as c}from"./loadAgentsDir-CQF8qhne.js";import{n as l,r as u,t as d}from"./Grove-Bo74aZx-.js";async function f(e){if(!await c())return e(m),null;let[t,n]=await Promise.all([a(),o()]);if(!t.success)return e(m),null;let r=t.data,s=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await a();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:s?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),s(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Rn as t}from"./src-Di342QoJ.js";import{t as n}from"./jsx-runtime-D-D469L8.js";import{n as r,r as i}from"./analytics-DqMQntaB.js";import{_E as a,gE as o,vE as s,yE as c}from"./loadAgentsDir-BYWykYwn.js";import{n as l,r as u,t as d}from"./Grove-BrP9JNpK.js";async function f(e){if(!await c())return e(m),null;let[t,n]=await Promise.all([a(),o()]);if(!t.success)return e(m),null;let r=t.data,s=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await a();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:s?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),s(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
@@ -1 +1 @@
1
- import{a as e}from"./chunk-DR8-3Aex.js";import{Rn as t,t as n,x as r}from"./src-KjMLauwe.js";import{t as i}from"./jsx-runtime-D-D469L8.js";import{Ka as a,oo as o}from"./paths-4ZWdjPP4.js";import{F as s,U as c,z as l}from"./debug-otxXY3j-.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{$g as f,$m as p,$o as m,Eo as h,GC as g,Qg as _,Qm as v,So as y,To as b,Uo as x,WC as S,dh as C,uh as w,vu as T,yu as E}from"./loadAgentsDir-CQF8qhne.js";import{Gt as D,Kt as O}from"./prompt-CogZQuTN.js";import{r as k,t as A}from"./xml-BUaEXGXx.js";import{randomUUID as j}from"crypto";t(),n(),E(),f(),C();var M=i();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(_,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(w,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):T.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}u(),c(),S(),x(),o();function P(){return a().defaultShell??`bash`}E(),D(),k();async function F(t,n,r,i,a){let o=O()&&P()===`powershell`;d(`tengu_input_bash`,{powershell:o});let c=h({content:m({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},s=e=>{a({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},l=null;o&&(l=(p(),e(v)).PowerShellTool);let d=l??T,f=(l?await l.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await T.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s)).data;if(!f)throw Error(`No result received from shell command`);let m=f.stderr,_=await g(d,{...f,stderr:``},j()),b=typeof _.content==`string`?_.content:A(f.stdout);return{messages:[y(),c,...r,h({content:`<bash-stdout>${b}</bash-stdout><bash-stderr>${A(m)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof s?e.interrupted?{messages:[y(),c,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[y(),c,...r,h({content:`<bash-stdout>${A(e.stdout)}</bash-stdout><bash-stderr>${A(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[y(),c,...r,h({content:`<bash-stderr>Command failed: ${A(l(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{F as processBashCommand};
1
+ import{a as e}from"./chunk-DR8-3Aex.js";import{Rn as t,t as n,x as r}from"./src-Di342QoJ.js";import{t as i}from"./jsx-runtime-D-D469L8.js";import{Ka as a,oo as o}from"./paths-BZjPDxMm.js";import{F as s,U as c,z as l}from"./debug-otxXY3j-.js";import{n as u,r as d}from"./analytics-DqMQntaB.js";import{$g as f,$m as p,$o as m,Eo as h,GC as g,Qg as _,Qm as v,So as y,To as b,Uo as x,WC as S,dh as C,uh as w,vu as T,yu as E}from"./loadAgentsDir-BYWykYwn.js";import{Gt as D,Kt as O}from"./prompt-BGNhFY1n.js";import{r as k,t as A}from"./xml-DOXio8vw.js";import{randomUUID as j}from"crypto";t(),n(),E(),f(),C();var M=i();function N({input:e,progress:t,verbose:n}){return(0,M.jsxs)(r,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(_,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),t?(0,M.jsx)(w,{fullOutput:t.fullOutput,output:t.output,elapsedTimeSeconds:t.elapsedTimeSeconds,totalLines:t.totalLines,verbose:n}):T.renderToolUseProgressMessage?.([],{verbose:n,tools:[],terminalSize:void 0})]})}u(),c(),S(),x(),o();function P(){return a().defaultShell??`bash`}E(),D(),k();async function F(t,n,r,i,a){let o=O()&&P()===`powershell`;d(`tengu_input_bash`,{powershell:o});let c=h({content:m({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),u;a({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{u=e?.jsx}},s=e=>{a({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),u]}),shouldHidePromptInput:!1,showSpinner:!1})},l=null;o&&(l=(p(),e(v)).PowerShellTool);let d=l??T,f=(l?await l.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s):await T.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,s)).data;if(!f)throw Error(`No result received from shell command`);let m=f.stderr,_=await g(d,{...f,stderr:``},j()),b=typeof _.content==`string`?_.content:A(f.stdout);return{messages:[y(),c,...r,h({content:`<bash-stdout>${b}</bash-stdout><bash-stderr>${A(m)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof s?e.interrupted?{messages:[y(),c,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[y(),c,...r,h({content:`<bash-stdout>${A(e.stdout)}</bash-stdout><bash-stderr>${A(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[y(),c,...r,h({content:`<bash-stderr>Command failed: ${A(l(e))}</bash-stderr>`})],shouldQuery:!1}}finally{a(null)}}export{F as processBashCommand};