@readmagic/workmate 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (415) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-DJRkEz7o.js → AddWorkspaceDirectory-CFrrXnt9.js} +1 -1
  2. package/dist/chunks/{App-iJu5qyiF.js → App-Buad9Llp.js} +1 -1
  3. package/dist/chunks/{ApproveApiKey-CRejTHUw.js → ApproveApiKey-B2HJUD7h.js} +1 -1
  4. package/dist/chunks/ApproveApiKey-BQbHdvc3.js +1 -0
  5. package/dist/chunks/{AssistantSessionChooser-CBLQ1v-J.js → AssistantSessionChooser-4lm4eXQ8.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-D4qA0M5O.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-D1FCKVOi.js → BypassPermissionsModeDialog-DllL8dxU.js} +1 -1
  8. package/dist/chunks/ClaudeMdExternalIncludesDialog--ywODh81.js +1 -0
  9. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CI0yF6sZ.js → ClaudeMdExternalIncludesDialog-BZSyRqeq.js} +1 -1
  10. package/dist/chunks/ConsoleOAuthFlow-Wkfw7Ts-.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-D1rrMxeP.js → DesktopHandoff-DaP4Riar.js} +1 -1
  12. package/dist/chunks/{DiffDialog-BKcfKx7O.js → DiffDialog-B7hx8i_Y.js} +2 -2
  13. package/dist/chunks/Doctor-89OgoAUA.js +1 -0
  14. package/dist/chunks/Doctor-CuKJ-nGt.js +3 -0
  15. package/dist/chunks/ExitFlow-DnPydE17.js +2 -0
  16. package/dist/chunks/{Feedback-bEUtrHia.js → Feedback-SmGiR3mf.js} +2 -2
  17. package/dist/chunks/Grove-CjN9DO47.js +11 -0
  18. package/dist/chunks/Grove-Cq88VBmM.js +1 -0
  19. package/dist/chunks/{HybridTransport-9fTBC2Pv.js → HybridTransport-rK83Qijz.js} +1 -1
  20. package/dist/chunks/{InvalidConfigDialog-9M-1nfZ6.js → InvalidConfigDialog-DdO0AxyF.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-B2F6pryH.js → InvalidSettingsDialog-s1G0DwXF.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-NRfIjdlj.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-BPBb7Npe.js → McpParsingWarnings-Du5IxZos.js} +1 -1
  24. package/dist/chunks/MessageSelector-iIroHvXo.js +3 -0
  25. package/dist/chunks/Messages-D4Hm4gaY.js +11 -0
  26. package/dist/chunks/{Onboarding-cHcnsBGp.js → Onboarding-BiZByBK-.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-CWCD_RpM.js → OverageCreditUpsell-BM7szLgm.js} +1 -1
  28. package/dist/chunks/PluginSettings-uY5KTCtK.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-D5sAO6y-.js → PromptInputFooterSuggestions-BmsFdOu9.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-n6hAdsto.js → PromptInputHelpMenu-DX-0wEDo.js} +1 -1
  31. package/dist/chunks/QueryEngine-CGYaShXD.js +1 -0
  32. package/dist/chunks/REPL-CRJB2t2z.js +142 -0
  33. package/dist/chunks/REPL-u4Yq29Du.js +1 -0
  34. package/dist/chunks/{RemoteCallout-CiA4rCEs.js → RemoteCallout-B-tyvQOe.js} +1 -1
  35. package/dist/chunks/{RemoteSessionManager-zdHfmvfj.js → RemoteSessionManager-DCd0O5_l.js} +2 -2
  36. package/dist/chunks/ResumeConversation-DAAXlOCd.js +1 -0
  37. package/dist/chunks/{SSETransport-BPbhCa2f.js → SSETransport-5VK5okFv.js} +1 -1
  38. package/dist/chunks/SearchExtraToolsTool-B-7Bworf.js +1 -0
  39. package/dist/chunks/Settings-CUjWlncb.js +2 -0
  40. package/dist/chunks/{TeleportProgress-DrulEQ7z.js → TeleportProgress-DxN0bQL2.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-D3FOLr0P.js → TeleportRepoMismatchDialog-A5Ss0kuk.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-DI5iRFND.js → TeleportResumeWrapper-Bz14mUqR.js} +1 -1
  43. package/dist/chunks/{ThemePicker-CQ7dfFtv.js → ThemePicker-CVSRqTzW.js} +1 -1
  44. package/dist/chunks/TrustDialog-CY8an_Tg.js +1 -0
  45. package/dist/chunks/{ValidationErrorsList-CPYeuppg.js → ValidationErrorsList-BYsDtAvX.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-C-UXdIng.js → WelcomeV2-C1BfrqC5.js} +1 -1
  47. package/dist/chunks/{add-dir-xTz4COgn.js → add-dir-DfLYgwox.js} +1 -1
  48. package/dist/chunks/{agentDisplay-BuSReYxu.js → agentDisplay-CMmHIl86.js} +1 -1
  49. package/dist/chunks/{agents-CiLlKN2I.js → agents-DE_4mAHG.js} +1 -1
  50. package/dist/chunks/agents-DJtPfvnL.js +103 -0
  51. package/dist/chunks/allErrors-CQE2k0zO.js +1 -0
  52. package/dist/chunks/{ant-CBIfqmAb.js → ant-ClQkuQjZ.js} +1 -1
  53. package/dist/chunks/{api-B-5jqiMg.js → api-2cdIPaeq.js} +1 -1
  54. package/dist/chunks/api-CG-lhKe-.js +1 -0
  55. package/dist/chunks/{assistant-XOnU01yl.js → assistant-Bje16tQx.js} +1 -1
  56. package/dist/chunks/auth-DMfEiQrC.js +1 -0
  57. package/dist/chunks/auth-D_cGl8WD.js +1 -0
  58. package/dist/chunks/{auth-DT2yxy94.js → auth-DqcKPbw8.js} +1 -1
  59. package/dist/chunks/{autoMode-CEMflt3g.js → autoMode-ZW70mpr0.js} +5 -5
  60. package/dist/chunks/{autonomy-_N8aDaA8.js → autonomy-CwbWsCnv.js} +1 -1
  61. package/dist/chunks/autonomy-Oui8yK8G.js +15 -0
  62. package/dist/chunks/{autonomyPanel-I4yCy3Fr.js → autonomyPanel-Mq50H7iM.js} +1 -1
  63. package/dist/chunks/backgroundHousekeeping-BpLtI45r.js +1 -0
  64. package/dist/chunks/backgroundHousekeeping-DtJNx4Ja.js +17 -0
  65. package/dist/chunks/{branch-BIX-pyHp.js → branch-DU5O9KZ0.js} +1 -1
  66. package/dist/chunks/{break-cache-BQfgkNAo.js → break-cache-C_p7Kmx2.js} +3 -3
  67. package/dist/chunks/{bridge-CYskzVt8.js → bridge-DNNxtPlz.js} +2 -2
  68. package/dist/chunks/{bridgeConfig-5p_w4s5r.js → bridgeConfig-CE6dMsiJ.js} +1 -1
  69. package/dist/chunks/bridgeConfig-DP9dD1Cv.js +1 -0
  70. package/dist/chunks/{bridgeEnabled-DhFrLTbG.js → bridgeEnabled-Cc0mGlTb.js} +1 -1
  71. package/dist/chunks/bridgeEnabled-D8wP3DWQ.js +1 -0
  72. package/dist/chunks/bridgeMain-CwxMa_pd.js +1 -0
  73. package/dist/chunks/bridgeMain-D11t1BYQ.js +68 -0
  74. package/dist/chunks/{bridgeMessaging-B5Lbzr8e.js → bridgeMessaging-DdvApEqW.js} +1 -1
  75. package/dist/chunks/{bridgePointer-MqLe5Asm.js → bridgePointer-DqHMHa2B.js} +1 -1
  76. package/dist/chunks/{btw-CWWFO7u8.js → btw-CejSEdNl.js} +1 -1
  77. package/dist/chunks/{caches-DPqPIogk.js → caches-5HVQSevy.js} +2 -2
  78. package/dist/chunks/caches-B-nJoHLM.js +1 -0
  79. package/dist/chunks/{ccrClient-CTLnU9Y1.js → ccrClient-BFyfO67b.js} +1 -1
  80. package/dist/chunks/{claudeDesktop-Cx31Ugjp.js → claudeDesktop-Fe-QL-sN.js} +1 -1
  81. package/dist/chunks/{clear-DCAgZwc4.js → clear-D8m2utXW.js} +1 -1
  82. package/dist/chunks/client-C6MbjvOB.js +17 -0
  83. package/dist/chunks/client-DKXCfdde.js +1 -0
  84. package/dist/chunks/client-xxikkAoZ.js +1 -0
  85. package/dist/chunks/{color-CmJGInHL.js → color-DWhgZH7A.js} +1 -1
  86. package/dist/chunks/commands-CxJpmEKF.js +1 -0
  87. package/dist/chunks/commitAttribution-DM6SBMwl.js +1 -0
  88. package/dist/chunks/{commitAttribution-CGZr7XNO.js → commitAttribution-DPnHHKSA.js} +1 -1
  89. package/dist/chunks/compact-CblM7306.js +2 -0
  90. package/dist/chunks/config-BLVBFi5v.js +1 -0
  91. package/dist/chunks/config-CMnqm6Se.js +1 -0
  92. package/dist/chunks/{config-3m_9zSrj.js → config-DRDuVyzE.js} +2 -2
  93. package/dist/chunks/{context-C9V4GF0n.js → context-CdSMMM-0.js} +1 -1
  94. package/dist/chunks/context-noninteractive-CPkf2vB9.js +1 -0
  95. package/dist/chunks/{context-noninteractive-BmC4o5xo.js → context-noninteractive-DNury4JI.js} +5 -5
  96. package/dist/chunks/conversation-DCMw_rsE.js +1 -0
  97. package/dist/chunks/conversation-pUtvc-cE.js +1 -0
  98. package/dist/chunks/{createSSHSession-BL6j0AU5.js → createSSHSession-BOdTAX3N.js} +1 -1
  99. package/dist/chunks/{createSession-D_sgO1Xy.js → createSession-8Ei-Lj7V.js} +1 -1
  100. package/dist/chunks/createSession-CjqxVh_Q.js +1 -0
  101. package/dist/chunks/crossProjectResume-Bj_Pe8oe.js +40 -0
  102. package/dist/chunks/{datadog-UkGdjL8-.js → datadog-DqHxqiwY.js} +1 -1
  103. package/dist/chunks/{desktop-HbYKh-VK.js → desktop-Z5FAfunZ.js} +1 -1
  104. package/dist/chunks/{diff-nTV17iWX.js → diff-CJEKvOA5.js} +1 -1
  105. package/dist/chunks/doctor-BA2ZLDTl.js +1 -0
  106. package/dist/chunks/{entry-CCFI6-gM.js → entry-DE0uMIf0.js} +4 -4
  107. package/dist/chunks/envLessBridgeConfig-B-LKYNvv.js +1 -0
  108. package/dist/chunks/envLessBridgeConfig-DyD9XCda.js +1 -0
  109. package/dist/chunks/{esm-CGoYrggU.js → esm-5w3xFBnt.js} +1 -1
  110. package/dist/chunks/exit-Dt9kHtJO.js +1 -0
  111. package/dist/chunks/{extra-usage-g2Pw4zt_.js → extra-usage-C7E2Z1p1.js} +1 -1
  112. package/dist/chunks/extra-usage-D0Kkjp-2.js +1 -0
  113. package/dist/chunks/{extra-usage-core-DLYHAInT.js → extra-usage-core-DjdaD1qO.js} +1 -1
  114. package/dist/chunks/{extra-usage-noninteractive-D8iszH3c.js → extra-usage-noninteractive-BnD1RhKK.js} +1 -1
  115. package/dist/chunks/{extraUsage-C2Ylufhj.js → extraUsage-CpgRTcMk.js} +1 -1
  116. package/dist/chunks/extractMemories-DhUprYa7.js +1 -0
  117. package/dist/chunks/{fast-Dx2fTmWr.js → fast-C4ZevUNL.js} +1 -1
  118. package/dist/chunks/fast-CChxlAAF.js +1 -0
  119. package/dist/chunks/{feedback-DCQ4pJ3v.js → feedback-BIhBhV6n.js} +1 -1
  120. package/dist/chunks/{firstPartyEventLogger-BNGPPBNP.js → firstPartyEventLogger-BXY1IJ2D.js} +2 -2
  121. package/dist/chunks/firstPartyEventLogger-CnkGSojw.js +1 -0
  122. package/dist/chunks/{flushGate-XaheIZZT.js → flushGate-CgHq81Gw.js} +1 -1
  123. package/dist/chunks/{gemini-BCCLHK3K.js → gemini-C1J-x1g7.js} +1 -1
  124. package/dist/chunks/generateRecap-C0jjCg0Z.js +1 -0
  125. package/dist/chunks/generateSessionName-w0BMtwS7.js +1 -0
  126. package/dist/chunks/{githubRepoPathMapping-B4AM8luI.js → githubRepoPathMapping-8D0kpsif.js} +1 -1
  127. package/dist/chunks/{goal-Bp6fyGqo.js → goal-B4GsR54_.js} +3 -3
  128. package/dist/chunks/grok-ffNyU3Lt.js +1 -0
  129. package/dist/chunks/{grove-DrBVaZSN.js → grove-BQisE2JM.js} +1 -1
  130. package/dist/chunks/{heapdump-JseysNDr.js → heapdump-DiCjAPR3.js} +1 -1
  131. package/dist/chunks/{help-DR9hKneR.js → help-2hn8VK2-.js} +1 -1
  132. package/dist/chunks/hooks-CBmrBO-J.js +1 -0
  133. package/dist/chunks/{hooks-C5n23H1E.js → hooks-CkA9bhHl.js} +2 -2
  134. package/dist/chunks/hostGuard-BHI6Q8Mt.js +1 -0
  135. package/dist/chunks/inboundAttachments-C5K3XPTC.js +1 -0
  136. package/dist/chunks/{inboundAttachments-Cp8XvLMZ.js → inboundAttachments-IH-g95jo.js} +1 -1
  137. package/dist/chunks/initReplBridge-C-P4dgAG.js +1 -0
  138. package/dist/chunks/{install-C7qTB0V5.js → install-Dzlm4u58.js} +1 -1
  139. package/dist/chunks/{instrumentation-CLZttr_u.js → instrumentation-Yt31gxWN.js} +3 -3
  140. package/dist/chunks/{job-BhiazwPH.js → job-BXujwZNa.js} +1 -1
  141. package/dist/chunks/{keybindings-CkL8BzUt.js → keybindings-D8FXoO89.js} +2 -2
  142. package/dist/chunks/language-Baosud0X.js +1 -0
  143. package/dist/chunks/{language-DIw2871r.js → language-Ca4B018X.js} +1 -1
  144. package/dist/chunks/{launchAgentsPlatform-j-mWpwW1.js → launchAgentsPlatform-D6DmNuDt.js} +1 -1
  145. package/dist/chunks/{launchLocalMemory-DmoXp0Xo.js → launchLocalMemory-C0FzUq7x.js} +2 -2
  146. package/dist/chunks/{launchLocalVault-1uKe0HjA.js → launchLocalVault-DkYAre4O.js} +3 -3
  147. package/dist/chunks/{launchMemoryStores-SxDKjHJ3.js → launchMemoryStores-D2rKWAPs.js} +1 -1
  148. package/dist/chunks/{launchOnboarding-CTtpnXcs.js → launchOnboarding-gOVAFEFp.js} +1 -1
  149. package/dist/chunks/{launchSchedule-BDVnGhaL.js → launchSchedule-IZdFstT_.js} +1 -1
  150. package/dist/chunks/{launchSkillStore-SmMLxp4K.js → launchSkillStore-B7LamM1d.js} +1 -1
  151. package/dist/chunks/{launchTeleport-B472ZSGz.js → launchTeleport-C2BQMfYP.js} +3 -3
  152. package/dist/chunks/{launchVault-CsyBgxle.js → launchVault-C60WUcCI.js} +1 -1
  153. package/dist/chunks/{lazySchema-DcIJE_0i.js → lazySchema-DULtBUCI.js} +1 -1
  154. package/dist/chunks/loadAgentsDir-B9c3Emvg.js +1 -0
  155. package/dist/chunks/{loadAgentsDir-Clu7Uk6a.js → loadAgentsDir-x3rlgED4.js} +693 -695
  156. package/dist/chunks/loadPluginHooks-BhNdAjeY.js +1 -0
  157. package/dist/chunks/localSearch-BLCGsdyM.js +1 -0
  158. package/dist/chunks/{localSearch-iA6JTk19.js → localSearch-DtplGF-l.js} +1 -1
  159. package/dist/chunks/{logoV2Utils-YHBJLIrC.js → logoV2Utils-gGK9gErT.js} +1 -1
  160. package/dist/chunks/{magicDocs-Bf1fqnHN.js → magicDocs-qdDB_mKb.js} +2 -2
  161. package/dist/chunks/{main-gtV_TqXP.js → main-OWFSddRx.js} +84 -84
  162. package/dist/chunks/managedEnv-Aq5BXfY7.js +1 -0
  163. package/dist/chunks/managedEnv-BHoeDjpS.js +1 -0
  164. package/dist/chunks/managedEnvConstants-BPwL2aWI.js +1 -0
  165. package/dist/chunks/{mappers-C8lYERPX.js → mappers-04gNXJ3w.js} +1 -1
  166. package/dist/chunks/mcp-BSNdwbxR.js +1 -0
  167. package/dist/chunks/mcp-CMnDNI-4.js +6 -0
  168. package/dist/chunks/mcp-D1yA9E56.js +2 -0
  169. package/dist/chunks/memory-D1zbyjxN.js +1 -0
  170. package/dist/chunks/{mode-DO6g7nkX.js → mode-DY087x_x.js} +2 -2
  171. package/dist/chunks/model-CZViyZnE.js +1 -0
  172. package/dist/chunks/{model-DLXL0CNu.js → model-D0EfJBuw.js} +1 -1
  173. package/dist/chunks/model-DLLkVV6S.js +1 -0
  174. package/dist/chunks/{nativeInstaller-OPuO2sm_.js → nativeInstaller-yj81F75v.js} +1 -1
  175. package/dist/chunks/onChangeAppState-DhGKPG9g.js +1 -0
  176. package/dist/chunks/{openai-HOebt-8k.js → openai-EYRnUsco.js} +3 -3
  177. package/dist/chunks/{overageCreditGrant-Bi1CTBAx.js → overageCreditGrant-Du3dOYVu.js} +1 -1
  178. package/dist/chunks/{panel-CrTPqXCv.js → panel-BSZGX6jN.js} +1 -1
  179. package/dist/chunks/{panelCall-D0eURklm.js → panelCall-dMvRPAGE.js} +1 -1
  180. package/dist/chunks/{partition-C8RSL3SQ.js → partition-C4FWzYVm.js} +1 -1
  181. package/dist/chunks/{passes-BJci5SM_.js → passes-Daz-ARWD.js} +1 -1
  182. package/dist/chunks/permissions-DF8tAmDF.js +3 -0
  183. package/dist/chunks/{pidLock-Bd2e6xuT.js → pidLock-CbC_il6r.js} +2 -2
  184. package/dist/chunks/{plan-D4gMsK7i.js → plan-rsb_83Fo.js} +1 -1
  185. package/dist/chunks/{plugin-CwCo5Kik.js → plugin-Cm31-nej.js} +1 -1
  186. package/dist/chunks/pluginAutoupdate-0k03PVff.js +1 -0
  187. package/dist/chunks/pluginBlocklist-wPFCUPdm.js +1 -0
  188. package/dist/chunks/pluginCliCommands-DhL9LbH0.js +1 -0
  189. package/dist/chunks/{pluginFlagging-DNPBbJZo.js → pluginFlagging-CAdaFV_D.js} +1 -1
  190. package/dist/chunks/pluginOperations-Cs_Z4C6O.js +2 -0
  191. package/dist/chunks/pluginStartupCheck-BRXGKGjG.js +1 -0
  192. package/dist/chunks/pluginStartupCheck-KeU0efTj.js +1 -0
  193. package/dist/chunks/{plugins-CzJIuPfb.js → plugins-CQNKZmjP.js} +4 -4
  194. package/dist/chunks/policyLimits-D2s8M8P2.js +1 -0
  195. package/dist/chunks/{pollConfig-DH2oCtFS.js → pollConfig-2nFzv6Hy.js} +1 -1
  196. package/dist/chunks/{poor-Dha9p9RF.js → poor-DXumVTR4.js} +1 -1
  197. package/dist/chunks/{poorMode-1NLYiS3Y.js → poorMode-CBOtooa0.js} +1 -1
  198. package/dist/chunks/poorMode-yNZL5uYf.js +1 -0
  199. package/dist/chunks/print-uxCF5ka5.js +23 -0
  200. package/dist/chunks/{privacy-settings-6ZWxR4Qt.js → privacy-settings-BncbJCV0.js} +1 -1
  201. package/dist/chunks/processBashCommand-CGdwvPmD.js +1 -0
  202. package/dist/chunks/processSlashCommand-DQarepEb.js +5 -0
  203. package/dist/chunks/prompt-BgOdcHkd.js +1 -0
  204. package/dist/chunks/{prompt-Bg_1U0gO.js → prompt-CE3sFmZV.js} +5 -5
  205. package/dist/chunks/prompt-CLJKFebn.js +1 -0
  206. package/dist/chunks/{promptEditor-BhYDmwdS.js → promptEditor-CyTzyjwG.js} +2 -2
  207. package/dist/chunks/{protocolHandler-Dnb7lITm.js → protocolHandler-JR8pASdH.js} +1 -1
  208. package/dist/chunks/rate-limit-options-C-EqWjeI.js +1 -0
  209. package/dist/chunks/{rcDebugLog-VKwMl0yg.js → rcDebugLog-DBB9r8aw.js} +1 -1
  210. package/dist/chunks/reconciler-CYD_XpG4.js +4 -0
  211. package/dist/chunks/{referral-BlrMpBAV.js → referral-CKmHHxj_.js} +1 -1
  212. package/dist/chunks/refresh-ZqZdmLK5.js +1 -0
  213. package/dist/chunks/{registerProtocol-CuKZAiCc.js → registerProtocol-wZv2uiW_.js} +1 -1
  214. package/dist/chunks/{release-notes-BgP8u7NE.js → release-notes-B5K7wVqZ.js} +1 -1
  215. package/dist/chunks/{releaseNotes-CunqVlbU.js → releaseNotes-B8gbyFFJ.js} +2 -2
  216. package/dist/chunks/{reload-plugins-CD9TzvFm.js → reload-plugins-B9ApSp2m.js} +1 -1
  217. package/dist/chunks/{remote-env-QaP_W_sv.js → remote-env-CAt1dHIS.js} +1 -1
  218. package/dist/chunks/{remoteBridgeCore-9-HVMo63.js → remoteBridgeCore-Bk3UdSLJ.js} +1 -1
  219. package/dist/chunks/remoteManagedSettings-bswzAB6W.js +1 -0
  220. package/dist/chunks/rename-CE_U6KE6.js +1 -0
  221. package/dist/chunks/{resume-D-SpOy_1.js → resume-BicEjsPd.js} +2 -2
  222. package/dist/chunks/{runtimeObserver-Dm3LIUMp.js → runtimeObserver-BrGF5QWX.js} +4 -4
  223. package/dist/chunks/{runtimeObserver-DOEcrylu.js → runtimeObserver-CiwnPFjK.js} +1 -1
  224. package/dist/chunks/sandbox-adapter-BtMiHImm.js +1 -0
  225. package/dist/chunks/{sandbox-toggle-B61AeBor.js → sandbox-toggle-D8eebdyI.js} +1 -1
  226. package/dist/chunks/searchExtraTools-hLLPuh7c.js +1 -0
  227. package/dist/chunks/{session-RwJCIIcs.js → session-BZIlR9Gc.js} +2 -2
  228. package/dist/chunks/{sessionDiscovery-dkFeWcA3.js → sessionDiscovery-DfDqTrF1.js} +1 -1
  229. package/dist/chunks/sessionFileAccessHooks-Bm8wiqwe.js +1 -0
  230. package/dist/chunks/sessionMemory-D37S0-jX.js +1 -0
  231. package/dist/chunks/sessionMemory-DmlAG3jq.js +1 -0
  232. package/dist/chunks/sessionMemoryUtils-6EWDHSGU.js +1 -0
  233. package/dist/chunks/sessionObserver-BUw2rzKl.js +1 -0
  234. package/dist/chunks/{sessionObserver-CSOYgsvH.js → sessionObserver-KgquhGWw.js} +1 -1
  235. package/dist/chunks/sessionStorage-CucBSK5Q.js +1 -0
  236. package/dist/chunks/{sessionTitle-CLOlPZ_M.js → sessionTitle-DAnM73S0.js} +2 -2
  237. package/dist/chunks/{sessionTracing-D8wr9j4X.js → sessionTracing-_Hh5VXxt.js} +1 -1
  238. package/dist/chunks/settings-BeLFUeie.js +19 -0
  239. package/dist/chunks/settings-Cl16Haug.js +1 -0
  240. package/dist/chunks/settingsSync-BNvFYH3c.js +1 -0
  241. package/dist/chunks/setup-D8kXv3ts.js +3 -0
  242. package/dist/chunks/{shadowedRuleDetection-CXsmUY2o.js → shadowedRuleDetection-C6R5zOUe.js} +1 -1
  243. package/dist/chunks/{sideQuestion-CHpOVzY5.js → sideQuestion-hUhxls9r.js} +3 -3
  244. package/dist/chunks/{sinks-1hFrW9HK.js → sinks-BuE17DeZ.js} +2 -2
  245. package/dist/chunks/sinks-FevoYQqP.js +1 -0
  246. package/dist/chunks/{skill-learning-Ck17rwH8.js → skill-learning-CMdxGtxr.js} +1 -1
  247. package/dist/chunks/skillChangeDetector-C65ZLSYV.js +1 -0
  248. package/dist/chunks/{skillGapStore-DyqNKuNy.js → skillGapStore-D18LRJAM.js} +2 -2
  249. package/dist/chunks/{skillGapStore-BJ1h2LVr.js → skillGapStore-Ep62R-2_.js} +1 -1
  250. package/dist/chunks/{skillGenerator-BT8NGzXT.js → skillGenerator-Bc7WwNT8.js} +2 -2
  251. package/dist/chunks/{skillLearning-Cn9Uw0Kd.js → skillLearning-Cs9fJgkV.js} +1 -1
  252. package/dist/chunks/skillLearning-duPZl69A.js +1 -0
  253. package/dist/chunks/{skillPanel-N0GoWjIi.js → skillPanel-Cyzby746.js} +3 -3
  254. package/dist/chunks/{skillSearchPanel-CTwtgTzy.js → skillSearchPanel-Cll9ccA5.js} +4 -4
  255. package/dist/chunks/{skills-Bv3lH-aA.js → skills-BPPeYBy7.js} +1 -1
  256. package/dist/chunks/{stats-C1Ff6w4i.js → stats-CqfF4Axp.js} +1 -1
  257. package/dist/chunks/{status-FD7HVYS7.js → status-CC9Q-2Yn.js} +1 -1
  258. package/dist/chunks/{status-DyXiBa0m.js → status-D4IQpsNK.js} +2 -2
  259. package/dist/chunks/statusNoticeHelpers-CEGvdm5d.js +1 -0
  260. package/dist/chunks/syncCache-CANQZ9mQ.js +1 -0
  261. package/dist/chunks/{tag-RzOSA5T0.js → tag-DDbNqBMu.js} +2 -2
  262. package/dist/chunks/{tasks-eJrOcdhB.js → tasks-CZvWJYGr.js} +1 -1
  263. package/dist/chunks/teleport-Dk5j03Ix.js +1 -0
  264. package/dist/chunks/{templateJobs-BnOBSFtq.js → templateJobs-D1BdhZsv.js} +1 -1
  265. package/dist/chunks/{terminalSetup-D_P5iZmq.js → terminalSetup-3JNy6i_J.js} +5 -5
  266. package/dist/chunks/{terminalSetup-BfvmoJaK.js → terminalSetup-Cn6jeYw1.js} +1 -1
  267. package/dist/chunks/{theme-S0kVMVt4.js → theme-Cg4GNOoQ.js} +1 -1
  268. package/dist/chunks/thinkback-p-vKIRW_.js +1 -0
  269. package/dist/chunks/thinkback-play-DnPTDE8B.js +1 -0
  270. package/dist/chunks/{thinkback-HyW_R_88.js → thinkback-rFA1do6F.js} +1 -1
  271. package/dist/chunks/{toolEventObserver--Z6jENks.js → toolEventObserver-CzsCuUMc.js} +1 -1
  272. package/dist/chunks/{toolEventObserver-BAFzvePj.js → toolEventObserver-SFwURL5F.js} +1 -1
  273. package/dist/chunks/toolPool-BR27AMJO.js +1 -0
  274. package/dist/chunks/trustedDevice-BYt39fui.js +1 -0
  275. package/dist/chunks/{trustedDevice-Dn4rXbxT.js → trustedDevice-CKedohmT.js} +1 -1
  276. package/dist/chunks/{types-C-MRCL8J.js → types-Dut4311z.js} +2 -2
  277. package/dist/chunks/{ultrareviewCommand-mYDTBCFD.js → ultrareviewCommand-C_4OSBTW.js} +2 -2
  278. package/dist/chunks/{undercover-CdapzvNH.js → undercover-D30rKimg.js} +2 -2
  279. package/dist/chunks/undercover-DRSwLozU.js +1 -0
  280. package/dist/chunks/{updateCCB-DPShheOr.js → updateCCB-C2G-U-qA.js} +1 -1
  281. package/dist/chunks/upgrade-Bi-bIz7R.js +1 -0
  282. package/dist/chunks/{upgrade-BOeakAP6.js → upgrade-Chs-OQFd.js} +1 -1
  283. package/dist/chunks/{upload-BXQsDtLW.js → upload-D8FWMSQx.js} +1 -1
  284. package/dist/chunks/{usage-iNQzY960.js → usage-BxVeUt60.js} +1 -1
  285. package/dist/chunks/usage-DUO7Yy1f.js +1 -0
  286. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CntByfTQ.js → useExitOnCtrlCDWithKeybindings-BwsZ5f0s.js} +1 -1
  287. package/dist/chunks/useMainLoopModel-Gy1Vv4Qr.js +1 -0
  288. package/dist/chunks/useManagePlugins-B11_87VN.js +1 -0
  289. package/dist/chunks/useMergedTools-CR56my9t.js +1 -0
  290. package/dist/chunks/{useSearchInput-H-8hJeFD.js → useSearchInput-C5OzQnX6.js} +1 -1
  291. package/dist/chunks/{useSettingsErrors-BF5i5Xju.js → useSettingsErrors-B9vOZL41.js} +1 -1
  292. package/dist/chunks/{util-CoicMvOv.js → util-8EHwfg4A.js} +1 -1
  293. package/dist/chunks/validatePlugin-6q1qmnAC.js +1 -0
  294. package/dist/chunks/{vim-DdvQlLDm.js → vim-CNDzwoTd.js} +1 -1
  295. package/dist/chunks/{workerRegistry-CzqQwCHC.js → workerRegistry-CvyHvwx-.js} +1 -1
  296. package/dist/chunks/worktree-ogmNCIpz.js +1 -0
  297. package/dist/cli.js +1 -1
  298. package/package.json +1 -1
  299. package/dist/chunks/ApproveApiKey-CKfn7U1R.js +0 -1
  300. package/dist/chunks/BackgroundTasksDialog-CyoLEYWH.js +0 -2
  301. package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +0 -1
  302. package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +0 -1
  303. package/dist/chunks/Doctor-CcJUwSQn.js +0 -1
  304. package/dist/chunks/Doctor-Yco1McrL.js +0 -3
  305. package/dist/chunks/ExitFlow-D3csukbB.js +0 -2
  306. package/dist/chunks/Grove-DPkIjqg8.js +0 -1
  307. package/dist/chunks/Grove-Dsd7F39b.js +0 -11
  308. package/dist/chunks/MCPConnectionManager-MWpKjeZT.js +0 -1
  309. package/dist/chunks/MessageSelector-DsQmqFt2.js +0 -3
  310. package/dist/chunks/Messages-B3sGRx5A.js +0 -11
  311. package/dist/chunks/PluginSettings-B0jbwB2M.js +0 -17
  312. package/dist/chunks/QueryEngine-cwdsr4dr.js +0 -1
  313. package/dist/chunks/REPL-CJzScgbZ.js +0 -142
  314. package/dist/chunks/REPL-DlBJIPCw.js +0 -1
  315. package/dist/chunks/ResumeConversation-Rxwd6HAJ.js +0 -1
  316. package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +0 -1
  317. package/dist/chunks/Settings-CxI_KHUj.js +0 -2
  318. package/dist/chunks/TrustDialog-CnVKrdxQ.js +0 -1
  319. package/dist/chunks/agents-Du9KYHqN.js +0 -103
  320. package/dist/chunks/allErrors-P3utlEeA.js +0 -1
  321. package/dist/chunks/api-BiwZmmsh.js +0 -1
  322. package/dist/chunks/auth-BQa4kzQo.js +0 -1
  323. package/dist/chunks/auth-UAJhZNmZ.js +0 -1
  324. package/dist/chunks/autonomy-Cg5zweUa.js +0 -15
  325. package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +0 -1
  326. package/dist/chunks/backgroundHousekeeping-DhF2lrQ9.js +0 -17
  327. package/dist/chunks/bridgeConfig-DWEqKbXk.js +0 -1
  328. package/dist/chunks/bridgeEnabled-CjVCMwnq.js +0 -1
  329. package/dist/chunks/bridgeMain-6lollTtZ.js +0 -1
  330. package/dist/chunks/bridgeMain-BX2AkLPs.js +0 -68
  331. package/dist/chunks/caches-C46fa77L.js +0 -1
  332. package/dist/chunks/client-Bup0Sgcn.js +0 -1
  333. package/dist/chunks/commands-BdB1eFvP.js +0 -1
  334. package/dist/chunks/commitAttribution-D6J3NuhB.js +0 -1
  335. package/dist/chunks/compact-C6-lMHgn.js +0 -2
  336. package/dist/chunks/config-Bxt1UH1T.js +0 -1
  337. package/dist/chunks/config-CjjXZfNi.js +0 -1
  338. package/dist/chunks/context-noninteractive-DvGo1l7b.js +0 -1
  339. package/dist/chunks/conversation-CH9ouFai.js +0 -1
  340. package/dist/chunks/conversation-CYqqk0o7.js +0 -1
  341. package/dist/chunks/createSession-DUfOAeyE.js +0 -1
  342. package/dist/chunks/crossProjectResume-D5hTOfnE.js +0 -40
  343. package/dist/chunks/doctor-7fgVhEKL.js +0 -1
  344. package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +0 -1
  345. package/dist/chunks/envLessBridgeConfig-DXd10GXD.js +0 -1
  346. package/dist/chunks/exit-ropaQiOr.js +0 -1
  347. package/dist/chunks/extra-usage-CLhv1Z4g.js +0 -1
  348. package/dist/chunks/extractMemories-B2IAvbXM.js +0 -1
  349. package/dist/chunks/fast-_G6zcFye.js +0 -1
  350. package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +0 -1
  351. package/dist/chunks/generateRecap-BhvbixY2.js +0 -1
  352. package/dist/chunks/generateSessionName-CN1oh7Fa.js +0 -1
  353. package/dist/chunks/grok-ax26ju8y.js +0 -1
  354. package/dist/chunks/hooks-BUJLxdFJ.js +0 -1
  355. package/dist/chunks/hostGuard-C5xydXZI.js +0 -1
  356. package/dist/chunks/inboundAttachments-C0nMTtCi.js +0 -1
  357. package/dist/chunks/initReplBridge-DJs28ZkI.js +0 -1
  358. package/dist/chunks/language-DfOAuDFc.js +0 -1
  359. package/dist/chunks/loadAgentsDir-DTbJJff-.js +0 -1
  360. package/dist/chunks/loadPluginHooks-Cvd5VdjQ.js +0 -1
  361. package/dist/chunks/localSearch-DKv8PRLD.js +0 -1
  362. package/dist/chunks/mcp-CNuhEGP6.js +0 -6
  363. package/dist/chunks/mcp-Ci0OPVrR.js +0 -1
  364. package/dist/chunks/mcp-CwIYauZl.js +0 -2
  365. package/dist/chunks/memory-DCGqfQ1U.js +0 -1
  366. package/dist/chunks/model-BQF64tZx.js +0 -1
  367. package/dist/chunks/model-DvrvG6BB.js +0 -1
  368. package/dist/chunks/onChangeAppState-CHhRDkM7.js +0 -1
  369. package/dist/chunks/permissions-JU9CGHgI.js +0 -3
  370. package/dist/chunks/pluginAutoupdate-CO-n9bqe.js +0 -1
  371. package/dist/chunks/pluginBlocklist-5qbaTRbV.js +0 -1
  372. package/dist/chunks/pluginCliCommands-I-lsw_us.js +0 -1
  373. package/dist/chunks/pluginOperations-Cz6eQ0Vu.js +0 -2
  374. package/dist/chunks/pluginStartupCheck-CoW7073W.js +0 -1
  375. package/dist/chunks/pluginStartupCheck-DJ9fslCK.js +0 -1
  376. package/dist/chunks/policyLimits-BkjgMQD0.js +0 -1
  377. package/dist/chunks/poorMode-qlxqU8Hm.js +0 -1
  378. package/dist/chunks/print-BL4EUT5Z.js +0 -23
  379. package/dist/chunks/processBashCommand-BZs9wggV.js +0 -1
  380. package/dist/chunks/processSlashCommand-D8lKLNzM.js +0 -5
  381. package/dist/chunks/prompt-CN7gBNKS.js +0 -1
  382. package/dist/chunks/prompt-D-zHhqp8.js +0 -1
  383. package/dist/chunks/rate-limit-options-DVzT3eWH.js +0 -1
  384. package/dist/chunks/reconciler-BdRXZTJf.js +0 -4
  385. package/dist/chunks/refresh-jwqnoK2h.js +0 -1
  386. package/dist/chunks/remoteManagedSettings-jZ6u8ZBT.js +0 -1
  387. package/dist/chunks/rename-29qxHf8W.js +0 -1
  388. package/dist/chunks/sandbox-adapter-LzTcKwBp.js +0 -1
  389. package/dist/chunks/searchExtraTools-CbJJQqzH.js +0 -1
  390. package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +0 -1
  391. package/dist/chunks/sessionMemory-C4JAUZ6V.js +0 -1
  392. package/dist/chunks/sessionMemory-btARBn8H.js +0 -1
  393. package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +0 -1
  394. package/dist/chunks/sessionObserver-DMvWci8-.js +0 -1
  395. package/dist/chunks/sessionStorage-Diyuvt20.js +0 -1
  396. package/dist/chunks/settings-Dlp5JTa_.js +0 -19
  397. package/dist/chunks/settingsSync-QWA0VZSu.js +0 -1
  398. package/dist/chunks/setup-UI9uv2-K.js +0 -3
  399. package/dist/chunks/sinks-CXq8-7Qn.js +0 -1
  400. package/dist/chunks/skillChangeDetector-s0F9Yf9a.js +0 -1
  401. package/dist/chunks/skillLearning-1ZfYIzfL.js +0 -1
  402. package/dist/chunks/statusNoticeHelpers-kTp9Rdk6.js +0 -1
  403. package/dist/chunks/teleport-ABA-hdmP.js +0 -1
  404. package/dist/chunks/thinkback-C6gV2LpU.js +0 -1
  405. package/dist/chunks/thinkback-play-H6md4czq.js +0 -1
  406. package/dist/chunks/toolPool-CR61XXm3.js +0 -1
  407. package/dist/chunks/trustedDevice-DUrFWupL.js +0 -1
  408. package/dist/chunks/undercover-k3JoOKAb.js +0 -1
  409. package/dist/chunks/upgrade-D7iGU0PQ.js +0 -1
  410. package/dist/chunks/usage-DbRdMJog.js +0 -1
  411. package/dist/chunks/useMainLoopModel-DHkRIgNs.js +0 -1
  412. package/dist/chunks/useManagePlugins-B8HD0RUh.js +0 -1
  413. package/dist/chunks/useMergedTools-DfchLQZC.js +0 -1
  414. package/dist/chunks/validatePlugin-z2fcngf8.js +0 -1
  415. package/dist/chunks/worktree-DMhP5T0p.js +0 -1
@@ -0,0 +1,23 @@
1
+ import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,l as n,o as r,s as i}from"./envUtils-DSxRz_kt.js";import{n as a,t as o}from"./defineProperty-C-QyHrDq.js";import{M as s,P as c,Tn as l,Un as u,Wn as d,Z as f,en as p,ht as m,ir as h,kn as g,ln as _,tn as v,vr as y}from"./state-ix0xIunV.js";import{$C as b,$S as x,$h as S,$o as C,$v as w,$w as ee,AC as T,Ar as E,As as D,Ay as te,BC as ne,Bu as re,By as O,C as k,CT as ie,Cl as ae,Cn as oe,D as se,D_ as ce,Db as le,Dc as ue,E as A,E_ as j,Ec as de,Fw as fe,G as pe,GC as me,Gg as he,Gw as ge,HC as _e,Hw as M,Ia as N,Is as ve,Iw as P,Jw as ye,KC as be,Kv as xe,Kw as Se,LT as Ce,L_ as we,Ly as Te,M_ as Ee,Mo as De,NC as Oe,N_ as ke,Ny as F,OD as I,OT as Ae,Ob as je,Oc as Me,Oi as Ne,P as Pe,PC as Fe,Pa as L,Ps as R,Py as z,QS as B,Qi as Ie,Qo as Le,Qv as Re,Qw as ze,RS as Be,RT as Ve,Ry as V,Sl as He,TC as Ue,TD as We,TT as Ge,Td as Ke,Ut as qe,Uu as Je,Uw as Ye,Vi as Xe,W as Ze,Wg as Qe,Wi as $e,Ww as et,Xb as tt,Xh as nt,Xw as rt,Yh as it,Yw as at,ZS as ot,Zw as st,_D as ct,_T as lt,_i as ut,ac as dt,ag as ft,as as pt,aw as mt,b as ht,ca as gt,cc as _t,cg as vt,cr as yt,cw as bt,db as xt,dc as St,eC as Ct,ei as wt,eu as Tt,ex as Et,f as Dt,fc as Ot,fi as kt,gT as At,g_ as jt,gb as Mt,gi as Nt,hb as Pt,iT as Ft,ig as It,ir as Lt,iw as Rt,jT as zt,jr as Bt,jv as Vt,kC as Ht,kD as H,k_ as Ut,kc as Wt,ki as Gt,kr as Kt,ks as qt,kv as Jt,lb as Yt,lc as Xt,lg as Zt,lo as Qt,lw as $t,mc as en,nf as tn,ng as nn,o as rn,o_ as an,oc as on,og as sn,ow as cn,pD as ln,pc as un,pi as dn,qg as fn,qh as pn,qi as mn,qw as hn,ru as gn,s as _n,sb as vn,sc as yn,ss as bn,tf as xn,ts as Sn,tu as Cn,tw as wn,uD as Tn,ub as En,uc as Dn,uw as On,vD as kn,vT as An,wC as jn,wD as Mn,wT as Nn,wd as Pn,wn as Fn,x as In,y_ as Ln,yn as Rn,zS as zn,zs as Bn,zu as Vn,zy as Hn}from"./loadAgentsDir-x3rlgED4.js";import{n as Un,t as Wn}from"./cwd-CYmmnQVS.js";import{C as Gn,F as U,S as Kn,W as qn,a as Jn,d as Yn,l as W,nt as Xn,o as Zn,p as Qn,rt as $n,w as G,z as er}from"./debug-BrXObCdR.js";import{Z as tr,_t as nr,ct as rr,d as ir,f as ar,g as or,ut as sr,wt as cr,xn as lr,yn as ur}from"./settings-BeLFUeie.js";import{L as dr,P as fr}from"./config-DRDuVyzE.js";import{i as pr,n as mr,o as K}from"./process-gEbdy6uY.js";import{M as hr,N as gr,j as _r}from"./git-Do0wJvux.js";import{U as vr,Y as yr,c as br,i as xr,o as Sr,s as q}from"./log-BMCygSzM.js";import{i as Cr,n as wr}from"./path-D5U-tm91.js";import{s as Tr,u as Er}from"./types-Dut4311z.js";import{n as Dr,r as J}from"./analytics-BotDBGh0.js";import{Bt as Or,C as kr,Mn as Ar,Si as jr,Y as Mr,_ as Nr,_n as Pr,bi as Fr,br as Ir,bt as Lr,et as Rr,ii as zr,it as Br,jn as Vr,o as Hr,oi as Ur,rt as Wr,tt as Gr,u as Kr,vn as qr,wi as Jr,x as Yr,xi as Xr,xr as Zr}from"./model-CZViyZnE.js";import{Dt as Qr,En as $r,Ot as ei,Tn as ti,Zt as ni,an as ri,dt as ii,ut as ai}from"./prompt-CE3sFmZV.js";import{c as oi,s as si}from"./pluginFlagging-CAdaFV_D.js";import{a as ci,o as li,s as ui}from"./fileStateCache-DDW5toIs.js";import{A as di,C as fi,D as pi,N as mi,O as hi,P as gi,_ as _i,d as vi,g as yi,h as bi,lt as xi,m as Si,u as Ci,v as wi,y as Ti}from"./rcDebugLog-DBB9r8aw.js";import{c as Ei,l as Di}from"./commitAttribution-DPnHHKSA.js";import{t as Oi}from"./pollConfig-2nFzv6Hy.js";import{r as ki}from"./inboundAttachments-IH-g95jo.js";import{i as Ai,n as ji,s as Mi}from"./mappers-04gNXJ3w.js";import{n as Ni,r as Pi}from"./sessionTitle-DAnM73S0.js";import{n as Fi,t as Ii}from"./ccrClient-BFyfO67b.js";import{n as Li,t as Ri}from"./HybridTransport-rK83Qijz.js";import{n as zi,t as Bi}from"./SSETransport-5VK5okFv.js";import{a as Vi,n as Hi,o as Ui}from"./grove-BQisE2JM.js";import{o as Wi}from"./remoteManagedSettings-bswzAB6W.js";import{i as Gi,r as Ki}from"./auth-DqcKPbw8.js";import{t as qi}from"./pluginBlocklist-wPFCUPdm.js";import{t as Ji}from"./onChangeAppState-DhGKPG9g.js";import{t as Yi}from"./settingsSync-BNvFYH3c.js";import{a as Xi,c as Zi,n as Qi,o as $i,r as ea,s as ta}from"./reconciler-CYD_XpG4.js";import{n as na,t as ra}from"./toolPool-BR27AMJO.js";import{n as ia,r as aa}from"./QueryEngine-CGYaShXD.js";import{n as oa,r as sa}from"./sideQuestion-hUhxls9r.js";import{n as ca,r as la}from"./context-noninteractive-DNury4JI.js";import{a as ua,o as da,t as fa}from"./skillChangeDetector-C65ZLSYV.js";import{n as pa,t as ma}from"./refresh-ZqZdmLK5.js";import{dirname as ha,join as ga}from"path";import{PassThrough as _a}from"stream";import{randomUUID as Y}from"crypto";import{readFile as va,stat as ya}from"fs/promises";import{URL as ba}from"url";import{cwd as X}from"process";a(),p(),Un(),Xn(),er(),Kn(),Qn(),mr(),Jn(),_r(),yr(),Sr(),Cr(),ur(),Tr(),or(),Jr(),ti(),Ur(),Zr(),Vr(),Pr(),Or(),Nr(),ri(),Se(),mi(),T(),x(),hi(),Re(),vi(),C(),De(),Ie(),Bt(),Yi(),r(),zi();function xa(e,t={},r,i){if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let n=new ba(e.href);return n.protocol===`wss:`?n.protocol=`https:`:n.protocol===`ws:`&&(n.protocol=`http:`),n.pathname=n.pathname.replace(/\/$/,``)+`/worker/events/stream`,new Bi(n,t,r,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return n(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new Ri(e,t,r,i):new Li(e,t,r,i);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),zi();var Sa=class extends Xi{constructor(e,t,r){let i=new _a({encoding:`utf8`});super(i,r),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=i,this.url=new ba(e);let a={},s=pi();s?a.Authorization=`Bearer ${s}`:W(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;c&&(a[`x-environment-runner-version`]=c);let l=()=>{let e={},t=pi();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e};if(this.transport=xa(this.url,a,m(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Zn(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&K(e.endsWith(`
2
+ `)?e:e+`
3
+ `)}),this.transport.setOnClose(()=>{this.inputStream.end()}),n(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof Bi))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Ii(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{hr(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Fi?e.reason:`unknown`}),q(Error(`CCRClient initialization failed: ${U(e)}`)),ot(1,`other`)}),$n(async()=>this.ccrClient?.close()),Gt((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Ne(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};ye((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),wi((e,t)=>{this.ccrClient?.reportState(e,t)}),_i(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=Oi().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{W(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{W(`[remote-io] keep_alive write failed: ${U(e)}`)})},u),this.keepAliveTimer.unref?.()),$n(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
4
+ `)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&K($i(e)+`
5
+ `)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};ni(),tr(),ei(),[...Qr],Xn(),Jn();var Ca=`[stdout-guard]`,wa=!1,Z=``,Q=null;function Ta(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function Ea(){wa||(wa=!0,Q=process.stdout.write.bind(process.stdout),process.stdout.write=function(e,t,n){let r=typeof e==`string`?e:Buffer.from(e).toString(`utf-8`);Z+=r;let i,a=!0;for(;(i=Z.indexOf(`
6
+ `))!==-1;){let e=Z.slice(0,i);Z=Z.slice(i+1),Ta(e)?a=Q(e+`
7
+ `):(process.stderr.write(`${Ca} ${e}\n`),W(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},$n(async()=>{Z.length>0&&(Q&&Ta(Z)?Q(Z+`
8
+ `):process.stderr.write(`${Ca} ${Z}\n`),Z=``),Q&&(process.stdout.write=Q,Q=null),wa=!1}))}cr(),sr(),fr(),Mn(),ct(),ln(),ii(),li(),gi(),Ge(),P(),$t(),be(),_e(),Mt(),Te(),F(),Ee(),Ln(),Je(),Me(),ue(),Ot(),R(),pt(),Fn(),Rn(),pe(),rn(),ra(),te(),er(),Sr(),hi(),vn(),Jn(),x();function Da(e){let t=process.env.CLAUDE_CODE_EXIT_AFTER_STOP_DELAY,n=t?parseInt(t,10):null,r=n&&!isNaN(n)&&n>0,i=null,a=0;return{start(){i&&(clearTimeout(i),i=null),r&&(a=Date.now(),i=setTimeout(()=>{let t=Date.now()-a;e()&&t>=n&&(W(`Exiting after ${n}ms of idle time`),B())},n))},stop(){i&&(clearTimeout(i),i=null)}}}Rr(),si(),I(),Ce(),Rt(),Ue(),zn(),Et(),ae(),L(),k(),Pi(),oa();function Oa(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(w(e))return{sessionId:e,ingressUrl:null,isUrl:!1,jsonlFile:null,isJsonlFile:!1};try{let t=new URL(e);return{sessionId:Y(),ingressUrl:t.href,isUrl:!0,jsonlFile:null,isJsonlFile:!1}}catch{}return null}Fr(),Ft(),ze(),et(),Di(),b(),xe(),Qe(),sn(),nn(),Ke(),Tt(),ji(),Vi(),la(),Jn();async function ka(){try{let e=await va(Xt(),`utf-8`),t=nr().safeParse(Gn(e));return t.success?t.data:(W(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function Aa(e){await dt(Xt(),G(e,null,2))}async function ja(e,t){let n=_t();if(!n)return;let r=await Ma(t);r!==null&&await dt(ga(n,yn(e)),r)}async function Ma(e){let t=[ga(e,`.claude-plugin`,`marketplace.json`),ga(e,`marketplace.json`),e];for(let e of t)try{return await va(e,`utf-8`)}catch{}return null}async function Na(){let e=await ve();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await ja(t,n.installLocation)}catch(e){W(`Failed to save marketplace JSON for ${t}: ${e}`)}await Aa({...await ka(),...e})}Dr(),Xn(),Jn(),_r(),Sr(),R(),Ot();async function Pa(){let e=en();W(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await Bn();t&&(qt(),Sn(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Yn().mkdir(Dn()),await Yn().mkdir(St()));let n=Object.keys(D()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)W(`installPluginsForHeadless: no marketplaces declared`);else{let t=await gr(`headless_marketplace_reconcile`,()=>Qi({skip:e?(e,t)=>!un(t):void 0,onProgress:e=>{e.type===`installed`?W(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&W(`installPluginsForHeadless: failed to install marketplace ${e.name}: ${e.error}`)}}),e=>({installed_count:e.installed.length,updated_count:e.updated.length,failed_count:e.failed.length,skipped_count:e.skipped.length}));t.skipped.length>0&&W(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(qt(),Sn(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Na();let t=await qi();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&Sn(`headlessPluginInstall: plugins changed`),e&&$n(on),i}catch(e){return q(e),!1}finally{J(`tengu_headless_plugin_install`,r)}}Dr(),Jn(),_r(),Se(),vi(),Sr(),mr(),Re(),x(),Xn(),Un(),p(),Bt(),De(),Kn(),r(),ma(),pt(),Fe(),le(),xn(),er();var $=(Ti(),e(fi)),Fa=1e4,Ia=new Set,La=[];function Ra(e){if(Ia.has(e))return!1;if(Ia.add(e),La.push(e),La.length>Fa){let e=La.splice(0,La.length-Fa);for(let t of e)Ia.delete(t)}return!0}function za(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Ba(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
9
+ `):e.flatMap(za)}function Va(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Ha(e,t,r,i,a,o,s,c){if(process.env.USER_TYPE===`ant`&&n(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),kn.subscribe(e=>{Be(e,r),Wr()&&r(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&n(process.env.CLAUDE_CODE_PROACTIVE)&&$.activateProactive(`command`),typeof Bun<`u`&&setInterval(()=>{process.memoryUsage.rss()>350*1024*1024?Bun.gc(!0):Bun.gc(!1)},1e3).unref(),Ye(),M(`runHeadless_entry`),await Ui()&&await Hi(),M(`after_grove_check`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
10
+ `),B(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
11
+ `),B(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
12
+ `),B(1);return}let l=Qa(e,c);c.outputFormat===`stream-json`&&Ea();let u=Tn.getSandboxUnavailableReason();if(u){if(Tn.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${u}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),B(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${u}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(Tn.isSandboxingEnabled())try{await Tn.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${U(e)}\n`),B(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&Wt(e=>{let t=(()=>{switch(e.type){case`started`:return{type:`system`,subtype:`hook_started`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,uuid:Y(),session_id:m()};case`progress`:return{type:`system`,subtype:`hook_progress`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,stdout:e.stdout,stderr:e.stderr,output:e.output,uuid:Y(),session_id:m()};case`response`:return{type:`system`,subtype:`hook_response`,hook_id:e.hookId,hook_name:e.hookName,hook_event:e.hookEvent,output:e.output,stdout:e.stdout,stderr:e.stderr,exit_code:e.exitCode,outcome:e.outcome,uuid:Y(),session_id:m()}}})();l.write(t)}),c.setupTrigger&&await Hn(c.setupTrigger),M(`before_loadInitialMessages`);let d=t(),{messages:p,turnInterruptionState:h,agentSetting:g}=await Za(r,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),_=O();if(_&&l.prependUserMessage(_),!c.agent&&!f()&&g){let{agentDefinition:e}=ua(g,void 0,{activeAgents:s,allAgents:s});if(e){if(r(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!_n(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Nt(e.agentType)}}if(p.length===0&&process.exitCode!==void 0)return;if(c.rewindFiles){let e=p.find(e=>e.uuid===c.rewindFiles);if(!e||e.type!==`user`){process.stderr.write(`Error: --rewind-files requires a user message UUID, but ${c.rewindFiles} is not a user message in this session\n`),B(1);return}let n=t(),i=await qa(c.rewindFiles,n,r,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),B(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),B(0);return}let v=typeof c.resume==`string`&&(!!w(c.resume)||c.resume.endsWith(`.jsonl`)),y=!!c.sdkUrl;if(!e&&!v&&!y){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
13
+ `),B(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
14
+ `),B(1);return}let b=re(d.mcp.tools,d.toolPermissionContext),x=[...a,...b],S=Ga(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{r(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),bi(`requires_action`,e)});c.permissionPromptToolName&&(x=x.filter(e=>!$r(e,c.permissionPromptToolName))),pr(),M(`after_loadInitialMessages`),await zr(),M(`after_modelStrings`);let C=c.outputFormat===`json`&&c.verbose,ee=[],T;M(`before_runHeadlessStreaming`);for await(let e of Ua(l,d.mcp.clients,[...i,...d.mcp.commands],x,p,S,o,t,r,s,c,h))c.outputFormat===`stream-json`&&c.verbose&&await l.write(e),e.type!==`control_response`&&e.type!==`control_request`&&e.type!==`control_cancel_request`&&!(e.type===`system`&&(e.subtype===`session_state_changed`||e.subtype===`task_notification`||e.subtype===`task_started`||e.subtype===`task_progress`||e.subtype===`post_turn_summary`))&&e.type!==`stream_event`&&e.type!==`keep_alive`&&e.type!==`streamlined_text`&&e.type!==`streamlined_tool_use_summary`&&e.type!==`prompt_suggestion`&&(C&&ee.push(e),T=e);switch(c.outputFormat){case`json`:if(!T||T.type!==`result`)throw Error(`No messages returned`);if(c.verbose){K(G(ee)+`
15
+ `);break}K(G(T)+`
16
+ `);break;case`stream-json`:break;default:if(!T||T.type!==`result`)throw Error(`No messages returned`);switch(T.subtype){case`success`:K(T.result.endsWith(`
17
+ `)?T.result:T.result+`
18
+ `);break;case`error_during_execution`:K(`Execution error`);break;case`error_max_turns`:K(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:K(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:K(`Error: Failed to provide valid structured output after maximum retries.
19
+ Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(ge(),dr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-DhUprYa7.js`);await e()}catch{}B(T?.type===`result`&&T?.is_error?1:0)}function Ua(e,r,a,o,d,f,p,g,_,v,y,b){let x=!1,S,C=!1,w=null,T,E=e.outbound;process.on(`SIGINT`,()=>{hr(`info`,`shutdown_signal`,{signal:`SIGINT`}),T&&!T.signal.aborted&&T.abort(),ot(0)}),$n(async()=>{let t={};for(let e of Oe(g()))je(e)&&(t[e.type]=(t[e.type]??0)+1);hr(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:Ci(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),yi(e=>{(e==="default"||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&E.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:m()})});let D={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},te;y.enableAuthStatus&&(te=Ir.getInstance().subscribe(e=>{E.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:m()})}));let re=e=>{let t=Mi(e);t&&E.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:m()})};Ve.add(re);let O=d,k=ne(d,X(),100),ae=ci(100),oe=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;b&&b.kind!==`none`&&oe&&(W(`[print.ts] Auto-resuming interrupted turn (kind: ${b.kind})`),Xa(O,b.message),An({mode:`prompt`,value:b.message.message.content,uuid:Y()}));let se=Pn().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?Hr():kr(t),r=wn(n),i=Br(e.value),a=Ar(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsAdaptiveThinking:!0},...i&&{supportsFastMode:!0},...a&&{supportsAutoMode:!0}}}),le=y.userSpecifiedModel;function ue(e,t){let n=Qt(e,Yr(t));O.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&E.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:m(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let A=[],j=[],pe=new Set;function me(t){for(let n of t){if(n.type!==`connected`||pe.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(Jt,async(n,r)=>{br(t,`Elicitation request received in print mode: ${G(n)}`);let i=n.params.mode===`url`?`url`:`form`;J(`tengu_mcp_elicitation_shown`,{mode:i});let a=await vt(t,n.params,r.signal);if(a)return br(t,`Elicitation resolved by hook: ${G(a)}`),J(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),u=await Zt(t,l,r.signal,i,c);return J(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler(Vt,e=>{let{elicitationId:n}=e.params;br(t,`Elicitation completion notification: ${n}`),qe({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),E.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:m()})}),pe.add(t)}catch{}}}async function _e(){let t=new Set(Object.keys(p)),n=new Set(A.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=A.some(e=>e.type===`pending`),o=A.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of A)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await ft(p,(t,n)=>e.sendMcpMessage(t,n));A=r.clients,j=r.tools;let i=lr([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(rr(t)))),...j]}})),On(A)}}_e();let N={clients:[],tools:[],configs:{}},ve=e=>{let t=Vn(e.toolPermissionContext,e.mcp.tools),n=We(na([...o,...j,...N.tools],t,e.toolPermissionContext.mode),`name`);y.permissionPromptToolName&&(n=n.filter(e=>!$r(e,y.permissionPromptToolName)));let r=c();if(r&&!y.jsonSchema){let e=ai(r);`tool`in e&&(n=[...n,e.tool])}return n},P=null,ye=0;function be(){if(!P)return;let e=Math.min(ye,O.length),t=O.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);ye=O.length,t.length>0&&P.writeMessages(t)}let xe=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Se(e){let t=async()=>{let t=new Set(A.map(e=>e.name)),n=await to(e,{configs:p,clients:A,tools:j},N,_);for(let e of Object.keys(p))delete p[e];if(Object.assign(p,n.newSdkState.configs),A=n.newSdkState.clients,j=n.newSdkState.tools,N=n.newDynamicState,n.sdkServersChanged){let e=new Set(A.map(e=>e.name)),n=lr([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(rr(t)))),...j]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return xe=xe.then(t,t),xe}function Ce(){let e=g(),t=e.mcp.clients,n=We([...e.mcp.tools,...N.tools],`name`),r=new Set([...t.map(e=>e.name),...A.map(e=>e.name)]);return[...t,...A,...N.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?jt(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0;return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r}})}async function Te(){try{await Promise.all([Promise.resolve(),gr(`headless_managed_settings_wait`,()=>Wi())]),await Pa()&&await Ne()}catch(e){q(e)}}let Ee=null;i()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Ee=Te():Te());let De=Da(()=>!x),F=a,I=v;async function Me(){let{agentDefinitions:e}=await pa(_);F=await mn(X());let t=I.filter(e=>e.source===`flagSettings`);I=[...e.allAgents,...t]}async function Ne(){let{servers:e}=await ce(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(p))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Se(t);r&&_e(),W(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Pe=fa.subscribe(()=>{Xe(),mn(X()).then(e=>{F=e})}),Fe=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await ee({basePrompt:`<${vr}>${new Date().toLocaleTimeString()}</${vr}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await at({commands:e});return}for(let t of e)An({...t,uuid:Y()});L()})().catch(e=>{q(e),W(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};zt(()=>{T&&ie(`now`).length>0&&T.abort(`interrupt`)});let L=async()=>{if(x)return;if(x=!0,S=void 0,bi(`running`),De.stop(),M(`run_entry`),await _e(),M(`after_updateSdkMcp`),Ee){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=qr(e).then(()=>`timeout`);await Promise.race([Ee,t])===`timeout`&&(q(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),J(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await Ee;Ee=null,await Me();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-BhNdAjeY.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=At(n);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Va(r,Ae(n));)i.push(At(n));let a=await rt(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Ba(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(y.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&E.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:m(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),l=[...s.mcp.clients,...A,...N.clients];me(l);let u=ve(s);for(let e of o)hn(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,u=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,d=u.match(/<total_tokens>(\d+)<\/total_tokens>/),f=u.match(/<tool_uses>(\d+)<\/tool_uses>/),p=u.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&E.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:d&&f?{total_tokens:parseInt(d[1],10),tool_uses:parseInt(f[1],10),duration_ms:p?parseInt(p[1],10):0}:void 0,session_id:m(),uuid:Y()})}let d=r.value,p=a.claimedCommands;if(e instanceof Sa&&r.mode===`prompt`&&J(`tengu_bridge_message_received`,{is_repl:!1}),D.abortController?.abort(),D.abortController=null,D.pendingSuggestion=null,D.pendingLastEmittedEntry=null,D.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&mt(D.lastEmitted.text,e,D.lastEmitted.emittedAt,D.lastEmitted.promptId,D.lastEmitted.generationRequestId),D.lastEmitted=null}T=fe(),M(`before_ask`),gn();let h=r,v=!1;try{if(await Xr(h.workload??y.workload,async()=>{for await(let t of ia({commands:We([...F,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:u,verbose:y.verbose,mcpClients:l,thinkingConfig:y.thinkingConfig,maxTurns:y.maxTurns,maxBudgetUsd:y.maxBudgetUsd,taskBudget:y.taskBudget,canUseTool:f,userSpecifiedModel:le,fallbackModel:y.fallbackModel,jsonSchema:c()??y.jsonSchema,mutableMessages:O,getReadFileCache:()=>ae.size===0?k:ui(k,ae),setReadFileCache:e=>{k=e;for(let[e,t]of ae.entries()){let n=k.get(e);(!n||t.timestamp>n.timestamp)&&k.set(e,t)}ae.clear()},customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,getAppState:g,setAppState:_,abortController:T,replayUserMessages:y.replayUserMessages,includePartialMessages:y.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:I,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{E.enqueue({type:`system`,subtype:`status`,status:e,session_id:m(),uuid:Y()})}}))if(be(),t.type===`result`){v=!!t.is_error;for(let e of di())E.enqueue(e);Oe(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&je(e))?w=t:(w=null,E.enqueue(t))}else{for(let e of di())E.enqueue(e);E.enqueue(t)}}),v)await st({commands:p,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??y.workload});else{let e=await st({commands:p,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??y.workload});for(let t of e)An({...t,uuid:Y()})}}catch(e){throw await st({commands:p,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??y.workload}),e}for(let e of o)hn(e,`completed`);if(be(),P?.sendResult(),y.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){D.abortController?.abort();let e=new AbortController;D.abortController=e;let t=He();if(!t)cn(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await bt(e,O,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:m()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};w?(D.pendingSuggestion=r,D.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(D.lastEmitted=i,E.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){cn(`aborted`,void 0,void 0,`sdk`);return}q(qn(e))}finally{D.inflightPromise===n.promise&&(D.inflightPromise=null)}})(),D.inflightPromise=n.promise}}ge(),Cn(),Ye()}};do{for(let e of di())E.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=Oe(g()).some(e=>je(e)),t=Ae(n)!==void 0;(e||t)&&(i=!0,t||(S=`waiting_for_agents`,await qr(100)))}}while(i);w&&(E.enqueue(w),w=null,D.pendingSuggestion&&(E.enqueue(D.pendingSuggestion),D.pendingLastEmittedEntry&&(D.lastEmitted={...D.pendingLastEmittedEntry,emittedAt:Date.now()},D.pendingLastEmittedEntry=null),D.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:xi,modelUsage:{},permission_denials:[],uuid:Y(),errors:[U(t),...xr().map(e=>e.error)]})}catch{}D.abortController?.abort(),B(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!Ct()){bi(`idle`);for(let e of di())E.enqueue(e)}x=!1,De.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&Ae(n)===void 0&&!C){Fe();return}if(Ae(n)!==void 0){L();return}C&&(D.inflightPromise&&await Promise.race([D.inflightPromise,qr(5e3)]),D.abortController?.abort(),D.abortController=null,await de(),Pe(),te?.(),Ve.delete(re),E.done())},R=function(e,t){E.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},z=function(e,t){E.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ie=new Set;e.setUnexpectedResponseCallback(async e=>{await $a({message:e,setAppState:_,handledToolUseIds:Ie,onEnqueued:()=>{L()}})});let Le=new Map,Re=new Map,ze=new Set,Be=new Map,V=null;return(async()=>{let t=!1;hr(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&hn(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),T&&T.abort(),D.abortController?.abort(),D.abortController=null,D.lastEmitted=null,D.pendingSuggestion=null,R(i);else if(o.subtype===`end_session`){W(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),T&&T.abort(),D.abortController?.abort(),D.abortController=null,D.lastEmitted=null,D.pendingSuggestion=null,R(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)p[e]={type:`sdk`,name:e};await Ka(i.request,i.request_id,t,E,a,se,e,!!y.enableAuthStatus,y,v,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&h(!0),t=!0,Nn()&&L()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Ja(e,i.request_id,t.toolPermissionContext,E),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e==="default"?Hr():e;le=t,u(t),Si({model:t}),ue(e,t),R(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?y.thinkingConfig=void 0:i.request.max_thinking_tokens===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},R(i);else if(i.request.subtype===`mcp_status`)R(i,{mcpServers:Ce()});else if(i.request.subtype===`get_context_usage`)try{let e=g(),t=await ca({messages:O,getAppState:g,options:{mainLoopModel:Kr(),tools:ve(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt}});R(i,{...t})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=A.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),R(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await qa(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?R(i,t):z(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid,t=lt(t=>t.uuid===e);R(i,{cancelled:t.length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=wr(i.request.path),t=Math.floor((await ya(e)).mtimeMs);if(t<=i.request.mtime){let n=await va(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
20
+ `,`
21
+ `);ae.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}R(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Se(i.request.servers);R(i,e),t&&_e()}else if(i.request.subtype===`reload_plugins`)try{let e=await pa(_),t=I.filter(e=>e.source===`flagSettings`);I=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([mn(X()),Ne(),bn()]);r.status===`fulfilled`?F=r.value:q(r.reason),a.status===`rejected`&&q(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):q(o.reason),R(i,{commands:F.filter(e=>e.userInvocable!==!1).map(e=>({name:gt(e),description:$e(e),argumentHint:e.argumentHint||``})),agents:I.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Ce(),error_count:e.error_count})}catch(e){z(i,U(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;pe.delete(t);let n=Ut(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??N.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)z(i,`Server not found: ${t}`);else{let e=await It(t,n),r=rr(t);if(_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...H(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...H(n.mcp.commands,e=>an(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:oi(n.mcp.resources,t)}})),N={...N,clients:[...N.clients.filter(e=>e.name!==t),e.client],tools:[...N.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)me([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;pe.delete(t);let a=Ut(t)??r.find(e=>e.name===t)?.config??A.find(e=>e.name===t)?.config??N.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)z(i,`Server not found: ${t}`);else if(n){we(t,!0);let e=await It(t,a),n=rr(t);if(_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...H(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...H(r.mcp.commands,e=>an(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:oi(r.mcp.resources,t)}})),e.client.type===`connected`)me([e.client]),R(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;z(i,t)}}else{we(t,!1);let n=[...r,...A,...N.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await it(t,a);let o=rr(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:H(e.mcp.tools,e=>e.name?.startsWith(o)),commands:H(e.mcp.commands,e=>an(e,t)),resources:oi(e.mcp.resources,t)}})),R(i)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=Ut(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Le.get(e)?.abort();let t=new AbortController;Le.set(e,t);let r,a=new Promise(e=>{r=e}),o=he(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{Re.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?R(i,{authUrl:s,requiresUserAction:!0}):R(i,{requiresUserAction:!1}),Be.set(e,o),o.then(async()=>{if(ke(e)||ze.has(e))return;let t=await It(e,n),r=rr(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...H(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...H(n.mcp.commands,t=>an(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:oi(n.mcp.resources,e)}})),N={...N,clients:[...N.clients.filter(t=>t.name!==e),t.client],tools:[...N.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{W(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Le.get(e)===t&&(Le.delete(e),Re.delete(e),ze.delete(e),Be.delete(e))})}catch(e){z(i,U(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=Re.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)z(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{ze.add(e),n(t);let r=Be.get(e);if(r)try{await r,R(i)}catch(e){z(i,e instanceof Error?e.message:`OAuth authentication failed`)}else R(i)}}else z(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;V?.service.cleanup(),J(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Gi,n,r=new Promise(e=>{n=e}),a=t.startOAuthFlow(async(e,t)=>{n({manualUrl:e,automaticUrl:t})},{loginWithClaudeAi:e??!0,skipBrowserOpen:!0}).then(async t=>{await Ki(t),J(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),V?.service===t&&(V=null)});V={service:t,flow:a},a.catch(e=>W(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);R(i,{manualUrl:e,automaticUrl:t})}catch(e){z(i,U(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!V)z(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&V.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=V;e.then(()=>{let e=Lr();R(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:jr()}})},e=>z(i,U(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=Ut(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)z(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)z(i,`Cannot clear auth for server type "${n.type}"`);else{await fn(e,n);let t=await It(e,n),r=rr(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...H(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...H(n.mcp.commands,t=>an(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:oi(n.mcp.resources,e)}})),R(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=Kr(),t=s()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];l(r),kn.notifyChange(`flagSettings`),`model`in n&&(n.model==null?u(void 0):u(String(n.model)));let a=Kr();if(a!==e){le=a;let e=n.model?String(n.model):`default`;Si({model:a}),ue(e,a)}R(i)}else if(i.request.subtype===`get_settings`){let e=Kr();R(i,{...ir(),applied:{model:e}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await tn(e,{getAppState:g,setAppState:_}),R(i,{})}catch(e){z(i,U(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(T&&!T.signal.aborted?T:fe()).signal;(async()=>{try{let r=await Ni(e,n);if(r&&t)try{ut(m(),r)}catch(e){q(e)}R(i,{title:r})}catch(e){z(i,U(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=He(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:fe()}}:await aa({tools:ve(g()),commands:F,mcpClients:[...g().mcp.clients,...A,...N.clients],messages:O,readFileState:k,getAppState:g,setAppState:_,customSystemPrompt:y.systemPrompt,appendSystemPrompt:y.appendSystemPrompt,thinkingConfig:y.thinkingConfig,agents:I}),r=await sa({question:e,cacheSafeParams:n});R(i,{response:r.response})}catch(e){z(i,U(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),Fe()):$.deactivateProactive(),R(i);else if(o.subtype===`remote_control`)if(o.enabled)if(P)R(i,{session_url:jn(P.bridgeSessionId,P.sessionIngressUrl),connect_url:tt(P.environmentId,P.sessionIngressUrl),environment_id:P.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-C-P4dgAG.js`),r=await n({onInboundMessage(e){let t=ea(e);if(!t)return;let{content:n,uuid:r}=t;An({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),L()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){T?.abort()},onSetModel(e){let t=e==="default"?Hr():e;le=t,u(t)},onSetMaxThinkingTokens(e){e===null?y.thinkingConfig=void 0:e===0?y.thinkingConfig={type:`disabled`}:y.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),W(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),E.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:m()})},initialMessages:O.length>0?O:void 0});r?(P=r,ye=O.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),R(i,{session_url:jn(r.bridgeSessionId,r.sessionIngressUrl),connect_url:tt(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):z(i,t??`Remote Control initialization failed`)}catch(e){z(i,U(e))}}else P&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await P.teardown(),P=null),R(i);else z(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){y.replayUserMessages&&E.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=Ai([n]);O.push(...e),n.type===`assistant`&&y.replayUserMessages&&E.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=m(),t=await Lt(e,o.uuid);if(t||Ia.has(o.uuid)){W(`Skipping duplicate user message: ${o.uuid}`),y.replayUserMessages&&(W(`Sending acknowledgment for duplicate user message: ${o.uuid}`),E.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&hn(o.uuid,`completed`);continue}Ra(o.uuid)}An({mode:`prompt`,value:await ki(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:Ei(e.attribution,e=>{wt(e).catch(e=>{W(`Attribution: Failed to save snapshot: ${e}`)})})})),L()}C=!0,x||(D.inflightPromise&&await Promise.race([D.inflightPromise,qr(5e3)]),D.abortController?.abort(),D.abortController=null,await de(),Pe(),te?.(),Ve.delete(re),E.done())})(),E}function Wa(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Ze(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=oe(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Zi(ta().parse(Er(h.content[0].text)),e,r,i)};return t}function Ga(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Ze(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>$r(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),B(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),B(1),Error(t)}i=Wa(r)}return i(t,r,a,o,s,c)}}async function Ka(e,t,n,r,i,a,o,s,c,l,p){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Dt(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=f()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(d(t.agentType),!c.systemPrompt&&!_n(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&u(kr(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let h=ar()?.outputStyle||`default`,v=await Le(Wn()),y=Lr();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});_(t)}e.jsonSchema&&g(e.jsonSchema);let b={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:gt(e),description:$e(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:h,available_output_styles:Object.keys(v),models:a,account:{email:y?.email,organization:y?.organization,subscriptionType:y?.subscription,tokenSource:y?.tokenSource,apiKeySource:y?.apiKeySource,apiProvider:jr()},pid:process.pid};if(Wr()&&Gr()){let e=p();b.fast_mode_state=Mr(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:b}}),s){let e=Ir.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:m()})}}async function qa(e,t,n,r){if(!En())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Yt(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await xt(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await Pt(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${U(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Ja(e,t,n,r){if(e.mode===`bypassPermissions`){if(se())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!A()){let e=In();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${ht(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...Pe(n.mode,e.mode,n),mode:e.mode}}function Ya(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:m(),total_cost_usd:0,usage:xi,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(G(t)+`
22
+ `)}else process.stderr.write(e+`
23
+ `)}function Xa(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function Za(e,t){let r=!v();if(t.continue)try{J(`tengu_continue_print`,{});let n=await z(void 0,void 0);if(n)return t.forkSession||n.sessionId&&(y(Ht(n.sessionId),n.fullPath?ha(n.fullPath):null),r&&await kt()),da(n,e),dn(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return q(e),B(1),{messages:[]}}if(t.teleport)try{if(!N(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(J(`tengu_teleport_print`,{}),typeof t.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:n,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-Dk5j03Ix.js`);await i();let a=await r(t.teleport),{branchError:o}=await e(a.branch);return{messages:n(a.log,o)}}catch(e){return q(e),B(1),{messages:[]}}if(t.resume)try{J(`tengu_resume_print`,{});let i=Oa(typeof t.resume==`string`?t.resume:``);if(!i){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof t.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${t.resume}" is not a valid UUID`),Ya(e,t.outputFormat),B(1),{messages:[]}}if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([Kt(i.sessionId),t.restoredWorkerState]);n&&(e(Ji(n)),typeof n.model==`string`&&u(n.model))}else i.isUrl&&i.ingressUrl&&n(process.env.ENABLE_SESSION_PERSISTENCE)&&await E(i.sessionId,i.ingressUrl);let a=await z(i.sessionId,i.jsonlFile||void 0);if(!a||a.messages.length===0)return i.isUrl||n(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(t.sessionStartHooksPromise??V(`startup`))}:(Ya(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),B(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return Ya(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),B(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&(y(Ht(a.sessionId),a.fullPath?ha(a.fullPath):null),r&&await kt()),da(a,e),dn(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return q(e),Ya(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),B(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??V(`startup`))}}function Qa(e,t){let n;return n=typeof e==`string`?e.trim()===``?me([]):me([G({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new Sa(t.sdkUrl,n,t.replayUserMessages):new Xi(n,t.replayUserMessages)}async function $a({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(W(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return W(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await yt(t);return a?(r.add(t),W(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),An({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(W(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function eo(e){return{...e,scope:`dynamic`}}async function to(e,t,n,r){let{allowed:i,blocked:a}=j(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await no(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function no(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i||!pn(r,eo(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){q(e)}await it(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=eo(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await nt(t,r);if(d.push(e),e.type===`connected`){let t=await S(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=qn(e);u[t]=n.message,q(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=eo(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Ha as runHeadless};
@@ -1 +1 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,r as i}from"./analytics-BotDBGh0.js";import{a,i as o,o as s,r as c}from"./grove-DrBVaZSN.js";import{n as l,r as u,t as d}from"./Grove-Dsd7F39b.js";async function f(e){if(!await s())return e(m),null;let[t,n]=await Promise.all([o(),c()]);if(!t.success)return e(m),null;let r=t.data,a=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await o();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:a?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),a(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,r as i}from"./analytics-BotDBGh0.js";import{a,i as o,o as s,r as c}from"./grove-BQisE2JM.js";import{n as l,r as u,t as d}from"./Grove-CjN9DO47.js";async function f(e){if(!await s())return e(m),null;let[t,n]=await Promise.all([o(),c()]);if(!t.success)return e(m),null;let r=t.data,a=n.success?n.data:null;async function u(t){if(t===`escape`||t===`defer`){e(`Privacy settings dialog dismissed`,{display:`system`});return}await f()}async function f(){let t=await o();if(!t.success){e(`Unable to retrieve updated privacy settings`,{display:`system`});return}let n=t.data;e(`"Help improve Claude" set to ${n.grove_enabled?`true`:`false`}.`),r.grove_enabled!==null&&r.grove_enabled!==n.grove_enabled&&i(`tengu_grove_policy_toggled`,{state:n.grove_enabled,location:`settings`})}return r.grove_enabled===null?(0,p.jsx)(d,{showIfAlreadyViewed:!0,onDone:u,location:`settings`}):(0,p.jsx)(l,{settings:r,domainExcluded:a?.domain_excluded,onDone:f})}var p,m;e((()=>{t(),u(),r(),a(),p=n(),m=`Review and manage your privacy settings at https://claude.ai/settings/data-privacy-controls`}))();export{f as call};
@@ -0,0 +1 @@
1
+ import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{I as t,fi as n,t as r}from"./src-CDCSSo0U2.js";import{t as i}from"./jsx-runtime-Bb4Xn-E0.js";import{Cp as a,Fg as o,Fp as s,Hm as c,Ho as l,Ig as u,MC as d,Mo as f,Pp as p,Sp as m,Vm as h,do as g,du as _,ho as v,jC as y,mo as b,uu as x}from"./loadAgentsDir-x3rlgED4.js";import{F as S,j as C,z as w}from"./debug-BrXObCdR.js";import{g as T,n as E}from"./settings-BeLFUeie.js";import{n as D,r as O}from"./analytics-BotDBGh0.js";import{Ot as k,kt as A}from"./prompt-CE3sFmZV.js";import{randomUUID as j}from"crypto";n(),r(),_(),c(),s();var M=i();function N({input:e,progress:n,verbose:r}){return(0,M.jsxs)(t,{flexDirection:`column`,marginTop:1,children:[(0,M.jsx)(h,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),n?(0,M.jsx)(p,{fullOutput:n.fullOutput,output:n.output,elapsedTimeSeconds:n.elapsedTimeSeconds,totalLines:n.totalLines,verbose:r}):x.renderToolUseProgressMessage?.([],{verbose:r,tools:[],terminalSize:void 0})]})}w(),D(),o(),f(),T();function P(){return E().defaultShell??`bash`}_(),k(),d();async function F(t,n,r,i,o){let s=A()&&P()===`powershell`;O(`tengu_input_bash`,{powershell:s});let c=v({content:l({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),d;o({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{d=e?.jsx}},l=e=>{o({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),d]}),shouldHidePromptInput:!1,showSpinner:!1})},f=null;s&&(f=(a(),e(m)).PowerShellTool);let p=f??x,h=(f?await f.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,l):await x.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,l)).data;if(!h)throw Error(`No result received from shell command`);let _=h.stderr,b=await u(p,{...h,stderr:``},j()),S=typeof b.content==`string`?b.content:y(h.stdout);return{messages:[g(),c,...r,v({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${y(_)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[g(),c,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[g(),c,...r,v({content:`<bash-stdout>${y(e.stdout)}</bash-stdout><bash-stderr>${y(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[g(),c,...r,v({content:`<bash-stderr>Command failed: ${y(S(e))}</bash-stderr>`})],shouldQuery:!1}}finally{o(null)}}export{F as processBashCommand};
@@ -0,0 +1,5 @@
1
+ import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{en as t,ht as n,nr as r,t as i}from"./state-ix0xIunV.js";import{Bo as a,C as o,Cl as s,Fh as c,Fw as l,G as u,GS as d,Hd as f,Ho as p,Ih as m,Iw as h,KC as g,Ki as _,LE as v,Lh as y,Lo as b,Mo as x,No as S,Nx as C,Px as w,QD as T,Qi as E,Qv as D,Rw as O,Sc as k,TT as A,US as ee,Ui as te,Vd as ne,W as re,WS as ie,XD as ae,ZD as j,Zi as oe,Zv as se,_h as ce,bc as le,cO as ue,ca as M,co as N,do as P,eT as de,fo as fe,hE as pe,hl as me,ho as F,iT as he,k as ge,mo as _e,ny as I,oy as ve,pl as ye,qC as be,ry as L,sO as xe,tT as Se,ty as Ce,vE as we,vT as Te,vh as R,wl as Ee,xl as z,yT as De,yc as Oe,yo as ke,zE as Ae,zi as je,zw as Me}from"./loadAgentsDir-x3rlgED4.js";import{A as B,D as Ne,a as V,d as Pe,l as H,p as Fe,z as Ie}from"./debug-BrXObCdR.js";import{Nt as Le,Pt as Re}from"./settings-BeLFUeie.js";import{T as U,Y as ze,o as Be,s as W,w as G}from"./log-BMCygSzM.js";import{f as Ve,l as He}from"./file-DcZWPH2V.js";import{n as Ue,r as K}from"./analytics-BotDBGh0.js";import{_n as We,bi as Ge,vn as Ke,yi as qe}from"./model-CZViyZnE.js";import{ct as Je,ot as Ye}from"./esm-5w3xFBnt.js";import{E as Xe,T as Ze,w as Qe}from"./sessionTracing-_Hh5VXxt.js";import{n as $e,t as et}from"./slashCommandParsing-RQb_7Xzt.js";import{randomUUID as q}from"crypto";function tt(e,t,n,r,i){let a=0;for(let o of Le){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let l=s.once?()=>{H(`Removing one-shot hook for event ${o} in skill '${r}'`),y(e,t,o,s)}:void 0;c(e,t,o,n.matcher||``,s,l,i),a++}}a>0&&H(`Registered ${a} hooks from skill '${r}'`)}var nt=e((()=>{Re(),V(),m()}));function J(){return!1}function rt(){if(!J())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function it(e,t,n,r,i,o,s){let c=se(),u=e.pluginInfo?T(e.pluginInfo.repository).marketplace:void 0;K(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...u&&{_PROTO_marketplace_name:u},...L(e.pluginInfo)}});let{skillContent:d,modifiedGetAppState:m,baseAgent:h,promptMessages:g}=await Ee(e,t,n);H(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let _=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&rt();let v=!1;if(_.kairosEnabled&&(v=!0),v){let t=l(),r=M(e),i=qe(),a=e=>De({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!s?.runId)return;let e=await de({runId:s.runId,rootDir:s.rootDir,priority:`later`,workload:i});for(let t of e)Te(t)},d=async e=>{s?.runId&&await Se({runId:s.runId,rootDir:s.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 Ke(Q);let s=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of R({agentDefinition:h,promptMessages:g,toolUseContext:{...n,getAppState:m,abortController:t},canUseTool:o,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:s,override:{agentId:c}}))l.push(r);let d=z(l,`Command completed`);H(`Background forked command /${r} completed (agent ${c})`),a(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){W(e)}})().catch(async e=>{W(e),a(`<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:!!s?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,C=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:d,agentId:c},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:q()}),w=()=>{i({jsx:f(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};w();try{for await(let t of R({agentDefinition:h,promptMessages:g,toolUseContext:{...n,getAppState:m},canUseTool:o,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=a([t]);if(t.type===`assistant`){let r=pe(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(C(t)),w())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(C(t)),w())}}}finally{i(null)}let E=z(y,`Command completed`);return H(`Forked slash command /${e.name} completed with agent ${c}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${He(O(c))}\n${E}`),{messages:[F({content:p({inputString:`/${M(e)} ${t}`.trim(),precedingInputBlocks:r})}),F({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function at(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function ot(e,t,n,i,a,o,s,c,l,u){let d=$e(e);if(!d){K(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[P(),...i,F({content:p({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:m,isMcp:h}=d,g=h?`mcp`:je().has(f)?f:`custom`;if(!oe(f,a.options.commands)){let n=!1;try{await Pe().stat(`/${f}`),n=!0}catch{}if(at(f)&&!n){K(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[P(),...i,F({content:p({inputString:e,precedingInputBlocks:t})}),...m?[fe(`Args from unknown skill: ${m}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let a=q();return r(a),K(`tengu_input_prompt`,{}),Ze(`user_prompt`,{prompt_length:String(e.length),prompt:Xe(e),"prompt.id":a}),{messages:[F({content:p({inputString:e,precedingInputBlocks:t}),uuid:s}),...i],shouldQuery:!0}}let{messages:_,shouldQuery:v,allowedTools:y,model:x,command:C,resultText:w,nextInput:E,submitNextInput:D,deferAutonomyCompletion:O}=await st(f,m,o,a,t,n,c,l,s,u);if(_.length===0){let e={input:g};if(C.type===`prompt`&&C.pluginInfo){let{pluginManifest:t,repository:n}=C.pluginInfo,{marketplace:r}=T(n),i=j(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,L(C.pluginInfo))}return K(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...C.type===`prompt`&&{skill_source:C.source},...C.loadedFrom&&{skill_loaded_from:C.loadedFrom},...C.kind&&{skill_kind:C.kind}}}),{messages:[],shouldQuery:!1,model:x,nextInput:E,submitNextInput:D,deferAutonomyCompletion:O}}if(_.length===2&&_[1].type===`user`&&typeof _[1].message.content==`string`&&_[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||K(`tengu_input_slash_invalid`,{input:f}),{messages:[P(),..._],shouldQuery:v,allowedTools:y,model:x};let k={input:g};if(C.type===`prompt`&&C.pluginInfo){let{pluginManifest:e,repository:t}=C.pluginInfo,{marketplace:n}=T(t),r=j(n);k._PROTO_plugin_name=e.name,n&&(k._PROTO_marketplace_name=n),k.plugin_repository=r?t:`third-party`,k.plugin_name=r?e.name:`third-party`,r&&e.version&&(k.plugin_version=e.version),Object.assign(k,L(C.pluginInfo))}K(`tengu_input_command`,{...k,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...C.type===`prompt`&&{skill_source:C.source},...C.loadedFrom&&{skill_loaded_from:C.loadedFrom},...C.kind&&{skill_kind:C.kind}}});let A=_.length>0&&_[0]&&S(_[0]);return{messages:v||_.every(b)||A?_:[P(),..._],shouldQuery:v,allowedTools:y,model:x,resultText:w,nextInput:E,submitNextInput:D,deferAutonomyCompletion:O}}async function st(e,t,n,r,i,a,o,s,c,l){let u=_(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&I(e),u.userInvocable===!1)return{messages:[F({content:p({inputString:`/${e}`,precedingInputBlocks:i})}),F({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=>F({content:e,isMeta:!0})),s=w()&&typeof n==`string`&&n.endsWith(` dismissed`),c=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[N(Y(u,c)),N(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[F({content:p({inputString:Y(u,c),precedingInputBlocks:i})}),F(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${xe}</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=>{W(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=F({content:p({inputString:Y(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=P(),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?[F({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 Ae(),{messages:ye(r),shouldQuery:!1,command:u}}return{messages:[e,N(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return W(t),{messages:[e,N(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await it(u,t,r,i,n,s??re,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof Ne?{messages:[F({content:p({inputString:Y(u,t),precedingInputBlocks:i})}),_e({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[F({content:p({inputString:Y(u,t),precedingInputBlocks:i})}),F({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof B)return{messages:[F({content:p({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function Y(e,t){return ke(M(e),t)}function X(e,t=`loading`){return[`<${G}>${e}</${G}>`,`<${U}>${e}</${U}>`,`<skill-format>true</skill-format>`].join(`
2
+ `)}function ct(e,t){return[`<${G}>${e}</${G}>`,`<${U}>/${e}</${U}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
3
+ `)}function lt(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?X(e.name,e.progressMessage):ct(e.name,t)}async function ut(e,t,n,r,i=[]){let a=te(e,n);if(!a)throw new B(`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,r,a=[],o=[],s){let c=await e.getPromptForCommand(t,r),l=!ie(`hooks`)||d(e.source);if(e.hooks&&l){let t=n();tt(r.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let u=e.source?`${e.source}:${e.name}`:e.name,f=c.filter(e=>e.type===`text`).map(e=>e.text).join(`
4
+
5
+ `);i(e.name,u,f,Ye()?.agentId??null);let p=lt(e,t),m=ge(e.allowedTools??[]),h=o.length>0||a.length>0?[...o,...a,...c]:c,g=await be(le(c.filter(e=>e.type===`text`).map(e=>e.text).join(` `),r,null,[],r.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[F({content:p,uuid:s}),F({content:h,isMeta:!0}),...g,Oe({type:`command_permissions`,allowedTools:m,model:e.model})],shouldQuery:!0,allowedTools:m,model:e.model,command:e}}var Q,$;e((()=>{t(),E(),ue(),ze(),Ue(),Me(),me(),v(),ce(),ne(),h(),Je(),k(),V(),Ie(),Ve(),s(),Fe(),C(),g(),nt(),Be(),A(),x(),o(),u(),ae(),ee(),et(),We(),Ce(),Qe(),ve(),we(),D(),he(),Ge(),Q=200,$=1e4}))();export{X as formatSkillLoadingMetadata,ut as processPromptSlashCommand,ot as processSlashCommand};
@@ -0,0 +1 @@
1
+ import{i as e,r as t}from"./prompt-CE3sFmZV.js";t();export{e as isDeferredTool};