@readmagic/workmate 0.0.4 → 0.0.5

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 (402) hide show
  1. package/dist/chunks/{AddWorkspaceDirectory-BTC7FPqM.js → AddWorkspaceDirectory-DJRkEz7o.js} +1 -1
  2. package/dist/chunks/{App-DOm71vtY.js → App-iJu5qyiF.js} +1 -1
  3. package/dist/chunks/ApproveApiKey-CKfn7U1R.js +1 -0
  4. package/dist/chunks/{ApproveApiKey-9YQzwrrC.js → ApproveApiKey-CRejTHUw.js} +1 -1
  5. package/dist/chunks/{AssistantSessionChooser-CnYfFWrx.js → AssistantSessionChooser-CBLQ1v-J.js} +1 -1
  6. package/dist/chunks/BackgroundTasksDialog-CyoLEYWH.js +2 -0
  7. package/dist/chunks/{BypassPermissionsModeDialog-DAq-qbqC.js → BypassPermissionsModeDialog-D1FCKVOi.js} +1 -1
  8. package/dist/chunks/{ClaudeMdExternalIncludesDialog-CyvidoR3.js → ClaudeMdExternalIncludesDialog-CI0yF6sZ.js} +1 -1
  9. package/dist/chunks/ClaudeMdExternalIncludesDialog-TypH-X8e.js +1 -0
  10. package/dist/chunks/ConsoleOAuthFlow-wGQuFt41.js +1 -0
  11. package/dist/chunks/{DesktopHandoff-gRvy-WlW.js → DesktopHandoff-D1rrMxeP.js} +1 -1
  12. package/dist/chunks/{DiffDialog-CdfVTgOx.js → DiffDialog-BKcfKx7O.js} +2 -2
  13. package/dist/chunks/Doctor-CcJUwSQn.js +1 -0
  14. package/dist/chunks/Doctor-Yco1McrL.js +3 -0
  15. package/dist/chunks/ExitFlow-D3csukbB.js +2 -0
  16. package/dist/chunks/{Feedback-gGpjUC_F.js → Feedback-bEUtrHia.js} +2 -2
  17. package/dist/chunks/Grove-DPkIjqg8.js +1 -0
  18. package/dist/chunks/{Grove-CD769Wvw.js → Grove-Dsd7F39b.js} +1 -1
  19. package/dist/chunks/{HybridTransport-kN1jmg26.js → HybridTransport-9fTBC2Pv.js} +1 -1
  20. package/dist/chunks/{InvalidConfigDialog-BpJub73a.js → InvalidConfigDialog-9M-1nfZ6.js} +1 -1
  21. package/dist/chunks/{InvalidSettingsDialog-DzOp3Ihx.js → InvalidSettingsDialog-B2F6pryH.js} +1 -1
  22. package/dist/chunks/MCPConnectionManager-MWpKjeZT.js +1 -0
  23. package/dist/chunks/{McpParsingWarnings-Cc6FWyU4.js → McpParsingWarnings-BPBb7Npe.js} +1 -1
  24. package/dist/chunks/MessageSelector-DsQmqFt2.js +3 -0
  25. package/dist/chunks/Messages-B3sGRx5A.js +11 -0
  26. package/dist/chunks/{Onboarding-D00lTweB.js → Onboarding-cHcnsBGp.js} +1 -1
  27. package/dist/chunks/{OverageCreditUpsell-B-Bf_-UX.js → OverageCreditUpsell-CWCD_RpM.js} +1 -1
  28. package/dist/chunks/PluginSettings-B0jbwB2M.js +17 -0
  29. package/dist/chunks/{PromptInputFooterSuggestions-MwS_cExV.js → PromptInputFooterSuggestions-D5sAO6y-.js} +1 -1
  30. package/dist/chunks/{PromptInputHelpMenu-V2dEpzhC.js → PromptInputHelpMenu-n6hAdsto.js} +1 -1
  31. package/dist/chunks/QueryEngine-cwdsr4dr.js +1 -0
  32. package/dist/chunks/REPL-CJzScgbZ.js +142 -0
  33. package/dist/chunks/REPL-DlBJIPCw.js +1 -0
  34. package/dist/chunks/{RemoteCallout-ChCjmgw1.js → RemoteCallout-CiA4rCEs.js} +1 -1
  35. package/dist/chunks/RemoteSessionManager-zdHfmvfj.js +2 -0
  36. package/dist/chunks/ResumeConversation-Rxwd6HAJ.js +1 -0
  37. package/dist/chunks/{SSETransport-h43pQVlJ.js → SSETransport-BPbhCa2f.js} +3 -3
  38. package/dist/chunks/SearchExtraToolsTool-VP87ErGx.js +1 -0
  39. package/dist/chunks/Settings-CxI_KHUj.js +2 -0
  40. package/dist/chunks/{TeleportProgress-QtJrXSCX.js → TeleportProgress-DrulEQ7z.js} +1 -1
  41. package/dist/chunks/{TeleportRepoMismatchDialog-D-HVj-A6.js → TeleportRepoMismatchDialog-D3FOLr0P.js} +1 -1
  42. package/dist/chunks/{TeleportResumeWrapper-C6sbzJsJ.js → TeleportResumeWrapper-DI5iRFND.js} +1 -1
  43. package/dist/chunks/{ThemePicker-CqPCp5Hs.js → ThemePicker-CQ7dfFtv.js} +1 -1
  44. package/dist/chunks/{TrustDialog-CeVwxDlZ.js → TrustDialog-CnVKrdxQ.js} +1 -1
  45. package/dist/chunks/{ValidationErrorsList-Bl68E-2-.js → ValidationErrorsList-CPYeuppg.js} +1 -1
  46. package/dist/chunks/{WelcomeV2-DNiXQ5ES.js → WelcomeV2-C-UXdIng.js} +1 -1
  47. package/dist/chunks/{add-dir-V3xjklnJ.js → add-dir-xTz4COgn.js} +1 -1
  48. package/dist/chunks/{agentDisplay-BuiwcrQi.js → agentDisplay-BuSReYxu.js} +1 -1
  49. package/dist/chunks/{agents-ZY6IaVE7.js → agents-CiLlKN2I.js} +1 -1
  50. package/dist/chunks/agents-Du9KYHqN.js +103 -0
  51. package/dist/chunks/allErrors-P3utlEeA.js +1 -0
  52. package/dist/chunks/{ant-D66LZCap.js → ant-CBIfqmAb.js} +1 -1
  53. package/dist/chunks/api-B-5jqiMg.js +1 -0
  54. package/dist/chunks/api-BiwZmmsh.js +1 -0
  55. package/dist/chunks/{assistant-CYF7ch7C.js → assistant-XOnU01yl.js} +1 -1
  56. package/dist/chunks/auth-BQa4kzQo.js +1 -0
  57. package/dist/chunks/auth-DT2yxy94.js +15 -0
  58. package/dist/chunks/auth-UAJhZNmZ.js +1 -0
  59. package/dist/chunks/{autoMode-TysBQkU_.js → autoMode-CEMflt3g.js} +1 -1
  60. package/dist/chunks/{autonomy-CNEbT-t_.js → autonomy-Cg5zweUa.js} +7 -7
  61. package/dist/chunks/{autonomy-k3QPea5z.js → autonomy-_N8aDaA8.js} +1 -1
  62. package/dist/chunks/{autonomyPanel-DiztRblF.js → autonomyPanel-I4yCy3Fr.js} +1 -1
  63. package/dist/chunks/backgroundHousekeeping-BUUZ7Csq.js +1 -0
  64. package/dist/chunks/backgroundHousekeeping-DhF2lrQ9.js +17 -0
  65. package/dist/chunks/{branch-_NBgDfrK.js → branch-BIX-pyHp.js} +1 -1
  66. package/dist/chunks/{bridge-DpmFl8p8.js → bridge-CYskzVt8.js} +2 -2
  67. package/dist/chunks/{bridgeConfig-DMBOO3gW.js → bridgeConfig-5p_w4s5r.js} +1 -1
  68. package/dist/chunks/bridgeConfig-DWEqKbXk.js +1 -0
  69. package/dist/chunks/bridgeEnabled-CjVCMwnq.js +1 -0
  70. package/dist/chunks/bridgeEnabled-DhFrLTbG.js +1 -0
  71. package/dist/chunks/bridgeMain-6lollTtZ.js +1 -0
  72. package/dist/chunks/bridgeMain-BX2AkLPs.js +68 -0
  73. package/dist/chunks/{bridgeMessaging-N5zlzCCr.js → bridgeMessaging-B5Lbzr8e.js} +1 -1
  74. package/dist/chunks/{btw-BFRje_Zi.js → btw-CWWFO7u8.js} +1 -1
  75. package/dist/chunks/caches-C46fa77L.js +1 -0
  76. package/dist/chunks/{caches-CcfPJ4_A.js → caches-DPqPIogk.js} +2 -2
  77. package/dist/chunks/{ccrClient-q2JCVCU2.js → ccrClient-CTLnU9Y1.js} +1 -1
  78. package/dist/chunks/{clear-CxY7W5Wt.js → clear-DCAgZwc4.js} +1 -1
  79. package/dist/chunks/client-Bup0Sgcn.js +1 -0
  80. package/dist/chunks/{color-DOWhfjnA.js → color-CmJGInHL.js} +1 -1
  81. package/dist/chunks/commands-BdB1eFvP.js +1 -0
  82. package/dist/chunks/{commitAttribution-CLbEIaRJ.js → commitAttribution-CGZr7XNO.js} +2 -2
  83. package/dist/chunks/commitAttribution-D6J3NuhB.js +1 -0
  84. package/dist/chunks/compact-C6-lMHgn.js +2 -0
  85. package/dist/chunks/{config-DiT2Z8dY.js → config-3m_9zSrj.js} +1 -1
  86. package/dist/chunks/config-Bxt1UH1T.js +1 -0
  87. package/dist/chunks/config-CjjXZfNi.js +1 -0
  88. package/dist/chunks/{context-B2OvKo2t.js → context-C9V4GF0n.js} +1 -1
  89. package/dist/chunks/{context-noninteractive-BuGxX3YL.js → context-noninteractive-BmC4o5xo.js} +2 -2
  90. package/dist/chunks/context-noninteractive-DvGo1l7b.js +1 -0
  91. package/dist/chunks/conversation-CH9ouFai.js +1 -0
  92. package/dist/chunks/conversation-CYqqk0o7.js +1 -0
  93. package/dist/chunks/{createSSHSession-C-c7I5iJ.js → createSSHSession-BL6j0AU5.js} +1 -1
  94. package/dist/chunks/createSession-DUfOAeyE.js +1 -0
  95. package/dist/chunks/{createSession-D_fIDqgc.js → createSession-D_sgO1Xy.js} +1 -1
  96. package/dist/chunks/crossProjectResume-D5hTOfnE.js +40 -0
  97. package/dist/chunks/{datadog-Ed8emSFA.js → datadog-UkGdjL8-.js} +1 -1
  98. package/dist/chunks/{desktop-D_ofPlyi.js → desktop-HbYKh-VK.js} +1 -1
  99. package/dist/chunks/{diff-CUAgBDu1.js → diff-nTV17iWX.js} +1 -1
  100. package/dist/chunks/doctor-7fgVhEKL.js +1 -0
  101. package/dist/chunks/{entry-Bh0gPOAo.js → entry-CCFI6-gM.js} +3 -3
  102. package/dist/chunks/envLessBridgeConfig-B2HYnEKo.js +1 -0
  103. package/dist/chunks/{envLessBridgeConfig-DJHZAlU-.js → envLessBridgeConfig-DXd10GXD.js} +1 -1
  104. package/dist/chunks/{esm-B62dCLgf.js → esm-CGoYrggU.js} +1 -1
  105. package/dist/chunks/exit-ropaQiOr.js +1 -0
  106. package/dist/chunks/extra-usage-CLhv1Z4g.js +1 -0
  107. package/dist/chunks/{extra-usage-core-B6ga8Rni.js → extra-usage-core-DLYHAInT.js} +1 -1
  108. package/dist/chunks/{extra-usage-CjaHpu8y.js → extra-usage-g2Pw4zt_.js} +1 -1
  109. package/dist/chunks/{extra-usage-noninteractive-Dc9AndId.js → extra-usage-noninteractive-D8iszH3c.js} +1 -1
  110. package/dist/chunks/extraUsage-C2Ylufhj.js +1 -0
  111. package/dist/chunks/extractMemories-B2IAvbXM.js +1 -0
  112. package/dist/chunks/{fast-CW_NsL0x.js → fast-Dx2fTmWr.js} +1 -1
  113. package/dist/chunks/fast-_G6zcFye.js +1 -0
  114. package/dist/chunks/{feedback-BpRorTAC.js → feedback-DCQ4pJ3v.js} +1 -1
  115. package/dist/chunks/{firstPartyEventLogger-CuUiNdj8.js → firstPartyEventLogger-BNGPPBNP.js} +2 -2
  116. package/dist/chunks/firstPartyEventLogger-C9LzVy6y.js +1 -0
  117. package/dist/chunks/{flushGate-BltVae97.js → flushGate-XaheIZZT.js} +1 -1
  118. package/dist/chunks/{gemini-YyIxfveQ.js → gemini-BCCLHK3K.js} +1 -1
  119. package/dist/chunks/{generateRecap-tx4wLIkI.js → generateRecap-BhvbixY2.js} +1 -1
  120. package/dist/chunks/{generateSessionName-BkDigIN8.js → generateSessionName-CN1oh7Fa.js} +1 -1
  121. package/dist/chunks/{githubRepoPathMapping-C4umZ1oC.js → githubRepoPathMapping-B4AM8luI.js} +1 -1
  122. package/dist/chunks/{goal-DZrD4puM.js → goal-Bp6fyGqo.js} +3 -3
  123. package/dist/chunks/{grok-BZf7W_hL.js → grok-ax26ju8y.js} +1 -1
  124. package/dist/chunks/{grove-CFBPplP6.js → grove-DrBVaZSN.js} +2 -2
  125. package/dist/chunks/{heapdump-DWc3Z2NO.js → heapdump-JseysNDr.js} +1 -1
  126. package/dist/chunks/{help-pap9jNUJ.js → help-DR9hKneR.js} +1 -1
  127. package/dist/chunks/hooks-BUJLxdFJ.js +1 -0
  128. package/dist/chunks/{hooks-Bmat0L6A.js → hooks-C5n23H1E.js} +2 -2
  129. package/dist/chunks/inboundAttachments-C0nMTtCi.js +1 -0
  130. package/dist/chunks/{inboundAttachments-DkfNHtF9.js → inboundAttachments-Cp8XvLMZ.js} +1 -1
  131. package/dist/chunks/initReplBridge-DJs28ZkI.js +1 -0
  132. package/dist/chunks/{install-D4jmHjmk.js → install-C7qTB0V5.js} +1 -1
  133. package/dist/chunks/{instrumentation-Nqgm1SMw.js → instrumentation-CLZttr_u.js} +4 -4
  134. package/dist/chunks/{job-CT9bcgPb.js → job-BhiazwPH.js} +1 -1
  135. package/dist/chunks/keybindings-CkL8BzUt.js +2 -0
  136. package/dist/chunks/{language-BA5WprZv.js → language-DIw2871r.js} +1 -1
  137. package/dist/chunks/language-DfOAuDFc.js +1 -0
  138. package/dist/chunks/launchAgentsPlatform-j-mWpwW1.js +1 -0
  139. package/dist/chunks/{launchLocalMemory-CRMqifzn.js → launchLocalMemory-DmoXp0Xo.js} +2 -2
  140. package/dist/chunks/{launchLocalVault-DlKX_oDE.js → launchLocalVault-1uKe0HjA.js} +3 -3
  141. package/dist/chunks/launchMemoryStores-SxDKjHJ3.js +1 -0
  142. package/dist/chunks/{launchOnboarding-DTdUA_wE.js → launchOnboarding-CTtpnXcs.js} +1 -1
  143. package/dist/chunks/launchSchedule-BDVnGhaL.js +1 -0
  144. package/dist/chunks/launchSkillStore-SmMLxp4K.js +1 -0
  145. package/dist/chunks/{launchTeleport-CXFRPVMR.js → launchTeleport-B472ZSGz.js} +3 -3
  146. package/dist/chunks/launchVault-CsyBgxle.js +1 -0
  147. package/dist/chunks/{loadAgentsDir-BURvZNN6.js → loadAgentsDir-Clu7Uk6a.js} +629 -629
  148. package/dist/chunks/loadAgentsDir-DTbJJff-.js +1 -0
  149. package/dist/chunks/loadPluginHooks-Cvd5VdjQ.js +1 -0
  150. package/dist/chunks/localSearch-DKv8PRLD.js +1 -0
  151. package/dist/chunks/{localSearch-D2Rs8wQP.js → localSearch-iA6JTk19.js} +1 -1
  152. package/dist/chunks/{logoV2Utils-DN9nzdX-.js → logoV2Utils-YHBJLIrC.js} +1 -1
  153. package/dist/chunks/{magicDocs-DIeTcwAA.js → magicDocs-Bf1fqnHN.js} +3 -3
  154. package/dist/chunks/{main-CI54PZrG.js → main-gtV_TqXP.js} +84 -84
  155. package/dist/chunks/{mappers-Q_Z3Kjo-.js → mappers-C8lYERPX.js} +1 -1
  156. package/dist/chunks/{mcp-RvwPC7FB.js → mcp-CNuhEGP6.js} +4 -4
  157. package/dist/chunks/mcp-Ci0OPVrR.js +1 -0
  158. package/dist/chunks/mcp-CwIYauZl.js +2 -0
  159. package/dist/chunks/memory-DCGqfQ1U.js +1 -0
  160. package/dist/chunks/{mode-Jl_Boaym.js → mode-DO6g7nkX.js} +2 -2
  161. package/dist/chunks/model-BQF64tZx.js +1 -0
  162. package/dist/chunks/model-DLXL0CNu.js +1 -0
  163. package/dist/chunks/model-DvrvG6BB.js +1 -0
  164. package/dist/chunks/{nativeInstaller-8arnRiUO.js → nativeInstaller-OPuO2sm_.js} +1 -1
  165. package/dist/chunks/{onChangeAppState-DBantDJ6.js → onChangeAppState-CHhRDkM7.js} +1 -1
  166. package/dist/chunks/openai-HOebt-8k.js +10 -0
  167. package/dist/chunks/{overageCreditGrant-CN_sVURL.js → overageCreditGrant-Bi1CTBAx.js} +1 -1
  168. package/dist/chunks/{panelCall-CPKC6VR5.js → panelCall-D0eURklm.js} +1 -1
  169. package/dist/chunks/{partition-CW0BJ881.js → partition-C8RSL3SQ.js} +1 -1
  170. package/dist/chunks/{passes-DOm9ukdK.js → passes-BJci5SM_.js} +1 -1
  171. package/dist/chunks/permissions-JU9CGHgI.js +3 -0
  172. package/dist/chunks/{pidLock-C69HNTTb.js → pidLock-Bd2e6xuT.js} +2 -2
  173. package/dist/chunks/{plan-B0rEs32a.js → plan-D4gMsK7i.js} +1 -1
  174. package/dist/chunks/{plugin-BSEMgcGu.js → plugin-CwCo5Kik.js} +1 -1
  175. package/dist/chunks/{pluginAutoupdate-CTByPD8J.js → pluginAutoupdate-CO-n9bqe.js} +1 -1
  176. package/dist/chunks/{pluginBlocklist-mogKaK0p.js → pluginBlocklist-5qbaTRbV.js} +1 -1
  177. package/dist/chunks/pluginCliCommands-I-lsw_us.js +1 -0
  178. package/dist/chunks/{pluginFlagging-mHNff1t9.js → pluginFlagging-DNPBbJZo.js} +1 -1
  179. package/dist/chunks/{pluginOperations-JEedVzfS.js → pluginOperations-Cz6eQ0Vu.js} +2 -2
  180. package/dist/chunks/pluginStartupCheck-CoW7073W.js +1 -0
  181. package/dist/chunks/{pluginStartupCheck-RscVZDi4.js → pluginStartupCheck-DJ9fslCK.js} +1 -1
  182. package/dist/chunks/plugins-CzJIuPfb.js +4 -0
  183. package/dist/chunks/policyLimits-BkjgMQD0.js +1 -0
  184. package/dist/chunks/{poor-DekfGNT7.js → poor-Dha9p9RF.js} +1 -1
  185. package/dist/chunks/{poorMode-CtcqaiwD.js → poorMode-1NLYiS3Y.js} +1 -1
  186. package/dist/chunks/poorMode-qlxqU8Hm.js +1 -0
  187. package/dist/chunks/print-BL4EUT5Z.js +23 -0
  188. package/dist/chunks/{privacy-settings-CwJ1H8Ua.js → privacy-settings-6ZWxR4Qt.js} +1 -1
  189. package/dist/chunks/processBashCommand-BZs9wggV.js +1 -0
  190. package/dist/chunks/processSlashCommand-D8lKLNzM.js +5 -0
  191. package/dist/chunks/{prompt-DNDgGM9q.js → prompt-Bg_1U0gO.js} +1 -1
  192. package/dist/chunks/prompt-CN7gBNKS.js +1 -0
  193. package/dist/chunks/prompt-D-zHhqp8.js +1 -0
  194. package/dist/chunks/{promptEditor-DMJyosKj.js → promptEditor-BhYDmwdS.js} +2 -2
  195. package/dist/chunks/{protocolHandler-z2zxAtB1.js → protocolHandler-Dnb7lITm.js} +1 -1
  196. package/dist/chunks/rate-limit-options-DVzT3eWH.js +1 -0
  197. package/dist/chunks/{rcDebugLog-DoL1FpGJ.js → rcDebugLog-VKwMl0yg.js} +1 -1
  198. package/dist/chunks/reconciler-BdRXZTJf.js +4 -0
  199. package/dist/chunks/{referral-UKJv23_5.js → referral-BlrMpBAV.js} +1 -1
  200. package/dist/chunks/{refresh-ul_i5R1a.js → refresh-jwqnoK2h.js} +1 -1
  201. package/dist/chunks/{registerProtocol-CukLQuxJ.js → registerProtocol-CuKZAiCc.js} +1 -1
  202. package/dist/chunks/{release-notes-CGv_6MMt.js → release-notes-BgP8u7NE.js} +1 -1
  203. package/dist/chunks/{releaseNotes-BKZNuDLD.js → releaseNotes-CunqVlbU.js} +2 -2
  204. package/dist/chunks/{reload-plugins-2W11dpLQ.js → reload-plugins-CD9TzvFm.js} +1 -1
  205. package/dist/chunks/{remote-env-D9xsoBfx.js → remote-env-QaP_W_sv.js} +1 -1
  206. package/dist/chunks/{remoteBridgeCore-asY9JAXU.js → remoteBridgeCore-9-HVMo63.js} +1 -1
  207. package/dist/chunks/{remoteManagedSettings-Bxo3bv1U.js → remoteManagedSettings-jZ6u8ZBT.js} +1 -1
  208. package/dist/chunks/{rename-CHsHMWpO.js → rename-29qxHf8W.js} +1 -1
  209. package/dist/chunks/{resume-NduOaghx.js → resume-D-SpOy_1.js} +2 -2
  210. package/dist/chunks/{runtimeObserver-Bo80nWQf.js → runtimeObserver-DOEcrylu.js} +1 -1
  211. package/dist/chunks/{runtimeObserver-BXbjibFk.js → runtimeObserver-Dm3LIUMp.js} +3 -3
  212. package/dist/chunks/sandbox-adapter-LzTcKwBp.js +1 -0
  213. package/dist/chunks/{sandbox-toggle-C-WCDRN4.js → sandbox-toggle-B61AeBor.js} +1 -1
  214. package/dist/chunks/searchExtraTools-CbJJQqzH.js +1 -0
  215. package/dist/chunks/{session-pDd13-wE.js → session-RwJCIIcs.js} +2 -2
  216. package/dist/chunks/{sessionDiscovery-CSUnpsCy.js → sessionDiscovery-dkFeWcA3.js} +1 -1
  217. package/dist/chunks/sessionFileAccessHooks-B_nNW0zE.js +1 -0
  218. package/dist/chunks/sessionMemory-C4JAUZ6V.js +1 -0
  219. package/dist/chunks/sessionMemory-btARBn8H.js +1 -0
  220. package/dist/chunks/sessionMemoryUtils-BlqAy8oR.js +1 -0
  221. package/dist/chunks/{sessionObserver-Ur7PqKl_.js → sessionObserver-CSOYgsvH.js} +1 -1
  222. package/dist/chunks/sessionObserver-DMvWci8-.js +1 -0
  223. package/dist/chunks/sessionStorage-Diyuvt20.js +1 -0
  224. package/dist/chunks/{sessionTitle-pWMaI79N.js → sessionTitle-CLOlPZ_M.js} +1 -1
  225. package/dist/chunks/{sessionTracing-CCPRzOvy.js → sessionTracing-D8wr9j4X.js} +1 -1
  226. package/dist/chunks/{settings-DfWP5y6X.js → settings-Dlp5JTa_.js} +1 -1
  227. package/dist/chunks/settingsSync-QWA0VZSu.js +1 -0
  228. package/dist/chunks/setup-UI9uv2-K.js +3 -0
  229. package/dist/chunks/{shadowedRuleDetection-Chi3afMR.js → shadowedRuleDetection-CXsmUY2o.js} +1 -1
  230. package/dist/chunks/{sideQuestion-D03MXdE2.js → sideQuestion-CHpOVzY5.js} +1 -1
  231. package/dist/chunks/{sinks-B4_pw0Gb.js → sinks-1hFrW9HK.js} +2 -2
  232. package/dist/chunks/sinks-CXq8-7Qn.js +1 -0
  233. package/dist/chunks/{skill-learning-7ZQF5JvA.js → skill-learning-Ck17rwH8.js} +1 -1
  234. package/dist/chunks/skillChangeDetector-s0F9Yf9a.js +1 -0
  235. package/dist/chunks/{skillGapStore-BND2Lq0Z.js → skillGapStore-BJ1h2LVr.js} +1 -1
  236. package/dist/chunks/{skillGapStore-z3LP64O-.js → skillGapStore-DyqNKuNy.js} +2 -2
  237. package/dist/chunks/{skillGenerator-DaNb-yKH.js → skillGenerator-BT8NGzXT.js} +2 -2
  238. package/dist/chunks/skillLearning-1ZfYIzfL.js +1 -0
  239. package/dist/chunks/{skillLearning-rMX1bSBa.js → skillLearning-Cn9Uw0Kd.js} +1 -1
  240. package/dist/chunks/{skillPanel-q7GPSQ6_.js → skillPanel-N0GoWjIi.js} +3 -3
  241. package/dist/chunks/{skillSearchPanel-oj8gy1ZL.js → skillSearchPanel-CTwtgTzy.js} +3 -3
  242. package/dist/chunks/{skills-QqbeFP0s.js → skills-Bv3lH-aA.js} +1 -1
  243. package/dist/chunks/{stats-DmFubHpI.js → stats-C1Ff6w4i.js} +1 -1
  244. package/dist/chunks/{status-DW3Z_7xa.js → status-DyXiBa0m.js} +2 -2
  245. package/dist/chunks/{status-BEIsLmfj.js → status-FD7HVYS7.js} +1 -1
  246. package/dist/chunks/{statusNoticeHelpers-CaHS8xig.js → statusNoticeHelpers-kTp9Rdk6.js} +1 -1
  247. package/dist/chunks/{tag-CRg93Die.js → tag-RzOSA5T0.js} +2 -2
  248. package/dist/chunks/{tasks-BEohK1ij.js → tasks-eJrOcdhB.js} +1 -1
  249. package/dist/chunks/teleport-ABA-hdmP.js +1 -0
  250. package/dist/chunks/{templateJobs-DYP1fjYU.js → templateJobs-BnOBSFtq.js} +1 -1
  251. package/dist/chunks/{terminalSetup-RDKg8dVa.js → terminalSetup-BfvmoJaK.js} +1 -1
  252. package/dist/chunks/{terminalSetup-BNs9nLbT.js → terminalSetup-D_P5iZmq.js} +1 -1
  253. package/dist/chunks/{theme-kNL4kl_3.js → theme-S0kVMVt4.js} +1 -1
  254. package/dist/chunks/thinkback-C6gV2LpU.js +1 -0
  255. package/dist/chunks/thinkback-HyW_R_88.js +1 -0
  256. package/dist/chunks/{thinkback-play-BpWMqbgJ.js → thinkback-play-H6md4czq.js} +1 -1
  257. package/dist/chunks/{toolEventObserver-ar5NDa0M.js → toolEventObserver--Z6jENks.js} +1 -1
  258. package/dist/chunks/{toolEventObserver-C98uraqD.js → toolEventObserver-BAFzvePj.js} +1 -1
  259. package/dist/chunks/toolPool-CR61XXm3.js +1 -0
  260. package/dist/chunks/trustedDevice-DUrFWupL.js +1 -0
  261. package/dist/chunks/{trustedDevice-BBKUhCCL.js → trustedDevice-Dn4rXbxT.js} +1 -1
  262. package/dist/chunks/types-Bh9S_JG5.js +3 -0
  263. package/dist/chunks/types-DHkZVzJe.js +1 -0
  264. package/dist/chunks/{ultrareviewCommand-yXlFsMnv.js → ultrareviewCommand-mYDTBCFD.js} +2 -2
  265. package/dist/chunks/{undercover-BTIRVF1t.js → undercover-CdapzvNH.js} +1 -1
  266. package/dist/chunks/undercover-k3JoOKAb.js +1 -0
  267. package/dist/chunks/{updateCCB-B2xAJ4Nr.js → updateCCB-DPShheOr.js} +1 -1
  268. package/dist/chunks/upgrade-BOeakAP6.js +1 -0
  269. package/dist/chunks/upgrade-D7iGU0PQ.js +1 -0
  270. package/dist/chunks/{upload-BWVIHmMB.js → upload-BXQsDtLW.js} +1 -1
  271. package/dist/chunks/usage-DbRdMJog.js +1 -0
  272. package/dist/chunks/usage-iNQzY960.js +1 -0
  273. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-CV4GZ-sq.js → useExitOnCtrlCDWithKeybindings-CntByfTQ.js} +1 -1
  274. package/dist/chunks/useMainLoopModel-DHkRIgNs.js +1 -0
  275. package/dist/chunks/useManagePlugins-B8HD0RUh.js +1 -0
  276. package/dist/chunks/{useMergedTools-CRLWSGDl.js → useMergedTools-DfchLQZC.js} +1 -1
  277. package/dist/chunks/{useSearchInput-BzGq4t7t.js → useSearchInput-H-8hJeFD.js} +1 -1
  278. package/dist/chunks/useSettingsErrors-BF5i5Xju.js +1 -0
  279. package/dist/chunks/{util-BnReK81E.js → util-CoicMvOv.js} +1 -1
  280. package/dist/chunks/validatePlugin-z2fcngf8.js +1 -0
  281. package/dist/chunks/{vim-C0KTnJJs.js → vim-DdvQlLDm.js} +1 -1
  282. package/dist/chunks/{workerRegistry-CUXbNyL9.js → workerRegistry-CzqQwCHC.js} +1 -1
  283. package/dist/chunks/worktree-DMhP5T0p.js +1 -0
  284. package/dist/cli.js +1 -1
  285. package/package.json +1 -1
  286. package/dist/chunks/ApproveApiKey-LPrZMlgU.js +0 -1
  287. package/dist/chunks/BackgroundTasksDialog-D_UHm7xo.js +0 -2
  288. package/dist/chunks/ClaudeMdExternalIncludesDialog--w2zWWEn.js +0 -1
  289. package/dist/chunks/ConsoleOAuthFlow-BXdC6j3_.js +0 -1
  290. package/dist/chunks/Doctor-BuiYwjAS.js +0 -1
  291. package/dist/chunks/Doctor-DKlHJBXq.js +0 -3
  292. package/dist/chunks/ExitFlow-rExuBL3w.js +0 -2
  293. package/dist/chunks/Grove-ENfM8hC6.js +0 -1
  294. package/dist/chunks/MCPConnectionManager-CaBvO7NB.js +0 -1
  295. package/dist/chunks/MessageSelector-DOB1S2-O.js +0 -3
  296. package/dist/chunks/Messages-Clihwd2F.js +0 -11
  297. package/dist/chunks/PluginSettings-DUxj_oAg.js +0 -17
  298. package/dist/chunks/QueryEngine-BLcPQYq_.js +0 -1
  299. package/dist/chunks/REPL-B_E07dnf.js +0 -142
  300. package/dist/chunks/REPL-BhURgntS.js +0 -1
  301. package/dist/chunks/RemoteSessionManager-B43isWQs.js +0 -2
  302. package/dist/chunks/ResumeConversation-DaQ9n8_C.js +0 -1
  303. package/dist/chunks/SearchExtraToolsTool-DSq7beKs.js +0 -1
  304. package/dist/chunks/Settings-CNsaWv8g.js +0 -2
  305. package/dist/chunks/agents-D7um1IXM.js +0 -103
  306. package/dist/chunks/allErrors-CHVdQ3fT.js +0 -1
  307. package/dist/chunks/api-C-rOQY-l.js +0 -1
  308. package/dist/chunks/api-Dmn7DUgU.js +0 -1
  309. package/dist/chunks/auth-C4Rvit2q.js +0 -1
  310. package/dist/chunks/auth-Cj7EX1eG.js +0 -1
  311. package/dist/chunks/auth-DAxGNCIR.js +0 -15
  312. package/dist/chunks/backgroundHousekeeping-C9m4tiFi.js +0 -17
  313. package/dist/chunks/backgroundHousekeeping-DQjzXBe0.js +0 -1
  314. package/dist/chunks/bridgeConfig-DsI5d0s7.js +0 -1
  315. package/dist/chunks/bridgeEnabled-DZzlF2d8.js +0 -1
  316. package/dist/chunks/bridgeEnabled-FjPuA7zx.js +0 -1
  317. package/dist/chunks/bridgeMain-BppY0KW3.js +0 -68
  318. package/dist/chunks/bridgeMain-BrY4tkF6.js +0 -1
  319. package/dist/chunks/caches-BBLH8G1I.js +0 -1
  320. package/dist/chunks/client-CtVu3BLD.js +0 -1
  321. package/dist/chunks/commands-BWw1sQeH.js +0 -1
  322. package/dist/chunks/commitAttribution-DIT_s0vY.js +0 -1
  323. package/dist/chunks/compact-CaOnQVkH.js +0 -2
  324. package/dist/chunks/config-DmPGzNmi.js +0 -1
  325. package/dist/chunks/config-HHTwEsWp.js +0 -1
  326. package/dist/chunks/context-noninteractive-BilCSCV1.js +0 -1
  327. package/dist/chunks/conversation-BWXf3un9.js +0 -1
  328. package/dist/chunks/conversation-awh8AwwL.js +0 -1
  329. package/dist/chunks/createSession-Hvpx3Le7.js +0 -1
  330. package/dist/chunks/crossProjectResume-_XjvSXA3.js +0 -40
  331. package/dist/chunks/doctor-CkdQ7Fv7.js +0 -1
  332. package/dist/chunks/effort-DCgooYMY.js +0 -9
  333. package/dist/chunks/envLessBridgeConfig-sxodu0xO.js +0 -1
  334. package/dist/chunks/exit-CFJR3NfE.js +0 -1
  335. package/dist/chunks/extra-usage-D1Y-3OWQ.js +0 -1
  336. package/dist/chunks/extraUsage-2DwLEr26.js +0 -1
  337. package/dist/chunks/extractMemories-C3qrwpu2.js +0 -1
  338. package/dist/chunks/fast-D3CPmUX4.js +0 -1
  339. package/dist/chunks/firstPartyEventLogger-DPUQnc6J.js +0 -1
  340. package/dist/chunks/hooks-cCAzfabs.js +0 -1
  341. package/dist/chunks/inboundAttachments-DZgSqDwY.js +0 -1
  342. package/dist/chunks/initReplBridge-myzllvlk.js +0 -1
  343. package/dist/chunks/keybindings-DETOn3qJ.js +0 -2
  344. package/dist/chunks/language-BbaOTWm3.js +0 -1
  345. package/dist/chunks/launchAgentsPlatform-CuRQgd2Q.js +0 -1
  346. package/dist/chunks/launchMemoryStores-CN0ecWpP.js +0 -1
  347. package/dist/chunks/launchSchedule-psiSLmTA.js +0 -1
  348. package/dist/chunks/launchSkillStore-CQQ00Ads.js +0 -1
  349. package/dist/chunks/launchVault-Dn6jq0Rc.js +0 -1
  350. package/dist/chunks/loadAgentsDir-Db9UTm45.js +0 -1
  351. package/dist/chunks/loadPluginHooks-C9A9oS-w.js +0 -1
  352. package/dist/chunks/localSearch-hBh1ATr2.js +0 -1
  353. package/dist/chunks/mcp-CtbhGaLC.js +0 -2
  354. package/dist/chunks/mcp-DMacvhqZ.js +0 -1
  355. package/dist/chunks/memory-BPN8gW7n.js +0 -1
  356. package/dist/chunks/model-BIVmcl_N.js +0 -1
  357. package/dist/chunks/model-CWBwPvTH.js +0 -1
  358. package/dist/chunks/model-DlVpqR0P.js +0 -1
  359. package/dist/chunks/openai-yin1iDG8.js +0 -10
  360. package/dist/chunks/permissions-CxDJ__l6.js +0 -3
  361. package/dist/chunks/pluginCliCommands-DQQ7C7kk.js +0 -1
  362. package/dist/chunks/pluginStartupCheck-D7ts2V3p.js +0 -1
  363. package/dist/chunks/plugins-Cr03lISA.js +0 -4
  364. package/dist/chunks/policyLimits-DWtLyJ4n.js +0 -1
  365. package/dist/chunks/poorMode-AE4WNYZo.js +0 -1
  366. package/dist/chunks/print-CZUmAzmt.js +0 -23
  367. package/dist/chunks/processBashCommand-aKNneP2u.js +0 -1
  368. package/dist/chunks/processSlashCommand-BcPnWNxZ.js +0 -5
  369. package/dist/chunks/prompt-CIyhCdkE.js +0 -1
  370. package/dist/chunks/prompt-DRhjinu2.js +0 -1
  371. package/dist/chunks/rate-limit-options--Y3oF1g0.js +0 -1
  372. package/dist/chunks/reconciler-CJcSh6xo.js +0 -4
  373. package/dist/chunks/sandbox-adapter-DDfVl_2V.js +0 -1
  374. package/dist/chunks/searchExtraTools-BHWzsbNO.js +0 -1
  375. package/dist/chunks/sessionFileAccessHooks-BZvxeufx.js +0 -1
  376. package/dist/chunks/sessionMemory-CAmpw2yb.js +0 -1
  377. package/dist/chunks/sessionMemory-DT0IkiA1.js +0 -1
  378. package/dist/chunks/sessionMemoryUtils-B4kGNH4j.js +0 -1
  379. package/dist/chunks/sessionObserver-oIkwTidC.js +0 -1
  380. package/dist/chunks/sessionStorage-DqARUj0K.js +0 -1
  381. package/dist/chunks/settingsSync-D_4P3Esd.js +0 -1
  382. package/dist/chunks/setup-JHvhWKh9.js +0 -3
  383. package/dist/chunks/sinks-Cro1Y8C2.js +0 -1
  384. package/dist/chunks/skillChangeDetector-uCaYrerZ.js +0 -1
  385. package/dist/chunks/skillLearning-GZxYPlyl.js +0 -1
  386. package/dist/chunks/teleport-4Srg5vcP.js +0 -1
  387. package/dist/chunks/thinkback-gV-sKkMM.js +0 -1
  388. package/dist/chunks/thinkback-hc5eJ9ul.js +0 -1
  389. package/dist/chunks/toolPool-CNYKDRq5.js +0 -1
  390. package/dist/chunks/trustedDevice-0dehm9qz.js +0 -1
  391. package/dist/chunks/types-BUyOCzUt.js +0 -1
  392. package/dist/chunks/types-Czs-_G1S.js +0 -3
  393. package/dist/chunks/undercover-CG_269xD.js +0 -1
  394. package/dist/chunks/upgrade-J7lKLkD2.js +0 -1
  395. package/dist/chunks/upgrade-yNl7EO4e.js +0 -1
  396. package/dist/chunks/usage-B2PbCUMi.js +0 -1
  397. package/dist/chunks/usage-Ck8Cu45g.js +0 -1
  398. package/dist/chunks/useMainLoopModel-CO4yBjRM.js +0 -1
  399. package/dist/chunks/useManagePlugins-BzFKIDrD.js +0 -1
  400. package/dist/chunks/useSettingsErrors-CSemUjj1.js +0 -1
  401. package/dist/chunks/validatePlugin-D6sPqea1.js +0 -1
  402. package/dist/chunks/worktree-89ttIVxH.js +0 -1
@@ -1,23 +0,0 @@
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 ee,vr as v}from"./state-ix0xIunV.js";import{$C as te,$w as y,$y as b,AT as ne,Al as x,Ar as S,B_ as C,Bb as w,C as T,CO as re,CT as ie,Cb as E,Cn as D,D as ae,E as oe,FD as O,FO as se,FT as ce,Fc as k,G as le,GO as ue,GT as de,G_ as fe,HC as pe,H_ as me,Hv as he,Hw as ge,ID as A,Ic as _e,Is as ve,KC as ye,K_ as be,Ks as j,Ku as xe,Ky as Se,LC as Ce,Ls as we,MD as Te,MO as Ee,MT as De,M_ as M,Md as Oe,Nc as ke,Ob as N,Oi as Ae,P as je,PO as Me,Pc as Ne,QS as Pe,Qi as Fe,Qw as Ie,Qy as Le,RC as Re,RO as ze,RT as Be,Sb as Ve,TD as He,TT as Ue,UC as P,UO as F,Ua as We,Us as Ge,Ut as Ke,Uw as qe,Uy as Je,Va as I,Vb as Ye,Vi as Xe,Vs as L,W as R,WT as Ze,Wi as Qe,Wv as $e,X_ as et,Xu as tt,Xw as nt,Xy as rt,Yw as z,ZS as it,Zw as at,Zy as B,_D as ot,_c as st,_g as ct,_i as lt,_w as ut,aT as dt,ag as ft,as as pt,aw as mt,ay as ht,b as gt,bD as _t,bb as vt,bc as yt,ca as bt,cf as xt,cg as St,cr as Ct,cs as wt,cu as Tt,dC as V,dT as Et,dg as Dt,dw as Ot,dy as kt,eT as At,ei as jt,f as Mt,fC as Nt,fc as Pt,fi as Ft,fs as It,fw as Lt,fy as Rt,gc as zt,gi as Bt,go as Vt,gw as Ht,hc as Ut,hg as Wt,hw as Gt,iT as Kt,i_ as qt,ig as Jt,ir as Yt,iw as Xt,jD as Zt,jT as Qt,jd as $t,jr as en,k_ as tn,kb as nn,ki as rn,kl as an,kr as on,lf as sn,lx as cn,mc as ln,mg as un,ms as dn,nT as fn,ng as pn,o as mn,oT as hn,o_ as gn,os as _n,pC as vn,pc as yn,pg as bn,pi as xn,pw as Sn,px as Cn,qC as wn,qi as Tn,qu as En,qy as Dn,rT as On,r_ as kn,s as An,su as jn,tT as Mn,tw as Nn,uC as Pn,uu as Fn,vc as In,vg as Ln,wD as Rn,wT as zn,wb as Bn,wn as Vn,x as Hn,xc as Un,y_ as Wn,yc as Gn,yn as Kn,z_ as qn,zo as Jn}from"./loadAgentsDir-BURvZNN6.js";import{n as Yn,t as Xn}from"./cwd-CYmmnQVS.js";import{C as Zn,F as H,S as Qn,W as $n,a as er,d as tr,l as U,nt as nr,o as rr,p as ir,rt as ar,w as W,z as or}from"./debug-BrXObCdR.js";import{St as sr,Y as cr,_n as lr,ct as ur,d as dr,f as fr,g as pr,ht as mr,ot as G,yn as hr}from"./settings-DfWP5y6X.js";import{L as gr,P as _r}from"./config-DiT2Z8dY.js";import{i as vr,n as yr,o as K}from"./process-gEbdy6uY.js";import{M as br,N as xr,j as Sr}from"./git-Do0wJvux.js";import{U as Cr,Y as wr,c as Tr,i as Er,o as Dr,s as q}from"./log-BMCygSzM.js";import{i as Or,n as kr}from"./path-D5U-tm91.js";import{s as Ar,u as jr}from"./types-C-MRCL8J.js";import{n as Mr,r as J}from"./analytics-BotDBGh0.js";import{C as Nr,Er as Pr,Mn as Fr,Nn as Ir,Tr as Lr,Vt as Rr,X as zr,_ as Br,at as Vr,cr as Hr,di as Ur,fi as Wr,it as Gr,li as Kr,mi as qr,nt as Jr,o as Yr,sr as Xr,tt as Zr,u as Qr,vn as $r,x as ei,xt as ti,yn as ni}from"./model-BIVmcl_N.js";import{Dt as ri,En as ii,Ot as ai,Tn as oi,Zt as si,an as ci,dt as li,ut as ui}from"./prompt-DNDgGM9q.js";import{c as di,s as fi}from"./pluginFlagging-mHNff1t9.js";import{a as pi,o as mi,s as hi}from"./fileStateCache-DDW5toIs.js";import{A as gi,C as _i,D as vi,N as yi,O as bi,P as xi,_ as Si,d as Ci,g as wi,h as Ti,lt as Ei,m as Di,u as Oi,v as ki,y as Ai}from"./rcDebugLog-DoL1FpGJ.js";import{c as ji,l as Mi}from"./commitAttribution-CLbEIaRJ.js";import{t as Ni}from"./pollConfig-DH2oCtFS.js";import{r as Pi}from"./inboundAttachments-DkfNHtF9.js";import{i as Fi,n as Ii,s as Li}from"./mappers-Q_Z3Kjo-.js";import{n as Ri,r as zi}from"./sessionTitle-pWMaI79N.js";import{n as Bi,t as Vi}from"./ccrClient-q2JCVCU2.js";import{n as Hi,t as Ui}from"./HybridTransport-kN1jmg26.js";import{n as Wi,t as Gi}from"./SSETransport-h43pQVlJ.js";import{a as Ki,n as qi,o as Ji}from"./grove-CFBPplP6.js";import{o as Yi}from"./remoteManagedSettings-Bxo3bv1U.js";import{i as Xi,r as Zi}from"./auth-DAxGNCIR.js";import{t as Qi}from"./pluginBlocklist-mogKaK0p.js";import{t as $i}from"./onChangeAppState-DBantDJ6.js";import{t as ea}from"./settingsSync-D_4P3Esd.js";import{a as ta,c as na,n as ra,o as ia,r as aa,s as oa}from"./reconciler-CJcSh6xo.js";import{n as sa,t as ca}from"./toolPool-CNYKDRq5.js";import{n as la,r as ua}from"./QueryEngine-BLcPQYq_.js";import{n as da,r as fa}from"./sideQuestion-D03MXdE2.js";import{n as pa,r as ma}from"./context-noninteractive-BuGxX3YL.js";import{a as ha,o as ga,t as _a}from"./skillChangeDetector-uCaYrerZ.js";import{n as va,t as ya}from"./refresh-ul_i5R1a.js";import{dirname as ba,join as xa}from"path";import{PassThrough as Sa}from"stream";import{randomUUID as Y}from"crypto";import{readFile as Ca,stat as wa}from"fs/promises";import{URL as Ta}from"url";import{cwd as X}from"process";a(),p(),Yn(),nr(),or(),Qn(),ir(),yr(),er(),Sr(),wr(),Dr(),Or(),lr(),Ar(),pr(),qr(),Ur(),Pr(),Fr(),$r(),Rr(),Br(),oi(),ci(),y(),yi(),P(),Nt(),bi(),kt(),Ci(),_n(),Jn(),Fe(),en(),ea(),r(),Wi();function Ea(e,t={},r,i){if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let n=new Ta(e.href);return n.protocol===`wss:`?n.protocol=`https:`:n.protocol===`ws:`&&(n.protocol=`http:`),n.pathname=n.pathname.replace(/\/$/,``)+`/worker/events/stream`,new Gi(n,t,r,i)}if(e.protocol===`ws:`||e.protocol===`wss:`)return n(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new Ui(e,t,r,i):new Hi(e,t,r,i);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Wi();var Da=class extends ta{constructor(e,t,r){let i=new Sa({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 Ta(e);let a={},s=vi();s?a.Authorization=`Bearer ${s}`:U(`[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=vi();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=Ea(this.url,a,m(),l),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=rr(),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 Gi))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Vi(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{br(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Bi?e.reason:`unknown`}),q(Error(`CCRClient initialization failed: ${H(e)}`)),Pn(1,`other`)}),ar(async()=>this.ccrClient?.close()),rn((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Ae(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};Mn((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),ki((e,t)=>{this.ccrClient?.reportState(e,t)}),Si(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let u=Ni().session_keepalive_interval_v2_ms;if(this.isBridge&&u>0&&(this.keepAliveTimer=setInterval(()=>{U(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{U(`[remote-io] keep_alive write failed: ${H(e)}`)})},u),this.keepAliveTimer.unref?.()),ar(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(ia(e)+`
5
- `)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};si(),cr(),ai(),[...ri],nr(),er();var Oa=`[stdout-guard]`,ka=!1,Z=``,Q=null;function Aa(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function ja(){ka||(ka=!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),Aa(e)?a=Q(e+`
7
- `):(process.stderr.write(`${Oa} ${e}\n`),U(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},ar(async()=>{Z.length>0&&(Q&&Aa(Z)?Q(Z+`
8
- `):process.stderr.write(`${Oa} ${Z}\n`),Z=``),Q&&(process.stdout.write=Q,Q=null),ka=!1}))}sr(),ur(),_r(),F(),Ee(),Zt(),Rn(),_t(),li(),mi(),xi(),De(),qe(),Ht(),mt(),Nn(),nn(),rt(),Se(),fe(),M(),tt(),k(),Ne(),Gn(),L(),It(),Vn(),Kn(),le(),mn(),ca(),Je(),or(),Dr(),bi(),vt(),er(),Nt();function Ma(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&&(U(`Exiting after ${n}ms of idle time`),V())},n))},stop(){i&&(clearTimeout(i),i=null)}}}Zr(),fi(),O(),Ze(),Ot(),Re(),Pe(),Cn(),x(),I(),T(),zi(),da();function Na(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(Rt(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}Xr(),Et(),dt(),at(),Mi(),ht(),kn(),Wt(),Dt(),Oe(),jn(),Ii(),Ki(),ma(),er();async function Pa(){try{let e=await Ca(zt(),`utf-8`),t=mr().safeParse(Zn(e));return t.success?t.data:(U(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function Fa(e){await Pt(zt(),W(e,null,2))}async function Ia(e,t){let n=Ut();if(!n)return;let r=await La(t);r!==null&&await Pt(xa(n,ln(e)),r)}async function La(e){let t=[xa(e,`.claude-plugin`,`marketplace.json`),xa(e,`marketplace.json`),e];for(let e of t)try{return await Ca(e,`utf-8`)}catch{}return null}async function Ra(){let e=await Ge();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Ia(t,n.installLocation)}catch(e){U(`Failed to save marketplace JSON for ${t}: ${e}`)}await Fa({...await Pa(),...e})}Mr(),nr(),er(),Sr(),Dr(),L(),Gn();async function za(){let e=Un();U(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await j();t&&(ve(),wt(`headlessPluginInstall: seed marketplaces registered`)),e&&(await tr().mkdir(st()),await tr().mkdir(In()));let n=Object.keys(we()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)U(`installPluginsForHeadless: no marketplaces declared`);else{let t=await xr(`headless_marketplace_reconcile`,()=>ra({skip:e?(e,t)=>!yt(t):void 0,onProgress:e=>{e.type===`installed`?U(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&U(`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&&U(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(ve(),wt(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Ra();let t=await Qi();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&wt(`headlessPluginInstall: plugins changed`),e&&ar(yn),i}catch(e){return q(e),!1}finally{J(`tengu_headless_plugin_install`,r)}}Mr(),er(),Sr(),y(),Ci(),Dr(),yr(),kt(),Nt(),nr(),Yn(),p(),en(),Jn(),Qn(),r(),ya(),It(),wn(),w(),xt(),or();var $=(Ai(),e(_i)),Ba=1e4,Va=new Set,Ha=[];function Ua(e){if(Va.has(e))return!1;if(Va.add(e),Ha.push(e),Ha.length>Ba){let e=Ha.splice(0,Ha.length-Ba);for(let t of e)Va.delete(t)}return!0}function Wa(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Ga(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
9
- `):e.flatMap(Wa)}function Ka(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function qa(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)),He.subscribe(e=>{it(e,r),Gr()&&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(),nt(),z(`runHeadless_entry`),await Ji()&&await qi(),z(`after_grove_check`),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
10
- `),V(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
11
- `),V(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
12
- `),V(1);return}let l=ro(e,c);c.outputFormat===`stream-json`&&ja();let u=ot.getSandboxUnavailableReason();if(u){if(ot.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${u}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),V(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(ot.isSandboxingEnabled())try{await ot.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${H(e)}\n`),V(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&_e(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 Le(c.setupTrigger),z(`before_loadInitialMessages`);let d=t(),{messages:p,turnInterruptionState:h,agentSetting:g}=await no(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}),_=b();if(_&&l.prependUserMessage(_),!c.agent&&!f()&&g){let{agentDefinition:e}=ha(g,void 0,{activeAgents:s,allAgents:s});if(e){if(r(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!An(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Bt(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`),V(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`),V(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),V(0);return}let ee=typeof c.resume==`string`&&(!!Rt(c.resume)||c.resume.endsWith(`.jsonl`)),v=!!c.sdkUrl;if(!e&&!ee&&!v){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
13
- `),V(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
14
- `),V(1);return}let te=En(d.mcp.tools,d.toolPermissionContext),y=[...a,...te],ne=Xa(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{r(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),Ti(`requires_action`,e)});c.permissionPromptToolName&&(y=y.filter(e=>!ii(e,c.permissionPromptToolName))),vr(),z(`after_loadInitialMessages`),await Kr(),z(`after_modelStrings`);let x=c.outputFormat===`json`&&c.verbose,S=[],C;z(`before_runHeadlessStreaming`);for await(let e of Ja(l,d.mcp.clients,[...i,...d.mcp.commands],y,p,ne,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`&&(x&&S.push(e),C=e);switch(c.outputFormat){case`json`:if(!C||C.type!==`result`)throw Error(`No messages returned`);if(c.verbose){K(W(S)+`
15
- `);break}K(W(C)+`
16
- `);break;case`stream-json`:break;default:if(!C||C.type!==`result`)throw Error(`No messages returned`);switch(C.subtype){case`success`:K(C.result.endsWith(`
17
- `)?C.result:C.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(Ie(),gr())try{let{drainPendingExtraction:e}=await import(`./extractMemories-C3qrwpu2.js`);await e()}catch{}V(C?.type===`result`&&C?.is_error?1:0)}function Ja(e,r,a,o,d,f,p,g,_,ee,v,y){let b=!1,x,S=!1,w=null,T,E=e.outbound;process.on(`SIGINT`,()=>{br(`info`,`shutdown_signal`,{signal:`SIGINT`}),T&&!T.signal.aborted&&T.abort(),Pn(0)}),ar(async()=>{let t={};for(let e of ye(g()))Ye(e)&&(t[e.type]=(t[e.type]??0)+1);br(`info`,`run_state_at_shutdown`,{run_active:b,run_phase:x,worker_status:Oi(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),wi(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},ae;v.enableAuthStatus&&(ae=Lr.getInstance().subscribe(e=>{E.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:m()})}));let oe=e=>{let t=Li(e);t&&E.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:m()})};de.add(oe);let O=d,k=te(d,X(),100),le=pi(100),fe=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&fe&&(U(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),to(O,y.message),Ue({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let pe=$t().map(e=>{let t=e.value===null?`default`:e.value,n=t==="default"?Yr():Nr(t),r=Me(n),i=ue(n),a=Vr(e.value),o=Ir(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:se(n)?[...re]:re.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),_e=v.userSpecifiedModel;function ve(e,t){let n=Vt(e,ei(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 j=[],Se=[],we=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||we.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(he,async(n,r)=>{Tr(t,`Elicitation request received in print mode: ${W(n)}`);let i=n.params.mode===`url`?`url`:`form`;J(`tengu_mcp_elicitation_shown`,{mode:i});let a=await ct(t,n.params,r.signal);if(a)return Tr(t,`Elicitation resolved by hook: ${W(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 Ln(t,l,r.signal,i,c);return J(`tengu_mcp_elicitation_response`,{mode:i,action:u.action}),u}),n.client.setNotificationHandler($e,e=>{let{elicitationId:n}=e.params;Tr(t,`Elicitation completion notification: ${n}`),Ke({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()})}),we.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(p)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await un(p,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,Se=r.tools;let i=hr([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(G(t)))),...Se]}})),ut(j)}}De();let M={clients:[],tools:[],configs:{}},Oe=e=>{let t=xe(e.toolPermissionContext,e.mcp.tools),n=Te(sa([...o,...Se,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!ii(e,v.permissionPromptToolName)));let r=c();if(r&&!v.jsonSchema){let e=ui(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,Ae=0;function je(){if(!N)return;let e=Math.min(Ae,O.length),t=O.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);Ae=O.length,t.length>0&&N.writeMessages(t)}let Ne=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Pe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await oo(e,{configs:p,clients:j,tools:Se},M,_);for(let e of Object.keys(p))delete p[e];if(Object.assign(p,n.newSdkState.configs),j=n.newSdkState.clients,Se=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=hr([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(G(t)))),...Se]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Ne=Ne.then(t,t),Ne}function Fe(){let e=g(),t=e.mcp.clients,n=Te([...e.mcp.tools,...M.tools],`name`),r=new Set([...t.map(e=>e.name),...j.map(e=>e.name)]);return[...t,...j,...M.clients.filter(e=>!r.has(e.name))].map(e=>{let t;if(e.config.type===`sse`||e.config.type===`http`)t={type:e.config.type,url:e.config.url,headers:e.config.headers,oauth:e.config.oauth};else if(e.config.type===`claudeai-proxy`)t={type:`claudeai-proxy`,url:e.config.url,id:e.config.id};else if(e.config.type===`stdio`||e.config.type===void 0){let n=e.config;t={type:`stdio`,command:n.command,args:n.args}}let r=e.type===`connected`?tn(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 Le(){try{await Promise.all([Promise.resolve(),xr(`headless_managed_settings_wait`,()=>Yi())]),await za()&&await Ge()}catch(e){q(e)}}let Re=null;i()||(n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?Re=Le():Le());let Ve=Ma(()=>!b),P=a,F=ee;async function We(){let{agentDefinitions:e}=await va(_);P=await Tn(X());let t=F.filter(e=>e.source===`flagSettings`);F=[...e.allAgents,...t]}async function Ge(){let{servers:e}=await C(),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 Pe(t);r&&De(),U(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let qe=_a.subscribe(()=>{Xe(),Tn(X()).then(e=>{P=e})}),Je=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||S||(async()=>{let e=await hn({basePrompt:`<${Cr}>${new Date().toLocaleTimeString()}</${Cr}>`,currentDir:X(),shouldCreate:()=>!S});if(S){await fn({commands:e});return}for(let t of e)Ue({...t,uuid:Y()});I()})().catch(e=>{q(e),U(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};Be(()=>{T&&ne(`now`).length>0&&T.abort(`interrupt`)});let I=async()=>{if(b)return;if(b=!0,x=void 0,Ti(`running`),Ve.stop(),z(`run_entry`),await De(),z(`after_updateSdkMcp`),Re){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ni(e).then(()=>`timeout`);await Promise.race([Re,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 Re;Re=null,await We();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-C9A9oS-w.js`);t()}let n=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=ie(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(;Ka(r,ce(n));)i.push(ie(n));let a=await On(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Ga(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&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,...j,...M.clients];Ee(l);let u=Oe(s);for(let e of o)At(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 Da&&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`&&Lt(D.lastEmitted.text,e,D.lastEmitted.emittedAt,D.lastEmitted.promptId,D.lastEmitted.generationRequestId),D.lastEmitted=null}T=ge(),z(`before_ask`),Fn();let h=r,ee=!1;try{if(await Hr(h.workload??v.workload,async()=>{for await(let t of la({commands:Te([...P,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:u,verbose:v.verbose,mcpClients:l,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:f,userSpecifiedModel:_e,fallbackModel:v.fallbackModel,jsonSchema:c()??v.jsonSchema,mutableMessages:O,getReadFileCache:()=>le.size===0?k:hi(k,le),setReadFileCache:e=>{k=e;for(let[e,t]of le.entries()){let n=k.get(e);(!n||t.timestamp>n.timestamp)&&k.set(e,t)}le.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:T,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:F,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{E.enqueue({type:`system`,subtype:`status`,status:e,session_id:m(),uuid:Y()})}}))if(je(),t.type===`result`){ee=!!t.is_error;for(let e of gi())E.enqueue(e);ye(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&Ye(e))?w=t:(w=null,E.enqueue(t))}else{for(let e of gi())E.enqueue(e);E.enqueue(t)}}),ee)await Kt({commands:p,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await Kt({commands:p,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)Ue({...t,uuid:Y()})}}catch(e){throw await Kt({commands:p,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)At(e,`completed`);if(je(),N?.sendResult(),v.promptSuggestions&&!t(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){D.abortController?.abort();let e=new AbortController;D.abortController=e;let t=an();if(!t)Sn(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Gt(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`)){Sn(`aborted`,void 0,void 0,`sdk`);return}q($n(e))}finally{D.inflightPromise===n.promise&&(D.inflightPromise=null)}})(),D.inflightPromise=n.promise}}Ie(),Tt(),nt()}};do{for(let e of gi())E.enqueue(e);x=`draining_commands`,await a(),i=!1;{let e=ye(g()).some(e=>Ye(e)),t=ce(n)!==void 0;(e||t)&&(i=!0,t||(x=`waiting_for_agents`,await ni(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:Ei,modelUsage:{},permission_denials:[],uuid:Y(),errors:[H(t),...Er().map(e=>e.error)]})}catch{}D.abortController?.abort(),V(1);return}finally{if(x=`finally_flush`,await e.flushInternalEvents(),x=`finally_post_flush`,!vn()){Ti(`idle`);for(let e of gi())E.enqueue(e)}b=!1,Ve.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&ce(n)===void 0&&!S){Je();return}if(ce(n)!==void 0){I();return}S&&(D.inflightPromise&&await Promise.race([D.inflightPromise,ni(5e3)]),D.abortController?.abort(),D.abortController=null,await ke(),qe(),ae?.(),de.delete(oe),E.done())},L=function(e,t){E.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},R=function(e,t){E.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ze=new Set;e.setUnexpectedResponseCallback(async e=>{await io({message:e,setAppState:_,handledToolUseIds:Ze,onEnqueued:()=>{I()}})});let tt=new Map,rt=new Map,it=new Set,at=new Map,B=null;return(async()=>{let t=!1;br(`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`&&At(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,L(i);else if(o.subtype===`end_session`){U(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),T&&T.abort(),D.abortController?.abort(),D.abortController=null,D.lastEmitted=null,D.pendingSuggestion=null,L(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 Za(i.request,i.request_id,t,E,a,pe,e,!!v.enableAuthStatus,v,ee,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&h(!0),t=!0,Qt()&&I()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:$a(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"?Yr():e;_e=t,u(t),Di({model:t}),ve(e,t),L(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?v.thinkingConfig=void 0:i.request.max_thinking_tokens===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},L(i);else if(i.request.subtype===`mcp_status`)L(i,{mcpServers:Fe()});else if(i.request.subtype===`get_context_usage`)try{let e=g(),t=await pa({messages:O,getAppState:g,options:{mainLoopModel:Qr(),tools:Oe(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt}});L(i,{...t})}catch(e){R(i,H(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=j.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),L(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?L(i,t):R(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid,t=zn(t=>t.uuid===e);L(i,{cancelled:t.length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=kr(i.request.path),t=Math.floor((await wa(e)).mtimeMs);if(t<=i.request.mtime){let n=await Ca(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
20
- `,`
21
- `);le.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}L(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Pe(i.request.servers);L(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await va(_),t=F.filter(e=>e.source===`flagSettings`);F=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([Tn(X()),Ge(),dn()]);r.status===`fulfilled`?P=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),L(i,{commands:P.filter(e=>e.userInvocable!==!1).map(e=>({name:bt(e),description:Qe(e),argumentHint:e.argumentHint||``})),agents:F.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Fe(),error_count:e.error_count})}catch(e){R(i,H(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;we.delete(t);let n=me(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)R(i,`Server not found: ${t}`);else{let e=await bn(t,n),r=G(t);if(_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...A(n.mcp.commands,e=>Wn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:di(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`)Ee([e.client]),L(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;R(i,t)}}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;we.delete(t);let a=me(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)R(i,`Server not found: ${t}`);else if(n){et(t,!0);let e=await bn(t,a),n=G(t);if(_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...A(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...A(r.mcp.commands,e=>Wn(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:di(r.mcp.resources,t)}})),e.client.type===`connected`)Ee([e.client]),L(i);else{let t=e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`;R(i,t)}}else{et(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await Jt(t,a);let o=G(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:A(e.mcp.tools,e=>e.name?.startsWith(o)),commands:A(e.mcp.commands,e=>Wn(e,t)),resources:di(e.mcp.resources,t)}})),L(i)}}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=me(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)R(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)R(i,`Server type "${n.type}" does not support OAuth authentication`);else try{tt.get(e)?.abort();let t=new AbortController;tt.set(e,t);let r,a=new Promise(e=>{r=e}),o=qt(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{rt.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?L(i,{authUrl:s,requiresUserAction:!0}):L(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(be(e)||it.has(e))return;let t=await bn(e,n),r=G(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Wn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:di(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{U(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{tt.get(e)===t&&(tt.delete(e),rt.delete(e),it.delete(e),at.delete(e))})}catch(e){R(i,H(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=rt.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)R(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{it.add(e),n(t);let r=at.get(e);if(r)try{await r,L(i)}catch(e){R(i,e instanceof Error?e.message:`OAuth authentication failed`)}else L(i)}}else R(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;B?.service.cleanup(),J(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Xi,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 Zi(t),J(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),B?.service===t&&(B=null)});B={service:t,flow:a},a.catch(e=>U(`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`)})]);L(i,{manualUrl:e,automaticUrl:t})}catch(e){R(i,H(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!B)R(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&B.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=B;e.then(()=>{let e=ti();L(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:Wr()}})},e=>R(i,H(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=me(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)R(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)R(i,`Cannot clear auth for server type "${n.type}"`);else{await gn(e,n);let t=await bn(e,n),r=G(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...A(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...A(n.mcp.commands,t=>Wn(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:di(n.mcp.resources,e)}})),L(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=Qr(),t=s()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];l(r),He.notifyChange(`flagSettings`),`model`in n&&(n.model==null?u(void 0):u(String(n.model)));let a=Qr();if(a!==e){_e=a;let e=n.model?String(n.model):`default`;Di({model:a}),ve(e,a)}L(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=Qr(),n=Me(t)?ze(t,e.effortValue):void 0;L(i,{...dr(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await sn(e,{getAppState:g,setAppState:_}),L(i,{})}catch(e){R(i,H(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(T&&!T.signal.aborted?T:ge()).signal;(async()=>{try{let r=await Ri(e,n);if(r&&t)try{lt(m(),r)}catch(e){q(e)}L(i,{title:r})}catch(e){R(i,H(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=an(),n=t?{...t,toolUseContext:{...t.toolUseContext,abortController:ge()}}:await ua({tools:Oe(g()),commands:P,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:O,readFileState:k,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:F}),r=await fa({question:e,cacheSafeParams:n});L(i,{response:r.response})}catch(e){R(i,H(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),Je()):$.deactivateProactive(),L(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)L(i,{session_url:Ce(N.bridgeSessionId,N.sessionIngressUrl),connect_url:cn(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-myzllvlk.js`),r=await n({onInboundMessage(e){let t=aa(e);if(!t)return;let{content:n,uuid:r}=t;Ue({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),I()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){T?.abort()},onSetModel(e){let t=e==="default"?Yr():e;_e=t,u(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),U(`[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?(N=r,Ae=O.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),L(i,{session_url:Ce(r.bridgeSessionId,r.sessionIngressUrl),connect_url:cn(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):R(i,t??`Remote Control initialization failed`)}catch(e){R(i,H(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),L(i);else R(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.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=Fi([n]);O.push(...e),n.type===`assistant`&&v.replayUserMessages&&E.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=m(),t=await Yt(e,o.uuid);if(t||Va.has(o.uuid)){U(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(U(`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&&At(o.uuid,`completed`);continue}Ua(o.uuid)}Ue({mode:`prompt`,value:await Pi(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:ji(e.attribution,e=>{jt(e).catch(e=>{U(`Attribution: Failed to save snapshot: ${e}`)})})})),I()}S=!0,b||(D.inflightPromise&&await Promise.race([D.inflightPromise,ni(5e3)]),D.abortController?.abort(),D.abortController=null,await ke(),qe(),ae?.(),de.delete(oe),E.done())})(),E}function Ya(e){let t=async(n,r,i,a,o,s)=>{let c=s??await R(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=D(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 na(oa().parse(jr(h.content[0].text)),e,r,i)};return t}function Xa(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await R(e,t,n,r,i);let i=null;return async(t,r,a,o,s,c)=>{if(!i){let t=n(),r=t.find(t=>ii(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),V(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`),V(1),Error(t)}i=Ya(r)}return i(t,r,a,o,s,c)}}async function Za(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=Mt(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&&!An(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&u(Nr(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let h=fr()?.outputStyle||`default`,ee=await pt(Xn()),v=ti();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 te={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:bt(e),description:Qe(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(ee),models:a,account:{email:v?.email,organization:v?.organization,subscriptionType:v?.subscription,tokenSource:v?.tokenSource,apiKeySource:v?.apiKeySource,apiProvider:Wr()},pid:process.pid};if(Gr()&&Jr()){let e=p();te.fast_mode_state=zr(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:te}}),s){let e=Lr.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(!E())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Ve(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await Bn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await N(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${H(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function $a(e,t,n,r){if(e.mode===`bypassPermissions`){if(ae())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`&&!oe()){let e=Hn();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${gt(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...je(n.mode,e.mode,n),mode:e.mode}}function eo(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:Ei,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(W(t)+`
22
- `)}else process.stderr.write(e+`
23
- `)}function to(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function no(e,t){let r=!ee();if(t.continue)try{J(`tengu_continue_print`,{});let n=await Dn(void 0,void 0);if(n)return t.forkSession||n.sessionId&&(v(pe(n.sessionId),n.fullPath?ba(n.fullPath):null),r&&await Ft()),ga(n,e),xn(t.forkSession?{...n,worktreeSession:void 0}:n),{messages:n.messages,turnInterruptionState:n.turnInterruptionState,agentSetting:n.agentSetting}}catch(e){return q(e),V(1),{messages:[]}}if(t.teleport)try{if(!We(`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-4Srg5vcP.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),V(1),{messages:[]}}if(t.resume)try{J(`tengu_resume_print`,{});let i=Na(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`),eo(e,t.outputFormat),V(1),{messages:[]}}if(n(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,n]=await Promise.all([on(i.sessionId),t.restoredWorkerState]);n&&(e($i(n)),typeof n.model==`string`&&u(n.model))}else i.isUrl&&i.ingressUrl&&n(process.env.ENABLE_SESSION_PERSISTENCE)&&await S(i.sessionId,i.ingressUrl);let a=await Dn(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??B(`startup`))}:(eo(`No conversation found with session ID: ${i.sessionId}`,t.outputFormat),V(1),{messages:[]});if(t.resumeSessionAt){let e=a.messages.findIndex(e=>e.uuid===t.resumeSessionAt);if(e<0)return eo(`No message found with message.uuid of: ${t.resumeSessionAt}`,t.outputFormat),V(1),{messages:[]};a.messages=e>=0?a.messages.slice(0,e+1):[]}return!t.forkSession&&a.sessionId&&(v(pe(a.sessionId),a.fullPath?ba(a.fullPath):null),r&&await Ft()),ga(a,e),xn(t.forkSession?{...a,worktreeSession:void 0}:a),{messages:a.messages,turnInterruptionState:a.turnInterruptionState,agentSetting:a.agentSetting}}catch(e){return q(e),eo(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,t.outputFormat),V(1),{messages:[]}}return{messages:await(t.sessionStartHooksPromise??B(`startup`))}}function ro(e,t){let n;return n=typeof e==`string`?e.trim()===``?Xt([]):Xt([W({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new Da(t.sdkUrl,n,t.replayUserMessages):new ta(n,t.replayUserMessages)}async function io({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(U(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return U(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await Ct(t);return a?(r.add(t),U(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),Ue({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(U(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function ao(e){return{...e,scope:`dynamic`}}async function oo(e,t,n,r){let{allowed:i,blocked:a}=qn(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 so(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 so(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,ao(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 Jt(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=ao(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await ft(t,r);if(d.push(e),e.type===`connected`){let t=await St(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=$n(e);u[t]=n.message,q(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=ao(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{qa as runHeadless};
@@ -1 +0,0 @@
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{Ap as a,GC as o,Hp as s,Jg as c,Jm as l,So as u,Vp as d,WC as f,Yg as p,Ym as m,Yo as h,_u as g,kp as _,vo as v,vu as y,xo as b,zo as x}from"./loadAgentsDir-BURvZNN6.js";import{F as S,j as C,z as w}from"./debug-BrXObCdR.js";import{g as T,n as E}from"./settings-DfWP5y6X.js";import{n as D,r as O}from"./analytics-BotDBGh0.js";import{Ot as k,kt as A}from"./prompt-DNDgGM9q.js";import{randomUUID as j}from"crypto";n(),r(),y(),m(),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)(l,{addMargin:!1,param:{text:`<bash-input>${e}</bash-input>`,type:`text`}}),n?(0,M.jsx)(d,{fullOutput:n.fullOutput,output:n.output,elapsedTimeSeconds:n.elapsedTimeSeconds,totalLines:n.totalLines,verbose:r}):g.renderToolUseProgressMessage?.([],{verbose:r,tools:[],terminalSize:void 0})]})}w(),D(),c(),x(),T();function P(){return E().defaultShell??`bash`}y(),k(),o();async function F(t,n,r,i,o){let s=A()&&P()===`powershell`;O(`tengu_input_bash`,{powershell:s});let c=u({content:h({inputString:`<bash-input>${t}</bash-input>`,precedingInputBlocks:n})}),l;o({jsx:(0,M.jsx)(N,{input:t,progress:null,verbose:i.options.verbose}),shouldHidePromptInput:!1});try{let n={...i,setToolJSX:e=>{l=e?.jsx}},d=e=>{o({jsx:(0,M.jsxs)(M.Fragment,{children:[(0,M.jsx)(N,{input:t,progress:e.data,verbose:i.options.verbose}),l]}),shouldHidePromptInput:!1,showSpinner:!1})},m=null;s&&(m=(a(),e(_)).PowerShellTool);let h=m??g,y=(m?await m.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,d):await g.call({command:t,dangerouslyDisableSandbox:!0},n,void 0,void 0,d)).data;if(!y)throw Error(`No result received from shell command`);let b=y.stderr,x=await p(h,{...y,stderr:``},j()),S=typeof x.content==`string`?x.content:f(y.stdout);return{messages:[v(),c,...r,u({content:`<bash-stdout>${S}</bash-stdout><bash-stderr>${f(b)}</bash-stderr>`})],shouldQuery:!1}}catch(e){return e instanceof C?e.interrupted?{messages:[v(),c,b({toolUse:!1}),...r],shouldQuery:!1}:{messages:[v(),c,...r,u({content:`<bash-stdout>${f(e.stdout)}</bash-stdout><bash-stderr>${f(e.stderr)}</bash-stderr>`})],shouldQuery:!1}:{messages:[v(),c,...r,u({content:`<bash-stderr>Command failed: ${f(S(e))}</bash-stderr>`})],shouldQuery:!1}}finally{o(null)}}export{F as processBashCommand};
@@ -1,5 +0,0 @@
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{Al as a,Bo as o,C as s,Dc as c,ET as l,Ec as u,Eo as d,G as f,Gh as p,Gw as m,Hw as h,Jd as g,KE as _,Kh as v,Ki as y,Kw as b,Kx as x,MT as S,Ol as C,Qi as w,SE as T,Sl as E,So as D,TE as O,TT as k,Th as A,Ui as ee,Uw as te,W as ne,WE as re,Wh as ie,Wo as ae,Yd as oe,Yo as j,Zi as se,aO as M,aw as ce,bl as le,cT as ue,ca as N,dT as de,dy as fe,gy as P,hO as pe,ho as F,hy as me,iC as he,iO as I,jl as L,k as R,kc as ge,mO as _e,my as ve,nC as ye,ow as be,qo as xe,qx as Se,rC as Ce,rO as we,sT as Te,uy as Ee,vo as z,wh as De,xo as Oe,yo as ke,yy as Ae,zi as je,zo as Me}from"./loadAgentsDir-BURvZNN6.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{Mt as Le,jt as Re}from"./settings-DfWP5y6X.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{or as We,sr as Ge,vn as Ke,yn as qe}from"./model-BIVmcl_N.js";import{ct as Je,ot as Ye}from"./esm-B62dCLgf.js";import{E as Xe,T as Ze,w as Qe}from"./sessionTracing-CCPRzOvy.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 Re){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{H(`Removing one-shot hook for event ${o} in skill '${r}'`),v(e,t,o,s)}:void 0;ie(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&H(`Registered ${a} hooks from skill '${r}'`)}var nt=e((()=>{Le(),V(),p()}));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,a,o){let s=Ee(),c=e.pluginInfo?M(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,...c&&{_PROTO_marketplace_name:c},...P(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:d,baseAgent:f,promptMessages:p}=await L(e,t,n),g=e.effort===void 0?f:{...f,effort:e.effort};H(`Executing forked slash command /${e.name} with agent ${g.agentType}`);let _=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&rt();let v=!1;if(_.kairosEnabled&&(v=!0),v){let t=h(),r=N(e),i=We(),c=e=>l({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await Te({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)k(t)},f=async e=>{o?.runId&&await ue({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await qe(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of A({agentDefinition:g,promptMessages:p,toolUseContext:{...n,getAppState:d,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let f=C(l,`Command completed`);H(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${f}\n</scheduled-task-result>`);try{await u()}catch(e){W(e)}})().catch(async e=>{W(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await f(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:q()}),E=()=>{i({jsx:oe(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};E();try{for await(let t of A({agentDefinition:g,promptMessages:p,toolUseContext:{...n,getAppState:d},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=xe([t]);if(t.type===`assistant`){let r=T(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),E())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),E())}}}finally{i(null)}let O=C(y,`Command completed`);return H(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(O=`[ANT-ONLY] API calls: ${He(m(s))}\n${O}`),{messages:[D({content:j({inputString:`/${N(e)} ${t}`.trim(),precedingInputBlocks:r})}),D({content:`<local-command-stdout>\n${O}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:O}}function at(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function ot(e,t,n,i,a,s,c,l,u,d){let f=$e(e);if(!f){K(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[z(),...i,D({content:j({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:p,args:m,isMcp:h}=f,g=h?`mcp`:je().has(p)?p:`custom`;if(!se(p,a.options.commands)){let n=!1;try{await Pe().stat(`/${p}`),n=!0}catch{}if(at(p)&&!n){K(`tengu_input_slash_invalid`,{input:p});let e=`Unknown skill: ${p}`;return{messages:[z(),...i,D({content:j({inputString:e,precedingInputBlocks:t})}),...m?[ke(`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:[D({content:j({inputString:e,precedingInputBlocks:t}),uuid:c}),...i],shouldQuery:!0}}let{messages:_,shouldQuery:v,allowedTools:y,model:b,effort:x,command:S,resultText:C,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}=await st(p,m,s,a,t,n,l,u,c,d);if(_.length===0){let e={input:g};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=M(n),i=I(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,P(S.pluginInfo))}return K(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:p,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:b,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}}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:p}),{messages:[z(),..._],shouldQuery:v,allowedTools:y,model:b};let O={input:g};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=M(t),r=I(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,P(S.pluginInfo))}K(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:p,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=_.length>0&&_[0]&&o(_[0]);return{messages:v||_.every(ae)||k?_:[z(),..._],shouldQuery:v,allowedTools:y,model:b,effort:x,resultText:C,nextInput:w,submitNextInput:T,deferAutonomyCompletion:E}}async function st(e,t,n,r,i,a,o,s,c,l){let u=y(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&me(e),u.userInvocable===!1)return{messages:[D({content:j({inputString:`/${e}`,precedingInputBlocks:i})}),D({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=>D({content:e,isMeta:!0})),s=Se()&&typeof n==`string`&&n.endsWith(` dismissed`),c=r?.displayArgs??t;e({messages:r?.display===`system`?s?o:[F(Y(u,c)),F(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[D({content:j({inputString:Y(u,c),precedingInputBlocks:i})}),D(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${_e}</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=D({content:j({inputString:Y(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=z(),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?[D({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 _(),{messages:le(r),shouldQuery:!1,command:u}}return{messages:[e,F(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return W(t),{messages:[e,F(`<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??ne,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof Ne?{messages:[D({content:j({inputString:Y(u,t),precedingInputBlocks:i})}),Oe({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[D({content:j({inputString:Y(u,t),precedingInputBlocks:i})}),D({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof B)return{messages:[D({content:j({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function Y(e,t){return d(N(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=ee(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 l=await e.getPromptForCommand(t,r),d=!Ce(`hooks`)||he(e.source);if(e.hooks&&d){let t=n();tt(r.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=l.filter(e=>e.type===`text`).map(e=>e.text).join(`
4
-
5
- `);i(e.name,f,p,Ye()?.agentId??null);let m=lt(e,t),h=R(e.allowedTools??[]),g=o.length>0||a.length>0?[...o,...a,...l]:l,_=await be(c(l.filter(e=>e.type===`text`).map(e=>e.text).join(` `),r,null,[],r.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[D({content:m,uuid:s}),D({content:g,isMeta:!0}),..._,u({type:`command_permissions`,allowedTools:h,model:e.model})],shouldQuery:!0,allowedTools:h,model:e.model,effort:e.effort,command:e}}var Q,$;e((()=>{t(),w(),pe(),ze(),Ue(),b(),E(),re(),De(),g(),te(),Je(),ge(),V(),Ie(),Ve(),a(),Fe(),x(),ce(),nt(),Be(),S(),Me(),s(),f(),we(),ye(),et(),Ke(),ve(),Qe(),Ae(),O(),fe(),de(),Ge(),Q=200,$=1e4}))();export{X as formatSkillLoadingMetadata,ut as processPromptSlashCommand,ot as processSlashCommand};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./prompt-DNDgGM9q.js";t();export{e as isDeferredTool};
@@ -1 +0,0 @@
1
- import{iD as e,uD as t}from"./loadAgentsDir-BURvZNN6.js";t();export{e as clearPromptCache};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n,t as r,y as i}from"./src-CDCSSo0U2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{_x as o,ah as s,da as c,fa as l,ih as u,oh as d,rh as f,vx as p}from"./loadAgentsDir-BURvZNN6.js";import{n as m,r as h}from"./analytics-BotDBGh0.js";import{It as g,Mt as _,Pt as v,Vt as y,ci as b,oi as x}from"./model-BIVmcl_N.js";import{n as S,t as C}from"./extra-usage-CjaHpu8y.js";import{n as w,t as T}from"./upgrade-yNl7EO4e.js";function E({onDone:e,context:t}){let[n,r]=(0,O.useState)(null),a=u(),c=g(),d=v(),f=_()?.hasExtraUsageEnabled===!0,p=c===`max`&&d===`default_claude_max_20x`,m=c===`team`||c===`enterprise`,y=(0,O.useMemo)(()=>{let e=[];if(s.isEnabled()){let t=x(),n=m&&!t,r=a.overageDisabledReason===`out_of_credits`||a.overageDisabledReason===`org_level_disabled_until`||a.overageDisabledReason===`org_service_zero_credit_limit`;if(!(n&&r)){let t=a.overageStatus===`rejected`||a.overageStatus===`allowed_warning`,r;r=n?t?`Request more`:`Request extra usage`:f?`Add funds to continue with extra usage`:`Switch to extra usage`,e.push({label:r,value:`extra-usage`})}}return!p&&!m&&l.isEnabled()&&e.push({label:`Upgrade your plan`,value:`upgrade`}),[{label:`Stop and wait for limit to reset`,value:`cancel`},...e]},[!1,p,m,f,a.overageStatus,a.overageDisabledReason]);function b(){h(`tengu_rate_limit_options_menu_cancel`,{}),e(void 0,{display:`skip`})}function S(n){n===`upgrade`?(h(`tengu_rate_limit_options_menu_select_upgrade`,{}),T(e,t).then(e=>{e&&r(e)})):n===`extra-usage`?(h(`tengu_rate_limit_options_menu_select_extra_usage`,{}),C(e,t).then(e=>{e&&r(e)})):n===`cancel`&&b()}return n||(0,k.jsx)(i,{title:`What do you want to do?`,onCancel:b,color:`suggestion`,children:(0,k.jsx)(o,{options:y,onChange:S,visibleOptionCount:y.length})})}async function D(e,t){return(0,k.jsx)(E,{onDone:e,context:t})}var O,k;e((()=>{O=t(n(),1),p(),r(),m(),f(),y(),b(),S(),d(),c(),w(),k=a()}))();export{D as call};
@@ -1,4 +0,0 @@
1
- import{n as e,t}from"./defineProperty-C-QyHrDq.js";import{A as n,E as r,M as i,N as a,P as o,S as s,T as c,d as l,f as u,g as d,h as f,i as p,m as ee,n as m,r as h,t as g,v as te,x as _}from"./lazySchema-DcIJE_0i.js";import{en as ne,nt as v}from"./state-ix0xIunV.js";import{$w as re,Dn as ie,En as ae,Ew as y,Fs as oe,G as se,Gt as ce,Hs as le,Ls as ue,On as de,QT as fe,Tn as pe,Vs as me,W as he,ZT as ge,du as _e,eT as ve,fu as ye,ww as b,xw as x,yn as be}from"./loadAgentsDir-BURvZNN6.js";import{C as xe,D as Se,F as Ce,S,a as C,l as w,w as T,z as E}from"./debug-BrXObCdR.js";import{Ct as we,St as Te}from"./settings-DfWP5y6X.js";import{n as Ee,o as De}from"./process-gEbdy6uY.js";import{M as Oe,_ as ke,j as Ae,n as je}from"./git-Do0wJvux.js";import{o as Me,s as D}from"./log-BMCygSzM.js";import{_ as Ne,f as Pe}from"./file-DcZWPH2V.js";import{dr as Fe,fr as Ie}from"./model-BIVmcl_N.js";import{d as Le,h as Re}from"./rcDebugLog-DoL1FpGJ.js";import{t as ze}from"./controlMessageCompat-IFu4Gc1y.js";import{isAbsolute as Be,resolve as Ve}from"path";import{randomUUID as O}from"crypto";h(),g();var k=m(()=>r({inputTokens:c(),outputTokens:c(),cacheReadInputTokens:c(),cacheCreationInputTokens:c(),webSearchRequests:c(),costUSD:c(),contextWindow:c(),maxOutputTokens:c()})),He=m(()=>s(`json_schema`));m(()=>r({type:He()}));var Ue=m(()=>r({type:s(`json_schema`),schema:n(i(),o())}));m(()=>Ue());var We=m(()=>l([`user`,`project`,`org`,`temporary`,`oauth`]));m(()=>l([`local`,`user`,`project`]).describe(`Config scope for settings.`)),m(()=>s(`context-1m-2025-08-07`));var Ge=m(()=>r({type:s(`adaptive`)}).describe(`Claude decides when and how much to think (Opus 4.6+).`)),Ke=m(()=>r({type:s(`enabled`),budgetTokens:c().optional()}).describe(`Fixed thinking token budget (older models)`)),qe=m(()=>r({type:s(`disabled`)}).describe(`No extended thinking`));m(()=>a([Ge(),Ke(),qe()]).describe(`Controls Claude's thinking/reasoning behavior. When set, takes precedence over the deprecated maxThinkingTokens.`));var Je=m(()=>r({type:s(`stdio`).optional(),command:i(),args:f(i()).optional(),env:n(i(),i()).optional()})),Ye=m(()=>r({type:s(`sse`),url:i(),headers:n(i(),i()).optional()})),Xe=m(()=>r({type:s(`http`),url:i(),headers:n(i(),i()).optional()})),Ze=m(()=>r({type:s(`sdk`),name:i()})),A=m(()=>a([Je(),Ye(),Xe(),Ze()])),Qe=m(()=>r({type:s(`claudeai-proxy`),url:i(),id:i()})),$e=m(()=>a([A(),Qe()])),j=m(()=>r({name:i().describe(`Server name as configured`),status:l([`connected`,`failed`,`needs-auth`,`pending`,`disabled`]).describe(`Current connection status`),serverInfo:r({name:i(),version:i()}).optional().describe(`Server information (available when connected)`),error:i().optional().describe(`Error message (available when status is 'failed')`),config:$e().optional().describe(`Server configuration (includes URL for HTTP/SSE servers)`),scope:i().optional().describe(`Configuration scope (e.g., project, user, local, claudeai, managed)`),tools:f(r({name:i(),description:i().optional(),annotations:r({readOnly:d().optional(),destructive:d().optional(),openWorld:d().optional()}).optional()})).optional().describe(`Tools provided by this server (available when connected)`),capabilities:r({experimental:n(i(),o()).optional()}).optional().describe(`@internal Server capabilities (available when connected). experimental['claude/channel'] is only present if the server's plugin is on the approved channels allowlist — use its presence to decide whether to show an Enable-channel prompt.`)}).describe(`Status information for an MCP server connection.`));m(()=>r({added:f(i()).describe(`Names of servers that were added`),removed:f(i()).describe(`Names of servers that were removed`),errors:n(i(),i()).describe(`Map of server names to error messages for servers that failed to connect`)}).describe(`Result of a setMcpServers operation.`));var M=m(()=>l([`userSettings`,`projectSettings`,`localSettings`,`session`,`cliArg`])),N=m(()=>l([`allow`,`deny`,`ask`])),P=m(()=>r({toolName:i(),ruleContent:i().optional()})),F=m(()=>te(`type`,[r({type:s(`addRules`),rules:f(P()),behavior:N(),destination:M()}),r({type:s(`replaceRules`),rules:f(P()),behavior:N(),destination:M()}),r({type:s(`removeRules`),rules:f(P()),behavior:N(),destination:M()}),r({type:s(`setMode`),mode:_(()=>L()),destination:M()}),r({type:s(`addDirectories`),directories:f(i()),destination:M()}),r({type:s(`removeDirectories`),directories:f(i()),destination:M()})])),I=m(()=>l([`user_temporary`,`user_permanent`,`user_reject`]).describe(`Classification of this permission decision for telemetry. SDK hosts that prompt users (desktop apps, IDEs) should set this to reflect what actually happened: user_temporary for allow-once, user_permanent for always-allow (both the click and later cache hits), user_reject for deny. If unset, the CLI infers conservatively (temporary for allow, reject for deny). The vocabulary matches tool_decision OTel events (monitoring-usage docs).`));m(()=>a([r({behavior:s(`allow`),updatedInput:n(i(),o()).optional(),updatedPermissions:f(F()).optional(),toolUseID:i().optional(),decisionClassification:I().optional()}),r({behavior:s(`deny`),message:i(),interrupt:d().optional(),toolUseID:i().optional(),decisionClassification:I().optional()})]));var L=m(()=>l([`default`,`acceptEdits`,`bypassPermissions`,`plan`,`dontAsk`,`auto`]).describe(`Permission mode for controlling how tool executions are handled. 'default' - Standard behavior, prompts for dangerous operations. 'acceptEdits' - Auto-accept file edit operations. 'bypassPermissions' - Bypass all permission checks (requires allowDangerouslySkipPermissions). 'plan' - Planning mode, no actual tool execution. 'dontAsk' - Don't prompt for permissions, deny if not pre-approved. 'auto' - Automatic mode (transcript classifier).`)),et=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`),tt=m(()=>l(et)),R=m(()=>r({session_id:i(),transcript_path:i(),cwd:i(),permission_mode:i().optional(),agent_id:i().optional().describe(`Subagent identifier. Present only when the hook fires from within a subagent (e.g., a tool called by an AgentTool worker). Absent for the main thread, even in --agent sessions. Use this field (not agent_type) to distinguish subagent calls from main-thread calls.`),agent_type:i().optional().describe(`Agent type name (e.g., "general-purpose", "code-reviewer"). Present when the hook fires from within a subagent (alongside agent_id), or on the main thread of a session started with --agent (without agent_id).`)})),nt=m(()=>R().and(r({hook_event_name:s(`PreToolUse`),tool_name:i(),tool_input:o(),tool_use_id:i()}))),rt=m(()=>R().and(r({hook_event_name:s(`PermissionRequest`),tool_name:i(),tool_input:o(),permission_suggestions:f(F()).optional()}))),it=m(()=>R().and(r({hook_event_name:s(`PostToolUse`),tool_name:i(),tool_input:o(),tool_response:o(),tool_use_id:i()}))),at=m(()=>R().and(r({hook_event_name:s(`PostToolUseFailure`),tool_name:i(),tool_input:o(),tool_use_id:i(),error:i(),is_interrupt:d().optional()}))),ot=m(()=>R().and(r({hook_event_name:s(`PermissionDenied`),tool_name:i(),tool_input:o(),tool_use_id:i(),reason:i()}))),st=m(()=>R().and(r({hook_event_name:s(`Notification`),message:i(),title:i().optional(),notification_type:i()}))),ct=m(()=>R().and(r({hook_event_name:s(`UserPromptSubmit`),prompt:i()}))),lt=m(()=>R().and(r({hook_event_name:s(`SessionStart`),source:l([`startup`,`resume`,`clear`,`compact`]),agent_type:i().optional(),model:i().optional()}))),ut=m(()=>R().and(r({hook_event_name:s(`Setup`),trigger:l([`init`,`maintenance`])}))),dt=m(()=>R().and(r({hook_event_name:s(`Stop`),stop_hook_active:d(),last_assistant_message:i().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),ft=m(()=>R().and(r({hook_event_name:s(`StopFailure`),error:U(),error_details:i().optional(),last_assistant_message:i().optional()}))),pt=m(()=>R().and(r({hook_event_name:s(`SubagentStart`),agent_id:i(),agent_type:i()}))),mt=m(()=>R().and(r({hook_event_name:s(`SubagentStop`),stop_hook_active:d(),agent_id:i(),agent_transcript_path:i(),agent_type:i(),last_assistant_message:i().optional().describe(`Text content of the last assistant message before stopping. Avoids the need to read and parse the transcript file.`)}))),ht=m(()=>R().and(r({hook_event_name:s(`PreCompact`),trigger:l([`manual`,`auto`]),custom_instructions:i().nullable()}))),gt=m(()=>R().and(r({hook_event_name:s(`PostCompact`),trigger:l([`manual`,`auto`]),compact_summary:i().describe(`The conversation summary produced by compaction`)}))),_t=m(()=>R().and(r({hook_event_name:s(`TeammateIdle`),teammate_name:i(),team_name:i()}))),vt=m(()=>R().and(r({hook_event_name:s(`TaskCreated`),task_id:i(),task_subject:i(),task_description:i().optional(),teammate_name:i().optional(),team_name:i().optional()}))),yt=m(()=>R().and(r({hook_event_name:s(`TaskCompleted`),task_id:i(),task_subject:i(),task_description:i().optional(),teammate_name:i().optional(),team_name:i().optional()}))),bt=m(()=>R().and(r({hook_event_name:s(`Elicitation`),mcp_server_name:i(),message:i(),mode:l([`form`,`url`]).optional(),url:i().optional(),elicitation_id:i().optional(),requested_schema:n(i(),o()).optional()})).describe(`Hook input for the Elicitation event. Fired when an MCP server requests user input. Hooks can auto-respond (accept/decline) instead of showing the dialog.`)),xt=m(()=>R().and(r({hook_event_name:s(`ElicitationResult`),mcp_server_name:i(),elicitation_id:i().optional(),mode:l([`form`,`url`]).optional(),action:l([`accept`,`decline`,`cancel`]),content:n(i(),o()).optional()})).describe(`Hook input for the ElicitationResult event. Fired after the user responds to an MCP elicitation. Hooks can observe or override the response before it is sent to the server.`)),St=[`user_settings`,`project_settings`,`local_settings`,`policy_settings`,`skills`],Ct=m(()=>R().and(r({hook_event_name:s(`ConfigChange`),source:l(St),file_path:i().optional()}))),wt=[`session_start`,`nested_traversal`,`path_glob_match`,`include`,`compact`],Tt=[`User`,`Project`,`Local`,`Managed`],Et=m(()=>R().and(r({hook_event_name:s(`InstructionsLoaded`),file_path:i(),memory_type:l(Tt),load_reason:l(wt),globs:f(i()).optional(),trigger_file_path:i().optional(),parent_file_path:i().optional()}))),Dt=m(()=>R().and(r({hook_event_name:s(`WorktreeCreate`),name:i()}))),Ot=m(()=>R().and(r({hook_event_name:s(`WorktreeRemove`),worktree_path:i()}))),kt=m(()=>R().and(r({hook_event_name:s(`CwdChanged`),old_cwd:i(),new_cwd:i()}))),At=m(()=>R().and(r({hook_event_name:s(`FileChanged`),file_path:i(),event:l([`change`,`add`,`unlink`])}))),jt=[`clear`,`resume`,`logout`,`prompt_input_exit`,`other`,`bypass_permissions_disabled`],Mt=m(()=>l(jt)),Nt=m(()=>R().and(r({hook_event_name:s(`SessionEnd`),reason:Mt()}))),Pt=m(()=>a([nt(),it(),at(),ot(),st(),ct(),lt(),Nt(),dt(),ft(),pt(),mt(),ht(),gt(),rt(),ut(),_t(),vt(),yt(),bt(),xt(),Ct(),Et(),Dt(),Ot(),kt(),At()])),Ft=m(()=>r({async:s(!0),asyncTimeout:c().optional()})),It=m(()=>r({hookEventName:s(`PreToolUse`),permissionDecision:N().optional(),permissionDecisionReason:i().optional(),updatedInput:n(i(),o()).optional(),additionalContext:i().optional()})),Lt=m(()=>r({hookEventName:s(`UserPromptSubmit`),additionalContext:i().optional()})),Rt=m(()=>r({hookEventName:s(`SessionStart`),additionalContext:i().optional(),initialUserMessage:i().optional(),watchPaths:f(i()).optional()})),zt=m(()=>r({hookEventName:s(`Setup`),additionalContext:i().optional()})),Bt=m(()=>r({hookEventName:s(`SubagentStart`),additionalContext:i().optional()})),Vt=m(()=>r({hookEventName:s(`PostToolUse`),additionalContext:i().optional(),updatedMCPToolOutput:o().optional()})),Ht=m(()=>r({hookEventName:s(`PostToolUseFailure`),additionalContext:i().optional()})),Ut=m(()=>r({hookEventName:s(`PermissionDenied`),retry:d().optional()})),Wt=m(()=>r({hookEventName:s(`Notification`),additionalContext:i().optional()})),Gt=m(()=>r({hookEventName:s(`PermissionRequest`),decision:a([r({behavior:s(`allow`),updatedInput:n(i(),o()).optional(),updatedPermissions:f(F()).optional()}),r({behavior:s(`deny`),message:i().optional(),interrupt:d().optional()})])})),Kt=m(()=>r({hookEventName:s(`CwdChanged`),watchPaths:f(i()).optional()})),qt=m(()=>r({hookEventName:s(`FileChanged`),watchPaths:f(i()).optional()})),Jt=m(()=>r({continue:d().optional(),suppressOutput:d().optional(),stopReason:i().optional(),decision:l([`approve`,`block`]).optional(),systemMessage:i().optional(),reason:i().optional(),hookSpecificOutput:a([It(),Lt(),Rt(),zt(),Bt(),Vt(),Ht(),Ut(),Wt(),Gt(),Yt(),Xt(),Kt(),qt(),Zt()]).optional()})),Yt=m(()=>r({hookEventName:s(`Elicitation`),action:l([`accept`,`decline`,`cancel`]).optional(),content:n(i(),o()).optional()}).describe(`Hook-specific output for the Elicitation event. Return this to programmatically accept or decline an MCP elicitation request.`)),Xt=m(()=>r({hookEventName:s(`ElicitationResult`),action:l([`accept`,`decline`,`cancel`]).optional(),content:n(i(),o()).optional()}).describe(`Hook-specific output for the ElicitationResult event. Return this to override the action or content before the response is sent to the MCP server.`)),Zt=m(()=>r({hookEventName:s(`WorktreeCreate`),worktreePath:i()}).describe(`Hook-specific output for the WorktreeCreate event. Provides the absolute path to the created worktree directory. Command hooks print the path on stdout instead.`));m(()=>a([Ft(),Jt()]));var Qt=m(()=>r({key:i().describe(`Unique key for this option, returned in the response`),label:i().describe(`Display text for this option`),description:i().optional().describe(`Optional description shown below the label`)}));m(()=>r({prompt:i().describe(`Request ID. Presence of this key marks the line as a prompt request.`),message:i().describe(`The prompt message to display to the user`),options:f(Qt()).describe(`Available options for the user to choose from`)})),m(()=>r({prompt_response:i().describe(`The request ID from the corresponding prompt request`),selected:i().describe(`The key of the selected option`)}));var z=m(()=>r({name:i().describe(`Skill name (without the leading slash)`),description:i().describe(`Description of what the skill does`),argumentHint:i().describe(`Hint for skill arguments (e.g., "<file>")`)}).describe(`Information about an available skill (invoked via /command syntax).`)),B=m(()=>r({name:i().describe(`Agent type identifier (e.g., "Explore")`),description:i().describe(`Description of when to use this agent`),model:i().optional().describe(`Model alias this agent uses. If omitted, inherits the parent's model`)}).describe(`Information about an available subagent that can be invoked via the Task tool.`)),$t=m(()=>r({value:i().describe(`Model identifier to use in API calls`),displayName:i().describe(`Human-readable display name`),description:i().describe(`Description of the model's capabilities`),supportsEffort:d().optional().describe(`Whether this model supports effort levels`),supportedEffortLevels:f(l([`low`,`medium`,`high`,`xhigh`,`max`])).optional().describe(`Available effort levels for this model`),supportsAdaptiveThinking:d().optional().describe(`Whether this model supports adaptive thinking (Claude decides when and how much to think)`),supportsFastMode:d().optional().describe(`Whether this model supports fast mode`),supportsAutoMode:d().optional().describe(`Whether this model supports auto mode`)}).describe(`Information about an available model.`)),en=m(()=>r({email:i().optional(),organization:i().optional(),subscriptionType:i().optional(),tokenSource:i().optional(),apiKeySource:i().optional(),apiProvider:l([`firstParty`,`bedrock`,`vertex`,`foundry`]).optional().describe(`Active API backend. Anthropic OAuth login only applies when "firstParty"; for 3P providers the other fields are absent and auth is external (AWS creds, gcloud ADC, etc.).`)}).describe(`Information about the logged in user's account.`)),tn=m(()=>a([i(),n(i(),A())])),nn=m(()=>r({description:i().describe(`Natural language description of when to use this agent`),tools:f(i()).optional().describe(`Array of allowed tool names. If omitted, inherits all tools from parent`),disallowedTools:f(i()).optional().describe(`Array of tool names to explicitly disallow for this agent`),prompt:i().describe(`The agent's system prompt`),model:i().optional().describe(`Model alias (e.g. 'sonnet', 'opus', 'haiku') or full model ID (e.g. 'claude-opus-4-5'). If omitted or 'inherit', uses the main model`),mcpServers:f(tn()).optional(),criticalSystemReminder_EXPERIMENTAL:i().optional().describe(`Experimental: Critical reminder added to system prompt`),skills:f(i()).optional().describe(`Array of skill names to preload into the agent context`),initialPrompt:i().optional().describe(`Auto-submitted as the first user turn when this agent is the main thread agent. Slash commands are processed. Prepended to any user-provided prompt.`),maxTurns:c().int().positive().optional().describe(`Maximum number of agentic turns (API round-trips) before stopping`),background:d().optional().describe(`Run this agent as a background task (non-blocking, fire-and-forget) when invoked`),memory:l([`user`,`project`,`local`]).optional().describe(`Scope for auto-loading agent memory files. 'user' - ~/.claude/agent-memory/<agentType>/, 'project' - .claude/agent-memory/<agentType>/, 'local' - .claude/agent-memory-local/<agentType>/`),effort:a([l([`low`,`medium`,`high`,`xhigh`,`max`]),c().int()]).optional().describe(`Reasoning effort level for this agent. Either a named level or an integer`),permissionMode:L().optional().describe(`Permission mode controlling how tool executions are handled`)}).describe(`Definition for a custom subagent that can be invoked via the Agent tool.`));m(()=>l([`user`,`project`,`local`]).describe(`Source for loading filesystem-based settings. 'user' - Global user settings (~/.claude/settings.json). 'project' - Project settings (.claude/settings.json). 'local' - Local settings (.claude/settings.local.json).`)),m(()=>r({type:s(`local`).describe(`Plugin type. Currently only 'local' is supported`),path:i().describe(`Absolute or relative path to the plugin directory`)}).describe(`Configuration for loading a plugin.`)),m(()=>r({canRewind:d(),error:i().optional(),filesChanged:f(i()).optional(),insertions:c().optional(),deletions:c().optional()}).describe(`Result of a rewindFiles operation.`));var rn=m(()=>o()),an=m(()=>o()),on=m(()=>o()),V=m(()=>i()),H=m(()=>o()),U=m(()=>l([`authentication_failed`,`billing_error`,`rate_limit`,`invalid_request`,`server_error`,`unknown`,`max_output_tokens`])),sn=m(()=>a([s(`compacting`),u()])),W=m(()=>r({type:s(`user`),message:rn(),parent_tool_use_id:i().nullable(),isSynthetic:d().optional(),tool_use_result:o().optional(),priority:l([`now`,`next`,`later`]).optional(),timestamp:i().optional().describe(`ISO timestamp when the message was created on the originating process. Older emitters omit it; consumers should fall back to receive time.`)})),G=m(()=>W().extend({uuid:V().optional(),session_id:i().optional()})),cn=m(()=>W().extend({uuid:V(),session_id:i(),isReplay:s(!0)})),ln=m(()=>r({status:l([`allowed`,`allowed_warning`,`rejected`]),resetsAt:c().optional(),rateLimitType:l([`five_hour`,`seven_day`,`seven_day_opus`,`seven_day_sonnet`,`overage`]).optional(),utilization:c().optional(),overageStatus:l([`allowed`,`allowed_warning`,`rejected`]).optional(),overageResetsAt:c().optional(),overageDisabledReason:l([`overage_not_provisioned`,`org_level_disabled`,`org_level_disabled_until`,`out_of_credits`,`seat_tier_level_disabled`,`member_level_disabled`,`seat_tier_zero_credit_limit`,`group_zero_credit_limit`,`member_zero_credit_limit`,`org_service_level_disabled`,`org_service_zero_credit_limit`,`no_limits_configured`,`unknown`]).optional(),isUsingOverage:d().optional(),surpassedThreshold:c().optional()}).describe(`Rate limit information for claude.ai subscription users.`)),un=m(()=>r({type:s(`assistant`),message:an(),parent_tool_use_id:i().nullable(),error:U().optional(),uuid:V(),session_id:i()})),dn=m(()=>r({type:s(`rate_limit_event`),rate_limit_info:ln(),uuid:V(),session_id:i()}).describe(`Rate limit event emitted when rate limit info changes.`)),fn=m(()=>r({type:s(`streamlined_text`),text:i().describe(`Text content preserved from the assistant message`),session_id:i(),uuid:V()}).describe(`@internal Streamlined text message - replaces SDKAssistantMessage in streamlined output. Text content preserved, thinking and tool_use blocks removed.`)),pn=m(()=>r({type:s(`streamlined_tool_use_summary`),tool_summary:i().describe(`Summary of tool calls (e.g., "Read 2 files, wrote 1 file")`),session_id:i(),uuid:V()}).describe(`@internal Streamlined tool use summary - replaces tool_use blocks in streamlined output with a cumulative summary string.`)),K=m(()=>r({tool_name:i(),tool_use_id:i(),tool_input:n(i(),o())})),mn=m(()=>r({type:s(`result`),subtype:s(`success`),duration_ms:c(),duration_api_ms:c(),is_error:d(),num_turns:c(),result:i(),stop_reason:i().nullable(),total_cost_usd:c(),usage:H(),modelUsage:n(i(),k()),permission_denials:f(K()),structured_output:o().optional(),fast_mode_state:q().optional(),uuid:V(),session_id:i()})),hn=m(()=>r({type:s(`result`),subtype:l([`error_during_execution`,`error_max_turns`,`error_max_budget_usd`,`error_max_structured_output_retries`]),duration_ms:c(),duration_api_ms:c(),is_error:d(),num_turns:c(),stop_reason:i().nullable(),total_cost_usd:c(),usage:H(),modelUsage:n(i(),k()),permission_denials:f(K()),errors:f(i()),fast_mode_state:q().optional(),uuid:V(),session_id:i()})),gn=m(()=>a([mn(),hn()])),_n=m(()=>r({type:s(`system`),subtype:s(`init`),agents:f(i()).optional(),apiKeySource:We(),betas:f(i()).optional(),claude_code_version:i(),cwd:i(),tools:f(i()),mcp_servers:f(r({name:i(),status:i()})),model:i(),permissionMode:L(),slash_commands:f(i()),output_style:i(),skills:f(i()),plugins:f(r({name:i(),path:i(),source:i().optional().describe(`@internal Plugin source identifier in "name\\@marketplace" format. Sentinels: "name\\@inline" for --plugin-dir, "name\\@builtin" for built-in plugins.`)})),fast_mode_state:q().optional(),uuid:V(),session_id:i()})),vn=m(()=>r({type:s(`stream_event`),event:on(),parent_tool_use_id:i().nullable(),uuid:V(),session_id:i()})),yn=m(()=>r({type:s(`system`),subtype:s(`compact_boundary`),compact_metadata:r({trigger:l([`manual`,`auto`]),pre_tokens:c(),preserved_segment:r({head_uuid:V(),anchor_uuid:V(),tail_uuid:V()}).optional().describe(`Relink info for messagesToKeep. Loaders splice the preserved segment at anchor_uuid (summary for suffix-preserving, boundary for prefix-preserving partial compact) so resume includes preserved content. Unset when compaction summarizes everything (no messagesToKeep).`)}),uuid:V(),session_id:i()})),bn=m(()=>r({type:s(`system`),subtype:s(`status`),status:sn(),permissionMode:L().optional(),uuid:V(),session_id:i()})),xn=m(()=>r({type:s(`system`),subtype:s(`post_turn_summary`),summarizes_uuid:i(),status_category:l([`blocked`,`waiting`,`completed`,`review_ready`,`failed`]),status_detail:i(),is_noteworthy:d(),title:i(),description:i(),recent_action:i(),needs_action:i(),artifact_urls:f(i()),uuid:V(),session_id:i()}).describe(`@internal Background post-turn summary emitted after each assistant turn. summarizes_uuid points to the assistant message this summarizes.`)),Sn=m(()=>r({type:s(`system`),subtype:s(`api_retry`),attempt:c(),max_retries:c(),retry_delay_ms:c(),error_status:c().nullable(),error:U(),uuid:V(),session_id:i()}).describe(`Emitted when an API request fails with a retryable error and will be retried after a delay. error_status is null for connection errors (e.g. timeouts) that had no HTTP response.`)),Cn=m(()=>r({type:s(`system`),subtype:s(`local_command_output`),content:i(),uuid:V(),session_id:i()}).describe(`Output from a local slash command (e.g. /voice, /cost). Displayed as assistant-style text in the transcript.`)),wn=m(()=>r({type:s(`system`),subtype:s(`hook_started`),hook_id:i(),hook_name:i(),hook_event:i(),uuid:V(),session_id:i()})),Tn=m(()=>r({type:s(`system`),subtype:s(`hook_progress`),hook_id:i(),hook_name:i(),hook_event:i(),stdout:i(),stderr:i(),output:i(),uuid:V(),session_id:i()})),En=m(()=>r({type:s(`system`),subtype:s(`hook_response`),hook_id:i(),hook_name:i(),hook_event:i(),output:i(),stdout:i(),stderr:i(),exit_code:c().optional(),outcome:l([`success`,`error`,`cancelled`]),uuid:V(),session_id:i()})),Dn=m(()=>r({type:s(`tool_progress`),tool_use_id:i(),tool_name:i(),parent_tool_use_id:i().nullable(),elapsed_time_seconds:c(),task_id:i().optional(),uuid:V(),session_id:i()})),On=m(()=>r({type:s(`auth_status`),isAuthenticating:d(),output:f(i()),error:i().optional(),uuid:V(),session_id:i()})),kn=m(()=>r({type:s(`system`),subtype:s(`files_persisted`),files:f(r({filename:i(),file_id:i()})),failed:f(r({filename:i(),error:i()})),processed_at:i(),uuid:V(),session_id:i()})),An=m(()=>r({type:s(`system`),subtype:s(`task_notification`),task_id:i(),tool_use_id:i().optional(),status:l([`completed`,`failed`,`stopped`]),output_file:i(),summary:i(),usage:r({total_tokens:c(),tool_uses:c(),duration_ms:c()}).optional(),uuid:V(),session_id:i()})),jn=m(()=>r({type:s(`system`),subtype:s(`task_started`),task_id:i(),tool_use_id:i().optional(),description:i(),task_type:i().optional(),workflow_name:i().optional().describe(`meta.name from the workflow script (e.g. 'spec'). Only set when task_type is 'local_workflow'.`),prompt:i().optional(),uuid:V(),session_id:i()})),Mn=m(()=>r({type:s(`system`),subtype:s(`session_state_changed`),state:l([`idle`,`running`,`requires_action`]),uuid:V(),session_id:i()}).describe(`Mirrors notifySessionStateChanged. 'idle' fires after heldBackResult flushes and the bg-agent do-while exits — authoritative turn-over signal.`)),Nn=m(()=>r({type:s(`system`),subtype:s(`task_progress`),task_id:i(),tool_use_id:i().optional(),description:i(),usage:r({total_tokens:c(),tool_uses:c(),duration_ms:c()}),last_tool_name:i().optional(),summary:i().optional(),uuid:V(),session_id:i()})),Pn=m(()=>r({type:s(`tool_use_summary`),summary:i(),preceding_tool_use_ids:f(i()),uuid:V(),session_id:i()})),Fn=m(()=>r({type:s(`system`),subtype:s(`elicitation_complete`),mcp_server_name:i(),elicitation_id:i(),uuid:V(),session_id:i()}).describe(`Emitted when an MCP server confirms that a URL-mode elicitation is complete.`)),In=m(()=>r({type:s(`prompt_suggestion`),suggestion:i(),uuid:V(),session_id:i()}).describe(`Predicted next user prompt, emitted after each turn when promptSuggestions is enabled.`));m(()=>r({sessionId:i().describe(`Unique session identifier (UUID).`),summary:i().describe(`Display title for the session: custom title, auto-generated summary, or first prompt.`),lastModified:c().describe(`Last modified time in milliseconds since epoch.`),fileSize:c().optional().describe(`File size in bytes. Only populated for local JSONL storage.`),customTitle:i().optional().describe(`User-set session title via /rename.`),firstPrompt:i().optional().describe(`First meaningful user prompt in the session.`),gitBranch:i().optional().describe(`Git branch at the end of the session.`),cwd:i().optional().describe(`Working directory for the session.`),tag:i().optional().describe(`User-set session tag.`),createdAt:c().optional().describe(`Creation time in milliseconds since epoch, extracted from the first entry's timestamp.`)}).describe(`Session metadata returned by listSessions and getSessionInfo.`));var Ln=m(()=>a([un(),G(),cn(),gn(),_n(),vn(),yn(),bn(),Sn(),Cn(),wn(),Tn(),En(),Dn(),On(),An(),jn(),Nn(),Mn(),kn(),Pn(),dn(),Fn(),In()])),q=m(()=>l([`off`,`cooldown`,`on`]).describe(`Fast mode state: off, in cooldown after rate limit, or actively enabled.`));h(),g();var Rn=m(()=>o()),zn=m(()=>r({matcher:i().optional(),hookCallbackIds:f(i()),timeout:c().optional()}).describe(`Configuration for matching and routing hook callbacks.`)),Bn=m(()=>r({subtype:s(`initialize`),hooks:n(tt(),f(zn())).optional(),sdkMcpServers:f(i()).optional(),jsonSchema:n(i(),o()).optional(),systemPrompt:i().optional(),appendSystemPrompt:i().optional(),agents:n(i(),nn()).optional(),promptSuggestions:d().optional(),agentProgressSummaries:d().optional()}).describe(`Initializes the SDK session with hooks, MCP servers, and agent configuration.`));m(()=>r({commands:f(z()),agents:f(B()),output_style:i(),available_output_styles:f(i()),models:f($t()),account:en(),pid:c().optional().describe(`@internal CLI process PID for tmux socket isolation`),fast_mode_state:q().optional()}).describe(`Response from session initialization with available commands, models, and account info.`));var Vn=m(()=>r({subtype:s(`interrupt`)}).describe(`Interrupts the currently running conversation turn.`)),Hn=m(()=>r({subtype:s(`can_use_tool`),tool_name:i(),input:n(i(),o()),permission_suggestions:f(F()).optional(),blocked_path:i().optional(),decision_reason:i().optional(),title:i().optional(),display_name:i().optional(),tool_use_id:i(),agent_id:i().optional(),description:i().optional()}).describe(`Requests permission to use a tool with the given input.`)),Un=m(()=>r({subtype:s(`set_permission_mode`),mode:L(),ultraplan:d().optional().describe(`@internal CCR ultraplan session marker.`)}).describe(`Sets the permission mode for tool execution handling.`)),Wn=m(()=>r({subtype:s(`set_model`),model:i().optional()}).describe(`Sets the model to use for subsequent conversation turns.`)),Gn=m(()=>r({subtype:s(`set_max_thinking_tokens`),max_thinking_tokens:c().nullable()}).describe(`Sets the maximum number of thinking tokens for extended thinking.`)),Kn=m(()=>r({subtype:s(`mcp_status`)}).describe(`Requests the current status of all MCP server connections.`));m(()=>r({mcpServers:f(j())}).describe(`Response containing the current status of all MCP server connections.`));var qn=m(()=>r({subtype:s(`get_context_usage`)}).describe(`Requests a breakdown of current context window usage by category.`)),Jn=m(()=>r({name:i(),tokens:c(),color:i(),isDeferred:d().optional()})),Yn=m(()=>r({color:i(),isFilled:d(),categoryName:i(),tokens:c(),percentage:c(),squareFullness:c()}));m(()=>r({categories:f(Jn()),totalTokens:c(),maxTokens:c(),rawMaxTokens:c(),percentage:c(),gridRows:f(f(Yn())),model:i(),memoryFiles:f(r({path:i(),type:i(),tokens:c()})),mcpTools:f(r({name:i(),serverName:i(),tokens:c(),isLoaded:d().optional()})),deferredBuiltinTools:f(r({name:i(),tokens:c(),isLoaded:d()})).optional(),systemTools:f(r({name:i(),tokens:c()})).optional(),systemPromptSections:f(r({name:i(),tokens:c()})).optional(),agents:f(r({agentType:i(),source:i(),tokens:c()})),slashCommands:r({totalCommands:c(),includedCommands:c(),tokens:c()}).optional(),skills:r({totalSkills:c(),includedSkills:c(),tokens:c(),skillFrontmatter:f(r({name:i(),source:i(),tokens:c()}))}).optional(),autoCompactThreshold:c().optional(),isAutoCompactEnabled:d(),messageBreakdown:r({toolCallTokens:c(),toolResultTokens:c(),attachmentTokens:c(),assistantMessageTokens:c(),userMessageTokens:c(),toolCallsByType:f(r({name:i(),callTokens:c(),resultTokens:c()})),attachmentsByType:f(r({name:i(),tokens:c()}))}).optional(),apiUsage:r({input_tokens:c(),output_tokens:c(),cache_creation_input_tokens:c(),cache_read_input_tokens:c()}).nullable()}).describe(`Breakdown of current context window usage by category (system prompt, tools, messages, etc.).`));var Xn=m(()=>r({subtype:s(`rewind_files`),user_message_id:i(),dry_run:d().optional()}).describe(`Rewinds file changes made since a specific user message.`));m(()=>r({canRewind:d(),error:i().optional(),filesChanged:f(i()).optional(),insertions:c().optional(),deletions:c().optional()}).describe(`Result of a rewindFiles operation.`));var Zn=m(()=>r({subtype:s(`cancel_async_message`),message_uuid:i()}).describe(`Drops a pending async user message from the command queue by uuid. No-op if already dequeued for execution.`));m(()=>r({cancelled:d()}).describe(`Result of a cancel_async_message operation. cancelled=false means the message was not in the queue (already dequeued or never enqueued).`));var Qn=m(()=>r({subtype:s(`seed_read_state`),path:i(),mtime:c()}).describe(`Seeds the readFileState cache with a path+mtime entry. Use when a prior Read was removed from context (e.g. by snip) so Edit validation would fail despite the client having observed the Read. The mtime lets the CLI detect if the file changed since the seeded Read — same staleness check as the normal path.`)),$n=m(()=>r({subtype:s(`hook_callback`),callback_id:i(),input:Pt(),tool_use_id:i().optional()}).describe(`Delivers a hook callback with its input data.`)),er=m(()=>r({subtype:s(`mcp_message`),server_name:i(),message:Rn()}).describe(`Sends a JSON-RPC message to a specific MCP server.`)),tr=m(()=>r({subtype:s(`mcp_set_servers`),servers:n(i(),A())}).describe(`Replaces the set of dynamically managed MCP servers.`));m(()=>r({added:f(i()),removed:f(i()),errors:n(i(),i())}).describe(`Result of replacing the set of dynamically managed MCP servers.`));var nr=m(()=>r({subtype:s(`reload_plugins`)}).describe(`Reloads plugins from disk and returns the refreshed session components.`));m(()=>r({commands:f(z()),agents:f(B()),plugins:f(r({name:i(),path:i(),source:i().optional()})),mcpServers:f(j()),error_count:c()}).describe(`Refreshed commands, agents, plugins, and MCP server status after reload.`));var rr=m(()=>r({subtype:s(`mcp_reconnect`),serverName:i()}).describe(`Reconnects a disconnected or failed MCP server.`)),ir=m(()=>r({subtype:s(`mcp_toggle`),serverName:i(),enabled:d()}).describe(`Enables or disables an MCP server.`)),ar=m(()=>r({subtype:s(`stop_task`),task_id:i()}).describe(`Stops a running task.`)),or=m(()=>r({subtype:s(`apply_flag_settings`),settings:n(i(),o())}).describe(`Merges the provided settings into the flag settings layer, updating the active configuration.`)),sr=m(()=>r({subtype:s(`get_settings`)}).describe(`Returns the effective merged settings and the raw per-source settings.`));m(()=>r({effective:n(i(),o()),sources:f(r({source:l([`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`]),settings:n(i(),o())})).describe(`Ordered low-to-high priority — later entries override earlier ones.`),applied:r({model:i(),effort:l([`low`,`medium`,`high`,`xhigh`,`max`]).nullable()}).optional().describe("Runtime-resolved values after env overrides, session state, and model-specific defaults are applied. Unlike `effective` (disk merge), these reflect what will actually be sent to the API.")}).describe(`Effective merged settings plus raw per-source settings in merge order.`));var cr=m(()=>r({subtype:s(`elicitation`),mcp_server_name:i(),message:i(),mode:l([`form`,`url`]).optional(),url:i().optional(),elicitation_id:i().optional(),requested_schema:n(i(),o()).optional()}).describe(`Requests the SDK consumer to handle an MCP elicitation (user input request).`)),lr=m(()=>r({action:l([`accept`,`decline`,`cancel`]),content:n(i(),o()).optional()}).describe(`Response from the SDK consumer for an elicitation request.`)),ur=m(()=>a([Vn(),Hn(),Bn(),Un(),Wn(),Gn(),Kn(),qn(),$n(),er(),Xn(),Zn(),Qn(),tr(),nr(),rr(),ir(),ar(),or(),sr(),cr()])),J=m(()=>r({type:s(`control_request`),request_id:i(),request:ur()})),dr=m(()=>r({subtype:s(`success`),request_id:i(),response:n(i(),o()).optional()})),fr=m(()=>r({subtype:s(`error`),request_id:i(),error:i(),pending_permission_requests:f(_(()=>J())).optional()})),Y=m(()=>r({type:s(`control_response`),response:a([dr(),fr()])})),pr=m(()=>r({type:s(`control_cancel_request`),request_id:i()}).describe(`Cancels a currently open control request.`)),X=m(()=>r({type:s(`keep_alive`)}).describe(`Keep-alive message to maintain WebSocket connection.`)),mr=m(()=>r({type:s(`update_environment_variables`),variables:n(i(),i())}).describe(`Updates environment variables at runtime.`));m(()=>a([Ln(),fn(),pn(),xn(),Y(),J(),pr(),X()])),m(()=>a([G(),J(),Y(),X(),mr()])),e(),ne(),E(),S(),Ee(),Ae(),ae(),h(),C(),g(),b(),ie(),m(()=>p.object({tool_name:p.string().describe(`The name of the tool requesting permission`),input:p.record(p.string(),p.unknown()).describe(`The input for the tool`),tool_use_id:p.string().optional().describe(`The unique tool use request ID`)}));var Z=m(()=>p.enum([`user_temporary`,`user_permanent`,`user_reject`]).optional().catch(void 0)),hr=m(()=>p.object({behavior:p.literal(`allow`),updatedInput:p.record(p.string(),p.unknown()),updatedPermissions:p.array(de()).optional().catch(e=>{w(`Malformed updatedPermissions from SDK host ignored: ${e.error.issues[0]?.message??`unknown`}`,{level:`warn`})}),toolUseID:p.string().optional(),decisionClassification:Z()})),gr=m(()=>p.object({behavior:p.literal(`deny`),message:p.string(),interrupt:p.boolean().optional(),toolUseID:p.string().optional(),decisionClassification:Z()})),Q=m(()=>p.union([hr(),gr()]));function $(e,t,n,r){let i={type:`permissionPromptTool`,permissionPromptToolName:t.name,toolResult:e};if(e.behavior===`allow`){let t=e.updatedPermissions;t&&(r.setAppState(e=>({...e,toolPermissionContext:x(e.toolPermissionContext,t)})),y(t));let a=Object.keys(e.updatedInput).length>0?e.updatedInput:n;return{...e,updatedInput:a,decisionReason:i}}else e.behavior===`deny`&&e.interrupt&&(w(`SDK permission prompt deny+interrupt: tool=${t.name} message=${e.message}`),r.abortController.abort());return{...e,decisionReason:i}}Me(),Pe(),Te(),re(),Le(),ye(),be(),se();var _r=/\u2028|\u2029/g;function vr(e){return e.replace(_r,e=>e===`\u2028`?`\\u2028`:`\\u2029`)}function yr(e){return vr(T(e))}C(),S(),h(),b();var br=`SandboxNetworkAccess`;function xr(e){if(e){if(e.type===`classifier`)return e.reason;switch(e.type){case`rule`:case`mode`:case`subcommandResults`:case`permissionPromptTool`:return;case`hook`:case`asyncAgent`:case`sandboxOverride`:case`workingDir`:case`safetyCheck`:case`other`:return e.reason}}}function Sr(e,t,n,r){let i;try{i=e.getActivityDescription?.(t)??e.getToolUseSummary?.(t)??e.userFacingName(t)}catch{i=e.name}return{tool_name:e.name,action_description:i,tool_use_id:n,request_id:r,input:t}}var Cr=1e3,wr=class{constructor(e,n){t(this,`input`,void 0),t(this,`replayUserMessages`,void 0),t(this,`structuredInput`,void 0),t(this,`pendingRequests`,new Map),t(this,`restoredWorkerState`,Promise.resolve(null)),t(this,`inputClosed`,!1),t(this,`unexpectedResponseCallback`,void 0),t(this,`resolvedToolUseIds`,new Set),t(this,`prependedLines`,[]),t(this,`onControlRequestSent`,void 0),t(this,`onControlRequestResolved`,void 0),t(this,`outbound`,new _e),this.input=e,this.replayUserMessages=n,this.input=e,this.structuredInput=this.read()}trackResolvedToolUseId(e){let t=e.request;if(t.subtype===`can_use_tool`&&(this.resolvedToolUseIds.add(t.tool_use_id),this.resolvedToolUseIds.size>Cr)){let e=this.resolvedToolUseIds.values().next().value;e!==void 0&&this.resolvedToolUseIds.delete(e)}}flushInternalEvents(){return Promise.resolve()}get internalEventsPending(){return 0}prependUserMessage(e){this.prependedLines.push(T({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})+`
2
- `)}async*read(){let e=``,t=async function*(){for(;;){this.prependedLines.length>0&&(e=this.prependedLines.join(``)+e,this.prependedLines=[]);let t=e.indexOf(`
3
- `);if(t===-1)break;let n=e.slice(0,t);e=e.slice(t+1);let r=await this.processLine(n);r&&(Oe(`info`,`cli_stdin_message_parsed`,{type:r.type}),yield r)}}.bind(this);yield*t();for await(let n of this.input)e+=n,yield*t();if(e){let t=await this.processLine(e);t&&(yield t)}this.inputClosed=!0;for(let e of this.pendingRequests.values())e.reject(Error(`Tool permission stream closed before response received`))}getPendingPermissionRequests(){return Array.from(this.pendingRequests.values()).map(e=>e.request).filter(e=>e.request.subtype===`can_use_tool`)}setUnexpectedResponseCallback(e){this.unexpectedResponseCallback=e}injectControlResponse(e){let t=e.response,n=t?.request_id;if(!n)return;let r=this.pendingRequests.get(n);if(r)if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n),this.write({type:`control_cancel_request`,request_id:n}),t.subtype===`error`)r.reject(Error(t.error));else{let e=t.response;if(r.schema)try{r.resolve(r.schema.parse(e))}catch(e){r.reject(e)}else r.resolve({})}}setOnControlRequestSent(e){this.onControlRequestSent=e}setOnControlRequestResolved(e){this.onControlRequestResolved=e}async processLine(e){if(e)try{let t=ze(xe(e));if(t.type===`keep_alive`)return;if(t.type===`update_environment_variables`){let e=t.variables??{},n=Object.keys(e);for(let[t,n]of Object.entries(e))process.env[t]=n;w(`[structuredIO] applied update_environment_variables: ${n.join(`, `)}`);return}if(t.type===`control_response`){let e=`uuid`in t&&typeof t.uuid==`string`?t.uuid:void 0;e&&ve(e,`completed`);let n=t.response,r=this.pendingRequests.get(n.request_id);if(!r){let e=(n.subtype===`success`?n.response:void 0)?.toolUseID;if(typeof e==`string`&&this.resolvedToolUseIds.has(e)){w(`Ignoring duplicate control_response for already-resolved toolUseID=${e} request_id=${n.request_id}`);return}this.unexpectedResponseCallback&&await this.unexpectedResponseCallback(t);return}if(this.trackResolvedToolUseId(r.request),this.pendingRequests.delete(n.request_id),r.request.request.subtype===`can_use_tool`&&this.onControlRequestResolved&&this.onControlRequestResolved(n.request_id),n.subtype===`error`){r.reject(Error(n.error??`Unknown error`));return}let i=n.response;if(r.schema)try{r.resolve(r.schema.parse(i))}catch(e){r.reject(e)}else r.resolve({});return this.replayUserMessages?t:void 0}if(t.type!==`user`&&t.type!==`control_request`&&t.type!==`assistant`&&t.type!==`system`){w(`Ignoring unknown message type: ${t.type}`,{level:`warn`});return}return t.type===`control_request`?(t.request||Tr(`Error: Missing request on control_request`),t):(t.type===`assistant`||t.type===`system`||t.message?.role!==`user`&&Tr(`Error: Expected message role 'user', got '${t.message?.role}'`),t)}catch(t){console.error(`Error parsing streaming input line: ${e}: ${t}`),process.exit(1)}}async write(e){De(yr(e)+`
4
- `)}async sendRequest(e,t,n,r=O()){let i={type:`control_request`,request_id:r,request:e};if(this.inputClosed)throw Error(`Stream closed`);if(n?.aborted)throw Error(`Request aborted`);this.outbound.enqueue(i),e.subtype===`can_use_tool`&&this.onControlRequestSent&&this.onControlRequestSent(i);let a=()=>{this.outbound.enqueue({type:`control_cancel_request`,request_id:r});let e=this.pendingRequests.get(r);e&&(this.trackResolvedToolUseId(e.request),e.reject(new Se))};n&&n.addEventListener(`abort`,a,{once:!0});try{return await new Promise((n,i)=>{this.pendingRequests.set(r,{request:{type:`control_request`,request_id:r,request:e},resolve:e=>{n(e)},reject:i,schema:t})})}finally{n&&n.removeEventListener(`abort`,a),this.pendingRequests.delete(r)}}createCanUseTool(e){return async(t,n,r,i,a,o)=>{let s=o??await he(t,n,r,i,a);if(s.behavior===`allow`||s.behavior===`deny`)return s;let c=new AbortController,l=r.abortController.signal,u=()=>c.abort();l.addEventListener(`abort`,u,{once:!0});try{let i=Er(t.name,a,n,r,s.suggestions).then(e=>({source:`hook`,decision:e})),o=O();e?.(Sr(t,n,a,o));let l=this.sendRequest({subtype:`can_use_tool`,tool_name:t.name,input:n,permission_suggestions:s.suggestions,blocked_path:s.blockedPath,decision_reason:xr(s.decisionReason),tool_use_id:a,agent_id:r.agentId},Q(),c.signal,o).then(e=>({source:`sdk`,result:e})),u=await Promise.race([i,l]);return u.source===`hook`?u.decision?(l.catch(()=>{}),c.abort(),u.decision):$((await l).result,t,n,r):$(u.result,t,n,r)}catch(e){return $({behavior:`deny`,message:`Tool permission request failed: ${e}`,toolUseID:a},t,n,r)}finally{this.getPendingPermissionRequests().length===0&&Re(`running`),l.removeEventListener(`abort`,u)}}}createHookCallback(e,t){return{type:`callback`,timeout:t,callback:async(t,n,r)=>{try{return await this.sendRequest({subtype:`hook_callback`,callback_id:e,input:t,tool_use_id:n||void 0},pe(),r)}catch(t){return console.error(`Error in hook callback ${e}:`,t),{}}}}}async handleElicitation(e,t,n,r,i,a,o){try{return await this.sendRequest({subtype:`elicitation`,mcp_server_name:e,message:t,mode:i,url:a,elicitation_id:o,requested_schema:n},lr(),r)}catch{return{action:`cancel`}}}createSandboxAskCallback(){return async e=>{try{return(await this.sendRequest({subtype:`can_use_tool`,tool_name:br,input:{host:e.host},tool_use_id:O(),description:`Allow network connection to ${e.host}?`},Q())).behavior===`allow`}catch{return!1}}}async sendMcpMessage(e,t){return(await this.sendRequest({subtype:`mcp_message`,server_name:e,message:t},r({mcp_response:ee()}))).mcp_response}};function Tr(e){console.error(e),process.exit(1)}async function Er(e,t,n,r,i){let a=r.getAppState().toolPermissionContext.mode,o=ce(e,t,n,r,a,i,r.abortController.signal);for await(let e of o)if(e.permissionRequestResult&&(e.permissionRequestResult.behavior===`allow`||e.permissionRequestResult.behavior===`deny`)){let t=e.permissionRequestResult;if(t.behavior===`allow`){let e=t.updatedInput||n,i=t.updatedPermissions??[];if(i.length>0){y(i);let e=x(r.getAppState().toolPermissionContext,i);r.setAppState(t=>t.toolPermissionContext===e?t:{...t,toolPermissionContext:e})}return{behavior:`allow`,updatedInput:e,userModified:!1,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}else return{behavior:`deny`,message:t.message||`Permission denied by PermissionRequest hook`,decisionReason:{type:`hook`,hookName:`PermissionRequest`}}}}fe();function Dr(e){if(e.type!==`user`)return;let t=e.message?.content;if(!t||Array.isArray(t)&&t.length===0)return;let n=`uuid`in e&&typeof e.uuid==`string`?e.uuid:void 0;return{content:Array.isArray(t)?Or(t):t,uuid:n}}function Or(e){return e.some(kr)?e.map(e=>{if(!kr(e))return e;let t=e.source,n=typeof t.mediaType==`string`&&t.mediaType?t.mediaType:ge(e.source.data);return{...e,source:{type:`base64`,media_type:n,data:e.source.data}}}):e}function kr(e){return e.type!==`image`||e.source?.type!==`base64`?!1:!e.source.media_type}Fe(),C(),E(),ke(),me();function Ar(e,t,n){let r=[],i=[],a=[];for(let[o,s]of Object.entries(e)){let e=t[o],c=Mr(s.source,n?.projectRoot);e?s.sourceIsFallback||Ie(c,e.source)?a.push(o):i.push({name:o,declaredSource:c,materializedSource:e.source}):r.push(o)}return{missing:r,sourceChanged:i,upToDate:a}}async function jr(e){let t=ue();if(Object.keys(t).length===0)return{installed:[],updated:[],failed:[],upToDate:[],skipped:[]};let n;try{n=await le()}catch(e){D(e),n={}}let r=Ar(t,n,{projectRoot:v()}),i=[...r.missing.map(e=>({name:e,source:Mr(t[e].source),action:`install`})),...r.sourceChanged.map(({name:e,declaredSource:t})=>({name:e,source:t,action:`update`}))],a=[],o=[];for(let t of i){if(e?.skip?.(t.name,t.source)){a.push(t.name);continue}if(t.action===`update`&&we(t.source)&&!await Ne(t.source.path)){w(`[reconcile] '${t.name}' declared path does not exist; keeping materialized entry`),a.push(t.name);continue}o.push(t)}if(o.length===0)return{installed:[],updated:[],failed:[],upToDate:r.upToDate,skipped:a};w(`[reconcile] ${o.length} marketplace(s): ${o.map(e=>`${e.name}(${e.action})`).join(`, `)}`);let s=[],c=[],l=[];for(let t=0;t<o.length;t++){let{name:n,source:r,action:i}=o[t];e?.onProgress?.({type:`installing`,name:n,action:i,index:t+1,total:o.length});try{let t=await oe(r);i===`install`?s.push(n):c.push(n),e?.onProgress?.({type:`installed`,name:n,alreadyMaterialized:t.alreadyMaterialized})}catch(t){let r=Ce(t);l.push({name:n,error:r}),e?.onProgress?.({type:`failed`,name:n,error:r}),D(t)}}return{installed:s,updated:c,failed:l,upToDate:r.upToDate,skipped:a}}function Mr(e,t){if((e.source===`directory`||e.source===`file`)&&!Be(e.path)){let n=t??v(),r=je(n);return{...e,path:Ve(r??n,e.path)}}return e}export{wr as a,$ as c,br as i,jr as n,yr as o,Dr as r,Q as s,Ar as t};
@@ -1 +0,0 @@
1
- import{_D as e,bD as t}from"./loadAgentsDir-BURvZNN6.js";t();export{e as SandboxManager};
@@ -1 +0,0 @@
1
- import{Yc as e,Zc as t}from"./loadAgentsDir-BURvZNN6.js";e();export{t as isSearchExtraToolsEnabled};
@@ -1 +0,0 @@
1
- import{xu as e,yu as t}from"./loadAgentsDir-BURvZNN6.js";t();export{e as registerSessionFileAccessHooks};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./memoize-BK3gG5ob.js";import{B as r,en as i}from"./state-ix0xIunV.js";import{AE as a,Al as o,Bc as s,DE as c,Dl as l,El as u,Fn as d,In as f,Jw as p,Ln as m,Lo as h,Ml as g,So as _,TE as ee,Vc as te,YT as ne,_E as v,aE as y,cl as b,dE as re,fE as ie,fl as x,gE as ae,hE as S,jE as oe,kE as se,lE as ce,lt as le,mE as C,ml as ue,pE as de,pl as w,qw as T,sE as E,sl as D,uE as O,ut as k,vE as A,wE as j,yE as M,zo as N}from"./loadAgentsDir-BURvZNN6.js";import{F as P,I as F,d as I,p as L,z as R}from"./debug-BrXObCdR.js";import{_n as z,gn as B}from"./settings-DfWP5y6X.js";import{n as V,r as H}from"./analytics-BotDBGh0.js";import{Ci as fe,Si as pe}from"./model-BIVmcl_N.js";import{fn as U,hn as me}from"./prompt-DNDgGM9q.js";import{st as he}from"./rcDebugLog-DoL1FpGJ.js";import{writeFile as W}from"fs/promises";function ge(){return!1}function _e(){return{}}function ve(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=B(e,e=>e.type===`tool_use`))}}return n}function G(e){let t=c(e);if(!de()){if(!O(t))return!1;ae()}let n=re(t),r=ve(e,X)>=ce(),i=h(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&(X=t.uuid),!0}return!1}async function K(e){let t=I(),n=d();await t.mkdir(n,{mode:448});let r=f();try{await W(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await W(r,await ue(),{encoding:`utf-8`,mode:384})}catch(e){if(F(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await s.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),H(`tengu_session_memory_file_read`,{content_length:a.length}),{memoryPath:r,currentMemory:a}}function ye(){if(r())return;let e=b();process.env.USER_TYPE===`ant`&&H(`tengu_session_memory_init`,{auto_compact_enabled:e}),e&&p($)}async function q(e,t){if(e.length===0)return{success:!1,error:`No messages to summarize`};S();try{let n=l(t),{memoryPath:r,currentMemory:i}=await K(n),o=await x(i,r),{tools:s,mainLoopModel:u}=t.options,[d,f,p]=await Promise.all([le(s,u),a(),se()]),m=he(d);return await g({promptMessages:[_({content:o})],cacheSafeParams:{systemPrompt:m,userContext:f,systemContext:p,toolUseContext:n,forkContextMessages:e},canUseTool:J(r),querySource:`session_memory`,forkLabel:`session_memory_manual`,overrides:{readFileState:n.readFileState}}),H(`tengu_session_memory_manual_extraction`,{}),v(c(e)),Y(e),{success:!0,memoryPath:r}}catch(e){return{success:!1,error:P(e)}}finally{C()}}function J(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${U} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${U} on ${e} is allowed`}}}}function Y(e){if(!h(e)){let t=e[e.length-1];t?.uuid&&A(t.uuid)}}var X,Z,Q,$,be=e((()=>{n(),i(),k(),oe(),me(),te(),z(),o(),L(),T(),N(),m(),pe(),ne(),ee(),V(),D(),w(),ie(),R(),Z=t(()=>{let e=_e();M({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:y.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:y.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:y.toolCallsBetweenUpdates})}),Q=!1,$=fe(async function(e){let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`)return;{let{isPoorModeActive:e}=await import(`./poorMode-AE4WNYZo.js`);if(e())return}if(!ge()){process.env.USER_TYPE===`ant`&&!Q&&(Q=!0,H(`tengu_session_memory_gate_disabled`,{}));return}if(Z(),!G(t))return;S();let i=l(n),{memoryPath:a,currentMemory:o}=await K(i);await g({promptMessages:[_({content:await x(o,a)})],cacheSafeParams:u(e),canUseTool:J(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],d=s?j(s):void 0,f=E();H(`tengu_session_memory_extraction`,{input_tokens:d?.input_tokens,output_tokens:d?.output_tokens,cache_read_input_tokens:d?.cache_read_input_tokens??void 0,cache_creation_input_tokens:d?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:f.minimumMessageTokensToInit,config_min_tokens_between_update:f.minimumTokensBetweenUpdate,config_tool_calls_between_updates:f.toolCallsBetweenUpdates}),v(c(t)),Y(t),C()})}));export{G as a,q as i,ye as n,be as r,J as t};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./sessionMemory-CAmpw2yb.js";t();export{e as manuallyExtractSessionMemory};
@@ -1 +0,0 @@
1
- import{cE as e,fE as t}from"./loadAgentsDir-BURvZNN6.js";t();export{e as getSessionMemoryContent};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./sessionObserver-Ur7PqKl_.js";e();export{t as heuristicObserverBackend};
@@ -1 +0,0 @@
1
- import{Rr as e,jr as t,si as n}from"./loadAgentsDir-BURvZNN6.js";t();export{e as linkSessionToPR,n as recordTranscript};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{A as t,E as n,M as r,T as i,n as a,r as o,t as s}from"./lazySchema-DcIJE_0i.js";import{en as c}from"./state-ix0xIunV.js";import{Za as l,zE as u}from"./loadAgentsDir-BURvZNN6.js";import{z as d}from"./debug-BrXObCdR.js";import{g as f}from"./settings-DfWP5y6X.js";import{g as p}from"./config-DiT2Z8dY.js";import{_ as m,j as h}from"./git-Do0wJvux.js";import{u as g}from"./oauth-BqJqV-2M.js";import{Vt as _,mi as v}from"./model-BIVmcl_N.js";import"path";import"fs/promises";var y,b=e((()=>{o(),s(),y=a(()=>n({entries:t(r(),r())})),a(()=>n({userId:r(),version:i(),lastModified:r(),checksum:r(),content:y()}))})),x=e((()=>{c(),g(),_(),u(),p(),h(),d(),m(),v(),f(),l(),b()}));export{x as t};
@@ -1,3 +0,0 @@
1
- import{l as e,o as t,s as n}from"./envUtils-DSxRz_kt.js";import{di as r,ui as i}from"./src-CDCSSo0U2.js";import{$n as a,Zn as ee,en as o,ht as s,ot as c,vr as l,z as u}from"./state-ix0xIunV.js";import{$S as d,Ci as f,Et as p,Gp as m,HC as h,PE as g,Pt as _,Qi as v,St as y,UC as b,Wp as x,bt as te,eC as S,gb as ne,jr as C,mb as w,ob as T,qi as E,sb as D,tC as O,vn as k,yn as A,yt as j,zE as M}from"./loadAgentsDir-BURvZNN6.js";import{n as N,t as P}from"./cwd-CYmmnQVS.js";import{F,z as I}from"./debug-BrXObCdR.js";import{Jt as L,Zt as R}from"./settings-DfWP5y6X.js";import{c as z,g as B,o as V}from"./config-DiT2Z8dY.js";import{M as H,_ as U,d as W,j as G,n as K,r as re}from"./git-Do0wJvux.js";import{o as q,s as J}from"./log-BMCygSzM.js";import{n as Y,r as X}from"./analytics-BotDBGh0.js";import{i as Z,n as ie}from"./startupProfiler-xa3NmN7Z.js";import{Vt as ae,in as oe}from"./model-BIVmcl_N.js";import{ft as se,ut as Q}from"./esm-B62dCLgf.js";import{l as ce,u as le}from"./terminalSetup-BNs9nLbT.js";import{c as ue,n as de}from"./releaseNotes-BKZNuDLD.js";import{s as fe,u as pe}from"./logoV2Utils-DN9nzdX-.js";import{c as $,t as me}from"./nativeInstaller-8arnRiUO.js";import{i as he,r as ge}from"./runtimeObserver-BXbjibFk.js";import{n as _e,r as ve}from"./sessionMemory-CAmpw2yb.js";import{t as ye}from"./sinks-B4_pw0Gb.js";r(),Y(),N(),ue(),x(),o(),v(),ve(),he(),b(),le(),ae(),M(),B(),G(),R(),se(),t(),I(),U(),T(),S(),A(),q(),pe(),me(),ne(),C(),ie(),p();async function be(t,r,o,p,v,b,x,S,ne){H(`info`,`setup_started`);let C=process.version.match(/^v(\d+)\./)?.[1];if((!C||parseInt(C,10)<18)&&(console.error(i.bold.red(`Error: Work Mate requires Node.js version 18 or higher.`)),process.exit(1)),x&&l(h(x)),n(),!u())try{let e=await ce();e.status===`restored`?console.log(i.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(i.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){J(e)}m(t);let T=Date.now();if(d(),H(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-T}),D(t),p){let e=k(),n=await W();!e&&!n&&(process.stderr.write(i.red(`Error: Can only use --worktree in a git repository, but ${i.bold(t)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let r=S?`pr-${S}`:v??w(),o;if(n){let e=K(P());e||(process.stderr.write(i.red(`Error: Could not determine the main git repository root.
2
- `)),process.exit(1)),e!==(re(P())??P())&&(H(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),m(e)),o=b?y(e,_(r)):void 0}else o=b?y(P(),_(r)):void 0;let c;try{c=await te(s(),r,o,S?{prNumber:S}:void 0)}catch(e){process.stderr.write(i.red(`Error creating worktree: ${F(e)}\n`)),process.exit(1)}if(X(`tengu_worktree_created`,{tmux_enabled:b}),b&&o){let e=await j(o,c.worktreePath);e.created?console.log(i.green(`Created tmux session: ${i.bold(o)}\nTo attach: ${i.bold(`tmux attach -t ${o}`)}`)):console.error(i.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(c.worktreePath),m(c.worktreePath),ee(P()),a(P()),f(c),g(),O()}H(`info`,`setup_background_jobs_starting`),n()||(_e(),ge()),$(),H(`info`,`setup_background_jobs_launched`),Z(`setup_before_prefetch`),H(`info`,`setup_prefetch_starting`);let A=u()&&e(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)||n();if(A||E(c()),import(`./loadPluginHooks-C9A9oS-w.js`).then(e=>{A||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),n()||(process.env.USER_TYPE===`ant`&&import(`./commitAttribution-DIT_s0vY.js`).then(async e=>{if(await e.isInternalModelRepo()){let{clearSystemPromptSections:e}=await import(`./systemPromptSections-CR_AoPIX.js`);e()}}),setImmediate(()=>{import(`./attributionHooks-CUAoGkU6.js`).then(({registerAttributionHooks:e})=>{e()})}),import(`./sessionFileAccessHooks-BZvxeufx.js`).then(e=>e.registerSessionFileAccessHooks())),ye(),X(`tengu_started`,{}),oe(u()),Z(`setup_after_prefetch`),!n()){let{hasReleaseNotes:e}=await de(z().lastReleaseNotesSeen);e&&await fe()}if(r===`bypassPermissions`||o){if(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!e(process.env.CLAUDE_CODE_BUBBLEWRAP))if(process.stdin.isTTY){console.error(i.bold.red(`WARNING: Running as root/sudo with bypass permissions mode is dangerous.`)),console.error(i.yellow(`Bypass mode skips ALL permission checks. Combined with root, any command (rm -rf /, chmod, dd) executes without review.`));let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout}),t=await new Promise(t=>{e.question(`
3
- I understand the risks. Continue? [y/N] `,t)});e.close(),t.trim().toLowerCase()!==`y`&&(console.error(`Aborted.`),process.exit(1))}else console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1);if(process.env.USER_TYPE===`ant`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`claude-desktop`){let[e,t]=await Promise.all([Q.getIsDocker(),L.hasInternetAccess()]),n=Q.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}}let M=V();M.lastCost!==void 0&&M.lastDuration!==void 0&&X(`tengu_exit`,{last_session_cost:M.lastCost,last_session_api_duration:M.lastAPIDuration,last_session_tool_duration:M.lastToolDuration,last_session_duration:M.lastDuration,last_session_lines_added:M.lastLinesAdded,last_session_lines_removed:M.lastLinesRemoved,last_session_total_input_tokens:M.lastTotalInputTokens,last_session_total_output_tokens:M.lastTotalOutputTokens,last_session_total_cache_creation_input_tokens:M.lastTotalCacheCreationInputTokens,last_session_total_cache_read_input_tokens:M.lastTotalCacheReadInputTokens,last_session_fps_average:M.lastFpsAverage,last_session_fps_low_1_pct:M.lastFpsLow1Pct,last_session_id:M.lastSessionId,...M.lastSessionMetrics})}export{be as setup};
@@ -1 +0,0 @@
1
- import{t as e}from"./sinks-B4_pw0Gb.js";export{e as initSinks};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Sr as t,Un as n,Wn as r,X as i,Zn as a,en as o,h as s,ht as c,vr as ee,xr as l}from"./state-ix0xIunV.js";import{Ac as te,Bi as ne,CC as re,Ci as u,Cp as ie,Ct as d,DD as ae,Db as oe,Dp as se,ED as f,Ep as ce,Et as le,Gp as p,HC as ue,Il as de,It as fe,Jn as pe,MC as me,Mt as m,NC as he,PE as h,Qi as ge,SC as _e,Tp as g,UC as ve,Vi as ye,Vl as be,Wp as _,bi as v,fi as y,gb as b,gn as x,hb as S,jr as C,kb as w,kc as T,nd as E,op as D,pi as O,rd as k,sp as A,ti as j,yn as M,zE as N}from"./loadAgentsDir-BURvZNN6.js";import{n as xe,t as P}from"./cwd-CYmmnQVS.js";import{a as F,d as Se,l as I,nt as Ce,p as we,rt as Te}from"./debug-BrXObCdR.js";import{n as Ee,r as L}from"./analytics-BotDBGh0.js";import{C as De,_ as Oe}from"./model-BIVmcl_N.js";import{Nt as ke}from"./prompt-DNDgGM9q.js";import{f as Ae,l as je,t as Me}from"./commitAttribution-CLbEIaRJ.js";import{n as R,r as Ne}from"./systemPromptSections-DN0HGVye.js";import{r as Pe}from"./asciicast-CbAjUHT_.js";import*as z from"path";import{dirname as Fe}from"path";o(),Ne(),D(),ke(),ve(),N(),je(),de(),xe(),F(),w(),Oe(),b(),_(),C(),me(),re(),le();function Ie(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.type!==`assistant`)continue;let r=n.message.content.find(e=>e.type===`tool_use`&&e.name===`TodoWrite`);if(!r||r.type!==`tool_use`)continue;let i=r.input;if(typeof i!=`object`||!i)return[];let a=_e().safeParse(i.todos);return a.success?a.data:[]}return[]}function Le(e,t){if(e.fileHistorySnapshots&&e.fileHistorySnapshots.length>0&&oe(e.fileHistorySnapshots,e=>{t(t=>({...t,fileHistory:e}))}),e.attributionSnapshots&&e.attributionSnapshots.length>0&&Me(e.attributionSnapshots,e=>{t(t=>({...t,attribution:e}))}),!he()&&e.messages&&e.messages.length>0){let n=Ie(e.messages);if(n.length>0){let e=c();t(t=>({...t,todos:{...t.todos,[e]:n}}))}}}function Re(e){if(e.attributionSnapshots&&e.attributionSnapshots.length>0)return Ae(e.attributionSnapshots)}function B(e,t){if(!(!e&&!t))return{name:e??``,color:t==="default"?void 0:t}}function V(e,t,a){if(t)return{agentDefinition:t,agentType:void 0};if(!e)return r(void 0),{agentDefinition:void 0,agentType:void 0};let o=a.activeAgents.find(t=>t.agentType===e);return o?(r(o.agentType),!i()&&o.model&&o.model!==`inherit`&&n(De(o.model)),{agentDefinition:o,agentType:o.agentType}):(I(`Resumed session had agent "${e}" but it is no longer available. Using default behavior.`),r(void 0),{agentDefinition:void 0,agentType:void 0})}function H(e){let t=d();if(t){u(t);return}if(e){try{process.chdir(e.worktreePath)}catch{u(null);return}p(e.worktreePath),a(P()),m(e),h(),R(),S.cache.clear?.()}}function ze(){let e=d();if(e){m(null),h(),R(),S.cache.clear?.();try{process.chdir(e.originalCwd)}catch{return}p(e.originalCwd),a(P())}}async function Be(t,n,r){if(n.forkSession)t.contentReplacements?.length&&await j(t.contentReplacements);else{let e=n.sessionIdOverride??t.sessionId;e&&(ee(ue(e),n.transcriptPath?Fe(n.transcriptPath):null),await Pe(),await y(),A(e))}if(O(n.forkSession?{...t,worktreeSession:void 0}:t),t.goal){let{hydrateGoalFromTranscript:r}=(k(),e(E)),i=new Map,a=n.sessionIdOverride??t.sessionId??c();i.set(a,t.goal),r(i,a)}n.forkSession||(H(t.worktreeSession),pe());let{agentDefinition:i,agentType:a}=V(t.agentSetting,r.mainThreadAgentDefinition,r.agentDefinitions);v(`normal`);let o=n.includeAttribution?Re(t):void 0,s=B(t.agentName,t.agentColor);be(t.agentName);let l=r.agentDefinitions;return{messages:t.messages,fileHistorySnapshots:t.fileHistorySnapshots,contentReplacements:t.contentReplacements,agentName:t.agentName,agentColor:t.agentColor==="default"?void 0:t.agentColor,restoredAgentDef:i,initialState:{...r.initialState,...a&&{agent:a},...o&&{attribution:o},...s&&{standaloneAgentContext:s},agentDefinitions:l}}}ae(),o(),ge(),Ee(),ce(),T(),Ce(),F(),we(),M(),t();var Ve=1e3,He=500,Ue=300,We=2e3,Ge=typeof Bun<`u`,U=null,W=null,G=new Set,K=!1,q=!1,J=!1,Y=null,X=l(),Z=null;async function Ke(){if(K||q)return;K=!0,J||(J=!0,se(()=>{ne(),X.emit()}));let e=await Je();e.length!==0&&(I(`Watching for changes in skill/command directories: ${e.join(`, `)}...`),U=f.watch(e,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:Z?.stabilityThreshold??Ve,pollInterval:Z?.pollInterval??He},ignored:(e,t)=>t&&!t.isFile()&&!t.isDirectory()?!0:e.split(z.sep).some(e=>e===`.git`),ignorePermissionErrors:!0,usePolling:Ge,interval:Z?.chokidarInterval??We,atomic:!0}),U.on(`add`,$),U.on(`change`,$),U.on(`unlink`,$),Y=Te(async()=>{await Q()}))}function Q(){q=!0,Y&&(Y(),Y=null);let e=Promise.resolve();return U&&(e=U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),e}var qe=X.subscribe;async function Je(){let e=Se(),t=[],n=g(`userSettings`,`skills`);if(n)try{await e.stat(n),t.push(n)}catch{}let r=g(`userSettings`,`commands`);if(r)try{await e.stat(r),t.push(r)}catch{}let i=g(`projectSettings`,`skills`);if(i)try{let n=z.resolve(i);await e.stat(n),t.push(n)}catch{}let a=g(`projectSettings`,`commands`);if(a)try{let n=z.resolve(a);await e.stat(n),t.push(n)}catch{}for(let n of s()){let r=z.join(n,`.claude`,`skills`);try{await e.stat(r),t.push(r)}catch{}}return t}function $(e){I(`Detected skill change: ${e}`),L(`tengu_skill_file_changed`,{source:`chokidar`}),Ye(e)}function Ye(e){G.add(e),W&&clearTimeout(W),W=setTimeout(async()=>{W=null;let e=[...G];if(G.clear(),x(await fe(`skills`,e[0]))){I(`ConfigChange hook blocked skill reload (${e.length} paths)`);return}ie(),ye(),te(),X.emit()},Z?.reloadDebounce??Ue)}async function Xe(e){U&&(await U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),K=!1,q=!1,Z=e??null}var Ze={initialize:Ke,dispose:Q,subscribe:qe,resetForTesting:Xe};export{V as a,Be as i,B as n,Le as o,ze as r,H as s,Ze as t};
@@ -1 +0,0 @@
1
- import"./featureCheck-HslM03dr.js";import"./instinctParser-Dt-lqnDe.js";import"./skillGenerator-DaNb-yKH.js";import{p as e}from"./runtimeObserver-BXbjibFk.js";import{o as t}from"./observationStore-DzCdXq8U.js";import{s as n}from"./projectContext-D9MDwJUF.js";import"./sessionObserver-Ur7PqKl_.js";import"./toolEventObserver-C98uraqD.js";import"./skillGapStore-z3LP64O-.js";import{t as r}from"./skillLearning-rMX1bSBa.js";r();export{e as loadInstincts,t as readObservations,n as resolveProjectContext};
@@ -1 +0,0 @@
1
- import{Ay as e,Fy as t,Ny as n,Ry as r,jy as i}from"./loadAgentsDir-BURvZNN6.js";i();export{e as checkOutTeleportedSessionBranch,n as processMessagesForTeleportResume,t as teleportResumeCodeSession,r as validateGitState};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{I as n,P as r,Rn as i,fi as a,t as o,y as s}from"./src-CDCSSo0U2.js";import{t as c}from"./jsx-runtime-Bb4Xn-E0.js";import{$D as l,As as u,Es as d,Fs as f,Gs as p,Hs as m,Is as ee,Lb as h,Vs as g,ZD as _,_x as v,fs as y,lc as b,ps as x,uc as S,vx as te,zb as C}from"./loadAgentsDir-BURvZNN6.js";import{V as w,W as T,a as E,l as D,z as ne}from"./debug-BrXObCdR.js";import{c as re,o as ie,r as ae,t as oe}from"./execFileNoThrow-D244NytW.js";import{o as se,s as O}from"./log-BMCygSzM.js";import{i as ce,o as k}from"./platform-BrYefG_2.js";import{_ as A,f as j}from"./file-DcZWPH2V.js";import{n as M,r as N}from"./pluginStartupCheck-RscVZDi4.js";import{a as P,s as F}from"./pluginOperations-JEedVzfS.js";import{join as I}from"path";import{readFile as L}from"fs/promises";function R(){return process.env.USER_TYPE===`ant`?q:_}function z(){return process.env.USER_TYPE===`ant`?J:Y}function B(){return`thinkback@${R()}`}async function V(){let{enabled:e}=await x(),t=e.find(e=>e.name===`thinkback`||e.source&&e.source.includes(B()));if(!t)return null;let n=I(t.path,`skills`,X);return await A(n)?n:null}async function H(e){let t=I(e,`year_in_review.js`),n=I(e,`player.js`);try{await L(t)}catch(e){return w(e)?{success:!1,message:`No animation found. Run /think-back first to generate one.`}:(O(e),{success:!1,message:`Could not access animation data: ${T(e).message}`})}try{await L(n)}catch(e){return w(e)?{success:!1,message:`Player script not found. The player.js file is missing from the thinkback skill.`}:(O(e),{success:!1,message:`Could not access player script: ${T(e).message}`})}let r=i.get(process.stdout);if(!r)return{success:!1,message:`Failed to access terminal instance`};r.enterAlternateScreen();try{await ie(`node`,[n],{stdio:`inherit`,cwd:e,reject:!1})}catch{}finally{r.exitAlternateScreen()}let a=I(e,`year_in_review.html`);if(await A(a)){let e=ce();oe(e===`macos`?`open`:e===`windows`?`start`:`xdg-open`,[a])}return{success:!0,message:`Year in review animation complete!`}}function U({onReady:e,onError:t}){let[i,a]=(0,G.useState)({phase:`checking`}),[o,s]=(0,G.useState)(``);if((0,G.useEffect)(()=>{async function n(){try{let t=await m(),n=R(),r=z(),i=B(),o=n in t,c=u(i);if(o?c||(a({phase:`installing-marketplace`}),s(`Updating marketplace…`),D(`Refreshing marketplace ${n}`),await p(n,e=>{s(e)}),ee(),b(),D(`Marketplace ${n} refreshed`)):(a({phase:`installing-marketplace`}),D(`Installing marketplace ${r}`),await f({source:`github`,repo:r},e=>{s(e)}),b(),D(`Marketplace ${n} installed`)),c){let{disabled:e}=await x();if(e.some(e=>e.name===`thinkback`||e.source?.includes(i))){a({phase:`enabling-plugin`}),D(`Enabling plugin ${i}`);let e=await P(i);if(!e.success)throw Error(`Failed to enable plugin: ${e.message}`);b(),D(`Plugin ${i} enabled`)}}else{a({phase:`installing-plugin`}),D(`Installing plugin ${i}`);let e=await N([i]);if(e.failed.length>0){let t=e.failed.map(e=>`${e.name}: ${e.error}`).join(`, `);throw Error(`Failed to install plugin: ${t}`)}b(),D(`Plugin ${i} installed`)}a({phase:`ready`}),e()}catch(e){let n=T(e);O(n),a({phase:`error`,message:n.message}),t(n.message)}}n()},[e,t]),i.phase===`error`)return(0,K.jsx)(n,{flexDirection:`column`,children:(0,K.jsxs)(r,{color:`error`,children:[`Error: `,i.message]})});if(i.phase===`ready`)return null;let c=i.phase===`checking`?`Checking thinkback installation…`:i.phase===`installing-marketplace`?`Installing marketplace…`:i.phase===`enabling-plugin`?`Enabling thinkback plugin…`:`Installing thinkback plugin…`;return(0,K.jsx)(n,{flexDirection:`column`,children:(0,K.jsxs)(n,{children:[(0,K.jsx)(h,{}),(0,K.jsx)(r,{children:o||c})]})})}function W({onDone:e,onAction:t,skillDir:i,hasGenerated:a}){let[o,c]=(0,G.useState)(!1),l=a?[{label:`Play animation`,value:`play`,description:`Watch your year in review`},{label:`Edit content`,value:`edit`,description:`Modify the animation`},{label:`Fix errors`,value:`fix`,description:`Fix validation or rendering issues`},{label:`Regenerate`,value:`regenerate`,description:`Create a new animation from scratch`}]:[{label:`Let's go!`,value:`regenerate`,description:`Generate your personalized animation`}];function u(n){c(!0),n===`play`?H(i).then(()=>{e(void 0,{display:`skip`})}):t(n)}function d(){e(void 0,{display:`skip`})}return o?null:(0,K.jsx)(s,{title:`Think Back on 2025 with Work Mate`,subtitle:`Generate your 2025 Work Mate Think Back (takes a few minutes to run)`,onCancel:d,color:`claude`,children:(0,K.jsxs)(n,{flexDirection:`column`,gap:1,children:[!a&&(0,K.jsxs)(n,{flexDirection:`column`,children:[(0,K.jsx)(r,{children:`Relive your year of coding with Claude.`}),(0,K.jsx)(r,{dimColor:!0,children:`We'll create a personalized ASCII animation celebrating your journey.`})]}),(0,K.jsx)(v,{options:l,onChange:u,visibleOptionCount:5})]})})}function le({onDone:e}){let[t,i]=(0,G.useState)(!1),[a,o]=(0,G.useState)(null),[s,c]=(0,G.useState)(null),[l,u]=(0,G.useState)(null);function d(){i(!0)}let f=(0,G.useCallback)(t=>{o(t),e(`Error with thinkback: ${t}. Try running /plugin to manually install the think-back plugin.`,{display:`system`})},[e]);(0,G.useEffect)(()=>{t&&!s&&!a&&V().then(e=>{e?(D(`Thinkback skill directory: ${e}`),c(e)):f(`Could not find thinkback skill directory`)})},[t,s,a,f]),(0,G.useEffect)(()=>{if(!s)return;let e=I(s,`year_in_review.js`);A(e).then(t=>{D(`Checking for ${e}: ${t?`found`:`not found`}`),u(t)})},[s]);function p(t){e({edit:Z,fix:Q,regenerate:$}[t],{display:`user`,shouldQuery:!0})}return a?(0,K.jsxs)(n,{flexDirection:`column`,children:[(0,K.jsxs)(r,{color:`error`,children:[`Error: `,a]}),(0,K.jsx)(r,{dimColor:!0,children:`Try running /plugin to manually install the think-back plugin.`})]}):t?!s||l===null?(0,K.jsxs)(n,{children:[(0,K.jsx)(h,{}),(0,K.jsx)(r,{children:`Loading thinkback skill…`})]}):(0,K.jsx)(W,{onDone:e,onAction:p,skillDir:s,hasGenerated:l}):(0,K.jsx)(U,{onReady:d,onError:f})}async function ue(e){return(0,K.jsx)(le,{onDone:e})}var G,K,q,J,Y,X,Z,Q,$,de=e((()=>{re(),a(),G=t(a(),1),te(),o(),C(),F(),E(),ne(),ae(),j(),se(),k(),S(),d(),g(),l(),y(),M(),K=c(),q=`claude-code-marketplace`,J=`anthropics/claude-code-marketplace`,Y=`anthropics/claude-plugins-official`,X=`thinkback`,Z=`Use the Skill tool to invoke the "thinkback" skill with mode=edit to modify my existing Work Mate year in review animation. Ask me what I want to change. When the animation is ready, tell the user to run /think-back again to play it.`,Q=`Use the Skill tool to invoke the "thinkback" skill with mode=fix to fix validation or rendering errors in my existing Work Mate year in review animation. Run the validator, identify errors, and fix them. When the animation is ready, tell the user to run /think-back again to play it.`,$=`Use the Skill tool to invoke the "thinkback" skill with mode=regenerate to create a completely new Work Mate year in review animation from scratch. Delete the existing animation and start fresh. When the animation is ready, tell the user to run /think-back again to play it.`}));export{de as n,H as r,ue as t};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./thinkback-gV-sKkMM.js";e();export{n as call,t as playAnimation};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{MD as t,M_ as n,N_ as r,jD as i}from"./loadAgentsDir-BURvZNN6.js";import{n as a,t as o}from"./partition-CW0BJ881.js";function s(e,n,i){let[o,s]=a(t([...e,...n],`name`),r),c=(e,t)=>e.name.localeCompare(t.name);return[...s.sort(c),...o.sort(c)]}var c=e((()=>{o(),i(),n()}));export{s as n,c as t};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./trustedDevice-BBKUhCCL.js";export{t as clearTrustedDeviceToken,e as enrollTrustedDevice};
@@ -1 +0,0 @@
1
- import{a as e,t}from"./types-Czs-_G1S.js";e();export{t as BRIDGE_LOGIN_ERROR};
@@ -1,3 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";var t,n,r,i,a=e((()=>{t=1440*60*1e3,n="Remote Control is only available with claude.ai subscriptions. Please use `/login` to sign in with your claude.ai account.",r=`Error: You must be logged in to use Remote Control.
2
-
3
- Remote Control is only available with claude.ai subscriptions. Please use \`/login\` to sign in with your claude.ai account.`,i=`Remote Control disconnected.`}));export{a,i,n,t as r,r as t};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./undercover-BTIRVF1t.js";t();export{e as shouldShowUndercoverAutoNotice};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./upgrade-yNl7EO4e.js";e();export{t as call};
@@ -1 +0,0 @@
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{Ix as r,Lx as i}from"./loadAgentsDir-BURvZNN6.js";import{o as a,s as o}from"./log-BMCygSzM.js";import{Kt as s,Qr as c,Vt as l,Zr as u,kt as d}from"./model-BIVmcl_N.js";import{n as f,t as p}from"./browser-BmZuQom6.js";async function m(e,t){try{if(s()){let t=d(),n=!1;if(t?.subscriptionType&&t?.rateLimitTier)n=t.subscriptionType===`max`&&t.rateLimitTier===`default_claude_max_20x`;else if(t?.accessToken){let e=await u(t.accessToken);n=e?.organization?.organization_type===`claude_max`&&e?.organization?.rate_limit_tier===`default_claude_max_20x`}if(n)return setTimeout(e,0,`You are already on the highest Max subscription plan. For additional usage, run /login to switch to an API usage-billed account.`),null}return await f(`https://claude.ai/upgrade/max`),(0,h.jsx)(r,{onDone:()=>{t.onChangeAPIKey(),e(`Login successful`)}})}catch(t){o(t),setTimeout(e,0,`Failed to open browser. Please visit https://claude.ai/upgrade/max to upgrade.`)}return null}var h,g=e((()=>{t(),c(),l(),p(),a(),i(),h=n()}));export{g as n,m as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{l as r,u as i}from"./oauth-BqJqV-2M.js";import{Bt as a,Kt as o,Ur as s,Vt as c,Wr as l,er as u,ir as d,kt as f,lr as p,ur as m}from"./model-BIVmcl_N.js";async function h(){if(!o()||!a())return{};let e=f();if(e&&l(e.expiresAt))return null;let n=u();if(n.error)throw Error(`Auth error: ${n.error}`);let i={"Content-Type":`application/json`,"User-Agent":p(),...n.headers},s=`${r().BASE_API_URL}/api/oauth/usage`;return(await t.get(s,{headers:i,timeout:5e3})).data}var g=e((()=>{n(),i(),c(),d(),m(),s()}));export{g as n,h as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{t}from"./jsx-runtime-Bb4Xn-E0.js";import{n,t as r}from"./Settings-CNsaWv8g.js";var i,a;e((()=>{n(),i=t(),a=async(e,t)=>(0,i.jsx)(r,{onClose:e,context:t,defaultTab:`Usage`})}))();export{a as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{JS as t,qS as n}from"./loadAgentsDir-BURvZNN6.js";import{C as r,_ as i,s as a}from"./model-BIVmcl_N.js";function o(){let e=t(e=>e.mainLoopModel);return r(t(e=>e.mainLoopModelForSession)??e??a())}var s=e((()=>{n(),i()}));export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-CDCSSo0U2.js";import{Cc as n,GS as r,JS as i,Sc as a,Sm as o,Tc as s,WS as c,XS as l,_m as u,fs as d,nb as f,nv as p,ps as m,qS as h,rb as g,rv as _,wc as v,xm as y,ym as b}from"./loadAgentsDir-BURvZNN6.js";import{W as x,a as S,l as C,z as w}from"./debug-BrXObCdR.js";import{_n as T,gn as E}from"./settings-DfWP5y6X.js";import{M as D,j as O}from"./git-Do0wJvux.js";import{o as k,s as A}from"./log-BMCygSzM.js";import{n as j,r as M}from"./analytics-BotDBGh0.js";import{n as N,r as P}from"./pluginFlagging-mHNff1t9.js";import{t as F}from"./pluginBlocklist-mogKaK0p.js";var I=e(t(),1);c(),j(),u(),h(),T(),S(),O(),w(),k(),v(),n(),f(),y(),p(),P(),d();function L({enabled:e=!0}={}){let t=l(),n=i(e=>e.plugins.needsRefresh),{addNotification:c}=r(),u=(0,I.useCallback)(async()=>{try{let{enabled:e,disabled:n,errors:r}=await m();await F();let i=N();Object.keys(i).length>0&&c({key:`plugin-delisted-flagged`,text:`Plugins flagged. Check /plugins`,color:`warning`,priority:`high`});let l=[],u=[];try{l=await a()}catch(e){let t=e instanceof Error?e.message:String(e);r.push({type:`generic-error`,source:`plugin-commands`,error:`Failed to load plugin commands: ${t}`})}try{u=await s()}catch(e){let t=e instanceof Error?e.message:String(e);r.push({type:`generic-error`,source:`plugin-agents`,error:`Failed to load plugin agents: ${t}`})}try{await g()}catch(e){let t=e instanceof Error?e.message:String(e);r.push({type:`generic-error`,source:`plugin-hooks`,error:`Failed to load plugin hooks: ${t}`})}let d=(await Promise.all(e.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await _(e,r);return t&&(e.mcpServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0),f=(await Promise.all(e.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await o(e,r);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0);b(),t(t=>{let i=t.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),a=new Set(r.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),o=[...i.filter(e=>{let t=e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`;return!a.has(t)}),...r];return{...t,plugins:{...t.plugins,enabled:e,disabled:n,commands:l,errors:o}}}),C(`Loaded plugins - Enabled: ${e.length}, Disabled: ${n.length}, Commands: ${l.length}, Agents: ${u.length}, Errors: ${r.length}`);let p=e.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return{enabled_count:e.length,disabled_count:n.length,inline_count:E(e,e=>e.source.endsWith(`@inline`)),marketplace_count:E(e,e=>!e.source.endsWith(`@inline`)),error_count:r.length,skill_count:l.length,agent_count:u.length,hook_count:p,mcp_count:d,lsp_count:f,ant_enabled_names:process.env.USER_TYPE===`ant`&&e.length>0?e.map(e=>e.name).sort().join(`,`):void 0}}catch(e){let n=x(e);return A(n),C(`Error loading plugins: ${e}`),t(e=>{let t=e.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r={type:`generic-error`,source:`plugin-system`,error:n.message};return{...e,plugins:{...e.plugins,enabled:[],disabled:[],commands:[],errors:[...t,r]}}}),{enabled_count:0,disabled_count:0,inline_count:0,marketplace_count:0,error_count:1,skill_count:0,agent_count:0,hook_count:0,mcp_count:0,lsp_count:0,load_failed:!0,ant_enabled_names:void 0}}},[t,c]);(0,I.useEffect)(()=>{e&&u().then(e=>{let{ant_enabled_names:t,...n}=e,r={...n,has_custom_plugin_cache_dir:!!process.env.CLAUDE_CODE_PLUGIN_CACHE_DIR};M(`tengu_plugins_loaded`,{...r,...t!==void 0&&{enabled_names:t}}),D(`info`,`tengu_plugins_loaded`,r)})},[u,e]),(0,I.useEffect)(()=>{!e||!n||c({key:`plugin-reload-pending`,text:`Plugins changed. Run /reload-plugins to activate.`,color:`suggestion`,priority:`low`})},[e,n,c])}export{L as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as n}from"./src-CDCSSo0U2.js";import{B as r,en as i}from"./state-ix0xIunV.js";import{GS as a,WS as o,aC as s,oC as c}from"./loadAgentsDir-BURvZNN6.js";import{n as l,t as u}from"./allErrors-CHVdQ3fT.js";function d(){let{addNotification:e,removeNotification:t}=a(),[n,i]=(0,f.useState)(()=>{let{errors:e}=u();return e});return c((0,f.useCallback)(()=>{let{errors:e}=u();i(e)},[])),(0,f.useEffect)(()=>{if(!r())if(n.length>0){let t=`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`;e({key:p,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(p)},[n,e,t]),n}var f,p,m=e((()=>{f=t(n(),1),o(),i(),l(),s(),p=`settings-errors`}));export{d as n,m as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{h as r,r as i}from"./lazySchema-DcIJE_0i.js";import{JD as a,SO as o,XD as s,YD as c,hD as l,mD as u,vO as ee,xO as d,yO as f}from"./loadAgentsDir-BURvZNN6.js";import{C as p,F as m,I as h,S as g,V as _,a as te,d as v,l as y,p as b,w as x,z as S}from"./debug-BrXObCdR.js";import{St as C,_t as w,bt as T,xt as ne,yt as re}from"./settings-DfWP5y6X.js";import{o as ie,s as E}from"./log-BMCygSzM.js";import{homedir as ae}from"os";import*as D from"path";import{join as oe,resolve as se}from"path";import{randomBytes as O}from"crypto";import{readFile as k,readdir as A,rename as j,stat as M,unlink as N,writeFile as P}from"fs/promises";function F(){return oe(u(),H)}async function I(){let e=F();try{let t=p(await k(e,{encoding:`utf-8`}));if(typeof t!=`object`||!t||!(`version`in t)||!(`fetchedAt`in t)||!(`counts`in t))return y(`Install counts cache has invalid structure`),null;let n=t;if(n.version!==V)return y(`Install counts cache version mismatch (got ${n.version}, expected ${V})`),null;if(typeof n.fetchedAt!=`string`||!Array.isArray(n.counts))return y(`Install counts cache has invalid structure`),null;let r=new Date(n.fetchedAt).getTime();return Number.isNaN(r)?(y(`Install counts cache has invalid fetchedAt timestamp`),null):n.counts.every(e=>typeof e==`object`&&!!e&&typeof e.plugin==`string`&&typeof e.unique_installs==`number`)?Date.now()-r>W?(y(`Install counts cache is stale (>24h old)`),null):{version:n.version,fetchedAt:n.fetchedAt,counts:n.counts}:(y(`Install counts cache has malformed entries`),null)}catch(e){return h(e)!==`ENOENT`&&y(`Failed to load install counts cache: ${m(e)}`),null}}async function L(e){let t=F(),n=`${t}.${O(8).toString(`hex`)}.tmp`;try{let r=u();await v().mkdir(r),await P(n,x(e,null,2),{encoding:`utf-8`,mode:384}),await j(n,t),y(`Install counts cache saved successfully`)}catch(e){E(e);try{await N(n)}catch{}}}async function R(){y(`Fetching install counts from ${U}`);let e=performance.now();try{let n=await t.get(U,{timeout:1e4});if(!n.data?.plugins||!Array.isArray(n.data.plugins))throw Error(`Invalid response format from install counts API`);return s(`install_counts`,U,`success`,performance.now()-e),n.data.plugins}catch(t){throw s(`install_counts`,U,`failure`,performance.now()-e,a(t)),t}}async function z(){let e=await I();if(e){y(`Using cached install counts`),s(`install_counts`,U,`cache_hit`,0);let t=new Map;for(let n of e.counts)t.set(n.plugin,n.unique_installs);return t}try{let e=await R();await L({version:V,fetchedAt:new Date().toISOString(),counts:e});let t=new Map;for(let n of e)t.set(n.plugin,n.unique_installs);return t}catch(e){return E(e),y(`Failed to fetch install counts: ${m(e)}`),null}}function B(e){if(e<1e3)return String(e);if(e<1e6){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}K`:`${t}K`}let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}var V,H,U,W,G=e((()=>{n(),te(),S(),b(),ie(),g(),c(),l(),V=1,H=`install-counts-cache.json`,U=`https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json`,W=1440*60*1e3}));async function K(e){let t=e.trim(),n=v(),r=t.match(/^([a-zA-Z0-9._-]+@[^:]+:.+?(?:\.git)?)(#(.+))?$/);if(r?.[1]){let e=r[1],t=r[3];return t?{source:`git`,url:e,ref:t}:{source:`git`,url:e}}if(t.startsWith(`http://`)||t.startsWith(`https://`)){let e=t.match(/^([^#]+)(#(.+))?$/),n=e?.[1]||t,r=e?.[3];if(n.endsWith(`.git`)||n.includes(`/_git/`))return r?{source:`git`,url:n,ref:r}:{source:`git`,url:n};let i;try{i=new URL(n)}catch{return{source:`url`,url:n}}if((i.hostname===`github.com`||i.hostname===`www.github.com`)&&i.pathname.match(/^\/([^/]+\/[^/]+?)(\/|\.git|$)/)?.[1]){let e=n.endsWith(`.git`)?n:`${n}.git`;return r?{source:`git`,url:e,ref:r}:{source:`git`,url:e}}return{source:`url`,url:n}}let i=process.platform===`win32`&&(t.startsWith(`.\\`)||t.startsWith(`..\\`)||/^[a-zA-Z]:[/\\]/.test(t));if(t.startsWith(`./`)||t.startsWith(`../`)||t.startsWith(`/`)||t.startsWith(`~`)||i){let e=se(t.startsWith(`~`)?t.replace(/^~/,ae()):t),r;try{r=await n.stat(e)}catch(t){let n=h(t);return{error:n===`ENOENT`?`Path does not exist: ${e}`:`Cannot access path: ${e} (${n??t})`}}return r.isFile()?e.endsWith(`.json`)?{source:`file`,path:e}:{error:`File path must point to a .json file (marketplace.json), but got: ${e}`}:r.isDirectory()?{source:`directory`,path:e}:{error:`Path is neither a file nor a directory: ${e}`}}if(t.includes(`/`)&&!t.startsWith(`@`)){if(t.includes(`:`))return null;let e=t.match(/^([^#@]+)(?:[#@](.+))?$/),n=e?.[1]||t,r=e?.[2];return r?{source:`github`,repo:n,ref:r}:{source:`github`,repo:n}}return null}var ce=e((()=>{S(),b()}));function le(e){let t=D.basename(e),n=D.basename(D.dirname(e));return t===`plugin.json`?`plugin`:t===`marketplace.json`?`marketplace`:n===`.claude-plugin`?`plugin`:`unknown`}function q(e){return e.issues.map(e=>({path:e.path.join(`.`)||`root`,message:e.message,code:e.code}))}function J(e,t,n,r){e.includes(`..`)&&n.push({path:t,message:r?`Path contains "..": ${e}. ${r}`:`Path contains ".." which could be a path traversal attempt: ${e}`})}function ue(e){let t=e.replace(/^(\.\.\/)+/,``);return`Plugin source paths are resolved relative to the marketplace root (the directory containing .claude-plugin/), not relative to marketplace.json. Use "${t===e?`./plugins/my-plugin`:`./${t}`}" instead of "${e}".`}async function Y(e){let t=[],n=[],r=D.resolve(e),i;try{i=await k(r,{encoding:`utf-8`})}catch(e){let t=h(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${m(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`plugin`}}let a;try{a=p(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${m(e)}`}],warnings:[],filePath:r,fileType:`plugin`}}if(a&&typeof a==`object`){let e=a;e.commands&&(Array.isArray(e.commands)?e.commands:[e.commands]).forEach((e,n)=>{typeof e==`string`&&J(e,`commands[${n}]`,t)}),e.agents&&(Array.isArray(e.agents)?e.agents:[e.agents]).forEach((e,n)=>{typeof e==`string`&&J(e,`agents[${n}]`,t)}),e.skills&&(Array.isArray(e.skills)?e.skills:[e.skills]).forEach((e,n)=>{typeof e==`string`&&J(e,`skills[${n}]`,t)})}let o=a;if(typeof a==`object`&&a){let e=a,t=Object.keys(e).filter(e=>$.has(e));if(t.length>0){let r={...e};for(let e of t)delete r[e],n.push({path:e,message:`Field '${e}' belongs in the marketplace entry (marketplace.json), not plugin.json. It's harmless here but unused — Work Mate ignores it at load time.`});o=r}}let s=re().strict().safeParse(o);if(s.success||t.push(...q(s.error)),s.success){let e=s.data;/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e.name)||n.push({path:`name`,message:`Plugin name "${e.name}" is not kebab-case. Work Mate accepts it, but the Claude.ai marketplace sync requires kebab-case (lowercase letters, digits, and hyphens only, e.g., "my-plugin").`}),e.version||n.push({path:`version`,message:`No version specified. Consider adding a version following semver (e.g., "1.0.0")`}),e.description||n.push({path:`description`,message:`No description provided. Adding a description helps users understand what your plugin does`}),e.author||n.push({path:`author`,message:`No author information provided. Consider adding author details for plugin attribution`})}return{success:t.length===0,errors:t,warnings:n,filePath:r,fileType:`plugin`}}async function X(e){let t=[],n=[],i=D.resolve(e),a;try{a=await k(i,{encoding:`utf-8`})}catch(e){let t=h(e),n;return n=t===`ENOENT`?`File not found: ${i}`:t===`EISDIR`?`Path is not a file: ${i}`:`Failed to read file: ${m(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:i,fileType:`marketplace`}}let o;try{o=p(a)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${m(e)}`}],warnings:[],filePath:i,fileType:`marketplace`}}if(o&&typeof o==`object`){let e=o;Array.isArray(e.plugins)&&e.plugins.forEach((e,n)=>{if(e&&typeof e==`object`&&`source`in e){let r=e.source;typeof r==`string`&&J(r,`plugins[${n}].source`,t,ue(r)),r&&typeof r==`object`&&`path`in r&&typeof r.path==`string`&&J(r.path,`plugins[${n}].source.path`,t)}})}let s=ne().extend({plugins:r(T().strict())}).strict().safeParse(o);if(s.success||t.push(...q(s.error)),s.success){let e=s.data;if((!e.plugins||e.plugins.length===0)&&n.push({path:`plugins`,message:`Marketplace has no plugins defined`}),e.plugins){e.plugins.forEach((n,r)=>{e.plugins.filter(e=>e.name===n.name).length>1&&t.push({path:`plugins[${r}].name`,message:`Duplicate plugin name "${n.name}" found in marketplace`})});let r=D.dirname(i),a=D.basename(r)===`.claude-plugin`?D.dirname(r):r;for(let[t,r]of e.plugins.entries()){if(!r.version||typeof r.source!=`string`||!r.source.startsWith(`./`))continue;let e=D.join(a,r.source,`.claude-plugin`,`plugin.json`),i;try{let t=p(await k(e,{encoding:`utf-8`}));typeof t.version==`string`&&(i=t.version)}catch{continue}i&&i!==r.version&&n.push({path:`plugins[${t}].version`,message:`Entry declares version "${r.version}" but ${r.source}/.claude-plugin/plugin.json says "${i}". At install time, plugin.json wins (calculatePluginVersion precedence) — the entry version is silently ignored. Update this entry to "${i}" to match.`})}}e.metadata?.description||n.push({path:`metadata.description`,message:`No marketplace description provided. Adding a description helps users understand what this marketplace offers`})}return{success:t.length===0,errors:t,warnings:n,filePath:i,fileType:`marketplace`}}function de(e,t,n){let r=[],i=[],a=t.match(ee);if(!a)return i.push({path:`frontmatter`,message:`No frontmatter block found. Add YAML frontmatter between --- delimiters at the top of the file to set description and other metadata.`}),{success:!0,errors:r,warnings:i,filePath:e,fileType:n};let s=a[1]||``,c;try{c=o(s)}catch(t){return r.push({path:`frontmatter`,message:`YAML frontmatter failed to parse: ${m(t)}. At runtime this ${n} loads with empty metadata (all frontmatter fields silently dropped).`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n}}if(typeof c!=`object`||!c||Array.isArray(c))return r.push({path:`frontmatter`,message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(c)?`an array`:c===null?`null`:typeof c}.`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n};let l=c;if(l.description!==void 0){let e=l.description;typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`&&e!==null&&r.push({path:`description`,message:`description must be a string, got ${Array.isArray(e)?`array`:typeof e}. At runtime this value is dropped.`})}else i.push({path:`description`,message:`No description in frontmatter. A description helps users and Claude understand when to use this ${n}.`});l.name!==void 0&&l.name!==null&&typeof l.name!=`string`&&r.push({path:`name`,message:`name must be a string, got ${typeof l.name}.`});let u=l[`allowed-tools`];u!=null&&(typeof u!=`string`&&!Array.isArray(u)?r.push({path:`allowed-tools`,message:`allowed-tools must be a string or array of strings, got ${typeof u}.`}):Array.isArray(u)&&u.some(e=>typeof e!=`string`)&&r.push({path:`allowed-tools`,message:`allowed-tools array must contain only strings.`}));let d=l.shell;if(d!=null)if(typeof d!=`string`)r.push({path:`shell`,message:`shell must be a string, got ${typeof d}.`});else{let e=d.trim().toLowerCase();e!==`bash`&&e!==`powershell`&&r.push({path:`shell`,message:`shell must be 'bash' or 'powershell', got '${d}'.`})}return{success:r.length===0,errors:r,warnings:i,filePath:e,fileType:n}}async function Z(e){let t;try{t=await k(e,{encoding:`utf-8`})}catch(t){return h(t)===`ENOENT`?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:[{path:`file`,message:`Failed to read file: ${m(t)}`}],warnings:[],filePath:e,fileType:`hooks`}}let n;try{n=p(t)}catch(t){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${m(t)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:e,fileType:`hooks`}}let r=w().safeParse(n);return r.success?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:q(r.error),warnings:[],filePath:e,fileType:`hooks`}}async function Q(e,t){let n;try{n=await A(e,{withFileTypes:!0})}catch(e){let t=h(e);if(t===`ENOENT`||t===`ENOTDIR`)return[];throw e}if(t)return n.filter(e=>e.isDirectory()).map(t=>D.join(e,t.name,`SKILL.md`));let r=[];for(let t of n){let n=D.join(e,t.name);t.isDirectory()?r.push(...await Q(n,!1)):t.isFile()&&t.name.toLowerCase().endsWith(`.md`)&&r.push(n)}return r}async function fe(e){let t=[],n=[[`skill`,D.join(e,`skills`)],[`agent`,D.join(e,`agents`)],[`command`,D.join(e,`commands`)]];for(let[e,r]of n){let n=await Q(r,e===`skill`);for(let r of n){let n;try{n=await k(r,{encoding:`utf-8`})}catch(n){if(_(n))continue;t.push({success:!1,errors:[{path:`file`,message:`Failed to read: ${m(n)}`}],warnings:[],filePath:r,fileType:e});continue}let i=de(r,n,e);(i.errors.length>0||i.warnings.length>0)&&t.push(i)}}let r=await Z(D.join(e,`hooks`,`hooks.json`));return(r.errors.length>0||r.warnings.length>0)&&t.push(r),t}async function pe(e){let t=D.resolve(e),n=null;try{n=await M(t)}catch(e){if(!_(e))throw e}if(n?.isDirectory()){let e=await X(D.join(t,`.claude-plugin`,`marketplace.json`));if(e.errors[0]?.code!==`ENOENT`)return e;let n=await Y(D.join(t,`.claude-plugin`,`plugin.json`));return n.errors[0]?.code===`ENOENT`?{success:!1,errors:[{path:`directory`,message:`No manifest found in directory. Expected .claude-plugin/marketplace.json or .claude-plugin/plugin.json`}],warnings:[],filePath:t,fileType:`plugin`}:n}switch(le(e)){case`plugin`:return Y(e);case`marketplace`:return X(e);case`unknown`:try{let n=p(await k(t,{encoding:`utf-8`}));if(Array.isArray(n.plugins))return X(e)}catch(e){if(h(e)===`ENOENT`)return{success:!1,errors:[{path:`file`,message:`File not found: ${t}`}],warnings:[],filePath:t,fileType:`plugin`}}return Y(e)}}var $,me=e((()=>{i(),S(),f(),g(),d(),C(),$=new Set([`category`,`source`,`tags`,`strict`,`id`])}));export{K as a,G as c,ce as i,pe as n,B as o,fe as r,z as s,me as t};
@@ -1 +0,0 @@
1
- import{Et as e,xt as t}from"./loadAgentsDir-BURvZNN6.js";e();export{t as execIntoTmuxWorktree};