claude-code-best 2.6.6 → 2.6.9

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 (435) hide show
  1. package/README.md +3 -5
  2. package/dist/chunks/{AddWorkspaceDirectory-Bb6crGWh.js → AddWorkspaceDirectory-_RSNUS7K.js} +1 -1
  3. package/dist/chunks/{App-CW0Y4ceR.js → App-4VqMMjIu.js} +1 -1
  4. package/dist/chunks/{ApproveApiKey-9rkwQfgT.js → ApproveApiKey-B7oSxzWc.js} +1 -1
  5. package/dist/chunks/ApproveApiKey-Bmcop2Do.js +1 -0
  6. package/dist/chunks/{AssistantSessionChooser-XzXZZdiH.js → AssistantSessionChooser-Lf5l_1Dh.js} +1 -1
  7. package/dist/chunks/BackgroundTasksDialog-Ckgmqm6u.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-DlLWAKw2.js → BypassPermissionsModeDialog-DNqPpiPC.js} +1 -1
  9. package/dist/chunks/{ClaudeInChromeOnboarding-CjGydpBk.js → ClaudeInChromeOnboarding-BODZ64gw.js} +1 -1
  10. package/dist/chunks/{ClaudeMdExternalIncludesDialog-B04cjDwX.js → ClaudeMdExternalIncludesDialog-DLI6ey3G.js} +1 -1
  11. package/dist/chunks/ClaudeMdExternalIncludesDialog-DO61Zz-S.js +1 -0
  12. package/dist/chunks/ConsoleOAuthFlow-FSHC5mxO.js +1 -0
  13. package/dist/chunks/{DesktopHandoff-CFBUqcCf.js → DesktopHandoff--xyI5kTQ.js} +1 -1
  14. package/dist/chunks/{DevChannelsDialog-ByTf41du.js → DevChannelsDialog-DJ4mHsA_.js} +1 -1
  15. package/dist/chunks/{DiffDialog-CY-8kw_Q.js → DiffDialog-CVWUlOjm.js} +2 -2
  16. package/dist/chunks/Doctor-DVoFX-9y.js +3 -0
  17. package/dist/chunks/Doctor-Dcntgp5Z.js +1 -0
  18. package/dist/chunks/{ExitFlow-BlON8IgH.js → ExitFlow-BKzQPr75.js} +2 -2
  19. package/dist/chunks/{Feedback-CSeD3k4M.js → Feedback-hFZwDSRp.js} +2 -2
  20. package/dist/chunks/Grove-Cmcsx2UE.js +1 -0
  21. package/dist/chunks/{Grove-Tp_UtIMg.js → Grove-G0DtwY22.js} +1 -1
  22. package/dist/chunks/{HybridTransport-CAko699F.js → HybridTransport-xN03sWrt.js} +1 -1
  23. package/dist/chunks/{ITermBackend-5P3WJumD.js → ITermBackend-DzN3ZWds.js} +1 -1
  24. package/dist/chunks/{InvalidConfigDialog-CVcdra9v.js → InvalidConfigDialog-Iy4Su1Lm.js} +1 -1
  25. package/dist/chunks/{InvalidSettingsDialog-CfLdbmSI.js → InvalidSettingsDialog-dx4y_nY-.js} +1 -1
  26. package/dist/chunks/{MCPConnectionManager-BK_3uwQj.js → MCPConnectionManager-kVO-4BcA.js} +1 -1
  27. package/dist/chunks/{McpParsingWarnings-BOj-T8F3.js → McpParsingWarnings-D420-W8M.js} +1 -1
  28. package/dist/chunks/MessageSelector-CDVC2CAj.js +3 -0
  29. package/dist/chunks/Messages-C5gVVVmY.js +11 -0
  30. package/dist/chunks/{Onboarding-C06Mxlf-.js → Onboarding-BkidUre_.js} +1 -1
  31. package/dist/chunks/{OverageCreditUpsell-abcPm3PB.js → OverageCreditUpsell-DoRUucoN.js} +1 -1
  32. package/dist/chunks/PluginSettings-DhpNtjTm.js +17 -0
  33. package/dist/chunks/{PromptInputFooterSuggestions-ihnbjU0K.js → PromptInputFooterSuggestions-BnpXzkW9.js} +1 -1
  34. package/dist/chunks/{PromptInputHelpMenu-CMm8z7Gk.js → PromptInputHelpMenu-DKbiO4C0.js} +1 -1
  35. package/dist/chunks/QueryEngine-J15EOjWx.js +1 -0
  36. package/dist/chunks/REPL-Dk3Ics9i.js +1 -0
  37. package/dist/chunks/{REPL-CBFcgD4r.js → REPL-nrJ13J1o.js} +34 -34
  38. package/dist/chunks/{RemoteCallout-Cy6lH-CZ.js → RemoteCallout-DGXIcTKv.js} +1 -1
  39. package/dist/chunks/{RemoteSessionManager-C7iGd5Og.js → RemoteSessionManager-3KsuTCZM.js} +2 -2
  40. package/dist/chunks/ResumeConversation-kS7lkjJm.js +1 -0
  41. package/dist/chunks/{SSETransport-B5xlXeAN.js → SSETransport-Cy1rXP6E.js} +1 -1
  42. package/dist/chunks/SearchExtraToolsTool-C998WSxs.js +1 -0
  43. package/dist/chunks/SentryErrorBoundary-BJLT-ebr.js +1 -0
  44. package/dist/chunks/{SentryErrorBoundary-iih9eFpM.js → SentryErrorBoundary-B_6MfzRa.js} +1 -1
  45. package/dist/chunks/Settings-DBopjMkN.js +2 -0
  46. package/dist/chunks/{TeleportProgress-BX-uLwuL.js → TeleportProgress-CQUN_zoe.js} +1 -1
  47. package/dist/chunks/{TeleportRepoMismatchDialog-D8oPPTWd.js → TeleportRepoMismatchDialog-CPquWrd-.js} +1 -1
  48. package/dist/chunks/{TeleportResumeWrapper-B_CvNDbr.js → TeleportResumeWrapper-NIFNCHIO.js} +1 -1
  49. package/dist/chunks/{ThemePicker-BG1ykSpX.js → ThemePicker-DnK0DStD.js} +1 -1
  50. package/dist/chunks/{TmuxBackend-CnMCWNS4.js → TmuxBackend-C00k5RF9.js} +1 -1
  51. package/dist/chunks/{TrustDialog-Z_maAYj8.js → TrustDialog-CUnvtDeS.js} +1 -1
  52. package/dist/chunks/{ValidationErrorsList-C9swVkZ-.js → ValidationErrorsList-CJbO1qub.js} +1 -1
  53. package/dist/chunks/{WelcomeV2-Au_5ddlT.js → WelcomeV2-BBFGft_e.js} +1 -1
  54. package/dist/chunks/{WindowsTerminalBackend-CGxaYH74.js → WindowsTerminalBackend-DSsgxuNK.js} +1 -1
  55. package/dist/chunks/{add-dir-Cm9u56YX.js → add-dir-BPqd010H.js} +1 -1
  56. package/dist/chunks/{agentDisplay-Bi_bEyEn.js → agentDisplay-C0B1b_90.js} +1 -1
  57. package/dist/chunks/{agents-CbjR7hNr.js → agents-CYs7WGHP.js} +1 -1
  58. package/dist/chunks/{agents-CMF9fLzV.js → agents-DMzVeRly.js} +7 -7
  59. package/dist/chunks/{ant-Bu1Gs4WJ.js → ant-BO0Hmoii.js} +1 -1
  60. package/dist/chunks/api-B2HW-oZI.js +1 -0
  61. package/dist/chunks/{api-D_t0nHsS.js → api-DLLVkmRJ.js} +1 -1
  62. package/dist/chunks/asciicast-C3nf97NR.js +1 -0
  63. package/dist/chunks/{asciicast-o5Zg4dJt.js → asciicast-DIsaWcsJ.js} +1 -1
  64. package/dist/chunks/assistant-BmM44yln.js +1 -0
  65. package/dist/chunks/{assistant-C_pfWe2a.js → assistant-CHp4-EaF.js} +1 -1
  66. package/dist/chunks/{assistant-EA-MHNQ-.js → assistant-_dIpsqHM.js} +1 -1
  67. package/dist/chunks/{auth-D7PZvVPf.js → auth-DelyQc8g.js} +1 -1
  68. package/dist/chunks/auth-ndSNSeqS.js +1 -0
  69. package/dist/chunks/{autoMode-B8iO05xy.js → autoMode-D3-o7xPK.js} +1 -1
  70. package/dist/chunks/{autonomy-CaLvE5N6.js → autonomy-CzSRoxjl.js} +12 -12
  71. package/dist/chunks/{autonomy-dQVtSiCJ.js → autonomy-tTAucjip.js} +1 -1
  72. package/dist/chunks/{autonomyPanel-DSswVlCF.js → autonomyPanel-DcK8N52K.js} +1 -1
  73. package/dist/chunks/backgroundHousekeeping-Bbkz61_-.js +17 -0
  74. package/dist/chunks/backgroundHousekeeping-DVo3ndZr.js +1 -0
  75. package/dist/chunks/{branch-C7pM8Sjh.js → branch-ZJF4xAh9.js} +1 -1
  76. package/dist/chunks/{bridge-CTYdzSWg.js → bridge-C6gSt_32.js} +2 -2
  77. package/dist/chunks/{bridgeConfig-Df6uyp3q.js → bridgeConfig-DXUNQp2l.js} +1 -1
  78. package/dist/chunks/bridgeConfig-ZcbBdhji.js +1 -0
  79. package/dist/chunks/bridgeEnabled-D5qCI5v2.js +1 -0
  80. package/dist/chunks/{bridgeEnabled-A-_xJ94c.js → bridgeEnabled-G6vxQV-7.js} +1 -1
  81. package/dist/chunks/bridgeMain-B4Zv8UOe.js +1 -0
  82. package/dist/chunks/bridgeMain-DlnIQOtX.js +68 -0
  83. package/dist/chunks/{bridgeMessaging-DPVLAIzl.js → bridgeMessaging-mek-AaFi.js} +1 -1
  84. package/dist/chunks/{bridgePointer-FvAMj3re.js → bridgePointer-B2FPGDWR.js} +1 -1
  85. package/dist/chunks/{btw-CqgjLlFN.js → btw-Cz2lyle-.js} +1 -1
  86. package/dist/chunks/{buddy-DCGBAqF2.js → buddy-BMqKttFw.js} +1 -1
  87. package/dist/chunks/{bypassPermissionsKillswitch-CK0jeZTW.js → bypassPermissionsKillswitch-BxvX48jr.js} +1 -1
  88. package/dist/chunks/caches-D_W3nCFE.js +1 -0
  89. package/dist/chunks/{caches-CdVW8fYV.js → caches-wtRUk5y5.js} +2 -2
  90. package/dist/chunks/{ccrClient-B_3AmY7K.js → ccrClient-BOrmrmgF.js} +1 -1
  91. package/dist/chunks/changeDetector-CUsHUdul.js +1 -0
  92. package/dist/chunks/channelNotification-CLVU5AuO.js +1 -0
  93. package/dist/chunks/{channelNotification-BbDQdLZC.js → channelNotification-D8do6HUN.js} +1 -1
  94. package/dist/chunks/{chrome-CGyqsCkL.js → chrome-JF2BXNK6.js} +1 -1
  95. package/dist/chunks/clear-BP-G1JWa.js +1 -0
  96. package/dist/chunks/client-BHfY6SC5.js +1 -0
  97. package/dist/chunks/color-oh8CGhkI.js +1 -0
  98. package/dist/chunks/commands-E0eNJ_XZ.js +1 -0
  99. package/dist/chunks/commitAttribution-B4DOgUS7.js +1 -0
  100. package/dist/chunks/{commitAttribution-e0kkanVT.js → commitAttribution-CUdm_sRl.js} +1 -1
  101. package/dist/chunks/{compact-Dh9RewNA.js → compact-R6vMbGQQ.js} +3 -3
  102. package/dist/chunks/{companion-DVFacTUw.js → companion-ClxqTyG9.js} +1 -1
  103. package/dist/chunks/{config-DwiVCSrY.js → config-BQ-MayP6.js} +1 -1
  104. package/dist/chunks/{config-CkSmYDJY.js → config-CPK9PlWS.js} +1 -1
  105. package/dist/chunks/{context-B8VDDHTv.js → context-CWfsKYEB.js} +1 -1
  106. package/dist/chunks/{context-noninteractive-IZfWniex.js → context-noninteractive-BJ4hE3MX.js} +2 -2
  107. package/dist/chunks/context-noninteractive-D1Kxn5e0.js +1 -0
  108. package/dist/chunks/conversation-C23rDJe3.js +1 -0
  109. package/dist/chunks/conversation-DizpkPtq.js +1 -0
  110. package/dist/chunks/{copy-CIjrYoFa.js → copy-BuPCS2HG.js} +2 -2
  111. package/dist/chunks/{createSSHSession-ArNlbIZB.js → createSSHSession-Di9Je4Th.js} +1 -1
  112. package/dist/chunks/createSession-Bsa0VJKS.js +1 -0
  113. package/dist/chunks/{createSession-CBheIT_G.js → createSession-D6v0lBtG.js} +1 -1
  114. package/dist/chunks/{cronJitterConfig-DcMGWOa-.js → cronJitterConfig-By18m-PD.js} +3 -3
  115. package/dist/chunks/{crossProjectResume-Z-aR2q-d.js → crossProjectResume-C4YT2T6P.js} +3 -3
  116. package/dist/chunks/{datadog-BK8eJz8B.js → datadog-BFSdlK6C.js} +1 -1
  117. package/dist/chunks/datadog-MUvg76p3.js +1 -0
  118. package/dist/chunks/{desktop-B9vWJeRu.js → desktop-Bd-JHrBo.js} +1 -1
  119. package/dist/chunks/{diff-BTV7_Dca.js → diff-DGmINgOc.js} +1 -1
  120. package/dist/chunks/{directoryCompletion-DP_4B1GL.js → directoryCompletion-D7EGwonO.js} +1 -1
  121. package/dist/chunks/{doctor-Dpbh0aRz.js → doctor-DQ42RQPx.js} +1 -1
  122. package/dist/chunks/{effort-Czlwa5qF.js → effort-E6XjzPYR.js} +2 -2
  123. package/dist/chunks/entry-Di8oWZUk.js +14 -0
  124. package/dist/chunks/{envLessBridgeConfig-BAFYaZ0E.js → envLessBridgeConfig-BNvozi46.js} +1 -1
  125. package/dist/chunks/envLessBridgeConfig-CUTBQKDY.js +1 -0
  126. package/dist/chunks/{exit-DzOm62Dn.js → exit-CVlpMwCq.js} +1 -1
  127. package/dist/chunks/{export-DHOR3z3Z.js → export-CXcPQd0T.js} +1 -1
  128. package/dist/chunks/{exportRenderer-CiNXeNr9.js → exportRenderer-B9WXgMV2.js} +1 -1
  129. package/dist/chunks/{extra-usage-DIYR_3ZR.js → extra-usage-B2KmuAZe.js} +1 -1
  130. package/dist/chunks/extra-usage-DVtAa1zD.js +1 -0
  131. package/dist/chunks/{extra-usage-core-C3uM9bOP.js → extra-usage-core-B20tawuN.js} +1 -1
  132. package/dist/chunks/{extra-usage-noninteractive-Ctz9TfY8.js → extra-usage-noninteractive-DZRe98BZ.js} +1 -1
  133. package/dist/chunks/{extraUsage-CBwIvl73.js → extraUsage-CxqJdnGC.js} +1 -1
  134. package/dist/chunks/extractMemories-8uB606Y0.js +1 -0
  135. package/dist/chunks/{fast-BpBwjbSD.js → fast-CPmJ2bp3.js} +1 -1
  136. package/dist/chunks/fast-DTGg3pRh.js +1 -0
  137. package/dist/chunks/{feedback-BkVnsZVx.js → feedback-4GY3ahvw.js} +1 -1
  138. package/dist/chunks/{firstPartyEventLogger-BCzGkdpd.js → firstPartyEventLogger-CISUrAsf.js} +1 -1
  139. package/dist/chunks/{flushGate-CQsnMw8g.js → flushGate-Dr8sMjB7.js} +1 -1
  140. package/dist/chunks/gates-BbF5S-Dy.js +1 -0
  141. package/dist/chunks/{gates-CxWIWtmd.js → gates-DI4pxvrD.js} +1 -1
  142. package/dist/chunks/{gemini-BbV8D2SS.js → gemini-Dcfosr2Z.js} +1 -1
  143. package/dist/chunks/{generateRecap-B3j2nUgh.js → generateRecap-CH_fgtxk.js} +1 -1
  144. package/dist/chunks/{generateSessionName-aGnXSNgN.js → generateSessionName-DO0R__8w.js} +1 -1
  145. package/dist/chunks/{githubRepoPathMapping-DCJLSTLl.js → githubRepoPathMapping-D5I8CVDz.js} +1 -1
  146. package/dist/chunks/grok-X0FzcE6Y.js +1 -0
  147. package/dist/chunks/{growthbook-prtWhMRg.js → growthbook-DZPT2JzB.js} +1 -1
  148. package/dist/chunks/{heapdump-Czm-2XiG.js → heapdump-Cq6i0wJH.js} +1 -1
  149. package/dist/chunks/{help-CSAFsN0-.js → help-B8ddA-Ec.js} +1 -1
  150. package/dist/chunks/{hooks-DkbOP-bI.js → hooks-CvFNccdv.js} +2 -2
  151. package/dist/chunks/hooks-gwB4Eotj.js +1 -0
  152. package/dist/chunks/{hostAdapter-BcdDPVTj.js → hostAdapter-D3s4JFk-.js} +1 -1
  153. package/dist/chunks/{ide-BXERRFZF.js → ide-CzxV5_D7.js} +2 -2
  154. package/dist/chunks/{inboundAttachments-7rXrAtkb.js → inboundAttachments-B3ZTyNKF.js} +1 -1
  155. package/dist/chunks/inboundAttachments-DxrrrqBW.js +1 -0
  156. package/dist/chunks/initReplBridge-DWpGy3aE.js +1 -0
  157. package/dist/chunks/{insights-DrvqJgF8.js → insights-DiWlKgVQ.js} +5 -5
  158. package/dist/chunks/{install-BGnxwO00.js → install-BFpg1zm1.js} +1 -1
  159. package/dist/chunks/{install-github-app-CIpBHlr9.js → install-github-app-BUCGGSw0.js} +2 -2
  160. package/dist/chunks/{install-slack-app-By4Lh7ww.js → install-slack-app-D5JDqzbs.js} +1 -1
  161. package/dist/chunks/{instrumentation-D9y7Ph_R.js → instrumentation--BToLJT9.js} +3 -3
  162. package/dist/chunks/{job-BPVIMW_P.js → job-mUyxSEc2.js} +1 -1
  163. package/dist/chunks/{keybindings-Ce6AHMLI.js → keybindings-D4DbE4G0.js} +2 -2
  164. package/dist/chunks/{lang-DfDG_fSa.js → lang-cMcnaxAR.js} +1 -1
  165. package/dist/chunks/language-DC6bsdvI.js +1 -0
  166. package/dist/chunks/{language-yGoDFP3X.js → language-sTn9sA3E.js} +1 -1
  167. package/dist/chunks/{launchAgentsPlatform-DT01xZM7.js → launchAgentsPlatform-CAfyCAsQ.js} +1 -1
  168. package/dist/chunks/{launchAutofixPr-DrYd7WVf.js → launchAutofixPr-CSMamZS6.js} +3 -3
  169. package/dist/chunks/{launchLocalMemory-Bt3tMYVJ.js → launchLocalMemory-nYAwNsNT.js} +2 -2
  170. package/dist/chunks/{launchLocalVault-jyRHEa_Y.js → launchLocalVault-yPp8S-tG.js} +3 -3
  171. package/dist/chunks/{launchMemoryStores-cmXnLAF5.js → launchMemoryStores-Dk3SXucB.js} +1 -1
  172. package/dist/chunks/{launchOnboarding-BPTNFftb.js → launchOnboarding-BoqmHyRx.js} +1 -1
  173. package/dist/chunks/{launchSchedule-141GqGC8.js → launchSchedule-C2HBjD6C.js} +1 -1
  174. package/dist/chunks/{launchSkillStore-Bz0lok_o.js → launchSkillStore-B5Yjvi-k.js} +1 -1
  175. package/dist/chunks/{launchTeleport-BMquJxIq.js → launchTeleport-BayvAnwh.js} +3 -3
  176. package/dist/chunks/{launchVault-Bsuwqad6.js → launchVault-BszsgPbZ.js} +1 -1
  177. package/dist/chunks/loadAgentsDir-6_9ZFegv.js +1 -0
  178. package/dist/chunks/{loadAgentsDir-D7kapZB5.js → loadAgentsDir-Cl2w3uvH.js} +810 -791
  179. package/dist/chunks/loadPluginHooks-YHtjByxm.js +1 -0
  180. package/dist/chunks/{localSearch-r1_G8kfV.js → localSearch-CpeqVibs.js} +1 -1
  181. package/dist/chunks/localSearch-DbEm6f3k.js +1 -0
  182. package/dist/chunks/login-D2x89UCR.js +1 -0
  183. package/dist/chunks/{login-7MvpaOkt.js → login-TVtq34WQ.js} +1 -1
  184. package/dist/chunks/{logoV2Utils-DjThKW15.js → logoV2Utils-DwaRnvOY.js} +1 -1
  185. package/dist/chunks/logout-BBPihkXp.js +1 -0
  186. package/dist/chunks/{magicDocs-Dy72LHIj.js → magicDocs-_yNWB88A.js} +2 -2
  187. package/dist/chunks/{main-CF6Im-LV.js → main-gTbhsbIs.js} +48 -48
  188. package/dist/chunks/{mappers-CkMESMy7.js → mappers-COd8OOml.js} +1 -1
  189. package/dist/chunks/mcp-CChzTC5v.js +6 -0
  190. package/dist/chunks/{mcp-BTgHgOhR.js → mcp-D-0wE0nJ.js} +2 -2
  191. package/dist/chunks/mcp-DoraEndj.js +1 -0
  192. package/dist/chunks/{mcpServer-BueM5fWI.js → mcpServer-CpBN77YB.js} +1 -1
  193. package/dist/chunks/{mcpServer-Dqm2PQQx.js → mcpServer-Wd9rZG_E.js} +1 -1
  194. package/dist/chunks/{memory-BNZmqma1.js → memory-I21QZZ9h.js} +1 -1
  195. package/dist/chunks/{model-DOw7wIKQ.js → model-BrHh21Db.js} +1 -1
  196. package/dist/chunks/model-C6_WjCy0.js +1 -0
  197. package/dist/chunks/{onChangeAppState-Cb9_yIuW.js → onChangeAppState-Cn_HSmmQ.js} +1 -1
  198. package/dist/chunks/openai-BD2V4lHN.js +10 -0
  199. package/dist/chunks/openaiShared-Bjrci9n8.js +1 -0
  200. package/dist/chunks/{overageCreditGrant-BrN7dk3d.js → overageCreditGrant-B47t5a73.js} +1 -1
  201. package/dist/chunks/{passes-vgcY8_l8.js → passes-DAOPYX0C.js} +1 -1
  202. package/dist/chunks/{path-C4kbwvSH.js → path-B3lx7yHn.js} +1 -1
  203. package/dist/chunks/{paths-1ngPRtu3.js → paths-q1-Ni8Oh.js} +7 -7
  204. package/dist/chunks/permissions-BmxTU-Pk.js +3 -0
  205. package/dist/chunks/{pipeTransport-KU8psPDI.js → pipeTransport-DnHE3axn.js} +1 -1
  206. package/dist/chunks/{plan-5NVPuxp6.js → plan-4dmnQ9bv.js} +1 -1
  207. package/dist/chunks/{plugin-t8jMqdsY.js → plugin-CG7lJIpf.js} +1 -1
  208. package/dist/chunks/{pluginAutoupdate-CAa4KLro.js → pluginAutoupdate-CPLuidh-.js} +1 -1
  209. package/dist/chunks/{pluginBlocklist-BG2LkLq1.js → pluginBlocklist-BHxIUqu4.js} +1 -1
  210. package/dist/chunks/{pluginCliCommands-vqAtVibb.js → pluginCliCommands-BcDIvxR3.js} +1 -1
  211. package/dist/chunks/{pluginFlagging-BFCtv3kY.js → pluginFlagging-Dh6rYOvj.js} +1 -1
  212. package/dist/chunks/{pluginOperations-C9XP-mko.js → pluginOperations-fdLcp72i.js} +2 -2
  213. package/dist/chunks/{pluginStartupCheck-RRcAbKfx.js → pluginStartupCheck-Dy7EckW4.js} +1 -1
  214. package/dist/chunks/pluginStartupCheck-fyqW-stg.js +1 -0
  215. package/dist/chunks/plugins-C3-iYKTp.js +4 -0
  216. package/dist/chunks/policyLimits-DUGrXcje.js +1 -0
  217. package/dist/chunks/{pollConfig-DTYIJ8lQ.js → pollConfig-BGXMaSla.js} +1 -1
  218. package/dist/chunks/{poor-Dw5dMZpM.js → poor-CxAil0Mi.js} +1 -1
  219. package/dist/chunks/poorMode-BkPHRLuG.js +1 -0
  220. package/dist/chunks/{poorMode-CsGLI_hm.js → poorMode-DFcYVnMT.js} +1 -1
  221. package/dist/chunks/print-Cog1o-Tw.js +39 -0
  222. package/dist/chunks/{privacy-settings-P2r-kg2i.js → privacy-settings-D6g7p6sB.js} +1 -1
  223. package/dist/chunks/{processBashCommand-a8W8aTRu.js → processBashCommand-DqgujTR4.js} +1 -1
  224. package/dist/chunks/processSlashCommand-DUPS9Xx3.js +6 -0
  225. package/dist/chunks/prompt-B-8CD-W_.js +1 -0
  226. package/dist/chunks/{prompt-BBg3jtfc.js → prompt-BmOnuQfF.js} +1 -1
  227. package/dist/chunks/prompt-Da3gIGA8.js +1 -0
  228. package/dist/chunks/{promptEditor-CvaugNTt.js → promptEditor-ClGwMkWl.js} +2 -2
  229. package/dist/chunks/{protocolHandler-DxBaHlaD.js → protocolHandler--b0d38gF.js} +1 -1
  230. package/dist/chunks/{rate-limit-options-Df_sgE0b.js → rate-limit-options-DD2ZRREl.js} +1 -1
  231. package/dist/chunks/{rcDebugLog-CPGWJbI4.js → rcDebugLog-fhwD4wm-.js} +1 -1
  232. package/dist/chunks/{referral-BKeCKnOJ.js → referral-rRvT6UDX.js} +1 -1
  233. package/dist/chunks/refresh-C7S_6LOQ.js +1 -0
  234. package/dist/chunks/{registerProtocol-DLuRm0mf.js → registerProtocol-Bu_tz5Au.js} +1 -1
  235. package/dist/chunks/{registry-DVSgtCq5.js → registry-Bk0vdx_8.js} +1 -1
  236. package/dist/chunks/{release-notes-CZcf8zB7.js → release-notes-BShc_V-B.js} +1 -1
  237. package/dist/chunks/{releaseNotes-CvfZb3fZ.js → releaseNotes-D3wZdQVZ.js} +2 -2
  238. package/dist/chunks/{reload-plugins-pSlDLk3b.js → reload-plugins-CpytFAAC.js} +1 -1
  239. package/dist/chunks/{remote-env-BH89NuwC.js → remote-env-B9Of1v31.js} +1 -1
  240. package/dist/chunks/{remoteBridgeCore-CrXlWEL1.js → remoteBridgeCore-BXp6nJ8q.js} +1 -1
  241. package/dist/chunks/{remoteControlServer-BSOnq4yY.js → remoteControlServer-BvlTaHu4.js} +2 -2
  242. package/dist/chunks/{rename-DNGvNQm2.js → rename-DhTddAd7.js} +1 -1
  243. package/dist/chunks/{resume-6UL38yL3.js → resume-DwVeFqnc.js} +2 -2
  244. package/dist/chunks/{runtimeObserver-Cp-DN8fP.js → runtimeObserver-BtgDP8Gz.js} +1 -1
  245. package/dist/chunks/{runtimeObserver-BhvHeiwD.js → runtimeObserver-dtT0QHYO.js} +4 -4
  246. package/dist/chunks/sandbox-adapter-Cm8kCM_U.js +1 -0
  247. package/dist/chunks/{sandbox-toggle-D19YbI5G.js → sandbox-toggle-CG2vZNAb.js} +1 -1
  248. package/dist/chunks/searchExtraTools-D-RZ9DId.js +1 -0
  249. package/dist/chunks/{sentry-BZmpC-iI.js → sentry-DFk8bzvt.js} +1 -1
  250. package/dist/chunks/{session-lLpGqp0B.js → session-DifFcUdR.js} +1 -1
  251. package/dist/chunks/{sessionDiscovery-BX3fjgzD.js → sessionDiscovery-CRbLIQv1.js} +1 -1
  252. package/dist/chunks/sessionFileAccessHooks-Bixkjai4.js +1 -0
  253. package/dist/chunks/sessionMemory-BdptRKL8.js +1 -0
  254. package/dist/chunks/sessionMemory-T1K_mJRE.js +1 -0
  255. package/dist/chunks/sessionMemoryUtils-q3xRtP-z.js +1 -0
  256. package/dist/chunks/{sessionObserver-CujNIWks.js → sessionObserver-D3vw6SJ_.js} +1 -1
  257. package/dist/chunks/sessionObserver-i_3day_6.js +1 -0
  258. package/dist/chunks/sessionStorage-CusaYoh0.js +1 -0
  259. package/dist/chunks/sessionStoragePortable-DJZ_6cL8.js +3 -0
  260. package/dist/chunks/{sessionTitle-QxXslbJY.js → sessionTitle-DnvlYJ-c.js} +2 -2
  261. package/dist/chunks/{sessionTracing-DognYcDf.js → sessionTracing-BkzKJi0v.js} +1 -1
  262. package/dist/chunks/{settingsSync-DEPET5O1.js → settingsSync-CHZVpM34.js} +1 -1
  263. package/dist/chunks/{setup-C6G0lasE.js → setup-BfecYO-n.js} +1 -1
  264. package/dist/chunks/setup-BpwYOhci.js +2 -0
  265. package/dist/chunks/{setup-BUBUidOg.js → setup-GxlEx1KG.js} +1 -1
  266. package/dist/chunks/{shadowedRuleDetection-CQayPrmM.js → shadowedRuleDetection-FNzEipG0.js} +1 -1
  267. package/dist/chunks/{sideQuestion-B9EE1vTM.js → sideQuestion-Bfa0SZn5.js} +1 -1
  268. package/dist/chunks/sink-BSwQ045N.js +1 -0
  269. package/dist/chunks/{sink-Cugto5We.js → sink-DpAjuilF.js} +1 -1
  270. package/dist/chunks/{sinks-B9A94oIj.js → sinks-C37Xl5c3.js} +2 -2
  271. package/dist/chunks/sinks-DHHmQJi-.js +1 -0
  272. package/dist/chunks/{skill-learning-CroDcatu.js → skill-learning-BSeEbCnP.js} +1 -1
  273. package/dist/chunks/skillChangeDetector-BEDBRGbY.js +1 -0
  274. package/dist/chunks/{skillGapStore-91Mb3xDY.js → skillGapStore-B4GmZRJ0.js} +2 -2
  275. package/dist/chunks/{skillGapStore-LKwap3o4.js → skillGapStore-BCO6YB3H.js} +1 -1
  276. package/dist/chunks/{skillGenerator-B9GM0LHk.js → skillGenerator-QgDWAvzK.js} +2 -2
  277. package/dist/chunks/skillLearning-CFYgFRPE.js +1 -0
  278. package/dist/chunks/skillLearning-en7AuVDZ.js +1 -0
  279. package/dist/chunks/{skillPanel-rIIYgnBE.js → skillPanel-srZjMIbC.js} +3 -3
  280. package/dist/chunks/{skillSearchPanel-xAL-6uJF.js → skillSearchPanel-DTvHcwNK.js} +4 -4
  281. package/dist/chunks/{skills-Doe47wxK.js → skills-BlVUkWg4.js} +1 -1
  282. package/dist/chunks/{sprites-D11F3i1M.js → sprites-QO9r_mXk.js} +1 -1
  283. package/dist/chunks/{stats-WNUyieG-.js → stats-DdXM-u7l.js} +1 -1
  284. package/dist/chunks/{status-CjBS9SkF.js → status-BIZWtZqI.js} +1 -1
  285. package/dist/chunks/{statusNoticeHelpers-cnI4TiGw.js → statusNoticeHelpers-9sIAjiE6.js} +1 -1
  286. package/dist/chunks/{tag-Gfb8vTAR.js → tag-DDJ8pAsl.js} +2 -2
  287. package/dist/chunks/{tasks-BwX1rzOD.js → tasks-DYt6udr3.js} +1 -1
  288. package/dist/chunks/{teamHelpers-DEgaCpta.js → teamHelpers-BJuKEuyS.js} +1 -1
  289. package/dist/chunks/teamHelpers-Cw5dPQor.js +1 -0
  290. package/dist/chunks/teammateModeSnapshot-BXC7ssXX.js +1 -0
  291. package/dist/chunks/{teammateModeSnapshot-Dyukgtp9.js → teammateModeSnapshot-Zp1weNIZ.js} +1 -1
  292. package/dist/chunks/teleport-DkoFG3EI.js +1 -0
  293. package/dist/chunks/{templateJobs-DQXuFnkl.js → templateJobs-V2-TVeGE.js} +1 -1
  294. package/dist/chunks/{terminalSetup-bSbq4LE7.js → terminalSetup-DMUDhXur.js} +1 -1
  295. package/dist/chunks/{terminalSetup-CTEIn08j.js → terminalSetup-l0Vv_v1c.js} +1 -1
  296. package/dist/chunks/{theme-DazaKPy8.js → theme-Dm1yCDce.js} +1 -1
  297. package/dist/chunks/thinkback-D1mk7cq1.js +1 -0
  298. package/dist/chunks/thinkback-DQAZE5SA.js +1 -0
  299. package/dist/chunks/thinkback-play-BJcGmc9X.js +1 -0
  300. package/dist/chunks/{toolEventObserver-Dfvv2trb.js → toolEventObserver-BgkqkNwy.js} +1 -1
  301. package/dist/chunks/{toolEventObserver-D4h-QqVP.js → toolEventObserver-C-BImvCz.js} +1 -1
  302. package/dist/chunks/toolPool-DNH5H4Jg.js +1 -0
  303. package/dist/chunks/toolPool-DYvz_Mjt.js +1 -0
  304. package/dist/chunks/{trustedDevice-CQ9PK-8m.js → trustedDevice-BDrK9AQ6.js} +1 -1
  305. package/dist/chunks/{trustedDevice-rdvUkS1W.js → trustedDevice-CXsk3eij.js} +1 -1
  306. package/dist/chunks/{ultrareviewCommand-Zf9hO4wr.js → ultrareviewCommand-Bc8hMzHz.js} +2 -2
  307. package/dist/chunks/undercover-DUrQYxYo.js +1 -0
  308. package/dist/chunks/{undercover-DLyKv5TE.js → undercover-kRoI_nlN.js} +1 -1
  309. package/dist/chunks/{updateCCB-7WQRz9lW.js → updateCCB-BPGNN7VA.js} +1 -1
  310. package/dist/chunks/upgrade-BTI562Ce.js +1 -0
  311. package/dist/chunks/{upgrade-ByIumMQe.js → upgrade-DmEGLk6v.js} +1 -1
  312. package/dist/chunks/{upload-CvOMbA9_.js → upload-49qk5TBL.js} +1 -1
  313. package/dist/chunks/{usage-DE4PSQiF.js → usage-DhJDFJVx.js} +1 -1
  314. package/dist/chunks/{usage-C_d-Z-eb.js → usage-sYgTL8wR.js} +1 -1
  315. package/dist/chunks/{useMainLoopModel-Os8Ao8-x.js → useMainLoopModel-CJaR_qEJ.js} +1 -1
  316. package/dist/chunks/{useManagePlugins-BYBubfHU.js → useManagePlugins-B1FpmxFo.js} +1 -1
  317. package/dist/chunks/{useMergedTools-BJAn2i-F.js → useMergedTools-eMPZ95TX.js} +1 -1
  318. package/dist/chunks/{useSearchInput-CF77X2OV.js → useSearchInput-CR-b0Qi6.js} +1 -1
  319. package/dist/chunks/useSettingsErrors-p-PFBeaC.js +1 -0
  320. package/dist/chunks/{useVoice-DwzMN0fq.js → useVoice-D3PqTfCK.js} +1 -1
  321. package/dist/chunks/{util-DD30Y4o8.js → util-BZ2fS3PR.js} +1 -1
  322. package/dist/chunks/utils-hhztcb0b.js +1 -0
  323. package/dist/chunks/validatePlugin-QtcXXmZu.js +1 -0
  324. package/dist/chunks/{vim-zc9EiMil.js → vim-LmepJftY.js} +1 -1
  325. package/dist/chunks/{voice-BRhZt4jW.js → voice-CNRTt4gH.js} +2 -2
  326. package/dist/chunks/voiceModeEnabled-B57V7REx.js +1 -0
  327. package/dist/chunks/{voiceModeEnabled-168-1Ocs.js → voiceModeEnabled-wWM929QG.js} +1 -1
  328. package/dist/chunks/{voiceStreamSTT-B80UegKG.js → voiceStreamSTT-CnK9GN6Q.js} +1 -1
  329. package/dist/chunks/voiceStreamSTT-Dp-1uSjP.js +1 -0
  330. package/dist/chunks/{workerRegistry-s8nnpmUO.js → workerRegistry-CrIpKIZe.js} +1 -1
  331. package/dist/chunks/worktree-YbEK6b36.js +1 -0
  332. package/dist/chunks/{xml-DTMvLcPg.js → xml-CMdTGiv6.js} +1 -1
  333. package/dist/cli.js +1 -1
  334. package/package.json +1 -1
  335. package/dist/chunks/ApproveApiKey-BhMr2Y5F.js +0 -1
  336. package/dist/chunks/BackgroundTasksDialog-BL_dfbZP.js +0 -2
  337. package/dist/chunks/ClaudeMdExternalIncludesDialog-DPki55Xa.js +0 -1
  338. package/dist/chunks/ConsoleOAuthFlow-D_j1NebK.js +0 -1
  339. package/dist/chunks/Doctor-2D5Wz58o.js +0 -1
  340. package/dist/chunks/Doctor-CDez_u_U.js +0 -3
  341. package/dist/chunks/Grove-Dwu_0zRw.js +0 -1
  342. package/dist/chunks/MessageSelector-BRkxpO1O.js +0 -3
  343. package/dist/chunks/Messages-wyMyMP7U.js +0 -11
  344. package/dist/chunks/PluginSettings-DGpIVGvV.js +0 -17
  345. package/dist/chunks/QueryEngine-I3Bqzbiz.js +0 -1
  346. package/dist/chunks/REPL-BxAsVlx3.js +0 -1
  347. package/dist/chunks/ResumeConversation-AdLtgdVB.js +0 -1
  348. package/dist/chunks/SearchExtraToolsTool-BJ8Nx_Nu.js +0 -1
  349. package/dist/chunks/SentryErrorBoundary-Bs7mtkPb.js +0 -1
  350. package/dist/chunks/Settings-PioHwsvg.js +0 -2
  351. package/dist/chunks/api-CFNGoLoL.js +0 -1
  352. package/dist/chunks/asciicast-aoKFhc7C.js +0 -1
  353. package/dist/chunks/assistant-BLd4y2FJ.js +0 -1
  354. package/dist/chunks/auth-DGfZCD_B.js +0 -1
  355. package/dist/chunks/backgroundHousekeeping-Ckj8W3RO.js +0 -1
  356. package/dist/chunks/backgroundHousekeeping-D2_Uopt7.js +0 -17
  357. package/dist/chunks/bridgeConfig-7c07tJm9.js +0 -1
  358. package/dist/chunks/bridgeEnabled-Z2S8lk0l.js +0 -1
  359. package/dist/chunks/bridgeMain-B7FZpvo0.js +0 -68
  360. package/dist/chunks/bridgeMain-C5UxF8ST.js +0 -1
  361. package/dist/chunks/caches-Dt52PedI.js +0 -1
  362. package/dist/chunks/changeDetector-uO9CBvut.js +0 -1
  363. package/dist/chunks/channelNotification-DzTzUrCe.js +0 -1
  364. package/dist/chunks/clear-B_cVk64B.js +0 -1
  365. package/dist/chunks/client-BcqXgcrx.js +0 -1
  366. package/dist/chunks/color-DEXUx7gE.js +0 -1
  367. package/dist/chunks/commands-BX0_wEGw.js +0 -1
  368. package/dist/chunks/commitAttribution-CSVDcgTO.js +0 -1
  369. package/dist/chunks/context-noninteractive-SBxqQ3iu.js +0 -1
  370. package/dist/chunks/conversation-CQBl9Yy2.js +0 -1
  371. package/dist/chunks/conversation-DVZplNag.js +0 -1
  372. package/dist/chunks/createSession-DfEQy2dZ.js +0 -1
  373. package/dist/chunks/datadog-Uj6FjEuU.js +0 -1
  374. package/dist/chunks/entry-CdfuWjKu.js +0 -14
  375. package/dist/chunks/envLessBridgeConfig-DOO9eX07.js +0 -1
  376. package/dist/chunks/extra-usage-CJcyfVCt.js +0 -1
  377. package/dist/chunks/extractMemories-C3SU-Osb.js +0 -1
  378. package/dist/chunks/fast-7iinMwk-.js +0 -1
  379. package/dist/chunks/gates-qgzva-fO.js +0 -1
  380. package/dist/chunks/grok-C4QFXJnR.js +0 -1
  381. package/dist/chunks/hooks-Ch2vPE8u.js +0 -1
  382. package/dist/chunks/inboundAttachments-C0rkLl2x.js +0 -1
  383. package/dist/chunks/initReplBridge-tXqkba08.js +0 -1
  384. package/dist/chunks/language-B1yHC1d6.js +0 -1
  385. package/dist/chunks/loadAgentsDir-DxPE2bIO.js +0 -1
  386. package/dist/chunks/loadPluginHooks-CL5aGDrb.js +0 -1
  387. package/dist/chunks/localSearch-iozuZZhZ.js +0 -1
  388. package/dist/chunks/login-Dxza_KNT.js +0 -1
  389. package/dist/chunks/logout-BeGQR78E.js +0 -1
  390. package/dist/chunks/mcp-UJZ22IDJ.js +0 -6
  391. package/dist/chunks/mcp-fHf8Uc7h.js +0 -1
  392. package/dist/chunks/model-D3g2QdU-.js +0 -1
  393. package/dist/chunks/openai-Bvo0Gcec.js +0 -10
  394. package/dist/chunks/openaiShared-D5lOejS1.js +0 -16
  395. package/dist/chunks/permissions-BDbIjTT6.js +0 -3
  396. package/dist/chunks/pluginStartupCheck-DZp0wnXP.js +0 -1
  397. package/dist/chunks/plugins-0SyID4Kx.js +0 -4
  398. package/dist/chunks/policyLimits-Cmmzuv-E.js +0 -1
  399. package/dist/chunks/poorMode-D_hB-rDf.js +0 -1
  400. package/dist/chunks/print-Ct8N4PYT.js +0 -39
  401. package/dist/chunks/processSlashCommand-BaUdUg3T.js +0 -6
  402. package/dist/chunks/prompt-B1Qy8mi4.js +0 -1
  403. package/dist/chunks/prompt-D4kWWEZC.js +0 -1
  404. package/dist/chunks/refresh-Cjv4jA6L.js +0 -1
  405. package/dist/chunks/sandbox-adapter-DGVtPPD0.js +0 -1
  406. package/dist/chunks/searchExtraTools-DXWkpOIg.js +0 -1
  407. package/dist/chunks/sessionFileAccessHooks-BeuS4m7a.js +0 -1
  408. package/dist/chunks/sessionMemory-LMOQk90c.js +0 -1
  409. package/dist/chunks/sessionMemory-UpILj5ww.js +0 -1
  410. package/dist/chunks/sessionMemoryUtils-DE7AezA0.js +0 -1
  411. package/dist/chunks/sessionObserver-HqvTXhs9.js +0 -1
  412. package/dist/chunks/sessionStorage-BN56DAAd.js +0 -1
  413. package/dist/chunks/sessionStoragePortable-BI9q2WcJ.js +0 -3
  414. package/dist/chunks/setup-BZMVuIIx.js +0 -2
  415. package/dist/chunks/sink-BRrEbL6h.js +0 -1
  416. package/dist/chunks/sinks-CKaSBvU8.js +0 -1
  417. package/dist/chunks/skillChangeDetector-DnyEQqe6.js +0 -1
  418. package/dist/chunks/skillLearning-D6latSKi.js +0 -1
  419. package/dist/chunks/skillLearning-DbOOqb6b.js +0 -1
  420. package/dist/chunks/teamHelpers-EJxTXoTV.js +0 -1
  421. package/dist/chunks/teammateModeSnapshot-BgUQ4Phz.js +0 -1
  422. package/dist/chunks/teleport-B4p8XlAv.js +0 -1
  423. package/dist/chunks/thinkback-BOfZP_QG.js +0 -1
  424. package/dist/chunks/thinkback-CxWZV2Oz.js +0 -1
  425. package/dist/chunks/thinkback-play-CHe1x2Hc.js +0 -1
  426. package/dist/chunks/toolPool-BHChMuLr.js +0 -1
  427. package/dist/chunks/toolPool-C5K43w4_.js +0 -1
  428. package/dist/chunks/undercover-DNS9V_JT.js +0 -1
  429. package/dist/chunks/upgrade-bK4x32Ma.js +0 -1
  430. package/dist/chunks/useSettingsErrors-DD7fQ-fU.js +0 -1
  431. package/dist/chunks/utils-D44M8obg.js +0 -1
  432. package/dist/chunks/validatePlugin-DpHiJRsT.js +0 -1
  433. package/dist/chunks/voiceModeEnabled-CTT25yFj.js +0 -1
  434. package/dist/chunks/voiceStreamSTT-BpYhKo2H.js +0 -1
  435. package/dist/chunks/worktree-CkB4jLXK.js +0 -1
@@ -1,39 +0,0 @@
1
- import{a as e}from"./chunk-DR8-3Aex.js";import{c as t,l as n,s as r,u as i}from"./envUtils-BWeoiL4Y.js";import{n as a,t as o}from"./defineProperty-80gRi2ZW.js";import{B as s,b as c,v as l}from"./server-DzOdtq8A.js";import{Ct as u,F as d,In as f,R as p,Tn as m,Vn as h,_n as g,_r as ee,cn as _,jr as te,ln as v,nr as y,tr as b,tt as x,y as S}from"./state-sIHsFpDu.js";import{Aa as C,Br as w,Bt as ne,C as re,Cr as ie,Dr as ae,El as T,Et as oe,Fa as se,Ki as ce,Ma as E,Ml as le,Na as ue,Ot as D,Pr as O,Rr as de,S as fe,Si as pe,Tl as me,Xn as he,Xo as k,Yn as A,_ as ge,a as _e,bl as ve,c as ye,jl as be,kt as xe,ls as Se,ms as Ce,no as j,on as we,oo as Te,pi as Ee,qi as De,ss as Oe,to as ke,vi as M,xi as Ae,xs as N,yi as je,yl as Me}from"./paths-1ngPRtu3.js";import{E as P,K as Ne,L as F,T as Pe,V as Fe,X as Ie,Y as Le,c as Re,d as I,h as ze,p as Be,s as L,w as R}from"./debug-UI3T040K.js";import{n as Ve,r as z}from"./analytics-DqMQntaB.js";import{n as He,t as Ue}from"./cwd--iizewsn.js";import{i as We,n as B,o as V}from"./process-DMKLUQIO.js";import{F as Ge,I as Ke,P as H}from"./git-CN3qtTb_.js";import{J as qe,K as Je,c as Ye,et as U,i as Xe,o as Ze,s as W}from"./log-CzsijfHZ.js";import{i as Qe,n as $e}from"./path-C4kbwvSH.js";import{s as et,u as tt}from"./types-Csi32ZXh.js";import{C as nt,c as rt,d as it,l as at,m as ot,s as st,x as G}from"./teammate-DMYOtLTK.js";import{n as ct,t as lt}from"./sleep-8Eb9j_Ly.js";import{$A as ut,$E as dt,$r as ft,AO as pt,Ar as mt,BD as ht,BE as gt,BT as _t,Ba as vt,CC as yt,CO as bt,Cn as xt,D as St,DE as Ct,Di as wt,Dv as Tt,Dx as Et,EC as Dt,Ei as Ot,Ev as kt,F as At,FD as jt,Fc as Mt,G as Nt,Gi as Pt,Hi as Ft,ID as It,I_ as Lt,Ic as Rt,Is as zt,JE as Bt,JT as K,Jv as Vt,K as Ht,Ks as Ut,LD as Wt,LS as Gt,L_ as Kt,Lo as qt,Ls as Jt,MD as Yt,Ml as Xt,ND as Zt,NT as Qt,Nc as $t,Ny as en,O as tn,Of as nn,Or as rn,Ox as an,PD as on,Pc as sn,Py as cn,QC as ln,QD as un,QE as dn,Qv as fn,RD as pn,RS as mn,RT as hn,Ra as gn,S as _n,Sx as vn,TD as yn,TT as bn,Tv as xn,Tx as Sn,UD as Cn,UT as wn,Uh as Tn,Us as En,Uu as Dn,VD as On,VE as kn,Vs as An,Vt as jn,WA as Mn,WD as Nn,WT as Pn,Wu as Fn,XT as In,Xi as Ln,Xv as Rn,YC as zn,YD as Bn,YE as Vn,YT as Hn,ZE as Un,Zh as Wn,Zv as Gn,_E as Kn,_O as qn,_c as Jn,_v as Yn,aj as Xn,as as Zn,au as Qn,aw as $n,bE as er,bO as tr,bb as nr,bc as rr,bv as ir,cC as ar,cE as or,cO as sr,cs as cr,cw as lr,db as ur,di as dr,dw as fr,eg as pr,fc as mr,fi as hr,fj as gr,fs as _r,fw as vr,gO as yr,gc as br,gi as xr,gw as Sr,gx as Cr,hO as wr,hc as Tr,hi as Er,ip as Dr,ir as Or,jD as q,jl as kr,kE as Ar,kO as jr,kf as Mr,kr as Nr,lC as Pr,lE as Fr,lO as Ir,la as Lr,lr as Rr,mA as zr,mc as Br,ms as Vr,nj as Hr,nu as Ur,ny as Wr,o as Gr,oA as Kr,oC as qr,os as Jr,ow as Yr,p as Xr,pc as Zr,po as Qr,qE as $r,qT as ei,qu as ti,rA as ni,rp as ri,ru as ii,ry as ai,s as oi,sE as si,sb as ci,tg as li,tj as ui,u as di,uE as fi,uO as J,uj as pi,vA as mi,vE as hi,vc as gi,vi as _i,vx as vi,w as yi,wC as bi,wD as xi,wT as Si,wn as Ci,wv as wi,x as Ti,xE as Ei,xc as Di,xv as Oi,yb as ki,yc as Ai,yn as ji,yx as Mi,zC as Ni,zD as Pi,zi as Fi}from"./loadAgentsDir-D7kapZB5.js";import{F as Ii,Hn as Li,Ht as Ri,M as zi,Nt as Bi,Pt as Vi,Vn as Hi,_t as Ui,pn as Wi,vt as Gi,xn as Ki}from"./prompt-BBg3jtfc.js";import{i as qi,o as Ji}from"./xml-DTMvLcPg.js";import{a as Yi,o as Xi,s as Zi}from"./fileStateCache-C7-TxF8G.js";import{A as Qi,C as $i,D as ea,N as ta,O as na,P as ra,Z as ia,_ as aa,d as oa,g as sa,h as ca,m as la,u as ua,v as da,y as fa}from"./rcDebugLog-CPGWJbI4.js";import{c as pa,l as ma}from"./commitAttribution-e0kkanVT.js";import{P as ha,V as ga,a as _a,d as va}from"./teamHelpers-DEgaCpta.js";import{t as ya}from"./pollConfig-DTYIJ8lQ.js";import{r as ba}from"./inboundAttachments-7rXrAtkb.js";import{i as xa,n as Sa,s as Ca}from"./mappers-CkMESMy7.js";import{n as wa,r as Ta}from"./sessionTitle-QxXslbJY.js";import{n as Ea,t as Da}from"./ccrClient-B_3AmY7K.js";import{n as Oa,t as ka}from"./HybridTransport-CAko699F.js";import{n as Aa,t as ja}from"./SSETransport-B5xlXeAN.js";import{t as Ma}from"./pluginBlocklist-BG2LkLq1.js";import{c as Na,d as Pa,f as Fa,l as Ia,o as La,r as Ra,s as za,u as Ba}from"./channelNotification-BbDQdLZC.js";import{t as Va}from"./onChangeAppState-Cb9_yIuW.js";import{t as Ha}from"./settingsSync-DEPET5O1.js";import{a as Ua,c as Wa,d as Ga,f as Ka,l as qa,m as Ja,o as Ya,p as Xa,r as Za,t as Qa}from"./cronJitterConfig-DcMGWOa-.js";import{i as $a,n as eo}from"./toolPool-BHChMuLr.js";import{n as to,r as no}from"./QueryEngine-I3Bqzbiz.js";import{n as ro,r as io}from"./sideQuestion-B9EE1vTM.js";import{n as ao,r as oo}from"./context-noninteractive-IZfWniex.js";import{a as so,o as co,t as lo}from"./skillChangeDetector-DnyEQqe6.js";import{n as uo,t as fo}from"./refresh-Cjv4jA6L.js";import{dirname as po,join as mo}from"path";import{PassThrough as ho}from"stream";import{randomUUID as Y}from"crypto";import{readFile as go,stat as _o}from"fs/promises";import{URL as vo}from"url";import{cwd as X}from"process";a(),_(),He(),Le(),Fe(),R(),ze(),B(),L(),H(),U(),Ze(),Qe(),et(),G(),N(),Te(),se(),E(),De(),O(),A(),lt(),we(),at(),fe(),_e(),Hi(),Ki(),zr(),Kr(),qn(),jt(),yn(),kn(),ta(),hi(),ha(),Hn(),Qt(),na(),Lt(),oa(),Mt(),sn(),Jr(),qt(),Ln(),mt(),Ci(),ji(),Ha(),r(),Aa();function yo(e,t={},n,r){if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let i=new vo(e.href);return i.protocol===`wss:`?i.protocol=`https:`:i.protocol===`ws:`&&(i.protocol=`http:`),i.pathname=i.pathname.replace(/\/$/,``)+`/worker/events/stream`,new ja(i,t,n,r)}if(e.protocol===`ws:`||e.protocol===`wss:`)return i(process.env.CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2)?new ka(e,t,n,r):new Oa(e,t,n,r);throw Error(`Unsupported protocol: ${e.protocol}`)}r(),Aa();var bo=class extends Ga{constructor(e,t,n){let r=new ho({encoding:`utf8`});super(r,n),o(this,`url`,void 0),o(this,`transport`,void 0),o(this,`inputStream`,void 0),o(this,`isBridge`,!1),o(this,`isDebug`,!1),o(this,`ccrClient`,null),o(this,`keepAliveTimer`,null),this.inputStream=r,this.url=new vo(e);let a={},s=ea();s?a.Authorization=`Bearer ${s}`:I(`[remote-io] No session ingress token available`,{level:`error`});let c=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;if(c&&(a[`x-environment-runner-version`]=c),this.transport=yo(this.url,a,u(),()=>{let e={},t=ea();t&&(e.Authorization=`Bearer ${t}`);let n=process.env.CLAUDE_CODE_ENVIRONMENT_RUNNER_VERSION;return n&&(e[`x-environment-runner-version`]=n),e}),this.isBridge=process.env.CLAUDE_CODE_ENVIRONMENT_KIND===`bridge`,this.isDebug=Re(),this.transport.setOnData(e=>{this.inputStream.write(e),this.isBridge&&this.isDebug&&V(e.endsWith(`
2
- `)?e:e+`
3
- `)}),this.transport.setOnClose(()=>{this.inputStream.end()}),i(process.env.CLAUDE_CODE_USE_CCR_V2)){if(!(this.transport instanceof ja))throw Error(`CCR v2 requires SSETransport; check getTransportForUrl`);this.ccrClient=new Da(this.transport,this.url);let e=this.ccrClient.initialize();this.restoredWorkerState=e.catch(()=>null),e.catch(e=>{Ge(`error`,`cli_worker_lifecycle_init_failed`,{reason:e instanceof Ea?e.reason:`unknown`}),W(Error(`CCRClient initialization failed: ${F(e)}`)),ei(1,`other`)}),Ie(async()=>this.ccrClient?.close()),wt((e,t,n)=>this.ccrClient.writeInternalEvent(e,t,n)),Ot(()=>this.ccrClient.readInternalEvents(),()=>this.ccrClient.readSubagentInternalEvents());let t={started:`processing`,completed:`processed`};Wt((e,n)=>{this.ccrClient?.reportDelivery(e,t[n])}),da((e,t)=>{this.ccrClient?.reportState(e,t)}),aa(e=>{this.ccrClient?.reportMetadata(e)},{replayCurrent:!0})}this.transport.connect();let l=ya().session_keepalive_interval_v2_ms;if(this.isBridge&&l>0&&(this.keepAliveTimer=setInterval(()=>{I(`[remote-io] keep_alive sent`),this.write({type:`keep_alive`}).catch(e=>{I(`[remote-io] keep_alive write failed: ${F(e)}`)})},l),this.keepAliveTimer.unref?.()),Ie(async()=>this.close()),t){let e=this.inputStream;(async()=>{for await(let n of t)e.write(String(n).replace(/\n$/,``)+`
4
- `)})()}}flushInternalEvents(){return this.ccrClient?.flushInternalEvents()??Promise.resolve()}get internalEventsPending(){return this.ccrClient?.internalEventsPending??0}async write(e){this.ccrClient?await this.ccrClient.writeEvent(e):await this.transport.write(e),this.isBridge&&(e.type===`control_request`||this.isDebug)&&V(Ka(e)+`
5
- `)}close(){this.keepAliveTimer&&(clearInterval(this.keepAliveTimer),this.keepAliveTimer=null),this.transport.close(),this.inputStream.end()}};Wi(),k(),Ri(),Vi(),[...Bi],Le(),L();var xo=`[stdout-guard]`,So=!1,Z=``,Co=null;function wo(e){if(e.length===0)return!0;try{return JSON.parse(e),!0}catch{return!1}}function To(){So||(So=!0,Co=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),wo(e)?a=Co(e+`
7
- `):(process.stderr.write(`${xo} ${e}\n`),I(`streamJsonStdoutGuard diverted non-JSON stdout line: ${e.slice(0,200)}`))}let o=typeof t==`function`?t:n;return o&&queueMicrotask(()=>o()),a},Ie(async()=>{Z.length>0&&(Co&&wo(Z)?Co(Z+`
8
- `):process.stderr.write(`${xo} ${Z}\n`),Z=``),Co&&(process.stdout.write=Co,Co=null),So=!1}))}Me(),Se(),pi(),ut(),qi(),Gi(),Xi(),ra(),dn(),Ar(),fr(),ln(),ai(),wi(),ir(),ti(),Ai(),An(),_r(),Ht(),Gr(),Ba(),Na(),eo(),Yn(),Fe(),Ze(),na(),Vt(),L(),Hn();function Eo(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&&(I(`Exiting after ${n}ms of idle time`),K())},n))},stop(){i&&(clearTimeout(i),i=null)}}}be(),me(),M(),jr(),$r(),or(),bn(),mn(),ki(),ur(),Xt(),gn(),yi(),Ta(),ro();function Do(e){if(e.toLowerCase().endsWith(`.jsonl`))return{sessionId:Y(),ingressUrl:null,isUrl:!1,jsonlFile:e,isJsonlFile:!0};if(Kt(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}s(),D(),Bn(),On(),Zt(),ma(),wn(),yt(),qr(),Sn(),Mr(),Ur(),Sa(),oo(),L();async function Oo(){try{let e=await go(br(),`utf-8`),t=Ce().safeParse(Pe(e));return t.success?t.data:(I(`Invalid known_marketplaces.json in zip cache: ${t.error.message}`,{level:`error`}),{})}catch{return{}}}async function ko(e){await mr(br(),P(e,null,2))}async function Ao(e,t){let n=Tr();if(!n)return;let r=await jo(t);r!==null&&await mr(mo(n,Br(e)),r)}async function jo(e){let t=[mo(e,`.claude-plugin`,`marketplace.json`),mo(e,`marketplace.json`),e];for(let e of t)try{return await go(e,`utf-8`)}catch{}return null}async function Mo(){let e=await En();for(let[t,n]of Object.entries(e))if(n.installLocation)try{await Ao(t,n.installLocation)}catch(e){I(`Failed to save marketplace JSON for ${t}: ${e}`)}await ko({...await Oo(),...e})}Ve(),Le(),L(),H(),Ze(),An(),Ai();async function No(){let e=Di();I(`installPluginsForHeadless: starting${e?` (zip cache mode)`:``}`);let t=await Ut();t&&(zt(),cr(`headlessPluginInstall: seed marketplaces registered`)),e&&(await Be().mkdir(Jn()),await Be().mkdir(gi()));let n=Object.keys(Jt()).length,r={marketplaces_installed:0,delisted_count:0},i=t;try{if(n===0)I(`installPluginsForHeadless: no marketplaces declared`);else{let t=await Ke(`headless_marketplace_reconcile`,()=>Wa({skip:e?(e,t)=>!rr(t):void 0,onProgress:e=>{e.type===`installed`?I(`installPluginsForHeadless: installed marketplace ${e.name}`):e.type===`failed`&&I(`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&&I(`installPluginsForHeadless: skipped ${t.skipped.length} marketplace(s) unsupported by zip cache: ${t.skipped.join(`, `)}`);let n=t.installed.length+t.updated.length;n>0&&(zt(),cr(`headlessPluginInstall: marketplaces reconciled`),i=!0),r.marketplaces_installed=n}e&&await Mo();let t=await Ma();return r.delisted_count=t.length,t.length>0&&(i=!0),i&&cr(`headlessPluginInstall: plugins changed`),e&&Ie(Zr),i}catch(e){return W(e),!1}finally{z(`tengu_headless_plugin_install`,r)}}Ve(),L(),H(),jt(),oa(),Ze(),B(),Lt(),Hn(),Le(),He(),_(),mt(),qt(),R(),r(),fo(),_r(),Tn(),_a(),Ei(),en(),ri(),Fe();var Q=(fi(),e(Fr)),$=(fa(),e($i)),Po=(Ya(),e(Ua)),Fo=(Za(),e(Qa)),Io=(zi(),e(Ii)),Lo=`<system-reminder>
9
- You are running in non-interactive mode and cannot return a response to the user until your team is shut down.
10
-
11
- You MUST shut down your team before preparing your final response:
12
- 1. Use requestShutdown to ask each team member to shut down gracefully
13
- 2. Wait for shutdown approvals
14
- 3. Use the cleanup operation to clean up the team
15
- 4. Only then provide your final response to the user
16
-
17
- The user cannot receive your response until the team is completely shut down.
18
- </system-reminder>
19
-
20
- Shut down your team and prepare your final response for the user.`,Ro=1e4,zo=new Set,Bo=[];function Vo(e){if(zo.has(e))return!1;if(zo.add(e),Bo.push(e),Bo.length>Ro){let e=Bo.splice(0,Bo.length-Ro);for(let t of e)zo.delete(t)}return!0}function Ho(e){return typeof e==`string`?[{type:`text`,text:e}]:e}function Uo(e){return e.length===1?e[0]:e.every(e=>typeof e==`string`)?e.join(`
21
- `):e.flatMap(Ho)}function Wo(e,t){return t!==void 0&&t.mode===`prompt`&&t.workload===e.workload&&t.isMeta===e.isMeta}async function Go(e,t,n,r,a,o,s,c){if(process.env.USER_TYPE===`ant`&&i(process.env.CLAUDE_CODE_EXIT_AFTER_FIRST_RENDER)&&(process.stderr.write(`\nStartup time: ${Math.round(process.uptime()*1e3)}ms\n`),process.exit(0)),mi.subscribe(e=>{Gt(e,n),Ae()&&n(e=>{let t=e.settings,n=t.fastMode===!0&&!t.fastModePerSessionOptIn;return{...e,fastMode:n}})}),$&&!$.isProactiveActive()&&i(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(),Yt(),q(`runHeadless_entry`),await Pn()&&await _t(),q(`after_grove_check`),re(),c.resumeSessionAt&&!c.resume){process.stderr.write(`Error: --resume-session-at requires --resume
22
- `),K(1);return}if(c.rewindFiles&&!c.resume){process.stderr.write(`Error: --rewind-files requires --resume
23
- `),K(1);return}if(c.rewindFiles&&e){process.stderr.write(`Error: --rewind-files is a standalone operation and cannot be used with a prompt
24
- `),K(1);return}let l=rs(e,c);c.outputFormat===`stream-json`&&To();let d=ni.getSandboxUnavailableReason();if(d){if(ni.isSandboxRequired()){process.stderr.write(`\nError: sandbox required but unavailable: ${d}\n sandbox.failIfUnavailable is set — refusing to start without a working sandbox.\n\n`),K(1);return}process.stderr.write(`\n⚠ Sandbox disabled: ${d}\n Commands will run WITHOUT sandboxing. Network and filesystem restrictions will NOT be enforced.\n\n`)}else if(ni.isSandboxingEnabled())try{await ni.initialize(l.createSandboxAskCallback())}catch(e){process.stderr.write(`\n❌ Sandbox Error: ${F(e)}\n`),K(1,`other`);return}c.outputFormat===`stream-json`&&c.verbose&&Rt(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:u()};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:u()};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:u()}}})();l.write(t)}),c.setupTrigger&&await kt(c.setupTrigger),q(`before_loadInitialMessages`);let f=t(),{messages:p,turnInterruptionState:m,agentSetting:h}=await ns(n,{continue:c.continue,teleport:c.teleport,resume:c.resume,resumeSessionAt:c.resumeSessionAt,forkSession:c.forkSession,outputFormat:c.outputFormat,sessionStartHooksPromise:c.sessionStartHooksPromise,restoredWorkerState:l.restoredWorkerState}),g=Tt();if(g&&l.prependUserMessage(g),!c.agent&&!x()&&h){let{agentDefinition:e}=so(h,void 0,{activeAgents:s,allAgents:s});if(e){if(n(t=>({...t,agent:e.agentType})),!c.systemPrompt&&!oi(e)){let t=e.getSystemPrompt();t&&(c.systemPrompt=t)}Er(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`),K(1);return}let r=t(),i=await Xo(c.rewindFiles,r,n,!1);if(!i.canRewind){process.stderr.write(`Error: ${i.error||`Unexpected error`}\n`),K(1);return}process.stdout.write(`Files rewound to state at message ${c.rewindFiles}\n`),K(0);return}let ee=typeof c.resume==`string`&&(!!Kt(c.resume)||c.resume.endsWith(`.jsonl`)),_=!!c.sdkUrl;if(!e&&!ee&&!_){process.stderr.write(`Error: Input must be provided either through stdin or as a prompt argument when using --print
25
- `),K(1);return}if(c.outputFormat===`stream-json`&&!c.verbose){process.stderr.write(`Error: When using --print, --output-format=stream-json requires --verbose
26
- `),K(1);return}let te=Fn(f.mcp.tools,f.toolPermissionContext),v=[...a,...te],y=Jo(c.sdkUrl?`stdio`:c.permissionPromptToolName,l,()=>t().mcp.tools,e=>{n(e=>({...e,attribution:{...e.attribution,permissionPromptCount:e.attribution.permissionPromptCount+1}})),ca(`requires_action`,e)});c.permissionPromptToolName&&(v=v.filter(e=>!Li(e,c.permissionPromptToolName))),We(),q(`after_loadInitialMessages`),await C(),q(`after_modelStrings`);let b=c.outputFormat===`json`&&c.verbose,S=[],w;q(`before_runHeadlessStreaming`);for await(let e of Ko(l,f.mcp.clients,[...r,...f.mcp.commands],v,p,y,o,t,n,s,c,m))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`&&(b&&S.push(e),w=e);switch(c.outputFormat){case`json`:if(!w||w.type!==`result`)throw Error(`No messages returned`);if(c.verbose){V(P(S)+`
27
- `);break}V(P(w)+`
28
- `);break;case`stream-json`:break;default:if(!w||w.type!==`result`)throw Error(`No messages returned`);switch(w.subtype){case`success`:V(w.result.endsWith(`
29
- `)?w.result:w.result+`
30
- `);break;case`error_during_execution`:V(`Execution error`);break;case`error_max_turns`:V(`Error: Reached max turns (${c.maxTurns}).\nTip: Increase the limit with --max-turns or continue in a new session.`);break;case`error_max_budget_usd`:V(`Error: Exceeded USD budget ($${c.maxBudgetUsd}).\nTip: Increase the limit with --max-budget-usd or start a new session to continue.`);break;case`error_max_structured_output_retries`:V(`Error: Failed to provide valid structured output after maximum retries.
31
- Tip: Simplify your schema or check if the output format matches the expected structure.`)}}if(on(),ye())try{let{drainPendingExtraction:e}=await import(`./extractMemories-C3SU-Osb.js`);await e()}catch{}K(w?.type===`result`&&w?.is_error?1:0)}function Ko(e,r,a,o,s,m,h,g,_,te,v,y){let x=!1,S,C=!1,re=!1,se=null,E,D=e.outbound;process.on(`SIGINT`,()=>{Ge(`info`,`shutdown_signal`,{signal:`SIGINT`}),E&&!E.signal.aborted&&E.abort(),ei(0)}),Ie(async()=>{let t={};for(let e of er(g()))cn(e)&&(t[e.type]=(t[e.type]??0)+1);Ge(`info`,`run_state_at_shutdown`,{run_active:x,run_phase:S,worker_status:ua(),internal_events_pending:e.internalEventsPending,bg_tasks:t})}),sa(e=>{(e===`default`||e===`acceptEdits`||e===`bypassPermissions`||e===`plan`||e===`auto`||e===`dontAsk`)&&D.enqueue({type:`system`,subtype:`status`,status:null,permissionMode:e,uuid:Y(),session_id:u()})});let O={abortController:null,inflightPromise:null,lastEmitted:null,pendingSuggestion:null,pendingLastEmittedEntry:null},fe;v.enableAuthStatus&&(fe=ce.getInstance().subscribe(e=>{D.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}));let me=e=>{let t=Ca(e);t&&D.enqueue({type:`rate_limit_event`,rate_limit_info:t,uuid:Y(),session_id:u()})};pt.add(me);let k=s,A=Ct(s,X(),100),_e=Yi(100),ye=process.env.CLAUDE_CODE_RESUME_INTERRUPTED_TURN;y&&y.kind!==`none`&&ye&&(I(`[print.ts] Auto-resuming interrupted turn (kind: ${y.kind})`),ts(k,y.message),J({mode:`prompt`,value:y.message.message.content,uuid:Y()}));let be=nn().map(e=>{let t=e.value===null?`default`:e.value,n=t===`default`?ie():w(t),r=ui(n),i=gr(n),a=pe(e.value),o=he(n);return{name:t,value:t,displayName:e.label,description:e.description,...r&&{supportsEffort:!0,supportedEffortLevels:Hr(n)?[...Mn]:Mn.filter(e=>e!==`max`)},...i&&{supportsAdaptiveThinking:!0},...a&&{supportsFastMode:!0},...o&&{supportsAutoMode:!0}}}),Se=v.userSpecifiedModel;function Ce(e,t){let n=Qr(e,de(t));k.push(...n);for(let e of n)typeof e.message.content==`string`&&e.message.content.includes(`<local-command-stdout>`)&&D.enqueue({type:`user`,content:e.message.content,message:e.message,session_id:u(),parent_tool_use_id:null,uuid:e.uuid,timestamp:e.timestamp,isReplay:!0})}let j=[],we=[],Te=new Set;function Ee(t){for(let n of t){if(n.type!==`connected`||Te.has(n.name)||n.config.type===`sdk`)continue;let t=n.name;try{n.client.setRequestHandler(l,async(n,r)=>{Ye(t,`Elicitation request received in print mode: ${P(n)}`);let i=n.params.mode===`url`?`url`:`form`;z(`tengu_mcp_elicitation_shown`,{mode:i});let a=await ar(t,n.params,r.signal);if(a)return Ye(t,`Elicitation resolved by hook: ${P(a)}`),z(`tengu_mcp_elicitation_response`,{mode:i,action:a.action}),a;let o=`url`in n.params?n.params.url:void 0,s=`requestedSchema`in n.params?n.params.requestedSchema:void 0,c=`elicitationId`in n.params?n.params.elicitationId:void 0,l=await Pr(t,await e.handleElicitation(t,n.params.message,s,r.signal,i,o,c),r.signal,i,c);return z(`tengu_mcp_elicitation_response`,{mode:i,action:l.action}),l}),n.client.setNotificationHandler(c,e=>{let{elicitationId:n}=e.params;Ye(t,`Elicitation completion notification: ${n}`),jn({message:`MCP server "${t}" confirmed elicitation ${n} complete`,notificationType:`elicitation_complete`}),D.enqueue({type:`system`,subtype:`elicitation_complete`,mcp_server_name:t,elicitation_id:n,uuid:Y(),session_id:u()})}),Te.add(t)}catch{}}}async function De(){let t=new Set(Object.keys(h)),n=new Set(j.map(e=>e.name)),r=Array.from(t).some(e=>!n.has(e)),i=Array.from(n).some(e=>!t.has(e)),a=j.some(e=>e.type===`pending`),o=j.some(e=>e.type===`failed`);if(r||i||a||o){for(let e of j)t.has(e.name)||e.type===`connected`&&await e.cleanup();let r=await an(h,(t,n)=>e.sendMcpMessage(t,n));j=r.clients,we=r.tools;let i=nt([...n,...t]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!i.some(t=>e.name.startsWith(Oe(t)))),...we]}})),dt(j)}}De();let M={clients:[],tools:[],configs:{}},Ae=e=>{let t=Dn(e.toolPermissionContext,e.mcp.tools),n=ve($a([...o,...we,...M.tools],t,e.toolPermissionContext.mode),`name`);v.permissionPromptToolName&&(n=n.filter(e=>!Li(e,v.permissionPromptToolName)));let r=p();if(r&&!v.jsonSchema){let e=Ui(r);`tool`in e&&(n=[...n,e.tool])}return n},N=null,je=0;function Me(){if(!N)return;let e=Math.min(je,k.length),t=k.slice(e).filter(e=>e.type===`user`||e.type===`assistant`);je=k.length,t.length>0&&N.writeMessages(t)}let Pe=Promise.resolve({response:{added:[],removed:[],errors:{}},sdkServersChanged:!1});function Fe(e){let t=async()=>{let t=new Set(j.map(e=>e.name)),n=await os(e,{configs:h,clients:j,tools:we},M,_);for(let e of Object.keys(h))delete h[e];if(Object.assign(h,n.newSdkState.configs),j=n.newSdkState.clients,we=n.newSdkState.tools,M=n.newDynamicState,n.sdkServersChanged){let e=new Set(j.map(e=>e.name)),n=nt([...t,...e]);_(e=>({...e,mcp:{...e.mcp,tools:[...e.mcp.tools.filter(e=>!n.some(t=>e.name.startsWith(Oe(t)))),...we]}}))}return{response:n.response,sdkServersChanged:n.sdkServersChanged}};return Pe=Pe.then(t,t),Pe}function Le(){let e=g(),t=e.mcp.clients,n=ve([...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`?zn(n,e.name).map(e=>({name:e.mcpInfo?.toolName??e.name,annotations:{readOnly:e.isReadOnly({})||void 0,destructive:e.isDestructive?.({})||void 0,openWorld:e.isOpenWorld?.({})||void 0}})):void 0,i;if(e.type===`connected`&&e.capabilities.experimental){let t={...e.capabilities.experimental};t[`claude/channel`]&&(!Fa()||!Pa(e.config.pluginSource))&&delete t[`claude/channel`],Object.keys(t).length>0&&(i={experimental:t})}return{name:e.name,status:e.type,serverInfo:e.type===`connected`?e.serverInfo:void 0,error:e.type===`failed`?e.error:void 0,config:t,scope:e.config.scope,tools:r,capabilities:i}})}async function Re(){try{await Promise.all([Promise.resolve(),Ke(`headless_managed_settings_wait`,()=>hn())]),await No()&&await He()}catch(e){W(e)}}let ze=null;t()||(i(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)?ze=Re():Re());let Be=Eo(()=>!x),L=a,R=te;async function Ve(){let{agentDefinitions:e}=await uo(_);L=await Pt(X());let t=R.filter(e=>e.source===`flagSettings`);R=[...e.allAgents,...t]}async function He(){let{servers:e}=await Yr(),t={};for(let[n,r]of Object.entries(e)){let e=r.type;(e===void 0||e===`stdio`||e===`sse`||e===`http`||e===`sdk`)&&(t[n]=r)}for(let[e,n]of Object.entries(h))n.type===`sdk`&&!(e in t)&&(t[e]=n);let{response:n,sdkServersChanged:r}=await Fe(t);r&&De(),I(`Headless MCP refresh: added=${n.added.length}, removed=${n.removed.length}`)}let Ue=lo.subscribe(()=>{Fi(),Pt(X()).then(e=>{L=e})}),We=()=>{setTimeout(()=>{!$?.isProactiveActive()||$.isProactivePaused()||C||(async()=>{let e=await Nn({basePrompt:`<${qe}>${new Date().toLocaleTimeString()}</${qe}>`,currentDir:X(),shouldCreate:()=>!C});if(C){await pn({commands:e});return}for(let t of e)J({...t,uuid:Y()});B()})().catch(e=>{W(e),I(`[Proactive] failed to create headless tick: ${e}`,{level:`error`})})},0)};bt(()=>{E&&wr(`now`).length>0&&E.abort(`interrupt`)});let B=async()=>{if(x)return;if(x=!0,S=void 0,ca(`running`),Be.stop(),q(`run_entry`),await De(),q(`after_updateSdkMcp`),ze){let e=parseInt(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL_TIMEOUT_MS||``,10);if(e>0){let t=ct(e).then(()=>`timeout`);await Promise.race([ze,t])===`timeout`&&(W(Error(`CLAUDE_CODE_SYNC_PLUGIN_INSTALL: plugin installation timed out after ${e}ms`)),z(`tengu_sync_plugin_install_timeout`,{timeout_ms:e}))}else await ze;ze=null,await Ve();let{setupPluginHookHotReload:t}=await import(`./loadPluginHooks-CL5aGDrb.js`);t()}let t=e=>e.agentId===void 0;try{let r,i=!1,a=async()=>{for(;r=sr(t);){if(r.mode!==`prompt`&&r.mode!==`orphaned-permission`&&r.mode!==`task-notification`)throw Error(`only prompt commands are supported in streaming mode`);let i=[r];if(r.mode===`prompt`)for(;Wo(r,tr(t));)i.push(sr(t));let a=await Pi(i);if(i=a.attachmentCommands,i.length===0)continue;r=i[0],r.mode===`prompt`&&i.length>1&&(r={...r,value:Uo(i.map(e=>e.value)),uuid:i.findLast(e=>e.uuid)?.uuid??r.uuid});let o=i.map(e=>e.uuid).filter(e=>e!==void 0);if(v.replayUserMessages&&i.length>1)for(let e of i)e.uuid&&e.uuid!==r.uuid&&D.enqueue({type:`user`,content:e.value,message:{role:`user`,content:e.value},session_id:u(),parent_tool_use_id:null,uuid:e.uuid,isReplay:!0});let s=g(),c=[...s.mcp.clients,...j,...M.clients];Ee(c);for(let e of c)$o(e);let l=Ae(s);for(let e of o)It(e,`started`);if(r.mode===`task-notification`){let e=typeof r.value==`string`?r.value:``,t=e.match(/<task-id>([^<]+)<\/task-id>/),n=e.match(/<tool-use-id>([^<]+)<\/tool-use-id>/),i=e.match(/<output-file>([^<]+)<\/output-file>/),a=e.match(/<status>([^<]+)<\/status>/),o=e.match(/<summary>([^<]+)<\/summary>/),s=e=>e===`completed`||e===`failed`||e===`stopped`||e===`killed`,c=a?.[1],l=s(c)?c===`killed`?`stopped`:c:`completed`,d=e.match(/<usage>([\s\S]*?)<\/usage>/)?.[1]??``,f=d.match(/<total_tokens>(\d+)<\/total_tokens>/),p=d.match(/<tool_uses>(\d+)<\/tool_uses>/),m=d.match(/<duration_ms>(\d+)<\/duration_ms>/);a&&D.enqueue({type:`system`,subtype:`task_notification`,task_id:t?.[1]??``,tool_use_id:n?.[1],status:l,output_file:i?.[1]??``,summary:o?.[1]??``,usage:f&&p?{total_tokens:parseInt(f[1],10),tool_uses:parseInt(p[1],10),duration_ms:m?parseInt(m[1],10):0}:void 0,session_id:u(),uuid:Y()})}let d=r.value,f=a.claimedCommands;if(e instanceof bo&&r.mode===`prompt`&&z(`tengu_bridge_message_received`,{is_repl:!1}),O.abortController?.abort(),O.abortController=null,O.pendingSuggestion=null,O.pendingLastEmittedEntry=null,O.lastEmitted&&r.mode===`prompt`){let e=typeof d==`string`?d:d.find(e=>e.type===`text`)?.text;typeof e==`string`&&Bt(O.lastEmitted.text,e,O.lastEmitted.emittedAt,O.lastEmitted.promptId,O.lastEmitted.generationRequestId),O.lastEmitted=null}E=xi(),q(`before_ask`),Qn();let h=r,ee=!1;try{if(await xe(h.workload??v.workload,async()=>{for await(let t of to({commands:ve([...L,...s.mcp.commands],`name`),prompt:d,promptUuid:h.uuid,isMeta:h.isMeta,cwd:X(),tools:l,verbose:v.verbose,mcpClients:c,thinkingConfig:v.thinkingConfig,maxTurns:v.maxTurns,maxBudgetUsd:v.maxBudgetUsd,taskBudget:v.taskBudget,canUseTool:m,userSpecifiedModel:Se,fallbackModel:v.fallbackModel,jsonSchema:p()??v.jsonSchema,mutableMessages:k,getReadFileCache:()=>_e.size===0?A:Zi(A,_e),setReadFileCache:e=>{A=e;for(let[e,t]of _e.entries()){let n=A.get(e);(!n||t.timestamp>n.timestamp)&&A.set(e,t)}_e.clear()},customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,getAppState:g,setAppState:_,abortController:E,replayUserMessages:v.replayUserMessages,includePartialMessages:v.includePartialMessages,handleElicitation:(t,n,r)=>e.handleElicitation(t,n.message,void 0,r,n.mode,n.url,`elicitationId`in n?n.elicitationId:void 0),agents:R,orphanedPermission:h.orphanedPermission,setSDKStatus:e=>{D.enqueue({type:`system`,subtype:`status`,status:e,session_id:u(),uuid:Y()})}}))if(Me(),t.type===`result`){ee=!!t.is_error;for(let e of Qi())D.enqueue(e);er(g()).some(e=>(e.type===`local_agent`||e.type===`local_workflow`)&&cn(e))?se=t:(se=null,D.enqueue(t))}else{for(let e of Qi())D.enqueue(e);D.enqueue(t)}}),ee)await ht({commands:f,outcome:{type:`failed`,message:`ask() returned an error result`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});else{let e=await ht({commands:f,outcome:{type:`completed`},currentDir:X(),priority:`later`,workload:h.workload??v.workload});for(let t of e)J({...t,uuid:Y()})}}catch(e){throw await ht({commands:f,outcome:{type:`failed`,error:e},currentDir:X(),priority:`later`,workload:h.workload??v.workload}),e}for(let e of o)It(e,`completed`);if(Me(),N?.sendResult(),v.promptSuggestions&&!n(process.env.CLAUDE_CODE_ENABLE_PROMPT_SUGGESTION)){O.abortController?.abort();let e=new AbortController;O.abortController=e;let t=kr();if(!t)Vn(`sdk_no_params`,void 0,void 0,`sdk`);else{let n={promise:null};n.promise=(async()=>{try{let n=await Un(e,k,g,t,`sdk`);if(!n||e.signal.aborted)return;let r={type:`prompt_suggestion`,suggestion:n.suggestion,uuid:Y(),session_id:u()},i={text:n.suggestion,emittedAt:Date.now(),promptId:n.promptId,generationRequestId:n.generationRequestId};se?(O.pendingSuggestion=r,O.pendingLastEmittedEntry={text:i.text,promptId:i.promptId,generationRequestId:i.generationRequestId}):(O.lastEmitted=i,D.enqueue(r))}catch(e){if(e instanceof Error&&(e.name===`AbortError`||e.name===`APIUserAbortError`)){Vn(`aborted`,void 0,void 0,`sdk`);return}W(Ne(e))}finally{O.inflightPromise===n.promise&&(O.inflightPromise=null)}})(),O.inflightPromise=n.promise}}on(),ii(),Yt()}};do{for(let e of Qi())D.enqueue(e);S=`draining_commands`,await a(),i=!1;{let e=er(g()).some(e=>cn(e)&&e.type!==`in_process_teammate`),n=tr(t)!==void 0;(e||n)&&(i=!0,n||(S=`waiting_for_agents`,await ct(100)))}}while(i);se&&(D.enqueue(se),se=null,O.pendingSuggestion&&(D.enqueue(O.pendingSuggestion),O.pendingLastEmittedEntry&&(O.lastEmitted={...O.pendingLastEmittedEntry,emittedAt:Date.now()},O.pendingLastEmittedEntry=null),O.pendingSuggestion=null))}catch(t){try{await e.write({type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[F(t),...Xe().map(e=>e.error)]})}catch{}O.abortController?.abort(),K(1);return}finally{if(S=`finally_flush`,await e.flushInternalEvents(),S=`finally_post_flush`,!In()){ca(`idle`);for(let e of Qi())D.enqueue(e)}x=!1,Be.start()}if($?.isProactiveActive()&&!$.isProactivePaused()&&tr(t)===void 0&&!C){We();return}if(tr(t)!==void 0){B();return}{let e=g().teamContext;if(e&&it(e)){let e=`team-lead`;for(;;){let t=g();if(!(st(t)||t.teamContext&&Object.keys(t.teamContext.teammates).length>0)){I(`[print.ts] No more active teammates, stopping poll`);break}let n=await li(e,t.teamContext?.teamName);if(n.length>0){I(`[print.ts] Team-lead found ${n.length} unread messages`),await pr(e,t.teamContext?.teamName);let r=t.teamContext?.teamName;for(let e of n){let n=Wn(e.text);if(n&&r){let e=n.from;I(`[print.ts] Processing shutdown_approved from ${e}`);let i=t.teamContext?.teammates?Object.entries(t.teamContext.teammates).find(([,t])=>t.name===e)?.[0]:void 0;i&&(va(r,{agentId:i,name:e}),I(`[print.ts] Removed ${e} from team file`),await ga(r,i,e,`shutdown`),_(e=>{if(!e.teamContext?.teammates||!(i in e.teamContext.teammates))return e;let{[i]:t,...n}=e.teamContext.teammates;return{...e,teamContext:{...e.teamContext,teammates:n}}}))}}J({mode:`prompt`,value:n.map(e=>`<${Je} teammate_id="${e.from}"${e.color?` color="${e.color}"`:``}>\n${e.text}\n</${Je}>`).join(`
32
-
33
- `),uuid:Y()}),B();return}if(C&&!re){re=!0,I(`[print.ts] Input closed with active teammates, injecting shutdown prompt`),J({mode:`prompt`,value:Lo,uuid:Y()}),B();return}await ct(500)}}}C&&(await(async()=>{let e=g();rt(e)&&await ot(_,e);let t=g(),n=t.teamContext;return n&&Object.keys(n.teammates).length>0||st(t)})()?(J({mode:`prompt`,value:Lo,uuid:Y()}),B()):(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await $t(),Ue(),fe?.(),pt.delete(me),D.done()))},V=null;if(Io.isKairosCronEnabled()){let e=e=>{C||(async()=>{let t=await Cn({basePrompt:e.basePrompt,trigger:`scheduled-task`,currentDir:X(),sourceId:e.sourceId,sourceLabel:e.sourceLabel,workload:oe,shouldCreate:()=>!C});if(t){if(C){await pn({commands:[t]});return}await e.onSuccess(t)}})().catch(t=>{W(t),I(`[ScheduledTasks] failed to enqueue headless task${e.logSuffix}: ${t}`,{level:`error`})})},t=e=>{J({...e,uuid:Y()}),B()};V=Po.createCronScheduler({onFire:n=>{e({basePrompt:n,sourceId:n,sourceLabel:n,logSuffix:``,onSuccess:t})},onFireTask:n=>{if(n.agentId){e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:async e=>{await un(e.autonomy.runId,`No teammate runtime available for scheduled task owner ${n.agentId} in headless mode.`,e.autonomy.rootDir)}});return}e({basePrompt:n.prompt,sourceId:n.id,sourceLabel:n.prompt,logSuffix:` ${n.id}`,onSuccess:t})},isLoading:()=>x||C,getJitterConfig:Fo?.getCronJitterConfig,isKilled:()=>!Io?.isKairosCronEnabled()}),V.start()}let H=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e.request_id,response:t}})},U=function(e,t){D.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e.request_id,error:t}})},Ze=new Set;e.setUnexpectedResponseCallback(async e=>{await is({message:e,setAppState:_,handledToolUseIds:Ze,onEnqueued:()=>{B()}})});let Qe=new Map,et=new Map,tt=new Set,at=new Map,G=null;return(async()=>{let t=!1;Ge(`info`,`cli_message_loop_started`);for await(let n of e.structuredInput){let i=`uuid`in n?n.uuid:void 0;if(i&&n.type!==`user`&&n.type!==`control_response`&&It(i,`completed`),n.type===`control_request`){let i=n,o=i.request;if(i.request.subtype===`interrupt`)_(e=>({...e,attribution:{...e.attribution,escapeCount:e.attribution.escapeCount+1}})),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);else if(o.subtype===`end_session`){I(`[print.ts] end_session received, reason=${o.reason??`unspecified`}`),E&&E.abort(),O.abortController?.abort(),O.abortController=null,O.lastEmitted=null,O.pendingSuggestion=null,H(i);break}else if(i.request.subtype===`initialize`){if(i.request.sdkMcpServers&&i.request.sdkMcpServers.length>0)for(let e of i.request.sdkMcpServers)h[e]={type:`sdk`,name:e};await Yo(i.request,i.request_id,t,D,a,be,e,!!v.enableAuthStatus,v,te,g),i.request.promptSuggestions&&_(e=>e.promptSuggestionEnabled?e:{...e,promptSuggestionEnabled:!0}),i.request.agentProgressSummaries&&ge(`tengu_slate_prism`,!0)&&ee(!0),t=!0,yr()&&B()}else if(i.request.subtype===`set_permission_mode`){let e=i.request;_(t=>({...t,toolPermissionContext:Zo(e,i.request_id,t.toolPermissionContext,D),isUltraplanMode:e.ultraplan??t.isUltraplanMode}))}else if(i.request.subtype===`set_model`){let e=i.request.model??`default`,t=e===`default`?ie():e;Se=t,b(t),la({model:t}),Ce(e,t),H(i)}else if(i.request.subtype===`set_max_thinking_tokens`)i.request.max_thinking_tokens===null?v.thinkingConfig=void 0:i.request.max_thinking_tokens===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:i.request.max_thinking_tokens},H(i);else if(i.request.subtype===`mcp_status`)H(i,{mcpServers:Le()});else if(i.request.subtype===`get_context_usage`)try{let e=g();H(i,{...await ao({messages:k,getAppState:g,options:{mainLoopModel:ae(),tools:Ae(e),agentDefinitions:e.agentDefinitions,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt}})})}catch(e){U(i,F(e))}else if(i.request.subtype===`mcp_message`){let e=i.request,t=j.find(t=>t.name===e.server_name);t&&t.type===`connected`&&t.client?.transport?.onmessage&&t.client.transport.onmessage(e.message),H(i)}else if(i.request.subtype===`rewind_files`){let e=g(),t=await Xo(i.request.user_message_id,e,_,i.request.dry_run??!1);t.canRewind||i.request.dry_run?H(i,t):U(i,t.error??`Unexpected error`)}else if(i.request.subtype===`cancel_async_message`){let e=i.request.message_uuid;H(i,{cancelled:Ir(t=>t.uuid===e).length>0})}else if(i.request.subtype===`seed_read_state`){try{let e=$e(i.request.path),t=Math.floor((await _o(e)).mtimeMs);if(t<=i.request.mtime){let n=await go(e,`utf-8`),r=(n.charCodeAt(0)===65279?n.slice(1):n).replaceAll(`\r
34
- `,`
35
- `);_e.set(e,{content:r,timestamp:t,offset:void 0,limit:void 0})}}catch{}H(i)}else if(i.request.subtype===`mcp_set_servers`){let{response:e,sdkServersChanged:t}=await Fe(i.request.servers);H(i,e),t&&De()}else if(i.request.subtype===`reload_plugins`)try{let e=await uo(_),t=R.filter(e=>e.source===`flagSettings`);R=[...e.agentDefinitions.allAgents,...t];let n=[],[r,a,o]=await Promise.allSettled([Pt(X()),He(),Vr()]);r.status===`fulfilled`?L=r.value:W(r.reason),a.status===`rejected`&&W(a.reason),o.status===`fulfilled`?n=o.value.enabled.map(e=>({name:e.name,path:e.path,source:e.source})):W(o.reason),H(i,{commands:L.filter(e=>e.userInvocable!==!1).map(e=>({name:Lr(e),description:Ft(e),argumentHint:e.argumentHint||``})),agents:R.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),plugins:n,mcpServers:Le(),error_count:e.error_count})}catch(e){U(i,F(e))}else if(i.request.subtype===`mcp_reconnect`){let e=g(),{serverName:t}=i.request;Te.delete(t);let n=lr(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!n)U(i,`Server not found: ${t}`);else{let e=await Et(t,n),r=Oe(t);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...e.tools],commands:[...T(n.mcp.commands,e=>Ni(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...n.mcp.resources,[t]:e.resources}:le(n.mcp.resources,t)}})),M={...M,clients:[...M.clients.filter(e=>e.name!==t),e.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...e.tools]},e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}}else if(i.request.subtype===`mcp_toggle`){let e=g(),{serverName:t,enabled:n}=i.request;Te.delete(t);let a=lr(t)??r.find(e=>e.name===t)?.config??j.find(e=>e.name===t)?.config??M.clients.find(e=>e.name===t)?.config??e.mcp.clients.find(e=>e.name===t)?.config??null;if(!a)U(i,`Server not found: ${t}`);else if(n){Sr(t,!0);let e=await Et(t,a),n=Oe(t);_(r=>({...r,mcp:{...r.mcp,clients:r.mcp.clients.map(n=>n.name===t?e.client:n),tools:[...T(r.mcp.tools,e=>e.name?.startsWith(n)),...e.tools],commands:[...T(r.mcp.commands,e=>Ni(e,t)),...e.commands],resources:e.resources&&e.resources.length>0?{...r.mcp.resources,[t]:e.resources}:le(r.mcp.resources,t)}})),e.client.type===`connected`?(Ee([e.client]),$o(e.client),H(i)):U(i,e.client.type===`failed`?e.client.error??`Connection failed`:`Server status: ${e.client.type}`)}else{Sr(t,!1);let n=[...r,...j,...M.clients,...e.mcp.clients].find(e=>e.name===t);n&&n.type===`connected`&&await vi(t,a);let o=Oe(t);_(e=>({...e,mcp:{...e.mcp,clients:e.mcp.clients.map(e=>e.name===t?{name:t,type:`disabled`,config:a}:e),tools:T(e.mcp.tools,e=>e.name?.startsWith(o)),commands:T(e.mcp.commands,e=>Ni(e,t)),resources:le(e.mcp.resources,t)}})),H(i)}}else if(o.subtype===`channel_enable`){let e=g();Qo(i.request_id,o.serverName,[...e.mcp.clients,...j,...M.clients],D)}else if(o.subtype===`mcp_authenticate`){let e=o.serverName,t=g(),n=lr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Server type "${n.type}" does not support OAuth authentication`);else try{Qe.get(e)?.abort();let t=new AbortController;Qe.set(e,t);let r,a=new Promise(e=>{r=e}),o=bi(e,n,e=>r(e),t.signal,{skipBrowserOpen:!0,onWaitingForCallback:t=>{et.set(e,t)}}),s=await Promise.race([a,o.then(()=>null)]);s?H(i,{authUrl:s,requiresUserAction:!0}):H(i,{requiresUserAction:!1}),at.set(e,o),o.then(async()=>{if(vr(e)||tt.has(e))return;let t=await Et(e,n),r=Oe(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Ni(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),M={...M,clients:[...M.clients.filter(t=>t.name!==e),t.client],tools:[...M.tools.filter(e=>!e.name?.startsWith(r)),...t.tools]}}).catch(t=>{I(`MCP OAuth failed for ${e}: ${t}`,{level:`error`})}).finally(()=>{Qe.get(e)===t&&(Qe.delete(e),et.delete(e),tt.delete(e),at.delete(e))})}catch(e){U(i,F(e))}}else if(o.subtype===`mcp_oauth_callback_url`){let e=o.serverName,t=o.callbackUrl,n=et.get(e);if(n){let r=!1;try{let e=new URL(t);r=e.searchParams.has(`code`)||e.searchParams.has(`error`)}catch{}if(!r)U(i,`Invalid callback URL: missing authorization code. Please paste the full redirect URL including the code parameter.`);else{tt.add(e),n(t);let r=at.get(e);if(r)try{await r,H(i)}catch(e){U(i,e instanceof Error?e.message:`OAuth authentication failed`)}else H(i)}}else U(i,`No active OAuth flow for server: ${e}`)}else if(o.subtype===`claude_authenticate`){let e=o.loginWithClaudeAi;G?.service.cleanup(),z(`tengu_oauth_flow_start`,{loginWithClaudeAi:e??!0});let t=new Si,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 nr(t),z(`tengu_oauth_success`,{loginWithClaudeAi:e??!0})}).finally(()=>{t.cleanup(),G?.service===t&&(G=null)});G={service:t,flow:a},a.catch(e=>I(`claude_authenticate flow ended: ${e}`,{level:`info`}));try{let{manualUrl:e,automaticUrl:t}=await Promise.race([r,a.then(()=>{throw Error(`OAuth flow completed without producing auth URLs`)})]);H(i,{manualUrl:e,automaticUrl:t})}catch(e){U(i,F(e))}}else if(o.subtype===`claude_oauth_callback`||o.subtype===`claude_oauth_wait_for_completion`)if(!G)U(i,`No active claude_authenticate flow`);else{o.subtype===`claude_oauth_callback`&&G.service.handleManualAuthCodeInput({authorizationCode:o.authorizationCode,state:o.state});let{flow:e}=G;e.then(()=>{let e=ne();H(i,{account:{email:e?.email,organization:e?.organization,subscriptionType:e?.subscription,tokenSource:e?.tokenSource,apiKeySource:e?.apiKeySource,apiProvider:ue()}})},e=>U(i,F(e)))}else if(o.subtype===`mcp_clear_auth`){let e=o.serverName,t=g(),n=lr(e)??r.find(t=>t.name===e)?.config??t.mcp.clients.find(t=>t.name===e)?.config??null;if(!n)U(i,`Server not found: ${e}`);else if(n.type!==`sse`&&n.type!==`http`)U(i,`Cannot clear auth for server type "${n.type}"`);else{await Dt(e,n);let t=await Et(e,n),r=Oe(e);_(n=>({...n,mcp:{...n.mcp,clients:n.mcp.clients.map(n=>n.name===e?t.client:n),tools:[...T(n.mcp.tools,e=>e.name?.startsWith(r)),...t.tools],commands:[...T(n.mcp.commands,t=>Ni(t,e)),...t.commands],resources:t.resources&&t.resources.length>0?{...n.mcp.resources,[e]:t.resources}:le(n.mcp.resources,e)}})),H(i,{})}}else if(i.request.subtype===`apply_flag_settings`){let e=ae(),t=d()??{},n=i.request.settings,r={...t,...n};for(let e of Object.keys(r))r[e]===null&&delete r[e];f(r),mi.notifyChange(`flagSettings`),`model`in n&&(n.model==null?b(void 0):b(String(n.model)));let a=ae();if(a!==e){Se=a;let e=n.model?String(n.model):`default`;la({model:a}),Ce(e,a)}H(i)}else if(i.request.subtype===`get_settings`){let e=g(),t=ae(),n=ui(t)?Xn(t,e.effortValue):void 0;H(i,{...ke(),applied:{model:t,effort:typeof n==`string`?n:null}})}else if(i.request.subtype===`stop_task`){let{task_id:e}=i.request;try{await Dr(e,{getAppState:g,setAppState:_}),H(i,{})}catch(e){U(i,F(e))}}else if(o.subtype===`generate_session_title`){let e=o.description,t=o.persist,n=(E&&!E.signal.aborted?E:xi()).signal;(async()=>{try{let r=await wa(e,n);if(r&&t)try{xr(u(),r)}catch(e){W(e)}H(i,{title:r})}catch(e){U(i,F(e))}})()}else if(o.subtype===`side_question`){let e=o.question;(async()=>{try{let t=kr();H(i,{response:(await io({question:e,cacheSafeParams:t?{...t,toolUseContext:{...t.toolUseContext,abortController:xi()}}:await no({tools:Ae(g()),commands:L,mcpClients:[...g().mcp.clients,...j,...M.clients],messages:k,readFileState:A,getAppState:g,setAppState:_,customSystemPrompt:v.systemPrompt,appendSystemPrompt:v.appendSystemPrompt,thinkingConfig:v.thinkingConfig,agents:R})})).response})}catch(e){U(i,F(e))}})()}else if(i.request.subtype===`set_proactive`)i.request.enabled?$.isProactiveActive()||($.activateProactive(`command`),We()):$.deactivateProactive(),H(i);else if(o.subtype===`remote_control`)if(o.enabled)if(N)H(i,{session_url:si(N.bridgeSessionId,N.sessionIngressUrl),connect_url:ci(N.environmentId,N.sessionIngressUrl),environment_id:N.environmentId});else{let t;try{let{initReplBridge:n}=await import(`./initReplBridge-tXqkba08.js`),r=await n({onInboundMessage(e){let t=qa(e);if(!t)return;let{content:n,uuid:r}=t;J({value:n,mode:`prompt`,uuid:r,skipSlashCommands:!0}),B()},onPermissionResponse(t){e.injectControlResponse(t)},onInterrupt(){E?.abort()},onSetModel(e){let t=e===`default`?ie():e;Se=t,b(t)},onSetMaxThinkingTokens(e){e===null?v.thinkingConfig=void 0:e===0?v.thinkingConfig={type:`disabled`}:v.thinkingConfig={type:`enabled`,budgetTokens:e}},onStateChange(e,n){e===`failed`&&(t=n),I(`[bridge:sdk] State change: ${e}${n?` — ${n}`:``}`),D.enqueue({type:`system`,subtype:`bridge_state`,state:e,detail:n,uuid:Y(),session_id:u()})},initialMessages:k.length>0?k:void 0});r?(N=r,je=k.length,e.setOnControlRequestSent(e=>{r.sendControlRequest(e)}),e.setOnControlRequestResolved(e=>{r.sendControlCancelRequest(e)}),H(i,{session_url:si(r.bridgeSessionId,r.sessionIngressUrl),connect_url:ci(r.environmentId,r.sessionIngressUrl),environment_id:r.environmentId})):U(i,t??`Remote Control initialization failed`)}catch(e){U(i,F(e))}}else N&&(e.setOnControlRequestSent(void 0),e.setOnControlRequestResolved(void 0),await N.teardown(),N=null),H(i);else U(i,`Unsupported control request subtype: ${i.request.subtype}`);continue}else if(n.type===`control_response`){v.replayUserMessages&&D.enqueue(n);continue}else if(n.type===`keep_alive`)continue;else if(n.type===`update_environment_variables`)continue;else if(n.type===`assistant`||n.type===`system`){let e=xa([n]);k.push(...e),n.type===`assistant`&&v.replayUserMessages&&D.enqueue(n);continue}if(n.type!==`user`)continue;let o=n;if(t=!0,o.uuid){let e=u(),t=await Or(e,o.uuid);if(t||zo.has(o.uuid)){I(`Skipping duplicate user message: ${o.uuid}`),v.replayUserMessages&&(I(`Sending acknowledgment for duplicate user message: ${o.uuid}`),D.enqueue({type:`user`,content:o.message?.content??``,message:o.message,session_id:e,parent_tool_use_id:null,uuid:o.uuid,timestamp:o.timestamp,isReplay:!0})),t&&It(o.uuid,`completed`);continue}Vo(o.uuid)}J({mode:`prompt`,value:await ba(o,o.message.content),uuid:o.uuid,priority:o.priority}),_(e=>({...e,attribution:pa(e.attribution,e=>{ft(e).catch(e=>{I(`Attribution: Failed to save snapshot: ${e}`)})})})),B()}C=!0,V?.stop(),x||(O.inflightPromise&&await Promise.race([O.inflightPromise,ct(5e3)]),O.abortController?.abort(),O.abortController=null,await $t(),Ue(),fe?.(),pt.delete(me),D.done())})(),D}function qo(e){let t=async(n,r,i,a,o,s)=>{let c=s??await Nt(n,r,i,a,o);if(c.behavior===`allow`||c.behavior===`deny`)return c;let{signal:l,cleanup:u}=xt(i.abortController.signal);if(l.aborted)return u(),{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let d=new Promise(e=>{l.addEventListener(`abort`,()=>e(`aborted`),{once:!0})}),f=e.call({tool_name:n.name,input:r,tool_use_id:o},i,t,a),p=await Promise.race([f,d]);if(u(),p===`aborted`||l.aborted)return{behavior:`deny`,message:`Permission prompt was aborted.`,decisionReason:{type:`permissionPromptTool`,permissionPromptToolName:n.name,toolResult:void 0}};let m=p,h=e.mapToolResultToToolResultBlockParam(m.data,`1`);if(!h.content||!Array.isArray(h.content)||!h.content[0]||h.content[0].type!==`text`||typeof h.content[0].text!=`string`)throw Error(`Permission prompt tool returned an invalid result. Expected a single text block param with type="text" and a string text value.`);return Ja(Xa().parse(tt(h.content[0].text)),e,r,i)};return t}function Jo(e,t,n,r){if(e===`stdio`)return t.createCanUseTool(r);if(!e)return async(e,t,n,r,i,a)=>a??await Nt(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=>Li(t,e));if(!r){let n=`Error: MCP tool ${e} (passed via --permission-prompt-tool) not found. Available MCP tools: ${t.map(e=>e.name).join(`, `)||`none`}`;throw process.stderr.write(`${n}\n`),K(1),Error(n)}if(!r.inputJSONSchema){let t=`Error: tool ${e} (passed via --permission-prompt-tool) must be an MCP tool`;throw process.stderr.write(`${t}\n`),K(1),Error(t)}i=qo(r)}return i(t,r,a,o,s,c)}}async function Yo(e,t,n,r,i,a,o,s,c,l,d){if(n){r.enqueue({type:`control_response`,response:{subtype:`error`,error:`Already initialized`,request_id:t,pending_permission_requests:o.getPendingPermissionRequests()}});return}if(e.systemPrompt!==void 0&&(c.systemPrompt=e.systemPrompt),e.appendSystemPrompt!==void 0&&(c.appendSystemPrompt=e.appendSystemPrompt),e.promptSuggestions!==void 0&&(c.promptSuggestions=e.promptSuggestions),e.agents){let t=Xr(e.agents,`flagSettings`);l.push(...t)}if(c.agent){let e=x()===c.agent,t=l.find(e=>e.agentType===c.agent);if(t&&!e){if(y(t.agentType),!c.systemPrompt&&!oi(t)){let e=t.getSystemPrompt();e&&(c.systemPrompt=e)}!c.userSpecifiedModel&&t.model&&t.model!==`inherit`&&b(w(t.model)),t.initialPrompt&&o.prependUserMessage(t.initialPrompt)}else t?.initialPrompt&&o.prependUserMessage(t.initialPrompt)}let f=j()?.outputStyle||`default`,p=await Zn(Ue()),m=ne();if(e.hooks){let t={};for(let[n,r]of Object.entries(e.hooks))t[n]=r.map(e=>{let t=e.hookCallbackIds.map(t=>o.createHookCallback(t,e.timeout));return{matcher:e.matcher,hooks:t}});g(t)}e.jsonSchema&&h(e.jsonSchema);let ee={commands:i.filter(e=>e.userInvocable!==!1).map(e=>({name:Lr(e),description:Ft(e),argumentHint:e.argumentHint||``})),agents:l.map(e=>({name:e.agentType,description:e.whenToUse,model:e.model===`inherit`?void 0:e.model})),output_style:f,available_output_styles:Object.keys(p),models:a,account:{email:m?.email,organization:m?.organization,subscriptionType:m?.subscription,tokenSource:m?.tokenSource,apiKeySource:m?.apiKeySource,apiProvider:ue()},pid:process.pid};if(Ae()&&je()){let e=d();ee.fast_mode_state=Ee(c.userSpecifiedModel??null,e.fastMode)}if(r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:ee}}),s){let e=ce.getInstance().getStatus();e&&r.enqueue({type:`auth_status`,isAuthenticating:e.isAuthenticating,output:e.output,error:e.error,uuid:Y(),session_id:u()})}}async function Xo(e,t,n,r){if(!Gn())return{canRewind:!1,error:`File rewinding is not enabled.`,filesChanged:[]};if(!Rn(t.fileHistory,e))return{canRewind:!1,error:`No file checkpoint found for this message.`,filesChanged:[]};if(r){let n=await fn(t.fileHistory,e);return{canRewind:!0,filesChanged:n?.filesChanged??[],insertions:n?.insertions,deletions:n?.deletions}}try{await Wr(e=>n(t=>({...t,fileHistory:e(t.fileHistory)})),e)}catch(e){return{canRewind:!1,error:`Failed to rewind: ${F(e)}`,filesChanged:[]}}return{canRewind:!0,filesChanged:[]}}function Zo(e,t,n,r){if(e.mode===`bypassPermissions`){if(tn())return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because it is disabled by settings or configuration`}}),n;if(!n.isBypassPermissionsModeAvailable)return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:`Cannot set permission mode to bypassPermissions because the session was not launched with --dangerously-skip-permissions`}}),n}if(e.mode===`auto`&&!St()){let e=_n();return r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:t,error:e?`Cannot set permission mode to auto: ${Ti(e)}`:`Cannot set permission mode to auto`}}),n}return r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:t,response:{mode:e.mode}}}),{...At(n.mode,e.mode,n),mode:e.mode}}function Qo(e,t,n,r){let i=t=>r.enqueue({type:`control_response`,response:{subtype:`error`,request_id:e,error:t}}),a=n.find(e=>e.name===t&&e.type===`connected`);if(!a||a.type!==`connected`)return i(`server ${t} is not connected`);let o=a.config.pluginSource,s=o?Ji(o):void 0;if(!s?.marketplace)return i(`server ${t} is not plugin-sourced; channel_enable requires a marketplace plugin`);let c={kind:`plugin`,name:s.name,marketplace:s.marketplace},l=S(),u=l.some(e=>e.kind===`plugin`&&e.name===c.name&&e.marketplace===c.marketplace);u||m([...l,c]);let d=za(t,a.capabilities,o);if(d.action===`skip`)return u||m(l),i(d.reason);let f=`${c.name}@${c.marketplace}`;Ye(t,`Channel notifications registered`),z(`tengu_mcp_channel_enable`,{plugin:f}),a.client.setNotificationHandler(Ra(),async e=>{let{content:n,meta:r}=e.params;Ye(t,`notifications/claude/channel: ${n.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:n.length,meta_key_count:Object.keys(r??{}).length,entry_kind:`plugin`,is_dev:!1,plugin:f}),J({mode:`prompt`,value:Ia(t,n,r),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:t},skipSlashCommands:!0})}),r.enqueue({type:`control_response`,response:{subtype:`success`,request_id:e,response:void 0}})}function $o(e){if(e.type!==`connected`||za(e.name,e.capabilities,e.config.pluginSource).action!==`register`)return;let t=La(e.name,S()),n=t?.kind===`plugin`?`${t.name}@${t.marketplace}`:void 0;Ye(e.name,`Channel notifications re-registered after reconnect`),e.client.setNotificationHandler(Ra(),async r=>{let{content:i,meta:a}=r.params;Ye(e.name,`notifications/claude/channel: ${i.slice(0,80)}`),z(`tengu_mcp_channel_message`,{content_length:i.length,meta_key_count:Object.keys(a??{}).length,entry_kind:t?.kind,is_dev:t?.dev??!1,plugin:n}),J({mode:`prompt`,value:Ia(e.name,i,a),priority:`next`,isMeta:!0,origin:{kind:`channel`,server:e.name},skipSlashCommands:!0})})}function es(e,t){if(t===`stream-json`){let t={type:`result`,subtype:`error_during_execution`,duration_ms:0,duration_api_ms:0,is_error:!0,num_turns:0,stop_reason:null,session_id:u(),total_cost_usd:0,usage:ia,modelUsage:{},permission_denials:[],uuid:Y(),errors:[e]};process.stdout.write(P(t)+`
36
- `)}else process.stderr.write(e+`
37
- `)}function ts(e,t){let n=e.findIndex(e=>e.uuid===t.uuid);n!==-1&&e.splice(n,2)}async function ns(t,n){let r=!v();if(n.continue)try{z(`tengu_continue_print`,{});let i=await Oi(void 0,void 0);if(i){if(Q){let n=Q.matchSessionMode(i.mode);if(n){process.stderr.write(n+`
38
- `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Gr(),e(di));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return n.forkSession||i.sessionId&&(te(Kn(i.sessionId),i.fullPath?po(i.fullPath):null),r&&await dr()),co(i,t),hr(n.forkSession?{...i,worktreeSession:void 0}:i),Q&&_i(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:i.messages,turnInterruptionState:i.turnInterruptionState,agentSetting:i.agentSetting}}}catch(e){return W(e),K(1),{messages:[]}}if(n.teleport)try{if(!vt(`allow_remote_sessions`))throw Error(`Remote sessions are disabled by your organization's policy.`);if(z(`tengu_teleport_print`,{}),typeof n.teleport!=`string`)throw Error(`No session ID provided for teleport`);let{checkOutTeleportedSessionBranch:e,processMessagesForTeleportResume:t,teleportResumeCodeSession:r,validateGitState:i}=await import(`./teleport-B4p8XlAv.js`);await i();let a=await r(n.teleport),{branchError:o}=await e(a.branch);return{messages:t(a.log,o)}}catch(e){return W(e),K(1),{messages:[]}}if(n.resume)try{z(`tengu_resume_print`,{});let a=Do(typeof n.resume==`string`?n.resume:``);if(!a){let e=`Error: --resume requires a valid session ID when used with --print. Usage: claude -p --resume <session-id>`;return typeof n.resume==`string`&&(e+=`. Session IDs must be in UUID format (e.g., 550e8400-e29b-41d4-a716-446655440000). Provided value "${n.resume}" is not a valid UUID`),es(e,n.outputFormat),K(1),{messages:[]}}if(i(process.env.CLAUDE_CODE_USE_CCR_V2)){let[,e]=await Promise.all([rn(a.sessionId),n.restoredWorkerState]);e&&(t(Va(e)),typeof e.model==`string`&&b(e.model))}else a.isUrl&&a.ingressUrl&&i(process.env.ENABLE_SESSION_PERSISTENCE)&&await Nr(a.sessionId,a.ingressUrl);let o=await Oi(a.sessionId,a.jsonlFile||void 0);if(!o||o.messages.length===0)return a.isUrl||i(process.env.CLAUDE_CODE_USE_CCR_V2)?{messages:await(n.sessionStartHooksPromise??xn(`startup`))}:(es(`No conversation found with session ID: ${a.sessionId}`,n.outputFormat),K(1),{messages:[]});if(n.resumeSessionAt){let e=o.messages.findIndex(e=>e.uuid===n.resumeSessionAt);if(e<0)return es(`No message found with message.uuid of: ${n.resumeSessionAt}`,n.outputFormat),K(1),{messages:[]};o.messages=e>=0?o.messages.slice(0,e+1):[]}if(Q){let n=Q.matchSessionMode(o.mode);if(n){process.stderr.write(n+`
39
- `);let{getAgentDefinitionsWithOverrides:r,getActiveAgentsFromList:i}=(Gr(),e(di));r.cache.clear?.();let a=await r(Ue());t(e=>({...e,agentDefinitions:{...a,allAgents:a.allAgents,activeAgents:i(a.allAgents)}}))}}return!n.forkSession&&o.sessionId&&(te(Kn(o.sessionId),o.fullPath?po(o.fullPath):null),r&&await dr()),co(o,t),hr(n.forkSession?{...o,worktreeSession:void 0}:o),Q&&_i(Q.isCoordinatorMode()?`coordinator`:`normal`),{messages:o.messages,turnInterruptionState:o.turnInterruptionState,agentSetting:o.agentSetting}}catch(e){return W(e),es(e instanceof Error?`Failed to resume session: ${e.message}`:`Failed to resume session with --print mode`,n.outputFormat),K(1),{messages:[]}}return{messages:await(n.sessionStartHooksPromise??xn(`startup`))}}function rs(e,t){let n;return n=typeof e==`string`?e.trim()===``?gt([]):gt([P({type:`user`,content:e,uuid:``,session_id:``,message:{role:`user`,content:e},parent_tool_use_id:null})]):e,t.sdkUrl?new bo(t.sdkUrl,n,t.replayUserMessages):new Ga(n,t.replayUserMessages)}async function is({message:e,setAppState:t,onEnqueued:n,handledToolUseIds:r}){let i=e.response;if(i?.subtype===`success`&&i.response?.toolUseID&&typeof i.response.toolUseID==`string`){let e=i.response,t=e.toolUseID;if(!t)return!1;if(I(`handleOrphanedPermissionResponse: received orphaned control_response for toolUseID=${t} request_id=${i.request_id}`),r.has(t))return I(`handleOrphanedPermissionResponse: skipping duplicate orphaned permission for toolUseID=${t} (already handled)`),!1;let a=await Rr(t);return a?(r.add(t),I(`handleOrphanedPermissionResponse: enqueuing orphaned permission for toolUseID=${t} messageID=${a.message.id}`),J({mode:`orphaned-permission`,value:[],orphanedPermission:{permissionResult:e,assistantMessage:a}}),n?.(),!0):(I(`handleOrphanedPermissionResponse: no unresolved tool_use found for toolUseID=${t} (already resolved in transcript)`),!1)}return!1}function as(e){return{...e,scope:`dynamic`}}async function os(e,t,n,r){let{allowed:i,blocked:a}=$n(e),o={};for(let e of a)o[e]=`Blocked by enterprise policy (allowedMcpServers/deniedMcpServers)`;let s={},c={};for(let[e,t]of Object.entries(i))t.type===`sdk`?s[e]=t:c[e]=t;let l=new Set(Object.keys(t.configs)),u=new Set(Object.keys(s)),d=[],f=[],p={...t.configs},m=[...t.clients],h=[...t.tools];for(let e of l)if(!u.has(e)){let t=m.find(t=>t.name===e);t&&t.type===`connected`&&await t.cleanup(),m=m.filter(t=>t.name!==e);let n=`mcp__${e}__`;h=h.filter(e=>!e.name.startsWith(n)),delete p[e],f.push(e)}for(let[e,t]of Object.entries(s))if(!l.has(e)){p[e]=t;let n={type:`pending`,name:e,config:{...t,scope:`dynamic`}};m=[...m,n],d.push(e)}let g=await ss(c,n,r);return{response:{added:[...d,...g.response.added],removed:[...f,...g.response.removed],errors:{...o,...g.response.errors}},newSdkState:{configs:p,clients:m,tools:h},newDynamicState:g.newState,sdkServersChanged:d.length>0||f.length>0}}async function ss(e,t,n){let r=new Set(Object.keys(t.configs)),i=new Set(Object.keys(e)),a=[...r].filter(e=>!i.has(e)),o=[...i].filter(e=>!r.has(e)),s=[...r].filter(e=>i.has(e)).filter(n=>{let r=t.configs[n],i=e[n];return!r||!i?!0:!Cr(r,as(i))}),c=[],l=[],u={},d=[...t.clients],f=[...t.tools];for(let e of[...a,...s]){let n=d.find(t=>t.name===e),r=t.configs[e];if(n&&r){if(n.type===`connected`)try{await n.cleanup()}catch(e){W(e)}await vi(e,r)}let i=`mcp__${e}__`;f=f.filter(e=>!e.name.startsWith(i)),d=d.filter(t=>t.name!==e),a.includes(e)&&c.push(e)}for(let t of[...o,...s]){let n=e[t];if(!n)continue;let r=as(n);if(n.type===`sdk`){l.push(t);continue}try{let e=await Mi(t,r);if(d.push(e),e.type===`connected`){let t=await vn(e);f.push(...t)}else e.type===`failed`&&(u[t]=e.error||`Connection failed`);l.push(t)}catch(e){let n=Ne(e);u[t]=n.message,W(n)}}let p={};for(let t of i){let n=e[t];n&&(p[t]=as(n))}let m={clients:d,tools:f,configs:p};return n(e=>{let n=new Set([...Object.keys(t.configs),...Object.keys(p)]),r=e.mcp.tools.filter(e=>{for(let t of n)if(e.name.startsWith(`mcp__${t}__`))return!1;return!0}),i=e.mcp.clients.filter(e=>!n.has(e.name));return{...e,mcp:{...e.mcp,tools:[...r,...f],clients:[...i,...d]}}}),{response:{added:l,removed:c,errors:u},newState:m}}export{Go as runHeadless};
@@ -1,6 +0,0 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{Ct as r,cn as i,mr as a,t as o}from"./state-sIHsFpDu.js";import{$ as s,As as c,Dt as l,Ot as u,Zc as d,el as f,ks as p,tt as m}from"./paths-1ngPRtu3.js";import{M as h,V as g,d as _,h as v,k as y,p as b,s as x}from"./debug-UI3T040K.js";import{n as S,r as C}from"./analytics-DqMQntaB.js";import{O as w,et as T,k as E,o as D,s as O}from"./log-CzsijfHZ.js";import{n as k,t as ee}from"./sleep-8Eb9j_Ly.js";import{A as te,Ak as ne,Al as A,B_ as re,C_ as ie,Cl as ae,Cw as oe,DD as se,Dc as ce,Ec as le,F_ as ue,G as de,GD as fe,Go as pe,HE as me,Ho as he,I_ as ge,Jf as _e,K as j,KD as M,LA as N,Li as P,Lo as F,Ml as I,Nl as ve,OD as ye,Ok as be,RA as xe,Ro as Se,Sw as Ce,TD as we,T_ as Te,VE as Ee,V_ as L,Vi as De,W_ as Oe,Wi as ke,Xi as Ae,YD as je,Yf as Me,Yi as Ne,Yx as Pe,_O as Fe,_o as Ie,bo as R,dO as Le,fo as z,go as B,kc as Re,la as V,lk as ze,n_ as Be,ok as Ve,qo as H,qx as He,r_ as U,uO as Ue,w as We,wD as Ge,w_ as Ke,wo as qe,xl as Je,xw as Ye,yo as Xe,z_ as Ze}from"./loadAgentsDir-D7kapZB5.js";import{a as W,i as Qe,o as G}from"./xml-DTMvLcPg.js";import{E as $e,T as et,w as tt}from"./sessionTracing-DognYcDf.js";import{n as nt,t as rt}from"./slashCommandParsing-Cari0pNg.js";import{randomUUID as K}from"crypto";function it(e,t,n,r,i){let a=0;for(let o of p){let s=n[o];if(s)for(let n of s)for(let s of n.hooks){let c=s.once?()=>{_(`Removing one-shot hook for event ${o} in skill '${r}'`),Te(e,t,o,s)}:void 0;ie(e,t,o,n.matcher||``,s,c,i),a++}}a>0&&_(`Registered ${a} hooks from skill '${r}'`)}var at=e((()=>{c(),x(),Ke()}));function ot(){return!1}function st(){if(!ot())throw Error(`ToolUseContext.options.allowBackgroundForkedSlashCommands is test-only and cannot be enabled outside NODE_ENV=test.`)}async function q(e,t,n,r,i,a,o){let s=ue(),c=e.pluginInfo?G(e.pluginInfo.repository).marketplace:void 0;C(`tengu_slash_command_forked`,{command_name:e.name,invocation_trigger:`user-slash`,...e.pluginInfo&&{_PROTO_plugin_name:e.pluginInfo.pluginManifest.name,...c&&{_PROTO_marketplace_name:c},...L(e.pluginInfo)}});let{skillContent:u,modifiedGetAppState:f,baseAgent:p,promptMessages:m}=await ve(e,t,n),h=e.effort===void 0?p:{...p,effort:e.effort};_(`Executing forked slash command /${e.name} with agent ${h.agentType}`);let g=await n.getAppState();n.options.allowBackgroundForkedSlashCommands===!0&&st();let v=!1;if(g.kairosEnabled&&(v=!0),v){let t=Ge(),r=V(e),i=l(),c=e=>Le({value:e,mode:`prompt`,priority:`later`,isMeta:!0,skipSlashCommands:!0,workload:i}),u=async()=>{if(!o?.runId)return;let e=await fe({runId:o.runId,rootDir:o.rootDir,priority:`later`,workload:i});for(let t of e)Ue(t)},d=async e=>{o?.runId&&await M({runId:o.runId,rootDir:o.rootDir,error:e instanceof Error?e.message:String(e)})};return(async()=>{let i=Date.now()+$;for(;Date.now()<i&&n.getAppState().mcp.clients.some(e=>e.type===`pending`);)await k(Q);let o=n.options.refreshTools?.()??n.options.tools,l=[];for await(let r of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f,abortController:t},canUseTool:a,isAsync:!0,querySource:`agent:custom`,model:e.model,availableTools:o,override:{agentId:s}}))l.push(r);let d=A(l,`Command completed`);_(`Background forked command /${r} completed (agent ${s})`),c(`<scheduled-task-result command="/${r}">\n${d}\n</scheduled-task-result>`);try{await u()}catch(e){O(e)}})().catch(async e=>{O(e),c(`<scheduled-task-result command="/${r}" status="failed">\n${e instanceof Error?e.message:String(e)}\n</scheduled-task-result>`),await d(e)}),{messages:[],shouldQuery:!1,command:e,deferAutonomyCompletion:!!o?.runId}}let y=[],b=[],x=`forked-command-${e.name}`,S=0,w=e=>(S++,{type:`progress`,data:{message:e,type:`agent_progress`,prompt:u,agentId:s},parentToolUseID:x,toolUseID:`${x}-${S}`,timestamp:new Date().toISOString(),uuid:K()}),T=()=>{i({jsx:Me(b,{tools:n.options.tools,verbose:!1}),shouldHidePromptInput:!1,shouldContinueAnimation:!0,showSpinner:!0})};T();try{for await(let t of U({agentDefinition:h,promptMessages:m,toolUseContext:{...n,getAppState:f},canUseTool:a,isAsync:!1,querySource:`agent:custom`,model:e.model,availableTools:n.options.tools})){y.push(t);let e=pe([t]);if(t.type===`assistant`){let r=Ve(t);r>0&&n.setResponseLength(e=>e+r);let i=e[0];i&&i.type===`assistant`&&(b.push(w(t)),T())}if(t.type===`user`){let t=e[0];t&&t.type===`user`&&(b.push(w(t)),T())}}}finally{i(null)}let E=A(y,`Command completed`);return _(`Forked slash command /${e.name} completed with agent ${s}`),process.env.USER_TYPE===`ant`&&(E=`[ANT-ONLY] API calls: ${d(se(s))}\n${E}`),{messages:[R({content:H({inputString:`/${V(e)} ${t}`.trim(),precedingInputBlocks:r})}),R({content:`<local-command-stdout>\n${E}\n</local-command-stdout>`})],shouldQuery:!1,command:e,resultText:E}}function ct(e){return!/[^a-zA-Z0-9:\-_]/.test(e)}async function lt(e,t,n,r,i,o,s,c,l,u){let d=nt(e);if(!d){C(`tengu_input_slash_missing`,{});let e="Commands are in the form `/command [args]`";return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})})],shouldQuery:!1,resultText:e}}let{commandName:f,args:p,isMcp:m}=d,h=m?`mcp`:P().has(f)?f:`custom`;if(!Ne(f,i.options.commands)){let n=!1;try{await b().stat(`/${f}`),n=!0}catch{}if(ct(f)&&!n){C(`tengu_input_slash_invalid`,{input:f});let e=`Unknown skill: ${f}`;return{messages:[B(),...r,R({content:H({inputString:e,precedingInputBlocks:t})}),...p?[Ie(`Args from unknown skill: ${p}`,`warning`)]:[]],shouldQuery:!1,resultText:e}}let i=K();return a(i),C(`tengu_input_prompt`,{}),et(`user_prompt`,{prompt_length:String(e.length),prompt:$e(e),"prompt.id":i}),{messages:[R({content:H({inputString:e,precedingInputBlocks:t}),uuid:s}),...r],shouldQuery:!0}}let{messages:g,shouldQuery:_,allowedTools:v,model:y,effort:x,command:S,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}=await ut(f,p,o,i,t,n,c,l,s,u);if(g.length===0){let e={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:t,repository:n}=S.pluginInfo,{marketplace:r}=G(n),i=W(r);e._PROTO_plugin_name=t.name,r&&(e._PROTO_marketplace_name=r),e.plugin_repository=i?n:`third-party`,e.plugin_name=i?t.name:`third-party`,i&&t.version&&(e.plugin_version=t.version),Object.assign(e,L(S.pluginInfo))}return C(`tengu_input_command`,{...e,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}}),{messages:[],shouldQuery:!1,model:y,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}if(g.length===2&&g[1].type===`user`&&typeof g[1].message.content==`string`&&g[1].message.content.startsWith(`Unknown command:`))return e.startsWith(`/var`)||e.startsWith(`/tmp`)||e.startsWith(`/private`)||C(`tengu_input_slash_invalid`,{input:f}),{messages:[B(),...g],shouldQuery:_,allowedTools:v,model:y};let O={input:h};if(S.type===`prompt`&&S.pluginInfo){let{pluginManifest:e,repository:t}=S.pluginInfo,{marketplace:n}=G(t),r=W(n);O._PROTO_plugin_name=e.name,n&&(O._PROTO_marketplace_name=n),O.plugin_repository=r?t:`third-party`,O.plugin_name=r?e.name:`third-party`,r&&e.version&&(O.plugin_version=e.version),Object.assign(O,L(S.pluginInfo))}C(`tengu_input_command`,{...O,invocation_trigger:`user-slash`,...process.env.USER_TYPE===`ant`&&{skill_name:f,...S.type===`prompt`&&{skill_source:S.source},...S.loadedFrom&&{skill_loaded_from:S.loadedFrom},...S.kind&&{skill_kind:S.kind}}});let k=g.length>0&&g[0]&&Se(g[0]);return{messages:_||g.every(he)||k?g:[B(),...g],shouldQuery:_,allowedTools:v,model:y,effort:x,resultText:w,nextInput:T,submitNextInput:E,deferAutonomyCompletion:D}}async function ut(e,t,n,r,i,a,o,s,c,l){let u=ke(e,r.options.commands);if(u.type===`prompt`&&u.userInvocable!==!1&&re(e),u.userInvocable===!1)return{messages:[R({content:H({inputString:`/${e}`,precedingInputBlocks:i})}),R({content:`This skill can only be invoked by Claude, not directly by users. Ask Claude to use the "${e}" skill for you.`})],shouldQuery:!1,command:u};try{switch(u.type){case`local-jsx`:return new Promise(e=>{let a=!1,o=(n,r)=>{if(a=!0,r?.display===`skip`){e({messages:[],shouldQuery:!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput});return}let o=(r?.metaMessages??[]).map(e=>R({content:e,isMeta:!0})),s=Pe()&&typeof n==`string`&&n.endsWith(` dismissed`);e({messages:r?.display===`system`?s?o:[z(J(u,t)),z(`<local-command-stdout>${n}</local-command-stdout>`),...o]:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R(n?{content:`<local-command-stdout>${n}</local-command-stdout>`}:{content:`<local-command-stdout>${N}</local-command-stdout>`}),...o],shouldQuery:r?.shouldQuery??!1,command:u,nextInput:r?.nextInput,submitNextInput:r?.submitNextInput})};u.load().then(e=>e.call(o,{...r,canUseTool:s},t)).then(t=>{if(t!=null){if(r.options.isNonInteractiveSession){e({messages:[],shouldQuery:!1,command:u});return}a||n({jsx:t,shouldHidePromptInput:!0,showSpinner:!1,isLocalJSXCommand:!0,isImmediate:u.immediate===!0})}}).catch(t=>{O(t),!a&&(a=!0,n({jsx:null,shouldHidePromptInput:!1,clearLocalJSX:!0}),e({messages:[],shouldQuery:!1,command:u}))})});case`local`:{let e=R({content:H({inputString:J(u,u.isSensitive&&t.trim()?`***`:t),precedingInputBlocks:i})});try{let n=B(),i=await(await u.load()).call(t,r);if(i.type===`skip`)return{messages:[],shouldQuery:!1,command:u};if(i.type===`compact`){let t=[n,e,...i.displayText?[R({content:`<local-command-stdout>${i.displayText}</local-command-stdout>`,timestamp:new Date(Date.now()+100).toISOString()})]:[]],r={...i.compactionResult,messagesToKeep:[...i.compactionResult.messagesToKeep??[],...t]};return ne(),{messages:Je(r),shouldQuery:!1,command:u}}return{messages:[e,z(`<local-command-stdout>${i.value}</local-command-stdout>`)],shouldQuery:!1,command:u,resultText:i.value}}catch(t){return O(t),{messages:[e,z(`<local-command-stderr>${String(t)}</local-command-stderr>`)],shouldQuery:!1,command:u}}}case`prompt`:try{return u.context===`fork`?await q(u,t,r,i,n,s??de,l):await Z(u,t,r,i,a,c)}catch(e){return e instanceof y?{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),Xe({toolUse:!1})],shouldQuery:!1,command:u}:{messages:[R({content:H({inputString:J(u,t),precedingInputBlocks:i})}),R({content:`<local-command-stderr>${String(e)}</local-command-stderr>`})],shouldQuery:!1,command:u}}}}catch(e){if(e instanceof h)return{messages:[R({content:H({inputString:e.message,precedingInputBlocks:i})})],shouldQuery:!1,command:u};throw e}}function J(e,t){return qe(V(e),t)}function Y(e,t=`loading`){return[`<${w}>${e}</${w}>`,`<${E}>${e}</${E}>`,`<skill-format>true</skill-format>`].join(`
2
- `)}function dt(e,t){return[`<${w}>${e}</${w}>`,`<${E}>/${e}</${E}>`,t?`<command-args>${t}</command-args>`:null].filter(Boolean).join(`
3
- `)}function X(e,t){return e.userInvocable===!1&&(e.loadedFrom===`skills`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)?Y(e.name,e.progressMessage):dt(e.name,t)}async function ft(e,t,n,r,i=[]){let a=De(e,n);if(!a)throw new h(`Unknown command: ${e}`);if(a.type!==`prompt`)throw Error(`Unexpected ${a.type} command. Expected 'prompt' command. Use /${e} directly in the main conversation.`);return Z(a,t,r,[],i)}async function Z(e,t,i,a=[],c=[],l){if(n(process.env.CLAUDE_CODE_COORDINATOR_MODE)&&!i.agentId){let n=X(e,t),r=[`Skill "/${e.name}" is available for workers.`];e.description&&r.push(`Description: ${e.description}`),e.whenToUse&&r.push(`When to use: ${e.whenToUse}`);let i=e.allowedTools??[];i.length>0&&r.push(`This skill grants workers additional tool permissions: ${i.join(`, `)}`),r.push(`\nInstruct a worker to use this skill by including "Use the /${e.name} skill" in your Agent prompt. The worker has access to the Skill tool and will receive the skill's content and permissions when it invokes it.`);let a=[{type:`text`,text:r.join(`
4
- `)}];return{messages:[R({content:n,uuid:l}),R({content:a,isMeta:!0})],shouldQuery:!0,model:e.model,effort:e.effort,command:e}}let u=await e.getPromptForCommand(t,i),d=!Ce(`hooks`)||oe(e.source);if(e.hooks&&d){let t=r();it(i.setAppState,t,e.hooks,e.name,e.type===`prompt`?e.skillRoot:void 0)}let f=e.source?`${e.source}:${e.name}`:e.name,p=u.filter(e=>e.type===`text`).map(e=>e.text).join(`
5
-
6
- `);o(e.name,f,p,s()?.agentId??null);let m=X(e,t),h=te(e.allowedTools??[]),g=c.length>0||a.length>0?[...c,...a,...u]:u,_=await me(ce(u.filter(e=>e.type===`text`).map(e=>e.text).join(` `),i,null,[],i.messages,`repl_main_thread`,{skipSkillDiscovery:!0}));return{messages:[R({content:m,uuid:l}),R({content:g,isMeta:!0}),..._,le({type:`command_permissions`,allowedTools:h,model:e.model})],shouldQuery:!0,allowedTools:h,model:e.model,effort:e.effort,command:e}}var Q,$;e((()=>{i(),Ae(),xe(),T(),S(),ye(),ae(),be(),Be(),_e(),we(),m(),Re(),x(),t(),g(),f(),I(),v(),He(),Ee(),at(),D(),Fe(),F(),We(),j(),Qe(),Ye(),rt(),ee(),Ze(),tt(),Oe(),ze(),ge(),je(),u(),Q=200,$=1e4}))();export{Y as formatSkillLoadingMetadata,ft as processPromptSlashCommand,lt as processSlashCommand};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./prompt-BBg3jtfc.js";t();export{e as isDeferredTool};
@@ -1 +0,0 @@
1
- import{Wk as e,Xk as t}from"./loadAgentsDir-D7kapZB5.js";t();export{e as clearPromptCache};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{cn as t,ot as n}from"./state-sIHsFpDu.js";import{L as r,V as i,d as a,s as o}from"./debug-UI3T040K.js";import{o as s,s as c}from"./log-CzsijfHZ.js";import{Av as l,Cc as u,Ew as d,Ip as f,Pp as p,Sc as m,Tw as h,fs as g,gh as _,i as v,jv as y,lc as b,mh as x,o as S,ps as C,uc as w,vh as T,yh as E}from"./loadAgentsDir-D7kapZB5.js";async function D(e){a(`refreshActivePlugins: clearing all plugin caches`),b(),p();let t=await C(),[i,o]=await Promise.all([m(),v(n())]),{enabled:s,disabled:l,errors:u}=t,[f,h]=await Promise.all([Promise.all(s.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await d(e,u);return t&&(e.mcpServers=t),t?Object.keys(t).length:0})),Promise.all(s.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await E(e,u);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))]),g=f.reduce((e,t)=>e+t,0),x=h.reduce((e,t)=>e+t,0);e(e=>({...e,plugins:{...e.plugins,enabled:s,disabled:l,commands:i,errors:O(e.plugins.errors,u),needsRefresh:!1},agentDefinitions:o,mcp:{...e.mcp,pluginReconnectKey:e.mcp.pluginReconnectKey+1}})),_();let S=!1;try{await y()}catch(e){S=!0,c(e),a(`refreshActivePlugins: loadPluginHooks failed: ${r(e)}`)}let w=s.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return a(`refreshActivePlugins: ${s.length} enabled, ${i.length} commands, ${o.allAgents.length} agents, ${w} hooks, ${g} MCP, ${x} LSP`),{enabled_count:s.length,disabled_count:l.length,command_count:i.length,agent_count:o.allAgents.length,hook_count:w,mcp_count:g,lsp_count:x,error_count:u.length+ +!!S,agentDefinitions:o,pluginCommands:i}}function O(e,t){let n=e.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(t.map(k));return[...n.filter(e=>!r.has(k(e))),...t]}function k(e){return e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`}var A=e((()=>{t(),x(),S(),o(),i(),s(),w(),u(),l(),T(),h(),f(),g()}));export{D as n,A as t};
@@ -1 +0,0 @@
1
- import{oA as e,rA as t}from"./loadAgentsDir-D7kapZB5.js";e();export{t as SandboxManager};
@@ -1 +0,0 @@
1
- import{Yc as e,Zc as t}from"./loadAgentsDir-D7kapZB5.js";e();export{t as isSearchExtraToolsEnabled};
@@ -1 +0,0 @@
1
- import{gu as e,vu as t}from"./loadAgentsDir-D7kapZB5.js";e();export{t as registerSessionFileAccessHooks};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./sessionMemory-UpILj5ww.js";t();export{e as manuallyExtractSessionMemory};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./memoize-DNnuA2aU.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{S as a,_ as o,g as s,mc as c,pc as l}from"./paths-1ngPRtu3.js";import{L as u,R as d,V as f,h as ee,p as te}from"./debug-UI3T040K.js";import{n as ne,r as p}from"./analytics-DqMQntaB.js";import{b as m,x as re}from"./teammate-DMYOtLTK.js";import{$O as h,AD as ie,Bc as ae,Fo as g,GO as _,In as v,JO as y,Ln as oe,Lo as se,Ml as ce,NO as le,Ol as ue,Pl as b,QO as x,Rn as de,UO as S,Vc as C,XO as w,YO as T,ZO as E,bo as D,ck as O,cl as k,dk as A,dt as j,ek as M,fl as N,ft as P,hk as F,kD as I,kl as L,lk as R,mk as z,ml as B,nk as V,pk as fe,pl as pe,qO as me,rk as he,sl as ge,tk as H}from"./loadAgentsDir-D7kapZB5.js";import{On as U,jn as _e}from"./prompt-BBg3jtfc.js";import{X as ve}from"./rcDebugLog-CPGWJbI4.js";import{writeFile as W}from"fs/promises";function ye(){return o(`tengu_session_memory`,!1)}function G(){return s(`tengu_sm_config`,{})}function be(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+=m(e,e=>e.type===`tool_use`))}}return n}function K(e){let t=A(e);if(!E()){if(!y(t))return!1;M()}let n=T(t),r=be(e,X)>=me(),i=g(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&(X=t.uuid),!0}return!1}async function q(e){let t=te(),n=v();await t.mkdir(n,{mode:448});let r=oe();try{await W(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await W(r,await B(),{encoding:`utf-8`,mode:384})}catch(e){if(d(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await ae.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),p(`tengu_session_memory_file_read`,{content_length:a.length}),{memoryPath:r,currentMemory:a}}function xe(){if(r())return;let e=k();process.env.USER_TYPE===`ant`&&p(`tengu_session_memory_init`,{auto_compact_enabled:e}),e&&ie($)}async function Se(e,t){if(e.length===0)return{success:!1,error:`No messages to summarize`};h();try{let n=L(t),{memoryPath:r,currentMemory:i}=await q(n),a=await N(i,r),{tools:o,mainLoopModel:s}=t.options,[c,l,u]=await Promise.all([j(o,s),z(),fe()]),d=ve(c);return await b({promptMessages:[D({content:a})],cacheSafeParams:{systemPrompt:d,userContext:l,systemContext:u,toolUseContext:n,forkContextMessages:e},canUseTool:J(r),querySource:`session_memory`,forkLabel:`session_memory_manual`,overrides:{readFileState:n.readFileState}}),p(`tengu_session_memory_manual_extraction`,{}),H(A(e)),Y(e),{success:!0,memoryPath:r}}catch(e){return{success:!1,error:u(e)}}finally{x()}}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(!g(e)){let t=e[e.length-1];t?.uuid&&V(t.uuid)}}var X,Z,Q,$,Ce=e((()=>{n(),i(),P(),F(),_e(),C(),re(),ce(),ee(),I(),se(),de(),l(),le(),R(),ne(),ge(),pe(),w(),f(),a(),Z=t(()=>{let e=G();he({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:S.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:S.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:S.toolCallsBetweenUpdates})}),Q=!1,$=c(async function(e){let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`)return;{let{isPoorModeActive:e}=await import(`./poorMode-D_hB-rDf.js`);if(e())return}if(!ye()){process.env.USER_TYPE===`ant`&&!Q&&(Q=!0,p(`tengu_session_memory_gate_disabled`,{}));return}if(Z(),!K(t))return;h();let i=L(n),{memoryPath:a,currentMemory:o}=await q(i);await b({promptMessages:[D({content:await N(o,a)})],cacheSafeParams:ue(e),canUseTool:J(a),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let s=t[t.length-1],c=s?O(s):void 0,l=_();p(`tengu_session_memory_extraction`,{input_tokens:c?.input_tokens,output_tokens:c?.output_tokens,cache_read_input_tokens:c?.cache_read_input_tokens??void 0,cache_creation_input_tokens:c?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:l.minimumMessageTokensToInit,config_min_tokens_between_update:l.minimumTokensBetweenUpdate,config_tool_calls_between_updates:l.toolCallsBetweenUpdates}),H(A(t)),Y(t),x()})}));export{K as a,Se as i,xe as n,Ce as r,J as t};
@@ -1 +0,0 @@
1
- import{KO as e,XO as t}from"./loadAgentsDir-D7kapZB5.js";t();export{e as getSessionMemoryContent};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./sessionObserver-CujNIWks.js";e();export{t as heuristicObserverBackend};
@@ -1 +0,0 @@
1
- import{Ar as e,Lr as t,oi as n}from"./loadAgentsDir-D7kapZB5.js";e();export{t as linkSessionToPR,n as recordTranscript};
@@ -1,3 +0,0 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,s as n}from"./envUtils-BWeoiL4Y.js";import{i as r,t as i}from"./hash-BRmOQc3c.js";import{join as a}from"path";import{open as o,readdir as s,realpath as c}from"fs/promises";import{promisify as l}from"util";import{execFile as u}from"child_process";async function d(e){try{let{stdout:t}=await f(`git`,[`worktree`,`list`,`--porcelain`],{cwd:e,timeout:5e3});return t?t.split(`
2
- `).filter(e=>e.startsWith(`worktree `)).map(e=>e.slice(9).normalize(`NFC`)):[]}catch{return[]}}var f,p=e((()=>{f=l(u)}));function m(e){return typeof e==`string`&&R.test(e)?e:null}function h(e){if(!e.includes(`\\`))return e;try{return JSON.parse(`"${e}"`)}catch{return e}}function g(e,t){let n=[`"${t}":"`,`"${t}": "`];for(let t of n){let n=e.indexOf(t);if(n<0)continue;let r=n+t.length,i=r;for(;i<e.length;){if(e[i]===`\\`){i+=2;continue}if(e[i]===`"`)return h(e.slice(r,i));i++}}}function _(e,t){let n=[`"${t}":"`,`"${t}": "`],r;for(let t of n){let n=0;for(;;){let i=e.indexOf(t,n);if(i<0)break;let a=i+t.length,o=a;for(;o<e.length;){if(e[o]===`\\`){o+=2;continue}if(e[o]===`"`){r=h(e.slice(a,o));break}o++}n=o+1}}return r}function v(e){let t=0,n=``;for(;t<e.length;){let r=e.indexOf(`
3
- `,t),i=r>=0?e.slice(t,r):e.slice(t);if(t=r>=0?r+1:e.length,!(!i.includes(`"type":"user"`)&&!i.includes(`"type": "user"`))&&!i.includes(`"tool_result"`)&&!(i.includes(`"isMeta":true`)||i.includes(`"isMeta": true`))&&!(i.includes(`"isCompactSummary":true`)||i.includes(`"isCompactSummary": true`)))try{let e=JSON.parse(i);if(e.type!==`user`)continue;let t=e.message;if(!t)continue;let r=t.content,a=[];if(typeof r==`string`)a.push(r);else if(Array.isArray(r))for(let e of r)e.type===`text`&&typeof e.text==`string`&&a.push(e.text);for(let e of a){let t=e.replace(/\n/g,` `).trim();if(!t)continue;let r=B.exec(t);if(r){n||(n=r[1]);continue}let i=/<bash-input>([\s\S]*?)<\/bash-input>/.exec(t);if(i)return`! ${i[1].trim()}`;if(!z.test(t))return t.length>200&&(t=t.slice(0,200).trim()+`…`),t}}catch{}}return n||``}async function y(e,t,n){try{let r=await o(e,`r`);try{let e=await r.read(n,0,L,0);if(e.bytesRead===0)return{head:``,tail:``};let i=n.toString(`utf8`,0,e.bytesRead),a=Math.max(0,t-L),o=i;if(a>0){let e=await r.read(n,0,L,a);o=n.toString(`utf8`,0,e.bytesRead)}return{head:i,tail:o}}finally{await r.close()}}catch{return{head:``,tail:``}}}async function b(e){try{let t=await o(e,`r`);try{let e=await t.stat(),n=Buffer.allocUnsafe(L),r=await t.read(n,0,L,0);if(r.bytesRead===0)return null;let i=n.toString(`utf8`,0,r.bytesRead),a=Math.max(0,e.size-L),o=i;if(a>0){let e=await t.read(n,0,L,a);o=n.toString(`utf8`,0,e.bytesRead)}return{mtime:e.mtime.getTime(),size:e.size,head:i,tail:o}}finally{await t.close()}}catch{return null}}function x(e){return Math.abs(i(e)).toString(36)}function S(e){let t=e.replace(/[^a-zA-Z0-9]/g,`-`);if(t.length<=200)return t;let n=typeof Bun<`u`?Bun.hash(e).toString(36):x(e);return`${t.slice(0,200)}-${n}`}function C(){return a(t(),`projects`)}function w(e){return a(C(),S(e))}async function T(e){try{return(await c(e)).normalize(`NFC`)}catch{return e.normalize(`NFC`)}}async function E(e){let t=w(e);try{return await s(t),t}catch{let t=S(e);if(t.length<=200)return;let n=t.slice(0,200),r=C();try{let e=(await s(r,{withFileTypes:!0})).find(e=>e.isDirectory()&&e.name.startsWith(n+`-`));return e?a(r,e.name):void 0}catch{return}}}function D(){return U??(U=Buffer.from(`"compact_boundary"`))}function O(e){try{let t=JSON.parse(e);return t.type!==`system`||t.subtype!==`compact_boundary`?null:{hasPreservedSegment:!!t.compactMetadata?.preservedSegment}}catch{return null}}function k(e,t,n,r){let i=r-n;if(!(i<=0)){if(e.len+i>e.buf.length){let t=Buffer.allocUnsafe(Math.min(Math.max(e.buf.length*2,e.len+i),e.cap));e.buf.copy(t,0,0,e.len),e.buf=t}t.copy(e.buf,e.len,n,r),e.len+=i}}function A(e,t,n,r){return r-n>=t.length&&e.compare(t,0,t.length,n,n+t.length)===0}function j(e,t,n){if(e.straddleSnapCarryLen=0,e.straddleSnapTailEnd=0,e.carryLen===0)return 0;let r=e.carryBuf,i=t.indexOf(K);if(i===-1||i>=n)return 0;let a=i+1;if(A(r,W,0,e.carryLen))e.straddleSnapCarryLen=e.carryLen,e.straddleSnapTailEnd=a,e.lastSnapSrc=null;else if(e.carryLen<W.length)return 0;else{if(A(r,G,0,e.carryLen)){let n=O(r.toString(`utf-8`,0,e.carryLen)+t.toString(`utf-8`,0,i));n?.hasPreservedSegment?e.hasPreservedSegment=!0:n&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff,e.hasPreservedSegment=!1,e.lastSnapSrc=null)}k(e.out,r,0,e.carryLen),k(e.out,t,0,a)}return e.bufFileOff+=e.carryLen+a,e.carryLen=0,a}function M(e,t,n){let r=t.indexOf(n),i=0,a=0,o=-1,s=-1,c=t.indexOf(K);for(;c!==-1;){let l=c+1;if(r!==-1&&r<a&&(r=t.indexOf(n,a)),A(t,W,a,l))k(e.out,t,i,a),o=a,s=l,i=l;else if(r>=a&&r<Math.min(a+J,l)){let s=O(t.toString(`utf-8`,a,c));s?.hasPreservedSegment?e.hasPreservedSegment=!0:s&&(e.out.len=0,e.boundaryStartOffset=e.bufFileOff+a,e.hasPreservedSegment=!1,e.lastSnapSrc=null,o=-1,e.straddleSnapCarryLen=0,i=a),r=t.indexOf(n,r+n.length)}a=l,c=t.indexOf(K,a)}return k(e.out,t,i,a),{lastSnapStart:o,lastSnapEnd:s,trailStart:a}}function N(e,t,n,r,i){r===-1?e.straddleSnapCarryLen>0&&(e.lastSnapLen=e.straddleSnapCarryLen+e.straddleSnapTailEnd,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),e.carryBuf.copy(e.lastSnapBuf,0,0,e.straddleSnapCarryLen),n.copy(e.lastSnapBuf,e.straddleSnapCarryLen,0,e.straddleSnapTailEnd),e.lastSnapSrc=e.lastSnapBuf):(e.lastSnapLen=i-r,(e.lastSnapBuf===void 0||e.lastSnapLen>e.lastSnapBuf.length)&&(e.lastSnapBuf=Buffer.allocUnsafe(e.lastSnapLen)),t.copy(e.lastSnapBuf,0,r,i),e.lastSnapSrc=e.lastSnapBuf)}function P(e,t,n){e.carryLen=t.length-n,e.carryLen>0&&((e.carryBuf===void 0||e.carryLen>e.carryBuf.length)&&(e.carryBuf=Buffer.allocUnsafe(e.carryLen)),t.copy(e.carryBuf,0,n,t.length))}function F(e){if(e.carryLen>0){let t=e.carryBuf;A(t,W,0,e.carryLen)?(e.lastSnapSrc=t,e.lastSnapLen=e.carryLen):k(e.out,t,0,e.carryLen)}e.lastSnapSrc&&(e.out.len>0&&e.out.buf[e.out.len-1]!==K&&k(e.out,q,0,1),k(e.out,e.lastSnapSrc,0,e.lastSnapLen))}async function I(e,t){let n=D(),r=V,i={out:{buf:Buffer.allocUnsafe(Math.min(t,8*1024*1024)),len:0,cap:t+1},boundaryStartOffset:0,hasPreservedSegment:!1,lastSnapSrc:null,lastSnapLen:0,lastSnapBuf:void 0,bufFileOff:0,carryLen:0,carryBuf:void 0,straddleSnapCarryLen:0,straddleSnapTailEnd:0},a=Buffer.allocUnsafe(r),s=await o(e,`r`);try{let e=0;for(;e<t;){let{bytesRead:o}=await s.read(a,0,Math.min(r,t-e),e);if(o===0)break;e+=o;let c=j(i,a,o),l;if(i.carryLen>0){let e=i.carryLen+(o-c);l=Buffer.allocUnsafe(e),i.carryBuf.copy(l,0,0,i.carryLen),a.copy(l,i.carryLen,c,o)}else l=a.subarray(c,o);let u=M(i,l,n);N(i,l,a,u.lastSnapStart,u.lastSnapEnd),P(i,l,u.trailStart),i.bufFileOff+=u.trailStart}F(i)}finally{await s.close()}return{boundaryStartOffset:i.boundaryStartOffset,postBoundaryBuf:i.out.buf.subarray(0,i.out.len),hasPreservedSegment:i.hasPreservedSegment}}var L,R,z,B,V,H,U,W,G,K,q,J,Y=e((()=>{n(),p(),r(),L=65536,R=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,z=/^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/,B=/<command-name>(.*?)<\/command-name>/,V=1024*1024,H=5*1024*1024,W=Buffer.from(`{"type":"attribution-snapshot"`),G=Buffer.from(`{"type":"system"`),K=10,q=Buffer.from([K]),J=256}));export{g as a,C as c,b as d,I as f,p as g,d as h,v as i,Y as l,m,H as n,_ as o,S as p,T as r,E as s,L as t,y as u};
@@ -1,2 +0,0 @@
1
- import{c as e,s as t,u as n}from"./envUtils-BWeoiL4Y.js";import{In as r,Ln as i}from"./src-Di342QoJ.js";import{Ct as ee,U as a,cn as o,dr as s,jr as c,lr as l,ut as te}from"./state-sIHsFpDu.js";import{Ac as u,Cn as ne,Pc as d,Sc as f,at as p,bc as m,it as h,on as g,rt as _,st as v}from"./paths-1ngPRtu3.js";import{L as y,V as b}from"./debug-UI3T040K.js";import{n as x,r as S}from"./analytics-DqMQntaB.js";import{n as C,t as w}from"./cwd--iizewsn.js";import{F as T,P as E,f as re,n as D,r as O,v as k}from"./git-CN3qtTb_.js";import{a as A,n as j}from"./env-chR0gV31.js";import{o as M,s as N}from"./log-CzsijfHZ.js";import{a as P,n as F}from"./startupProfiler-DnXZaX4A.js";import{Ar as I,BS as L,Bb as R,Ck as z,Fv as B,Gi as V,Hm as H,Hv as U,Mt as W,Pb as G,Pv as K,VS as q,Vm as J,Wv as Y,Xi as X,_E as ie,_t as ae,bt as Z,vE as oe,vk as se,vn as ce,vt as le,wt as ue,xi as de,yn as fe,zS as pe}from"./loadAgentsDir-D7kapZB5.js";import{l as me,u as he}from"./terminalSetup-bSbq4LE7.js";import{c as ge,n as _e}from"./releaseNotes-CvfZb3fZ.js";import{s as ve,u as ye}from"./logoV2Utils-DjThKW15.js";import{i as be,r as xe}from"./runtimeObserver-BhvHeiwD.js";import{n as Q,r as Se}from"./sessionMemory-UpILj5ww.js";import{t as Ce}from"./sinks-B9A94oIj.js";import{homedir as we}from"os";import{join as Te}from"path";import{copyFile as Ee,stat as De}from"fs/promises";t(),i(),o(),x(),C(),b(),E(),A(),k(),g(),v(),_(),z(),oe(),L(),he(),K(),J(),X(),I(),fe(),ge(),be(),Se(),u(),M();function $(){d(e=>({...e,iterm2SetupInProgress:!1}))}function Oe(){let e=f();return{inProgress:e.iterm2SetupInProgress??!1,backupPath:e.iterm2BackupPath||null}}function ke(){return Te(we(),`Library`,`Preferences`,`com.googlecode.iterm2.plist`)}async function Ae(){let{inProgress:e,backupPath:t}=Oe();if(!e)return{status:`no_backup`};if(!t)return $(),{status:`no_backup`};try{await De(t)}catch{return $(),{status:`no_backup`}}try{return await Ee(t,ke()),$(),{status:`restored`}}catch(e){return N(Error(`Failed to restore iTerm2 settings with: ${e}`)),$(),{status:`failed`,backupPath:t}}}u(),M(),ye(),G(),Y(),F(),ue();async function je(t,i,o,u,d,g,_,v,b){T(`info`,`setup_started`);let x=process.version.match(/^v(\d+)\./)?.[1];if((!x||parseInt(x,10)<18)&&(console.error(r.bold.red(`Error: Claude Code requires Node.js version 18 or higher.`)),process.exit(1)),_&&c(ie(_)),e(),!e()&&h()){let{captureTeammateModeSnapshot:e}=await import(`./teammateModeSnapshot-BgUQ4Phz.js`);e()}if(!a()){if(h()){let e=await Ae();e.status===`restored`?console.log(r.yellow(`Detected an interrupted iTerm2 setup. Your original settings have been restored. You may need to restart iTerm2 for the changes to take effect.`)):e.status===`failed`&&console.error(r.red(`Failed to restore iTerm2 settings. Please manually restore your original settings with: defaults import com.googlecode.iterm2 ${e.backupPath}.`))}try{let e=await me();e.status===`restored`?console.log(r.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(r.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){N(e)}}H(t);let C=Date.now();if(pe(),T(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-C}),B(t),u){let e=ce(),n=await re();!e&&!n&&(process.stderr.write(r.red(`Error: Can only use --worktree in a git repository, but ${r.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 i=v?`pr-${v}`:d??U(),a;if(n){let e=D(w());e||(process.stderr.write(r.red(`Error: Could not determine the main git repository root.
2
- `)),process.exit(1)),e!==(O(w())??w())&&(T(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),H(e)),a=g?Z(e,W(i)):void 0}else a=g?Z(w(),W(i)):void 0;let o;try{o=await le(ee(),i,a,v?{prNumber:v}:void 0)}catch(e){process.stderr.write(r.red(`Error creating worktree: ${y(e)}\n`)),process.exit(1)}if(S(`tengu_worktree_created`,{tmux_enabled:g}),g&&a){let e=await ae(a,o.worktreePath);e.created?console.log(r.green(`Created tmux session: ${r.bold(a)}\nTo attach: ${r.bold(`tmux attach -t ${a}`)}`)):console.error(r.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(o.worktreePath),H(o.worktreePath),l(w()),s(w()),de(o),se(),q()}T(`info`,`setup_background_jobs_starting`),e()||(Q(),xe()),R(),T(`info`,`setup_background_jobs_launched`),P(`setup_before_prefetch`),T(`info`,`setup_prefetch_starting`);let E=a()&&n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)||e();if(E||V(te()),import(`./loadPluginHooks-CL5aGDrb.js`).then(e=>{E||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),e()||(process.env.USER_TYPE===`ant`&&import(`./commitAttribution-CSVDcgTO.js`).then(async e=>{if(await e.isInternalModelRepo()){let{clearSystemPromptSections:e}=await import(`./systemPromptSections-DB93ZNWP.js`);e()}}),setImmediate(()=>{import(`./attributionHooks-PygdohOh.js`).then(({registerAttributionHooks:e})=>{e()})}),import(`./sessionFileAccessHooks-BeuS4m7a.js`).then(e=>e.registerSessionFileAccessHooks())),Ce(),S(`tengu_started`,{}),ne(a()),P(`setup_after_prefetch`),!e()){let{hasReleaseNotes:e}=await _e(f().lastReleaseNotesSeen);e&&await ve()}if((i===`bypassPermissions`||o)&&(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!n(process.env.CLAUDE_CODE_BUBBLEWRAP)&&(console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1)),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([p.getIsDocker(),j.hasInternetAccess()]),n=p.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 k=m();k.lastCost!==void 0&&k.lastDuration!==void 0&&S(`tengu_exit`,{last_session_cost:k.lastCost,last_session_api_duration:k.lastAPIDuration,last_session_tool_duration:k.lastToolDuration,last_session_duration:k.lastDuration,last_session_lines_added:k.lastLinesAdded,last_session_lines_removed:k.lastLinesRemoved,last_session_total_input_tokens:k.lastTotalInputTokens,last_session_total_output_tokens:k.lastTotalOutputTokens,last_session_total_cache_creation_input_tokens:k.lastTotalCacheCreationInputTokens,last_session_total_cache_read_input_tokens:k.lastTotalCacheReadInputTokens,last_session_fps_average:k.lastFpsAverage,last_session_fps_low_1_pct:k.lastFpsLow1Pct,last_session_id:k.lastSessionId,...k.lastSessionMetrics})}export{je as setup};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./sink-Cugto5We.js";t();export{e as initializeAnalyticsSink};
@@ -1 +0,0 @@
1
- import{t as e}from"./sinks-B9A94oIj.js";export{e as initSinks};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./chokidar-SzksMqYp.js";import{Ct as n,Fr as r,Pr as i,cn as a,et as o,g as s,jr as ee,lr as c,nr as l,tr as te}from"./state-sIHsFpDu.js";import{Br as ne,Pr as re}from"./paths-1ngPRtu3.js";import{X as ie,Y as ae,d as u,h as oe,p as se,s as d}from"./debug-UI3T040K.js";import{n as ce,r as le}from"./analytics-DqMQntaB.js";import{n as ue,t as f}from"./cwd--iizewsn.js";import{Ac as de,Ar as fe,At as p,Ck as pe,Cm as m,Hm as h,Lo as me,Pt as he,Ri as ge,Sm as g,Uv as _,Vm as _e,Wv as ve,Xi as ye,Yn as be,_E as v,_m as y,_o as b,aE as x,bm as S,cd as C,di as w,ei as T,fi as E,gm as D,gn as O,i as k,kc as A,o as j,oE as M,pd as N,r as xe,ry as Se,ty as Ce,vE as we,vi as Te,vk as P,wm as Ee,wt as De,xi as F,xt as I,yn as Oe,zi as ke}from"./loadAgentsDir-D7kapZB5.js";import{zt as Ae}from"./prompt-BBg3jtfc.js";import{f as je,l as Me,t as L}from"./commitAttribution-e0kkanVT.js";import{F as Ne,P as Pe}from"./teamHelpers-DEgaCpta.js";import{n as R,r as Fe}from"./systemPromptSections-BcN_XBTx.js";import{r as Ie}from"./asciicast-o5Zg4dJt.js";import*as z from"path";import{dirname as Le}from"path";a(),Fe(),D(),j(),Ae(),we(),pe(),Me(),C(),ue(),d(),Se(),me(),re(),ve(),_e(),fe(),Pe(),M(),De();function Re(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=x().safeParse(i.todos);return a.success?a.data:[]}return[]}function ze(e,t){if(e.fileHistorySnapshots&&e.fileHistorySnapshots.length>0&&Ce(e.fileHistorySnapshots,e=>{t(t=>({...t,fileHistory:e}))}),e.attributionSnapshots&&e.attributionSnapshots.length>0&&L(e.attributionSnapshots,e=>{t(t=>({...t,attribution:e}))}),!Ne()&&e.messages&&e.messages.length>0){let r=Re(e.messages);if(r.length>0){let e=n();t(t=>({...t,todos:{...t.todos,[e]:r}}))}}}function Be(e){if(e.attributionSnapshots&&e.attributionSnapshots.length>0)return je(e.attributionSnapshots)}function B(e,t){if(!(!e&&!t))return{name:e??``,color:t===`default`?void 0:t}}function V(e,t,n){if(t)return{agentDefinition:t,agentType:void 0};if(!e)return l(void 0),{agentDefinition:void 0,agentType:void 0};let r=n.activeAgents.find(t=>t.agentType===e);return r?(l(r.agentType),!o()&&r.model&&r.model!==`inherit`&&te(ne(r.model)),{agentDefinition:r,agentType:r.agentType}):(u(`Resumed session had agent "${e}" but it is no longer available. Using default behavior.`),l(void 0),{agentDefinition:void 0,agentType:void 0})}async function Ve(e,t,n,r){if(!e)return r;k.cache.clear?.();let i=await k(t),a=[...i.allAgents,...n];return{...i,allAgents:a,activeAgents:xe(a)}}function H(e){let t=I();if(t){F(t);return}if(e){try{process.chdir(e.worktreePath)}catch{F(null);return}h(e.worktreePath),c(f()),p(e),P(),R(),_.cache.clear?.()}}function He(){let e=I();if(e){p(null),P(),R(),_.cache.clear?.();try{process.chdir(e.originalCwd)}catch{return}h(e.originalCwd),c(f())}}async function Ue(e,t,n){let r;if(r=n.modeApi?.matchSessionMode(e.mode),r&&e.messages.push(b(r,`warning`)),t.forkSession)e.contentReplacements?.length&&await T(e.contentReplacements);else{let n=t.sessionIdOverride??e.sessionId;n&&(ee(v(n),t.transcriptPath?Le(t.transcriptPath):null),await Ie(),await w(),y(n))}E(t.forkSession?{...e,worktreeSession:void 0}:e),t.forkSession||(H(e.worktreeSession),be());let{agentDefinition:i,agentType:a}=V(e.agentSetting,n.mainThreadAgentDefinition,n.agentDefinitions);Te(n.modeApi?.isCoordinatorMode()?`coordinator`:`normal`);let o=t.includeAttribution?Be(e):void 0,s=B(e.agentName,e.agentColor);N(e.agentName);let c=await Ve(!!r,n.currentCwd,n.cliAgents,n.agentDefinitions);return{messages:e.messages,fileHistorySnapshots:e.fileHistorySnapshots,contentReplacements:e.contentReplacements,agentName:e.agentName,agentColor:e.agentColor===`default`?void 0:e.agentColor,restoredAgentDef:i,initialState:{...n.initialState,...a&&{agent:a},...o&&{attribution:o},...s&&{standaloneAgentContext:s},agentDefinitions:c}}}e(),a(),ye(),ce(),m(),A(),ae(),d(),oe(),Oe(),r();var We=1e3,Ge=500,Ke=300,qe=2e3,Je=typeof Bun<`u`,U=null,W=null,G=new Set,K=!1,q=!1,J=!1,Y=null,X=i(),Z=null;async function Ye(){if(K||q)return;K=!0,J||(J=!0,Ee(()=>{ge(),X.emit()}));let e=await Ze();e.length!==0&&(u(`Watching for changes in skill/command directories: ${e.join(`, `)}...`),U=t.watch(e,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:Z?.stabilityThreshold??We,pollInterval:Z?.pollInterval??Ge},ignored:(e,t)=>t&&!t.isFile()&&!t.isDirectory()?!0:e.split(z.sep).some(e=>e===`.git`),ignorePermissionErrors:!0,usePolling:Je,interval:Z?.chokidarInterval??qe,atomic:!0}),U.on(`add`,$),U.on(`change`,$),U.on(`unlink`,$),Y=ie(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 Xe=X.subscribe;async function Ze(){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){u(`Detected skill change: ${e}`),le(`tengu_skill_file_changed`,{source:`chokidar`}),Qe(e)}function Qe(e){G.add(e),W&&clearTimeout(W),W=setTimeout(async()=>{W=null;let e=[...G];if(G.clear(),O(await he(`skills`,e[0]))){u(`ConfigChange hook blocked skill reload (${e.length} paths)`);return}S(),ke(),de(),X.emit()},Z?.reloadDebounce??Ke)}async function $e(e){U&&(await U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),K=!1,q=!1,Z=e??null}var et={initialize:Ye,dispose:Q,subscribe:Xe,resetForTesting:$e};export{V as a,Ue as i,B as n,ze as o,He as r,H as s,et as t};
@@ -1 +0,0 @@
1
- import"./featureCheck-Cm0YNDXO.js";import"./instinctParser-DHMa8xa0.js";import"./skillGenerator-B9GM0LHk.js";import{p as e}from"./runtimeObserver-BhvHeiwD.js";import{o as t}from"./observationStore-tvkldXUo.js";import{c as n}from"./projectContext-eXMSfgdZ.js";import"./sessionObserver-CujNIWks.js";import"./toolEventObserver-D4h-QqVP.js";import"./skillGapStore-91Mb3xDY.js";import{t as r}from"./skillLearning-DbOOqb6b.js";r();export{e as loadInstincts,t as readObservations,n as resolveProjectContext};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{t}from"./featureCheck-Cm0YNDXO.js";import{b as n,m as r,o as i}from"./skillGenerator-B9GM0LHk.js";import{S as a,T as o,f as s,i as c,k as l,u}from"./runtimeObserver-BhvHeiwD.js";import{i as d}from"./observationStore-tvkldXUo.js";import{a as f}from"./projectContext-eXMSfgdZ.js";import{a as p,c as m,d as h,i as g}from"./sessionObserver-CujNIWks.js";import{n as _}from"./toolEventObserver-D4h-QqVP.js";import{n as v}from"./skillGapStore-91Mb3xDY.js";var y=e((()=>{t(),a(),n(),s(),d(),u(),f(),c(),h(),p(),l(),o(),_(),g(),v(),i(),r(),m()}));export{y as t};
@@ -1 +0,0 @@
1
- import{a as e,t}from"./teamHelpers-DEgaCpta.js";e();export{t as cleanupSessionTeams};
@@ -1 +0,0 @@
1
- import{a as e,t}from"./teammateModeSnapshot-Dyukgtp9.js";e();export{t as captureTeammateModeSnapshot};
@@ -1 +0,0 @@
1
- import{av as e,fv as t,iv as n,lv as r,sv as i}from"./loadAgentsDir-D7kapZB5.js";e();export{n as checkOutTeleportedSessionBranch,i as processMessagesForTeleportResume,r as teleportResumeCodeSession,t as validateGitState};
@@ -1 +0,0 @@
1
- import{n as e,r as t,t as n}from"./thinkback-CxWZV2Oz.js";e();export{n as call,t as playAnimation};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Lt as n,Rn as r,b as i,f as a,t as o,x as s}from"./src-Di342QoJ.js";import{t as c}from"./jsx-runtime-D-D469L8.js";import{al as l,el as u}from"./paths-1ngPRtu3.js";import{K as d,U as f,V as p,d as m,s as h}from"./debug-UI3T040K.js";import{r as g,t as _}from"./execa-CGue6Z3n.js";import{o as ee,s as v}from"./log-CzsijfHZ.js";import{i as te,o as y}from"./platform-CuyedWpe.js";import{r as b,t as ne}from"./execFileNoThrow-CuQN1sz8.js";import{As as x,Ax as S,DA as C,Es as w,Fs as T,Gs as re,Hs as ie,Is as ae,Vs as oe,fs as se,gy as E,kA as ce,kx as D,lc as O,ps as k,uc as A,vy as j}from"./loadAgentsDir-D7kapZB5.js";import{n as M,r as N}from"./pluginStartupCheck-RRcAbKfx.js";import{a as P,s as F}from"./pluginOperations-C9XP-mko.js";import{join as I}from"path";import{readFile as L}from"fs/promises";function R(){return process.env.USER_TYPE===`ant`?q:C}function z(){return process.env.USER_TYPE===`ant`?J:Y}function B(){return`thinkback@${R()}`}async function V(){let{enabled:e}=await k(),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 l(n)?n:null}async function H(e){let t=I(e,`year_in_review.js`),r=I(e,`player.js`);try{await L(t)}catch(e){return f(e)?{success:!1,message:`No animation found. Run /think-back first to generate one.`}:(v(e),{success:!1,message:`Could not access animation data: ${d(e).message}`})}try{await L(r)}catch(e){return f(e)?{success:!1,message:`Player script not found. The player.js file is missing from the thinkback skill.`}:(v(e),{success:!1,message:`Could not access player script: ${d(e).message}`})}let i=n.get(process.stdout);if(!i)return{success:!1,message:`Failed to access terminal instance`};i.enterAlternateScreen();try{await _(`node`,[r],{stdio:`inherit`,cwd:e,reject:!1})}catch{}finally{i.exitAlternateScreen()}let a=I(e,`year_in_review.html`);if(await l(a)){let e=te();ne(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[n,r]=(0,G.useState)({phase:`checking`}),[a,o]=(0,G.useState)(``);if((0,G.useEffect)(()=>{async function n(){try{let t=await ie(),n=R(),i=z(),a=B(),s=n in t,c=x(a);if(s?c||(r({phase:`installing-marketplace`}),o(`Updating marketplace…`),m(`Refreshing marketplace ${n}`),await re(n,e=>{o(e)}),ae(),O(),m(`Marketplace ${n} refreshed`)):(r({phase:`installing-marketplace`}),m(`Installing marketplace ${i}`),await T({source:`github`,repo:i},e=>{o(e)}),O(),m(`Marketplace ${n} installed`)),c){let{disabled:e}=await k();if(e.some(e=>e.name===`thinkback`||e.source?.includes(a))){r({phase:`enabling-plugin`}),m(`Enabling plugin ${a}`);let e=await P(a);if(!e.success)throw Error(`Failed to enable plugin: ${e.message}`);O(),m(`Plugin ${a} enabled`)}}else{r({phase:`installing-plugin`}),m(`Installing plugin ${a}`);let e=await N([a]);if(e.failed.length>0){let t=e.failed.map(e=>`${e.name}: ${e.error}`).join(`, `);throw Error(`Failed to install plugin: ${t}`)}O(),m(`Plugin ${a} installed`)}r({phase:`ready`}),e()}catch(e){let n=d(e);v(n),r({phase:`error`,message:n.message}),t(n.message)}}n()},[e,t]),n.phase===`error`)return(0,K.jsx)(s,{flexDirection:`column`,children:(0,K.jsxs)(i,{color:`error`,children:[`Error: `,n.message]})});if(n.phase===`ready`)return null;let c=n.phase===`checking`?`Checking thinkback installation…`:n.phase===`installing-marketplace`?`Installing marketplace…`:n.phase===`enabling-plugin`?`Enabling thinkback plugin…`:`Installing thinkback plugin…`;return(0,K.jsx)(s,{flexDirection:`column`,children:(0,K.jsxs)(s,{children:[(0,K.jsx)(E,{}),(0,K.jsx)(i,{children:a||c})]})})}function W({onDone:e,onAction:t,skillDir:n,hasGenerated:r}){let[o,c]=(0,G.useState)(!1),l=r?[{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(r){c(!0),r===`play`?H(n).then(()=>{e(void 0,{display:`skip`})}):t(r)}function d(){e(void 0,{display:`skip`})}return o?null:(0,K.jsx)(a,{title:`Think Back on 2025 with Claude Code`,subtitle:`Generate your 2025 Claude Code Think Back (takes a few minutes to run)`,onCancel:d,color:`claude`,children:(0,K.jsxs)(s,{flexDirection:`column`,gap:1,children:[!r&&(0,K.jsxs)(s,{flexDirection:`column`,children:[(0,K.jsx)(i,{children:`Relive your year of coding with Claude.`}),(0,K.jsx)(i,{dimColor:!0,children:`We'll create a personalized ASCII animation celebrating your journey.`})]}),(0,K.jsx)(D,{options:l,onChange:u,visibleOptionCount:5})]})})}function le({onDone:e}){let[t,n]=(0,G.useState)(!1),[r,a]=(0,G.useState)(null),[o,c]=(0,G.useState)(null),[u,d]=(0,G.useState)(null);function f(){n(!0)}let p=(0,G.useCallback)(t=>{a(t),e(`Error with thinkback: ${t}. Try running /plugin to manually install the think-back plugin.`,{display:`system`})},[e]);(0,G.useEffect)(()=>{t&&!o&&!r&&V().then(e=>{e?(m(`Thinkback skill directory: ${e}`),c(e)):p(`Could not find thinkback skill directory`)})},[t,o,r,p]),(0,G.useEffect)(()=>{if(!o)return;let e=I(o,`year_in_review.js`);l(e).then(t=>{m(`Checking for ${e}: ${t?`found`:`not found`}`),d(t)})},[o]);function h(t){e({edit:Z,fix:Q,regenerate:$}[t],{display:`user`,shouldQuery:!0})}return r?(0,K.jsxs)(s,{flexDirection:`column`,children:[(0,K.jsxs)(i,{color:`error`,children:[`Error: `,r]}),(0,K.jsx)(i,{dimColor:!0,children:`Try running /plugin to manually install the think-back plugin.`})]}):t?!o||u===null?(0,K.jsxs)(s,{children:[(0,K.jsx)(E,{}),(0,K.jsx)(i,{children:`Loading thinkback skill…`})]}):(0,K.jsx)(W,{onDone:e,onAction:h,skillDir:o,hasGenerated:u}):(0,K.jsx)(U,{onReady:f,onError:p})}async function ue(e){return(0,K.jsx)(le,{onDone:e})}var G,K,q,J,Y,X,Z,Q,$,de=e((()=>{g(),r(),G=t(r(),1),S(),o(),j(),F(),h(),p(),b(),u(),ee(),y(),A(),w(),oe(),ce(),se(),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 Claude Code 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 Claude Code 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 Claude Code 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}from"./chunk-DR8-3Aex.js";import{DA as t,Es as n,Ms as r,kA as i}from"./loadAgentsDir-D7kapZB5.js";import{n as a,r as o}from"./thinkback-CxWZV2Oz.js";import{join as s}from"path";function c(){return`thinkback@${process.env.USER_TYPE===`ant`?u:t}`}async function l(){let e=r(),t=c(),n=e.plugins[t];if(!n||n.length===0)return{type:`text`,value:`Thinkback plugin not installed. Run /think-back first to install it.`};let i=n[0];return i?.installPath?{type:`text`,value:(await o(s(i.installPath,`skills`,d))).message}:{type:`text`,value:`Thinkback plugin installation path not found.`}}var u,d;e((()=>{n(),i(),a(),u=`claude-code-marketplace`,d=`thinkback`}))();export{l as call};
@@ -1 +0,0 @@
1
- import{a as e,n as t}from"./chunk-DR8-3Aex.js";import{Dl as n,Ol as r,bl as i,yl as a}from"./paths-1ngPRtu3.js";import{$C as o,QC as s,lE as c,uE as l}from"./loadAgentsDir-D7kapZB5.js";import{s as u,u as d}from"./prompt-BBg3jtfc.js";function f(e){return h.some(t=>e.endsWith(t))}function p(e){return e.filter(e=>u.has(e.name)||f(e.name))}function m(e,t,n){let[a,s]=r(i([...e,...t],`name`),o),c=(e,t)=>e.name.localeCompare(t.name),l=[...s.sort(c),...a.sort(c)];return g&&g.isCoordinatorMode()?p(l):l}var h,g,_=t((()=>{n(),a(),d(),s(),h=[`subscribe_pr_activity`,`unsubscribe_pr_activity`],g=(l(),e(c))}));export{m as i,_ as n,f as r,p as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./toolPool-BHChMuLr.js";e();export{t as applyCoordinatorToolFilter};
@@ -1 +0,0 @@
1
- import{i as e,n as t}from"./undercover-DLyKv5TE.js";t();export{e as shouldShowUndercoverAutoNotice};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./upgrade-ByIumMQe.js";e();export{t as call};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./chunk-DR8-3Aex.js";import{Rn as n}from"./src-Di342QoJ.js";import{W as r,cn as i}from"./state-sIHsFpDu.js";import{AS as a,HS as o,Mb as s,Nb as c,US as l,jS as u}from"./loadAgentsDir-D7kapZB5.js";function d(){let{addNotification:e,removeNotification:t}=u(),[n,i]=(0,f.useState)(()=>{let{errors:e}=s();return e});return l((0,f.useCallback)(()=>{let{errors:e}=s();i(e)},[])),(0,f.useEffect)(()=>{r()||(n.length>0?e({key:p,text:`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`,color:`warning`,priority:`high`,timeoutMs:6e4}):t(p))},[n,e,t]),n}var f,p,m=e((()=>{f=t(n()),a(),i(),c(),o(),p=`settings-errors`}));export{d as n,m as t};
@@ -1 +0,0 @@
1
- import{Sp as e,yp as t}from"./loadAgentsDir-D7kapZB5.js";e();export{t as clearWebFetchCache};
@@ -1 +0,0 @@
1
- import{n as e}from"./chunk-DR8-3Aex.js";import{n as t,t as n}from"./axios-DhfaybwJ.js";import{Tt as r}from"./schemas-BGAvj1T4.js";import{t as i}from"./v4-f1i_CNUT.js";import{bs as a,gs as o,vs as s,xs as c,ys as l}from"./paths-1ngPRtu3.js";import{E as u,L as d,R as f,T as p,U as m,V as h,d as g,h as _,p as v,s as y,w as b}from"./debug-UI3T040K.js";import{o as x,s as S}from"./log-CzsijfHZ.js";import{BA as ee,EA as C,HA as w,TA as T,UA as E,eA as D,tA as O,wA as te,zA as ne}from"./loadAgentsDir-D7kapZB5.js";import{homedir as re}from"os";import*as k from"path";import{join as ie,resolve as ae}from"path";import{randomBytes as oe}from"crypto";import{readFile as A,readdir as j,rename as M,stat as N,unlink as P,writeFile as F}from"fs/promises";function I(){return ie(D(),U)}async function L(){let e=I();try{let t=p(await A(e,{encoding:`utf-8`}));if(typeof t!=`object`||!t||!(`version`in t)||!(`fetchedAt`in t)||!(`counts`in t))return g(`Install counts cache has invalid structure`),null;let n=t;if(n.version!==H)return g(`Install counts cache version mismatch (got ${n.version}, expected ${H})`),null;if(typeof n.fetchedAt!=`string`||!Array.isArray(n.counts))return g(`Install counts cache has invalid structure`),null;let r=new Date(n.fetchedAt).getTime();return Number.isNaN(r)?(g(`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>G?(g(`Install counts cache is stale (>24h old)`),null):{version:n.version,fetchedAt:n.fetchedAt,counts:n.counts}:(g(`Install counts cache has malformed entries`),null)}catch(e){return f(e)!==`ENOENT`&&g(`Failed to load install counts cache: ${d(e)}`),null}}async function R(e){let t=I(),n=`${t}.${oe(8).toString(`hex`)}.tmp`;try{let r=D();await v().mkdir(r),await F(n,u(e,null,2),{encoding:`utf-8`,mode:384}),await M(n,t),g(`Install counts cache saved successfully`)}catch(e){S(e);try{await P(n)}catch{}}}async function z(){g(`Fetching install counts from ${W}`);let e=performance.now();try{let n=await t.get(W,{timeout:1e4});if(!n.data?.plugins||!Array.isArray(n.data.plugins))throw Error(`Invalid response format from install counts API`);return C(`install_counts`,W,`success`,performance.now()-e),n.data.plugins}catch(t){throw C(`install_counts`,W,`failure`,performance.now()-e,te(t)),t}}async function B(){let e=await L();if(e){g(`Using cached install counts`),C(`install_counts`,W,`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 z();await R({version:H,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 S(e),g(`Failed to fetch install counts: ${d(e)}`),null}}function V(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 H,U,W,G,K=e((()=>{n(),y(),h(),_(),x(),b(),T(),O(),H=1,U=`install-counts-cache.json`,W=`https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json`,G=1440*60*1e3}));async function se(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=ae(t.startsWith(`~`)?t.replace(/^~/,re()):t),r;try{r=await n.stat(e)}catch(t){let n=f(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((()=>{h(),_()}));function le(e){let t=k.basename(e),n=k.basename(k.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=k.resolve(e),i;try{i=await A(r,{encoding:`utf-8`})}catch(e){let t=f(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${d(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: ${d(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 — Claude Code ignores it at load time.`});o=r}}let c=s().strict().safeParse(o);if(c.success||t.push(...q(c.error)),c.success){let e=c.data;/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e.name)||n.push({path:`name`,message:`Plugin name "${e.name}" is not kebab-case. Claude Code 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=k.resolve(e),o;try{o=await A(i,{encoding:`utf-8`})}catch(e){let t=f(e),n;return n=t===`ENOENT`?`File not found: ${i}`:t===`EISDIR`?`Path is not a file: ${i}`:`Failed to read file: ${d(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:i,fileType:`marketplace`}}let s;try{s=p(o)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${d(e)}`}],warnings:[],filePath:i,fileType:`marketplace`}}if(s&&typeof s==`object`){let e=s;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 c=a().extend({plugins:r(l().strict())}).strict().safeParse(s);if(c.success||t.push(...q(c.error)),c.success){let e=c.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=k.dirname(i),a=k.basename(r)===`.claude-plugin`?k.dirname(r):r;for(let[t,r]of e.plugins.entries()){if(!r.version||typeof r.source!=`string`||!r.source.startsWith(`./`))continue;let e=k.join(a,r.source,`.claude-plugin`,`plugin.json`),i;try{let t=p(await A(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(ne);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 o=a[1]||``,s;try{s=E(o)}catch(t){return r.push({path:`frontmatter`,message:`YAML frontmatter failed to parse: ${d(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 s!=`object`||!s||Array.isArray(s))return r.push({path:`frontmatter`,message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(s)?`an array`:s===null?`null`:typeof s}.`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n};let c=s;if(c.description!==void 0){let e=c.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}.`});c.name!==void 0&&c.name!==null&&typeof c.name!=`string`&&r.push({path:`name`,message:`name must be a string, got ${typeof c.name}.`});let l=c[`allowed-tools`];l!=null&&(typeof l!=`string`&&!Array.isArray(l)?r.push({path:`allowed-tools`,message:`allowed-tools must be a string or array of strings, got ${typeof l}.`}):Array.isArray(l)&&l.some(e=>typeof e!=`string`)&&r.push({path:`allowed-tools`,message:`allowed-tools array must contain only strings.`}));let u=c.shell;if(u!=null)if(typeof u!=`string`)r.push({path:`shell`,message:`shell must be a string, got ${typeof u}.`});else{let e=u.trim().toLowerCase();e!==`bash`&&e!==`powershell`&&r.push({path:`shell`,message:`shell must be 'bash' or 'powershell', got '${u}'.`})}return{success:r.length===0,errors:r,warnings:i,filePath:e,fileType:n}}async function Z(e){let t;try{t=await A(e,{encoding:`utf-8`})}catch(t){return f(t)===`ENOENT`?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:[{path:`file`,message:`Failed to read file: ${d(t)}`}],warnings:[],filePath:e,fileType:`hooks`}}let n;try{n=p(t)}catch(t){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${d(t)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:e,fileType:`hooks`}}let r=o().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 j(e,{withFileTypes:!0})}catch(e){let t=f(e);if(t===`ENOENT`||t===`ENOTDIR`)return[];throw e}if(t)return n.filter(e=>e.isDirectory()).map(t=>k.join(e,t.name,`SKILL.md`));let r=[];for(let t of n){let n=k.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`,k.join(e,`skills`)],[`agent`,k.join(e,`agents`)],[`command`,k.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 A(r,{encoding:`utf-8`})}catch(n){if(m(n))continue;t.push({success:!1,errors:[{path:`file`,message:`Failed to read: ${d(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(k.join(e,`hooks`,`hooks.json`));return(r.errors.length>0||r.warnings.length>0)&&t.push(r),t}async function pe(e){let t=k.resolve(e),n=null;try{n=await N(t)}catch(e){if(!m(e))throw e}if(n?.isDirectory()){let e=await X(k.join(t,`.claude-plugin`,`marketplace.json`));if(e.errors[0]?.code!==`ENOENT`)return e;let n=await Y(k.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 A(t,{encoding:`utf-8`}));if(Array.isArray(n.plugins))return X(e)}catch(e){if(f(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(),h(),ee(),b(),w(),c(),$=new Set([`category`,`source`,`tags`,`strict`,`id`])}));export{se as a,K as c,ce as i,pe as n,V as o,fe as r,B as s,me as t};
@@ -1 +0,0 @@
1
- import{a as e,i as t,n}from"./voiceModeEnabled-168-1Ocs.js";n();export{t as isVoiceGrowthBookEnabled,e as isVoiceModeEnabled};
@@ -1 +0,0 @@
1
- import{i as e,r as t}from"./voiceStreamSTT-B80UegKG.js";t();export{e as isVoiceStreamAvailable};
@@ -1 +0,0 @@
1
- import{wt as e,yt as t}from"./loadAgentsDir-D7kapZB5.js";e();export{t as execIntoTmuxWorktree};