claude-code-best 2.6.8 → 2.6.10

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 (408) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-YmrkKVv2.js → AddWorkspaceDirectory-DYIf4o0g.js} +1 -1
  2. package/dist/chunks/{App-IAjCdPUn.js → App-Bw4stCcv.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CBEOrsej.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-DhsT69v7.js → ApproveApiKey-CNBKF9de.js} +1 -1
  5. package/dist/chunks/{AssistantSessionChooser-DCUVNGfn.js → AssistantSessionChooser-DU5OOPwq.js} +1 -1
  6. package/dist/chunks/{BackgroundTasksDialog-Di_gH2TW.js → BackgroundTasksDialog-ChDZ6M4c.js} +1 -1
  7. package/dist/chunks/{BypassPermissionsModeDialog-BeZqE75e.js → BypassPermissionsModeDialog-UOkwRr3W.js} +1 -1
  8. package/dist/chunks/{ClaudeInChromeOnboarding-CZHktpPE.js → ClaudeInChromeOnboarding-6UL2_PCg.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-CG26Jg7h.js +1 -0
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-Dofr1TYr.js → ClaudeMdExternalIncludesDialog-DBfmH_dG.js} +1 -1
  11. package/dist/chunks/ConsoleOAuthFlow-1aq67dJV.js +1 -0
  12. package/dist/chunks/{DesktopHandoff-C8_CDNft.js → DesktopHandoff-B-ySC5nP.js} +1 -1
  13. package/dist/chunks/{DevChannelsDialog-DkGWCFpL.js → DevChannelsDialog-DZMsKuak.js} +1 -1
  14. package/dist/chunks/{DiffDialog-93P95op8.js → DiffDialog-CeYcqIIw.js} +1 -1
  15. package/dist/chunks/{Doctor-Zd0UaR5d.js → Doctor-ByQrTdef.js} +1 -1
  16. package/dist/chunks/Doctor-DOil8Eh7.js +1 -0
  17. package/dist/chunks/{ExitFlow-4edARxmd.js → ExitFlow-gMv13EpM.js} +1 -1
  18. package/dist/chunks/Feedback-CGRlFB5g.js +2 -0
  19. package/dist/chunks/Grove-CJn8QGFo.js +1 -0
  20. package/dist/chunks/{Grove-TYf1glGP.js → Grove-CnHyPepC.js} +1 -1
  21. package/dist/chunks/{HybridTransport-BNexuwcN.js → HybridTransport-CiY6jyhx.js} +1 -1
  22. package/dist/chunks/{ITermBackend-DuomVpsD.js → ITermBackend-CG-a4QYW.js} +1 -1
  23. package/dist/chunks/{InvalidConfigDialog-Byury3Zx.js → InvalidConfigDialog-umJZVrz-.js} +1 -1
  24. package/dist/chunks/{InvalidSettingsDialog-B8_0AvWo.js → InvalidSettingsDialog-C62kuhHc.js} +1 -1
  25. package/dist/chunks/{MCPConnectionManager-xL_wQCda.js → MCPConnectionManager-BbGFGZTr.js} +1 -1
  26. package/dist/chunks/{McpParsingWarnings-C6u4RM2a.js → McpParsingWarnings-DW0d9Lsb.js} +1 -1
  27. package/dist/chunks/MessageSelector-A-814zUi.js +3 -0
  28. package/dist/chunks/{Messages-QH8_sB13.js → Messages-C4nIAGDL.js} +2 -2
  29. package/dist/chunks/{Onboarding-XWhelEBr.js → Onboarding-BRePz3fJ.js} +1 -1
  30. package/dist/chunks/{OverageCreditUpsell-BvPz1jLU.js → OverageCreditUpsell-DEZsyI6y.js} +1 -1
  31. package/dist/chunks/{PluginSettings-D1YHfrE1.js → PluginSettings-CuZtXDaS.js} +1 -1
  32. package/dist/chunks/{PromptInputFooterSuggestions-rqUoa9Ch.js → PromptInputFooterSuggestions-BrpVQJVn.js} +1 -1
  33. package/dist/chunks/{PromptInputHelpMenu-OTViHSR0.js → PromptInputHelpMenu-BlGRpX1Q.js} +1 -1
  34. package/dist/chunks/{QueryEngine-DigBggXq.js → QueryEngine-CK9YRTZo.js} +1 -1
  35. package/dist/chunks/{REPL-D2p-vgct.js → REPL-D-t0XQx2.js} +6 -6
  36. package/dist/chunks/REPL-DV96-Prr.js +1 -0
  37. package/dist/chunks/{RemoteCallout-CCIWIrd-.js → RemoteCallout-DvOZQWoG.js} +1 -1
  38. package/dist/chunks/{RemoteSessionManager-Dx81p5dH.js → RemoteSessionManager-BlIA65dM.js} +1 -1
  39. package/dist/chunks/{ResumeConversation-73r3Zh5P.js → ResumeConversation-BTccgPK8.js} +1 -1
  40. package/dist/chunks/{SSETransport-C9hd2v-w.js → SSETransport-CIvM80QS.js} +1 -1
  41. package/dist/chunks/SearchExtraToolsTool-CmyZbRut.js +1 -0
  42. package/dist/chunks/SentryErrorBoundary-B9sk4zvj.js +1 -0
  43. package/dist/chunks/{SentryErrorBoundary-z8tMb-zO.js → SentryErrorBoundary-BK2HjzVw.js} +1 -1
  44. package/dist/chunks/Settings-D3Kpcb7q.js +2 -0
  45. package/dist/chunks/{TeleportProgress-CPXN7u3Z.js → TeleportProgress-BFlMrsa_.js} +1 -1
  46. package/dist/chunks/{TeleportRepoMismatchDialog-CiyXjTxq.js → TeleportRepoMismatchDialog-BUeyIQCH.js} +1 -1
  47. package/dist/chunks/{TeleportResumeWrapper-Dao8ktHk.js → TeleportResumeWrapper-CHfeyo9J.js} +1 -1
  48. package/dist/chunks/{ThemePicker-CFYFNnPp.js → ThemePicker-a5n2EKgk.js} +1 -1
  49. package/dist/chunks/{TmuxBackend-B5DBBugq.js → TmuxBackend-Ct9v-J78.js} +1 -1
  50. package/dist/chunks/{TrustDialog-DtIXHMR_.js → TrustDialog-e1nyM-Fp.js} +1 -1
  51. package/dist/chunks/{ValidationErrorsList-BK0wOS55.js → ValidationErrorsList-BHCepjdO.js} +1 -1
  52. package/dist/chunks/WelcomeV2-BnyziLbm.js +1 -0
  53. package/dist/chunks/{WindowsTerminalBackend-DFLLlAOp.js → WindowsTerminalBackend-Dw6qjsBu.js} +1 -1
  54. package/dist/chunks/{add-dir-JoVgNFOk.js → add-dir-CjnY5yfR.js} +1 -1
  55. package/dist/chunks/{agentDisplay-B3RjWR-3.js → agentDisplay-Dfx-axK9.js} +1 -1
  56. package/dist/chunks/{agents-BUyLUAIu.js → agents-CICHEOOq.js} +1 -1
  57. package/dist/chunks/{agents-UqS5PhD2.js → agents-lM-cxA8_.js} +1 -1
  58. package/dist/chunks/{ant-Bq1wIvnP.js → ant-JgExUpwJ.js} +1 -1
  59. package/dist/chunks/{api-O4eHGLTY.js → api-CClu711S.js} +1 -1
  60. package/dist/chunks/api-DgzWK3bh.js +1 -0
  61. package/dist/chunks/asciicast-C3nf97NR.js +1 -0
  62. package/dist/chunks/{asciicast-o5Zg4dJt.js → asciicast-DIsaWcsJ.js} +1 -1
  63. package/dist/chunks/{assistant-D5Tg_1ry.js → assistant-Bih7t52W.js} +1 -1
  64. package/dist/chunks/{assistant-CMIbt3Ir.js → assistant-D1XefK1z.js} +1 -1
  65. package/dist/chunks/assistant-Ojm6Wsb6.js +1 -0
  66. package/dist/chunks/{auth-D3SKo0wT.js → auth-CU6ArDos.js} +1 -1
  67. package/dist/chunks/auth-lQWhUjLX.js +1 -0
  68. package/dist/chunks/{autoMode-BIVJlkBM.js → autoMode-DM9eDMmT.js} +1 -1
  69. package/dist/chunks/{autonomy-BYi6z9LD.js → autonomy-CZCZ9wlx.js} +1 -1
  70. package/dist/chunks/{autonomy-Mi7Fkq1J.js → autonomy-DUfXLZfq.js} +1 -1
  71. package/dist/chunks/{autonomyPanel-D_GsUMOf.js → autonomyPanel-kUZwcjfu.js} +1 -1
  72. package/dist/chunks/backgroundHousekeeping-BcLV1-Ap.js +1 -0
  73. package/dist/chunks/{backgroundHousekeeping-BG_UYxFF.js → backgroundHousekeeping-KGRk7QeA.js} +2 -2
  74. package/dist/chunks/{branch-BC-K45fw.js → branch-Ac3HXXs2.js} +1 -1
  75. package/dist/chunks/{bridge-DBteRzgS.js → bridge-Drt-UmFp.js} +2 -2
  76. package/dist/chunks/bridgeConfig-ByjfIoJz.js +1 -0
  77. package/dist/chunks/{bridgeConfig-C_GoD1k5.js → bridgeConfig-GQzZVhuF.js} +1 -1
  78. package/dist/chunks/bridgeEnabled-C7AI9y8g.js +1 -0
  79. package/dist/chunks/{bridgeEnabled-cSK8a7tN.js → bridgeEnabled-CDoXbe3S.js} +1 -1
  80. package/dist/chunks/{bridgeMain-QbfEOTqV.js → bridgeMain-B0fLyOLC.js} +6 -6
  81. package/dist/chunks/bridgeMain-DKQ1u3k_.js +1 -0
  82. package/dist/chunks/{bridgeMessaging-CqXQzew4.js → bridgeMessaging-gRm2WcIE.js} +1 -1
  83. package/dist/chunks/{bridgePointer-FvAMj3re.js → bridgePointer-B2FPGDWR.js} +1 -1
  84. package/dist/chunks/{btw-DBtPlEWc.js → btw-B2Tq2ewP.js} +1 -1
  85. package/dist/chunks/{buddy-BYwTgNnf.js → buddy-v00QHFZ6.js} +1 -1
  86. package/dist/chunks/{bypassPermissionsKillswitch-DkYLp9m0.js → bypassPermissionsKillswitch-DAr5U3Ep.js} +1 -1
  87. package/dist/chunks/{caches-DGW9ovtw.js → caches-DHUk9KMo.js} +2 -2
  88. package/dist/chunks/caches-DbE9R4Zh.js +1 -0
  89. package/dist/chunks/{ccrClient-B9pi3b8Y.js → ccrClient-1Q3C_3_r.js} +1 -1
  90. package/dist/chunks/changeDetector--9sSzU2e.js +1 -0
  91. package/dist/chunks/channelNotification-CLYOd2-R.js +1 -0
  92. package/dist/chunks/{channelNotification-n7Avue-9.js → channelNotification-d08DSK9u.js} +1 -1
  93. package/dist/chunks/{chrome-BwZPfW9Z.js → chrome-CKo0_n71.js} +1 -1
  94. package/dist/chunks/clear-Cf1D1WkR.js +1 -0
  95. package/dist/chunks/client-Bzn58Ea4.js +1 -0
  96. package/dist/chunks/{color-BsBrog6H.js → color-DqtpdhFx.js} +1 -1
  97. package/dist/chunks/commands-CJz20FMO.js +1 -0
  98. package/dist/chunks/{commitAttribution-q7SEukgl.js → commitAttribution-BJvmLsVe.js} +1 -1
  99. package/dist/chunks/commitAttribution-BgNel6QS.js +1 -0
  100. package/dist/chunks/{compact-DiY1w7pT.js → compact-DLYic2Oa.js} +1 -1
  101. package/dist/chunks/{companion-D18UNnC7.js → companion-C2CBSYiF.js} +1 -1
  102. package/dist/chunks/{config-CSHnElBp.js → config-Cht2x9n9.js} +1 -1
  103. package/dist/chunks/{config-D3QKcEKz.js → config-DnWYFpDc.js} +1 -1
  104. package/dist/chunks/{context-DnyYrN2X.js → context-CDz9HqRT.js} +1 -1
  105. package/dist/chunks/{context-noninteractive-CFlod2Eg.js → context-noninteractive-BUIf4IMX.js} +1 -1
  106. package/dist/chunks/context-noninteractive-CzuLiIeO.js +1 -0
  107. package/dist/chunks/{conversation-CRoOMglD.js → conversation-CLRfdC_V.js} +1 -1
  108. package/dist/chunks/conversation-D2iFk7Te.js +1 -0
  109. package/dist/chunks/{copy-CHGX-YpC.js → copy-BgHTb1Z0.js} +1 -1
  110. package/dist/chunks/{createSSHSession-Bf-8h3Sw.js → createSSHSession-C_mpeqPy.js} +1 -1
  111. package/dist/chunks/createSession-XhPMcSns.js +1 -0
  112. package/dist/chunks/{createSession-rRZIkjl3.js → createSession-kVJBXQlZ.js} +1 -1
  113. package/dist/chunks/{cronJitterConfig-DmBBJDTf.js → cronJitterConfig-SI7bYvJj.js} +1 -1
  114. package/dist/chunks/{crossProjectResume-BQxLBpDD.js → crossProjectResume-BMWSw62A.js} +1 -1
  115. package/dist/chunks/datadog-B5oHSyS1.js +1 -0
  116. package/dist/chunks/{datadog-Bb65d6yd.js → datadog-Bd9AgZT-.js} +1 -1
  117. package/dist/chunks/{desktop-DiCA6RUU.js → desktop-BeUj2fqu.js} +1 -1
  118. package/dist/chunks/{diff-BvLQ-t8P.js → diff-BzgXDp1o.js} +1 -1
  119. package/dist/chunks/{directoryCompletion-DP_4B1GL.js → directoryCompletion-D7EGwonO.js} +1 -1
  120. package/dist/chunks/{doctor-bmTXLycZ.js → doctor-HCOexiL5.js} +1 -1
  121. package/dist/chunks/{effort-CSTwkB2B.js → effort-BaJU_k2K.js} +1 -1
  122. package/dist/chunks/entry-BoXZIfxW.js +14 -0
  123. package/dist/chunks/envLessBridgeConfig-CnR1E53G.js +1 -0
  124. package/dist/chunks/envLessBridgeConfig-DgdkC9jO.js +1 -0
  125. package/dist/chunks/{exit-eirVuF-n.js → exit-B-9k0zjK.js} +1 -1
  126. package/dist/chunks/{export-CcJD8r8U.js → export-p85q3g8t.js} +1 -1
  127. package/dist/chunks/{exportRenderer-DtezFcml.js → exportRenderer-CUqd8PZM.js} +1 -1
  128. package/dist/chunks/extra-usage-CsJ9Z2G1.js +1 -0
  129. package/dist/chunks/{extra-usage-core-DWM0Q56J.js → extra-usage-core-B9Fy8_RP.js} +1 -1
  130. package/dist/chunks/{extra-usage-noninteractive-BvJEi4WX.js → extra-usage-noninteractive-B4vaWh0y.js} +1 -1
  131. package/dist/chunks/{extra-usage-CBcgeIcJ.js → extra-usage-pPprHqwq.js} +1 -1
  132. package/dist/chunks/{extraUsage-CWde-Mi0.js → extraUsage-CEHCMe7l.js} +1 -1
  133. package/dist/chunks/extractMemories-D34FfNYT.js +1 -0
  134. package/dist/chunks/{fast-DQyJ7c7s.js → fast-CiSIZ5FI.js} +1 -1
  135. package/dist/chunks/fast-CxPB-PBH.js +1 -0
  136. package/dist/chunks/{feedback-BzBBKT2y.js → feedback-C2QLdCfW.js} +1 -1
  137. package/dist/chunks/{firstPartyEventLogger-BOHIpp-w.js → firstPartyEventLogger-CozFbFD9.js} +1 -1
  138. package/dist/chunks/{flushGate-DeCDhkKp.js → flushGate-LXr8ynSz.js} +1 -1
  139. package/dist/chunks/{gates-CAVdjC23.js → gates-BGfvIJXl.js} +1 -1
  140. package/dist/chunks/gates-D-kXXHiv.js +1 -0
  141. package/dist/chunks/{gemini-CFrOUVS4.js → gemini-BFBrPtVM.js} +1 -1
  142. package/dist/chunks/{generateRecap-Bcp5DiiO.js → generateRecap-CLla3Ymz.js} +1 -1
  143. package/dist/chunks/{generateSessionName-DeFGkHct.js → generateSessionName-DF4I7gr2.js} +1 -1
  144. package/dist/chunks/{githubRepoPathMapping-B07Wb07_.js → githubRepoPathMapping-C_5RCW_Z.js} +1 -1
  145. package/dist/chunks/{grok-DtidcVWD.js → grok-Dih61WOo.js} +1 -1
  146. package/dist/chunks/{growthbook-gLwBDK-r.js → growthbook-C39e6Byf.js} +1 -1
  147. package/dist/chunks/{heapdump-BxQYlnPR.js → heapdump-BRj4tC1y.js} +1 -1
  148. package/dist/chunks/{help-Bi0sABuv.js → help-fH9LNwox.js} +1 -1
  149. package/dist/chunks/hooks-Cw-F-1uO.js +1 -0
  150. package/dist/chunks/{hooks-Cc_DxF9N.js → hooks-D22Uu3Vs.js} +1 -1
  151. package/dist/chunks/{hostAdapter-D9_d4gU0.js → hostAdapter-CbXytx4y.js} +1 -1
  152. package/dist/chunks/{ide-3wDIOoZF.js → ide-DM5Tw70v.js} +1 -1
  153. package/dist/chunks/{inboundAttachments-DPMETKd6.js → inboundAttachments-2QIORKsd.js} +1 -1
  154. package/dist/chunks/inboundAttachments-CZN_sUNx.js +1 -0
  155. package/dist/chunks/initReplBridge-D8sWx97P.js +1 -0
  156. package/dist/chunks/{insights-w7qM4YyA.js → insights-B6ogyLuv.js} +1 -1
  157. package/dist/chunks/{install-N2FgArWv.js → install-DimDiHha.js} +1 -1
  158. package/dist/chunks/{install-github-app-By39Zi78.js → install-github-app-CQ7vkhIX.js} +1 -1
  159. package/dist/chunks/{install-slack-app-CVwZphU-.js → install-slack-app-By9_5YS7.js} +1 -1
  160. package/dist/chunks/{instrumentation-BkLEupDC.js → instrumentation-DbKu2GCL.js} +3 -3
  161. package/dist/chunks/{job-CgBE27O7.js → job-D_DoFtev.js} +1 -1
  162. package/dist/chunks/{keybindings-DHXJzU3E.js → keybindings-DYRBv1bg.js} +1 -1
  163. package/dist/chunks/{lang-DLneRt1b.js → lang-CAMxxG9F.js} +1 -1
  164. package/dist/chunks/{language-BVAzlrRz.js → language-CoHgN7rh.js} +1 -1
  165. package/dist/chunks/language-DB1HIsF8.js +1 -0
  166. package/dist/chunks/{launchAgentsPlatform-CtfK0qPa.js → launchAgentsPlatform-9P8K66ku.js} +1 -1
  167. package/dist/chunks/{launchAutofixPr-CQBv0rQ0.js → launchAutofixPr-BbsqqUMA.js} +1 -1
  168. package/dist/chunks/{launchLocalMemory-BNE09TKr.js → launchLocalMemory-K55Yo6JM.js} +1 -1
  169. package/dist/chunks/{launchLocalVault-Dw_NJUnd.js → launchLocalVault-rrd1Q7jP.js} +1 -1
  170. package/dist/chunks/{launchMemoryStores-CRRB6Z5A.js → launchMemoryStores-DMZ8GNQj.js} +1 -1
  171. package/dist/chunks/{launchOnboarding-nMAF5iv7.js → launchOnboarding-Duz_huXl.js} +1 -1
  172. package/dist/chunks/{launchSchedule-Akq1AmK8.js → launchSchedule-7VlG_3M6.js} +1 -1
  173. package/dist/chunks/{launchSkillStore-Zwtasj13.js → launchSkillStore-CcJL8RT0.js} +1 -1
  174. package/dist/chunks/{launchTeleport-BzlIYyll.js → launchTeleport-C8h_4F_L.js} +1 -1
  175. package/dist/chunks/{launchVault-BevXlxJB.js → launchVault-Bm1EeT2x.js} +1 -1
  176. package/dist/chunks/loadAgentsDir-DsskgPWe.js +1 -0
  177. package/dist/chunks/{loadAgentsDir-DF6FgRn-.js → loadAgentsDir-HZ19tmOZ.js} +53 -53
  178. package/dist/chunks/{loadPluginHooks-DBHkyJaj.js → loadPluginHooks-DoFtrBWf.js} +1 -1
  179. package/dist/chunks/{localSearch-v4itMlCM.js → localSearch-4cz5ia5a.js} +1 -1
  180. package/dist/chunks/localSearch-CScvVw0c.js +1 -0
  181. package/dist/chunks/{login-CKodBzyZ.js → login-D6ywctRr.js} +1 -1
  182. package/dist/chunks/login-FdPNsHJs.js +1 -0
  183. package/dist/chunks/{logoV2Utils-VebeEs7Y.js → logoV2Utils-jaFn88oE.js} +1 -1
  184. package/dist/chunks/logout-CulTqT7V.js +1 -0
  185. package/dist/chunks/{magicDocs-uX5n3NKh.js → magicDocs-DHGtJq0K.js} +1 -1
  186. package/dist/chunks/{main-Cd_i0ZPo.js → main-Bv4AvaJk.js} +15 -15
  187. package/dist/chunks/{mappers-CPL2ni36.js → mappers-qcXgNBi5.js} +1 -1
  188. package/dist/chunks/{mcp-DeWOD4B4.js → mcp-BXPg0RPm.js} +1 -1
  189. package/dist/chunks/{mcp-Dhp1SaId.js → mcp-iCbCqg7w.js} +2 -2
  190. package/dist/chunks/mcp-yDWIJznG.js +2 -0
  191. package/dist/chunks/{mcpServer-CPJo2eKm.js → mcpServer-DcSto-Od.js} +1 -1
  192. package/dist/chunks/{mcpServer-CTuPkyD6.js → mcpServer-Do9XTs2J.js} +1 -1
  193. package/dist/chunks/{memory-enMuKEnU.js → memory-B0YG4r65.js} +1 -1
  194. package/dist/chunks/model-DG0v1297.js +1 -0
  195. package/dist/chunks/{model-4f3U2YMu.js → model-DwVGG0mc.js} +1 -1
  196. package/dist/chunks/{onChangeAppState-DxTGoS7j.js → onChangeAppState-CHYSALjM.js} +1 -1
  197. package/dist/chunks/{openai-CwG_KpH1.js → openai-Brj68CWD.js} +1 -1
  198. package/dist/chunks/{overageCreditGrant-CCkJVN9k.js → overageCreditGrant-D5X6-TcP.js} +1 -1
  199. package/dist/chunks/{passes-O0VEQz1a.js → passes-B1f6NHWA.js} +1 -1
  200. package/dist/chunks/{path-C4kbwvSH.js → path-B3lx7yHn.js} +1 -1
  201. package/dist/chunks/{paths-o5iA-EnQ.js → paths-D8Fx3kUi.js} +3 -3
  202. package/dist/chunks/{permissions-BtYQvivG.js → permissions-CYrv_WVH.js} +1 -1
  203. package/dist/chunks/{pipeTransport-BEfqa7Uh.js → pipeTransport-DAYnzvGK.js} +1 -1
  204. package/dist/chunks/{plan-Jw4GjVL0.js → plan-B7EPetF0.js} +1 -1
  205. package/dist/chunks/{plugin-DZq0voFR.js → plugin-BRWx-_ZS.js} +1 -1
  206. package/dist/chunks/{pluginAutoupdate-D19vNoOp.js → pluginAutoupdate-BwxAsU2F.js} +1 -1
  207. package/dist/chunks/{pluginBlocklist-DeX8I4dK.js → pluginBlocklist-BiRgxFei.js} +1 -1
  208. package/dist/chunks/{pluginCliCommands-CMgqxOaT.js → pluginCliCommands-CXANH43C.js} +1 -1
  209. package/dist/chunks/{pluginFlagging-DFLE5fkh.js → pluginFlagging-CBbUoCJ9.js} +1 -1
  210. package/dist/chunks/{pluginOperations-BTz69m3_.js → pluginOperations-B3gcFjVq.js} +1 -1
  211. package/dist/chunks/{pluginStartupCheck-CWWKwD5F.js → pluginStartupCheck-BNfv-Pf4.js} +1 -1
  212. package/dist/chunks/pluginStartupCheck-Ga_XiMnA.js +1 -0
  213. package/dist/chunks/{plugins-BPUnAc0r.js → plugins-zHTS03v8.js} +1 -1
  214. package/dist/chunks/policyLimits-Dsz-jkpD.js +1 -0
  215. package/dist/chunks/{pollConfig-DyHumJli.js → pollConfig-BWY_xmk6.js} +1 -1
  216. package/dist/chunks/{poor-CHHZIPDW.js → poor-Bcu8JaV5.js} +1 -1
  217. package/dist/chunks/poorMode-BAuBNURJ.js +1 -0
  218. package/dist/chunks/{poorMode-7N6J6YN2.js → poorMode-CDhhKGBw.js} +1 -1
  219. package/dist/chunks/{print-QCXJDmz0.js → print-DO52Fudu.js} +4 -4
  220. package/dist/chunks/{privacy-settings-DR0_P3JF.js → privacy-settings-CmHUlYoo.js} +1 -1
  221. package/dist/chunks/{processBashCommand-CkqKsBSD.js → processBashCommand-DltW2Ubs.js} +1 -1
  222. package/dist/chunks/{processSlashCommand-DIk_hLHW.js → processSlashCommand-JLJ_vF05.js} +1 -1
  223. package/dist/chunks/{prompt-DiHksuOs.js → prompt-BxoRdmaw.js} +1 -1
  224. package/dist/chunks/prompt-D3rBUscf.js +1 -0
  225. package/dist/chunks/prompt-ohTcwieE.js +1 -0
  226. package/dist/chunks/{promptEditor-B3S5E5Q7.js → promptEditor-LQu9NhbN.js} +1 -1
  227. package/dist/chunks/{protocolHandler-D1XT2l3j.js → protocolHandler-DYn2E9Yl.js} +1 -1
  228. package/dist/chunks/{rate-limit-options-DHh1ksB5.js → rate-limit-options-OQt6LUP8.js} +1 -1
  229. package/dist/chunks/{rcDebugLog-BNojB_eB.js → rcDebugLog-5XEbz_Yg.js} +1 -1
  230. package/dist/chunks/{referral-BADm5sBf.js → referral-BsAvaATn.js} +1 -1
  231. package/dist/chunks/{refresh-D48fjYJ4.js → refresh-TlNezXn4.js} +1 -1
  232. package/dist/chunks/{registerProtocol-Dzmi6VC4.js → registerProtocol-COUVHFku.js} +1 -1
  233. package/dist/chunks/{registry-CEu_N3dS.js → registry-m7JojEMY.js} +1 -1
  234. package/dist/chunks/{release-notes-Dr61jYDO.js → release-notes-BDdughgu.js} +1 -1
  235. package/dist/chunks/{releaseNotes-5SV7C5aV.js → releaseNotes-Bd3zxid3.js} +2 -2
  236. package/dist/chunks/{reload-plugins-BxuE-21F.js → reload-plugins-qUIybHNy.js} +1 -1
  237. package/dist/chunks/{remote-env-BaQjT5em.js → remote-env-GGlLNGsx.js} +1 -1
  238. package/dist/chunks/{remoteBridgeCore-B8MjcW6f.js → remoteBridgeCore-DpF5alU6.js} +1 -1
  239. package/dist/chunks/{remoteControlServer-BvoNcg9D.js → remoteControlServer-C32rxr3F.js} +1 -1
  240. package/dist/chunks/{rename-B3q0tgmd.js → rename-CCF7A5mG.js} +1 -1
  241. package/dist/chunks/{resume-BSGOqus7.js → resume-C6ereXig.js} +1 -1
  242. package/dist/chunks/{runtimeObserver-Bb6wSUMJ.js → runtimeObserver-DBdzsp_h.js} +1 -1
  243. package/dist/chunks/{runtimeObserver-BbwUiToa.js → runtimeObserver-jrNSkZU2.js} +2 -2
  244. package/dist/chunks/sandbox-adapter-CQ0imVO1.js +1 -0
  245. package/dist/chunks/{sandbox-toggle-L7YPKXba.js → sandbox-toggle-Bfti5GKF.js} +1 -1
  246. package/dist/chunks/searchExtraTools-Ntz1u-YC.js +1 -0
  247. package/dist/chunks/{sentry-DG3ru8XE.js → sentry-CZUyEC3A.js} +1 -1
  248. package/dist/chunks/{session-B5wA2K9M.js → session-DCIDa5dI.js} +1 -1
  249. package/dist/chunks/{sessionDiscovery-DijWFNjj.js → sessionDiscovery-5m_pul65.js} +1 -1
  250. package/dist/chunks/sessionFileAccessHooks-DD2a-mTZ.js +1 -0
  251. package/dist/chunks/{sessionMemory-CeWjRuFL.js → sessionMemory-BQP_RezB.js} +1 -1
  252. package/dist/chunks/sessionMemory-hbxplpxs.js +1 -0
  253. package/dist/chunks/sessionMemoryUtils-DlW9hqOH.js +1 -0
  254. package/dist/chunks/{sessionObserver-CsDT2GnB.js → sessionObserver-LBqNoak9.js} +1 -1
  255. package/dist/chunks/sessionObserver-Lb1c5FPy.js +1 -0
  256. package/dist/chunks/sessionStorage-DG68Xvsy.js +1 -0
  257. package/dist/chunks/sessionStoragePortable-DJZ_6cL8.js +3 -0
  258. package/dist/chunks/{sessionTitle-CxmvZO71.js → sessionTitle-BIykjtKk.js} +1 -1
  259. package/dist/chunks/{sessionTracing-Cy5dAplG.js → sessionTracing-Da_r0mIc.js} +1 -1
  260. package/dist/chunks/{settingsSync-54E8xV8N.js → settingsSync-BE0PQqyo.js} +1 -1
  261. package/dist/chunks/{setup-KWELOokh.js → setup-CjA5bW6e.js} +1 -1
  262. package/dist/chunks/{setup-B5CMpp0c.js → setup-lxzmZdw5.js} +2 -2
  263. package/dist/chunks/{setup-GJtdESQj.js → setup-p04XtwYu.js} +1 -1
  264. package/dist/chunks/{shadowedRuleDetection-C4NGjljb.js → shadowedRuleDetection-Zqp1M5St.js} +1 -1
  265. package/dist/chunks/{sideQuestion-DBrzdgkl.js → sideQuestion-DzJenEES.js} +1 -1
  266. package/dist/chunks/sink-BdRlnpoG.js +1 -0
  267. package/dist/chunks/{sink-BKc24wdw.js → sink-N5XR8Zgp.js} +1 -1
  268. package/dist/chunks/sinks-Bn0FK_Ab.js +1 -0
  269. package/dist/chunks/sinks-D8erzS9D.js +2 -0
  270. package/dist/chunks/{skill-learning-C5NrosiL.js → skill-learning-CbMQ8IsZ.js} +1 -1
  271. package/dist/chunks/{skillChangeDetector-NJrEtU47.js → skillChangeDetector-4XWLpjQl.js} +1 -1
  272. package/dist/chunks/{skillGapStore-uXpRqLGG.js → skillGapStore-Bp5IVfOx.js} +1 -1
  273. package/dist/chunks/{skillGapStore-D1rkePoo.js → skillGapStore-DbiDG9Pd.js} +2 -2
  274. package/dist/chunks/{skillGenerator-Deog7yBO.js → skillGenerator-Bys7U1l_.js} +2 -2
  275. package/dist/chunks/skillLearning-702-D6Lq.js +1 -0
  276. package/dist/chunks/skillLearning-Cz7qU9V6.js +1 -0
  277. package/dist/chunks/{skillPanel-Bx63GX9w.js → skillPanel-MIHU1PPp.js} +3 -3
  278. package/dist/chunks/{skillSearchPanel-CM5EZGkH.js → skillSearchPanel-MFB-PzB1.js} +2 -2
  279. package/dist/chunks/{skills-JvC7Ms0P.js → skills-D4tZYFpd.js} +1 -1
  280. package/dist/chunks/{sprites-YBiqlYch.js → sprites-B479AZSz.js} +1 -1
  281. package/dist/chunks/{stats-BJMKNvVK.js → stats-B-ErfxCJ.js} +1 -1
  282. package/dist/chunks/{status-DAJ28yxZ.js → status-DVACJLsK.js} +1 -1
  283. package/dist/chunks/{statusNoticeHelpers-B7nbsqLz.js → statusNoticeHelpers-CwSCVvxP.js} +1 -1
  284. package/dist/chunks/{tag-B4y7cBqH.js → tag-YpE2D2ve.js} +1 -1
  285. package/dist/chunks/{tasks-CSye58Ap.js → tasks-7N7iSiEx.js} +1 -1
  286. package/dist/chunks/{teamHelpers-BFZ4eVwW.js → teamHelpers-BFdTH57t.js} +1 -1
  287. package/dist/chunks/teamHelpers-CmDn2xyl.js +1 -0
  288. package/dist/chunks/{teammateModeSnapshot-DXc2vyo2.js → teammateModeSnapshot-CwacsQvD.js} +1 -1
  289. package/dist/chunks/teammateModeSnapshot-DXtG86pG.js +1 -0
  290. package/dist/chunks/{teleport-NN6zSxxe.js → teleport-CPB1CHBs.js} +1 -1
  291. package/dist/chunks/{templateJobs-DAVqqU0g.js → templateJobs-BM98KAEH.js} +1 -1
  292. package/dist/chunks/{terminalSetup-DqL65XR2.js → terminalSetup-CGiIwoIX.js} +1 -1
  293. package/dist/chunks/{terminalSetup-jZKBoPTc.js → terminalSetup-yQ0CoywX.js} +1 -1
  294. package/dist/chunks/{theme-DPv2L3ut.js → theme-C5ULGNRs.js} +1 -1
  295. package/dist/chunks/{thinkback-tcfR5Uod.js → thinkback-CF_sLFvX.js} +1 -1
  296. package/dist/chunks/thinkback-D1Fv1QYl.js +1 -0
  297. package/dist/chunks/{thinkback-play-D_uOESmO.js → thinkback-play-syg_SJm8.js} +1 -1
  298. package/dist/chunks/{toolEventObserver-CtApZXry.js → toolEventObserver-CcLqNRcT.js} +1 -1
  299. package/dist/chunks/{toolEventObserver-D6ZTtdh_.js → toolEventObserver-CuJbsUL0.js} +1 -1
  300. package/dist/chunks/toolPool-C4CO158z.js +1 -0
  301. package/dist/chunks/{toolPool-DFpa-yul.js → toolPool-CRq0GSrk.js} +1 -1
  302. package/dist/chunks/{trustedDevice-Bxn7WW5C.js → trustedDevice-C4tvgByY.js} +1 -1
  303. package/dist/chunks/{trustedDevice-DsgCQRsJ.js → trustedDevice-u2HpuTkN.js} +1 -1
  304. package/dist/chunks/{ultrareviewCommand-BfuSrdXz.js → ultrareviewCommand-CWLiiq-z.js} +1 -1
  305. package/dist/chunks/{undercover-CM8zTx5g.js → undercover-CNlN7Xzl.js} +1 -1
  306. package/dist/chunks/undercover-jZEIpxrJ.js +1 -0
  307. package/dist/chunks/{updateCCB-DTArxdyR.js → updateCCB-BWN4mOEz.js} +1 -1
  308. package/dist/chunks/{upgrade-CEd1Jxw_.js → upgrade-CE25mJEk.js} +1 -1
  309. package/dist/chunks/upgrade-C_0-l0Zo.js +1 -0
  310. package/dist/chunks/{upload-DNo3bZLc.js → upload-YpyOX2a-.js} +1 -1
  311. package/dist/chunks/{usage-X4-qec8g.js → usage-Bw-kTwHb.js} +1 -1
  312. package/dist/chunks/{usage-DEwRsc7E.js → usage-DNXwr_ep.js} +1 -1
  313. package/dist/chunks/{useMainLoopModel-2A9HV1H3.js → useMainLoopModel-DPmF_cMn.js} +1 -1
  314. package/dist/chunks/{useManagePlugins-D9MBag8O.js → useManagePlugins-hPG7UMWo.js} +1 -1
  315. package/dist/chunks/{useMergedTools-DCYrP_YE.js → useMergedTools-BSO1NflP.js} +1 -1
  316. package/dist/chunks/{useSearchInput-CepwLBvi.js → useSearchInput-CR9uhbA7.js} +1 -1
  317. package/dist/chunks/{useSettingsErrors-C8ffWXbY.js → useSettingsErrors-453j5XuO.js} +1 -1
  318. package/dist/chunks/{useVoice-vHZVaTAN.js → useVoice-B5DQ5Tay.js} +1 -1
  319. package/dist/chunks/{util-B13MVSse.js → util-D_BHu06u.js} +1 -1
  320. package/dist/chunks/utils--ZdihcLH.js +1 -0
  321. package/dist/chunks/{validatePlugin-Cf_toBOJ.js → validatePlugin-Dxm-5f8W.js} +1 -1
  322. package/dist/chunks/{vim-6p7eiRPG.js → vim-BGqKMQxl.js} +1 -1
  323. package/dist/chunks/{voice-Bvc_BxoI.js → voice-B2MWrkN3.js} +1 -1
  324. package/dist/chunks/voiceModeEnabled-0NU5pSM-.js +1 -0
  325. package/dist/chunks/{voiceModeEnabled-BPbOh6jd.js → voiceModeEnabled-if9dV1bW.js} +1 -1
  326. package/dist/chunks/{voiceStreamSTT-CzCUhap3.js → voiceStreamSTT-CWhKAxcp.js} +1 -1
  327. package/dist/chunks/voiceStreamSTT-yvcTWD7i.js +1 -0
  328. package/dist/chunks/{workerRegistry-DCtC-WN3.js → workerRegistry-BANOcuS2.js} +1 -1
  329. package/dist/chunks/worktree-CRn2SbHn.js +1 -0
  330. package/dist/chunks/{xml-CqxiCY4v.js → xml-DZp0WcWT.js} +1 -1
  331. package/dist/cli.js +1 -1
  332. package/package.json +1 -1
  333. package/dist/chunks/ApproveApiKey-CAvlRKLr.js +0 -1
  334. package/dist/chunks/ClaudeMdExternalIncludesDialog-DrkzPawC.js +0 -1
  335. package/dist/chunks/ConsoleOAuthFlow-CtqOQRDT.js +0 -1
  336. package/dist/chunks/Doctor-CheDaF3O.js +0 -1
  337. package/dist/chunks/Feedback-CZY-BikO.js +0 -2
  338. package/dist/chunks/Grove-CbcR0CsI.js +0 -1
  339. package/dist/chunks/MessageSelector-DAyH1noQ.js +0 -3
  340. package/dist/chunks/REPL-Cxh0Qnnt.js +0 -1
  341. package/dist/chunks/SearchExtraToolsTool-BNpA8JzR.js +0 -1
  342. package/dist/chunks/SentryErrorBoundary-BFwcMSIK.js +0 -1
  343. package/dist/chunks/Settings-D9qdaMe5.js +0 -2
  344. package/dist/chunks/WelcomeV2-BjUbi9vp.js +0 -1
  345. package/dist/chunks/api-kAjsowcb.js +0 -1
  346. package/dist/chunks/asciicast-aoKFhc7C.js +0 -1
  347. package/dist/chunks/assistant-nOCkNa3_.js +0 -1
  348. package/dist/chunks/auth-CDOk9J9A.js +0 -1
  349. package/dist/chunks/backgroundHousekeeping-wHy1eAso.js +0 -1
  350. package/dist/chunks/bridgeConfig-V_pmBzSH.js +0 -1
  351. package/dist/chunks/bridgeEnabled-BxtxHb8R.js +0 -1
  352. package/dist/chunks/bridgeMain-CMNptMs4.js +0 -1
  353. package/dist/chunks/caches-B-GiT9hm.js +0 -1
  354. package/dist/chunks/changeDetector-S1Jti1bW.js +0 -1
  355. package/dist/chunks/channelNotification-Bx6dpA7I.js +0 -1
  356. package/dist/chunks/clear-BXv0Sq3m.js +0 -1
  357. package/dist/chunks/client-DNQukPEE.js +0 -1
  358. package/dist/chunks/commands-BK3ugb0u.js +0 -1
  359. package/dist/chunks/commitAttribution-CtQYmnw-.js +0 -1
  360. package/dist/chunks/context-noninteractive-0YpW67KZ.js +0 -1
  361. package/dist/chunks/conversation-DCG0fiGV.js +0 -1
  362. package/dist/chunks/createSession-BYf27ahD.js +0 -1
  363. package/dist/chunks/datadog-NnzM1Mu3.js +0 -1
  364. package/dist/chunks/entry-BUwwv2dM.js +0 -14
  365. package/dist/chunks/envLessBridgeConfig-DJJKeDBT.js +0 -1
  366. package/dist/chunks/envLessBridgeConfig-Dq02Vvx1.js +0 -1
  367. package/dist/chunks/extra-usage-DhB0NElh.js +0 -1
  368. package/dist/chunks/extractMemories-wcRNh_jz.js +0 -1
  369. package/dist/chunks/fast-ukzN3wl2.js +0 -1
  370. package/dist/chunks/gates-CB_pFChT.js +0 -1
  371. package/dist/chunks/hooks-BTBhK9sh.js +0 -1
  372. package/dist/chunks/inboundAttachments-DBaPmCTv.js +0 -1
  373. package/dist/chunks/initReplBridge-BWP41EGm.js +0 -1
  374. package/dist/chunks/language-ZBygqv6V.js +0 -1
  375. package/dist/chunks/loadAgentsDir-OIIKHPq9.js +0 -1
  376. package/dist/chunks/localSearch-DslXIfeC.js +0 -1
  377. package/dist/chunks/login-CTIVwgFU.js +0 -1
  378. package/dist/chunks/logout-B3MyP8fk.js +0 -1
  379. package/dist/chunks/mcp-Ci_TbB5m.js +0 -2
  380. package/dist/chunks/model-BsHyPvD0.js +0 -1
  381. package/dist/chunks/pluginStartupCheck-Non969kz.js +0 -1
  382. package/dist/chunks/policyLimits-D6dpS-CU.js +0 -1
  383. package/dist/chunks/poorMode-DX4EXe0o.js +0 -1
  384. package/dist/chunks/prompt-2ia5b-QO.js +0 -1
  385. package/dist/chunks/prompt-CNtVpGdl.js +0 -1
  386. package/dist/chunks/sandbox-adapter-Cr6f6gjf.js +0 -1
  387. package/dist/chunks/searchExtraTools-DRVIhwVJ.js +0 -1
  388. package/dist/chunks/sessionFileAccessHooks-DnbPctQc.js +0 -1
  389. package/dist/chunks/sessionMemory-BOT9f5f0.js +0 -1
  390. package/dist/chunks/sessionMemoryUtils-B47JMJa2.js +0 -1
  391. package/dist/chunks/sessionObserver-BNZflr2e.js +0 -1
  392. package/dist/chunks/sessionStorage-BUuPrnU0.js +0 -1
  393. package/dist/chunks/sessionStoragePortable-BI9q2WcJ.js +0 -3
  394. package/dist/chunks/sink-DG0SNHP7.js +0 -1
  395. package/dist/chunks/sinks-BTS1DWM4.js +0 -2
  396. package/dist/chunks/sinks-Cbp-8X1S.js +0 -1
  397. package/dist/chunks/skillLearning-BHjRTDJw.js +0 -1
  398. package/dist/chunks/skillLearning-By7jxHSI.js +0 -1
  399. package/dist/chunks/teamHelpers-CKBoDEPj.js +0 -1
  400. package/dist/chunks/teammateModeSnapshot-BfOLEMKn.js +0 -1
  401. package/dist/chunks/thinkback-B0OSwcPG.js +0 -1
  402. package/dist/chunks/toolPool-DqemSx_r.js +0 -1
  403. package/dist/chunks/undercover-B-R6dhHB.js +0 -1
  404. package/dist/chunks/upgrade-CCrHxXrm.js +0 -1
  405. package/dist/chunks/utils-C-vk0zpl.js +0 -1
  406. package/dist/chunks/voiceModeEnabled-JSBux8GA.js +0 -1
  407. package/dist/chunks/voiceStreamSTT-D9ER6Ml3.js +0 -1
  408. package/dist/chunks/worktree-Dv0mPuy_.js +0 -1
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,As as c,Dt as l,Ot as u,Zc as d,el as f,ks as p,tt as m}from"./paths-o5iA-EnQ.js";import{M as h,V as g,d as _,h as v,k as y,p as b,s as x}from"./debug-UI3T040K.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-CzsijfHZ.js";import{n as k,t as ee}from"./sleep-8Eb9j_Ly.js";import{$D as te,$x as ne,A as re,Al as A,B_ as ie,Cl as ae,D_ as oe,Dc as se,Dw as ce,Ec as le,Ew as ue,G as de,GE as fe,G_ as j,Go as pe,HA as me,Ho as he,J_ as ge,Jf as M,K as N,KE as P,Li as F,Lo as I,MD as L,Mk as _e,Ml as ve,Nl as ye,OD as be,O_ as xe,Pk as Se,Ro as Ce,Tw as we,U_ as Te,VA as Ee,Vi as De,W_ as Oe,Wi as ke,XD as Ae,Xi as je,YD as Me,Yf as Ne,Yi as Pe,Zx as Fe,_o as Ie,bo as R,fo as z,go as B,hO as Le,jD as Re,kD as ze,k_ as Be,kc as Ve,la as V,mO as He,n_ as Ue,pk as We,qo as H,r_ as U,uk as Ge,w as Ke,wo as qe,xO as Je,xl as Ye,yo as Xe,z_ as Ze}from"./loadAgentsDir-DF6FgRn-.js";import{a as W,i as Qe,o as G}from"./xml-CqxiCY4v.js";import{E as $e,T as et,w as tt}from"./sessionTracing-Cy5dAplG.js";import{n as nt,t as rt}from"./slashCommandParsing-Cari0pNg.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{_(`Removing one-shot hook for event ${o} in skill '${r}'`),Be(e,t,o,s)}:void 0;oe(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),xe()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=Ze(),c=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...j(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await ye(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};_(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let v=!1;if(g.kairosEnabled&&(v=!0),v){let t=be(),r=V(e),i=l(),c=e=>Le({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await Me({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)He(t)},d=async e=>{o?.runId&&await Ae({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=A(l,`Command completed`);_(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:Ne(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=pe([t]);if(t.type===`assistant`){let r=Ge(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{i(null)}let E=A(y,`Command completed`);return _(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${d(Re(s))}\n${E}`),{messages:[R({content:H({inputString:`/${V(e)} ${t}`.trim(),precedingInputBlocks:r})}),R({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:F().has(f)?f:`custom`;if(!Pe(f,i.options.commands)){let n=!1;try{await b().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})}),...p?[Ie(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[R({content:H({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:v,model:y,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,j(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:y,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[B(),...g],shouldQuery:_,allowedTools:v,model:y};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,j(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&Ce(g[0]);return{messages:_||g.every(he)||k?g:[B(),...g],shouldQuery:_,allowedTools:v,model:y,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=ke(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&Oe(e),u.userInvocable===!1)return{messages:[R({content:H({inputString:`/${e}`,precedingInputBlocks:i})}),R({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>R({content:e,isMeta:!0})),s=ne()&&typeof n==`string`&&n.endsWith(` dismissed`);e({messages:r?.display===`system`?s?o:[z(J(u,t)),z(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${Ee}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=R({content:H({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=B(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[R({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return Se(),{messages:Ye(r),shouldQuery:!1,command:u}}return{messages:[e,z(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,z(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??de,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),Xe({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[R({content:H({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return qe(V(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,As as c,Dt as l,Ot as u,Zc as d,el as f,ks as p,tt as m}from"./paths-D8Fx3kUi.js";import{M as h,V as g,d as _,h as v,k as y,p as b,s as x}from"./debug-UI3T040K.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-CzsijfHZ.js";import{n as k,t as ee}from"./sleep-8Eb9j_Ly.js";import{$D as te,$x as ne,A as re,Al as A,B_ as ie,Cl as ae,D_ as oe,Dc as se,Dw as ce,Ec as le,Ew as ue,G as de,GE as fe,G_ as j,Go as pe,HA as me,Ho as he,J_ as ge,Jf as M,K as N,KE as P,Li as F,Lo as I,MD as L,Mk as _e,Ml as ve,Nl as ye,OD as be,O_ as xe,Pk as Se,Ro as Ce,Tw as we,U_ as Te,VA as Ee,Vi as De,W_ as Oe,Wi as ke,XD as Ae,Xi as je,YD as Me,Yf as Ne,Yi as Pe,Zx as Fe,_o as Ie,bo as R,fo as z,go as B,hO as Le,jD as Re,kD as ze,k_ as Be,kc as Ve,la as V,mO as He,n_ as Ue,pk as We,qo as H,r_ as U,uk as Ge,w as Ke,wo as qe,xO as Je,xl as Ye,yo as Xe,z_ as Ze}from"./loadAgentsDir-HZ19tmOZ.js";import{a as W,i as Qe,o as G}from"./xml-DZp0WcWT.js";import{E as $e,T as et,w as tt}from"./sessionTracing-Da_r0mIc.js";import{n as nt,t as rt}from"./slashCommandParsing-Cari0pNg.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{_(`Removing one-shot hook for event ${o} in skill '${r}'`),Be(e,t,o,s)}:void 0;oe(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),xe()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=Ze(),c=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...j(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await ye(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};_(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let v=!1;if(g.kairosEnabled&&(v=!0),v){let t=be(),r=V(e),i=l(),c=e=>Le({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await Me({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)He(t)},d=async e=>{o?.runId&&await Ae({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=A(l,`Command completed`);_(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:Ne(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=pe([t]);if(t.type===`assistant`){let r=Ge(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{i(null)}let E=A(y,`Command completed`);return _(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${d(Re(s))}\n${E}`),{messages:[R({content:H({inputString:`/${V(e)} ${t}`.trim(),precedingInputBlocks:r})}),R({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:F().has(f)?f:`custom`;if(!Pe(f,i.options.commands)){let n=!1;try{await b().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})}),...p?[Ie(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[R({content:H({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:v,model:y,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,j(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:y,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[B(),...g],shouldQuery:_,allowedTools:v,model:y};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,j(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&Ce(g[0]);return{messages:_||g.every(he)||k?g:[B(),...g],shouldQuery:_,allowedTools:v,model:y,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=ke(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&Oe(e),u.userInvocable===!1)return{messages:[R({content:H({inputString:`/${e}`,precedingInputBlocks:i})}),R({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>R({content:e,isMeta:!0})),s=ne()&&typeof n==`string`&&n.endsWith(` dismissed`);e({messages:r?.display===`system`?s?o:[z(J(u,t)),z(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${Ee}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=R({content:H({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=B(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[R({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return Se(),{messages:Ye(r),shouldQuery:!1,command:u}}return{messages:[e,z(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,z(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??de,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),Xe({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[R({content:H({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return qe(V(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
2
2
  `)}function dt(e,t){return[`<${w}>${e}</${w}>`,`<${E}>/${e}</${E}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
3
3
  `)}function X(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?Y(e.name,e.progressMessage):dt(e.name,t)}async function ft(e,t,n,r,i=[]){let a=De(e,n);if(!a)throw new h(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,i,a=[],c=[],l){if(n(process.env.CLAUDE_CODE_COORDINATOR_MODE)&&!i.agentId){let n=X(e,t),r=[`Skill "/${e.name}" is available for workers.`];e.description&&r.push(`Description: ${e.description}`),e.whenToUse&&r.push(`When to use: ${e.whenToUse}`);let i=e.allowedTools??[];i.length>0&&r.push(`This skill grants workers additional tool permissions: ${i.join(`, `)}`),r.push(`\nInstruct a worker to use this skill by including "Use the /${e.name} skill" in your Agent prompt. The worker has access to the Skill tool and will receive the skill's content and permissions when it invokes it.`);let a=[{type:`text`,text:r.join(`
4
4
  `)}];return{messages:[R({content:n,uuid:l}),R({content:a,isMeta:!0})],shouldQuery:!0,model:e.model,effort:e.effort,command:e}}let u=await e.getPromptForCommand(t,i),d=!ue(`hooks`)||ce(e.source);if(e.hooks&&d){let t=r();it(i.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
@@ -1,4 +1,4 @@
1
- import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{Ln as ee,wn as te}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{t as re}from"./ajv-B_OpU_Uh.js";import{St as ie,cn as ae,n as oe,ut as se,vn as ce}from"./state-sIHsFpDu.js";import{$o as c,Dr as le,Pr as ue,Qo as de,S as fe,Xo as pe,Yo as l,Zo as me,_ as he,rs as ge,v as _e}from"./paths-o5iA-EnQ.js";import{E as ve,P as ye,V as be,W as xe,d as Se,h as Ce,p as we,s as Te,w as Ee}from"./debug-UI3T040K.js";import{J as De,et as Oe,o as ke,s as Ae}from"./log-CzsijfHZ.js";import{i as je,o as Me}from"./platform-CuyedWpe.js";import{s as Ne,u as Pe}from"./types-Csi32ZXh.js";import{n as Fe,t as Ie}from"./lazySchema-2sOku3cX.js";import{i as Le,r as Re,t as ze}from"./cron-DiW7eIPP.js";import{join as u}from"path";import{readFileSync as Be}from"fs";import{randomUUID as Ve}from"crypto";import{mkdir as He,writeFile as Ue}from"fs/promises";function We(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function Ge(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function Ke(e,t){return e.find(e=>Ge(e,t))}function qe(e){return{...Ye,userFacingName:()=>e.name,...e}}var Je,Ye,Xe=e((()=>{Je=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),Ye={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),d,f=e((()=>{d=`Bash`}));function Ze(){return`A powerful search tool built on ripgrep
1
+ import{n as e,o as t,r as n}from"./chunk-DR8-3Aex.js";import{n as r,t as i}from"./memoize-DNnuA2aU.js";import{l as a,s as o,u as s}from"./envUtils-BWeoiL4Y.js";import{Ln as ee,wn as te}from"./schemas-BGAvj1T4.js";import{t as ne}from"./v4-f1i_CNUT.js";import{t as re}from"./ajv-B_OpU_Uh.js";import{St as ie,cn as ae,n as oe,ut as se,vn as ce}from"./state-sIHsFpDu.js";import{$o as c,Dr as le,Pr as ue,Qo as de,S as fe,Xo as pe,Yo as l,Zo as me,_ as he,rs as ge,v as _e}from"./paths-D8Fx3kUi.js";import{E as ve,P as ye,V as be,W as xe,d as Se,h as Ce,p as we,s as Te,w as Ee}from"./debug-UI3T040K.js";import{J as De,et as Oe,o as ke,s as Ae}from"./log-CzsijfHZ.js";import{i as je,o as Me}from"./platform-CuyedWpe.js";import{s as Ne,u as Pe}from"./types-Csi32ZXh.js";import{n as Fe,t as Ie}from"./lazySchema-2sOku3cX.js";import{i as Le,r as Re,t as ze}from"./cron-DiW7eIPP.js";import{join as u}from"path";import{readFileSync as Be}from"fs";import{randomUUID as Ve}from"crypto";import{mkdir as He,writeFile as Ue}from"fs/promises";function We(e){return e.filter(e=>e.data?.type!==`hook_progress`)}function Ge(e,t){return e.name===t||(e.aliases?.includes(t)??!1)}function Ke(e,t){return e.find(e=>Ge(e,t))}function qe(e){return{...Ye,userFacingName:()=>e.name,...e}}var Je,Ye,Xe=e((()=>{Je=()=>({mode:`default`,additionalWorkingDirectories:new Map,alwaysAllowRules:{},alwaysDenyRules:{},alwaysAskRules:{},isBypassPermissionsModeAvailable:!0}),Ye={isEnabled:()=>!0,isConcurrencySafe:e=>!1,isReadOnly:e=>!1,isDestructive:e=>!1,checkPermissions:(e,t)=>Promise.resolve({behavior:`allow`,updatedInput:e}),toAutoClassifierInput:e=>``,userFacingName:e=>``}})),d,f=e((()=>{d=`Bash`}));function Ze(){return`A powerful search tool built on ripgrep
2
2
 
3
3
  Usage:
4
4
  - ALWAYS use ${p} for search tasks. NEVER invoke \`grep\` or \`rg\` as a ${d} command. The ${p} tool has been optimized for correct permissions and access.
@@ -0,0 +1 @@
1
+ import{Jk as e,eA as t}from"./loadAgentsDir-HZ19tmOZ.js";t();export{e as clearPromptCache};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./prompt-BxoRdmaw.js";t();export{e as isDeferredTool};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{O as a,d as o,h as s,p as c,s as l,w as u}from"./debug-UI3T040K.js";import{n as d,t as f}from"./execSyncWrapper-C2XQnFVo.js";import{r as p,t as m}from"./which-DqSAIvp2.js";import{_S as h,bS as g,hS as _,ix as v,px as y,vv as b,yS as x,yv as S}from"./loadAgentsDir-DF6FgRn-.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!p(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,s=i.slice(1),c=D(n);if(c){let r=O(c,e,t),i={detached:!0,stdio:`ignore`},l;return l=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...s,...r],i),l.on(`error`,e=>o(`editor spawn failed: ${e}`,{level:`error`})),l.unref(),!0}let l=r.get(process.stdout);if(!l)return!1;let u=t&&j.test(C(a));l.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${u?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...s,...u?[`+${t}`,e]:[e]],r),i.error?(o(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{l.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),l(),m(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=c(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return f(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${y(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=h(n,x(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=c(),r=b();try{a(r,t?_(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{Lt as r,t as i}from"./src-Di342QoJ.js";import{O as a,d as o,h as s,p as c,s as l,w as u}from"./debug-UI3T040K.js";import{n as d,t as f}from"./execSyncWrapper-C2XQnFVo.js";import{r as p,t as m}from"./which-DqSAIvp2.js";import{_S as h,bS as g,hS as _,ix as v,px as y,vv as b,yS as x,yv as S}from"./loadAgentsDir-HZ19tmOZ.js";import{basename as C}from"path";import{spawn as w,spawnSync as T}from"child_process";function E(e){return!!p(e)}function D(e){let t=C(e.split(` `)[0]??``);return A.find(e=>t.includes(e))}function O(e,t,n){return n?M.has(e)?[`-g`,`${t}:${n}`]:e===`subl`?[`${t}:${n}`]:[t]:[t]}function k(e,t){let n=N();if(!n)return!1;let i=n.split(` `),a=i[0]??n,s=i.slice(1),c=D(n);if(c){let r=O(c,e,t),i={detached:!0,stdio:`ignore`},l;return l=process.platform===`win32`?w(`${n} ${r.map(e=>`"${e}"`).join(` `)}`,{...i,shell:!0}):w(a,[...s,...r],i),l.on(`error`,e=>o(`editor spawn failed: ${e}`,{level:`error`})),l.unref(),!0}let l=r.get(process.stdout);if(!l)return!1;let u=t&&j.test(C(a));l.enterAlternateScreen();try{let r={stdio:`inherit`},i;return i=process.platform===`win32`?T(`${n} ${u?`+${t} `:``}"${e}"`,{...r,shell:!0}):T(a,[...s,...u?[`+${t}`,e]:[e]],r),i.error?(o(`editor spawn failed: ${i.error}`,{level:`error`}),!1):!0}finally{l.exitAlternateScreen()}}var A,j,M,N,P=e((()=>{n(),i(),l(),m(),A=[`code`,`cursor`,`windsurf`,`codium`,`subl`,`atom`,`gedit`,`notepad++`,`notepad`],j=/\b(vi|vim|nvim|nano|emacs|pico|micro|helix|hx)\b/,M=new Set([`code`,`cursor`,`windsurf`,`codium`]),N=t(()=>process.env.VISUAL?.trim()?process.env.VISUAL.trim():process.env.EDITOR?.trim()?process.env.EDITOR.trim():process.platform===`win32`?`start /wait notepad`:[`code`,`vi`,`nano`].find(e=>E(e)))}));function F(e){return D(e)!==void 0}function I(e){let t=c(),n=r.get(process.stdout);if(!n)throw Error(`Ink instance not found - cannot pause rendering`);let i=N();if(!i)return{content:null};try{t.statSync(e)}catch{return{content:null}}let a=!F(i);a?n.enterAlternateScreen():(n.pause(),n.suspendStdin());try{return f(`${z[i]??i} "${e}"`,{stdio:`inherit`}),{content:t.readFileSync(e,{encoding:`utf-8`})}}catch(e){if(typeof e==`object`&&e&&`status`in e&&typeof e.status==`number`){let t=e.status;if(t!==0)return{content:null,error:`${y(i)} exited with code ${t}`}}return{content:null}}finally{a?n.exitAlternateScreen():(n.resumeStdin(),n.resume())}}function L(e,t,n){let r=e;for(let[e,t]of Object.entries(n))if(t.type===`text`){let n=parseInt(e,10),i=t.content,a=r.indexOf(i);if(a!==-1){let e=h(n,x(i));r=r.slice(0,a)+e+r.slice(a+i.length)}}return r}function R(e,t){let n=c(),r=b();try{a(r,t?_(e,t):e,{encoding:`utf-8`,flush:!0});let n=I(r);if(n.content===null)return n;let i=n.content;return i.endsWith(`
2
2
  `)&&!i.endsWith(`
3
3
 
4
4
  `)&&(i=i.slice(0,-1)),t&&(i=L(i,e,t)),{content:i}}finally{try{n.unlinkSync(r)}catch{}}}var z,B=e((()=>{g(),i(),P(),d(),s(),v(),u(),S(),z={code:`code -w`,subl:`subl --wait`}}));export{P as a,N as i,R as n,k as o,B as r,I as t};
@@ -1,4 +1,4 @@
1
- import{Ac as e,Sc as t}from"./paths-o5iA-EnQ.js";import{E as n,d as r,s as i,w as a}from"./debug-UI3T040K.js";import{n as o,t as s}from"./which-DqSAIvp2.js";import{r as c,t as l}from"./execFileNoThrow-CuQN1sz8.js";import{n as u,t as d}from"./githubRepoPathMapping-B07Wb07_.js";import{n as f}from"./banner-CVXH2xts.js";import{a as p,i as m,n as h}from"./registerProtocol-Dzmi6VC4.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";a(),m(),h(),e(),i(),c(),s();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=t().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let n=process.env.TERM_PROGRAM;if(n){let e=n.replace(/\.app$/i,``).toLowerCase(),t=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(t)return{name:t.name,command:t.app}}for(let e of y){let{code:t,stdout:n}=await l(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await l(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await o(e);if(t)return{name:_(e),command:t}}let t=await o(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await o(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await o(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await o(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await o(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,t){let n=await w();if(!n)return r(`No terminal emulator detected`,{level:`error`}),!1;r(`Launching in terminal: ${n.name} (${n.command})`);let i=[`--deep-link-origin`];switch(t.repo&&(i.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&i.push(`--prefill`,t.query),process.platform){case`darwin`:return E(n,e,i,t.cwd);case`linux`:return D(n,e,i,t.cwd);case`win32`:return O(n,e,i,t.cwd);default:return!1}}async function E(e,t,n,i){switch(e.command){case`iTerm`:{let{code:e}=await l(`osascript`,[`-e`,`tell application "iTerm"
1
+ import{Ac as e,Sc as t}from"./paths-D8Fx3kUi.js";import{E as n,d as r,s as i,w as a}from"./debug-UI3T040K.js";import{n as o,t as s}from"./which-DqSAIvp2.js";import{r as c,t as l}from"./execFileNoThrow-CuQN1sz8.js";import{n as u,t as d}from"./githubRepoPathMapping-C_5RCW_Z.js";import{n as f}from"./banner-CVXH2xts.js";import{a as p,i as m,n as h}from"./registerProtocol-COUVHFku.js";import{homedir as g}from"os";import{basename as _}from"path";import{spawn as v}from"child_process";a(),m(),h(),e(),i(),c(),s();var y=[{name:`iTerm2`,bundleId:`com.googlecode.iterm2`,app:`iTerm`},{name:`Ghostty`,bundleId:`com.mitchellh.ghostty`,app:`Ghostty`},{name:`Kitty`,bundleId:`net.kovidgoyal.kitty`,app:`kitty`},{name:`Alacritty`,bundleId:`org.alacritty`,app:`Alacritty`},{name:`WezTerm`,bundleId:`com.github.wez.wezterm`,app:`WezTerm`},{name:`Terminal.app`,bundleId:`com.apple.Terminal`,app:`Terminal`}],b=[`ghostty`,`kitty`,`alacritty`,`wezterm`,`gnome-terminal`,`konsole`,`xfce4-terminal`,`mate-terminal`,`tilix`,`xterm`];async function x(){let e=t().deepLinkTerminal;if(e){let t=y.find(t=>t.app===e);if(t)return{name:t.name,command:t.app}}let n=process.env.TERM_PROGRAM;if(n){let e=n.replace(/\.app$/i,``).toLowerCase(),t=y.find(t=>t.app.toLowerCase()===e||t.name.toLowerCase()===e);if(t)return{name:t.name,command:t.app}}for(let e of y){let{code:t,stdout:n}=await l(`mdfind`,[`kMDItemCFBundleIdentifier == "${e.bundleId}"`],{timeout:5e3,useCwd:!1});if(t===0&&n.trim().length>0)return{name:e.name,command:e.app}}for(let e of y){let{code:t}=await l(`ls`,[`/Applications/${e.app}.app`],{timeout:1e3,useCwd:!1});if(t===0)return{name:e.name,command:e.app}}return{name:`Terminal.app`,command:`Terminal`}}async function S(){let e=process.env.TERMINAL;if(e){let t=await o(e);if(t)return{name:_(e),command:t}}let t=await o(`x-terminal-emulator`);if(t)return{name:`x-terminal-emulator`,command:t};for(let e of b){let t=await o(e);if(t)return{name:e,command:t}}return null}async function C(){let e=await o(`wt.exe`);if(e)return{name:`Windows Terminal`,command:e};let t=await o(`pwsh.exe`);if(t)return{name:`PowerShell`,command:t};let n=await o(`powershell.exe`);return n?{name:`PowerShell`,command:n}:{name:`Command Prompt`,command:`cmd.exe`}}async function w(){switch(process.platform){case`darwin`:return x();case`linux`:return S();case`win32`:return C();default:return null}}async function T(e,t){let n=await w();if(!n)return r(`No terminal emulator detected`,{level:`error`}),!1;r(`Launching in terminal: ${n.name} (${n.command})`);let i=[`--deep-link-origin`];switch(t.repo&&(i.push(`--deep-link-repo`,t.repo),t.lastFetchMs!==void 0&&i.push(`--deep-link-last-fetch`,String(t.lastFetchMs))),t.query&&i.push(`--prefill`,t.query),process.platform){case`darwin`:return E(n,e,i,t.cwd);case`linux`:return D(n,e,i,t.cwd);case`win32`:return O(n,e,i,t.cwd);default:return!1}}async function E(e,t,n,i){switch(e.command){case`iTerm`:{let{code:e}=await l(`osascript`,[`-e`,`tell application "iTerm"
2
2
  if running then
3
3
  create window with default profile
4
4
  else
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-o5iA-EnQ.js";import{n as m,r as h}from"./analytics-DqMQntaB.js";import{Fg as g,Ig as _,Lg as v,Nx as y,Px as b,Rg as x,da as S,fa as C}from"./loadAgentsDir-DF6FgRn-.js";import{n as w,t as T}from"./extra-usage-CBcgeIcJ.js";import{n as E,t as D}from"./upgrade-CEd1Jxw_.js";function O({onDone:e,context:t}){let[n,i]=(0,A.useState)(null),a=_(),c=p(),d=o(),f=l()?.hasExtraUsageEnabled===!0,m=c===`max`&&d===`default_claude_max_20x`,g=c===`team`||c===`enterprise`,b=u(`tengu_jade_anvil_4`,!1),x=(0,A.useMemo)(()=>{let e=[];if(v.isEnabled()){let t=s(),n=g&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}!m&&!g&&C.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`});let t={label:`Stop and wait for limit to reset`,value:`cancel`};return b?[...e,t]:[t,...e]},[b,m,g,f,a.overageStatus,a.overageDisabledReason]);function S(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function w(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),D(e,t).then(e=>{e&&i(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),T(e,t).then(e=>{e&&i(e)})):n===`cancel`&&S()}return n||(0,j.jsx)(r,{title:`What do you want to do?`,onCancel:S,color:`suggestion`,children:(0,j.jsx)(y,{options:x,onChange:w,visibleOptionCount:x.length})})}async function k(e,t){return(0,j.jsx)(O,{onDone:e,context:t})}var A,j;e((()=>{A=t(n(),1),b(),i(),c(),m(),g(),f(),d(),w(),x(),S(),E(),j=a()}))();export{k as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,f as r,t as i}from"./src-Di342QoJ.js";import{t as a}from"./jsx-runtime-D-D469L8.js";import{$t as o,Da as s,S as c,Zt as l,_ as u,ka as d,on as f,tn as p}from"./paths-D8Fx3kUi.js";import{n as m,r as h}from"./analytics-DqMQntaB.js";import{Fg as g,Ig as _,Lg as v,Nx as y,Px as b,Rg as x,da as S,fa as C}from"./loadAgentsDir-HZ19tmOZ.js";import{n as w,t as T}from"./extra-usage-pPprHqwq.js";import{n as E,t as D}from"./upgrade-CE25mJEk.js";function O({onDone:e,context:t}){let[n,i]=(0,A.useState)(null),a=_(),c=p(),d=o(),f=l()?.hasExtraUsageEnabled===!0,m=c===`max`&&d===`default_claude_max_20x`,g=c===`team`||c===`enterprise`,b=u(`tengu_jade_anvil_4`,!1),x=(0,A.useMemo)(()=>{let e=[];if(v.isEnabled()){let t=s(),n=g&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}!m&&!g&&C.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`});let t={label:`Stop and wait for limit to reset`,value:`cancel`};return b?[...e,t]:[t,...e]},[b,m,g,f,a.overageStatus,a.overageDisabledReason]);function S(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function w(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),D(e,t).then(e=>{e&&i(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),T(e,t).then(e=>{e&&i(e)})):n===`cancel`&&S()}return n||(0,j.jsx)(r,{title:`What do you want to do?`,onCancel:S,color:`suggestion`,children:(0,j.jsx)(y,{options:x,onChange:w,visibleOptionCount:x.length})})}async function k(e,t){return(0,j.jsx)(O,{onDone:e,context:t})}var A,j;e((()=>{A=t(n(),1),b(),i(),c(),m(),g(),f(),d(),w(),x(),S(),E(),j=a()}))();export{k as call};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,U as a,br as o,cn as s,wt as c}from"./state-sIHsFpDu.js";import{ea as l,na as u,ra as d,ta as f}from"./paths-o5iA-EnQ.js";import{L as p,V as ee,X as m,Y as h,d as g,h as te,p as ne,s as re}from"./debug-UI3T040K.js";import{F as _,P as ie}from"./git-CN3qtTb_.js";import{join as ae}from"node:path";import{appendFileSync as oe,existsSync as se,mkdirSync as ce}from"node:fs";import{homedir as le}from"node:os";import{randomUUID as v}from"crypto";var ue=e((()=>{})),de,fe=e((()=>{de={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),pe=e((()=>{}));function me(e){return e}var he=e((()=>{})),ge=e((()=>{ue(),fe(),pe(),he()}));function _e(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function ve(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=_e(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return ye[t]??t}var ye,be=e((()=>{ye={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function xe(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Se(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function Ce(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=xe(t),r=Se();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return y[t]?y[t]:n&&b[n]?b[n]:t}var y,b,we=e((()=>{y={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},b={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function Te(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Ee(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=Te(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var De=e((()=>{})),x,Oe=e((()=>{x=`_geminiThoughtSignature`}));function S(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ke(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=Ne(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=je(t,r);e.parts.length>0&&n.push(e)}}let i=Ae(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function Ae(e){return!e||e.length===0?``:e.filter(Boolean).join(`
1
+ import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{s as n,u as r}from"./envUtils-BWeoiL4Y.js";import{Ct as i,U as a,br as o,cn as s,wt as c}from"./state-sIHsFpDu.js";import{ea as l,na as u,ra as d,ta as f}from"./paths-D8Fx3kUi.js";import{L as p,V as ee,X as m,Y as h,d as g,h as te,p as ne,s as re}from"./debug-UI3T040K.js";import{F as _,P as ie}from"./git-CN3qtTb_.js";import{join as ae}from"node:path";import{appendFileSync as oe,existsSync as se,mkdirSync as ce}from"node:fs";import{homedir as le}from"node:os";import{randomUUID as v}from"crypto";var ue=e((()=>{})),de,fe=e((()=>{de={input_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:0,output_tokens:0,server_tool_use:{web_search_requests:0,web_fetch_requests:0},service_tier:`standard`,cache_creation:{ephemeral_1h_input_tokens:0,ephemeral_5m_input_tokens:0},inference_geo:``,iterations:[],speed:`standard`}})),pe=e((()=>{}));function me(e){return e}var he=e((()=>{})),ge=e((()=>{ue(),fe(),pe(),he()}));function _e(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function ve(e){if(process.env.OPENAI_MODEL)return process.env.OPENAI_MODEL;let t=e.replace(/\[1m\]$/,``),n=_e(t);if(n){let e=`OPENAI_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return ye[t]??t}var ye,be=e((()=>{ye={"claude-sonnet-4-20250514":`gpt-4o`,"claude-sonnet-4-5-20250929":`gpt-4o`,"claude-sonnet-4-6":`gpt-4o`,"claude-opus-4-20250514":`o3`,"claude-opus-4-1-20250805":`o3`,"claude-opus-4-5-20251101":`o3`,"claude-opus-4-6":`o3`,"claude-haiku-4-5-20251001":`gpt-4o-mini`,"claude-3-5-haiku-20241022":`gpt-4o-mini`,"claude-3-7-sonnet-20250219":`gpt-4o`,"claude-3-5-sonnet-20241022":`gpt-4o`}}));function xe(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Se(){let e=process.env.GROK_MODEL_MAP;if(!e)return null;try{let t=JSON.parse(e);if(t&&typeof t==`object`&&!Array.isArray(t))return t}catch{}return null}function Ce(e){if(process.env.GROK_MODEL)return process.env.GROK_MODEL;let t=e.replace(/\[1m\]$/,``),n=xe(t),r=Se();if(r&&n&&r[n])return r[n];if(n){let e=`GROK_DEFAULT_${n.toUpperCase()}_MODEL`,t=process.env[e];if(t)return t;let r=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i}return y[t]?y[t]:n&&b[n]?b[n]:t}var y,b,we=e((()=>{y={"claude-sonnet-4-20250514":`grok-3-mini-fast`,"claude-sonnet-4-5-20250929":`grok-3-mini-fast`,"claude-sonnet-4-6":`grok-3-mini-fast`,"claude-opus-4-20250514":`grok-4.20-reasoning`,"claude-opus-4-1-20250805":`grok-4.20-reasoning`,"claude-opus-4-5-20251101":`grok-4.20-reasoning`,"claude-opus-4-6":`grok-4.20-reasoning`,"claude-haiku-4-5-20251001":`grok-3-mini-fast`,"claude-3-5-haiku-20241022":`grok-3-mini-fast`,"claude-3-7-sonnet-20250219":`grok-3-mini-fast`,"claude-3-5-sonnet-20241022":`grok-3-mini-fast`},b={opus:`grok-4.20-reasoning`,sonnet:`grok-3-mini-fast`,haiku:`grok-3-mini-fast`}}));function Te(e){return/haiku/i.test(e)?`haiku`:/opus/i.test(e)?`opus`:/sonnet/i.test(e)?`sonnet`:null}function Ee(e){if(process.env.GEMINI_MODEL)return process.env.GEMINI_MODEL;let t=e.replace(/\[1m\]$/i,``),n=Te(t);if(!n)return t;let r=`GEMINI_DEFAULT_${n.toUpperCase()}_MODEL`,i=process.env[r];if(i)return i;let a=`ANTHROPIC_DEFAULT_${n.toUpperCase()}_MODEL`,o=process.env[a];if(o)return o;throw Error(`Gemini provider requires GEMINI_MODEL or ${r} (or ${a} for backward compatibility) to be configured.`)}var De=e((()=>{})),x,Oe=e((()=>{x=`_geminiThoughtSignature`}));function S(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}function ke(e,t){let n=[],r=new Map;for(let t of e){if(t.type===`assistant`){let e=Ne(t);e.parts.length>0&&n.push(e);let i=t.message.content;if(Array.isArray(i))for(let e of i)typeof e!=`string`&&e.type===`tool_use`&&r.set(e.id,e.name);continue}if(t.type===`user`){let e=je(t,r);e.parts.length>0&&n.push(e)}}let i=Ae(t);return{contents:n,...i?{systemInstruction:{parts:[{text:i}]}}:{}}}function Ae(e){return!e||e.length===0?``:e.filter(Boolean).join(`
2
2
 
3
3
  `)}function je(e,t){let n=e.message.content;return typeof n==`string`?{role:`user`,parts:C(n)}:Array.isArray(n)?{role:`user`,parts:n.flatMap(e=>Me(e,t))}:{role:`user`,parts:[]}}function Me(e,t){if(typeof e==`string`)return C(e);if(e.type===`text`)return C(e.text);if(e.type===`tool_result`){let n=e;return[{functionResponse:{name:t.get(n.tool_use_id)??n.tool_use_id,response:Ie(n)}}]}if(e.type===`image`){let t=e.source;if(t?.type===`base64`&&typeof t.data==`string`)return[{inlineData:{mimeType:t.media_type||`image/png`,data:t.data}}];if(t?.type===`url`&&typeof t.url==`string`)return C(`[image: ${t.url}]`)}return[]}function Ne(e){let t=e.message.content;if(typeof t==`string`)return{role:`model`,parts:C(t)};if(!Array.isArray(t))return{role:`model`,parts:[]};let n=[];for(let e of t){if(typeof e==`string`){n.push(...C(e));continue}if(e.type===`text`){n.push(...C(e.text,Re(e)));continue}if(e.type===`thinking`){let t=Pe(e.thinking,e.signature);t&&n.push(t);continue}if(e.type===`tool_use`){let t=e;n.push({functionCall:{name:t.name,args:Fe(t.input)},...Re(e)&&{thoughtSignature:Re(e)}})}}return{role:`model`,parts:n}}function C(e,t){return typeof e!=`string`||e.length===0?[]:[{text:e,...t&&{thoughtSignature:t}}]}function Pe(e,t){if(!(typeof e!=`string`||e.length===0))return{text:e,thought:!0,...t&&{thoughtSignature:t}}}function Fe(e){if(typeof e==`string`){let t=S(e);return t&&typeof t==`object`&&!Array.isArray(t)?t:t===null?{}:{value:t}}return e&&typeof e==`object`&&!Array.isArray(e)?e:e===void 0?{}:{value:e}}function Ie(e){let t=Le(e.content);return t&&typeof t==`object`&&!Array.isArray(t)?e.is_error?{...t,is_error:!0}:t:{result:t,...e.is_error?{is_error:!0}:{}}}function Le(e){if(typeof e==`string`)return S(e)??e;if(Array.isArray(e)){let t=e.map(e=>typeof e==`string`?e:e&&typeof e==`object`&&`text`in e&&typeof e.text==`string`?e.text:``).filter(Boolean).join(`
4
4
  `);return S(t)??t}return e??``}function Re(e){let t=e[x];return typeof t==`string`&&t.length>0?t:void 0}var ze=e((()=>{Oe()}));function Be(e){if(typeof e==`string`)return T.has(e)?e:void 0;if(Array.isArray(e)){let t=e.filter(e=>typeof e==`string`&&T.has(e)),n=Array.from(new Set(t));return n.length===0?void 0:n.length===1?n[0]:n}}function Ve(e){if(e===null)return`null`;if(Array.isArray(e))return`array`;if(typeof e==`string`)return`string`;if(typeof e==`boolean`)return`boolean`;if(typeof e==`number`)return Number.isInteger(e)?`integer`:`number`;if(typeof e==`object`)return`object`}function He(e){let t=e.map(Ve).filter(e=>e!==void 0),n=Array.from(new Set(t));if(n.length!==0)return n.length===1?n[0]:n}function Ue(e){return e===void 0?[`null`]:Array.isArray(e)?e.includes(`null`)?e:[...e,`null`]:e===`null`?e:[e,`null`]}function We(e){if(!e||typeof e!=`object`||Array.isArray(e))return;let t=Object.entries(e).map(([e,t])=>[e,w(t)]).filter(([,e])=>Object.keys(e).length>0);if(t.length!==0)return Object.fromEntries(t)}function Ge(e){if(!Array.isArray(e))return;let t=e.map(e=>w(e)).filter(e=>Object.keys(e).length>0);return t.length>0?t:void 0}function w(e){if(!e||typeof e!=`object`||Array.isArray(e))return{};let t=e,n={},r=Be(t.type);t.const===void 0?Array.isArray(t.enum)&&t.enum.length>0&&(n.enum=t.enum,r=r??He(t.enum)):(n.enum=[t.const],r=r??Ve(t.const)),r||(t.properties&&typeof t.properties==`object`?r=`object`:(t.items!==void 0||t.prefixItems!==void 0)&&(r=`array`)),t.nullable===!0&&(r=Ue(r)),r&&(n.type=r),typeof t.title==`string`&&(n.title=t.title),typeof t.description==`string`&&(n.description=t.description),typeof t.format==`string`&&(n.format=t.format),typeof t.pattern==`string`&&(n.pattern=t.pattern),typeof t.minimum==`number`?n.minimum=t.minimum:typeof t.exclusiveMinimum==`number`&&(n.minimum=t.exclusiveMinimum),typeof t.maximum==`number`?n.maximum=t.maximum:typeof t.exclusiveMaximum==`number`&&(n.maximum=t.exclusiveMaximum),typeof t.minItems==`number`&&(n.minItems=t.minItems),typeof t.maxItems==`number`&&(n.maxItems=t.maxItems),typeof t.minLength==`number`&&(n.minLength=t.minLength),typeof t.maxLength==`number`&&(n.maxLength=t.maxLength),typeof t.minProperties==`number`&&(n.minProperties=t.minProperties),typeof t.maxProperties==`number`&&(n.maxProperties=t.maxProperties);let i=We(t.properties);if(i&&(n.properties=i,n.propertyOrdering=Object.keys(i)),Array.isArray(t.required)){let e=t.required.filter(e=>typeof e==`string`);e.length>0&&(n.required=e)}if(typeof t.additionalProperties==`boolean`)n.additionalProperties=t.additionalProperties;else{let e=w(t.additionalProperties);Object.keys(e).length>0&&(n.additionalProperties=e)}let a=w(t.items);Object.keys(a).length>0&&(n.items=a);let o=Ge(t.prefixItems);o&&(n.prefixItems=o);let s=Ge(t.anyOf??t.oneOf);return s&&(n.anyOf=s),n}function Ke(e){let t=w(e);return Object.keys(t).length>0?t:{type:`object`,properties:{}}}function qe(e){let t=e.filter(e=>{let t=e.type;return e.type===`custom`||!(`type`in e)||t!==`server`}).map(e=>{let t=e;return{name:t.name||``,description:t.description||``,parametersJsonSchema:Ke(t.input_schema??{type:`object`,properties:{}})}});return t.length>0?[{functionDeclarations:t}]:[]}function Je(e){if(!e||typeof e!=`object`)return;let t=e;switch(t.type){case`auto`:return{mode:`AUTO`};case`any`:return{mode:`ANY`};case`tool`:return{mode:`ANY`,allowedFunctionNames:typeof t.name==`string`?[t.name]:void 0};default:return}}var T,Ye=e((()=>{T=new Set([`string`,`number`,`integer`,`boolean`,`object`,`array`,`null`])}));async function*Xe(e,t){let n=`msg_${v().replace(/-/g,``).slice(0,24)}`,r=!1,i=!1,a=0,o=null,s=!1,c,l=0,u=0,d=0;for await(let i of e){let e=i.usageMetadata;e&&(l=e.promptTokenCount??l,u=(e.candidatesTokenCount??0)+(e.thoughtsTokenCount??0),d=e.cachedContentTokenCount??d),r||(r=!0,yield{type:`message_start`,message:{id:n,type:`message`,role:`assistant`,content:[],model:t,stop_reason:null,stop_sequence:null,usage:{input_tokens:l,output_tokens:0,cache_creation_input_tokens:0,cache_read_input_tokens:d}}});let f=i.candidates?.[0],p=f?.content?.parts??[];for(let e of p){if(e.functionCall){o&&(yield{type:`content_block_stop`,index:o.index},o=null),s=!0;let t=a++;yield{type:`content_block_start`,index:t,content_block:{type:`tool_use`,id:`toolu_${v().replace(/-/g,``).slice(0,24)}`,name:e.functionCall.name||``,input:{}}},e.thoughtSignature&&(yield{type:`content_block_delta`,index:t,delta:{type:`signature_delta`,signature:e.thoughtSignature}}),e.functionCall.args&&Object.keys(e.functionCall.args).length>0&&(yield{type:`content_block_delta`,index:t,delta:{type:`input_json_delta`,partial_json:JSON.stringify(e.functionCall.args)}}),yield{type:`content_block_stop`,index:t};continue}let t=Ze(e);if(t){(!o||o.type!==t)&&(o&&(yield{type:`content_block_stop`,index:o.index}),o={index:a++,type:t},yield{type:`content_block_start`,index:o.index,content_block:t===`thinking`?{type:`thinking`,thinking:``,signature:``}:{type:`text`,text:``}}),e.text&&(yield{type:`content_block_delta`,index:o.index,delta:t===`thinking`?{type:`thinking_delta`,thinking:e.text}:{type:`text_delta`,text:e.text}}),e.thoughtSignature&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}});continue}e.thoughtSignature&&o&&(yield{type:`content_block_delta`,index:o.index,delta:{type:`signature_delta`,signature:e.thoughtSignature}})}f?.finishReason&&(c=f.finishReason)}r&&(o&&(yield{type:`content_block_stop`,index:o.index}),i||(yield{type:`message_delta`,delta:{stop_reason:Qe(c,s),stop_sequence:null},usage:{input_tokens:l,output_tokens:u,cache_creation_input_tokens:0,cache_read_input_tokens:d}},yield{type:`message_stop`},i=!0))}function Ze(e){return typeof e.text==`string`?e.thought?`thinking`:`text`:null}function Qe(e,t){switch(e){case`MAX_TOKENS`:return`max_tokens`;default:return t?`tool_use`:`end_turn`}}var $e=e((()=>{}));function E(e){if(!e||typeof e!=`object`)return null;let t=e,n=0;for(;t&&n<5;){if(t instanceof Error&&`code`in t&&typeof t.code==`string`){let e=t.code,n=at.has(e);return{code:e,message:t.message,isSSLError:n}}if(t instanceof Error&&`cause`in t&&t.cause!==t)t=t.cause,n++;else break}return null}function et(e){let t=E(e);return t?.isSSLError?`SSL certificate error (${t.code}). If you are behind a corporate proxy or TLS-intercepting firewall, set NODE_EXTRA_CA_CERTS to your CA bundle path, or ask IT to allowlist *.anthropic.com. Run /doctor for details.`:null}function D(e){if(e.includes(`<!DOCTYPE html`)||e.includes(`<html`)){let t=e.match(/<title>([^<]+)<\/title>/);return t&&t[1]?t[1].trim():``}return e}function tt(e){let t=e.message;return t?D(t):``}function nt(e){return typeof e==`object`&&!!e&&`error`in e&&typeof e.error==`object`&&e.error!==null}function rt(e){if(!nt(e))return null;let t=e.error,n=t?.error?.message;if(typeof n==`string`&&n.length>0){let e=D(n);if(e.length>0)return e}let r=t?.message;if(typeof r==`string`&&r.length>0){let e=D(r);if(e.length>0)return e}return null}function it(e){let t=E(e);if(t){let{code:e,isSSLError:n}=t;if(e===`ETIMEDOUT`)return`Request timed out. Check your internet connection and proxy settings`;if(n)switch(e){case`UNABLE_TO_VERIFY_LEAF_SIGNATURE`:case`UNABLE_TO_GET_ISSUER_CERT`:case`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`:return`Unable to connect to API: SSL certificate verification failed. Check your proxy or corporate SSL certificates`;case`CERT_HAS_EXPIRED`:return`Unable to connect to API: SSL certificate has expired`;case`CERT_REVOKED`:return`Unable to connect to API: SSL certificate has been revoked`;case`DEPTH_ZERO_SELF_SIGNED_CERT`:case`SELF_SIGNED_CERT_IN_CHAIN`:return`Unable to connect to API: Self-signed certificate detected. Check your proxy or corporate SSL certificates`;case`ERR_TLS_CERT_ALTNAME_INVALID`:case`HOSTNAME_MISMATCH`:return`Unable to connect to API: SSL certificate hostname mismatch`;case`CERT_NOT_YET_VALID`:return`Unable to connect to API: SSL certificate is not yet valid`;default:return`Unable to connect to API: SSL error (${e})`}}if(e.message===`Connection error.`)return t?.code?`Unable to connect to API (${t.code})`:`Unable to connect to API. Check your internet connection`;if(!e.message)return rt(e)??`API error (status ${e.status??`unknown`})`;let n=tt(e);return n!==e.message&&n.length>0?n:e.message}var at,ot=e((()=>{at=new Set([`UNABLE_TO_VERIFY_LEAF_SIGNATURE`,`UNABLE_TO_GET_ISSUER_CERT`,`UNABLE_TO_GET_ISSUER_CERT_LOCALLY`,`CERT_SIGNATURE_FAILURE`,`CERT_NOT_YET_VALID`,`CERT_HAS_EXPIRED`,`CERT_REVOKED`,`CERT_REJECTED`,`CERT_UNTRUSTED`,`DEPTH_ZERO_SELF_SIGNED_CERT`,`SELF_SIGNED_CERT_IN_CHAIN`,`CERT_CHAIN_TOO_LONG`,`PATH_LENGTH_EXCEEDED`,`ERR_TLS_CERT_ALTNAME_INVALID`,`HOSTNAME_MISMATCH`,`ERR_TLS_HANDSHAKE_TIMEOUT`,`ERR_SSL_WRONG_VERSION_NUMBER`,`ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC`])}));function st(e,t,n){let r=[],i=ct(t);i&&r.push({role:`system`,content:i});for(let t of e)switch(t.type){case`user`:r.push(...lt(t));break;case`assistant`:r.push(...dt(t));break;default:break}return r}function ct(e){return!e||e.length===0?``:e.filter(Boolean).join(`
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./axios-DhfaybwJ.js";import{H as i,M as a,Rn as o,nt as s,t as c}from"./src-Di342QoJ.js";import{Ac as l,Pc as u,Sc as d,Zt as f,dn as p,on as m,tn as h}from"./paths-o5iA-EnQ.js";import{d as g,s as _}from"./debug-UI3T040K.js";import{l as v,u as y}from"./oauth-CdZEzMww.js";import{d as b,f as x,o as S,s as C}from"./log-CzsijfHZ.js";import{a as w,l as T,o as E}from"./api-O4eHGLTY.js";import{t as D}from"./useKeybinding-FsOnjW6T.js";var O=e((()=>{c()}));function k(e,t,n,r=!0){let{exit:o}=i(),[s,c]=(0,A.useState)({pending:!1,keyName:null}),l=(0,A.useMemo)(()=>n??o,[n,o]),u=a(e=>c({pending:e,keyName:`Ctrl-C`}),l),d=a(e=>c({pending:e,keyName:`Ctrl-D`}),l),f=(0,A.useCallback)(()=>{t?.()||u()},[u,t]),p=(0,A.useCallback)(()=>{d()},[d]);return e((0,A.useMemo)(()=>({"app:interrupt":f,"app:exit":p}),[f,p]),{context:`Global`,isActive:r}),s}var A,j=e((()=>{A=t(o(),1),c(),O()}));function M(e,t,n){return k(s,t,e,n)}var N=e((()=>{D(),j()}));async function P(e=`claude_code_guest_pass`){let{accessToken:t,orgUUID:r}=await T(),i={...w(t),"x-organization-uuid":r},a=`${v().BASE_API_URL}/api/oauth/organizations/${r}/referral/eligibility`;return(await n.get(a,{headers:i,params:{campaign:e},timeout:5e3})).data}async function F(e=`claude_code_guest_pass`){let{accessToken:t,orgUUID:r}=await T(),i={...w(t),"x-organization-uuid":r},a=`${v().BASE_API_URL}/api/oauth/organizations/${r}/referral/redemptions`;return(await n.get(a,{headers:i,params:{campaign:e},timeout:1e4})).data}function I(){return!!(f()?.organizationUuid&&p()&&h()===`max`)}function L(){if(!I())return{eligible:!1,needsRefresh:!1,hasCache:!1};let e=f()?.organizationUuid;if(!e)return{eligible:!1,needsRefresh:!1,hasCache:!1};let t=d().passesEligibilityCache?.[e];if(!t)return{eligible:!1,needsRefresh:!0,hasCache:!1};let{eligible:n,timestamp:r}=t;return{eligible:n,needsRefresh:Date.now()-r>W,hasCache:!0}}function R(e){let t=K[e.currency]??`${e.currency} `,n=e.amount_minor_units/100;return`${t}${n%1==0?n.toString():n.toFixed(2)}`}function z(){let e=f()?.organizationUuid;return e?d().passesEligibilityCache?.[e]?.referrer_reward??null:null}function B(){let e=f()?.organizationUuid;return e?d().passesEligibilityCache?.[e]?.remaining_passes??null:null}async function V(){if(G)return g(`Passes: Reusing in-flight eligibility fetch`),G;let e=f()?.organizationUuid;return e?(G=(async()=>{try{let t=await P(),n={...t,timestamp:Date.now()};return u(t=>({...t,passesEligibilityCache:{...t.passesEligibilityCache,[e]:n}})),g(`Passes eligibility cached for org ${e}: ${t.eligible}`),t}catch(e){return g(`Failed to fetch and cache passes eligibility`),C(e),null}finally{G=null}})(),G):null}async function H(){if(!I())return null;let e=f()?.organizationUuid;if(!e)return null;let t=d().passesEligibilityCache?.[e],n=Date.now();if(!t)return g(`Passes: No cache, fetching eligibility in background (command unavailable this session)`),V(),null;if(n-t.timestamp>W){g(`Passes: Cache stale, returning cached data and refreshing in background`),V();let{timestamp:e,...n}=t;return n}g(`Passes: Using fresh cached eligibility data`);let{timestamp:r,...i}=t;return i}async function U(){x()||H()}var W,G,K,q=e((()=>{r(),y(),m(),l(),_(),S(),b(),E(),W=1440*60*1e3,G=null,K={USD:`$`,EUR:`€`,GBP:`£`,BRL:`R$`,CAD:`CA$`,AUD:`A$`,NZD:`NZ$`,SGD:`S$`}}));export{z as a,U as c,O as d,H as i,N as l,F as n,B as o,R as r,q as s,L as t,M as u};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./axios-DhfaybwJ.js";import{H as i,M as a,Rn as o,nt as s,t as c}from"./src-Di342QoJ.js";import{Ac as l,Pc as u,Sc as d,Zt as f,dn as p,on as m,tn as h}from"./paths-D8Fx3kUi.js";import{d as g,s as _}from"./debug-UI3T040K.js";import{l as v,u as y}from"./oauth-CdZEzMww.js";import{d as b,f as x,o as S,s as C}from"./log-CzsijfHZ.js";import{a as w,l as T,o as E}from"./api-CClu711S.js";import{t as D}from"./useKeybinding-FsOnjW6T.js";var O=e((()=>{c()}));function k(e,t,n,r=!0){let{exit:o}=i(),[s,c]=(0,A.useState)({pending:!1,keyName:null}),l=(0,A.useMemo)(()=>n??o,[n,o]),u=a(e=>c({pending:e,keyName:`Ctrl-C`}),l),d=a(e=>c({pending:e,keyName:`Ctrl-D`}),l),f=(0,A.useCallback)(()=>{t?.()||u()},[u,t]),p=(0,A.useCallback)(()=>{d()},[d]);return e((0,A.useMemo)(()=>({"app:interrupt":f,"app:exit":p}),[f,p]),{context:`Global`,isActive:r}),s}var A,j=e((()=>{A=t(o(),1),c(),O()}));function M(e,t,n){return k(s,t,e,n)}var N=e((()=>{D(),j()}));async function P(e=`claude_code_guest_pass`){let{accessToken:t,orgUUID:r}=await T(),i={...w(t),"x-organization-uuid":r},a=`${v().BASE_API_URL}/api/oauth/organizations/${r}/referral/eligibility`;return(await n.get(a,{headers:i,params:{campaign:e},timeout:5e3})).data}async function F(e=`claude_code_guest_pass`){let{accessToken:t,orgUUID:r}=await T(),i={...w(t),"x-organization-uuid":r},a=`${v().BASE_API_URL}/api/oauth/organizations/${r}/referral/redemptions`;return(await n.get(a,{headers:i,params:{campaign:e},timeout:1e4})).data}function I(){return!!(f()?.organizationUuid&&p()&&h()===`max`)}function L(){if(!I())return{eligible:!1,needsRefresh:!1,hasCache:!1};let e=f()?.organizationUuid;if(!e)return{eligible:!1,needsRefresh:!1,hasCache:!1};let t=d().passesEligibilityCache?.[e];if(!t)return{eligible:!1,needsRefresh:!0,hasCache:!1};let{eligible:n,timestamp:r}=t;return{eligible:n,needsRefresh:Date.now()-r>W,hasCache:!0}}function R(e){let t=K[e.currency]??`${e.currency} `,n=e.amount_minor_units/100;return`${t}${n%1==0?n.toString():n.toFixed(2)}`}function z(){let e=f()?.organizationUuid;return e?d().passesEligibilityCache?.[e]?.referrer_reward??null:null}function B(){let e=f()?.organizationUuid;return e?d().passesEligibilityCache?.[e]?.remaining_passes??null:null}async function V(){if(G)return g(`Passes: Reusing in-flight eligibility fetch`),G;let e=f()?.organizationUuid;return e?(G=(async()=>{try{let t=await P(),n={...t,timestamp:Date.now()};return u(t=>({...t,passesEligibilityCache:{...t.passesEligibilityCache,[e]:n}})),g(`Passes eligibility cached for org ${e}: ${t.eligible}`),t}catch(e){return g(`Failed to fetch and cache passes eligibility`),C(e),null}finally{G=null}})(),G):null}async function H(){if(!I())return null;let e=f()?.organizationUuid;if(!e)return null;let t=d().passesEligibilityCache?.[e],n=Date.now();if(!t)return g(`Passes: No cache, fetching eligibility in background (command unavailable this session)`),V(),null;if(n-t.timestamp>W){g(`Passes: Cache stale, returning cached data and refreshing in background`),V();let{timestamp:e,...n}=t;return n}g(`Passes: Using fresh cached eligibility data`);let{timestamp:r,...i}=t;return i}async function U(){x()||H()}var W,G,K,q=e((()=>{r(),y(),m(),l(),_(),S(),b(),E(),W=1440*60*1e3,G=null,K={USD:`$`,EUR:`€`,GBP:`£`,BRL:`R$`,CAD:`CA$`,AUD:`A$`,NZD:`NZ$`,SGD:`S$`}}));export{z as a,U as c,O as d,H as i,N as l,F as n,B as o,R as r,q as s,L as t,M as u};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{L as r,V as i,d as a,s as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{Aw as l,Cc as u,Fv as d,Ip as f,Pp as p,Pv as m,Sc as h,fs as g,gh as _,i as v,kw as y,lc as b,mh as x,o as S,ps as C,uc as w,vh as T,yh as E}from"./loadAgentsDir-DF6FgRn-.js";async function D(e){a(`refreshActivePlugins: clearing all plugin caches`),b(),p();let t=await C(),[i,o]=await Promise.all([h(),v(n())]),{enabled:s,disabled:u,errors:f}=t,[m,g]=await Promise.all([Promise.all(s.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await l(e,f);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(s.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await E(e,f);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),y=m.reduce((e,t)=>e+t,0),x=g.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:s,disabled:u,commands:i,errors:O(e.plugins.errors,f),needsRefresh:!1},agentDefinitions:o,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),_();let S=!1;try{await d()}catch(e){S=!0,c(e),a(`refreshActivePlugins: loadPluginHooks failed: ${r(e)}`)}let w=s.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return a(`refreshActivePlugins: ${s.length} enabled, ${i.length} commands, ${o.allAgents.length} agents, ${w} hooks, ${y} MCP, ${x} LSP`),{enabled_count:s.length,disabled_count:u.length,command_count:i.length,agent_count:o.allAgents.length,hook_count:w,mcp_count:y,lsp_count:x,error_count:f.length+ +!!S,agentDefinitions:o,pluginCommands:i}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),x(),S(),o(),i(),s(),w(),u(),m(),T(),y(),f(),g()}));export{D as n,A as t};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{L as r,V as i,d as a,s as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{Aw as l,Cc as u,Fv as d,Ip as f,Pp as p,Pv as m,Sc as h,fs as g,gh as _,i as v,kw as y,lc as b,mh as x,o as S,ps as C,uc as w,vh as T,yh as E}from"./loadAgentsDir-HZ19tmOZ.js";async function D(e){a(`refreshActivePlugins: clearing all plugin caches`),b(),p();let t=await C(),[i,o]=await Promise.all([h(),v(n())]),{enabled:s,disabled:u,errors:f}=t,[m,g]=await Promise.all([Promise.all(s.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await l(e,f);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(s.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await E(e,f);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),y=m.reduce((e,t)=>e+t,0),x=g.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:s,disabled:u,commands:i,errors:O(e.plugins.errors,f),needsRefresh:!1},agentDefinitions:o,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),_();let S=!1;try{await d()}catch(e){S=!0,c(e),a(`refreshActivePlugins: loadPluginHooks failed: ${r(e)}`)}let w=s.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return a(`refreshActivePlugins: ${s.length} enabled, ${i.length} commands, ${o.allAgents.length} agents, ${w} hooks, ${y} MCP, ${x} LSP`),{enabled_count:s.length,disabled_count:u.length,command_count:i.length,agent_count:o.allAgents.length,hook_count:w,mcp_count:y,lsp_count:x,error_count:f.length+ +!!S,agentDefinitions:o,pluginCommands:i}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),x(),S(),o(),i(),s(),w(),u(),m(),T(),y(),f(),g()}));export{D as n,A as t};
@@ -1,4 +1,4 @@
1
- import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ka as i,S as a,_ as o,oo as s}from"./paths-o5iA-EnQ.js";import{R as c,V as l,d as u,s as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{n as m,t as h}from"./which-DqSAIvp2.js";import{r as g,t as _}from"./execFileNoThrow-CuQN1sz8.js";import{a as v,r as y,t as b}from"./xdg-CBxMmQux.js";import{n as x,t as S}from"./sanitization-CYp-9DbE.js";import*as C from"os";import*as w from"path";import{promises as T}from"fs";function E(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function D(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${O}:`,`${O}://`):null;if(!t)throw Error(`Invalid deep link: expected ${O}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&E(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>j)throw Error(`Deep link cwd exceeds ${j} characters (got ${r.length})`);if(i&&!k.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=x(a.trim()),E(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>A)throw Error(`Deep link query exceeds ${A} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}var O,k,A,j,M=e((()=>{S(),O=`claude-cli`,k=/^[\w.-]+\/[\w.-]+$/,A=5e3,j=4096})),N=t({MACOS_BUNDLE_ID:()=>W,ensureDeepLinkProtocolRegistered:()=>U,isProtocolHandlerCurrent:()=>H,registerProtocolHandler:()=>B});function P(){return w.join(y(),`applications`,K)}function F(e){return`Exec="${e}" --handle-uri %u`}function I(e){return`"${e}" --handle-uri "%1"`}async function L(e){let t=w.join(q,`Contents`);try{await T.rm(q,{recursive:!0})}catch(e){if(c(e)!==`ENOENT`)throw e}await T.mkdir(w.dirname(J),{recursive:!0});let n=`<?xml version="1.0" encoding="UTF-8"?>
1
+ import{n as e,r as t}from"./chunk-DR8-3Aex.js";import{n,s as r}from"./envUtils-BWeoiL4Y.js";import{Ka as i,S as a,_ as o,oo as s}from"./paths-D8Fx3kUi.js";import{R as c,V as l,d as u,s as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{n as m,t as h}from"./which-DqSAIvp2.js";import{r as g,t as _}from"./execFileNoThrow-CuQN1sz8.js";import{a as v,r as y,t as b}from"./xdg-CBxMmQux.js";import{n as x,t as S}from"./sanitization-CYp-9DbE.js";import*as C from"os";import*as w from"path";import{promises as T}from"fs";function E(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<=31||n===127)return!0}return!1}function D(e){let t=e.startsWith(`claude-cli://`)?e:e.startsWith(`claude-cli:`)?e.replace(`${O}:`,`${O}://`):null;if(!t)throw Error(`Invalid deep link: expected ${O}:// scheme, got "${e}"`);let n;try{n=new URL(t)}catch{throw Error(`Invalid deep link URL: "${e}"`)}if(n.hostname!==`open`)throw Error(`Unknown deep link action: "${n.hostname}"`);let r=n.searchParams.get(`cwd`)??void 0,i=n.searchParams.get(`repo`)??void 0,a=n.searchParams.get(`q`);if(r&&!r.startsWith(`/`)&&!/^[a-zA-Z]:[/\\]/.test(r))throw Error(`Invalid cwd in deep link: must be an absolute path, got "${r}"`);if(r&&E(r))throw Error(`Deep link cwd contains disallowed control characters`);if(r&&r.length>j)throw Error(`Deep link cwd exceeds ${j} characters (got ${r.length})`);if(i&&!k.test(i))throw Error(`Invalid repo in deep link: expected "owner/repo", got "${i}"`);let o;if(a&&a.trim().length>0){if(o=x(a.trim()),E(o))throw Error(`Deep link query contains disallowed control characters`);if(o.length>A)throw Error(`Deep link query exceeds ${A} characters (got ${o.length})`)}return{query:o,cwd:r,repo:i}}var O,k,A,j,M=e((()=>{S(),O=`claude-cli`,k=/^[\w.-]+\/[\w.-]+$/,A=5e3,j=4096})),N=t({MACOS_BUNDLE_ID:()=>W,ensureDeepLinkProtocolRegistered:()=>U,isProtocolHandlerCurrent:()=>H,registerProtocolHandler:()=>B});function P(){return w.join(y(),`applications`,K)}function F(e){return`Exec="${e}" --handle-uri %u`}function I(e){return`"${e}" --handle-uri "%1"`}async function L(e){let t=w.join(q,`Contents`);try{await T.rm(q,{recursive:!0})}catch(e){if(c(e)!==`ENOENT`)throw e}await T.mkdir(w.dirname(J),{recursive:!0});let n=`<?xml version="1.0" encoding="UTF-8"?>
2
2
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
3
  <plist version="1.0">
4
4
  <dict>
@@ -1 +1 @@
1
- import{Cd as e,Dd as t,Ed as n,Od as r,Sd as i,Td as a,_d as o,bd as s,gd as c,hd as l,md as u,vd as d,wd as f,xd as p,yd as m}from"./loadAgentsDir-DF6FgRn-.js";i();export{u as detectAndGetBackend,l as ensureBackendsRegistered,c as getBackendByType,o as getCachedBackend,d as getCachedDetectionResult,m as getInProcessBackend,s as getResolvedTeammateMode,p as getTeammateExecutor,e as isInProcessEnabled,f as markInProcessFallback,a as registerITermBackend,n as registerTmuxBackend,t as registerWindowsTerminalBackend,r as resetBackendDetection};
1
+ import{Cd as e,Dd as t,Ed as n,Od as r,Sd as i,Td as a,_d as o,bd as s,gd as c,hd as l,md as u,vd as d,wd as f,xd as p,yd as m}from"./loadAgentsDir-HZ19tmOZ.js";i();export{u as detectAndGetBackend,l as ensureBackendsRegistered,c as getBackendByType,o as getCachedBackend,d as getCachedDetectionResult,m as getInProcessBackend,s as getResolvedTeammateMode,p as getTeammateExecutor,e as isInProcessEnabled,f as markInProcessFallback,a as registerITermBackend,n as registerTmuxBackend,t as registerWindowsTerminalBackend,r as resetBackendDetection};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{a as t,c as n,i as r,o as i,t as a}from"./releaseNotes-5SV7C5aV.js";function o(e){return e.map(([e,t])=>`${`Version ${e}:`}\n${t.map(e=>`· ${e}`).join(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{a as t,c as n,i as r,o as i,t as a}from"./releaseNotes-Bd3zxid3.js";function o(e){return e.map(([e,t])=>`${`Version ${e}:`}\n${t.map(e=>`· ${e}`).join(`
2
2
  `)}`).join(`
3
3
 
4
4
  `)}async function s(){let e=[];try{let n=new Promise((e,t)=>{setTimeout(e=>e(Error(`Timeout`)),500,t)});await Promise.race([r(),n]),e=t(await i())}catch{}if(e.length>0)return{type:`text`,value:o(e)};let n=t(await i());return n.length>0?{type:`text`,value:o(n)}:{type:`text`,value:`See the full changelog at: ${a}`}}e((()=>{n()}))();export{s as call};
@@ -1,2 +1,2 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{t as r}from"./semver-Cq33BYay.js";import{n as i,t as a}from"./axios-DhfaybwJ.js";import{U as o,cn as s}from"./state-sIHsFpDu.js";import{Ac as c,Pc as l,Sc as u}from"./paths-o5iA-EnQ.js";import{K as d,V as f}from"./debug-UI3T040K.js";import{d as p,f as m,o as h,s as g}from"./log-CzsijfHZ.js";import{r as _,t as v}from"./semver-Tw0AFar5.js";import{dirname as y,join as b}from"path";import{mkdir as x,readFile as S,writeFile as C}from"fs/promises";function w(){return b(t(),`cache`,`changelog.md`)}async function T(){let e=u();if(!e.cachedChangelog)return;let t=w();try{await x(y(t),{recursive:!0}),await C(t,e.cachedChangelog,{encoding:`utf-8`,flag:`wx`})}catch{}l(({cachedChangelog:e,...t})=>t)}async function E(){if(o()||m())return;let e=await i.get(L);if(e.status===200){let t=e.data;if(t===R)return;let n=w();await x(y(n),{recursive:!0}),await C(n,t,{encoding:`utf-8`}),R=t;let r=Date.now();l(e=>({...e,changelogLastFetched:r}))}}async function D(){if(R!==null)return R;let e=w();try{let t=await S(e,`utf-8`);return R=t,t}catch{return R=``,``}}function O(){return R??``}function k(e){try{if(!e)return{};let t={},n=e.split(/^## /gm).slice(1);for(let e of n){let n=e.trim().split(`
2
- `);if(n.length===0)continue;let r=n[0];if(!r)continue;let i=r.split(` - `)[0]?.trim()||``;if(!i)continue;let a=n.slice(1).filter(e=>e.trim().startsWith(`- `)).map(e=>e.trim().substring(2).trim()).filter(Boolean);a.length>0&&(t[i]=a)}return t}catch(e){return g(d(e)),{}}}function A(e,t,n=O()){try{let r=k(n),i=(0,P.coerce)(e),a=t?(0,P.coerce)(t):null;if(!a||i&&v(i.version,a.version))return Object.entries(r).filter(([e])=>!a||v(e,a.version)).sort(([e],[t])=>v(e,t)?-1:1).flatMap(([e,t])=>t).filter(Boolean).slice(0,F)}catch(e){return g(d(e)),[]}return[]}function j(e=O()){try{let t=k(e);return Object.keys(t).sort((e,t)=>v(e,t)?1:-1).map(e=>{let n=t[e];if(!n||n.length===0)return null;let r=n.filter(Boolean);return r.length===0?null:[e,r]}).filter(e=>e!==null)}catch(e){return g(d(e)),[]}}async function M(e,t=`2.6.8`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=await D();(e!==t||!n)&&E().catch(e=>g(d(e)));let r=A(t,e,n);return{hasReleaseNotes:r.length>0,releaseNotes:r}}function N(e,t=`2.6.8`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=A(t,e);return{hasReleaseNotes:n.length>0,releaseNotes:n}}var P,F,I,L,R,z=e((()=>{a(),P=r(),s(),c(),n(),f(),h(),p(),_(),F=5,I=`https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md`,L=`https://raw.githubusercontent.com/anthropics/claude-code/refs/heads/main/CHANGELOG.md`,R=null}));export{j as a,z as c,E as i,T as l,M as n,D as o,N as r,O as s,I as t,k as u};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{t as r}from"./semver-Cq33BYay.js";import{n as i,t as a}from"./axios-DhfaybwJ.js";import{U as o,cn as s}from"./state-sIHsFpDu.js";import{Ac as c,Pc as l,Sc as u}from"./paths-D8Fx3kUi.js";import{K as d,V as f}from"./debug-UI3T040K.js";import{d as p,f as m,o as h,s as g}from"./log-CzsijfHZ.js";import{r as _,t as v}from"./semver-Tw0AFar5.js";import{dirname as y,join as b}from"path";import{mkdir as x,readFile as S,writeFile as C}from"fs/promises";function w(){return b(t(),`cache`,`changelog.md`)}async function T(){let e=u();if(!e.cachedChangelog)return;let t=w();try{await x(y(t),{recursive:!0}),await C(t,e.cachedChangelog,{encoding:`utf-8`,flag:`wx`})}catch{}l(({cachedChangelog:e,...t})=>t)}async function E(){if(o()||m())return;let e=await i.get(L);if(e.status===200){let t=e.data;if(t===R)return;let n=w();await x(y(n),{recursive:!0}),await C(n,t,{encoding:`utf-8`}),R=t;let r=Date.now();l(e=>({...e,changelogLastFetched:r}))}}async function D(){if(R!==null)return R;let e=w();try{let t=await S(e,`utf-8`);return R=t,t}catch{return R=``,``}}function O(){return R??``}function k(e){try{if(!e)return{};let t={},n=e.split(/^## /gm).slice(1);for(let e of n){let n=e.trim().split(`
2
+ `);if(n.length===0)continue;let r=n[0];if(!r)continue;let i=r.split(` - `)[0]?.trim()||``;if(!i)continue;let a=n.slice(1).filter(e=>e.trim().startsWith(`- `)).map(e=>e.trim().substring(2).trim()).filter(Boolean);a.length>0&&(t[i]=a)}return t}catch(e){return g(d(e)),{}}}function A(e,t,n=O()){try{let r=k(n),i=(0,P.coerce)(e),a=t?(0,P.coerce)(t):null;if(!a||i&&v(i.version,a.version))return Object.entries(r).filter(([e])=>!a||v(e,a.version)).sort(([e],[t])=>v(e,t)?-1:1).flatMap(([e,t])=>t).filter(Boolean).slice(0,F)}catch(e){return g(d(e)),[]}return[]}function j(e=O()){try{let t=k(e);return Object.keys(t).sort((e,t)=>v(e,t)?1:-1).map(e=>{let n=t[e];if(!n||n.length===0)return null;let r=n.filter(Boolean);return r.length===0?null:[e,r]}).filter(e=>e!==null)}catch(e){return g(d(e)),[]}}async function M(e,t=`2.6.10`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=await D();(e!==t||!n)&&E().catch(e=>g(d(e)));let r=A(t,e,n);return{hasReleaseNotes:r.length>0,releaseNotes:r}}function N(e,t=`2.6.10`){if(process.env.USER_TYPE===`ant`)return{hasReleaseNotes:!1,releaseNotes:[]};let n=A(t,e);return{hasReleaseNotes:n.length>0,releaseNotes:n}}var P,F,I,L,R,z=e((()=>{a(),P=r(),s(),c(),n(),f(),h(),p(),_(),F=5,I=`https://github.com/anthropics/claude-code/blob/main/CHANGELOG.md`,L=`https://raw.githubusercontent.com/anthropics/claude-code/refs/heads/main/CHANGELOG.md`,R=null}));export{j as a,z as c,E as i,T as l,M as n,D as o,N as r,O as s,I as t,k as u};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{s as t}from"./envUtils-BWeoiL4Y.js";import{cn as n}from"./state-sIHsFpDu.js";import{Po as r,jo as i}from"./paths-o5iA-EnQ.js";import{vA as a}from"./loadAgentsDir-DF6FgRn-.js";import{t as o}from"./settingsSync-54E8xV8N.js";import{n as s,t as c}from"./refresh-D48fjYJ4.js";function l(e,t){return`${e} ${r(e,t)}`}var u;e((()=>{n(),o(),t(),c(),a(),i(),u=async(e,t)=>{let n=await s(t.setAppState),r=`Reloaded: ${[l(n.enabled_count,`plugin`),l(n.command_count,`skill`),l(n.agent_count,`agent`),l(n.hook_count,`hook`),l(n.mcp_count,`plugin MCP server`),l(n.lsp_count,`plugin LSP server`)].join(` · `)}`;return n.error_count>0&&(r+=`\n${l(n.error_count,`error`)} during load. Run /doctor for details.`),{type:`text`,value:r}}}))();export{u as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{s as t}from"./envUtils-BWeoiL4Y.js";import{cn as n}from"./state-sIHsFpDu.js";import{Po as r,jo as i}from"./paths-D8Fx3kUi.js";import{vA as a}from"./loadAgentsDir-HZ19tmOZ.js";import{t as o}from"./settingsSync-BE0PQqyo.js";import{n as s,t as c}from"./refresh-TlNezXn4.js";function l(e,t){return`${e} ${r(e,t)}`}var u;e((()=>{n(),o(),t(),c(),a(),i(),u=async(e,t)=>{let n=await s(t.setAppState),r=`Reloaded: ${[l(n.enabled_count,`plugin`),l(n.command_count,`skill`),l(n.agent_count,`agent`),l(n.hook_count,`hook`),l(n.mcp_count,`plugin MCP server`),l(n.lsp_count,`plugin LSP server`)].join(` · `)}`;return n.error_count>0&&(r+=`\n${l(n.error_count,`error`)} during load. Run /doctor for details.`),{type:`text`,value:r}}}))();export{u as call};
@@ -1 +1 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{In as i,Ln as a,Rn as o,b as s,f as c,g as l,h as u,l as d,t as f,tt as p}from"./src-Di342QoJ.js";import{t as m}from"./jsx-runtime-D-D469L8.js";import{Qa as h,Ys as g,ec as _,lo as v,nc as y,no as b,oo as x}from"./paths-o5iA-EnQ.js";import{K as S,V as C}from"./debug-UI3T040K.js";import{o as w,s as T}from"./log-CzsijfHZ.js";import{Nx as E,Px as D,aE as O,eC as k,oE as A,tC as j}from"./loadAgentsDir-DF6FgRn-.js";import{t as M}from"./useKeybinding-FsOnjW6T.js";async function N(){let e=await O();if(e.length===0)return{availableEnvironments:[],selectedEnvironment:null,selectedEnvironmentSource:null};let t=b()?.remote?.defaultEnvironmentId,n=e.find(e=>e.kind!==`bridge`)??e[0],r=null;if(t){let i=e.find(e=>e.environment_id===t);if(i){n=i;for(let e=g.length-1;e>=0;e--){let n=g[e];if(!(!n||n===`flagSettings`)&&h(n)?.remote?.defaultEnvironmentId===t){r=n;break}}}}return{availableEnvironments:e,selectedEnvironment:n,selectedEnvironmentSource:r}}var P=e((()=>{y(),x(),A()}));function F({onDone:e}){let[t,n]=(0,z.useState)(`loading`),[r,a]=(0,z.useState)([]),[o,l]=(0,z.useState)(null),[u,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;async function t(){try{let t=await N();if(e)return;a(t.availableEnvironments),l(t.selectedEnvironment),f(t.selectedEnvironmentSource),n(null)}catch(t){if(e)return;let r=S(t);T(r),m(r.message),n(null)}}return t(),()=>{e=!0}},[]);function h(t){if(t===`cancel`){e();return}n(`updating`);let a=r.find(e=>e.environment_id===t);if(!a){e(`Error: Selected environment not found`);return}v(`localSettings`,{remote:{defaultEnvironmentId:a.environment_id}}),e(`Set default remote environment to ${i.bold(a.name)} (${a.environment_id})`)}return t===`loading`?(0,B.jsx)(c,{title:V,onCancel:e,hideInputGuide:!0,children:(0,B.jsx)(d,{message:`Loading environments…`})}):p?(0,B.jsx)(c,{title:V,onCancel:e,children:(0,B.jsxs)(s,{color:`error`,children:[`Error: `,p]})}):o?r.length===1?(0,B.jsx)(L,{environment:o,onDone:e}):(0,B.jsx)(R,{environments:r,selectedEnvironment:o,selectedEnvironmentSource:u,loadingState:t,onSelect:h,onCancel:e}):(0,B.jsx)(c,{title:V,subtitle:H,onCancel:e,children:(0,B.jsx)(s,{children:`No remote environments available.`})})}function I({environment:e}){return(0,B.jsxs)(s,{children:[r.tick,` Using `,(0,B.jsx)(s,{bold:!0,children:e.name}),` `,(0,B.jsxs)(s,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]})}function L({environment:e,onDone:t}){return p(`confirm:yes`,t,{context:`Confirmation`}),(0,B.jsx)(c,{title:V,subtitle:H,onCancel:t,children:(0,B.jsx)(I,{environment:e})})}function R({environments:e,selectedEnvironment:t,selectedEnvironmentSource:n,loadingState:r,onSelect:i,onCancel:a}){let o=n&&n!==`localSettings`?` (from ${_(n)} settings)`:``;return(0,B.jsxs)(c,{title:V,subtitle:(0,B.jsxs)(s,{children:[`Currently using: `,(0,B.jsx)(s,{bold:!0,children:t.name}),o]}),onCancel:a,hideInputGuide:!0,children:[(0,B.jsx)(s,{dimColor:!0,children:H}),r===`updating`?(0,B.jsx)(d,{message:`Updating…`}):(0,B.jsx)(E,{options:e.map(e=>({label:(0,B.jsxs)(s,{children:[e.name,` `,(0,B.jsxs)(s,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]}),value:e.environment_id})),defaultValue:t.environment_id,onChange:i,onCancel:()=>i(`cancel`),layout:`compact-vertical`}),(0,B.jsx)(s,{dimColor:!0,children:(0,B.jsxs)(u,{children:[(0,B.jsx)(l,{shortcut:`Enter`,action:`select`}),(0,B.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})}var z,B,V,H,U=e((()=>{a(),n(),o(),z=t(o(),1),f(),M(),C(),w(),y(),x(),P(),j(),D(),B=m(),V=`Select Remote Environment`,H=`Configure environments at: https://claude.ai/code`}));async function W(e){return(0,G.jsx)(F,{onDone:e})}var G;e((()=>{o(),U(),G=m()}))();export{W as call};
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{n,t as r}from"./figures-gfT9mM8P.js";import{In as i,Ln as a,Rn as o,b as s,f as c,g as l,h as u,l as d,t as f,tt as p}from"./src-Di342QoJ.js";import{t as m}from"./jsx-runtime-D-D469L8.js";import{Qa as h,Ys as g,ec as _,lo as v,nc as y,no as b,oo as x}from"./paths-D8Fx3kUi.js";import{K as S,V as C}from"./debug-UI3T040K.js";import{o as w,s as T}from"./log-CzsijfHZ.js";import{Nx as E,Px as D,aE as O,eC as k,oE as A,tC as j}from"./loadAgentsDir-HZ19tmOZ.js";import{t as M}from"./useKeybinding-FsOnjW6T.js";async function N(){let e=await O();if(e.length===0)return{availableEnvironments:[],selectedEnvironment:null,selectedEnvironmentSource:null};let t=b()?.remote?.defaultEnvironmentId,n=e.find(e=>e.kind!==`bridge`)??e[0],r=null;if(t){let i=e.find(e=>e.environment_id===t);if(i){n=i;for(let e=g.length-1;e>=0;e--){let n=g[e];if(!(!n||n===`flagSettings`)&&h(n)?.remote?.defaultEnvironmentId===t){r=n;break}}}}return{availableEnvironments:e,selectedEnvironment:n,selectedEnvironmentSource:r}}var P=e((()=>{y(),x(),A()}));function F({onDone:e}){let[t,n]=(0,z.useState)(`loading`),[r,a]=(0,z.useState)([]),[o,l]=(0,z.useState)(null),[u,f]=(0,z.useState)(null),[p,m]=(0,z.useState)(null);(0,z.useEffect)(()=>{let e=!1;async function t(){try{let t=await N();if(e)return;a(t.availableEnvironments),l(t.selectedEnvironment),f(t.selectedEnvironmentSource),n(null)}catch(t){if(e)return;let r=S(t);T(r),m(r.message),n(null)}}return t(),()=>{e=!0}},[]);function h(t){if(t===`cancel`){e();return}n(`updating`);let a=r.find(e=>e.environment_id===t);if(!a){e(`Error: Selected environment not found`);return}v(`localSettings`,{remote:{defaultEnvironmentId:a.environment_id}}),e(`Set default remote environment to ${i.bold(a.name)} (${a.environment_id})`)}return t===`loading`?(0,B.jsx)(c,{title:V,onCancel:e,hideInputGuide:!0,children:(0,B.jsx)(d,{message:`Loading environments…`})}):p?(0,B.jsx)(c,{title:V,onCancel:e,children:(0,B.jsxs)(s,{color:`error`,children:[`Error: `,p]})}):o?r.length===1?(0,B.jsx)(L,{environment:o,onDone:e}):(0,B.jsx)(R,{environments:r,selectedEnvironment:o,selectedEnvironmentSource:u,loadingState:t,onSelect:h,onCancel:e}):(0,B.jsx)(c,{title:V,subtitle:H,onCancel:e,children:(0,B.jsx)(s,{children:`No remote environments available.`})})}function I({environment:e}){return(0,B.jsxs)(s,{children:[r.tick,` Using `,(0,B.jsx)(s,{bold:!0,children:e.name}),` `,(0,B.jsxs)(s,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]})}function L({environment:e,onDone:t}){return p(`confirm:yes`,t,{context:`Confirmation`}),(0,B.jsx)(c,{title:V,subtitle:H,onCancel:t,children:(0,B.jsx)(I,{environment:e})})}function R({environments:e,selectedEnvironment:t,selectedEnvironmentSource:n,loadingState:r,onSelect:i,onCancel:a}){let o=n&&n!==`localSettings`?` (from ${_(n)} settings)`:``;return(0,B.jsxs)(c,{title:V,subtitle:(0,B.jsxs)(s,{children:[`Currently using: `,(0,B.jsx)(s,{bold:!0,children:t.name}),o]}),onCancel:a,hideInputGuide:!0,children:[(0,B.jsx)(s,{dimColor:!0,children:H}),r===`updating`?(0,B.jsx)(d,{message:`Updating…`}):(0,B.jsx)(E,{options:e.map(e=>({label:(0,B.jsxs)(s,{children:[e.name,` `,(0,B.jsxs)(s,{dimColor:!0,children:[`(`,e.environment_id,`)`]})]}),value:e.environment_id})),defaultValue:t.environment_id,onChange:i,onCancel:()=>i(`cancel`),layout:`compact-vertical`}),(0,B.jsx)(s,{dimColor:!0,children:(0,B.jsxs)(u,{children:[(0,B.jsx)(l,{shortcut:`Enter`,action:`select`}),(0,B.jsx)(k,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`cancel`})]})})]})}var z,B,V,H,U=e((()=>{a(),n(),o(),z=t(o(),1),f(),M(),C(),w(),y(),x(),P(),j(),D(),B=m(),V=`Select Remote Environment`,H=`Configure environments at: https://claude.ai/code`}));async function W(e){return(0,G.jsx)(F,{onDone:e})}var G;e((()=>{o(),U(),G=m()}))();export{W as call};
@@ -1 +1 @@
1
- import{d as e,s as t}from"./envUtils-BWeoiL4Y.js";import{n,t as r}from"./axios-DhfaybwJ.js";import{E as i,L as a,V as o,X as s,Y as c,d as l,s as u,w as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{F as m,P as h}from"./git-CN3qtTb_.js";import{n as g,t as _}from"./sleep-8Eb9j_Ly.js";import{_ as ee,d as v}from"./rcDebugLog-BNojB_eB.js";import{c as y,d as b,i as x,o as S,s as C}from"./debugUtils-BBMFODKH.js";import{a as w,i as T}from"./trustedDevice-Bxn7WW5C.js";import{a as E,r as D}from"./bridgeConfig-C_GoD1k5.js";import{t as te}from"./jwtUtils-CpXwh_du.js";import{t as O}from"./workSecret-mS2OrpxF.js";import{i as k,r as ne}from"./envLessBridgeConfig-DJJKeDBT.js";import{a as A,c as j,i as re,n as ie,o as M,r as ae,s as oe,t as N}from"./bridgeMessaging-CqXQzew4.js";import{r as P,t as se}from"./flushGate-DeCDhkKp.js";t(),f(),c(),h(),_(),y(),w(),v(),k(),r(),u(),o(),d(),S();var F=`2023-06-01`;function I(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":F}}async function ce(e,t,r,o,s){let c=`${e}/v1/code/sessions`,u;try{u=await n.post(c,{title:r,bridge:{},...s?.length?{tags:s}:{}},{headers:I(t),timeout:o,validateStatus:e=>e<500})}catch(e){return l(`[code-session] Session create request failed: ${a(e)}`),null}if(u.status!==200&&u.status!==201){let e=x(u.data);return l(`[code-session] Session create failed ${u.status}${e?`: ${e}`:``}`),null}let d=u.data;return!d||typeof d!=`object`||!(`session`in d)||!d.session||typeof d.session!=`object`||!(`id`in d.session)||typeof d.session.id!=`string`||!d.session.id.startsWith(`cse_`)?(l(`[code-session] No session.id (cse_*) in response: ${i(d).slice(0,200)}`),null):d.session.id}async function L(e,t,r,o,s){let c=`${t}/v1/code/sessions/${e}/bridge`,u=I(r);s&&(u[`X-Trusted-Device-Token`]=s);let d;try{d=await n.post(c,{},{headers:u,timeout:o,validateStatus:e=>e<500})}catch(e){return l(`[code-session] /bridge request failed: ${a(e)}`),null}if(d.status!==200){let e=x(d.data);return l(`[code-session] /bridge failed ${d.status}${e?`: ${e}`:``}`),null}let f=d.data;if(typeof f!=`object`||!f||!(`worker_jwt`in f)||typeof f.worker_jwt!=`string`||!(`expires_in`in f)||typeof f.expires_in!=`number`||!(`api_base_url`in f)||typeof f.api_base_url!=`string`||!(`worker_epoch`in f))return l(`[code-session] /bridge response malformed (need worker_jwt, expires_in, api_base_url, worker_epoch): ${i(f).slice(0,200)}`),null;let p=f.worker_epoch,m=typeof p==`string`?Number(p):p;return typeof m!=`number`||!Number.isFinite(m)||!Number.isSafeInteger(m)?(l(`[code-session] /bridge worker_epoch invalid: ${i(p)}`),null):{worker_jwt:f.worker_jwt,api_base_url:f.api_base_url,expires_in:f.expires_in,worker_epoch:m}}r(),S(),u(),o(),E();var R=`2023-06-01`;function z(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":R}}async function B(t){let{baseUrl:n,orgUUID:r,title:i,getAccessToken:o,onAuth401:c,toSDKMessages:u,initialHistoryCap:d,initialMessages:f,onInboundMessage:h,onUserMessage:g,onPermissionResponse:_,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,onStateChange:S,outboundOnly:w,tags:T}=t,E=await ne(),D=o();if(!D)return l(`[remote-bridge] No OAuth token`),null;let k=await V(()=>ce(n,D,i,E.http_timeout_ms,T),`createCodeSession`,E);if(!k)return S?.(`failed`,`Session creation failed — see debug log`),C(`v2_session_create_failed`,void 0,!0),null;let F=k;l(`[remote-bridge] Created session ${F}`),m(`info`,`bridge_repl_v2_session_created`);let I=await V(()=>H(F,n,D,E.http_timeout_ms),`fetchRemoteCredentials`,E);if(!I)return S?.(`failed`,`Remote credentials fetch failed — see debug log`),C(`v2_remote_creds_failed`,void 0,!0),U(F,n,D,r,E.http_timeout_ms),null;l(`[remote-bridge] Fetched bridge credentials (expires_in=${I.expires_in}s)`);let L=O(I.api_base_url,F);l(`[remote-bridge] v2 session URL: ${L}`);let R;try{R=await P({sessionUrl:L,ingressToken:I.worker_jwt,sessionId:F,epoch:I.worker_epoch,heartbeatIntervalMs:E.heartbeat_interval_ms,heartbeatJitterFraction:E.heartbeat_jitter_fraction,getAuthToken:()=>I.worker_jwt,outboundOnly:w})}catch(e){return l(`[remote-bridge] v2 transport setup failed: ${a(e)}`,{level:`error`}),S?.(`failed`,`Transport setup failed: ${a(e)}`),C(`v2_transport_setup_failed`,void 0,!0),U(F,n,D,r,E.http_timeout_ms),null}l(`[remote-bridge] v2 transport created (epoch=${I.worker_epoch})`),S?.(`ready`);let z=new N(E.uuid_dedup_buffer_size),B=new Set;if(f)for(let e of f)B.add(e.uuid),z.add(e.uuid);let le=new N(E.uuid_dedup_buffer_size),W=new se,G=!1,K=!1,q=!1,J=!g,Y=`initial`,X;function Z(e){K||p(`tengu_bridge_repl_connect_timeout`,{v2:!0,elapsed_ms:E.connect_timeout_ms,cause:e})}ee(e=>{K||R.reportMetadata(e)},{replayCurrent:!0});let Q=te({refreshBufferMs:E.token_refresh_buffer_ms,getAccessToken:async()=>{let e=o();return c&&await c(e??``),o()??e},onRefresh:(e,t)=>{(async()=>{if(q||K){l(`[remote-bridge] Recovery already in flight, skipping proactive refresh`);return}q=!0;try{let r=await V(()=>H(e,n,t,E.http_timeout_ms),`fetchRemoteCredentials (proactive)`,E);if(!r||K)return;await ue(r,`proactive_refresh`),l(`[remote-bridge] Transport rebuilt (proactive refresh)`)}catch(e){l(`[remote-bridge] Proactive refresh rebuild failed: ${a(e)}`,{level:`error`}),m(`error`,`bridge_repl_v2_proactive_refresh_failed`),K||S?.(`failed`,`Refresh failed: ${a(e)}`)}finally{q=!1}})()},label:`remote`});Q.scheduleFromExpiresIn(F,I.expires_in);function $(){R.setOnConnect(()=>{if(clearTimeout(X),l(`[remote-bridge] v2 transport connected`),m(`info`,`bridge_repl_v2_transport_connected`),p(`tengu_bridge_repl_ws_connected`,{v2:!0,cause:Y}),!G&&f&&f.length>0){G=!0;let e=R;pe(f).catch(e=>l(`[remote-bridge] flushHistory failed: ${e}`)).finally(()=>{R!==e||K||q||(fe(),S?.(`connected`))})}else W.active||S?.(`connected`)}),R.setOnData(e=>{ae(e,z,le,h,_?e=>{R.reportState(`running`),_(e)}:void 0,e=>re(e,{transport:R,sessionId:F,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,outboundOnly:w}))}),R.setOnClose(e=>{if(clearTimeout(X),!K){if(l(`[remote-bridge] v2 transport closed (code=${e})`),p(`tengu_bridge_repl_ws_closed`,{code:e,v2:!0}),e===401&&!q){de();return}S?.(`failed`,`Transport closed (code ${e})`)}})}async function ue(e,t){Y=t,W.start();try{let t=R.getLastSequenceNum();if(R.close(),R=await P({sessionUrl:O(e.api_base_url,F),ingressToken:e.worker_jwt,sessionId:F,epoch:e.worker_epoch,heartbeatIntervalMs:E.heartbeat_interval_ms,heartbeatJitterFraction:E.heartbeat_jitter_fraction,initialSequenceNum:t,getAuthToken:()=>e.worker_jwt,outboundOnly:w}),K){R.close();return}$(),R.connect(),X=setTimeout(Z,E.connect_timeout_ms,Y),Q.scheduleFromExpiresIn(F,e.expires_in),fe()}finally{W.drop()}}async function de(){if(!q){q=!0,S?.(`reconnecting`,`JWT expired — refreshing`),l(`[remote-bridge] 401 on SSE — attempting JWT refresh`);try{let e=o();c&&await c(e??``);let t=o()??e;if(!t||K){K||S?.(`failed`,`JWT refresh failed: no OAuth token`);return}let r=await V(()=>H(F,n,t,E.http_timeout_ms),`fetchRemoteCredentials (recovery)`,E);if(!r||K){K||S?.(`failed`,`JWT refresh failed after 401`);return}G=!1,await ue(r,`auth_401_recovery`),l(`[remote-bridge] Transport rebuilt after 401`)}catch(e){l(`[remote-bridge] 401 recovery failed: ${a(e)}`,{level:`error`}),m(`error`,`bridge_repl_v2_jwt_refresh_failed`),K||S?.(`failed`,`JWT refresh failed: ${a(e)}`)}finally{q=!1}}}$(),f&&f.length>0&&W.start(),R.connect(),X=setTimeout(Z,E.connect_timeout_ms,Y);function fe(){let e=W.end();if(e.length===0)return;for(let t of e)z.add(t.uuid);let t=u(e).map(e=>({...e,session_id:F}));j(e)&&R.reportState(`running`),l(`[remote-bridge] Drained ${e.length} queued message(s) after flush`),R.writeBatch(t)}async function pe(e){let t=e.filter(A),n=d>0&&t.length>d?t.slice(-d):t;n.length<t.length&&l(`[remote-bridge] Capped initial flush: ${t.length} -> ${n.length} (cap=${d})`);let r=u(n).map(e=>({...e,session_id:F}));if(r.length===0)return;let i=t.at(-1);i&&oe(i)&&R.reportState(`running`),l(`[remote-bridge] Flushing ${r.length} history events`),await R.writeBatch(r)}async function me(){if(K)return;K=!0,Q.cancelAll(),clearTimeout(X),W.drop(),R.reportState(`idle`);let e={...M(F),session_id:F};R.write(e);let t=o(),i=await U(F,n,t,r,E.teardown_archive_timeout_ms);if(i===401&&c)try{await c(t??``),t=o(),i=await U(F,n,t,r,E.teardown_archive_timeout_ms)}catch(e){l(`[remote-bridge] Teardown 401 retry threw: ${a(e)}`,{level:`error`})}R.close();let s=i===`no_token`?`skipped_no_token`:i===`timeout`||i===`error`?`network_error`:i>=500?`server_5xx`:i>=400?`server_4xx`:`ok`;l(`[remote-bridge] Torn down (archive=${i})`),m(`info`,`bridge_repl_v2_teardown`),p(`tengu_bridge_repl_teardown`,{v2:!0,archive_status:s,archive_ok:typeof i==`number`&&i<400,archive_http_status:typeof i==`number`?i:void 0,archive_timeout:i===`timeout`,archive_no_token:i===`no_token`})}let he=s(me);return p(`tengu_bridge_repl_started`,{has_initial_messages:!!(f&&f.length>0),v2:!0,expires_in_s:I.expires_in,inProtectedNamespace:e()}),{bridgeSessionId:F,environmentId:``,sessionIngressUrl:I.api_base_url,writeMessages(e){let t=e.filter(e=>A(e)&&!B.has(e.uuid)&&!z.has(e.uuid));if(t.length===0)return;if(!J)for(let e of t){let t=ie(e);if(t!==void 0&&g?.(t,F)){J=!0;break}}if(W.enqueue(...t)){l(`[remote-bridge] Queued ${t.length} message(s) during flush`);return}for(let e of t)z.add(e.uuid);let n=u(t).map(e=>({...e,session_id:F}));j(t)&&R.reportState(`running`),l(`[remote-bridge] Sending ${t.length} message(s)`),R.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!z.has(e.uuid));if(t.length===0)return;for(let e of t)e.uuid&&z.add(e.uuid);let n=t.map(e=>({...e,session_id:F}));R.writeBatch(n)},sendControlRequest(e){if(q){l(`[remote-bridge] Dropping control_request during 401 recovery: ${e.request_id}`);return}let t={...e,session_id:F};e.request?.subtype===`can_use_tool`&&R.reportState(`requires_action`),R.write(t),l(`[remote-bridge] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(q){l(`[remote-bridge] Dropping control_response during 401 recovery`);return}let t={...e,session_id:F};R.reportState(`running`),R.write(t),l(`[remote-bridge] Sent control_response`)},sendControlCancelRequest(e){if(q){l(`[remote-bridge] Dropping control_cancel_request during 401 recovery: ${e}`);return}let t={type:`control_cancel_request`,request_id:e,session_id:F};R.reportState(`running`),R.write(t),l(`[remote-bridge] Sent control_cancel_request request_id=${e}`)},sendResult(){if(q){l(`[remote-bridge] Dropping result during 401 recovery`);return}R.reportState(`idle`);let e={...M(F),session_id:F};R.write(e),l(`[remote-bridge] Sent result`)},async teardown(){he(),await me()}}}async function V(e,t,n){let r=n.init_retry_max_attempts;for(let i=1;i<=r;i++){let a=await e();if(a!==null)return a;if(i<r){let e=n.init_retry_base_delay_ms*2**(i-1),a=e*n.init_retry_jitter_fraction*(2*Math.random()-1),o=Math.min(e+a,n.init_retry_max_delay_ms);l(`[remote-bridge] ${t} failed (attempt ${i}/${r}), retrying in ${Math.round(o)}ms`),await g(o)}}return null}async function H(e,t,n,r){let i=await L(e,t,n,r,T());return i?D()?{...i,api_base_url:t}:i:null}async function U(e,t,r,i,o){if(!r)return`no_token`;let s=b(e);try{let e=await n.post(`${t}/v1/sessions/${s}/archive`,{},{headers:{...z(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i},timeout:o,validateStatus:()=>!0});return l(`[remote-bridge] Archive ${s} status=${e.status}`),e.status}catch(e){return l(`[remote-bridge] Archive failed: ${a(e)}`),n.isAxiosError(e)&&e.code===`ECONNABORTED`?`timeout`:`error`}}export{B as initEnvLessBridgeCore};
1
+ import{d as e,s as t}from"./envUtils-BWeoiL4Y.js";import{n,t as r}from"./axios-DhfaybwJ.js";import{E as i,L as a,V as o,X as s,Y as c,d as l,s as u,w as d}from"./debug-UI3T040K.js";import{n as f,r as p}from"./analytics-DqMQntaB.js";import{F as m,P as h}from"./git-CN3qtTb_.js";import{n as g,t as _}from"./sleep-8Eb9j_Ly.js";import{_ as ee,d as v}from"./rcDebugLog-5XEbz_Yg.js";import{c as y,d as b,i as x,o as S,s as C}from"./debugUtils-BBMFODKH.js";import{a as w,i as T}from"./trustedDevice-C4tvgByY.js";import{a as E,r as D}from"./bridgeConfig-GQzZVhuF.js";import{t as te}from"./jwtUtils-CpXwh_du.js";import{t as O}from"./workSecret-mS2OrpxF.js";import{i as k,r as ne}from"./envLessBridgeConfig-CnR1E53G.js";import{a as A,c as j,i as re,n as ie,o as M,r as ae,s as oe,t as N}from"./bridgeMessaging-gRm2WcIE.js";import{r as P,t as se}from"./flushGate-LXr8ynSz.js";t(),f(),c(),h(),_(),y(),w(),v(),k(),r(),u(),o(),d(),S();var F=`2023-06-01`;function I(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":F}}async function ce(e,t,r,o,s){let c=`${e}/v1/code/sessions`,u;try{u=await n.post(c,{title:r,bridge:{},...s?.length?{tags:s}:{}},{headers:I(t),timeout:o,validateStatus:e=>e<500})}catch(e){return l(`[code-session] Session create request failed: ${a(e)}`),null}if(u.status!==200&&u.status!==201){let e=x(u.data);return l(`[code-session] Session create failed ${u.status}${e?`: ${e}`:``}`),null}let d=u.data;return!d||typeof d!=`object`||!(`session`in d)||!d.session||typeof d.session!=`object`||!(`id`in d.session)||typeof d.session.id!=`string`||!d.session.id.startsWith(`cse_`)?(l(`[code-session] No session.id (cse_*) in response: ${i(d).slice(0,200)}`),null):d.session.id}async function L(e,t,r,o,s){let c=`${t}/v1/code/sessions/${e}/bridge`,u=I(r);s&&(u[`X-Trusted-Device-Token`]=s);let d;try{d=await n.post(c,{},{headers:u,timeout:o,validateStatus:e=>e<500})}catch(e){return l(`[code-session] /bridge request failed: ${a(e)}`),null}if(d.status!==200){let e=x(d.data);return l(`[code-session] /bridge failed ${d.status}${e?`: ${e}`:``}`),null}let f=d.data;if(typeof f!=`object`||!f||!(`worker_jwt`in f)||typeof f.worker_jwt!=`string`||!(`expires_in`in f)||typeof f.expires_in!=`number`||!(`api_base_url`in f)||typeof f.api_base_url!=`string`||!(`worker_epoch`in f))return l(`[code-session] /bridge response malformed (need worker_jwt, expires_in, api_base_url, worker_epoch): ${i(f).slice(0,200)}`),null;let p=f.worker_epoch,m=typeof p==`string`?Number(p):p;return typeof m!=`number`||!Number.isFinite(m)||!Number.isSafeInteger(m)?(l(`[code-session] /bridge worker_epoch invalid: ${i(p)}`),null):{worker_jwt:f.worker_jwt,api_base_url:f.api_base_url,expires_in:f.expires_in,worker_epoch:m}}r(),S(),u(),o(),E();var R=`2023-06-01`;function z(e){return{Authorization:`Bearer ${e}`,"Content-Type":`application/json`,"anthropic-version":R}}async function B(t){let{baseUrl:n,orgUUID:r,title:i,getAccessToken:o,onAuth401:c,toSDKMessages:u,initialHistoryCap:d,initialMessages:f,onInboundMessage:h,onUserMessage:g,onPermissionResponse:_,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,onStateChange:S,outboundOnly:w,tags:T}=t,E=await ne(),D=o();if(!D)return l(`[remote-bridge] No OAuth token`),null;let k=await V(()=>ce(n,D,i,E.http_timeout_ms,T),`createCodeSession`,E);if(!k)return S?.(`failed`,`Session creation failed — see debug log`),C(`v2_session_create_failed`,void 0,!0),null;let F=k;l(`[remote-bridge] Created session ${F}`),m(`info`,`bridge_repl_v2_session_created`);let I=await V(()=>H(F,n,D,E.http_timeout_ms),`fetchRemoteCredentials`,E);if(!I)return S?.(`failed`,`Remote credentials fetch failed — see debug log`),C(`v2_remote_creds_failed`,void 0,!0),U(F,n,D,r,E.http_timeout_ms),null;l(`[remote-bridge] Fetched bridge credentials (expires_in=${I.expires_in}s)`);let L=O(I.api_base_url,F);l(`[remote-bridge] v2 session URL: ${L}`);let R;try{R=await P({sessionUrl:L,ingressToken:I.worker_jwt,sessionId:F,epoch:I.worker_epoch,heartbeatIntervalMs:E.heartbeat_interval_ms,heartbeatJitterFraction:E.heartbeat_jitter_fraction,getAuthToken:()=>I.worker_jwt,outboundOnly:w})}catch(e){return l(`[remote-bridge] v2 transport setup failed: ${a(e)}`,{level:`error`}),S?.(`failed`,`Transport setup failed: ${a(e)}`),C(`v2_transport_setup_failed`,void 0,!0),U(F,n,D,r,E.http_timeout_ms),null}l(`[remote-bridge] v2 transport created (epoch=${I.worker_epoch})`),S?.(`ready`);let z=new N(E.uuid_dedup_buffer_size),B=new Set;if(f)for(let e of f)B.add(e.uuid),z.add(e.uuid);let le=new N(E.uuid_dedup_buffer_size),W=new se,G=!1,K=!1,q=!1,J=!g,Y=`initial`,X;function Z(e){K||p(`tengu_bridge_repl_connect_timeout`,{v2:!0,elapsed_ms:E.connect_timeout_ms,cause:e})}ee(e=>{K||R.reportMetadata(e)},{replayCurrent:!0});let Q=te({refreshBufferMs:E.token_refresh_buffer_ms,getAccessToken:async()=>{let e=o();return c&&await c(e??``),o()??e},onRefresh:(e,t)=>{(async()=>{if(q||K){l(`[remote-bridge] Recovery already in flight, skipping proactive refresh`);return}q=!0;try{let r=await V(()=>H(e,n,t,E.http_timeout_ms),`fetchRemoteCredentials (proactive)`,E);if(!r||K)return;await ue(r,`proactive_refresh`),l(`[remote-bridge] Transport rebuilt (proactive refresh)`)}catch(e){l(`[remote-bridge] Proactive refresh rebuild failed: ${a(e)}`,{level:`error`}),m(`error`,`bridge_repl_v2_proactive_refresh_failed`),K||S?.(`failed`,`Refresh failed: ${a(e)}`)}finally{q=!1}})()},label:`remote`});Q.scheduleFromExpiresIn(F,I.expires_in);function $(){R.setOnConnect(()=>{if(clearTimeout(X),l(`[remote-bridge] v2 transport connected`),m(`info`,`bridge_repl_v2_transport_connected`),p(`tengu_bridge_repl_ws_connected`,{v2:!0,cause:Y}),!G&&f&&f.length>0){G=!0;let e=R;pe(f).catch(e=>l(`[remote-bridge] flushHistory failed: ${e}`)).finally(()=>{R!==e||K||q||(fe(),S?.(`connected`))})}else W.active||S?.(`connected`)}),R.setOnData(e=>{ae(e,z,le,h,_?e=>{R.reportState(`running`),_(e)}:void 0,e=>re(e,{transport:R,sessionId:F,onInterrupt:v,onSetModel:y,onSetMaxThinkingTokens:b,onSetPermissionMode:x,outboundOnly:w}))}),R.setOnClose(e=>{if(clearTimeout(X),!K){if(l(`[remote-bridge] v2 transport closed (code=${e})`),p(`tengu_bridge_repl_ws_closed`,{code:e,v2:!0}),e===401&&!q){de();return}S?.(`failed`,`Transport closed (code ${e})`)}})}async function ue(e,t){Y=t,W.start();try{let t=R.getLastSequenceNum();if(R.close(),R=await P({sessionUrl:O(e.api_base_url,F),ingressToken:e.worker_jwt,sessionId:F,epoch:e.worker_epoch,heartbeatIntervalMs:E.heartbeat_interval_ms,heartbeatJitterFraction:E.heartbeat_jitter_fraction,initialSequenceNum:t,getAuthToken:()=>e.worker_jwt,outboundOnly:w}),K){R.close();return}$(),R.connect(),X=setTimeout(Z,E.connect_timeout_ms,Y),Q.scheduleFromExpiresIn(F,e.expires_in),fe()}finally{W.drop()}}async function de(){if(!q){q=!0,S?.(`reconnecting`,`JWT expired — refreshing`),l(`[remote-bridge] 401 on SSE — attempting JWT refresh`);try{let e=o();c&&await c(e??``);let t=o()??e;if(!t||K){K||S?.(`failed`,`JWT refresh failed: no OAuth token`);return}let r=await V(()=>H(F,n,t,E.http_timeout_ms),`fetchRemoteCredentials (recovery)`,E);if(!r||K){K||S?.(`failed`,`JWT refresh failed after 401`);return}G=!1,await ue(r,`auth_401_recovery`),l(`[remote-bridge] Transport rebuilt after 401`)}catch(e){l(`[remote-bridge] 401 recovery failed: ${a(e)}`,{level:`error`}),m(`error`,`bridge_repl_v2_jwt_refresh_failed`),K||S?.(`failed`,`JWT refresh failed: ${a(e)}`)}finally{q=!1}}}$(),f&&f.length>0&&W.start(),R.connect(),X=setTimeout(Z,E.connect_timeout_ms,Y);function fe(){let e=W.end();if(e.length===0)return;for(let t of e)z.add(t.uuid);let t=u(e).map(e=>({...e,session_id:F}));j(e)&&R.reportState(`running`),l(`[remote-bridge] Drained ${e.length} queued message(s) after flush`),R.writeBatch(t)}async function pe(e){let t=e.filter(A),n=d>0&&t.length>d?t.slice(-d):t;n.length<t.length&&l(`[remote-bridge] Capped initial flush: ${t.length} -> ${n.length} (cap=${d})`);let r=u(n).map(e=>({...e,session_id:F}));if(r.length===0)return;let i=t.at(-1);i&&oe(i)&&R.reportState(`running`),l(`[remote-bridge] Flushing ${r.length} history events`),await R.writeBatch(r)}async function me(){if(K)return;K=!0,Q.cancelAll(),clearTimeout(X),W.drop(),R.reportState(`idle`);let e={...M(F),session_id:F};R.write(e);let t=o(),i=await U(F,n,t,r,E.teardown_archive_timeout_ms);if(i===401&&c)try{await c(t??``),t=o(),i=await U(F,n,t,r,E.teardown_archive_timeout_ms)}catch(e){l(`[remote-bridge] Teardown 401 retry threw: ${a(e)}`,{level:`error`})}R.close();let s=i===`no_token`?`skipped_no_token`:i===`timeout`||i===`error`?`network_error`:i>=500?`server_5xx`:i>=400?`server_4xx`:`ok`;l(`[remote-bridge] Torn down (archive=${i})`),m(`info`,`bridge_repl_v2_teardown`),p(`tengu_bridge_repl_teardown`,{v2:!0,archive_status:s,archive_ok:typeof i==`number`&&i<400,archive_http_status:typeof i==`number`?i:void 0,archive_timeout:i===`timeout`,archive_no_token:i===`no_token`})}let he=s(me);return p(`tengu_bridge_repl_started`,{has_initial_messages:!!(f&&f.length>0),v2:!0,expires_in_s:I.expires_in,inProtectedNamespace:e()}),{bridgeSessionId:F,environmentId:``,sessionIngressUrl:I.api_base_url,writeMessages(e){let t=e.filter(e=>A(e)&&!B.has(e.uuid)&&!z.has(e.uuid));if(t.length===0)return;if(!J)for(let e of t){let t=ie(e);if(t!==void 0&&g?.(t,F)){J=!0;break}}if(W.enqueue(...t)){l(`[remote-bridge] Queued ${t.length} message(s) during flush`);return}for(let e of t)z.add(e.uuid);let n=u(t).map(e=>({...e,session_id:F}));j(t)&&R.reportState(`running`),l(`[remote-bridge] Sending ${t.length} message(s)`),R.writeBatch(n)},writeSdkMessages(e){let t=e.filter(e=>!e.uuid||!z.has(e.uuid));if(t.length===0)return;for(let e of t)e.uuid&&z.add(e.uuid);let n=t.map(e=>({...e,session_id:F}));R.writeBatch(n)},sendControlRequest(e){if(q){l(`[remote-bridge] Dropping control_request during 401 recovery: ${e.request_id}`);return}let t={...e,session_id:F};e.request?.subtype===`can_use_tool`&&R.reportState(`requires_action`),R.write(t),l(`[remote-bridge] Sent control_request request_id=${e.request_id}`)},sendControlResponse(e){if(q){l(`[remote-bridge] Dropping control_response during 401 recovery`);return}let t={...e,session_id:F};R.reportState(`running`),R.write(t),l(`[remote-bridge] Sent control_response`)},sendControlCancelRequest(e){if(q){l(`[remote-bridge] Dropping control_cancel_request during 401 recovery: ${e}`);return}let t={type:`control_cancel_request`,request_id:e,session_id:F};R.reportState(`running`),R.write(t),l(`[remote-bridge] Sent control_cancel_request request_id=${e}`)},sendResult(){if(q){l(`[remote-bridge] Dropping result during 401 recovery`);return}R.reportState(`idle`);let e={...M(F),session_id:F};R.write(e),l(`[remote-bridge] Sent result`)},async teardown(){he(),await me()}}}async function V(e,t,n){let r=n.init_retry_max_attempts;for(let i=1;i<=r;i++){let a=await e();if(a!==null)return a;if(i<r){let e=n.init_retry_base_delay_ms*2**(i-1),a=e*n.init_retry_jitter_fraction*(2*Math.random()-1),o=Math.min(e+a,n.init_retry_max_delay_ms);l(`[remote-bridge] ${t} failed (attempt ${i}/${r}), retrying in ${Math.round(o)}ms`),await g(o)}}return null}async function H(e,t,n,r){let i=await L(e,t,n,r,T());return i?D()?{...i,api_base_url:t}:i:null}async function U(e,t,r,i,o){if(!r)return`no_token`;let s=b(e);try{let e=await n.post(`${t}/v1/sessions/${s}/archive`,{},{headers:{...z(r),"anthropic-beta":`ccr-byoc-2025-07-29`,"x-organization-uuid":i},timeout:o,validateStatus:()=>!0});return l(`[remote-bridge] Archive ${s} status=${e.status}`),e.status}catch(e){return l(`[remote-bridge] Archive failed: ${a(e)}`),n.isAxiosError(e)&&e.code===`ECONNABORTED`?`timeout`:`error`}}export{B as initEnvLessBridgeCore};
@@ -1,3 +1,3 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{L as u,V as d}from"./debug-UI3T040K.js";import{Fx as f,Rx as p}from"./loadAgentsDir-DF6FgRn-.js";import{t as m}from"./useKeybinding-FsOnjW6T.js";import{a as h,t as g}from"./bridgeConfig-C_GoD1k5.js";import{n as _,r as v}from"./bridgeEnabled-cSK8a7tN.js";import{a as y,n as b}from"./types-RJTEOuIt.js";import{t as x}from"./Dialog-DYFGqyDs.js";import{t as S}from"./ListItem-OFARanN7.js";import{i as C,o as w,t as T}from"./cliLaunch-BQa48gsr.js";import{resolve as E}from"path";function D({onDone:e}){let[t,n]=(0,N.useState)(I),[r,i]=(0,N.useState)(null);return(0,N.useEffect)(()=>{if(F&&!F.killed){n(`running`);return}let t=!1;return(async()=>{let r=await k();if(!t){if(r){e(r,{display:`system`});return}n(`starting`);try{A(),t||(n(`running`),I=`running`,e(`Remote Control Server started. Use /remote-control-server to manage.`,{display:`system`}))}catch(r){if(!t){let t=u(r);n(`error`),i(t),I=`error`,e(`Remote Control Server failed to start: ${t}`,{display:`system`})}}}})(),()=>{t=!0}},[]),t===`running`&&F&&!F.killed?(0,P.jsx)(O,{onDone:e}):null}function O({onDone:e}){p(`remote-control-server-dialog`);let[t,n]=(0,N.useState)(2),s=L.slice(-5);function l(){j(),e(`Remote Control Server stopped.`,{display:`system`})}function d(){j();try{A(),e(`Remote Control Server restarted.`,{display:`system`})}catch(t){e(`Failed to restart: ${u(t)}`,{display:`system`})}}function f(){e(void 0,{display:`skip`})}return o({"select:next":()=>n(e=>(e+1)%3),"select:previous":()=>n(e=>(e-1+3)%3),"select:accept":()=>{t===0?l():t===1?d():f()}},{context:`Select`}),(0,P.jsx)(a,{title:`Remote Control Server`,onCancel:f,hideInputGuide:!0,children:(0,P.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,P.jsxs)(r,{children:[`Remote Control Server is`,` `,(0,P.jsx)(r,{bold:!0,color:`success`,children:`running`}),F?` (PID: ${F.pid})`:``]}),s.length>0&&(0,P.jsxs)(c,{flexDirection:`column`,children:[(0,P.jsx)(r,{dimColor:!0,children:`Recent logs:`}),s.map((e,t)=>(0,P.jsx)(r,{dimColor:!0,children:e},t))]}),(0,P.jsxs)(c,{flexDirection:`column`,children:[(0,P.jsx)(i,{isFocused:t===0,children:(0,P.jsx)(r,{children:`Stop server`})}),(0,P.jsx)(i,{isFocused:t===1,children:(0,P.jsx)(r,{children:`Restart server`})}),(0,P.jsx)(i,{isFocused:t===2,children:(0,P.jsx)(r,{children:`Continue`})})]}),(0,P.jsx)(r,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function k(){return await _()||(g()?null:b)}function A(){let e=E(`.`),t=w(T([`daemon`,`start`,`--dir=${e}`]),{cwd:e,stdio:[`ignore`,`pipe`,`pipe`],detached:!1});F=t,L=[],t.stdout?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
1
+ import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n,b as r,d as i,f as a,nt as o,t as s,x as c}from"./src-Di342QoJ.js";import{t as l}from"./jsx-runtime-D-D469L8.js";import{L as u,V as d}from"./debug-UI3T040K.js";import{Fx as f,Rx as p}from"./loadAgentsDir-HZ19tmOZ.js";import{t as m}from"./useKeybinding-FsOnjW6T.js";import{a as h,t as g}from"./bridgeConfig-GQzZVhuF.js";import{n as _,r as v}from"./bridgeEnabled-CDoXbe3S.js";import{a as y,n as b}from"./types-RJTEOuIt.js";import{t as x}from"./Dialog-DYFGqyDs.js";import{t as S}from"./ListItem-OFARanN7.js";import{i as C,o as w,t as T}from"./cliLaunch-BQa48gsr.js";import{resolve as E}from"path";function D({onDone:e}){let[t,n]=(0,N.useState)(I),[r,i]=(0,N.useState)(null);return(0,N.useEffect)(()=>{if(F&&!F.killed){n(`running`);return}let t=!1;return(async()=>{let r=await k();if(!t){if(r){e(r,{display:`system`});return}n(`starting`);try{A(),t||(n(`running`),I=`running`,e(`Remote Control Server started. Use /remote-control-server to manage.`,{display:`system`}))}catch(r){if(!t){let t=u(r);n(`error`),i(t),I=`error`,e(`Remote Control Server failed to start: ${t}`,{display:`system`})}}}})(),()=>{t=!0}},[]),t===`running`&&F&&!F.killed?(0,P.jsx)(O,{onDone:e}):null}function O({onDone:e}){p(`remote-control-server-dialog`);let[t,n]=(0,N.useState)(2),s=L.slice(-5);function l(){j(),e(`Remote Control Server stopped.`,{display:`system`})}function d(){j();try{A(),e(`Remote Control Server restarted.`,{display:`system`})}catch(t){e(`Failed to restart: ${u(t)}`,{display:`system`})}}function f(){e(void 0,{display:`skip`})}return o({"select:next":()=>n(e=>(e+1)%3),"select:previous":()=>n(e=>(e-1+3)%3),"select:accept":()=>{t===0?l():t===1?d():f()}},{context:`Select`}),(0,P.jsx)(a,{title:`Remote Control Server`,onCancel:f,hideInputGuide:!0,children:(0,P.jsxs)(c,{flexDirection:`column`,gap:1,children:[(0,P.jsxs)(r,{children:[`Remote Control Server is`,` `,(0,P.jsx)(r,{bold:!0,color:`success`,children:`running`}),F?` (PID: ${F.pid})`:``]}),s.length>0&&(0,P.jsxs)(c,{flexDirection:`column`,children:[(0,P.jsx)(r,{dimColor:!0,children:`Recent logs:`}),s.map((e,t)=>(0,P.jsx)(r,{dimColor:!0,children:e},t))]}),(0,P.jsxs)(c,{flexDirection:`column`,children:[(0,P.jsx)(i,{isFocused:t===0,children:(0,P.jsx)(r,{children:`Stop server`})}),(0,P.jsx)(i,{isFocused:t===1,children:(0,P.jsx)(r,{children:`Restart server`})}),(0,P.jsx)(i,{isFocused:t===2,children:(0,P.jsx)(r,{children:`Continue`})})]}),(0,P.jsx)(r,{dimColor:!0,children:`Enter to select · Esc to continue`})]})})}async function k(){return await _()||(g()?null:b)}function A(){let e=E(`.`),t=w(T([`daemon`,`start`,`--dir=${e}`]),{cwd:e,stdio:[`ignore`,`pipe`,`pipe`],detached:!1});F=t,L=[],t.stdout?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
2
2
  `);for(let e of t)L.push(e),L.length>R&&L.shift()}),t.stderr?.on(`data`,e=>{let t=e.toString().trimEnd().split(`
3
3
  `);for(let e of t)L.push(`[err] ${e}`),L.length>R&&L.shift()}),t.on(`exit`,(e,t)=>{F=null,I=`stopped`,L.push(`[daemon] exited (code=${e??`unknown`}, signal=${t})`)}),t.on(`error`,e=>{F=null,I=`error`,L.push(`[daemon] error: ${e.message}`)})}function j(){if(F&&!F.killed){F.kill(`SIGTERM`);let e=F.pid;setTimeout(()=>{try{e&&process.kill(e,0),F&&!F.killed&&F.kill(`SIGKILL`)}catch{}},1e4)}F=null,I=`stopped`}async function M(e,t,n){return(0,P.jsx)(D,{onDone:e})}var N,P,F,I,L,R;e((()=>{n(),N=t(n(),1),v(),h(),y(),x(),S(),f(),s(),m(),C(),d(),P=l(),F=null,I=`stopped`,L=[],R=50}))();export{M as call};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{f as r,l as i}from"./teammate-DMYOtLTK.js";import{Ar as a,Lo as o,Oo as s,Tr as c,_i as l,mi as u}from"./loadAgentsDir-DF6FgRn-.js";import{a as d,i as f,r as p}from"./bridgeConfig-C_GoD1k5.js";import{n as m,t as h}from"./generateSessionName-DeFGkHct.js";async function g(e,n,i){if(r())return e(`Cannot rename: This session is a swarm teammate. Teammate names are set by the team leader.`,{display:`system`}),null;let a;if(!i||i.trim()===``){let t=await h(s(n.messages),n.abortController.signal);if(!t)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;a=t}else a=i.trim();let o=t(),d=c();await l(o,a,d);let m=n.getAppState().replBridgeSessionId;if(m){let e=f();import(`./createSession-BYf27ahD.js`).then(({updateBridgeSessionTitle:t})=>t(m,a,{baseUrl:p(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await u(o,a,d),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:a}})),e(`Session renamed to: ${a}`,{display:`system`}),null}e((()=>{n(),d(),o(),a(),i(),m()}))();export{g as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Ct as t,cn as n}from"./state-sIHsFpDu.js";import{f as r,l as i}from"./teammate-DMYOtLTK.js";import{Ar as a,Lo as o,Oo as s,Tr as c,_i as l,mi as u}from"./loadAgentsDir-HZ19tmOZ.js";import{a as d,i as f,r as p}from"./bridgeConfig-GQzZVhuF.js";import{n as m,t as h}from"./generateSessionName-DF4I7gr2.js";async function g(e,n,i){if(r())return e(`Cannot rename: This session is a swarm teammate. Teammate names are set by the team leader.`,{display:`system`}),null;let a;if(!i||i.trim()===``){let t=await h(s(n.messages),n.abortController.signal);if(!t)return e(`Could not generate a name: no conversation context yet. Usage: /rename <name>`,{display:`system`}),null;a=t}else a=i.trim();let o=t(),d=c();await l(o,a,d);let m=n.getAppState().replBridgeSessionId;if(m){let e=f();import(`./createSession-XhPMcSns.js`).then(({updateBridgeSessionTitle:t})=>t(m,a,{baseUrl:p(),getAccessToken:e?()=>e:void 0}).catch(()=>{}))}return await u(o,a,d),n.setAppState(e=>({...e,standaloneAgentContext:{...e.standaloneAgentContext,name:a}})),e(`Session renamed to: ${a}`,{display:`system`}),null}e((()=>{n(),d(),o(),a(),i(),m()}))();export{g as call};
@@ -1,2 +1,2 @@
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,Ln as o,Rn as s,b as c,t as l,tn as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Ct as p,cn as m,ot as h}from"./state-sIHsFpDu.js";import{o as g,s as _}from"./log-CzsijfHZ.js";import{Ar as v,B_ as y,Br as b,Gr as x,Gw as S,Mi as C,Mr as w,Ni as T,Pr as E,Si as D,Sy as O,Ur as k,Uw as A,V_ as j,Ww as M,_r as N,by as P,wr as F}from"./loadAgentsDir-DF6FgRn-.js";import{n as I,r as L}from"./modalContext-CmSKRyea.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-BQxLBpDD.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${a.bold(e.arg)} was not found. Run ${a.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${a.bold(e.arg)}. Run ${a.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(d,{flexDirection:`column`,children:[(0,Y.jsxs)(c,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(M,{children:(0,Y.jsx)(c,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[a,o]=J.useState([]),[s,l]=J.useState(!0),[f,m]=J.useState(!1),[g,_]=J.useState(!1),{rows:v}=i(),y=L(),S=J.useCallback(async(t,n)=>{l(!0);try{let i=q(t?await b():await x(n),p());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{l(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await C(h());o(e),S(!1,e)}e()},[S]);let w=J.useCallback(()=>{let e=!g;_(e),S(e,a)},[g,S,a]);async function T(n){let r=j(F(n));if(!r){e(`Failed to resume conversation`);return}let i=E(n)?await k(n):n,o=U(i,g,a);if(o.isCrossProject){if(o.isSameRepoWorktree){m(!0),t(r,i,`slash_command_picker`);return}let n=await u(o.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${o.command}`,``,`(Command copied to clipboard)`,``].join(`
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,Ln as o,Rn as s,b as c,t as l,tn as u,x as d}from"./src-Di342QoJ.js";import{t as f}from"./jsx-runtime-D-D469L8.js";import{Ct as p,cn as m,ot as h}from"./state-sIHsFpDu.js";import{o as g,s as _}from"./log-CzsijfHZ.js";import{Ar as v,B_ as y,Br as b,Gr as x,Gw as S,Mi as C,Mr as w,Ni as T,Pr as E,Si as D,Sy as O,Ur as k,Uw as A,V_ as j,Ww as M,_r as N,by as P,wr as F}from"./loadAgentsDir-HZ19tmOZ.js";import{n as I,r as L}from"./modalContext-CmSKRyea.js";import{a as R,i as z,n as B,o as V,r as H,t as U}from"./crossProjectResume-BMWSw62A.js";function W(e){switch(e.resultType){case`sessionNotFound`:return`Session ${a.bold(e.arg)} was not found. Run ${a.bold(`/resume`)} without arguments to browse all sessions.`;case`multipleMatches`:return`Found ${e.count} sessions matching ${a.bold(e.arg)}. Run ${a.bold(`/resume`)} to pick one from the list.`}}function G({message:e,args:t,onDone:n}){return J.useEffect(()=>{let e=setTimeout(n,0);return()=>clearTimeout(e)},[n]),(0,Y.jsxs)(d,{flexDirection:`column`,children:[(0,Y.jsxs)(c,{dimColor:!0,children:[r.pointer,` /resume `,t]}),(0,Y.jsx)(M,{children:(0,Y.jsx)(c,{children:e})})]})}function K({onDone:e,onResume:t}){let[n,r]=J.useState([]),[a,o]=J.useState([]),[s,l]=J.useState(!0),[f,m]=J.useState(!1),[g,_]=J.useState(!1),{rows:v}=i(),y=L(),S=J.useCallback(async(t,n)=>{l(!0);try{let i=q(t?await b():await x(n),p());if(i.length===0){e(`No conversations found to resume`);return}r(i)}catch{e(`Failed to load conversations`)}finally{l(!1)}},[e]);J.useEffect(()=>{async function e(){let e=await C(h());o(e),S(!1,e)}e()},[S]);let w=J.useCallback(()=>{let e=!g;_(e),S(e,a)},[g,S,a]);async function T(n){let r=j(F(n));if(!r){e(`Failed to resume conversation`);return}let i=E(n)?await k(n):n,o=U(i,g,a);if(o.isCrossProject){if(o.isSameRepoWorktree){m(!0),t(r,i,`slash_command_picker`);return}let n=await u(o.command);n&&process.stdout.write(n),e([``,`This conversation is from a different directory.`,``,`To resume, run:`,` ${o.command}`,``,`(Command copied to clipboard)`,``].join(`
2
2
  `),{display:`user`});return}m(!0),t(r,i,`slash_command_picker`)}function D(){e(`Resume cancelled`,{display:`system`})}return s?(0,Y.jsxs)(d,{children:[(0,Y.jsx)(P,{}),(0,Y.jsx)(c,{children:` Loading conversations…`})]}):f?(0,Y.jsxs)(d,{children:[(0,Y.jsx)(P,{}),(0,Y.jsx)(c,{children:` Resuming conversation…`})]}):(0,Y.jsx)(R,{logs:n,maxHeight:y?Math.floor(v/2):v-2,onCancel:D,onSelect:T,onLogsChanged:()=>S(g,a),showAllProjects:g,onToggleAllProjects:w,onAgenticSearch:H})}function q(e,t){return e.filter(e=>!e.isSidechain&&F(e)!==t)}var J,Y,X;e((()=>{o(),n(),J=t(s(),1),m(),V(),S(),O(),I(),A(),l(),z(),B(),T(),g(),v(),y(),Y=f(),X=async(e,t,n)=>{let r=async(n,r,i)=>{try{await t.resume?.(n,r,i),e(void 0,{display:`skip`})}catch(t){_(t),e(`Failed to resume: ${t.message}`)}},i=n?.trim();if(!i)return(0,Y.jsx)(K,{onDone:e,onResume:r},Date.now());let a=await x(await C(h()));if(a.length===0){let t=`No conversations found to resume.`;return(0,Y.jsx)(G,{message:t,args:i,onDone:()=>e(t)})}let o=j(i);if(o){let e=a.filter(e=>F(e)===o).sort((e,t)=>t.modified.getTime()-e.modified.getTime());if(e.length>0){let t=e[0];return r(o,E(t)?await k(t):t,`slash_command_session_id`),null}let t=await N(o);if(t)return r(o,t,`slash_command_session_id`),null}if(w()){let t=await D(i,{exact:!0});if(t.length===1){let e=t[0],n=F(e);if(n)return r(n,E(e)?await k(e):e,`slash_command_title`),null}if(t.length>1){let n=W({resultType:`multipleMatches`,arg:i,count:t.length});return(0,Y.jsx)(G,{message:n,args:i,onDone:()=>e(n)})}}let s=W({resultType:`sessionNotFound`,arg:i});return(0,Y.jsx)(G,{message:s,args:i,onDone:()=>e(s)})}}))();export{X as call,q as filterResumableSessions};
@@ -1 +1 @@
1
- import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-BbwUiToa.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
1
+ import{a as e,i as t,n,o as r,r as i,s as a,t as o}from"./runtimeObserver-jrNSkZU2.js";t();export{o as RUNTIME_SESSION_ID,n as getRuntimeTurn,i as initSkillLearning,e as resetRuntimeLLMBookkeeping,r as resetRuntimeObserverForTest,a as runSkillLearningPostSampling};
@@ -1,4 +1,4 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{ND as r,PD as i,Xi as a,zi as o}from"./loadAgentsDir-DF6FgRn-.js";import{r as s,t as c}from"./featureCheck-Cm0YNDXO.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as ee,s as te,u as ne}from"./instinctParser-DHMa8xa0.js";import{C as h,S as g,b as _,c as re,f as ie,i as ae,m as oe,o as v,r as se,u as y}from"./skillGenerator-Deog7yBO.js";import{a as ce,i as b,l as le,n as x,o as ue,t as de}from"./observationStore-tvkldXUo.js";import{a as fe,c as pe}from"./projectContext-eXMSfgdZ.js";import{d as me,i as he,l as ge,p as _e}from"./sessionObserver-CsDT2GnB.js";import{dirname as ve,join as S}from"node:path";import{existsSync as C}from"node:fs";import{randomBytes as ye}from"node:crypto";import{mkdir as w,readFile as be,readdir as T,rename as xe,unlink as Se,writeFile as E}from"node:fs/promises";function D(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Ce(e)),i=Ee(e),a=t?.description??we(e),o=k(r,n,t),s=Te({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function O(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),o(),t)}function k(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??S(t(),`commands`)}function Ce(e){return g([`learned`,...De(e,4)].join(`-`))||`learned-command`}function we(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function Te(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{ND as r,PD as i,Xi as a,zi as o}from"./loadAgentsDir-HZ19tmOZ.js";import{r as s,t as c}from"./featureCheck-Cm0YNDXO.js";import{a as l,c as u,i as d,l as f,n as p,o as m,r as ee,s as te,u as ne}from"./instinctParser-DHMa8xa0.js";import{C as h,S as g,b as _,c as re,f as ie,i as ae,m as oe,o as v,r as se,u as y}from"./skillGenerator-Bys7U1l_.js";import{a as ce,i as b,l as le,n as x,o as ue,t as de}from"./observationStore-tvkldXUo.js";import{a as fe,c as pe}from"./projectContext-eXMSfgdZ.js";import{d as me,i as he,l as ge,p as _e}from"./sessionObserver-LBqNoak9.js";import{dirname as ve,join as S}from"node:path";import{existsSync as C}from"node:fs";import{randomBytes as ye}from"node:crypto";import{mkdir as w,readFile as be,readdir as T,rename as xe,unlink as Se,writeFile as E}from"node:fs/promises";function D(e,t){if(e.length===0)throw Error(`Cannot generate a command draft without instincts`);let n=t?.scope??e[0]?.scope??`project`,r=g(t?.name??Ce(e)),i=Ee(e),a=t?.description??we(e),o=k(r,n,t),s=Te({name:r,description:a,confidence:i,instincts:e});return{name:r,description:a,scope:n,sourceInstinctIds:e.map(e=>e.id),confidence:Number(i.toFixed(2)),content:s,outputPath:o}}async function O(e){await w(e.outputPath,{recursive:!0});let t=S(e.outputPath,`${e.name}.md`);return C(t)?t:(await E(t,e.content,`utf8`),o(),t)}function k(e,n,r){return r?.outputRoot?r.outputRoot:n===`project`?S(r?.cwd??process.cwd(),`.claude`,`commands`):r?.globalCommandsDir??S(t(),`commands`)}function Ce(e){return g([`learned`,...De(e,4)].join(`-`))||`learned-command`}function we(e){return(e[0]?.trigger??`Reuse the learned workflow`).replace(/\s+/g,` `).slice(0,120)}function Te(e){let{name:t,description:n,confidence:r,instincts:i}=e;return[`---`,`name: ${t}`,`description: ${JSON.stringify(n)}`,`origin: skill-learning`,`confidence: ${Number(r.toFixed(2))}`,`evolved_from: [${i.map(e=>JSON.stringify(e.id)).join(`, `)}]`,`---`,``,`# /${t}`,``,`## When to use`,``,i.map(e=>`- ${e.trigger}`).join(`
2
2
  `),``,`## Steps`,``,i.map(e=>`- ${e.action}`).join(`
3
3
  `),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).join(`
4
4
  `),``].join(`
@@ -6,5 +6,5 @@ import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWe
6
6
  `),``,`## Playbook`,``,i.map(e=>`- ${e.action}`).join(`
7
7
  `),``,`## Evidence`,``,i.flatMap(e=>e.evidence.map(e=>`- ${e}`)).slice(0,20).join(`
8
8
  `),``].join(`
9
- `)}function je(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function Me(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var P=e((()=>{n(),a(),_()}));function F(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Pe(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=f().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:I(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function I(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ne(e,t){return F(e).filter(e=>e.target===`skill`&&h(e.instincts)).map(e=>ae(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function L(e,t){return F(e).filter(e=>e.target===`command`&&h(e.instincts)).map(e=>D(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function R(e,t){return F(e).filter(e=>e.target===`agent`&&h(e.instincts)).map(e=>j(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var z=e((()=>{_(),v(),A(),P(),ne()}));function B(e){let t=x(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?S(t,`global`,`instincts`,`personal`):S(t,`projects`,n.projectId,`instincts`,`personal`)}async function V(e,t){let n=m(e);await w(B(t),{recursive:!0});let r=He(n.id,t),i=`${r}.${ye(6).toString(`hex`)}.tmp`;return await E(i,u(n)),await xe(i,r),n}async function H(e){let t=B(e),n=[];try{n=await T(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await be(S(t,e),`utf8`);r.push(te(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function Fe(e,t){let n=U.then(()=>Ie(e,t));return U=n.catch(()=>{}),n}async function Ie(e,t){let n=await H(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&l(t,e)),i=new Date().toISOString();if(!r)return V(e,t);let a=l(r,e),o=a?-.1:ze(e.evidenceOutcome),s=p(r.confidence+o),c=Le(r.status,s,a);return V(m({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function Le(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function Re(e){let t=await H(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/We);if(a<1)continue;let o=-Ue*a,s=p(i.confidence+o);s!==i.confidence&&(await V(m({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function ze(e){return e===`failure`?-.05:.05}async function Be(e,t){let n=await H(t);return await w(ve(e),{recursive:!0}),await E(e,`${JSON.stringify(n,null,2)}\n`),n}async function Ve(e,t){let n=await H(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await Se(He(e.id,t)),i.push(e));return i}function He(e,t){return S(B(t),`${e}.json`)}var U,Ue,We,W=e((()=>{b(),d(),U=Promise.resolve(),Ue=.02,We=10080*60*1e3}));function Ge(e){if(G.add(e),G.size>Xe){let e=G.size-Ze,t=G.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;G.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(G.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await V({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=S(x(e?{rootDir:e}:void 0),`projects`);if(!C(t))return[];let n=await T(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await H({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:S(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=x(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:S(t,`global`)}}var Xe,Ze,G,Qe=e((()=>{W(),b(),Xe=256,Ze=192,G=new Set}));function $e(){X=0,Z=0,Q.clear()}function et(){return J}function tt(){if(!q){q=!0;try{_e()}catch{}i(it),nt().catch(()=>{})}}async function nt(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:pe(process.cwd())};await Promise.allSettled([Re(e),ce(e),Ve(30,e)])}function rt(e){try{let t=x();return e.startsWith(t)}catch{return!1}}async function it(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(rt(t))return;let n=pe(t),r={project:n};++J;let i=[];for(let t of st(e.messages,n))i.push(await de(t,r));let a=(await ue(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=f(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,u;if(l)X++,Z=o,u=await ge(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-BNZflr2e.js`),t=e.analyze(i,{project:n});u=Array.isArray(t)?t:await t}for(let e of u)await Fe(ee(e),r);await ot(r)}function at(){J=0,Y=``,$e()}async function ot(e){let n=await H(e),r=process.cwd(),i=[S(r,`.claude`,`skills`),S(t(),`skills`)],a=F(n).filter(e=>e.target===`skill`&&h(e.instincts));for(let e of a){let t=await se(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;C(S(n.outputPath,`SKILL.md`))||await re(ie(n,await y(`skill`,n,i)))}let o=L(n,{cwd:r});for(let e of o)(await y(`command`,e,[S(r,`.claude`,`commands`),S(t(),`commands`)])).length>0||await O(e);let s=R(n,{cwd:r});for(let e of s)(await y(`agent`,e,[S(r,`.claude`,`agents`),S(t(),`agents`)])).length>0||await M(e);await qe()}function st(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>dt){let e=Q.size-$,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=ut(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=ct(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=lt(e.message?.content),n=ct(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function ct(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
9
+ `)}function je(e){return e.reduce((e,t)=>e+t.confidence,0)/e.length}function Me(e,t){let n=new Set([`when`,`with`,`this`,`that`,`user`,`asks`,`for`,`the`,`and`,`debug`,`investigate`,`research`]),r=[];for(let i of e)for(let e of`${i.trigger} ${i.action}`.toLowerCase().split(/[^a-z0-9]+/))if(e.length>2&&!n.has(e)&&!r.includes(e)&&r.push(e),r.length>=t)return r;return r}var P=e((()=>{n(),a(),_()}));function F(e){let t=new Map;for(let n of e){if(n.status!==`active`&&n.status!==`pending`)continue;let e=`${n.domain}:${Pe(n.trigger)}`,r=t.get(e)??[];r.push(n),t.set(e,r)}return Array.from(t.values()).filter(e=>e.length>=f().minClusterSize).map(e=>{let t=e.reduce((e,t)=>e+t.confidence,0)/e.length;return{target:I(e),trigger:e[0]?.trigger??`learned pattern`,domain:e[0]?.domain??`project`,instincts:e,averageConfidence:Number(t.toFixed(2))}}).sort((e,t)=>t.averageConfidence-e.averageConfidence)}function I(e){let t=Array.isArray(e)?e:e.instincts,n=t.map(e=>`${e.trigger} ${e.action}`).join(` `).toLowerCase();return/user asks|explicitly request|command|run /.test(n)?`command`:t.length>=4&&/(debug|investigate|research|multi-step)/.test(n)?`agent`:`skill`}function Ne(e,t){return F(e).filter(e=>e.target===`skill`&&h(e.instincts)).map(e=>ae(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function L(e,t){return F(e).filter(e=>e.target===`command`&&h(e.instincts)).map(e=>D(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function R(e,t){return F(e).filter(e=>e.target===`agent`&&h(e.instincts)).map(e=>j(e.instincts,{...t,scope:e.instincts[0]?.scope??`project`}))}function Pe(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,` `).split(/\s+/).filter(Boolean).slice(0,6).join(` `)}var z=e((()=>{_(),v(),A(),P(),ne()}));function B(e){let t=x(e),n=e?.project;return(e?.scope??n?.scope??`project`)===`global`||!n||n.projectId===`global`?S(t,`global`,`instincts`,`personal`):S(t,`projects`,n.projectId,`instincts`,`personal`)}async function V(e,t){let n=m(e);await w(B(t),{recursive:!0});let r=He(n.id,t),i=`${r}.${ye(6).toString(`hex`)}.tmp`;return await E(i,u(n)),await xe(i,r),n}async function H(e){let t=B(e),n=[];try{n=await T(t)}catch(e){if(e.code===`ENOENT`)return[];throw e}let r=[];for(let e of n.filter(e=>e.endsWith(`.json`))){let n=await be(S(t,e),`utf8`);r.push(te(n))}return r.sort((e,t)=>e.id.localeCompare(t.id))}function Fe(e,t){let n=U.then(()=>Ie(e,t));return U=n.catch(()=>{}),n}async function Ie(e,t){let n=await H(t),r=n.find(t=>t.id===e.id)??n.find(t=>t.trigger.toLowerCase()===e.trigger.toLowerCase()&&l(t,e)),i=new Date().toISOString();if(!r)return V(e,t);let a=l(r,e),o=a?-.1:ze(e.evidenceOutcome),s=p(r.confidence+o),c=Le(r.status,s,a);return V(m({...r,confidence:s,evidence:[...r.evidence,...e.evidence],evidenceOutcome:e.evidenceOutcome??r.evidenceOutcome,observationIds:[...r.observationIds??[],...e.observationIds??[]],updatedAt:i,status:c}),t)}function Le(e,t,n){return n&&t<.3?`conflict-hold`:e===`conflict-hold`&&t>=.5||e===`pending`&&t>=.8?`active`:e}async function Re(e){let t=await H(e),n=Date.now(),r=0;for(let i of t){if(i.status!==`pending`&&i.status!==`active`)continue;let t=Date.parse(i.updatedAt);if(Number.isNaN(t))continue;let a=Math.floor((n-t)/We);if(a<1)continue;let o=-Ue*a,s=p(i.confidence+o);s!==i.confidence&&(await V(m({...i,confidence:s,updatedAt:new Date(n).toISOString()}),e),r+=1)}return r}function ze(e){return e===`failure`?-.05:.05}async function Be(e,t){let n=await H(t);return await w(ve(e),{recursive:!0}),await E(e,`${JSON.stringify(n,null,2)}\n`),n}async function Ve(e,t){let n=await H(t),r=Date.now()-e*24*60*60*1e3,i=[];for(let e of n)e.status===`pending`&&Date.parse(e.updatedAt)<r&&(await Se(He(e.id,t)),i.push(e));return i}function He(e,t){return S(B(t),`${e}.json`)}var U,Ue,We,W=e((()=>{b(),d(),U=Promise.resolve(),Ue=.02,We=10080*60*1e3}));function Ge(e){if(G.add(e),G.size>Xe){let e=G.size-Ze,t=G.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;G.delete(e.value)}}}function Ke(e,t=2,n=.8){let r=new Map;for(let t of e){if(t.scope!==`project`)continue;let e=r.get(t.id)??[];e.push(t),r.set(t.id,e)}return Array.from(r.entries()).flatMap(([e,r])=>{let i=Array.from(new Set(r.map(e=>e.projectId).filter(Boolean))),a=r.reduce((e,t)=>e+t.confidence,0)/r.length;return i.length>=t&&a>=n?[{instinctId:e,projectIds:i,averageConfidence:Number(a.toFixed(2))}]:[]})}async function qe(e={}){let t=e.minProjects??2,n=e.minConfidence??.8,r=await Je(e.rootDir),i=Ke(r,t,n),a=[];for(let t of i){if(G.has(t.instinctId))continue;let n=r.find(e=>e.id===t.instinctId);n&&(await V({...n,scope:`global`,projectId:void 0,projectName:void 0,confidence:t.averageConfidence,updatedAt:new Date().toISOString()},{rootDir:e.rootDir,scope:`global`,project:Ye(e.rootDir)}),Ge(t.instinctId),a.push(t))}return a}async function Je(e){let t=S(x(e?{rootDir:e}:void 0),`projects`);if(!C(t))return[];let n=await T(t,{withFileTypes:!0}),r=[];for(let i of n){if(!i.isDirectory())continue;let n=await H({rootDir:e,project:{projectId:i.name,projectName:i.name,scope:`project`,source:`git_root`,cwd:t,storageDir:S(t,i.name)},scope:`project`});r.push(...n)}return r}function Ye(e){let t=x(e?{rootDir:e}:void 0);return{projectId:`global`,projectName:`Global`,scope:`global`,source:`global`,cwd:t,storageDir:S(t,`global`)}}var Xe,Ze,G,Qe=e((()=>{W(),b(),Xe=256,Ze=192,G=new Set}));function $e(){X=0,Z=0,Q.clear()}function et(){return J}function tt(){if(!q){q=!0;try{_e()}catch{}i(it),nt().catch(()=>{})}}async function nt(){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE)return;let e={project:pe(process.cwd())};await Promise.allSettled([Re(e),ce(e),Ve(30,e)])}function rt(e){try{let t=x();return e.startsWith(t)}catch{return!1}}async function it(e){if(!s()||process.env.CLAUDE_SKILL_LEARNING_DISABLE||!e.querySource?.startsWith(`repl_main_thread`)||e.toolUseContext.agentId)return;let t=process.cwd();if(rt(t))return;let n=pe(t),r={project:n};++J;let i=[];for(let t of st(e.messages,n))i.push(await de(t,r));let a=(await ue(r)).filter(e=>e.source===`tool-hook`&&e.sessionId===`runtime-session`&&typeof e.timestamp==`string`&&e.timestamp>Y);i.push(...a);for(let e of a)e.timestamp>Y&&(Y=e.timestamp);if(i.length===0)return;let o=Date.now(),{llm:c}=f(),l=i.length>=5&&X<c.maxCallsPerSession&&o-Z>=c.cooldownMs,u;if(l)X++,Z=o,u=await ge(i,{project:n});else{let{heuristicObserverBackend:e}=await import(`./sessionObserver-Lb1c5FPy.js`),t=e.analyze(i,{project:n});u=Array.isArray(t)?t:await t}for(let e of u)await Fe(ee(e),r);await ot(r)}function at(){J=0,Y=``,$e()}async function ot(e){let n=await H(e),r=process.cwd(),i=[S(r,`.claude`,`skills`),S(t(),`skills`)],a=F(n).filter(e=>e.target===`skill`&&h(e.instincts));for(let e of a){let t=await se(e.instincts,{cwd:r,scope:e.instincts[0]?.scope??`project`},i);if(t.action===`append-evidence`)continue;let n=t.draft;C(S(n.outputPath,`SKILL.md`))||await re(ie(n,await y(`skill`,n,i)))}let o=L(n,{cwd:r});for(let e of o)(await y(`command`,e,[S(r,`.claude`,`commands`),S(t(),`commands`)])).length>0||await O(e);let s=R(n,{cwd:r});for(let e of s)(await y(`agent`,e,[S(r,`.claude`,`agents`),S(t(),`agents`)])).length>0||await M(e);await qe()}function st(e,t){let n=K,r={sessionId:n,projectId:t.projectId,projectName:t.projectName,cwd:t.cwd,timestamp:new Date().toISOString(),source:`hook`};return e.flatMap(e=>{let t=`${n}:${String(e.uuid)}`;if(Q.has(t))return[];if(Q.add(t),Q.size>dt){let e=Q.size-$,t=Q.values();for(let n=0;n<e;n++){let e=t.next();if(e.done)break;Q.delete(e.value)}}if(e.type===`user`){let t=ut(e.message?.content);if(t.length>0)return t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_complete`,toolName:e.toolName,toolOutput:e.output,outcome:e.isError?`failure`:`success`}));let n=ct(e.message?.content);return n.trim()?[{...r,id:crypto.randomUUID(),event:`user_message`,messageText:n}]:[]}if(e.type===`assistant`){let t=lt(e.message?.content),n=ct(e.message?.content);return[...t.map(e=>({...r,id:crypto.randomUUID(),event:`tool_start`,toolName:e.toolName,toolInput:e.input})),...n.trim()?[{...r,id:crypto.randomUUID(),event:`assistant_message`,messageText:n}]:[]]}return[]})}function ct(e){return typeof e==`string`?e:Array.isArray(e)?e.map(e=>{if(!e||typeof e!=`object`)return``;let t=e;return typeof t.text==`string`?t.text:``}).filter(Boolean).join(`
10
10
  `):``}function lt(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_use`?[{toolName:String(t.name??`unknown_tool`),input:le(t.input)}]:[]}):[]}function ut(e){return Array.isArray(e)?e.flatMap(e=>{if(!e||typeof e!=`object`)return[];let t=e;return t.type===`tool_result`?[{toolName:String(t.name??t.tool_name??`unknown_tool`),output:le(t.content),isError:t.is_error===!0}]:[]}):[]}var K,q,J,Y,X,Z,Q,dt,$,ft=e((()=>{r(),ne(),c(),b(),fe(),he(),d(),me(),W(),oe(),z(),v(),_(),A(),P(),Qe(),n(),K=`runtime-session`,q=!1,J=0,Y=``,X=0,Z=0,Q=new Set,dt=1e3,$=500}));export{O as A,j as C,D,M as E,k as O,z as S,P as T,I as _,$e as a,L as b,qe as c,Be as d,W as f,Fe as g,V as h,ft as i,A as k,Ke as l,Ve as m,et as n,at as o,H as p,tt as r,it as s,K as t,Qe as u,F as v,N as w,Ne as x,R as y};
@@ -0,0 +1 @@
1
+ import{sA as e,uA as t}from"./loadAgentsDir-HZ19tmOZ.js";t();export{e as SandboxManager};
@@ -1 +1 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{Q as t,Rn as n,T as r,b as i,i as a,n as o,nt as s,p as c,r as l,t as u,v as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{cn as m,j as h}from"./state-sIHsFpDu.js";import{Za as g,no as _,oo as v}from"./paths-o5iA-EnQ.js";import{i as y,o as b}from"./platform-CuyedWpe.js";import{Nx as x,Px as S,cA as C,pA as w,sA as T,uA as E}from"./loadAgentsDir-DF6FgRn-.js";import{t as D}from"./useKeybinding-FsOnjW6T.js";import{relative as O}from"path";function k(){let e=T.isSandboxingEnabled(),t=T.checkDependencies(),n=t.warnings.length>0?(0,A.jsx)(f,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,A.jsx)(i,{dimColor:!0,children:e},t))}):null;if(!e)return(0,A.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,A.jsx)(i,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let r=T.getFsReadConfig(),a=T.getFsWriteConfig(),o=T.getNetworkRestrictionConfig(),s=T.getAllowUnixSockets(),c=T.getExcludedCommands(),l=T.getLinuxGlobPatternWarnings();return(0,A.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,A.jsxs)(f,{flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,A.jsx)(i,{dimColor:!0,children:c.length>0?c.join(`, `):`None`})]}),r.denyOnly.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,A.jsxs)(i,{dimColor:!0,children:[`Denied: `,r.denyOnly.join(`, `)]}),r.allowWithinDeny&&r.allowWithinDeny.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Allowed within denied: `,r.allowWithinDeny.join(`, `)]})]}),a.allowOnly.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,A.jsxs)(i,{dimColor:!0,children:[`Allowed: `,a.allowOnly.join(`, `)]}),a.denyWithinAllow.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Denied within allowed: `,a.denyWithinAllow.join(`, `)]})]}),(o.allowedHosts&&o.allowedHosts.length>0||o.deniedHosts&&o.deniedHosts.length>0)&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsxs)(i,{bold:!0,color:`permission`,children:[`Network Restrictions`,w()?` (Managed)`:``,`:`]}),o.allowedHosts&&o.allowedHosts.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Allowed: `,o.allowedHosts.join(`, `)]}),o.deniedHosts&&o.deniedHosts.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Denied: `,o.deniedHosts.join(`, `)]})]}),s&&s.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,A.jsx)(i,{dimColor:!0,children:s.join(`, `)})]}),l.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,A.jsxs)(i,{dimColor:!0,children:[`The following patterns will be ignored: `,l.slice(0,3).join(`, `),l.length>3&&` (${l.length-3} more)`]})]}),n]})}var A,j=e((()=>{n(),u(),E(),A=p()}));function M({depCheck:e}){let t=y()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),r=e.errors.some(e=>e.includes(`bwrap`)),a=e.errors.some(e=>e.includes(`socat`)),o=e.warnings.length>0,s=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,N.jsxs)(f,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,N.jsx)(f,{flexDirection:`column`,children:(0,N.jsxs)(i,{children:[`seatbelt: `,(0,N.jsx)(i,{color:`success`,children:`built-in (macOS)`})]})}),(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`ripgrep (rg): `,n?(0,N.jsx)(i,{color:`error`,children:`not found`}):(0,N.jsx)(i,{color:`success`,children:`found`})]}),n&&(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`bubblewrap (bwrap):`,` `,r?(0,N.jsx)(i,{color:`error`,children:`not installed`}):(0,N.jsx)(i,{color:`success`,children:`installed`})]}),r&&(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`socat: `,a?(0,N.jsx)(i,{color:`error`,children:`not installed`}):(0,N.jsx)(i,{color:`success`,children:`installed`})]}),a&&(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`seccomp filter:`,` `,o?(0,N.jsx)(i,{color:`warning`,children:`not installed`}):(0,N.jsx)(i,{color:`success`,children:`installed`}),o&&(0,N.jsx)(i,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),o&&(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,N.jsxs)(i,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),s.map(e=>(0,N.jsx)(i,{color:`error`,children:e},e))]})}var N,P=e((()=>{n(),u(),b(),N=p()}));function F({onComplete:e}){let t=T.isSandboxingEnabled(),n=T.areSandboxSettingsLockedByPolicy(),r=T.areUnsandboxedCommandsAllowed();return t?n?(0,L.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(i,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,L.jsx)(f,{marginTop:1,children:(0,L.jsxs)(i,{dimColor:!0,children:[`Current setting: `,r?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,L.jsx)(I,{onComplete:e,currentMode:r?`open`:`closed`}):(0,L.jsx)(f,{flexDirection:`column`,paddingY:1,children:(0,L.jsx)(i,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function I({onComplete:e,currentMode:n}){let[o]=r(),{headerFocused:s,focusHeader:c}=a(),l=d(`success`,o)(`(current)`),u=[{label:n===`open`?`Allow unsandboxed fallback ${l}`:`Allow unsandboxed fallback`,value:`open`},{label:n===`closed`?`Strict sandbox mode ${l}`:`Strict sandbox mode`,value:`closed`}];async function p(t){let n=t;await T.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,L.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(f,{marginBottom:1,children:(0,L.jsx)(i,{bold:!0,children:`Configure Overrides:`})}),(0,L.jsx)(x,{options:u,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:c,isDisabled:s}),(0,L.jsxs)(f,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,L.jsxs)(i,{dimColor:!0,children:[(0,L.jsx)(i,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Claude can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,L.jsxs)(i,{dimColor:!0,children:[(0,L.jsx)(i,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,L.jsxs)(i,{dimColor:!0,children:[`Learn more:`,` `,(0,L.jsx)(t,{url:`https://code.claude.com/docs/en/sandboxing#configure-sandboxing`,children:`code.claude.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var L,R=e((()=>{n(),u(),E(),S(),L=p()}));function z({onComplete:e,depCheck:t}){let[n]=r(),i=T.isSandboxingEnabled(),a=T.isAutoAllowBashIfSandboxedEnabled(),u=t.warnings.length>0,f=_().sandbox?.network?.allowAllUnixSockets,p=u&&!f,m=i?a?`auto-allow`:`regular`:`disabled`,h=d(`success`,n)(`(current)`),g=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${h}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${h}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${h}`:`No Sandbox`,value:`disabled`}];async function v(t){switch(t){case`auto-allow`:await T.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await T.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await T.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}s({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,V.jsx)(o,{title:`Mode`,children:(0,V.jsx)(B,{showSocketWarning:p,options:g,onSelect:v,onComplete:e})},`mode`),b=(0,V.jsx)(o,{title:`Overrides`,children:(0,V.jsx)(F,{onComplete:e})},`overrides`),x=(0,V.jsx)(o,{title:`Config`,children:(0,V.jsx)(k,{})},`config`);return(0,V.jsx)(c,{color:`permission`,children:(0,V.jsx)(l,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:t.errors.length>0?[(0,V.jsx)(o,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:t})},`dependencies`)]:[y,...u?[(0,V.jsx)(o,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:t})},`dependencies`)]:[],b,x]})})}function B({showSocketWarning:e,options:n,onSelect:r,onComplete:o}){let{headerFocused:s,focusHeader:c}=a();return(0,V.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[e&&(0,V.jsx)(f,{marginBottom:1,children:(0,V.jsx)(i,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,V.jsx)(f,{marginBottom:1,children:(0,V.jsx)(i,{bold:!0,children:`Configure Mode:`})}),(0,V.jsx)(x,{options:n,onChange:r,onCancel:()=>o(void 0,{display:`skip`}),onUpFromFirstItem:c,isDisabled:s}),(0,V.jsxs)(f,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,V.jsxs)(i,{dimColor:!0,children:[(0,V.jsx)(i,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,V.jsxs)(i,{dimColor:!0,children:[`Learn more: `,(0,V.jsx)(t,{url:`https://code.claude.com/docs/en/sandboxing`,children:`code.claude.com/docs/en/sandboxing`})]})]})]})}var V,H=e((()=>{n(),u(),D(),E(),v(),S(),j(),P(),R(),V=p()}));async function U(e,t,n){let r=_().theme||`light`,i=y();if(!T.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(d(`error`,r)(t)),null}let a=T.checkDependencies();if(!T.isPlatformInEnabledList())return e(d(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(T.areSandboxSettingsLockedByPolicy())return e(d(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let o=n?.trim()||``;if(!o)return(0,W.jsx)(z,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(d(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);C(n);let i=g(`localSettings`),a=i?O(h(),i):`.claude/settings.local.json`;return e(d(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(d(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var W;e((()=>{n(),m(),H(),u(),b(),E(),v(),W=p()}))();export{U as call};
1
+ import{n as e}from"./chunk-DR8-3Aex.js";import{Q as t,Rn as n,T as r,b as i,i as a,n as o,nt as s,p as c,r as l,t as u,v as d,x as f}from"./src-Di342QoJ.js";import{t as p}from"./jsx-runtime-D-D469L8.js";import{cn as m,j as h}from"./state-sIHsFpDu.js";import{Za as g,no as _,oo as v}from"./paths-D8Fx3kUi.js";import{i as y,o as b}from"./platform-CuyedWpe.js";import{Nx as x,Px as S,cA as C,pA as w,sA as T,uA as E}from"./loadAgentsDir-HZ19tmOZ.js";import{t as D}from"./useKeybinding-FsOnjW6T.js";import{relative as O}from"path";function k(){let e=T.isSandboxingEnabled(),t=T.checkDependencies(),n=t.warnings.length>0?(0,A.jsx)(f,{marginTop:1,flexDirection:`column`,children:t.warnings.map((e,t)=>(0,A.jsx)(i,{dimColor:!0,children:e},t))}):null;if(!e)return(0,A.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,A.jsx)(i,{color:`subtle`,children:`Sandbox is not enabled`}),n]});let r=T.getFsReadConfig(),a=T.getFsWriteConfig(),o=T.getNetworkRestrictionConfig(),s=T.getAllowUnixSockets(),c=T.getExcludedCommands(),l=T.getLinuxGlobPatternWarnings();return(0,A.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,A.jsxs)(f,{flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Excluded Commands:`}),(0,A.jsx)(i,{dimColor:!0,children:c.length>0?c.join(`, `):`None`})]}),r.denyOnly.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Filesystem Read Restrictions:`}),(0,A.jsxs)(i,{dimColor:!0,children:[`Denied: `,r.denyOnly.join(`, `)]}),r.allowWithinDeny&&r.allowWithinDeny.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Allowed within denied: `,r.allowWithinDeny.join(`, `)]})]}),a.allowOnly.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Filesystem Write Restrictions:`}),(0,A.jsxs)(i,{dimColor:!0,children:[`Allowed: `,a.allowOnly.join(`, `)]}),a.denyWithinAllow.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Denied within allowed: `,a.denyWithinAllow.join(`, `)]})]}),(o.allowedHosts&&o.allowedHosts.length>0||o.deniedHosts&&o.deniedHosts.length>0)&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsxs)(i,{bold:!0,color:`permission`,children:[`Network Restrictions`,w()?` (Managed)`:``,`:`]}),o.allowedHosts&&o.allowedHosts.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Allowed: `,o.allowedHosts.join(`, `)]}),o.deniedHosts&&o.deniedHosts.length>0&&(0,A.jsxs)(i,{dimColor:!0,children:[`Denied: `,o.deniedHosts.join(`, `)]})]}),s&&s.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`permission`,children:`Allowed Unix Sockets:`}),(0,A.jsx)(i,{dimColor:!0,children:s.join(`, `)})]}),l.length>0&&(0,A.jsxs)(f,{marginTop:1,flexDirection:`column`,children:[(0,A.jsx)(i,{bold:!0,color:`warning`,children:`⚠ Warning: Glob patterns not fully supported on Linux`}),(0,A.jsxs)(i,{dimColor:!0,children:[`The following patterns will be ignored: `,l.slice(0,3).join(`, `),l.length>3&&` (${l.length-3} more)`]})]}),n]})}var A,j=e((()=>{n(),u(),E(),A=p()}));function M({depCheck:e}){let t=y()===`macos`,n=e.errors.some(e=>e.includes(`ripgrep`)),r=e.errors.some(e=>e.includes(`bwrap`)),a=e.errors.some(e=>e.includes(`socat`)),o=e.warnings.length>0,s=e.errors.filter(e=>!e.includes(`ripgrep`)&&!e.includes(`bwrap`)&&!e.includes(`socat`));return(0,N.jsxs)(f,{flexDirection:`column`,paddingY:1,gap:1,children:[t&&(0,N.jsx)(f,{flexDirection:`column`,children:(0,N.jsxs)(i,{children:[`seatbelt: `,(0,N.jsx)(i,{color:`success`,children:`built-in (macOS)`})]})}),(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`ripgrep (rg): `,n?(0,N.jsx)(i,{color:`error`,children:`not found`}):(0,N.jsx)(i,{color:`success`,children:`found`})]}),n&&(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· `,t?`brew install ripgrep`:`apt install ripgrep`]})]}),!t&&(0,N.jsxs)(N.Fragment,{children:[(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`bubblewrap (bwrap):`,` `,r?(0,N.jsx)(i,{color:`error`,children:`not installed`}):(0,N.jsx)(i,{color:`success`,children:`installed`})]}),r&&(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· apt install bubblewrap`]})]}),(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`socat: `,a?(0,N.jsx)(i,{color:`error`,children:`not installed`}):(0,N.jsx)(i,{color:`success`,children:`installed`})]}),a&&(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· apt install socat`]})]}),(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{children:[`seccomp filter:`,` `,o?(0,N.jsx)(i,{color:`warning`,children:`not installed`}):(0,N.jsx)(i,{color:`success`,children:`installed`}),o&&(0,N.jsx)(i,{dimColor:!0,children:` (required to block unix domain sockets)`})]}),o&&(0,N.jsxs)(f,{flexDirection:`column`,children:[(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· npm install -g @anthropic-ai/sandbox-runtime`]}),(0,N.jsxs)(i,{dimColor:!0,children:[` `,`· or copy vendor/seccomp/* from sandbox-runtime and set`]}),(0,N.jsxs)(i,{dimColor:!0,children:[` `,`sandbox.seccomp.bpfPath and applyPath in settings.json`]})]})]})]}),s.map(e=>(0,N.jsx)(i,{color:`error`,children:e},e))]})}var N,P=e((()=>{n(),u(),b(),N=p()}));function F({onComplete:e}){let t=T.isSandboxingEnabled(),n=T.areSandboxSettingsLockedByPolicy(),r=T.areUnsandboxedCommandsAllowed();return t?n?(0,L.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(i,{color:`subtle`,children:`Override settings are managed by a higher-priority configuration and cannot be changed locally.`}),(0,L.jsx)(f,{marginTop:1,children:(0,L.jsxs)(i,{dimColor:!0,children:[`Current setting: `,r?`Allow unsandboxed fallback`:`Strict sandbox mode`]})})]}):(0,L.jsx)(I,{onComplete:e,currentMode:r?`open`:`closed`}):(0,L.jsx)(f,{flexDirection:`column`,paddingY:1,children:(0,L.jsx)(i,{color:`subtle`,children:`Sandbox is not enabled. Enable sandbox to configure override settings.`})})}function I({onComplete:e,currentMode:n}){let[o]=r(),{headerFocused:s,focusHeader:c}=a(),l=d(`success`,o)(`(current)`),u=[{label:n===`open`?`Allow unsandboxed fallback ${l}`:`Allow unsandboxed fallback`,value:`open`},{label:n===`closed`?`Strict sandbox mode ${l}`:`Strict sandbox mode`,value:`closed`}];async function p(t){let n=t;await T.setSandboxSettings({allowUnsandboxedCommands:n===`open`}),e(n===`open`?`✓ Unsandboxed fallback allowed - commands can run outside sandbox when necessary`:"✓ Strict sandbox mode - all commands must run in sandbox or be excluded via the `excludedCommands` option")}return(0,L.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[(0,L.jsx)(f,{marginBottom:1,children:(0,L.jsx)(i,{bold:!0,children:`Configure Overrides:`})}),(0,L.jsx)(x,{options:u,onChange:p,onCancel:()=>e(void 0,{display:`skip`}),onUpFromFirstItem:c,isDisabled:s}),(0,L.jsxs)(f,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,L.jsxs)(i,{dimColor:!0,children:[(0,L.jsx)(i,{bold:!0,dimColor:!0,children:`Allow unsandboxed fallback:`}),` `,`When a command fails due to sandbox restrictions, Claude can retry with dangerouslyDisableSandbox to run outside the sandbox (falling back to default permissions).`]}),(0,L.jsxs)(i,{dimColor:!0,children:[(0,L.jsx)(i,{bold:!0,dimColor:!0,children:`Strict sandbox mode:`}),` `,`All bash commands invoked by the model must run in the sandbox unless they are explicitly listed in excludedCommands.`]}),(0,L.jsxs)(i,{dimColor:!0,children:[`Learn more:`,` `,(0,L.jsx)(t,{url:`https://code.claude.com/docs/en/sandboxing#configure-sandboxing`,children:`code.claude.com/docs/en/sandboxing#configure-sandboxing`})]})]})]})}var L,R=e((()=>{n(),u(),E(),S(),L=p()}));function z({onComplete:e,depCheck:t}){let[n]=r(),i=T.isSandboxingEnabled(),a=T.isAutoAllowBashIfSandboxedEnabled(),u=t.warnings.length>0,f=_().sandbox?.network?.allowAllUnixSockets,p=u&&!f,m=i?a?`auto-allow`:`regular`:`disabled`,h=d(`success`,n)(`(current)`),g=[{label:m===`auto-allow`?`Sandbox BashTool, with auto-allow ${h}`:`Sandbox BashTool, with auto-allow`,value:`auto-allow`},{label:m===`regular`?`Sandbox BashTool, with regular permissions ${h}`:`Sandbox BashTool, with regular permissions`,value:`regular`},{label:m===`disabled`?`No Sandbox ${h}`:`No Sandbox`,value:`disabled`}];async function v(t){switch(t){case`auto-allow`:await T.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!0}),e(`✓ Sandbox enabled with auto-allow for bash commands`);break;case`regular`:await T.setSandboxSettings({enabled:!0,autoAllowBashIfSandboxed:!1}),e(`✓ Sandbox enabled with regular bash permissions`);break;case`disabled`:await T.setSandboxSettings({enabled:!1,autoAllowBashIfSandboxed:!1}),e(`○ Sandbox disabled`);break}}s({"confirm:no":()=>e(void 0,{display:`skip`})},{context:`Settings`});let y=(0,V.jsx)(o,{title:`Mode`,children:(0,V.jsx)(B,{showSocketWarning:p,options:g,onSelect:v,onComplete:e})},`mode`),b=(0,V.jsx)(o,{title:`Overrides`,children:(0,V.jsx)(F,{onComplete:e})},`overrides`),x=(0,V.jsx)(o,{title:`Config`,children:(0,V.jsx)(k,{})},`config`);return(0,V.jsx)(c,{color:`permission`,children:(0,V.jsx)(l,{title:`Sandbox:`,color:`permission`,defaultTab:`Mode`,children:t.errors.length>0?[(0,V.jsx)(o,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:t})},`dependencies`)]:[y,...u?[(0,V.jsx)(o,{title:`Dependencies`,children:(0,V.jsx)(M,{depCheck:t})},`dependencies`)]:[],b,x]})})}function B({showSocketWarning:e,options:n,onSelect:r,onComplete:o}){let{headerFocused:s,focusHeader:c}=a();return(0,V.jsxs)(f,{flexDirection:`column`,paddingY:1,children:[e&&(0,V.jsx)(f,{marginBottom:1,children:(0,V.jsx)(i,{color:`warning`,children:`Cannot block unix domain sockets (see Dependencies tab)`})}),(0,V.jsx)(f,{marginBottom:1,children:(0,V.jsx)(i,{bold:!0,children:`Configure Mode:`})}),(0,V.jsx)(x,{options:n,onChange:r,onCancel:()=>o(void 0,{display:`skip`}),onUpFromFirstItem:c,isDisabled:s}),(0,V.jsxs)(f,{flexDirection:`column`,marginTop:1,gap:1,children:[(0,V.jsxs)(i,{dimColor:!0,children:[(0,V.jsx)(i,{bold:!0,dimColor:!0,children:`Auto-allow mode:`}),` `,`Commands will try to run in the sandbox automatically, and attempts to run outside of the sandbox fallback to regular permissions. Explicit ask/deny rules are always respected.`]}),(0,V.jsxs)(i,{dimColor:!0,children:[`Learn more: `,(0,V.jsx)(t,{url:`https://code.claude.com/docs/en/sandboxing`,children:`code.claude.com/docs/en/sandboxing`})]})]})]})}var V,H=e((()=>{n(),u(),D(),E(),v(),S(),j(),P(),R(),V=p()}));async function U(e,t,n){let r=_().theme||`light`,i=y();if(!T.isSupportedPlatform()){let t=i===`wsl`?`Error: Sandboxing requires WSL2. WSL1 is not supported.`:`Error: Sandboxing is currently only supported on macOS, Linux, and WSL2.`;return e(d(`error`,r)(t)),null}let a=T.checkDependencies();if(!T.isPlatformInEnabledList())return e(d(`error`,r)(`Error: Sandboxing is disabled for this platform (${i}) via the enabledPlatforms setting.`)),null;if(T.areSandboxSettingsLockedByPolicy())return e(d(`error`,r)(`Error: Sandbox settings are overridden by a higher-priority configuration and cannot be changed locally.`)),null;let o=n?.trim()||``;if(!o)return(0,W.jsx)(z,{onComplete:e,depCheck:a});if(o){let t=o.split(` `)[0];if(t===`exclude`){let t=o.slice(8).trim();if(!t)return e(d(`error`,r)(`Error: Please provide a command pattern to exclude (e.g., /sandbox exclude "npm run test:*")`)),null;let n=t.replace(/^["']|["']$/g,``);C(n);let i=g(`localSettings`),a=i?O(h(),i):`.claude/settings.local.json`;return e(d(`success`,r)(`Added "${n}" to excluded commands in ${a}`)),null}else return e(d(`error`,r)(`Error: Unknown subcommand "${t}". Available subcommand: exclude`)),null}return null}var W;e((()=>{n(),m(),H(),u(),b(),E(),v(),W=p()}))();export{U as call};
@@ -0,0 +1 @@
1
+ import{Yc as e,Zc as t}from"./loadAgentsDir-HZ19tmOZ.js";e();export{t as isSearchExtraToolsEnabled};