@readmagic/workmate 0.0.13 → 0.0.14

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 (428) hide show
  1. package/dist/chunks/AddWorkspaceDirectory-m2d3nOQJ.js +1 -0
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-BRXGkHO4.js +1 -0
  3. package/dist/chunks/{AgentsMdExternalIncludesDialog-CH9x1Ngp.js → AgentsMdExternalIncludesDialog-D58Vn3SK.js} +1 -1
  4. package/dist/chunks/App-CeC-2dzL.js +1 -0
  5. package/dist/chunks/ApproveApiKey-DFpddLyp.js +1 -0
  6. package/dist/chunks/ApproveApiKey-NXTWIAMj.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-9ruzl1jm.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-B0BizN_J.js → BypassPermissionsModeDialog-C4QGpcBT.js} +1 -1
  9. package/dist/chunks/DiffDialog-LTdtTqsC.js +6 -0
  10. package/dist/chunks/Doctor-DmiDH-lg.js +1 -0
  11. package/dist/chunks/Doctor-Yvrzcrvx.js +3 -0
  12. package/dist/chunks/ExitFlow-DH0L3tyY.js +2 -0
  13. package/dist/chunks/{Grove-D0nn8zOV.js → Grove-BhhnrFX9.js} +1 -1
  14. package/dist/chunks/{HybridTransport-BQNLZNa_.js → HybridTransport-CEWG9ZRi.js} +2 -4
  15. package/dist/chunks/InvalidConfigDialog-Ue3kJUPJ.js +1 -0
  16. package/dist/chunks/InvalidSettingsDialog-BO2AOTVf.js +1 -0
  17. package/dist/chunks/MCPConnectionManager-Ciy9y9VV.js +1 -0
  18. package/dist/chunks/MCPToolListView-Ddmu2UcL.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-CUx2zexI.js → McpParsingWarnings-BsCDFWci.js} +1 -1
  20. package/dist/chunks/MessageSelector-DY5K0NHd.js +3 -0
  21. package/dist/chunks/Messages-LD6ZO301.js +10 -0
  22. package/dist/chunks/{Onboarding-t-P6Q5O6.js → Onboarding-w0-VVsDz.js} +1 -1
  23. package/dist/chunks/PermissionDialog-BPhvs5xH.js +1 -0
  24. package/dist/chunks/PressEnterToContinue-Dwoh6CaW.js +1 -0
  25. package/dist/chunks/{PromptInputFooterSuggestions-R12fbdmp.js → PromptInputFooterSuggestions-OEXx0Abp.js} +1 -1
  26. package/dist/chunks/PromptInputHelpMenu-DyaUsvNx.js +1 -0
  27. package/dist/chunks/QueryEngine-sH-KjJIq.js +1 -0
  28. package/dist/chunks/REPL-BMH_RItw.js +128 -0
  29. package/dist/chunks/REPL-DkPd3vk5.js +1 -0
  30. package/dist/chunks/RemoteSessionManager-DJhrR1dz.js +2 -0
  31. package/dist/chunks/ResumeConversation-BbNrpSFB.js +1 -0
  32. package/dist/chunks/SSETransport-CLiI2qnD.js +2 -0
  33. package/dist/chunks/{SearchBox-C9vUA4IM.js → SearchBox-CwwV0W-w.js} +1 -1
  34. package/dist/chunks/SearchExtraToolsTool-DupzA6Vm.js +1 -0
  35. package/dist/chunks/Settings-B1EI5LOU.js +2 -0
  36. package/dist/chunks/{TeleportProgress-3hmIApkj.js → TeleportProgress-IB--CbqZ.js} +1 -1
  37. package/dist/chunks/{TeleportRepoMismatchDialog-BA1a66RK.js → TeleportRepoMismatchDialog-KjdlS_gA.js} +1 -1
  38. package/dist/chunks/{TeleportResumeWrapper-BT4O-Wsi.js → TeleportResumeWrapper-DnHTI39O.js} +1 -1
  39. package/dist/chunks/ThemePicker-BrD_T7xF.js +1 -0
  40. package/dist/chunks/{TrustDialog-Dpk03V1Y.js → TrustDialog-L0rvvpit.js} +1 -1
  41. package/dist/chunks/ValidationErrorsList-QZvtUrAy.js +2 -0
  42. package/dist/chunks/add-dir-CpWXReCi.js +1 -0
  43. package/dist/chunks/{agentDisplay-D7bdOOG7.js → agentDisplay-CrQvGkTT.js} +1 -1
  44. package/dist/chunks/agents-BYQO6DbG.js +101 -0
  45. package/dist/chunks/{agents-22wiC58F.js → agents-C99yMsVF.js} +1 -1
  46. package/dist/chunks/allErrors-uyOMiF9U.js +1 -0
  47. package/dist/chunks/{api-f3GN2I_J.js → api-C5I2xwgd.js} +1 -1
  48. package/dist/chunks/api-j0iE1mkR.js +1 -0
  49. package/dist/chunks/attributionHooks-C0aXyx9L.js +1 -0
  50. package/dist/chunks/{auth-Czy7GoRh.js → auth-BYCRa_mb.js} +7 -12
  51. package/dist/chunks/auth-C9FUZzpW.js +1 -0
  52. package/dist/chunks/auth-DwPrlTHv.js +1 -0
  53. package/dist/chunks/backgroundHousekeeping-BxcVB3By.js +1 -0
  54. package/dist/chunks/backgroundHousekeeping-CjD8bACB.js +17 -0
  55. package/dist/chunks/{banner-BcAM7iSx.js → banner-HfMnBd03.js} +2 -2
  56. package/dist/chunks/{bg-Ci7pG4eo.js → bg-DltfF1_K.js} +2 -2
  57. package/dist/chunks/branch-BOWBZo5K.js +2 -0
  58. package/dist/chunks/{break-cache-4rlQORVk.js → break-cache-Cd1yQ-0h.js} +2 -3
  59. package/dist/chunks/bridgeConfig-Bxs5dqjH.js +1 -0
  60. package/dist/chunks/{bridgeConfig-B80T_lw7.js → bridgeConfig-CgAVrQfz.js} +1 -1
  61. package/dist/chunks/{bridgeMessaging-DyvHd16Z.js → bridgeMessaging-cOFtbkf_.js} +1 -1
  62. package/dist/chunks/{bridgePointer-DHWK3LEe.js → bridgePointer-CiHy2tTN.js} +1 -1
  63. package/dist/chunks/{bridgeStatusUtil-DStiD05t.js → bridgeStatusUtil-BQF0AJDO.js} +1 -1
  64. package/dist/chunks/btw-B0UmiVKl.js +1 -0
  65. package/dist/chunks/caches-C9--b9a7.js +1 -0
  66. package/dist/chunks/caches-wN3JyvNE.js +1 -0
  67. package/dist/chunks/{capacityWake-ByL6fM6I.js → capacityWake-LRiPhPeM.js} +1 -1
  68. package/dist/chunks/{ccrClient-BALhzhPF.js → ccrClient-wtUIz75R.js} +1 -1
  69. package/dist/chunks/{claudeDesktop-Ct_hyICL.js → claudeDesktop-DPIJpc1V.js} +1 -1
  70. package/dist/chunks/{clear-B_yVyJXP.js → clear-CNzBoL7O.js} +1 -1
  71. package/dist/chunks/{cliLaunch-OPOtzhvA.js → cliLaunch-xIVvtPZy.js} +1 -1
  72. package/dist/chunks/{client-BMA05FW8.js → client-B7WkO81L.js} +1 -1
  73. package/dist/chunks/client-BCzhAEd0.js +1 -0
  74. package/dist/chunks/client-Dr9AYB-r.js +1 -0
  75. package/dist/chunks/commands-DTB0Qzd5.js +1 -0
  76. package/dist/chunks/compact-Bj8mdDYN.js +2 -0
  77. package/dist/chunks/config-B1kYcRIP.js +1 -0
  78. package/dist/chunks/{config-9rLTDOYW.js → config-BkbL2e5Q.js} +1 -1
  79. package/dist/chunks/{config-DMKtiMzJ.js → config-WMxn2jLl.js} +1 -1
  80. package/dist/chunks/context-DB1Ar85E.js +1 -0
  81. package/dist/chunks/context-noninteractive-Bno2Xsmp.js +1 -0
  82. package/dist/chunks/{context-noninteractive-CHzerxnH.js → context-noninteractive-CqnJTDcI.js} +2 -2
  83. package/dist/chunks/conversation-DOgBzrm0.js +1 -0
  84. package/dist/chunks/conversation-hNXWaswI.js +1 -0
  85. package/dist/chunks/{createSSHSession-XkHMiGRN.js → createSSHSession-Cf2tOgK_.js} +3 -4
  86. package/dist/chunks/createSession-BZx-2UIB.js +1 -0
  87. package/dist/chunks/{createSession-BNGm9fL4.js → createSession-DD5YaQKM.js} +1 -1
  88. package/dist/chunks/crossProjectResume-CkiPQYYE.js +40 -0
  89. package/dist/chunks/{datadog-3WUWcCFn.js → datadog-DcLf1QpG.js} +1 -1
  90. package/dist/chunks/{debug-Dr1SjdXn.js → debug-BQj6h99Q.js} +1 -1
  91. package/dist/chunks/debugUtils-B86DM1Sp.js +1 -0
  92. package/dist/chunks/{detached-CqfQYVOi.js → detached--wGwkuHX.js} +1 -2
  93. package/dist/chunks/{detectRepository-CMEkS5_2.js → detectRepository-Qy3zKoyn.js} +1 -1
  94. package/dist/chunks/detectRepository-tRUoPOKy.js +1 -0
  95. package/dist/chunks/{diff-CKlLimGq.js → diff-dfXWiuLA.js} +1 -1
  96. package/dist/chunks/directoryCompletion-BtlRKLzw.js +1 -0
  97. package/dist/chunks/doctor-aKE2bG5C.js +1 -0
  98. package/dist/chunks/{entry-DCbq734V.js → entry-wISucmYc.js} +4 -5
  99. package/dist/chunks/esm-CrJVXrKW.js +1 -0
  100. package/dist/chunks/{execFileNoThrow-mXq4K0rl.js → execFileNoThrow-DYm1GeGn.js} +1 -1
  101. package/dist/chunks/{execSyncWrapper-Ne33rRiD.js → execSyncWrapper-CqvQqke-.js} +1 -1
  102. package/dist/chunks/exit-pjN4EJHV.js +1 -0
  103. package/dist/chunks/exit-s9XGerrH.js +1 -0
  104. package/dist/chunks/{extraUsage-C86bZVgt.js → extraUsage-CwDhpClH.js} +1 -1
  105. package/dist/chunks/extractMemories-WmPLOLUT.js +1 -0
  106. package/dist/chunks/fast-BVABmasw.js +1 -0
  107. package/dist/chunks/fast-Cuj3bfFm.js +1 -0
  108. package/dist/chunks/{fileSuggestions-BalHmi1-.js → fileSuggestions-Dy2BUZzd.js} +2 -2
  109. package/dist/chunks/firstPartyEventLogger-CabA8fu0.js +1 -0
  110. package/dist/chunks/{firstPartyEventLogger-1RTgXHSz.js → firstPartyEventLogger-D4yuDP-n.js} +3 -5
  111. package/dist/chunks/flushGate-B6ecrC4j.js +1 -0
  112. package/dist/chunks/{fpsMetrics-DffAomdg.js → fpsMetrics-Dk_pnSHJ.js} +1 -1
  113. package/dist/chunks/gemini-BC-BxZmj.js +1 -0
  114. package/dist/chunks/generateSessionName-JTR8nPYD.js +1 -0
  115. package/dist/chunks/{genericProcessUtils-Dc1pfb7J.js → genericProcessUtils-Bbcbi11g.js} +1 -1
  116. package/dist/chunks/git-BaSq69E7.js +1 -0
  117. package/dist/chunks/{git-CoQQ6YEf.js → git-DplvjXEY.js} +2 -3
  118. package/dist/chunks/{githubRepoPathMapping-CmpEaQoo.js → githubRepoPathMapping-Bk4FZrng.js} +1 -1
  119. package/dist/chunks/goal-B09SOyra.js +3 -0
  120. package/dist/chunks/grok-BBo3jGfP.js +1 -0
  121. package/dist/chunks/{grove-b9gGKgu4.js → grove-DsAIY-rZ.js} +2 -2
  122. package/dist/chunks/help-CELr6oJZ.js +1 -0
  123. package/dist/chunks/hooks-9rkDD2iw.js +1 -0
  124. package/dist/chunks/{hooks-C-QMGvCg.js → hooks-BI4NY5IC.js} +2 -2
  125. package/dist/chunks/initReplBridge-BYrL6ou1.js +1 -0
  126. package/dist/chunks/{install-DGH_bjUh.js → install-Dn3_M1Ui.js} +1 -1
  127. package/dist/chunks/{instrumentation-DQ705pC7.js → instrumentation-5cSwEKaF.js} +4 -4
  128. package/dist/chunks/{job-BaMT6Lb2.js → job-rW1mEYtm.js} +1 -1
  129. package/dist/chunks/{jwtUtils-FQWtM6iM.js → jwtUtils-YCoZL0FW.js} +1 -1
  130. package/dist/chunks/keybindings-B5kUoxvg.js +1 -0
  131. package/dist/chunks/{launchLocalMemory-CtZrkmaw.js → launchLocalMemory-CPucX8Xj.js} +2 -2
  132. package/dist/chunks/launchOnboarding--GCJWeeS.js +8 -0
  133. package/dist/chunks/loadAgentsDir-D-a1uUb5.js +1 -0
  134. package/dist/chunks/{loadAgentsDir-mcRW90aq.js → loadAgentsDir-JrGMJN05.js} +656 -693
  135. package/dist/chunks/loadPluginHooks-C4zrlV0u.js +1 -0
  136. package/dist/chunks/localSearch-C-stDP9C.js +1 -0
  137. package/dist/chunks/localSearch-hOERAH9v.js +1 -0
  138. package/dist/chunks/{log-27kCA_9u.js → log-BlJ7CcKG.js} +1 -1
  139. package/dist/chunks/{logoV2Utils--8OUQQPd.js → logoV2Utils-J2Sqfube.js} +1 -1
  140. package/dist/chunks/{magicDocs-26J_l1De.js → magicDocs-Dpe3YhyL.js} +2 -2
  141. package/dist/chunks/main-C_PDzJdv.js +356 -0
  142. package/dist/chunks/{main-CGLCy2pM.js → main-Zh18lf2J.js} +2 -2
  143. package/dist/chunks/managedEnv-AEhH_HUs.js +1 -0
  144. package/dist/chunks/{managedEnv-Ds6MlFQE.js → managedEnv-C8SisyLk.js} +1 -1
  145. package/dist/chunks/{mappers-DwZw084m.js → mappers-CMJorgSL.js} +1 -1
  146. package/dist/chunks/mcp-B2mJmWKt.js +6 -0
  147. package/dist/chunks/mcp-SuAh71Ht.js +2 -0
  148. package/dist/chunks/mcp-_tBxhPV-.js +1 -0
  149. package/dist/chunks/{memoize-Co4vS6UF.js → memoize-_2f7NWDv.js} +1 -1
  150. package/dist/chunks/memory-DK8bOrUr.js +1 -0
  151. package/dist/chunks/{modalContext-CUThy6Ph.js → modalContext-wY9CeN4G.js} +1 -1
  152. package/dist/chunks/{mode-B80CHkqo.js → mode-BhfhEpnW.js} +2 -2
  153. package/dist/chunks/model-BCM7RpVk.js +1 -0
  154. package/dist/chunks/model-BWR43D3c.js +1 -0
  155. package/dist/chunks/model-CmDF8O9G.js +1 -0
  156. package/dist/chunks/modelOptions-DEQat7lU.js +1 -0
  157. package/dist/chunks/nativeInstaller-xxyUjXbl.js +1 -0
  158. package/dist/chunks/{omit-KEhe84f4.js → omit-od_CYp5o.js} +1 -1
  159. package/dist/chunks/{onChangeAppState-Dq1tIEJI.js → onChangeAppState-CqTb0yEa.js} +1 -1
  160. package/dist/chunks/openai-qW8mATAs.js +10 -0
  161. package/dist/chunks/{panel-CoF2a-h4.js → panel-Bg_0PHE6.js} +1 -1
  162. package/dist/chunks/{parser-CUUiH40T.js → parser-a2S_eFyE.js} +1 -1
  163. package/dist/chunks/parser-x-w3ikxt.js +1 -0
  164. package/dist/chunks/{partition-DeT341qu.js → partition-CYoWXLNU.js} +1 -1
  165. package/dist/chunks/permissions--iKUbWBw.js +3 -0
  166. package/dist/chunks/pidLock-BR4hzYgp.js +3 -0
  167. package/dist/chunks/plan-DiHCGXhM.js +1 -0
  168. package/dist/chunks/{platform-Dg1c9F_1.js → platform-DVeTi9mp.js} +2 -2
  169. package/dist/chunks/plugin-BeC4D7XF.js +17 -0
  170. package/dist/chunks/pluginAutoupdate-Bj-CrFuO.js +1 -0
  171. package/dist/chunks/{pluginBlocklist-BfoLN9a-.js → pluginBlocklist-DzOs-RS1.js} +1 -1
  172. package/dist/chunks/{pluginCliCommands-Bc2Iybhz.js → pluginCliCommands-DwIGn58t.js} +1 -1
  173. package/dist/chunks/{pluginFlagging-Cr0d0hBA.js → pluginFlagging-BzuymJuf.js} +1 -1
  174. package/dist/chunks/pluginOperations-CP1v-nu0.js +2 -0
  175. package/dist/chunks/pluginStartupCheck-BGN6Je6d.js +1 -0
  176. package/dist/chunks/{pluginStartupCheck-DiCDQQlr.js → pluginStartupCheck-BUeBiYVq.js} +1 -1
  177. package/dist/chunks/plugins-D1N31THW.js +4 -0
  178. package/dist/chunks/{poorMode-DxgO_bUb.js → poorMode-D4L_-yWS.js} +1 -1
  179. package/dist/chunks/poorMode-XDBnxTiF.js +1 -0
  180. package/dist/chunks/print-DaJi1wF_.js +14 -0
  181. package/dist/chunks/processBashCommand-BGCIqxc9.js +1 -0
  182. package/dist/chunks/processSlashCommand-qR_j1DE8.js +5 -0
  183. package/dist/chunks/prompt-B0gADAvI.js +1 -0
  184. package/dist/chunks/{prompt-DIlq8NTy.js → prompt-DnPppVz8.js} +21 -23
  185. package/dist/chunks/prompt-DqyEtC_I2.js +1 -0
  186. package/dist/chunks/{promptEditor-BILqOGl1.js → promptEditor-Cilc9N3L.js} +3 -3
  187. package/dist/chunks/protocolHandler-DdbiucQa.js +13 -0
  188. package/dist/chunks/{proxy-BEKNaTXI.js → proxy-C0j74LqT.js} +1 -1
  189. package/dist/chunks/reconciler-Bte4gdP-.js +1 -0
  190. package/dist/chunks/refresh-MiZ0acBm.js +1 -0
  191. package/dist/chunks/registerProtocol-Bpte9dly.js +1 -0
  192. package/dist/chunks/{reload-plugins-CGb0HTsH.js → reload-plugins-GdqFZblC.js} +1 -1
  193. package/dist/chunks/{remoteBridgeCore-BmteXmI9.js → remoteBridgeCore-CAl3_H-O.js} +1 -1
  194. package/dist/chunks/{remoteManagedSettings-CwDGxL5p.js → remoteManagedSettings-BcLJLEr7.js} +1 -1
  195. package/dist/chunks/rename-BDo5qIK0.js +1 -0
  196. package/dist/chunks/{renderOptions-45A-EdsK.js → renderOptions-CkqTbz6d.js} +1 -1
  197. package/dist/chunks/resume-Bbweh2hA.js +2 -0
  198. package/dist/chunks/ripgrep-DrpZ79Pp.js +1 -0
  199. package/dist/chunks/{ripgrep-DQ_ILUJV.js → ripgrep-X5m4gJ-3.js} +1 -1
  200. package/dist/chunks/{runtimeObserver-CtNY8Al2.js → runtimeObserver-CxXxUcrm.js} +1 -1
  201. package/dist/chunks/{runtimeObserver-4ZqaCXYy.js → runtimeObserver-Hjbo43xj.js} +4 -4
  202. package/dist/chunks/sandbox-adapter-DQ_fJSIo.js +1 -0
  203. package/dist/chunks/sandbox-toggle-DmNSThQK.js +1 -0
  204. package/dist/chunks/searchExtraTools-C7b2x2p_.js +1 -0
  205. package/dist/chunks/{session-wb6X4Wrq.js → session-CkuTMD_4.js} +2 -2
  206. package/dist/chunks/sessionFileAccessHooks-CQvGAbvL.js +1 -0
  207. package/dist/chunks/{sessionIdCompat-DMayYBrf.js → sessionIdCompat-Dgp6PW_1.js} +1 -1
  208. package/dist/chunks/sessionObserver-BoQY7nOa.js +1 -0
  209. package/dist/chunks/{sessionObserver-BJQ5hwjU.js → sessionObserver-CvQ6oyoj.js} +2 -2
  210. package/dist/chunks/sessionState-C2REgUrs.js +11 -0
  211. package/dist/chunks/sessionStorage-BeaEgnaa.js +1 -0
  212. package/dist/chunks/sessionStoragePortable-x0Yn02-G.js +3 -0
  213. package/dist/chunks/{sessionTitle-Cbzrb9jT.js → sessionTitle-2IWcNB8H.js} +2 -2
  214. package/dist/chunks/{sessionTracing-CEsm8pZL.js → sessionTracing-Bm7hQKHA.js} +2 -2
  215. package/dist/chunks/settings-Da6ax5aI.js +1 -0
  216. package/dist/chunks/{settings-DiBMs2gM.js → settings-aUygByiZ.js} +4 -5
  217. package/dist/chunks/settingsSync-DgzCU1BZ.js +1 -0
  218. package/dist/chunks/setup-CvaG4nl5.js +3 -0
  219. package/dist/chunks/{shadowedRuleDetection-D5X5fhzj.js → shadowedRuleDetection-CWCQ5dZ0.js} +1 -1
  220. package/dist/chunks/{shellQuote-C_I6DHLV.js → shellQuote-D3Ocv_U-.js} +1 -1
  221. package/dist/chunks/{sideQuestion-BHRtwhyj.js → sideQuestion-BoW-xYkh.js} +3 -3
  222. package/dist/chunks/sinks-B_ehGpvp.js +1 -0
  223. package/dist/chunks/sinks-ZHKfs6gv.js +1 -0
  224. package/dist/chunks/skillChangeDetector-C-HWR_8v.js +1 -0
  225. package/dist/chunks/{skillGapStore-BjQSSz2E.js → skillGapStore-CCNeSjIb.js} +2 -2
  226. package/dist/chunks/{skillLifecycle-Sp8strFv.js → skillLifecycle-wU4JDNYQ.js} +2 -2
  227. package/dist/chunks/{skillSearchPanel-3sYRez_Q.js → skillSearchPanel-Cxr1QQn4.js} +4 -4
  228. package/dist/chunks/skills-BghnKnNo.js +1 -0
  229. package/dist/chunks/{src-r6ZFgWPx2.js → src-D3yIF9I42.js} +1 -1
  230. package/dist/chunks/src-DL3w8VPk2.js +51 -0
  231. package/dist/chunks/{startupProfiler-Dc5r6LgE.js → startupProfiler-2sjXZkIP.js} +1 -1
  232. package/dist/chunks/startupProfiler-B2fyaBEa.js +1 -0
  233. package/dist/chunks/{staticRender-DrU6eWoq.js → staticRender-D9AbnQFr.js} +1 -1
  234. package/dist/chunks/{stats-BkadEKa-.js → stats-unp6R0Ah.js} +1 -1
  235. package/dist/chunks/status-BraYBx4N.js +2 -0
  236. package/dist/chunks/status-DwyWiaVc.js +1 -0
  237. package/dist/chunks/statusNoticeHelpers-Dm1aiibR.js +1 -0
  238. package/dist/chunks/{stringUtils-Df-Lnjxd.js → stringUtils-BjnclTLB.js} +3 -3
  239. package/dist/chunks/{switcher-uoQMHmEZ.js → switcher-BUNSEJ-7.js} +1 -1
  240. package/dist/chunks/switcher-DDUnWU_4.js +1 -0
  241. package/dist/chunks/{syncCache-BooMjgU6.js → syncCache-1s9xV8WV.js} +1 -1
  242. package/dist/chunks/tasks-BjFot03S.js +1 -0
  243. package/dist/chunks/teleport-Dj2Kvbmx.js +1 -0
  244. package/dist/chunks/{templateJobs-BYYfF4m5.js → templateJobs-CY7GNRo5.js} +1 -3
  245. package/dist/chunks/{terminalSetup-fwhFTxGi.js → terminalSetup-CpMNk6dc.js} +5 -6
  246. package/dist/chunks/{terminalSetup-CbXKCpWM.js → terminalSetup-Ty8T8ePM.js} +1 -1
  247. package/dist/chunks/theme-c6grxWNn.js +1 -0
  248. package/dist/chunks/{tmux-d3cNCIZA.js → tmux-g0cQ0Buz.js} +1 -1
  249. package/dist/chunks/{toolEventObserver-BFEl47bq.js → toolEventObserver-D7WbjgFR.js} +1 -1
  250. package/dist/chunks/toolPool-O5nkEFb1.js +1 -0
  251. package/dist/chunks/{trustedDevice-BLiKbGpG.js → trustedDevice-BF78PNK8.js} +1 -1
  252. package/dist/chunks/trustedDevice-D_z7bAQh.js +1 -0
  253. package/dist/chunks/{types-BJ7qTz75.js → types-BomO8WUz.js} +1 -1
  254. package/dist/chunks/{udsClient-CF8BmZgN.js → udsClient-DSvRPCvR.js} +1 -1
  255. package/dist/chunks/updateCCB-ts7Joyve.js +5 -0
  256. package/dist/chunks/upstreamproxy-DYoLvdM9.js +10 -0
  257. package/dist/chunks/useExitOnCtrlCDWithKeybindings-qLfN0tc-.js +1 -0
  258. package/dist/chunks/useMainLoopModel-DkjG_ikT.js +1 -0
  259. package/dist/chunks/useManagePlugins-E0Qzj-ws.js +1 -0
  260. package/dist/chunks/useMergedTools-B7iYaNwM.js +1 -0
  261. package/dist/chunks/{useSearchInput-KFKh2ozY.js → useSearchInput-CsxiM9i0.js} +1 -1
  262. package/dist/chunks/useSettingsErrors-DdVTahNa.js +1 -0
  263. package/dist/chunks/{userAgent-DUrr02yh.js → userAgent-BggRZ-ZE.js} +1 -1
  264. package/dist/chunks/util-Xdy1nOjj.js +1 -0
  265. package/dist/chunks/validatePlugin-Be5aSSnP.js +1 -0
  266. package/dist/chunks/{vim-C4Hs5U2h.js → vim-cFcxfuac.js} +1 -1
  267. package/dist/chunks/{which-mplwBbc0.js → which-BR8YVCCW.js} +1 -1
  268. package/dist/chunks/{windowsPaths-C7Mdo9aU.js → windowsPaths-BmXyrasP.js} +1 -1
  269. package/dist/chunks/windowsPaths-BybjGW7e.js +1 -0
  270. package/dist/chunks/{workSecret-XLodD7tw.js → workSecret-BUd8cQ6-.js} +1 -1
  271. package/dist/chunks/workerRegistry-GrD7IAVQ.js +2 -0
  272. package/dist/chunks/worktree-V7xiUAtl.js +1 -0
  273. package/dist/cli.js +1 -1
  274. package/package.json +1 -1
  275. package/dist/chunks/AddWorkspaceDirectory-BzNj9rS6.js +0 -1
  276. package/dist/chunks/AgentsMdExternalIncludesDialog-CDZPR488.js +0 -1
  277. package/dist/chunks/App-D-bYAYAl.js +0 -1
  278. package/dist/chunks/ApproveApiKey-BEGV9Zj9.js +0 -1
  279. package/dist/chunks/ApproveApiKey-CjacpIqq.js +0 -1
  280. package/dist/chunks/BackgroundTasksDialog-A9hw_SV0.js +0 -2
  281. package/dist/chunks/DiffDialog-mQ-5_TSv.js +0 -6
  282. package/dist/chunks/Doctor-BC6IuQhd.js +0 -3
  283. package/dist/chunks/Doctor-i_5_AQd-.js +0 -1
  284. package/dist/chunks/ExitFlow-Bu2cVGpC.js +0 -2
  285. package/dist/chunks/InvalidConfigDialog-C5CIiSIE.js +0 -1
  286. package/dist/chunks/InvalidSettingsDialog-Dq7hKXcO.js +0 -1
  287. package/dist/chunks/MCPConnectionManager-aDDsYkGM.js +0 -1
  288. package/dist/chunks/MCPToolListView-Cr0MDkzT.js +0 -1
  289. package/dist/chunks/MessageSelector-DwGOWKKL.js +0 -3
  290. package/dist/chunks/Messages-C1jh4ixt.js +0 -11
  291. package/dist/chunks/PermissionDialog-Cb3z8OUP.js +0 -1
  292. package/dist/chunks/PressEnterToContinue-Dq0Imo9c.js +0 -1
  293. package/dist/chunks/PromptInputHelpMenu-BgADIzRj.js +0 -1
  294. package/dist/chunks/QueryEngine-HlLQJmsd.js +0 -1
  295. package/dist/chunks/REPL-Rs_JQkDc.js +0 -1
  296. package/dist/chunks/REPL-VKAmKkII.js +0 -133
  297. package/dist/chunks/RemoteSessionManager-BbgXeM-t.js +0 -2
  298. package/dist/chunks/ResumeConversation-66zbx12g.js +0 -1
  299. package/dist/chunks/SSETransport-BBQkdn4e.js +0 -4
  300. package/dist/chunks/SearchExtraToolsTool-Bq87I_vu.js +0 -1
  301. package/dist/chunks/Settings-BKdLcyXe.js +0 -2
  302. package/dist/chunks/ThemePicker-DUlhcoso.js +0 -1
  303. package/dist/chunks/ValidationErrorsList-DSSUWdgd.js +0 -2
  304. package/dist/chunks/add-dir-BUr0z-VU.js +0 -1
  305. package/dist/chunks/agents-8ELI8RJo.js +0 -103
  306. package/dist/chunks/allErrors-C1eMbHSv.js +0 -1
  307. package/dist/chunks/api-DgjIFdMn.js +0 -1
  308. package/dist/chunks/attributionHooks-CUAoGkU6.js +0 -1
  309. package/dist/chunks/auth-B73a4Cob.js +0 -1
  310. package/dist/chunks/auth-D_0waidQ.js +0 -1
  311. package/dist/chunks/autoModeDenials-BxNzGJdR.js +0 -1
  312. package/dist/chunks/backgroundHousekeeping-C_ArdTFX.js +0 -17
  313. package/dist/chunks/backgroundHousekeeping-YJhvZ0dh.js +0 -1
  314. package/dist/chunks/branch-bb4-bErF.js +0 -3
  315. package/dist/chunks/bridgeConfig-DywkIo_k.js +0 -1
  316. package/dist/chunks/btw-BRmV51bR.js +0 -1
  317. package/dist/chunks/caches-C5DIVdvI.js +0 -1
  318. package/dist/chunks/caches-zDZEgNKq.js +0 -1
  319. package/dist/chunks/client-7lIxWcaM.js +0 -1
  320. package/dist/chunks/client-DVg8PpFX.js +0 -1
  321. package/dist/chunks/commands-ByFXqW43.js +0 -1
  322. package/dist/chunks/compact-BUShp2eQ.js +0 -2
  323. package/dist/chunks/config-BwHNU_pI.js +0 -1
  324. package/dist/chunks/context-6Pk3iVhh.js +0 -1
  325. package/dist/chunks/context-noninteractive-DFwRQyFE.js +0 -1
  326. package/dist/chunks/conversation-5zb5XkSA.js +0 -1
  327. package/dist/chunks/conversation-JP2ZXrwu.js +0 -1
  328. package/dist/chunks/createSession-VTqzWAu6.js +0 -1
  329. package/dist/chunks/crossProjectResume-DxgQVYSi.js +0 -40
  330. package/dist/chunks/debugUtils-cK-iOsEV.js +0 -1
  331. package/dist/chunks/detectRepository-BsKZDRoI.js +0 -1
  332. package/dist/chunks/directoryCompletion-ByBTSuLu.js +0 -1
  333. package/dist/chunks/doctor-Bvx0u0sO.js +0 -1
  334. package/dist/chunks/esm-CtQkOk5D.js +0 -1
  335. package/dist/chunks/exit-BOhGfSlm.js +0 -2
  336. package/dist/chunks/exit-DTsz5Lcb.js +0 -1
  337. package/dist/chunks/extractMemories-6OnMgL2S.js +0 -1
  338. package/dist/chunks/fast-B2ziqJEA.js +0 -1
  339. package/dist/chunks/fast-BkhjaTkZ.js +0 -1
  340. package/dist/chunks/firstPartyEventLogger-CXMzhLrF.js +0 -1
  341. package/dist/chunks/flushGate-DWL05x7v.js +0 -1
  342. package/dist/chunks/gemini-BLpLJyli.js +0 -1
  343. package/dist/chunks/generateSessionName-CdbMksHi.js +0 -1
  344. package/dist/chunks/git-Bs1vtuvX.js +0 -1
  345. package/dist/chunks/goal-V3qix-i1.js +0 -3
  346. package/dist/chunks/grok-BLLATotv.js +0 -1
  347. package/dist/chunks/help-BR7UEr5R.js +0 -1
  348. package/dist/chunks/hooks-D6wtd0Qq.js +0 -1
  349. package/dist/chunks/initReplBridge-DyScxedy.js +0 -1
  350. package/dist/chunks/keybindings-CG292HS1.js +0 -2
  351. package/dist/chunks/launchOnboarding-CyOtdZkT.js +0 -8
  352. package/dist/chunks/loadAgentsDir-4UC4yLg1.js +0 -1
  353. package/dist/chunks/loadPluginHooks-CWI0RMUx.js +0 -1
  354. package/dist/chunks/localSearch-CCCDKpYx.js +0 -1
  355. package/dist/chunks/localSearch-D4hVR7-d.js +0 -1
  356. package/dist/chunks/main-DUjtDK1Q.js +0 -513
  357. package/dist/chunks/managedEnv-BuCurT_S.js +0 -1
  358. package/dist/chunks/mcp-CEKR7PjL.js +0 -6
  359. package/dist/chunks/mcp-DCAf2hHD.js +0 -1
  360. package/dist/chunks/mcp-mCuc8dNe.js +0 -2
  361. package/dist/chunks/memory-B5SkpC7u.js +0 -1
  362. package/dist/chunks/model-BqaneI4D.js +0 -1
  363. package/dist/chunks/model-C29_32BD.js +0 -1
  364. package/dist/chunks/model-NG8fvuT2.js +0 -1
  365. package/dist/chunks/modelOptions-CiZgZxZC.js +0 -1
  366. package/dist/chunks/nativeInstaller-DqbEfGSX.js +0 -1
  367. package/dist/chunks/openai-BvnsYTpQ.js +0 -10
  368. package/dist/chunks/parser-B2PlJg4C.js +0 -1
  369. package/dist/chunks/permissions-BPpeHxpk.js +0 -3
  370. package/dist/chunks/pidLock-DQGDoFQP.js +0 -3
  371. package/dist/chunks/plan-BRiC5ujG.js +0 -1
  372. package/dist/chunks/plugin-Dcg_GGR9.js +0 -17
  373. package/dist/chunks/pluginAutoupdate-ByH9IPC9.js +0 -1
  374. package/dist/chunks/pluginOperations-CKNyYjS-.js +0 -2
  375. package/dist/chunks/pluginStartupCheck-B48_cGgo.js +0 -1
  376. package/dist/chunks/plugins-BP_36tOl.js +0 -4
  377. package/dist/chunks/poorMode-Djw0P9Gu.js +0 -1
  378. package/dist/chunks/print-2uavraPq.js +0 -26
  379. package/dist/chunks/processBashCommand-g3sAMpHt.js +0 -1
  380. package/dist/chunks/processSlashCommand-tIbeCrv5.js +0 -5
  381. package/dist/chunks/prompt-DLv-Cd67.js +0 -1
  382. package/dist/chunks/prompt-DV5tCLRh.js +0 -1
  383. package/dist/chunks/protocolHandler-B83fCYI4.js +0 -13
  384. package/dist/chunks/reconciler-CDq6XgAS.js +0 -1
  385. package/dist/chunks/refresh-ysrhoWCo.js +0 -1
  386. package/dist/chunks/registerProtocol-DduKPsn_.js +0 -36
  387. package/dist/chunks/rename-1GLIUlYk.js +0 -1
  388. package/dist/chunks/resume-DWtlUiHW.js +0 -2
  389. package/dist/chunks/ripgrep-BLQnqPnE.js +0 -1
  390. package/dist/chunks/sandbox-adapter-BzjRQh_r.js +0 -1
  391. package/dist/chunks/sandbox-toggle-Bz49-F6e.js +0 -1
  392. package/dist/chunks/searchExtraTools-D6vj8qJ-.js +0 -1
  393. package/dist/chunks/sessionFileAccessHooks-Da97UA2n.js +0 -1
  394. package/dist/chunks/sessionObserver-DXO4trhk.js +0 -1
  395. package/dist/chunks/sessionState-Bn3ESS5f.js +0 -11
  396. package/dist/chunks/sessionStorage-DlPVsQn9.js +0 -1
  397. package/dist/chunks/sessionStoragePortable-BhkGMZWp.js +0 -3
  398. package/dist/chunks/settings-3ionQKNv.js +0 -1
  399. package/dist/chunks/settingsSync-eHaSngKo.js +0 -1
  400. package/dist/chunks/setup-DeyiuGNX.js +0 -3
  401. package/dist/chunks/sinks-Bgy2UNK-.js +0 -2
  402. package/dist/chunks/sinks-CgzLmim2.js +0 -1
  403. package/dist/chunks/skillChangeDetector-BlSP16j6.js +0 -1
  404. package/dist/chunks/skills-CJhWI8t1.js +0 -1
  405. package/dist/chunks/src-P_wYS_NJ2.js +0 -53
  406. package/dist/chunks/startupProfiler-CUlV07MD.js +0 -1
  407. package/dist/chunks/status-CDCurOqs.js +0 -2
  408. package/dist/chunks/status-yoQIQ2Ni.js +0 -1
  409. package/dist/chunks/statusNoticeHelpers-Sl4jjauz.js +0 -1
  410. package/dist/chunks/switcher-C-m6MUwE.js +0 -1
  411. package/dist/chunks/tasks-CHG_6sXQ.js +0 -1
  412. package/dist/chunks/teleport-C9KRE4X8.js +0 -1
  413. package/dist/chunks/theme-MvX7hojJ.js +0 -1
  414. package/dist/chunks/toolPool-Cq74Cvjp.js +0 -1
  415. package/dist/chunks/trustedDevice-BGwujSqc.js +0 -1
  416. package/dist/chunks/updateCCB-CfckOy7T.js +0 -11
  417. package/dist/chunks/upstreamproxy-BuBFDFAD.js +0 -11
  418. package/dist/chunks/useExitOnCtrlCDWithKeybindings-CPLBDluY.js +0 -1
  419. package/dist/chunks/useMainLoopModel-C00PbZ1Q.js +0 -1
  420. package/dist/chunks/useManagePlugins-DFaGntzJ.js +0 -1
  421. package/dist/chunks/useMergedTools-DYobZ5N4.js +0 -1
  422. package/dist/chunks/useSettingsErrors-BRgjvaHd.js +0 -1
  423. package/dist/chunks/util-D7uwPgF1.js +0 -1
  424. package/dist/chunks/validatePlugin-VukX52bx.js +0 -1
  425. package/dist/chunks/windowsPaths-B8p9tFRF.js +0 -1
  426. package/dist/chunks/workerRegistry-BA37PVbv.js +0 -6
  427. package/dist/chunks/worktree-Lik8xuKd.js +0 -1
  428. package/dist/chunks/xdg-DcF9ejUM.js +0 -1
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./startupProfiler-Dc5r6LgE.js";e();export{t as profileCheckpoint};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,n,o as r,t as i}from"./envUtils-DcaKZlRU.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{Cb as s,Ob as c,Zy as l,_b as ee,bb as u,eb as d,rb as f,tb as p}from"./loadAgentsDir-mcRW90aq.js";import{P as m,di as h,fi as g,j as _,t as v,ui as y}from"./src-P_wYS_NJ2.js";import{t as b}from"./jsx-runtime-Bb4Xn-E0.js";import{a as x,an as S,c as C,g as w,in as T,ln as E,r as D,wn as O,xn as k}from"./settings-DiBMs2gM.js";import{f as A,v as j}from"./startupProfiler-Dc5r6LgE.js";import{Bt as M,Gt as N,_ as te,ai as P,bt as F,i as I,si as L,x as R}from"./model-C29_32BD.js";import{h as z,l as B,o as V,p as H}from"./proxy-BEKNaTXI.js";import{d as U,u as W}from"./pidLock-DQGDoFQP.js";import{n as G,t as K}from"./nativeInstaller-DqbEfGSX.js";import{n as q,t as J}from"./allErrors-C1eMbHSv.js";function Y(){return[]}function X(e,t=null,n){let r=e?.find(e=>e.name===`ide`);if(t){let e=c(t.ideType),i=s(t.ideType)?`plugin`:`extension`;if(t.error)return[{label:`IDE`,value:(0,$.jsxs)(m,{children:[_(`error`,n)(o.cross),` Error installing `,e,` `,i,`:`,` `,t.error,`
2
- `,`Please restart your IDE and try again.`]})}];if(t.installed)return r&&r.type===`connected`?t.installedVersion===r.serverInfo?.version?[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion}`}]:[{label:`IDE`,value:`Connected to ${e} ${i} version ${t.installedVersion} (server version: ${r.serverInfo?.version})`}]:[{label:`IDE`,value:`Installed ${e} ${i}`}]}else if(r){let e=ee(r)??`IDE`;return r.type===`connected`?[{label:`IDE`,value:`Connected to ${e} extension`}]:[{label:`IDE`,value:`${_(`error`,n)(o.cross)} Not connected to ${e}`}]}return[]}function Z(e=[],t){let n=e.filter(e=>e.name!==`ide`);if(!n.length)return[];let r={connected:0,pending:0,needsAuth:0,failed:0};for(let e of n)e.type===`connected`?r.connected++:e.type===`pending`?r.pending++:e.type===`needs-auth`?r.needsAuth++:r.failed++;let i=[];return r.connected&&i.push(_(`success`,t)(`${r.connected} connected`)),r.needsAuth&&i.push(_(`warning`,t)(`${r.needsAuth} need auth`)),r.pending&&i.push(_(`inactive`,t)(`${r.pending} pending`)),r.failed&&i.push(_(`error`,t)(`${r.failed} failed`)),[{label:`MCP servers`,value:`${i.join(`, `)} ${_(`inactive`,t)(`· /mcp`)}`}]}async function Q(){let e=d(await p()),t=[];return e.forEach(e=>{let n=k(e.path);t.push(`Large ${n} will impact performance (${A(e.content.length)} chars > ${A(l)})`)}),t}function ne(){return[{label:`Setting sources`,value:T().filter(e=>{let t=C(e);return t!==null&&Object.keys(t).length>0}).map(e=>{if(e===`policySettings`){let e=x();if(e===null)return null;switch(e){case`remote`:return`Enterprise managed settings (remote)`;case`plist`:return`Enterprise managed settings (plist)`;case`hklm`:return`Enterprise managed settings (HKLM)`;case`file`:{let{hasBase:e,hasDropIns:t}=D();return e&&t?`Enterprise managed settings (file + drop-ins)`:t?`Enterprise managed settings (drop-ins)`:`Enterprise managed settings (file)`}case`hkcu`:return`Enterprise managed settings (HKCU)`}}return S(e)}).filter(e=>e!==null)}]}async function re(){return(await G()).map(e=>e.message)}async function ie(){let e=await W(),t=[],{errors:n}=J();if(n.length>0){let e=Array.from(new Set(n.map(e=>e.file))).join(`, `);t.push(`Found invalid settings files: ${e}. They will be ignored.`)}return e.warnings.forEach(e=>{t.push(e.issue)}),e.hasUpdatePermissions===!1&&t.push(`No write permissions for auto-updates (requires sudo)`),t}function ae(){let e=F();if(!e)return[];let t=[];return e.subscription&&t.push({label:`Login method`,value:`${e.subscription} Account`}),e.tokenSource&&t.push({label:`Auth token`,value:e.tokenSource}),e.apiKeySource&&t.push({label:`API key`,value:e.apiKeySource}),e.organization&&!process.env.IS_DEMO&&t.push({label:`Organization`,value:e.organization}),e.email&&!process.env.IS_DEMO&&t.push({label:`Email`,value:e.email}),t}function oe(){let e=P(),r=[];if(e!==`firstParty`){let t={bedrock:`AWS Bedrock`,vertex:`Google Vertex AI`,foundry:`Microsoft Foundry`,gemini:`Gemini API`,grok:`Grok API`,openai:`OpenAI API`}[e];r.push({label:`API provider`,value:t})}if(e===`firstParty`){let e=process.env.ANTHROPIC_BASE_URL;e&&r.push({label:`API base URL`,value:e})}else if(e===`bedrock`){let e=process.env.BEDROCK_BASE_URL;e&&r.push({label:`Bedrock base URL`,value:e}),r.push({label:`AWS region`,value:i()}),t(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&r.push({value:`AWS auth skipped`})}else if(e===`vertex`){let e=process.env.VERTEX_BASE_URL;e&&r.push({label:`Vertex base URL`,value:e});let i=process.env.ANTHROPIC_VERTEX_PROJECT_ID;i&&r.push({label:`GCP project`,value:i}),r.push({label:`Default region`,value:n()}),t(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&r.push({value:`GCP auth skipped`})}else if(e===`foundry`){let e=process.env.ANTHROPIC_FOUNDRY_BASE_URL;e&&r.push({label:`Microsoft Foundry base URL`,value:e});let n=process.env.ANTHROPIC_FOUNDRY_RESOURCE;n&&r.push({label:`Microsoft Foundry resource`,value:n}),t(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH)&&r.push({value:`Microsoft Foundry auth skipped`})}else if(e===`gemini`){let e=process.env.GEMINI_BASE_URL||`https://generativelanguage.googleapis.com/v1beta`;r.push({label:`Gemini base URL`,value:e})}else if(e===`grok`){let e=process.env.GROK_BASE_URL;r.push({label:`Grok base URL`,value:e})}else if(e===`openai`){let e=process.env.OPENAI_BASE_URL;r.push({label:`OpenAI base URL`,value:e})}let a=V();a&&r.push({label:`Proxy`,value:a});let o=H();return process.env.NODE_EXTRA_CA_CERTS&&r.push({label:`Additional CA cert(s)`,value:process.env.NODE_EXTRA_CA_CERTS}),o&&(o.cert&&process.env.CLAUDE_CODE_CLIENT_CERT&&r.push({label:`mTLS client cert`,value:process.env.CLAUDE_CODE_CLIENT_CERT}),o.key&&process.env.CLAUDE_CODE_CLIENT_KEY&&r.push({label:`mTLS client key`,value:process.env.CLAUDE_CODE_CLIENT_KEY})),r}function se(e){let t=R(e);if(e===null&&N()){let e=I();t=`${y.bold(`Default`)} ${e}`}return t}var $,ce=e((()=>{h(),a(),g(),v(),M(),f(),U(),r(),O(),j(),u(),te(),L(),z(),K(),B(),q(),E(),w(),$=b()}));export{ie as a,Y as c,ce as d,re as i,ne as l,ae as n,Z as o,X as r,Q as s,oe as t,se as u};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-P_wYS_NJ2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./Settings-BKdLcyXe.js";async function a(e,t){return(0,o.jsx)(i,{onClose:e,context:t,defaultTab:`Status`})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ea as t,ta as n}from"./loadAgentsDir-mcRW90aq.js";function r(e){return e?e.activeAgents.filter(e=>e.source!==`built-in`).reduce((e,t)=>e+n(`${t.agentType}: ${t.whenToUse}`),0):0}var i,a=e((()=>{t(),i=15e3}));export{r as n,a as r,i as t};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./switcher-uoQMHmEZ.js";e();export{t as restoreActiveProvider};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{fi as t}from"./src-P_wYS_NJ2.js";import{t as n}from"./jsx-runtime-Bb4Xn-E0.js";import{n as r,t as i}from"./BackgroundTasksDialog-A9hw_SV0.js";async function a(e,t){return(0,o.jsx)(i,{toolUseContext:t,onDone:e})}var o;e((()=>{t(),r(),o=n()}))();export{a as call};
@@ -1 +0,0 @@
1
- import{du as e,lu as t,mu as n,ou as r,su as i}from"./loadAgentsDir-mcRW90aq.js";i();export{r as checkOutTeleportedSessionBranch,t as processMessagesForTeleportResume,e as teleportResumeCodeSession,n as validateGitState};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{H as t,fi as n,t as r,x as i}from"./src-P_wYS_NJ2.js";import{t as a}from"./jsx-runtime-Bb4Xn-E0.js";import{n as o,t as s}from"./ThemePicker-DUlhcoso.js";function c({onDone:e}){let[,n]=t();return(0,l.jsx)(i,{color:`permission`,children:(0,l.jsx)(s,{onThemeSelect:t=>{n(t),e(`Theme set to ${t}`)},onCancel:()=>{e(`Theme picker dismissed`,{display:`system`})},skipExitHandling:!0})})}var l,u;e((()=>{n(),r(),o(),l=a(),u=async(e,t)=>(0,l.jsx)(c,{onDone:e})}))();export{u as call};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Fx as t,OT as n,Px as r,kT as i}from"./loadAgentsDir-mcRW90aq.js";import{n as a,t as o}from"./partition-DeT341qu.js";function s(e,n,r){let[o,s]=a(i([...e,...n],`name`),t),c=(e,t)=>e.name.localeCompare(t.name);return[...s.sort(c),...o.sort(c)]}var c=e((()=>{o(),n(),r()}));export{s as n,c as t};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./trustedDevice-BLiKbGpG.js";export{t as clearTrustedDeviceToken,e as enrollTrustedDevice};
@@ -1,11 +0,0 @@
1
- import{Yd as e,Zd as t}from"./loadAgentsDir-mcRW90aq.js";import{di as n,ui as r}from"./src-P_wYS_NJ2.js";import{c as i,i as a}from"./debug-Dr1SjdXn.js";import{n as o,o as s}from"./process-gEbdy6uY.js";import{n as c,r as l}from"./execFileNoThrow-mXq4K0rl.js";import{l as u,u as d}from"./ripgrep-DQ_ILUJV.js";import{join as f}from"node:path";import{execSync as p}from"node:child_process";import{existsSync as m,readFileSync as h}from"node:fs";import{homedir as g}from"node:os";n(),a(),d(),l(),t(),o();var _=`@readmagic/workmate`;function v(){try{let e=f(u,`..`,`package.json`);if(m(e)){let t=JSON.parse(h(e,`utf-8`));if(t.version)return t.version}}catch{}return`0.0.13`}function y(e){try{return p(`which ${e} 2>/dev/null`,{stdio:`pipe`}),!0}catch{return!1}}function b(){return!!(process.execPath.includes(`bun`)||m(f(f(g(),`.bun`,`install`,`global`),`node_modules`,_)))}async function x(){let e=await c(`npm`,[`view`,`${_}@latest`,`version`,`--prefer-online`],{abortSignal:AbortSignal.timeout(1e4),cwd:g()});return e.code===0?e.stdout.trim():(i(`npm view failed: ${e.stderr}`),null)}function S(e,t){let n=e=>e.replace(/^\D/,``).split(`.`).map(Number),r=n(e),i=n(t);for(let e=0;e<3;e++){if((r[e]??0)>(i[e]??0))return!0;if((r[e]??0)<(i[e]??0))return!1}return!0}async function C(){let t=v();s(`Current version: ${t}\n`);let n=y(`bun`),i=b()&&n?`bun`:`npm`;s(`Package manager: ${i}\n`),s(`Checking for updates...
2
- `);let a=await x();if(!a){process.stderr.write(r.red(`Failed to check for updates`)+`
3
- `),process.stderr.write(`Unable to fetch latest version from npm registry.
4
- `),await e(1);return}if(a===t||S(t,a)){s(r.green(`ccb is up to date (${t})`)+`
5
- `),await e(0);return}s(`New version available: ${a} (current: ${t})\n`),s(`Installing update via ${i}...\n`);try{p(i===`bun`?`bun install -g ${_}@latest`:`npm install -g ${_}@latest`,{stdio:`inherit`,cwd:g(),timeout:12e4}),s(r.green(`Successfully updated from ${t} to ${a}`)+`
6
- `)}catch(t){process.stderr.write(r.red(`Update failed`)+`
7
- `),process.stderr.write(`${t}\n`),process.stderr.write(`
8
- `),process.stderr.write(`Try manually updating with:
9
- `),i===`bun`?process.stderr.write(r.bold(` bun install -g ${_}@latest`)+`
10
- `):process.stderr.write(r.bold(` npm install -g ${_}@latest`)+`
11
- `),await e(1)}await e(0)}export{C as updateCCB};
@@ -1,11 +0,0 @@
1
- import{i as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n}from"./envUtils-DcaKZlRU.js";import{B as r,R as i,c as a,i as o,nt as s,tt as c}from"./debug-Dr1SjdXn.js";import{c as l,h as u,l as d,m as f,s as p}from"./proxy-BEKNaTXI.js";import{homedir as m}from"os";import{join as h}from"path";import{mkdir as g,readFile as _,unlink as v,writeFile as y}from"fs/promises";import{createServer as b}from"node:net";n(),c(),i(),o(),u(),d();var x,S=512*1024,C=3e4;function w(e){let t=e.length,n=[],r=t;for(;r>127;)n.push(r&127|128),r>>>=7;n.push(r);let i=new Uint8Array(1+n.length+t);return i[0]=10,i.set(n,1),i.set(e,1+n.length),i}function T(e){if(e.length===0)return new Uint8Array;if(e[0]!==10)return null;let t=0,n=0,r=1;for(;r<e.length;){let i=e[r];if(t|=(i&127)<<n,r++,!(i&128))break;if(n+=7,n>28)return null}return r+t>e.length?null:e.subarray(r,r+t)}function E(){return{connectBuf:Buffer.alloc(0),pending:[],wsOpen:!1,established:!1,closed:!1}}async function D(e){let t=`Basic `+Buffer.from(`${e.sessionId}:${e.token}`).toString(`base64`),n=`Bearer ${e.token}`,r=typeof Bun<`u`?O(e.wsUrl,t,n):await k(e.wsUrl,t,n);return a(`[upstreamproxy] relay listening on 127.0.0.1:${r.port}`),r}function O(e,t,n){let r=Bun.listen({hostname:`127.0.0.1`,port:0,socket:{open(e){e.data={...E(),writeBuf:[]}},data(r,i){let a=r.data;A({write:e=>{let t=typeof e==`string`?Buffer.from(e,`utf8`):e;if(a.writeBuf.length>0){a.writeBuf.push(t);return}let n=r.write(t);n<t.length&&a.writeBuf.push(t.subarray(n))},end:()=>r.end()},a,i,e,t,n)},drain(e){let t=e.data;for(;t.writeBuf.length>0;){let n=t.writeBuf[0],r=e.write(n);if(r<n.length){t.writeBuf[0]=n.subarray(r);return}t.writeBuf.shift()}},close(e){P(e.data)},error(e,t){a(`[upstreamproxy] client socket error: ${t.message}`),P(e.data)}}});return{port:r.port,stop:()=>r.stop(!0)}}async function k(e,t,n){x=(await import(`./wrapper-K8ZapJVu.js`)).default;let r=new WeakMap,i=b(i=>{let o=E();r.set(i,o);let s={write:e=>{i.write(typeof e==`string`?e:Buffer.from(e))},end:()=>i.end()};i.on(`data`,r=>A(s,o,r,e,t,n)),i.on(`close`,()=>P(r.get(i))),i.on(`error`,e=>{a(`[upstreamproxy] client socket error: ${e.message}`),P(r.get(i))})});return new Promise((e,t)=>{i.once(`error`,t),i.listen(0,`127.0.0.1`,()=>{let n=i.address();if(n===null||typeof n==`string`){t(Error(`upstreamproxy: server has no TCP address`));return}e({port:n.port,stop:()=>i.close()})})})}function A(e,t,n,r,i,a){if(!t.ws){t.connectBuf=Buffer.concat([t.connectBuf,n]);let o=t.connectBuf.indexOf(`\r
2
- \r
3
- `);if(o===-1){t.connectBuf.length>8192&&(e.write(`HTTP/1.1 400 Bad Request\r
4
- \r
5
- `),e.end());return}let s=t.connectBuf.subarray(0,o).toString(`utf8`).split(`\r
6
- `)[0]??``;if(!s.match(/^CONNECT\s+(\S+)\s+HTTP\/1\.[01]$/i)){e.write(`HTTP/1.1 405 Method Not Allowed\r
7
- \r
8
- `),e.end();return}let c=t.connectBuf.subarray(o+4);c.length>0&&t.pending.push(Buffer.from(c)),t.connectBuf=Buffer.alloc(0),j(e,t,s,r,i,a);return}if(!t.wsOpen){t.pending.push(Buffer.from(n));return}N(t.ws,n)}function j(e,t,n,r,i,o){let s={"Content-Type":`application/proto`,Authorization:o},c;c=x?new x(r,{headers:s,agent:p(r),...f()}):new globalThis.WebSocket(r,{headers:s,proxy:l(r),tls:f()||void 0}),c.binaryType=`arraybuffer`,t.ws=c,c.onopen=()=>{let e=`${n}\r\nProxy-Authorization: ${i}\r\n\r\n`;c.send(w(new Uint8Array(Buffer.from(e,`utf8`)))),t.wsOpen=!0;for(let e of t.pending)N(c,e);t.pending=[],t.pinger=setInterval(M,C,c)},c.onmessage=n=>{let r=T(n.data instanceof ArrayBuffer?new Uint8Array(n.data):new Uint8Array(Buffer.from(n.data)));r&&r.length>0&&(t.established=!0,e.write(r))},c.onerror=n=>{a(`[upstreamproxy] ws error: ${`message`in n?String(n.message):`websocket error`}`),!t.closed&&(t.closed=!0,t.established||e.write(`HTTP/1.1 502 Bad Gateway\r
9
- \r
10
- `),e.end(),P(t))},c.onclose=()=>{t.closed||(t.closed=!0,e.end(),P(t))}}function M(e){e.readyState===WebSocket.OPEN&&e.send(w(new Uint8Array))}function N(e,t){if(e.readyState===WebSocket.OPEN)for(let n=0;n<t.length;n+=S){let r=new Uint8Array(t.subarray(n,n+S));e.send(w(r))}}function P(e){if(e){if(e.pinger&&clearInterval(e.pinger),e.ws&&e.ws.readyState<=WebSocket.OPEN)try{e.ws.close()}catch{}e.ws=void 0}}o();var F=`/etc/ssl/certs/ca-certificates.crt`,I=[`localhost`,`127.0.0.1`,`::1`,`169.254.0.0/16`,`10.0.0.0/8`,`172.16.0.0/12`,`192.168.0.0/16`,`anthropic.com`,`.anthropic.com`,`*.anthropic.com`,`github.com`,`api.github.com`,`*.github.com`,`*.githubusercontent.com`,`registry.npmjs.org`,`pypi.org`,`files.pythonhosted.org`,`index.crates.io`,`proxy.golang.org`].join(`,`),L={enabled:!1};async function R(e){if(!t(process.env.CLAUDE_CODE_REMOTE)||!t(process.env.CCR_UPSTREAM_PROXY_ENABLED))return L;let n=process.env.CLAUDE_CODE_REMOTE_SESSION_ID;if(!n)return a(`[upstreamproxy] CLAUDE_CODE_REMOTE_SESSION_ID unset; proxy disabled`,{level:`warn`}),L;let r=e?.tokenPath??`/run/ccr/session_token`,i=await B(r);if(!i)return a(`[upstreamproxy] no session token file; proxy disabled`),L;V();let o=e?.ccrBaseUrl??process.env.ANTHROPIC_BASE_URL??`https://api.anthropic.com`,c=e?.caBundlePath??h(m(),`.ccr`,`ca-bundle.crt`);if(!await H(o,e?.systemCaPath??F,c))return L;try{let e=await D({wsUrl:o.replace(/^http/,`ws`)+`/v1/code/upstreamproxy/ws`,sessionId:n,token:i});s(async()=>e.stop()),L={enabled:!0,port:e.port,caBundlePath:c},a(`[upstreamproxy] enabled on 127.0.0.1:${e.port}`),await v(r).catch(()=>{a(`[upstreamproxy] token file unlink failed`,{level:`warn`})})}catch(e){a(`[upstreamproxy] relay start failed: ${e instanceof Error?e.message:String(e)}; proxy disabled`,{level:`warn`})}return L}function z(){if(!L.enabled||!L.port||!L.caBundlePath){if(process.env.HTTPS_PROXY&&process.env.SSL_CERT_FILE){let e={};for(let t of[`HTTPS_PROXY`,`https_proxy`,`NO_PROXY`,`no_proxy`,`SSL_CERT_FILE`,`NODE_EXTRA_CA_CERTS`,`REQUESTS_CA_BUNDLE`,`CURL_CA_BUNDLE`])process.env[t]&&(e[t]=process.env[t]);return e}return{}}let e=`http://127.0.0.1:${L.port}`;return{HTTPS_PROXY:e,https_proxy:e,NO_PROXY:I,no_proxy:I,SSL_CERT_FILE:L.caBundlePath,NODE_EXTRA_CA_CERTS:L.caBundlePath,REQUESTS_CA_BUNDLE:L.caBundlePath,CURL_CA_BUNDLE:L.caBundlePath}}async function B(e){try{return(await _(e,`utf8`)).trim()||null}catch(e){return r(e)||a(`[upstreamproxy] token read failed: ${e instanceof Error?e.message:String(e)}`,{level:`warn`}),null}}function V(){if(!(process.platform!==`linux`||typeof Bun>`u`))try{e(`bun:ffi`).dlopen(`libc.so.6`,{prctl:{args:[`int`,`u64`,`u64`,`u64`,`u64`],returns:`int`}}).symbols.prctl(4,0n,0n,0n,0n)!==0&&a(`[upstreamproxy] prctl(PR_SET_DUMPABLE,0) returned nonzero`,{level:`warn`})}catch(e){a(`[upstreamproxy] prctl unavailable: ${e instanceof Error?e.message:String(e)}`,{level:`warn`})}}async function H(e,t,n){try{let r=await fetch(`${e}/v1/code/upstreamproxy/ca-cert`,{signal:AbortSignal.timeout(5e3)});if(!r.ok)return a(`[upstreamproxy] ca-cert fetch ${r.status}; proxy disabled`,{level:`warn`}),!1;let i=await r.text(),o=await _(t,`utf8`).catch(()=>``);return await g(h(n,`..`),{recursive:!0}),await y(n,o+`
11
- `+i,`utf8`),!0}catch(e){return a(`[upstreamproxy] ca-cert download failed: ${e instanceof Error?e.message:String(e)}; proxy disabled`,{level:`warn`}),!1}}export{z as getUpstreamProxyEnv,R as initUpstreamProxy};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{EC as n,md as r}from"./loadAgentsDir-mcRW90aq.js";import{Gt as i,et as a,fi as o,t as s,vt as c}from"./src-P_wYS_NJ2.js";function l(e,t,n,r=!0){let{exit:i}=c(),[o,s]=(0,u.useState)({pending:!1,keyName:null}),l=(0,u.useMemo)(()=>n??i,[n,i]),d=a(e=>s({pending:e,keyName:`Ctrl-C`}),l),f=a(e=>s({pending:e,keyName:`Ctrl-D`}),l),p=(0,u.useCallback)(()=>{t?.()||d()},[d,t]),m=(0,u.useCallback)(()=>{f()},[f]);return e((0,u.useMemo)(()=>({"app:interrupt":p,"app:exit":m}),[p,m]),{context:`Global`,isActive:r}),o}var u,d=e((()=>{u=t(o(),1),s(),r()}));function f(e,t,n){return l(i,t,e,n)}var p=e((()=>{n(),d()}));export{f as n,p as t};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{ng as t,rg as n}from"./loadAgentsDir-mcRW90aq.js";import{C as r,_ as i,s as a}from"./model-C29_32BD.js";function o(){let e=n(e=>e.mainLoopModel);return r(n(e=>e.mainLoopModelForSession)??e??a())}var s=e((()=>{t(),i()}));export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Ch as t,D_ as n,E_ as r,Jd as i,Ts as a,aS as o,ag as s,bs as c,do as l,iS as u,ng as d,qd as f,rg as p,uo as m,wh as h,ws as g,xh as _,yh as v,ys as y}from"./loadAgentsDir-mcRW90aq.js";import{fi as b}from"./src-P_wYS_NJ2.js";import{R as x,U as S,c as C,i as w}from"./debug-Dr1SjdXn.js";import{Ln as T,Rn as E}from"./settings-DiBMs2gM.js";import{O as D,k as O}from"./git-CoQQ6YEf.js";import{o as k,s as A}from"./log-27kCA_9u.js";import{n as j,r as M}from"./analytics-DJobLaWP.js";import{n as N,r as P}from"./pluginFlagging-Cr0d0hBA.js";import{t as F}from"./pluginBlocklist-BfoLN9a-.js";var I=e(b(),1);f(),j(),v(),d(),E(),w(),D(),x(),k(),g(),c(),r(),t(),u(),P(),m();function L({enabled:e=!0}={}){let t=s(),r=p(e=>e.plugins.needsRefresh),{addNotification:c}=i(),u=(0,I.useCallback)(async()=>{try{let{enabled:e,disabled:r,errors:i}=await l();await F();let s=N();Object.keys(s).length>0&&c({key:`plugin-delisted-flagged`,text:`Plugins flagged. Check /plugins`,color:`warning`,priority:`high`});let u=[],d=[];try{u=await y()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-commands`,error:`Failed to load plugin commands: ${t}`})}try{d=await a()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-agents`,error:`Failed to load plugin agents: ${t}`})}try{await n()}catch(e){let t=e instanceof Error?e.message:String(e);i.push({type:`generic-error`,source:`plugin-hooks`,error:`Failed to load plugin hooks: ${t}`})}let f=(await Promise.all(e.map(async e=>{if(e.mcpServers)return Object.keys(e.mcpServers).length;let t=await o(e,i);return t&&(e.mcpServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0),p=(await Promise.all(e.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await h(e,i);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0);_(),t(t=>{let n=t.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),a=new Set(i.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),o=[...n.filter(e=>{let t=e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`;return!a.has(t)}),...i];return{...t,plugins:{...t.plugins,enabled:e,disabled:r,commands:u,errors:o}}}),C(`Loaded plugins - Enabled: ${e.length}, Disabled: ${r.length}, Commands: ${u.length}, Agents: ${d.length}, Errors: ${i.length}`);let m=e.reduce((e,t)=>t.hooksConfig?e+Object.values(t.hooksConfig).reduce((e,t)=>e+(t?.reduce((e,t)=>e+t.hooks.length,0)??0),0):e,0);return{enabled_count:e.length,disabled_count:r.length,inline_count:T(e,e=>e.source.endsWith(`@inline`)),marketplace_count:T(e,e=>!e.source.endsWith(`@inline`)),error_count:i.length,skill_count:u.length,agent_count:d.length,hook_count:m,mcp_count:f,lsp_count:p}}catch(e){let n=S(e);return A(n),C(`Error loading plugins: ${e}`),t(e=>{let t=e.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r={type:`generic-error`,source:`plugin-system`,error:n.message};return{...e,plugins:{...e.plugins,enabled:[],disabled:[],commands:[],errors:[...t,r]}}}),{enabled_count:0,disabled_count:0,inline_count:0,marketplace_count:0,error_count:1,skill_count:0,agent_count:0,hook_count:0,mcp_count:0,lsp_count:0,load_failed:!0,ant_enabled_names:void 0}}},[t,c]);(0,I.useEffect)(()=>{e&&u().then(e=>{let{ant_enabled_names:t,...n}=e,r={...n,has_custom_plugin_cache_dir:!!process.env.CLAUDE_CODE_PLUGIN_CACHE_DIR};M(`tengu_plugins_loaded`,{...r,...t!==void 0&&{enabled_names:t}}),O(`info`,`tengu_plugins_loaded`,r)})},[u,e]),(0,I.useEffect)(()=>{!e||!r||c({key:`plugin-reload-pending`,text:`Plugins changed. Run /reload-plugins to activate.`,color:`suggestion`,priority:`low`})},[e,r,c])}export{L as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Xc as n,el as r}from"./loadAgentsDir-mcRW90aq.js";import{fi as i}from"./src-P_wYS_NJ2.js";import{n as a,t as o}from"./toolPool-Cq74Cvjp.js";function s(e,t,r){return(0,c.useMemo)(()=>a(e,n(r,t),r.mode),[e,t,r,!1,!1])}var c,l=e((()=>{c=t(i(),1),r(),o()}));export{s as n,l as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Jd as n,cg as r,lg as i,qd as a}from"./loadAgentsDir-mcRW90aq.js";import{fi as o}from"./src-P_wYS_NJ2.js";import{B as s,Wt as c}from"./state-BPFYBqm1.js";import{n as l,t as u}from"./allErrors-C1eMbHSv.js";function d(){let{addNotification:e,removeNotification:t}=n(),[r,a]=(0,f.useState)(()=>{let{errors:e}=u();return e});return i((0,f.useCallback)(()=>{let{errors:e}=u();a(e)},[])),(0,f.useEffect)(()=>{if(!s())if(r.length>0){let t=`Found ${r.length} settings ${r.length===1?`issue`:`issues`} · /doctor for details`;e({key:p,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(p)},[r,e,t]),r}var f,p,m=e((()=>{f=t(o(),1),a(),c(),l(),r(),p=`settings-errors`}));export{d as n,m as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Du as t,Eu as n,ng as r,tg as i}from"./loadAgentsDir-mcRW90aq.js";import{fi as a}from"./src-P_wYS_NJ2.js";import{t as o}from"./jsx-runtime-Bb4Xn-E0.js";import{n as s,r as c}from"./analytics-DJobLaWP.js";import{t as l}from"./useManagePlugins-DFaGntzJ.js";import{n as u,t as d}from"./MCPConnectionManager-aDDsYkGM.js";import{cwd as f}from"process";var p=e(a(),1);t(),s(),u(),r();var m=o(),h=p.lazy(()=>import(`./Doctor-i_5_AQd-.js`).then(e=>({default:e.Doctor})));function g({onDone:e}){return l(),(0,m.jsx)(p.Suspense,{fallback:null,children:(0,m.jsx)(h,{onDone:e})})}async function _(e){c(`tengu_doctor_command`,{}),await new Promise(t=>{e.render((0,m.jsx)(i,{children:(0,m.jsx)(n,{children:(0,m.jsx)(d,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,m.jsx)(g,{onDone:()=>{t()}})})})}))}),e.unmount(),process.exit(0)}async function v(e,t){let{setup:n}=await import(`./setup-DeyiuGNX.js`);await n(f(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-DGH_bjUh.js`);await new Promise(n=>{let i=[];e&&i.push(e),t.force&&i.push(`--force`),r.call(e=>{n(),process.exit(+!!e.includes(`failed`))},{},i)})}export{_ as doctorHandler,v as installHandler};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./axios-DaWTGg7G.js";import{Aw as r,DE as i,Fw as a,Iw as o,Lw as s,OE as ee,TE as c,kw as l,wE as u}from"./loadAgentsDir-mcRW90aq.js";import{p as d}from"./external-CEp-aPkt.js";import{r as te}from"./lazySchema-B4D4qJVE.js";import{B as f,C as p,F as m,P as h,R as g,S as _,c as v,f as y,i as b,u as x,x as S}from"./debug-Dr1SjdXn.js";import{_t as C,gt as ne,ht as w,pt as re,vt as ie}from"./settings-DiBMs2gM.js";import{o as ae,s as T}from"./log-27kCA_9u.js";import{homedir as oe}from"os";import*as E from"path";import{join as se,resolve as D}from"path";import{randomBytes as O}from"crypto";import{readFile as k,readdir as A,rename as j,stat as M,unlink as N,writeFile as P}from"fs/promises";function F(){return se(l(),H)}async function I(){let e=F();try{let t=_(await k(e,{encoding:`utf-8`}));if(typeof t!=`object`||!t||!(`version`in t)||!(`fetchedAt`in t)||!(`counts`in t))return v(`Install counts cache has invalid structure`),null;let n=t;if(n.version!==V)return v(`Install counts cache version mismatch (got ${n.version}, expected ${V})`),null;if(typeof n.fetchedAt!=`string`||!Array.isArray(n.counts))return v(`Install counts cache has invalid structure`),null;let r=new Date(n.fetchedAt).getTime();return Number.isNaN(r)?(v(`Install counts cache has invalid fetchedAt timestamp`),null):n.counts.every(e=>typeof e==`object`&&!!e&&typeof e.plugin==`string`&&typeof e.unique_installs==`number`)?Date.now()-r>W?(v(`Install counts cache is stale (>24h old)`),null):{version:n.version,fetchedAt:n.fetchedAt,counts:n.counts}:(v(`Install counts cache has malformed entries`),null)}catch(e){return m(e)!==`ENOENT`&&v(`Failed to load install counts cache: ${h(e)}`),null}}async function L(e){let t=F(),n=`${t}.${O(8).toString(`hex`)}.tmp`;try{let r=l();await x().mkdir(r),await P(n,p(e,null,2),{encoding:`utf-8`,mode:384}),await j(n,t),v(`Install counts cache saved successfully`)}catch(e){T(e);try{await N(n)}catch{}}}async function R(){v(`Fetching install counts from ${U}`);let e=performance.now();try{let n=await t.get(U,{timeout:1e4});if(!n.data?.plugins||!Array.isArray(n.data.plugins))throw Error(`Invalid response format from install counts API`);return s(`install_counts`,U,`success`,performance.now()-e),n.data.plugins}catch(t){throw s(`install_counts`,U,`failure`,performance.now()-e,a(t)),t}}async function z(){let e=await I();if(e){v(`Using cached install counts`),s(`install_counts`,U,`cache_hit`,0);let t=new Map;for(let n of e.counts)t.set(n.plugin,n.unique_installs);return t}try{let e=await R();await L({version:V,fetchedAt:new Date().toISOString(),counts:e});let t=new Map;for(let n of e)t.set(n.plugin,n.unique_installs);return t}catch(e){return T(e),v(`Failed to fetch install counts: ${h(e)}`),null}}function B(e){if(e<1e3)return String(e);if(e<1e6){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}K`:`${t}K`}let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}var V,H,U,W,G=e((()=>{n(),b(),g(),y(),ae(),S(),o(),r(),V=1,H=`install-counts-cache.json`,U=`https://raw.githubusercontent.com/anthropics/claude-plugins-official/refs/heads/stats/stats/plugin-installs.json`,W=1440*60*1e3}));async function K(e){let t=e.trim(),n=x(),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=D(t.startsWith(`~`)?t.replace(/^~/,oe()):t),r;try{r=await n.stat(e)}catch(t){let n=m(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((()=>{g(),y()}));function le(e){let t=E.basename(e),n=E.basename(E.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=E.resolve(e),i;try{i=await k(r,{encoding:`utf-8`})}catch(e){let t=m(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${h(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`plugin`}}let a;try{a=_(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${h(e)}`}],warnings:[],filePath:r,fileType:`plugin`}}if(a&&typeof a==`object`){let e=a;e.commands&&(Array.isArray(e.commands)?e.commands:[e.commands]).forEach((e,n)=>{typeof e==`string`&&J(e,`commands[${n}]`,t)}),e.agents&&(Array.isArray(e.agents)?e.agents:[e.agents]).forEach((e,n)=>{typeof e==`string`&&J(e,`agents[${n}]`,t)}),e.skills&&(Array.isArray(e.skills)?e.skills:[e.skills]).forEach((e,n)=>{typeof e==`string`&&J(e,`skills[${n}]`,t)})}let o=a;if(typeof a==`object`&&a){let e=a,t=Object.keys(e).filter(e=>$.has(e));if(t.length>0){let r={...e};for(let e of t)delete r[e],n.push({path:e,message:`Field '${e}' belongs in the marketplace entry (marketplace.json), not plugin.json. It's harmless here but unused — Work Mate ignores it at load time.`});o=r}}let s=w().strict().safeParse(o);if(s.success||t.push(...q(s.error)),s.success){let e=s.data;/^[a-z0-9]+(-[a-z0-9]+)*$/.test(e.name)||n.push({path:`name`,message:`Plugin name "${e.name}" is not kebab-case. Work Mate accepts it, but the Claude.ai marketplace sync requires kebab-case (lowercase letters, digits, and hyphens only, e.g., "my-plugin").`}),e.version||n.push({path:`version`,message:`No version specified. Consider adding a version following semver (e.g., "1.0.0")`}),e.description||n.push({path:`description`,message:`No description provided. Adding a description helps users understand what your plugin does`}),e.author||n.push({path:`author`,message:`No author information provided. Consider adding author details for plugin attribution`})}return{success:t.length===0,errors:t,warnings:n,filePath:r,fileType:`plugin`}}async function X(e){let t=[],n=[],r=E.resolve(e),i;try{i=await k(r,{encoding:`utf-8`})}catch(e){let t=m(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${h(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`marketplace`}}let a;try{a=_(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${h(e)}`}],warnings:[],filePath:r,fileType:`marketplace`}}if(a&&typeof a==`object`){let e=a;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 o=C().extend({plugins:d(ne().strict())}).strict().safeParse(a);if(o.success||t.push(...q(o.error)),o.success){let e=o.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 i=E.dirname(r),a=E.basename(i)===`.claude-plugin`?E.dirname(i):i;for(let[t,r]of e.plugins.entries()){if(!r.version||typeof r.source!=`string`||!r.source.startsWith(`./`))continue;let e=E.join(a,r.source,`.claude-plugin`,`plugin.json`),i;try{let t=_(await k(e,{encoding:`utf-8`}));typeof t.version==`string`&&(i=t.version)}catch{continue}i&&i!==r.version&&n.push({path:`plugins[${t}].version`,message:`Entry declares version "${r.version}" but ${r.source}/.claude-plugin/plugin.json says "${i}". At install time, plugin.json wins (calculatePluginVersion precedence) — the entry version is silently ignored. Update this entry to "${i}" to match.`})}}e.metadata?.description||n.push({path:`metadata.description`,message:`No marketplace description provided. Adding a description helps users understand what this marketplace offers`})}return{success:t.length===0,errors:t,warnings:n,filePath:r,fileType:`marketplace`}}function de(e,t,n){let r=[],i=[],a=t.match(u);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=ee(o)}catch(t){return r.push({path:`frontmatter`,message:`YAML frontmatter failed to parse: ${h(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 d=c.shell;if(d!=null)if(typeof d!=`string`)r.push({path:`shell`,message:`shell must be a string, got ${typeof d}.`});else{let e=d.trim().toLowerCase();e!==`bash`&&e!==`powershell`&&r.push({path:`shell`,message:`shell must be 'bash' or 'powershell', got '${d}'.`})}return{success:r.length===0,errors:r,warnings:i,filePath:e,fileType:n}}async function Z(e){let t;try{t=await k(e,{encoding:`utf-8`})}catch(t){return m(t)===`ENOENT`?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:[{path:`file`,message:`Failed to read file: ${h(t)}`}],warnings:[],filePath:e,fileType:`hooks`}}let n;try{n=_(t)}catch(t){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${h(t)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:e,fileType:`hooks`}}let r=re().safeParse(n);return r.success?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:q(r.error),warnings:[],filePath:e,fileType:`hooks`}}async function Q(e,t){let n;try{n=await A(e,{withFileTypes:!0})}catch(e){let t=m(e);if(t===`ENOENT`||t===`ENOTDIR`)return[];throw e}if(t)return n.filter(e=>e.isDirectory()).map(t=>E.join(e,t.name,`SKILL.md`));let r=[];for(let t of n){let n=E.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`,E.join(e,`skills`)],[`agent`,E.join(e,`agents`)],[`command`,E.join(e,`commands`)]];for(let[e,r]of n){let n=await Q(r,e===`skill`);for(let r of n){let n;try{n=await k(r,{encoding:`utf-8`})}catch(n){if(f(n))continue;t.push({success:!1,errors:[{path:`file`,message:`Failed to read: ${h(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(E.join(e,`hooks`,`hooks.json`));return(r.errors.length>0||r.warnings.length>0)&&t.push(r),t}async function pe(e){let t=E.resolve(e),n=null;try{n=await M(t)}catch(e){if(!f(e))throw e}if(n?.isDirectory()){let e=await X(E.join(t,`.claude-plugin`,`marketplace.json`));if(e.errors[0]?.code!==`ENOENT`)return e;let n=await Y(E.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=_(await k(t,{encoding:`utf-8`}));if(Array.isArray(n.plugins))return X(e)}catch(e){if(m(e)===`ENOENT`)return{success:!1,errors:[{path:`file`,message:`File not found: ${t}`}],warnings:[],filePath:t,fileType:`plugin`}}return Y(e)}}var $,me=e((()=>{te(),g(),c(),S(),i(),ie(),$=new Set([`category`,`source`,`tags`,`strict`,`id`])}));export{K as a,G as c,ce as i,pe as n,B as o,fe as r,z as s,me as t};
@@ -1 +0,0 @@
1
- import{i as e,o as t}from"./windowsPaths-C7Mdo9aU.js";e();export{t as setShellIfWindows};
@@ -1,6 +0,0 @@
1
- import{l as e,o as t,u as n}from"./envUtils-DcaKZlRU.js";import{CS as r,SS as i,gt as a,kt as o,wt as s}from"./loadAgentsDir-mcRW90aq.js";import{t as c}from"./src-P_wYS_NJ2.js";import{C as l,P as u,R as d,S as f,c as p,i as m,x as h}from"./debug-Dr1SjdXn.js";import{Wt as g}from"./settings-DiBMs2gM.js";import{O as _,k as v}from"./git-CoQQ6YEf.js";import{o as y,s as b}from"./log-27kCA_9u.js";import{n as x,r as S}from"./analytics-DJobLaWP.js";import{C,l as w,v as T}from"./startupProfiler-Dc5r6LgE.js";import{Bt as E,Ot as D,_n as O,vn as k}from"./model-C29_32BD.js";import{i as ee,t as A}from"./sessionIdCompat-DMayYBrf.js";import{n as j}from"./firstPartyEventLogger-1RTgXHSz.js";import{t as te}from"./datadog-3WUWcCFn.js";import{n as M,o as N,r as P}from"./debugUtils-cK-iOsEV.js";import{t as F}from"./pollConfig-BgpfHQPJ.js";import{n as I,t as L}from"./rcDebugLog-DSchf3Hs.js";import{a as R,i as z,n as B,o as ne,r as re,s as V,t as H}from"./capacityWake-ByL6fM6I.js";import{a as ie,i as ae,n as oe,r as se,t as ce}from"./workSecret-XLodD7tw.js";import{i as U}from"./trustedDevice-BLiKbGpG.js";import{t as le}from"./jwtUtils-FQWtM6iM.js";import{n as W,r as G}from"./cliLaunch-OPOtzhvA.js";import"./bridgeStatusUtil-DStiD05t.js";import{t as K}from"./lib-BlVGipXx.js";import{hostname as q,tmpdir as ue}from"os";import{dirname as J,join as de,resolve as Y}from"path";import{createWriteStream as X}from"fs";import{randomUUID as Z}from"crypto";import{spawn as fe}from"child_process";import{createInterface as Q}from"readline";t(),d(),h(),_(),y(),x(),T(),O(),r(),te(),j(),s(),L(),K(),g(),c(),m(),A(),N();var pe=10,me=10;function he(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}var ge={Read:`Reading`,Write:`Writing`,Edit:`Editing`,MultiEdit:`Editing`,Bash:`Running`,Glob:`Searching`,Grep:`Searching`,WebFetch:`Fetching`,WebSearch:`Searching`,Task:`Running task`,FileReadTool:`Reading`,FileWriteTool:`Writing`,FileEditTool:`Editing`,GlobTool:`Searching`,GrepTool:`Searching`,BashTool:`Running`,NotebookEditTool:`Editing notebook`,LSP:`LSP`};function $(e,t){let n=ge[e]??e,r=t.file_path??t.filePath??t.pattern??t.command?.slice(0,60)??t.url??t.query??``;return r?`${n} ${r}`:n}function _e(e,t,n){let r;try{r=f(e)}catch{return[]}if(!r||typeof r!=`object`)return[];let i=r,a=[],o=Date.now();switch(i.type){case`assistant`:{let e=i.message;if(!e)break;let r=e.content;if(!Array.isArray(r))break;for(let e of r){if(!e||typeof e!=`object`)continue;let r=e;if(r.type===`tool_use`){let e=r.name??`Tool`,i=r.input??{},s=$(e,i);a.push({type:`tool_start`,summary:s,timestamp:o}),n(`[bridge:activity] sessionId=${t} tool_use name=${e} ${ye(i)}`)}else if(r.type===`text`){let e=r.text??``;e.length>0&&(a.push({type:`text`,summary:e.slice(0,80),timestamp:o}),n(`[bridge:activity] sessionId=${t} text "${e.slice(0,100)}"`))}}break}case`result`:{let e=i.subtype;if(e===`success`)a.push({type:`result`,summary:`Session completed`,timestamp:o}),n(`[bridge:activity] sessionId=${t} result subtype=success`);else if(e){let r=i.errors?.[0]??`Error: ${e}`;a.push({type:`error`,summary:r,timestamp:o}),n(`[bridge:activity] sessionId=${t} result subtype=${e} error="${r}"`)}else n(`[bridge:activity] sessionId=${t} result subtype=undefined`);break}default:break}return a}function ve(e){if(e.parent_tool_use_id!=null||e.isSynthetic||e.isReplay)return;let t=e.message?.content,n;if(typeof t==`string`)n=t;else if(Array.isArray(t)){for(let e of t)if(e&&typeof e==`object`&&e.type===`text`){n=e.text;break}}return n=n?.trim(),n||void 0}function ye(e){let t=[];for(let[n,r]of Object.entries(e))if(typeof r==`string`&&t.push(`${n}="${r.slice(0,100)}"`),t.length>=3)break;return t.join(` `)}function be(e){return{spawn(t,n){let r=he(t.sessionId),i;if(e.debugFile){let t=e.debugFile.lastIndexOf(`.`);i=t>0?`${e.debugFile.slice(0,t)}-${r}${e.debugFile.slice(t)}`:`${e.debugFile}-${r}`}else e.verbose&&(i=de(ue(),`claude`,`bridge-session-${r}.log`));let a=null,o;e.debugFile&&(o=de(J(e.debugFile),`bridge-transcript-${r}.jsonl`),a=X(o,{flags:`a`}),a.on(`error`,t=>{e.onDebug(`[bridge:session] Transcript write error: ${t.message}`),a=null}),e.onDebug(`[bridge:session] Transcript log: ${o}`));let s=[...e.scriptArgs,`--print`,`--sdk-url`,t.sdkUrl,`--session-id`,t.sessionId,`--input-format`,`stream-json`,`--output-format`,`stream-json`,`--replay-user-messages`,...e.verbose?[`--verbose`]:[],...i?[`--debug-file`,i]:[],...e.permissionMode?[`--permission-mode`,e.permissionMode]:[]],c={...e.env,CLAUDE_CODE_OAUTH_TOKEN:void 0,CLAUDE_CODE_ENVIRONMENT_KIND:`bridge`,...e.sandbox&&{CLAUDE_CODE_FORCE_SANDBOX:`1`},CLAUDE_CODE_SESSION_ACCESS_TOKEN:t.accessToken,CLAUDE_CODE_POST_FOR_SESSION_INGRESS_V2:`1`,...t.useCcrV2&&{CLAUDE_CODE_USE_CCR_V2:`1`,CLAUDE_CODE_WORKER_EPOCH:String(t.workerEpoch)}};e.onDebug(`[bridge:session] Spawning sessionId=${t.sessionId} sdkUrl=${t.sdkUrl} accessToken=${t.accessToken?`present`:`MISSING`}`),e.onDebug(`[bridge:session] Child args: ${s.join(` `)}`),i&&e.onDebug(`[bridge:session] Debug log: ${i}`);let u=fe(e.execPath,s,{cwd:n,stdio:[`pipe`,`pipe`,`pipe`],env:c,windowsHide:!0});e.onDebug(`[bridge:session] sessionId=${t.sessionId} pid=${u.pid}`);let d=[],p=null,m=[],h=!1,g=!1;u.stderr&&Q({input:u.stderr}).on(`line`,t=>{e.verbose&&process.stderr.write(t+`
2
- `),m.length>=me&&m.shift(),m.push(t)}),u.stdout&&Q({input:u.stdout}).on(`line`,n=>{a&&a.write(n+`
3
- `),e.onDebug(`[bridge:ws] sessionId=${t.sessionId} <<< ${M(n)}`),e.verbose&&process.stderr.write(n+`
4
- `);let r=_e(n,t.sessionId,e.onDebug);for(let n of r)d.length>=pe&&d.shift(),d.push(n),p=n,e.onActivity?.(t.sessionId,n);{let r;try{r=f(n)}catch{}if(r&&typeof r==`object`){let n=r;if(n.type===`control_request`)n.request?.subtype===`can_use_tool`&&e.onPermissionRequest&&e.onPermissionRequest(t.sessionId,r,t.accessToken);else if(n.type===`user`&&!g&&t.onFirstUserMessage){let e=ve(n);e&&(g=!0,t.onFirstUserMessage(e))}}}});let _=new Promise(n=>{u.on(`close`,(r,i)=>{a&&(a.end(),a=null),i===`SIGTERM`||i===`SIGINT`?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} interrupted signal=${i} pid=${u.pid}`),n(`interrupted`)):r===0?(e.onDebug(`[bridge:session] sessionId=${t.sessionId} completed exit_code=0 pid=${u.pid}`),n(`completed`)):(e.onDebug(`[bridge:session] sessionId=${t.sessionId} failed exit_code=${r} pid=${u.pid}`),n(`failed`))}),u.on(`error`,r=>{e.onDebug(`[bridge:session] sessionId=${t.sessionId} spawn error: ${r.message}`),n(`failed`)})}),v={sessionId:t.sessionId,done:_,activities:d,accessToken:t.accessToken,lastStderr:m,get currentActivity(){return p},kill(){u.killed||(e.onDebug(`[bridge:session] Sending SIGTERM to sessionId=${t.sessionId} pid=${u.pid}`),process.platform===`win32`?u.kill():u.kill(`SIGTERM`))},forceKill(){!h&&u.pid&&(h=!0,e.onDebug(`[bridge:session] Sending SIGKILL to sessionId=${t.sessionId} pid=${u.pid}`),process.platform===`win32`?u.kill():u.kill(`SIGKILL`))},writeStdin(n){u.stdin&&!u.stdin.destroyed&&(e.onDebug(`[bridge:ws] sessionId=${t.sessionId} >>> ${M(n)}`),u.stdin.write(n))},updateAccessToken(n){v.accessToken=n,v.writeStdin(l({type:`update_environment_variables`,variables:{CLAUDE_CODE_SESSION_ACCESS_TOKEN:n}})+`
5
- `),e.onDebug(`[bridge:session] Sent token refresh via stdin for sessionId=${t.sessionId}`)}};return v}}}m(),N();var xe={connInitialMs:2e3,connCapMs:12e4,connGiveUpMs:6e5,generalInitialMs:500,generalCapMs:3e4,generalGiveUpMs:6e5},Se=1e3;function Ce(e){return e.connCapMs*2}function we(){let e=[...W()],t=G();return t&&e.push(t),e}function Te(e,t,n){try{return e.spawn(t,n)}catch(e){let t=u(e);return b(Error(`Session spawn failed: ${t}`)),t}}async function Ee(t,r,s,c,l,d,f,m=xe,h,g){let _=new AbortController;f.aborted?_.abort():f.addEventListener(`abort`,()=>_.abort(),{once:!0});let y=_.signal,x=new Map,C=new Map,T=new Map,E=new Map,D=new Map,O=new Map,A=new Set,j=new Map,te=new Set,M=new Set,N=H(y);async function L(){I(`heartbeat: checking ${x.size} active session(s)`);let e=!1,t=!1,n=[];for(let[i]of x){let a=T.get(i),o=D.get(i);if(!(!a||!o))try{await c.heartbeatWork(r,a,o),e=!0}catch(e){p(`[bridge:heartbeat] Failed for sessionId=${i} workId=${a}: ${u(e)}`),e instanceof B&&(S(`tengu_bridge_heartbeat_error`,{status:e.status,error_type:e.status===401||e.status===403?`auth_failed`:`fatal`}),e.status===401||e.status===403?n.push(i):t=!0)}}for(let e of n){d.logVerbose(`Session ${e} token expired — re-queuing via bridge/reconnect`);try{await c.reconnectSession(r,e),p(`[bridge:heartbeat] Re-queued sessionId=${e} via bridge/reconnect`)}catch(t){d.logError(`Failed to refresh session ${e} token: ${u(t)}`),p(`[bridge:heartbeat] reconnectSession(${e}) failed: ${u(t)}`,{level:`error`})}}return t?`fatal`:n.length>0?`auth_failed`:e?`ok`:`failed`}let re=new Set,V=g?le({getAccessToken:g,onRefresh:(e,t)=>{let n=x.get(e);n&&(re.has(e)?(d.logVerbose(`Refreshing session ${e} token via bridge/reconnect`),c.reconnectSession(r,e).catch(t=>{d.logError(`Failed to refresh session ${e} token: ${u(t)}`),p(`[bridge:token] reconnectSession(${e}) failed: ${u(t)}`,{level:`error`})})):n.updateAccessToken(t))},label:`bridge`}):null,U=Date.now(),W=new Set;function G(e){W.add(e),e.finally(()=>W.delete(e))}let K=0,q=0,J=null,Y=null,X=null,Z=null;p(`[bridge:work] Starting poll loop spawnMode=${t.spawnMode} maxSessions=${t.maxSessions} environmentId=${r}`),v(`info`,`bridge_loop_started`,{max_sessions:t.maxSessions,spawn_mode:t.spawnMode}),d.printBanner(t,r),d.updateSessionCount(0,t.maxSessions,t.spawnMode),h&&d.setAttached(h);function fe(){d.updateSessionCount(x.size,t.maxSessions,t.spawnMode);for(let[e,t]of x){let n=t.currentActivity;n&&d.updateSessionActivity(E.get(e)??e,n)}if(x.size===0){d.updateIdleStatus();return}let[e,n]=[...x.entries()].pop(),r=C.get(e);if(!r)return;let i=n.currentActivity;if(!i||i.type===`result`||i.type===`error`){t.maxSessions>1&&d.refreshDisplay();return}let a=w(Date.now()-r),o=n.activities.filter(e=>e.type===`tool_start`).slice(-5).map(e=>e.summary);d.updateSessionStatus(e,a,i,o)}function Q(){pe(),fe(),Z=setInterval(fe,Se)}function pe(){Z&&(clearInterval(Z),Z=null)}function me(e,n,i){return a=>{let s=T.get(e);I(`session done: sessionId=${e} workId=${s??`none`} status=${a} wasTimedOut=${te.has(e)} duration=${Math.round((Date.now()-n)/1e3)}s stderr=${i.lastStderr.length>0?i.lastStderr.join(`\\n`).slice(0,500):`(none)`}`),x.delete(e),C.delete(e),T.delete(e),D.delete(e);let l=E.get(e)??e;E.delete(e),d.removeSession(l),M.delete(l),re.delete(e);let f=O.get(e);f&&(clearTimeout(f),O.delete(e)),V?.cancel(e),N.wake();let h=te.delete(e),g=h&&a===`interrupted`?`failed`:a,k=Date.now()-n;p(`[bridge:session] sessionId=${e} workId=${s??`unknown`} exited status=${g} duration=${w(k)}`),S(`tengu_bridge_session_done`,{status:g,duration_ms:k}),v(`info`,`bridge_session_done`,{status:g,duration_ms:k}),d.clearStatus(),pe();let ee=i.lastStderr.length>0?i.lastStderr.join(`
6
- `):void 0,P;switch(g){case`completed`:d.logSessionComplete(e,k);break;case`failed`:!h&&!y.aborted&&(P=ee??`Process exited with error`,d.logSessionFailed(e,P),b(Error(`Bridge session failed: ${P}`)));break;case`interrupted`:d.logVerbose(`Session ${e} interrupted`);break}g!==`interrupted`&&s&&(G(Me(c,r,s,d,m.stopWorkBaseDelayMs)),A.add(s));let F=j.get(e);if(F&&(j.delete(e),G(o(F.worktreePath,F.worktreeBranch,F.gitRoot,F.hookBased).catch(e=>d.logVerbose(`Failed to remove worktree ${F.worktreePath}: ${u(e)}`)))),g!==`interrupted`&&!y.aborted)if(t.spawnMode!==`single-session`)G(c.archiveSession(l).catch(t=>d.logVerbose(`Failed to archive session ${e}: ${u(t)}`))),p(`[bridge:session] Session ${g}, returning to idle (multi-session mode)`);else{p(`[bridge:session] Session ${g}, aborting poll loop to tear down environment`),_.abort();return}y.aborted||Q()}}for(h||Q();!y.aborted;){let f=F();try{I(`poll: envId=${r} activeSessions=${x.size}`);let g=await c.pollForWork(r,s,y,f.reclaim_older_than_ms);if(J!==null||Y!==null){let e=Date.now()-(J??Y??Date.now());d.logReconnected(e),p(`[bridge:poll] Reconnected after ${w(e)}`),S(`tengu_bridge_reconnected`,{disconnected_ms:e})}if(K=0,q=0,J=null,Y=null,X=null,!g){if(x.size>=t.maxSessions){let e=f.multisession_poll_interval_ms_at_capacity;if(f.non_exclusive_heartbeat_interval_ms>0){S(`tengu_bridge_heartbeat_mode_entered`,{active_sessions:x.size,heartbeat_interval_ms:f.non_exclusive_heartbeat_interval_ms});let n=e>0?Date.now()+e:null,r=`ok`,i=0;for(;!y.aborted&&x.size>=t.maxSessions&&(n===null||Date.now()<n);){let e=F();if(e.non_exclusive_heartbeat_interval_ms<=0)break;let t=N.signal();if(r=await L(),r===`auth_failed`||r===`fatal`){t.cleanup();break}i++,await k(e.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}let a=r===`auth_failed`||r===`fatal`?r:y.aborted?`shutdown`:x.size<t.maxSessions?`capacity_changed`:n!==null&&Date.now()>=n?`poll_due`:`config_disabled`;if(S(`tengu_bridge_heartbeat_mode_exited`,{reason:a,heartbeat_cycles:i,active_sessions:x.size}),a===`poll_due`&&p(`[bridge:poll] Heartbeat poll_due after ${i} cycles — falling through to pollForWork`),r===`auth_failed`||r===`fatal`){let t=N.signal();await k(e>0?e:f.non_exclusive_heartbeat_interval_ms,t.signal),t.cleanup()}}else if(e>0){let t=N.signal();await k(e,t.signal),t.cleanup()}}else await k(x.size>0?f.multisession_poll_interval_ms_partial_capacity:f.multisession_poll_interval_ms_not_at_capacity,y);continue}let _=x.size>=t.maxSessions;if(A.has(g.id)){if(p(`[bridge:work] Skipping already-completed workId=${g.id}`),_){let e=N.signal();f.non_exclusive_heartbeat_interval_ms>0?(await L(),await k(f.non_exclusive_heartbeat_interval_ms,e.signal)):f.multisession_poll_interval_ms_at_capacity>0&&await k(f.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}else await k(1e3,y);continue}let P;try{P=se(g.secret)}catch(e){let t=u(e);if(d.logError(`Failed to decode work secret for workId=${g.id}: ${t}`),S(`tengu_bridge_work_secret_failed`,{}),A.add(g.id),G(Me(c,r,g.id,d,m.stopWorkBaseDelayMs)),_){let e=N.signal();f.non_exclusive_heartbeat_interval_ms>0?(await L(),await k(f.non_exclusive_heartbeat_interval_ms,e.signal)):f.multisession_poll_interval_ms_at_capacity>0&&await k(f.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}continue}let R=async()=>{p(`[bridge:work] Acknowledging workId=${g.id}`);try{await c.acknowledgeWork(r,g.id,P.session_ingress_token)}catch(e){p(`[bridge:work] Acknowledge failed workId=${g.id}: ${u(e)}`)}},z=g.data.type;switch(g.data.type){case`healthcheck`:await R(),p(`[bridge:work] Healthcheck received`),d.logVerbose(`Healthcheck received`);break;case`session`:{let s=g.data.id;I(`work received: type=session sessionId=${s} workId=${g.id}`);try{ne(s,`session_id`)}catch{await R(),d.logError(`Invalid session_id received: ${s}`);break}let f=x.get(s);if(f){f.updateAccessToken(P.session_ingress_token),D.set(s,P.session_ingress_token),T.set(s,g.id),V?.schedule(s,P.session_ingress_token),p(`[bridge:work] Updated access token for existing sessionId=${s} workId=${g.id}`),await R();break}if(x.size>=t.maxSessions){p(`[bridge:work] At capacity (${x.size}/${t.maxSessions}), cannot spawn new session for workId=${g.id}`);break}await R();let _=Date.now(),w,N=!1,F;if(P.use_code_sessions===!0||e(process.env.CLAUDE_BRIDGE_USE_CCR_V2)){w=ce(t.apiBaseUrl,s);for(let e=1;e<=2;e++)try{F=await ae(w,P.session_ingress_token),N=!0,p(`[bridge:session] CCR v2: registered worker sessionId=${s} epoch=${F} attempt=${e}`);break}catch(t){let n=u(t);if(e<2){if(p(`[bridge:session] CCR v2: registerWorker attempt ${e} failed, retrying: ${n}`),await k(2e3,y),y.aborted)break;continue}d.logError(`CCR v2 worker registration failed for session ${s}: ${n}`),b(Error(`registerWorker failed: ${n}`)),A.add(g.id),G(Me(c,r,g.id,d,m.stopWorkBaseDelayMs))}if(!N)break}else w=oe(t.sessionIngressUrl,s);let L=t.spawnMode,z=t.dir,B=0;if(L===`worktree`&&(h===void 0||!ie(s,h))){let e=Date.now();try{let t=await a(`bridge-${he(s)}`);B=Date.now()-e,j.set(s,{worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,gitRoot:t.gitRoot,hookBased:t.hookBased}),z=t.worktreePath,p(`[bridge:session] Created worktree for sessionId=${s} at ${t.worktreePath}`)}catch(e){let t=u(e);d.logError(`Failed to create worktree for session ${s}: ${t}`),b(Error(`Worktree creation failed: ${t}`)),A.add(g.id),G(Me(c,r,g.id,d,m.stopWorkBaseDelayMs));break}}p(`[bridge:session] Spawning sessionId=${s} sdkUrl=${w}`);let H=ee(s);I(`spawning session: sessionId=${s} sdkUrl=${w} useCcrV2=${N} workerEpoch=${F} dir=${z} accessToken=${P.session_ingress_token?P.session_ingress_token.slice(0,8)+`...`:`NONE`}`);let se=Te(l,{sessionId:s,sdkUrl:w,accessToken:P.session_ingress_token,useCcrV2:N,workerEpoch:F,onFirstUserMessage:e=>{if(M.has(H))return;M.add(H);let n=Fe(e);d.setSessionTitle(H,n),p(`[bridge:title] derived title for ${H}: ${n}`),import(`./createSession-VTqzWAu6.js`).then(({updateBridgeSessionTitle:e})=>e(H,n,{baseUrl:t.apiBaseUrl})).catch(e=>p(`[bridge:title] failed to update title for ${H}: ${e}`,{level:`error`}))}},z);if(typeof se==`string`){d.logError(`Failed to spawn session ${s}: ${se}`);let e=j.get(s);e&&(j.delete(s),G(o(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased).catch(t=>d.logVerbose(`Failed to remove worktree ${e.worktreePath}: ${u(t)}`)))),A.add(g.id),G(Me(c,r,g.id,d,m.stopWorkBaseDelayMs));break}let U=se,le=Date.now()-_;S(`tengu_bridge_session_started`,{active_sessions:x.size,spawn_mode:L,in_worktree:j.has(s),spawn_duration_ms:le,worktree_create_ms:B,inProtectedNamespace:n()}),v(`info`,`bridge_session_started`,{spawn_mode:L,in_worktree:j.has(s),spawn_duration_ms:le,worktree_create_ms:B}),x.set(s,U),T.set(s,g.id),D.set(s,P.session_ingress_token),E.set(s,H);let W=Date.now();C.set(s,W),d.logSessionStart(s,`Session ${s}`);let K=he(s),q;if(t.debugFile){let e=t.debugFile.lastIndexOf(`.`);q=e>0?`${t.debugFile.slice(0,e)}-${K}${t.debugFile.slice(e)}`:`${t.debugFile}-${K}`}else t.verbose&&(q=de(ue(),`claude`,`bridge-session-${K}.log`));q&&d.logVerbose(`Debug log: ${q}`),d.addSession(H,i(H,t.sessionIngressUrl)),Q(),d.setAttached(H),Ie(H,t.apiBaseUrl).then(e=>{e&&x.has(s)&&(M.add(H),d.setSessionTitle(H,e),p(`[bridge:title] server title for ${H}: ${e}`))}).catch(e=>p(`[bridge:title] failed to fetch title for ${H}: ${e}`,{level:`error`}));let J=t.sessionTimeoutMs??864e5;if(J>0){let e=setTimeout(Ne,J,s,J,d,te,U);O.set(s,e)}N&&re.add(s),V?.schedule(s,P.session_ingress_token),U.done.then(me(s,W,U));break}default:await R(),p(`[bridge:work] Unknown work type: ${z}, skipping`);break}if(_){let e=N.signal();f.non_exclusive_heartbeat_interval_ms>0?(await L(),await k(f.non_exclusive_heartbeat_interval_ms,e.signal)):f.multisession_poll_interval_ms_at_capacity>0&&await k(f.multisession_poll_interval_ms_at_capacity,e.signal),e.cleanup()}}catch(e){if(y.aborted)break;if(e instanceof B){z(e.errorType)?d.logStatus(e.message):R(e)?p(`[bridge:work] Suppressed 403 error: ${e.message}`):(d.logError(e.message),b(e)),S(`tengu_bridge_fatal_error`,{status:e.status,error_type:e.errorType}),v(z(e.errorType)?`info`:`error`,`bridge_fatal_error`,{status:e.status,error_type:e.errorType});break}let t=P(e);if(I(`poll error: ${t} isConn=${Oe(e)} isServer=${ke(e)} activeSessions=${x.size}`),Oe(e)||ke(e)){let e=Date.now();X!==null&&e-X>Ce(m)&&(p(`[bridge:work] Detected system sleep (${Math.round((e-X)/1e3)}s gap), resetting error budget`),v(`info`,`bridge_poll_sleep_detected`,{gapMs:e-X}),J=null,K=0,Y=null,q=0),X=e,J||(J=e);let n=e-J;if(n>=m.connGiveUpMs){d.logError(`Server unreachable for ${Math.round(n/6e4)} minutes, giving up.`),S(`tengu_bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n}),v(`error`,`bridge_poll_give_up`,{error_type:`connection`,elapsed_ms:n});break}Y=null,q=0,K=K?Math.min(K*2,m.connCapMs):m.connInitialMs;let r=Ae(K);d.logVerbose(`Connection error, retrying in ${je(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),d.updateReconnectingStatus(je(r),w(n)),F().non_exclusive_heartbeat_interval_ms>0&&await L(),await k(r,y)}else{let e=Date.now();X!==null&&e-X>Ce(m)&&(p(`[bridge:work] Detected system sleep (${Math.round((e-X)/1e3)}s gap), resetting error budget`),v(`info`,`bridge_poll_sleep_detected`,{gapMs:e-X}),J=null,K=0,Y=null,q=0),X=e,Y||(Y=e);let n=e-Y;if(n>=m.generalGiveUpMs){d.logError(`Persistent errors for ${Math.round(n/6e4)} minutes, giving up.`),S(`tengu_bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n}),v(`error`,`bridge_poll_give_up`,{error_type:`general`,elapsed_ms:n});break}J=null,K=0,q=q?Math.min(q*2,m.generalCapMs):m.generalInitialMs;let r=Ae(q);d.logVerbose(`Poll failed, retrying in ${je(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),d.updateReconnectingStatus(je(r),w(n)),F().non_exclusive_heartbeat_interval_ms>0&&await L(),await k(r,y)}}}pe(),d.clearStatus();let ge=Date.now()-U;S(`tengu_bridge_shutdown`,{active_sessions:x.size,loop_duration_ms:ge}),v(`info`,`bridge_shutdown`,{active_sessions:x.size,loop_duration_ms:ge});let $=new Set(x.keys());h&&$.add(h);let _e=new Map(E);if(x.size>0){p(`[bridge:shutdown] Shutting down ${x.size} active session(s)`),d.logStatus(`Shutting down ${x.size} active session(s)\u2026`);let e=new Map(T);for(let[e,t]of x.entries())p(`[bridge:shutdown] Sending SIGTERM to sessionId=${e}`),t.kill();let t=new AbortController;await Promise.race([Promise.allSettled([...x.values()].map(e=>e.done)),k(m.shutdownGraceMs??3e4,t.signal)]),t.abort();for(let[e,t]of x.entries())p(`[bridge:shutdown] Force-killing stuck sessionId=${e}`),t.forceKill();for(let e of O.values())clearTimeout(e);if(O.clear(),V?.cancelAll(),j.size>0){let e=[...j.values()];j.clear(),p(`[bridge:shutdown] Cleaning up ${e.length} worktree(s)`),await Promise.allSettled(e.map(e=>o(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased)))}await Promise.allSettled([...e.entries()].map(([e,t])=>c.stopWork(r,t,!0).catch(n=>d.logVerbose(`Failed to stop work ${t} for session ${e}: ${u(n)}`))))}W.size>0&&await Promise.allSettled([...W]),$.size>0&&(p(`[bridge:shutdown] Archiving ${$.size} session(s)`),await Promise.allSettled([...$].map(e=>c.archiveSession(_e.get(e)??ee(e)).catch(t=>d.logVerbose(`Failed to archive session ${e}: ${u(t)}`)))));try{await c.deregisterEnvironment(r),p(`[bridge:shutdown] Environment deregistered, bridge offline`),d.logVerbose(`Environment deregistered.`)}catch(e){d.logVerbose(`Failed to deregister environment: ${u(e)}`)}let{clearBridgePointer:ve}=await import(`./bridgePointer-DHWK3LEe.js`);await ve(t.dir),d.logVerbose(`Environment offline.`)}var De=new Set([`ECONNREFUSED`,`ECONNRESET`,`ETIMEDOUT`,`ENETUNREACH`,`EHOSTUNREACH`]);function Oe(e){return!!(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&De.has(e.code))}function ke(e){return!!e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&e.code===`ERR_BAD_RESPONSE`}function Ae(e){return Math.max(0,e+e*.25*(2*Math.random()-1))}function je(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}async function Me(e,t,n,r,i=1e3){for(let a=1;a<=3;a++)try{await e.stopWork(t,n,!1),p(`[bridge:work] stopWork succeeded for workId=${n} on attempt ${a}/3`);return}catch(e){if(e instanceof B){R(e)?p(`[bridge:work] Suppressed stopWork 403 for ${n}: ${e.message}`):r.logError(`Failed to stop work ${n}: ${e.message}`),v(`error`,`bridge_stop_work_failed`,{attempts:a,fatal:!0});return}let t=u(e);if(a<3){let e=Ae(i*2**(a-1));r.logVerbose(`Failed to stop work ${n} (attempt ${a}/3), retrying in ${je(e)}: ${t}`),await k(e)}else r.logError(`Failed to stop work ${n} after 3 attempts: ${t}`),v(`error`,`bridge_stop_work_failed`,{attempts:3})}}function Ne(e,t,n,r,i){p(`[bridge:session] sessionId=${e} timed out after ${w(t)}`),S(`tengu_bridge_session_timeout`,{timeout_ms:t}),n.logSessionFailed(e,`Session timed out after ${w(t)}`),r.add(e),i.kill()}var Pe=80;function Fe(e){return C(e.replace(/\s+/g,` `).trim(),Pe)}async function Ie(e,t){let{getBridgeSession:n}=await import(`./createSession-VTqzWAu6.js`);return(await n(e,{baseUrl:t}))?.title||void 0}var Le=class extends Error{constructor(e){super(e),this.name=`BridgeHeadlessPermanentError`}};async function Re(e,t){let{dir:n,log:r}=e;process.chdir(n);let{setOriginalCwd:i,setCwdState:a}=await import(`./state-CsdHk8n-.js`);i(n),a(n);let{enableConfigs:o,checkHasTrustDialogAccepted:s}=await import(`./config-DMKtiMzJ.js`);o();let{initSinks:c}=await import(`./sinks-CgzLmim2.js`);if(c(),!s())throw new Le(`Workspace not trusted: ${n}. Run \`claude\` in that directory first to accept the trust dialog.`);if(!e.getAccessToken())throw Error(V);let{getBridgeBaseUrl:l}=await import(`./bridgeConfig-DywkIo_k.js`),d=l();if(d.startsWith(`http://`)&&!d.includes(`localhost`)&&!d.includes(`127.0.0.1`))throw new Le(`Remote Control base URL uses HTTP. Only HTTPS or localhost HTTP is allowed.`);let f=process.env.CLAUDE_BRIDGE_SESSION_INGRESS_URL||d,{getBranch:p,getRemoteUrl:m,findGitRoot:h}=await import(`./git-Bs1vtuvX.js`),{hasWorktreeCreateHook:g}=await import(`./hooks-D6wtd0Qq.js`);if(e.spawnMode===`worktree`&&!(g()||h(n)!==null))throw new Le(`Worktree mode requires a git repository or WorktreeCreate hooks. Directory ${n} has neither.`);let _=await p(),v=await m(),y=q(),b=Z(),x={dir:n,machineName:y,branch:_,gitRepoUrl:v,maxSessions:e.capacity,spawnMode:e.spawnMode,verbose:!1,sandbox:e.sandbox,bridgeId:b,workerType:`claude_code`,environmentId:Z(),apiBaseUrl:d,sessionIngressUrl:f,sessionTimeoutMs:e.sessionTimeoutMs},S=re({baseUrl:d,getAccessToken:e.getAccessToken,runnerVersion:`0.0.13`,onDebug:r,onAuth401:e.onAuth401,getTrustedDeviceToken:U}),C,w;try{let e=await S.registerBridgeEnvironment(x);C=e.environment_id,w=e.environment_secret}catch(e){throw Error(`Bridge registration failed: ${u(e)}`)}let T=be({execPath:process.execPath,scriptArgs:we(),env:process.env,verbose:!1,sandbox:e.sandbox,permissionMode:e.permissionMode,onDebug:r}),E=ze(r);E.printBanner(x,C);let D;if(e.createSessionOnStart){let{createBridgeSession:n}=await import(`./createSession-VTqzWAu6.js`);try{let i=await n({environmentId:C,title:e.name,events:[],gitRepoUrl:v,branch:_,signal:t,baseUrl:d,getAccessToken:e.getAccessToken,permissionMode:e.permissionMode});i&&(D=i,r(`created initial session ${i}`))}catch(e){r(`session pre-creation failed (non-fatal): ${u(e)}`)}}await Ee(x,C,w,S,T,E,t,void 0,D,async()=>e.getAccessToken())}function ze(e){let t=()=>{};return{printBanner:(t,n)=>e(`registered environmentId=${n} dir=${t.dir} spawnMode=${t.spawnMode} capacity=${t.maxSessions}`),logSessionStart:(t,n)=>e(`session start ${t}`),logSessionComplete:(t,n)=>e(`session complete ${t} (${n}ms)`),logSessionFailed:(t,n)=>e(`session failed ${t}: ${n}`),logStatus:e,logVerbose:e,logError:t=>e(`error: ${t}`),logReconnected:t=>e(`reconnected after ${t}ms`),addSession:(t,n)=>e(`session attached ${t}`),removeSession:t=>e(`session detached ${t}`),updateIdleStatus:t,updateReconnectingStatus:t,updateSessionStatus:t,updateSessionActivity:t,updateSessionCount:t,updateFailedStatus:t,setSpawnModeDisplay:t,setRepoInfo:t,setDebugLogPath:t,setAttached:t,setSessionTitle:t,clearStatus:t,toggleQr:t,refreshDisplay:t}}E(),d();var Be=78,Ve=1;async function He(e){if(!e){console.error(`Error: --daemon-worker requires a worker kind`),process.exitCode=Be;return}switch(e){case`remoteControl`:await Ue();break;default:console.error(`Error: unknown daemon worker kind '${e}'`),process.exitCode=Be}}async function Ue(){let e=process.env.DAEMON_WORKER_DIR||Y(`.`),t=process.env.DAEMON_WORKER_NAME||void 0,n=process.env.DAEMON_WORKER_SPAWN_MODE||`same-dir`,r=parseInt(process.env.DAEMON_WORKER_CAPACITY||`4`,10),i=process.env.DAEMON_WORKER_PERMISSION||void 0,a=process.env.DAEMON_WORKER_SANDBOX===`1`,o=process.env.DAEMON_WORKER_TIMEOUT_MS?parseInt(process.env.DAEMON_WORKER_TIMEOUT_MS,10):void 0,s=process.env.DAEMON_WORKER_CREATE_SESSION!==`0`,c=new AbortController,l=()=>c.abort();process.on(`SIGTERM`,l),process.on(`SIGINT`,l);let d={dir:e,name:t,spawnMode:n,capacity:r,permissionMode:i,sandbox:a,sessionTimeoutMs:o,createSessionOnStart:s,getAccessToken:()=>D()?.accessToken,onAuth401:async e=>!!D()?.accessToken,log:e=>{console.log(`[remoteControl] ${e}`)}};try{await Re(d,c.signal)}catch(e){e instanceof Le?(console.error(`[remoteControl] permanent error: ${e.message}`),process.exitCode=Be):(console.error(`[remoteControl] transient error: ${u(e)}`),process.exitCode=Ve)}finally{process.off(`SIGTERM`,l),process.off(`SIGINT`,l)}}export{He as runDaemonWorker};
@@ -1 +0,0 @@
1
- import{wt as e,yt as t}from"./loadAgentsDir-mcRW90aq.js";e();export{t as execIntoTmuxWorktree};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{homedir as t}from"os";import{join as n,posix as r}from"path";function i(e){return{env:e?.env??process.env,home:e?.homedir??process.env.HOME??t()}}function a(e,...t){return e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e)?r.join(e,...t):n(e,...t)}function o(e){let{env:t,home:n}=i(e);return t.XDG_STATE_HOME??a(n,`.local`,`state`)}function s(e){let{env:t,home:n}=i(e);return t.XDG_CACHE_HOME??a(n,`.cache`)}function c(e){let{env:t,home:n}=i(e);return t.XDG_DATA_HOME??a(n,`.local`,`share`)}function l(e){let{home:t}=i(e);return a(t,`.local`,`bin`)}var u=e((()=>{}));export{u as a,o as i,s as n,c as r,l as t};