@readmagic/workmate 0.0.11 → 0.0.13

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-ag2JTpmU.js → AddWorkspaceDirectory-BzNj9rS6.js} +1 -1
  2. package/dist/chunks/AgentsMdExternalIncludesDialog-CDZPR488.js +1 -0
  3. package/dist/chunks/AgentsMdExternalIncludesDialog-CH9x1Ngp.js +1 -0
  4. package/dist/chunks/App-D-bYAYAl.js +1 -0
  5. package/dist/chunks/ApproveApiKey-BEGV9Zj9.js +1 -0
  6. package/dist/chunks/ApproveApiKey-CjacpIqq.js +1 -0
  7. package/dist/chunks/BackgroundTasksDialog-A9hw_SV0.js +2 -0
  8. package/dist/chunks/{BypassPermissionsModeDialog-B05t83wa.js → BypassPermissionsModeDialog-B0BizN_J.js} +1 -1
  9. package/dist/chunks/{DiffDialog-DUbFrzKu.js → DiffDialog-mQ-5_TSv.js} +2 -2
  10. package/dist/chunks/Doctor-BC6IuQhd.js +3 -0
  11. package/dist/chunks/Doctor-i_5_AQd-.js +1 -0
  12. package/dist/chunks/ExitFlow-Bu2cVGpC.js +2 -0
  13. package/dist/chunks/{Grove-BDoVj02t.js → Grove-D0nn8zOV.js} +2 -2
  14. package/dist/chunks/{HybridTransport-C_U0IJfz.js → HybridTransport-BQNLZNa_.js} +1 -1
  15. package/dist/chunks/InvalidConfigDialog-C5CIiSIE.js +1 -0
  16. package/dist/chunks/{InvalidSettingsDialog-Br8kQOHz.js → InvalidSettingsDialog-Dq7hKXcO.js} +1 -1
  17. package/dist/chunks/MCPConnectionManager-aDDsYkGM.js +1 -0
  18. package/dist/chunks/MCPToolListView-Cr0MDkzT.js +1 -0
  19. package/dist/chunks/{McpParsingWarnings-COa71S9q.js → McpParsingWarnings-CUx2zexI.js} +1 -1
  20. package/dist/chunks/MessageSelector-DwGOWKKL.js +3 -0
  21. package/dist/chunks/Messages-C1jh4ixt.js +11 -0
  22. package/dist/chunks/Onboarding-t-P6Q5O6.js +1 -0
  23. package/dist/chunks/{PromptInputFooterSuggestions-to5eYBvI.js → PromptInputFooterSuggestions-R12fbdmp.js} +1 -1
  24. package/dist/chunks/{PromptInputHelpMenu-CfMFx-TF.js → PromptInputHelpMenu-BgADIzRj.js} +1 -1
  25. package/dist/chunks/QueryEngine-HlLQJmsd.js +1 -0
  26. package/dist/chunks/REPL-Rs_JQkDc.js +1 -0
  27. package/dist/chunks/REPL-VKAmKkII.js +133 -0
  28. package/dist/chunks/RemoteSessionManager-BbgXeM-t.js +2 -0
  29. package/dist/chunks/ResumeConversation-66zbx12g.js +1 -0
  30. package/dist/chunks/{SSETransport-DN4tCDEh.js → SSETransport-BBQkdn4e.js} +1 -1
  31. package/dist/chunks/SearchExtraToolsTool-Bq87I_vu.js +1 -0
  32. package/dist/chunks/Settings-BKdLcyXe.js +2 -0
  33. package/dist/chunks/{TeleportProgress-C2LQVLav.js → TeleportProgress-3hmIApkj.js} +1 -1
  34. package/dist/chunks/{TeleportRepoMismatchDialog-BZL8Zblz.js → TeleportRepoMismatchDialog-BA1a66RK.js} +1 -1
  35. package/dist/chunks/{TeleportResumeWrapper-wPiIs8xg.js → TeleportResumeWrapper-BT4O-Wsi.js} +1 -1
  36. package/dist/chunks/{ThemePicker-BT_NaRQC.js → ThemePicker-DUlhcoso.js} +1 -1
  37. package/dist/chunks/TrustDialog-Dpk03V1Y.js +1 -0
  38. package/dist/chunks/{ValidationErrorsList-C-hWdy_8.js → ValidationErrorsList-DSSUWdgd.js} +1 -1
  39. package/dist/chunks/add-dir-BUr0z-VU.js +1 -0
  40. package/dist/chunks/{agentDisplay-CuSHqgZc.js → agentDisplay-D7bdOOG7.js} +1 -1
  41. package/dist/chunks/{agents-CMC0iQP4.js → agents-22wiC58F.js} +1 -1
  42. package/dist/chunks/agents-8ELI8RJo.js +103 -0
  43. package/dist/chunks/allErrors-C1eMbHSv.js +1 -0
  44. package/dist/chunks/api-DgjIFdMn.js +1 -0
  45. package/dist/chunks/{api-BbJfMXRS.js → api-f3GN2I_J.js} +1 -1
  46. package/dist/chunks/auth-B73a4Cob.js +1 -0
  47. package/dist/chunks/{auth-7mJGtlZp.js → auth-Czy7GoRh.js} +1 -1
  48. package/dist/chunks/auth-D_0waidQ.js +1 -0
  49. package/dist/chunks/backgroundHousekeeping-C_ArdTFX.js +17 -0
  50. package/dist/chunks/backgroundHousekeeping-YJhvZ0dh.js +1 -0
  51. package/dist/chunks/{banner-1Wyeyawe.js → banner-BcAM7iSx.js} +1 -1
  52. package/dist/chunks/bg-Ci7pG4eo.js +9 -0
  53. package/dist/chunks/branch-bb4-bErF.js +3 -0
  54. package/dist/chunks/{break-cache-CAoZ9b72.js → break-cache-4rlQORVk.js} +2 -2
  55. package/dist/chunks/{bridgeConfig-UgaUfuP6.js → bridgeConfig-B80T_lw7.js} +1 -1
  56. package/dist/chunks/bridgeConfig-DywkIo_k.js +1 -0
  57. package/dist/chunks/{bridgeMessaging-Ci5H68MX.js → bridgeMessaging-DyvHd16Z.js} +1 -1
  58. package/dist/chunks/{bridgePointer-BL8-lGvN.js → bridgePointer-DHWK3LEe.js} +1 -1
  59. package/dist/chunks/{bridgeStatusUtil-C36w15ge.js → bridgeStatusUtil-DStiD05t.js} +1 -1
  60. package/dist/chunks/btw-BRmV51bR.js +1 -0
  61. package/dist/chunks/caches-C5DIVdvI.js +1 -0
  62. package/dist/chunks/caches-zDZEgNKq.js +1 -0
  63. package/dist/chunks/{capacityWake-BOySRJUJ.js → capacityWake-ByL6fM6I.js} +1 -1
  64. package/dist/chunks/{ccrClient-Br4LAofR.js → ccrClient-BALhzhPF.js} +1 -1
  65. package/dist/chunks/{claudeDesktop-Bgds1-YT.js → claudeDesktop-Ct_hyICL.js} +1 -1
  66. package/dist/chunks/{clear-C4Vtnbye.js → clear-B_yVyJXP.js} +1 -1
  67. package/dist/chunks/cliLaunch-OPOtzhvA.js +1 -0
  68. package/dist/chunks/client-7lIxWcaM.js +1 -0
  69. package/dist/chunks/{client-B9404qIP.js → client-BMA05FW8.js} +1 -1
  70. package/dist/chunks/client-DVg8PpFX.js +1 -0
  71. package/dist/chunks/commands-ByFXqW43.js +1 -0
  72. package/dist/chunks/compact-BUShp2eQ.js +2 -0
  73. package/dist/chunks/config-9rLTDOYW.js +3 -0
  74. package/dist/chunks/config-BwHNU_pI.js +1 -0
  75. package/dist/chunks/{config-kB2eazPX.js → config-DMKtiMzJ.js} +1 -1
  76. package/dist/chunks/{context-BN7DEjoH.js → context-6Pk3iVhh.js} +1 -1
  77. package/dist/chunks/{context-noninteractive-D91W2B8e.js → context-noninteractive-CHzerxnH.js} +2 -2
  78. package/dist/chunks/context-noninteractive-DFwRQyFE.js +1 -0
  79. package/dist/chunks/conversation-5zb5XkSA.js +1 -0
  80. package/dist/chunks/conversation-JP2ZXrwu.js +1 -0
  81. package/dist/chunks/createSSHSession-XkHMiGRN.js +6 -0
  82. package/dist/chunks/{createSession-DRqkLZWt.js → createSession-BNGm9fL4.js} +1 -1
  83. package/dist/chunks/createSession-VTqzWAu6.js +1 -0
  84. package/dist/chunks/crossProjectResume-DxgQVYSi.js +40 -0
  85. package/dist/chunks/{cwd-Cfdf7z7s.js → cwd-Besi3Os3.js} +1 -1
  86. package/dist/chunks/cwd-DpqwaYHw.js +1 -0
  87. package/dist/chunks/datadog-3WUWcCFn.js +1 -0
  88. package/dist/chunks/{debug-BecbSVoN.js → debug-Dr1SjdXn.js} +2 -2
  89. package/dist/chunks/{debugUtils-CmJfIUxW.js → debugUtils-cK-iOsEV.js} +1 -1
  90. package/dist/chunks/detached-CqfQYVOi.js +5 -0
  91. package/dist/chunks/detectRepository-BsKZDRoI.js +1 -0
  92. package/dist/chunks/{detectRepository-C15umvKN.js → detectRepository-CMEkS5_2.js} +1 -1
  93. package/dist/chunks/{diff-DeK4bwjw.js → diff-CKlLimGq.js} +1 -1
  94. package/dist/chunks/{directoryCompletion-BJCu19HJ.js → directoryCompletion-ByBTSuLu.js} +1 -1
  95. package/dist/chunks/doctor-Bvx0u0sO.js +1 -0
  96. package/dist/chunks/{entry-mdegyj8z.js → entry-DCbq734V.js} +4 -4
  97. package/dist/chunks/{envUtils-BDhHQY0-.js → envUtils-DcaKZlRU.js} +1 -1
  98. package/dist/chunks/{esm-Ka3lhafK.js → esm-CtQkOk5D.js} +1 -1
  99. package/dist/chunks/{execFileNoThrow-DHyW8FMX.js → execFileNoThrow-mXq4K0rl.js} +1 -1
  100. package/dist/chunks/{execSyncWrapper-CDzB0BM1.js → execSyncWrapper-Ne33rRiD.js} +1 -1
  101. package/dist/chunks/exit-DTsz5Lcb.js +1 -0
  102. package/dist/chunks/{extraUsage-BrKbpBK-.js → extraUsage-C86bZVgt.js} +1 -1
  103. package/dist/chunks/extractMemories-6OnMgL2S.js +1 -0
  104. package/dist/chunks/fast-B2ziqJEA.js +1 -0
  105. package/dist/chunks/{fast-DWn40OcQ.js → fast-BkhjaTkZ.js} +1 -1
  106. package/dist/chunks/{fileSuggestions-C7Pwq2yj.js → fileSuggestions-BalHmi1-.js} +2 -2
  107. package/dist/chunks/{firstPartyEventLogger-BHjBQH0J.js → firstPartyEventLogger-1RTgXHSz.js} +2 -2
  108. package/dist/chunks/firstPartyEventLogger-CXMzhLrF.js +1 -0
  109. package/dist/chunks/{flushGate-DdJjxCes.js → flushGate-DWL05x7v.js} +1 -1
  110. package/dist/chunks/{gemini-DHv2iVfy.js → gemini-BLpLJyli.js} +1 -1
  111. package/dist/chunks/generateSessionName-CdbMksHi.js +1 -0
  112. package/dist/chunks/{genericProcessUtils-B2HcDYhg.js → genericProcessUtils-Dc1pfb7J.js} +1 -1
  113. package/dist/chunks/git-Bs1vtuvX.js +1 -0
  114. package/dist/chunks/{git-DBlOv64X.js → git-CoQQ6YEf.js} +1 -1
  115. package/dist/chunks/{githubRepoPathMapping-CK56bUDe.js → githubRepoPathMapping-CmpEaQoo.js} +1 -1
  116. package/dist/chunks/{goal-BZG4gtnb.js → goal-V3qix-i1.js} +3 -3
  117. package/dist/chunks/grok-BLLATotv.js +1 -0
  118. package/dist/chunks/{grove-_zlQ83yR.js → grove-b9gGKgu4.js} +1 -1
  119. package/dist/chunks/{help-C_2tdXHC.js → help-BR7UEr5R.js} +1 -1
  120. package/dist/chunks/{hooks-C7Bn7MBe.js → hooks-C-QMGvCg.js} +3 -3
  121. package/dist/chunks/hooks-D6wtd0Qq.js +1 -0
  122. package/dist/chunks/{initReplBridge-NkZRcM77.js → initReplBridge-DyScxedy.js} +1 -1
  123. package/dist/chunks/{install-Du-DSVzj.js → install-DGH_bjUh.js} +1 -1
  124. package/dist/chunks/{instrumentation-DMs3b82f.js → instrumentation-DQ705pC7.js} +4 -4
  125. package/dist/chunks/{job-rbX1VZmp.js → job-BaMT6Lb2.js} +1 -1
  126. package/dist/chunks/{jwtUtils-OzxN2zts.js → jwtUtils-FQWtM6iM.js} +1 -1
  127. package/dist/chunks/keybindings-CG292HS1.js +2 -0
  128. package/dist/chunks/{launchLocalMemory-BLRCK1_o.js → launchLocalMemory-CtZrkmaw.js} +2 -2
  129. package/dist/chunks/{launchOnboarding-Al_X75Vz.js → launchOnboarding-CyOtdZkT.js} +1 -1
  130. package/dist/chunks/loadAgentsDir-4UC4yLg1.js +1 -0
  131. package/dist/chunks/{loadAgentsDir-BL93ulMm.js → loadAgentsDir-mcRW90aq.js} +596 -604
  132. package/dist/chunks/loadPluginHooks-CWI0RMUx.js +1 -0
  133. package/dist/chunks/{localSearch-C5ipegd9.js → localSearch-CCCDKpYx.js} +1 -1
  134. package/dist/chunks/localSearch-D4hVR7-d.js +1 -0
  135. package/dist/chunks/{log-Dauqle-Z.js → log-27kCA_9u.js} +1 -1
  136. package/dist/chunks/{logoV2Utils-CkvOihX7.js → logoV2Utils--8OUQQPd.js} +1 -1
  137. package/dist/chunks/{magicDocs-DLav5QK0.js → magicDocs-26J_l1De.js} +3 -3
  138. package/dist/chunks/main-CGLCy2pM.js +31 -0
  139. package/dist/chunks/main-DUjtDK1Q.js +513 -0
  140. package/dist/chunks/managedEnv-BuCurT_S.js +1 -0
  141. package/dist/chunks/{managedEnv-DJSCuqCb.js → managedEnv-Ds6MlFQE.js} +1 -1
  142. package/dist/chunks/{mappers-DQxMcezy.js → mappers-DwZw084m.js} +1 -1
  143. package/dist/chunks/mcp-CEKR7PjL.js +6 -0
  144. package/dist/chunks/mcp-DCAf2hHD.js +1 -0
  145. package/dist/chunks/mcp-mCuc8dNe.js +2 -0
  146. package/dist/chunks/{memoize-FeyE7JEh.js → memoize-Co4vS6UF.js} +1 -1
  147. package/dist/chunks/memory-B5SkpC7u.js +1 -0
  148. package/dist/chunks/{mode-Bl2RZC8M.js → mode-B80CHkqo.js} +1 -1
  149. package/dist/chunks/model-BqaneI4D.js +1 -0
  150. package/dist/chunks/model-C29_32BD.js +1 -0
  151. package/dist/chunks/model-NG8fvuT2.js +1 -0
  152. package/dist/chunks/{modelOptions-BtEZe5BB.js → modelOptions-CiZgZxZC.js} +1 -1
  153. package/dist/chunks/{nativeInstaller-BEwayifa.js → nativeInstaller-DqbEfGSX.js} +1 -1
  154. package/dist/chunks/oauth-D38aRTUb.js +1 -0
  155. package/dist/chunks/oauth-U649LV5H.js +1 -0
  156. package/dist/chunks/{observationStore-BpjlK0pG.js → observationStore-D0rm3GhP.js} +1 -1
  157. package/dist/chunks/{omit--yH_T4rf.js → omit-KEhe84f4.js} +1 -1
  158. package/dist/chunks/{onChangeAppState-ZdwI7boX.js → onChangeAppState-Dq1tIEJI.js} +1 -1
  159. package/dist/chunks/openai-BvnsYTpQ.js +10 -0
  160. package/dist/chunks/{panel-CoNfXy3K.js → panel-CoF2a-h4.js} +1 -1
  161. package/dist/chunks/parser-B2PlJg4C.js +1 -0
  162. package/dist/chunks/{parser-BH4u7QiV.js → parser-CUUiH40T.js} +1 -1
  163. package/dist/chunks/partition-DeT341qu.js +1 -0
  164. package/dist/chunks/permissions-BPpeHxpk.js +3 -0
  165. package/dist/chunks/pidLock-DQGDoFQP.js +3 -0
  166. package/dist/chunks/{plan-BNYDTnQd.js → plan-BRiC5ujG.js} +1 -1
  167. package/dist/chunks/{platform-B0uTQc9P.js → platform-Dg1c9F_1.js} +1 -1
  168. package/dist/chunks/plugin-Dcg_GGR9.js +17 -0
  169. package/dist/chunks/pluginAutoupdate-ByH9IPC9.js +1 -0
  170. package/dist/chunks/pluginBlocklist-BfoLN9a-.js +1 -0
  171. package/dist/chunks/pluginCliCommands-Bc2Iybhz.js +1 -0
  172. package/dist/chunks/{pluginFlagging-DcJ_FQuv.js → pluginFlagging-Cr0d0hBA.js} +1 -1
  173. package/dist/chunks/pluginOperations-CKNyYjS-.js +2 -0
  174. package/dist/chunks/pluginStartupCheck-B48_cGgo.js +1 -0
  175. package/dist/chunks/{pluginStartupCheck-CKBFaMFr.js → pluginStartupCheck-DiCDQQlr.js} +1 -1
  176. package/dist/chunks/plugins-BP_36tOl.js +4 -0
  177. package/dist/chunks/poorMode-Djw0P9Gu.js +1 -0
  178. package/dist/chunks/{poorMode-B_xEvuEV.js → poorMode-DxgO_bUb.js} +1 -1
  179. package/dist/chunks/print-2uavraPq.js +26 -0
  180. package/dist/chunks/processBashCommand-g3sAMpHt.js +1 -0
  181. package/dist/chunks/processSlashCommand-tIbeCrv5.js +5 -0
  182. package/dist/chunks/{projectContext-CIxul6vA.js → projectContext-BN2ZWzOG.js} +1 -1
  183. package/dist/chunks/{projectContext-RUMJB798.js → projectContext-Bw3o5BrN.js} +1 -1
  184. package/dist/chunks/{prompt-Dx7IWhBt.js → prompt-DIlq8NTy.js} +4 -4
  185. package/dist/chunks/prompt-DLv-Cd67.js +1 -0
  186. package/dist/chunks/prompt-DV5tCLRh.js +1 -0
  187. package/dist/chunks/{promptEditor-WCkmpejM.js → promptEditor-BILqOGl1.js} +2 -2
  188. package/dist/chunks/{protocolHandler-BiVWrpHi.js → protocolHandler-B83fCYI4.js} +1 -1
  189. package/dist/chunks/{proxy-CVn7o19p.js → proxy-BEKNaTXI.js} +1 -1
  190. package/dist/chunks/rcDebugLog-DSchf3Hs.js +1 -0
  191. package/dist/chunks/reconciler-CDq6XgAS.js +1 -0
  192. package/dist/chunks/refresh-ysrhoWCo.js +1 -0
  193. package/dist/chunks/{registerProtocol-E0Iu5hEx.js → registerProtocol-DduKPsn_.js} +1 -1
  194. package/dist/chunks/{reload-plugins-D-3AUT9g.js → reload-plugins-CGb0HTsH.js} +1 -1
  195. package/dist/chunks/{remoteBridgeCore-CV6we3ZA.js → remoteBridgeCore-BmteXmI9.js} +1 -1
  196. package/dist/chunks/{remoteManagedSettings-D26Q09-7.js → remoteManagedSettings-CwDGxL5p.js} +1 -1
  197. package/dist/chunks/rename-1GLIUlYk.js +1 -0
  198. package/dist/chunks/{renderOptions-DDLbSMQU.js → renderOptions-45A-EdsK.js} +1 -1
  199. package/dist/chunks/resume-DWtlUiHW.js +2 -0
  200. package/dist/chunks/ripgrep-BLQnqPnE.js +1 -0
  201. package/dist/chunks/{ripgrep-C1ydIMzT.js → ripgrep-DQ_ILUJV.js} +1 -1
  202. package/dist/chunks/{runtimeObserver-L7pSIWBT.js → runtimeObserver-4ZqaCXYy.js} +4 -4
  203. package/dist/chunks/{runtimeObserver-OU8KrZQG.js → runtimeObserver-CtNY8Al2.js} +1 -1
  204. package/dist/chunks/sandbox-adapter-BzjRQh_r.js +1 -0
  205. package/dist/chunks/sandbox-toggle-Bz49-F6e.js +1 -0
  206. package/dist/chunks/searchExtraTools-D6vj8qJ-.js +1 -0
  207. package/dist/chunks/{session-DUYsfPy_.js → session-wb6X4Wrq.js} +2 -2
  208. package/dist/chunks/sessionFileAccessHooks-Da97UA2n.js +1 -0
  209. package/dist/chunks/{sessionObserver-Dv3Ba8eA.js → sessionObserver-BJQ5hwjU.js} +2 -2
  210. package/dist/chunks/sessionObserver-DXO4trhk.js +1 -0
  211. package/dist/chunks/{sessionState-D-SaBzWD.js → sessionState-Bn3ESS5f.js} +1 -1
  212. package/dist/chunks/sessionStorage-DlPVsQn9.js +1 -0
  213. package/dist/chunks/{sessionStoragePortable-JZnGwqUM.js → sessionStoragePortable-BhkGMZWp.js} +1 -1
  214. package/dist/chunks/sessionTitle-Cbzrb9jT.js +14 -0
  215. package/dist/chunks/{sessionTracing-Bqb3vJTt.js → sessionTracing-CEsm8pZL.js} +1 -1
  216. package/dist/chunks/settings-3ionQKNv.js +1 -0
  217. package/dist/chunks/settings-DiBMs2gM.js +20 -0
  218. package/dist/chunks/settingsSync-eHaSngKo.js +1 -0
  219. package/dist/chunks/setup-DeyiuGNX.js +3 -0
  220. package/dist/chunks/{shadowedRuleDetection-BzAZ57p2.js → shadowedRuleDetection-D5X5fhzj.js} +1 -1
  221. package/dist/chunks/{shellQuote-DS6WrivY.js → shellQuote-C_I6DHLV.js} +1 -1
  222. package/dist/chunks/{sideQuestion-CvMBBjI8.js → sideQuestion-BHRtwhyj.js} +3 -3
  223. package/dist/chunks/{sinks-f7qYjbKJ.js → sinks-Bgy2UNK-.js} +2 -2
  224. package/dist/chunks/sinks-CgzLmim2.js +1 -0
  225. package/dist/chunks/skillChangeDetector-BlSP16j6.js +1 -0
  226. package/dist/chunks/{skillGapStore-CqaT8c0C.js → skillGapStore-BjQSSz2E.js} +2 -2
  227. package/dist/chunks/{skillLifecycle-CnR8IqJM.js → skillLifecycle-Sp8strFv.js} +2 -2
  228. package/dist/chunks/{skillSearchPanel-D9qrOXpI.js → skillSearchPanel-3sYRez_Q.js} +5 -5
  229. package/dist/chunks/skills-CJhWI8t1.js +1 -0
  230. package/dist/chunks/startupProfiler-CUlV07MD.js +1 -0
  231. package/dist/chunks/{startupProfiler-CmH_aVy2.js → startupProfiler-Dc5r6LgE.js} +2 -2
  232. package/dist/chunks/{state-BemZdQIl.js → state-BPFYBqm1.js} +1 -1
  233. package/dist/chunks/state-CsdHk8n-.js +1 -0
  234. package/dist/chunks/{stats-B8uQ-UDi.js → stats-BkadEKa-.js} +1 -1
  235. package/dist/chunks/status-CDCurOqs.js +2 -0
  236. package/dist/chunks/{status-BekdWoIj.js → status-yoQIQ2Ni.js} +1 -1
  237. package/dist/chunks/statusNoticeHelpers-Sl4jjauz.js +1 -0
  238. package/dist/chunks/{stringUtils-C8PaYpQF.js → stringUtils-Df-Lnjxd.js} +1 -1
  239. package/dist/chunks/{subprocessEnv-Ci8VV_bi.js → subprocessEnv-CNBOhlDV.js} +1 -1
  240. package/dist/chunks/subprocessEnv-DtBCqQIo.js +1 -0
  241. package/dist/chunks/switcher-C-m6MUwE.js +1 -0
  242. package/dist/chunks/switcher-uoQMHmEZ.js +1 -0
  243. package/dist/chunks/{syncCache-ClP9aBqK.js → syncCache-BooMjgU6.js} +1 -1
  244. package/dist/chunks/{tasks-Dmh6qikm.js → tasks-CHG_6sXQ.js} +1 -1
  245. package/dist/chunks/teleport-C9KRE4X8.js +1 -0
  246. package/dist/chunks/{templateJobs-CxqU-s5i.js → templateJobs-BYYfF4m5.js} +2 -2
  247. package/dist/chunks/{terminalSetup-BKGcmlWp.js → terminalSetup-CbXKCpWM.js} +1 -1
  248. package/dist/chunks/{terminalSetup-Cy19F1Js.js → terminalSetup-fwhFTxGi.js} +1 -1
  249. package/dist/chunks/{theme-U7lMFHQ0.js → theme-MvX7hojJ.js} +1 -1
  250. package/dist/chunks/tmux-d3cNCIZA.js +1 -0
  251. package/dist/chunks/{toolEventObserver-D9qjoVl5.js → toolEventObserver-BFEl47bq.js} +1 -1
  252. package/dist/chunks/toolPool-Cq74Cvjp.js +1 -0
  253. package/dist/chunks/trustedDevice-BGwujSqc.js +1 -0
  254. package/dist/chunks/{trustedDevice-DL0pWP4_.js → trustedDevice-BLiKbGpG.js} +1 -1
  255. package/dist/chunks/{types-DafcFtmb.js → types-BJ7qTz75.js} +1 -1
  256. package/dist/chunks/{udsClient-CWnfsgFP.js → udsClient-CF8BmZgN.js} +1 -1
  257. package/dist/chunks/{updateCCB-C6XftzIG.js → updateCCB-CfckOy7T.js} +1 -1
  258. package/dist/chunks/{upstreamproxy-CXmjxHpl.js → upstreamproxy-BuBFDFAD.js} +1 -1
  259. package/dist/chunks/{useExitOnCtrlCDWithKeybindings-DEEJhm_W.js → useExitOnCtrlCDWithKeybindings-CPLBDluY.js} +1 -1
  260. package/dist/chunks/useMainLoopModel-C00PbZ1Q.js +1 -0
  261. package/dist/chunks/useManagePlugins-DFaGntzJ.js +1 -0
  262. package/dist/chunks/{useMergedTools-DbhqKk1-.js → useMergedTools-DYobZ5N4.js} +1 -1
  263. package/dist/chunks/{useSearchInput-gUDbkLaC.js → useSearchInput-KFKh2ozY.js} +1 -1
  264. package/dist/chunks/useSettingsErrors-BRgjvaHd.js +1 -0
  265. package/dist/chunks/{userAgent-CU7Ndh79.js → userAgent-DUrr02yh.js} +1 -1
  266. package/dist/chunks/util-D7uwPgF1.js +1 -0
  267. package/dist/chunks/validatePlugin-VukX52bx.js +1 -0
  268. package/dist/chunks/{vim-w37BfGZ5.js → vim-C4Hs5U2h.js} +1 -1
  269. package/dist/chunks/{which-BRWBO7Gu.js → which-mplwBbc0.js} +1 -1
  270. package/dist/chunks/windowsPaths-B8p9tFRF.js +1 -0
  271. package/dist/chunks/{windowsPaths-DtWHLjmE.js → windowsPaths-C7Mdo9aU.js} +1 -1
  272. package/dist/chunks/{workSecret-BEhXgH2M.js → workSecret-XLodD7tw.js} +1 -1
  273. package/dist/chunks/workerRegistry-BA37PVbv.js +6 -0
  274. package/dist/chunks/worktree-Lik8xuKd.js +1 -0
  275. package/dist/cli.js +1 -1
  276. package/package.json +1 -1
  277. package/dist/chunks/App-BuKmqFPm.js +0 -1
  278. package/dist/chunks/ApproveApiKey-CIWOi_7v.js +0 -1
  279. package/dist/chunks/ApproveApiKey-M6U-NafA.js +0 -1
  280. package/dist/chunks/BackgroundTasksDialog-Pnpl3Ixx.js +0 -2
  281. package/dist/chunks/ClaudeMdExternalIncludesDialog-CSywJdVL.js +0 -1
  282. package/dist/chunks/ClaudeMdExternalIncludesDialog-D-w166RC.js +0 -1
  283. package/dist/chunks/ConsoleOAuthFlow-CV6PcJOP.js +0 -1
  284. package/dist/chunks/Doctor-BcnUfJ4I.js +0 -1
  285. package/dist/chunks/Doctor-Dz4TuYas.js +0 -3
  286. package/dist/chunks/ExitFlow-BwyAtIHx.js +0 -2
  287. package/dist/chunks/InvalidConfigDialog-bih293Xt.js +0 -1
  288. package/dist/chunks/MCPConnectionManager-B9n4SXN4.js +0 -1
  289. package/dist/chunks/MCPToolListView-DJ06N1DG.js +0 -1
  290. package/dist/chunks/MessageSelector-o4ULADFg.js +0 -3
  291. package/dist/chunks/Messages-qqwHuAW5.js +0 -11
  292. package/dist/chunks/Onboarding-BzuQjney.js +0 -1
  293. package/dist/chunks/QueryEngine-Dt0BKUeF.js +0 -1
  294. package/dist/chunks/REPL-CUbEDqEl.js +0 -133
  295. package/dist/chunks/REPL-DMaKNhTa.js +0 -1
  296. package/dist/chunks/RemoteSessionManager-Bf44A0Ol.js +0 -2
  297. package/dist/chunks/ResumeConversation-Ctw5Q1g9.js +0 -1
  298. package/dist/chunks/SearchExtraToolsTool-C80OdtPZ.js +0 -1
  299. package/dist/chunks/Settings-DfdcmvOV.js +0 -2
  300. package/dist/chunks/TrustDialog-ACaJ_m7A.js +0 -1
  301. package/dist/chunks/WelcomeV2-ZQRKlcT4.js +0 -1
  302. package/dist/chunks/add-dir-SAKTkw0S.js +0 -1
  303. package/dist/chunks/agents-ZgRKpjHv.js +0 -103
  304. package/dist/chunks/allErrors-_cOQksHC.js +0 -1
  305. package/dist/chunks/api-DS1MiW01.js +0 -1
  306. package/dist/chunks/auth-DGZzCbU0.js +0 -1
  307. package/dist/chunks/auth-DN1MUpB8.js +0 -1
  308. package/dist/chunks/autoMode-CBtY7ACs.js +0 -45
  309. package/dist/chunks/autonomy-DuQmYhq6.js +0 -15
  310. package/dist/chunks/autonomy-lJV7yWUl.js +0 -1
  311. package/dist/chunks/autonomyPanel-DAQm6lDz.js +0 -1
  312. package/dist/chunks/backgroundHousekeeping-BTy71bcY.js +0 -1
  313. package/dist/chunks/backgroundHousekeeping-Cc7Ag7JG.js +0 -17
  314. package/dist/chunks/bg-CJ0YWFli.js +0 -9
  315. package/dist/chunks/bg-CeUrRz_7.js +0 -1
  316. package/dist/chunks/branch-k3kirqbA.js +0 -3
  317. package/dist/chunks/bridgeConfig-CzRUPn-D.js +0 -1
  318. package/dist/chunks/btw-nVoVuIae.js +0 -1
  319. package/dist/chunks/caches-B8sM3Zys.js +0 -1
  320. package/dist/chunks/caches-Bp9MZ7IE.js +0 -1
  321. package/dist/chunks/cliLaunch-BTpfAGGI.js +0 -1
  322. package/dist/chunks/client-BCAbKdNz.js +0 -1
  323. package/dist/chunks/client-CJE6gEvU.js +0 -1
  324. package/dist/chunks/commands-DL-BzoMQ.js +0 -1
  325. package/dist/chunks/compact-Cx7BPXLU.js +0 -2
  326. package/dist/chunks/config-S5OW4Xqr.js +0 -1
  327. package/dist/chunks/config-aRiTrtCv.js +0 -3
  328. package/dist/chunks/connectHeadless-CqRoEtrg.js +0 -1
  329. package/dist/chunks/context-noninteractive-DPacEFJ1.js +0 -1
  330. package/dist/chunks/conversation-D5Nbu9eT.js +0 -1
  331. package/dist/chunks/conversation-hcUx9e-C.js +0 -1
  332. package/dist/chunks/createSSHSession-DecOR6M5.js +0 -6
  333. package/dist/chunks/createSession-D27zvmOs.js +0 -1
  334. package/dist/chunks/crossProjectResume-Bw3U0Ty6.js +0 -40
  335. package/dist/chunks/cwd-ClLru_7T.js +0 -1
  336. package/dist/chunks/dangerousBackend-DwcP0P08.js +0 -1
  337. package/dist/chunks/datadog-bm551AVV.js +0 -1
  338. package/dist/chunks/detached-CIyF0M5O.js +0 -5
  339. package/dist/chunks/detectRepository-DDfLfKcM.js +0 -1
  340. package/dist/chunks/doctor-BJORBomU.js +0 -1
  341. package/dist/chunks/exit-CF3KBl-S.js +0 -1
  342. package/dist/chunks/extractMemories-4lBn134y.js +0 -1
  343. package/dist/chunks/fast-0Vi354KI.js +0 -1
  344. package/dist/chunks/firstPartyEventLogger-BNBnLYPK.js +0 -1
  345. package/dist/chunks/generateSessionName-DhS_6oHd.js +0 -1
  346. package/dist/chunks/git-DF4RFFaT.js +0 -1
  347. package/dist/chunks/grok-BS57ZhyW.js +0 -1
  348. package/dist/chunks/hooks-DT80Arzc.js +0 -1
  349. package/dist/chunks/keybindings-CwdC_8S0.js +0 -2
  350. package/dist/chunks/loadAgentsDir-eVKq8efm.js +0 -1
  351. package/dist/chunks/loadPluginHooks-B0au35a4.js +0 -1
  352. package/dist/chunks/localSearch-CZlFfR_X.js +0 -1
  353. package/dist/chunks/lockfile-D5-j7HOZ.js +0 -1
  354. package/dist/chunks/main-CVNWNAoh.js +0 -513
  355. package/dist/chunks/main-LMyE3jXY.js +0 -31
  356. package/dist/chunks/managedEnv-CYepSnm8.js +0 -1
  357. package/dist/chunks/mcp-BAbbEaBA.js +0 -1
  358. package/dist/chunks/mcp-Ct4Sum6A.js +0 -6
  359. package/dist/chunks/mcp-D5HkCqUh.js +0 -2
  360. package/dist/chunks/memory-COa7aUbx.js +0 -1
  361. package/dist/chunks/model-B7rtZ7KV.js +0 -1
  362. package/dist/chunks/model-Bgh_r4lg.js +0 -1
  363. package/dist/chunks/model-DiuEAv6h.js +0 -1
  364. package/dist/chunks/oauth-BN2I0_jl.js +0 -1
  365. package/dist/chunks/oauth-C9VBDB0Y.js +0 -1
  366. package/dist/chunks/openai-DWs4D-nQ.js +0 -10
  367. package/dist/chunks/parseConnectUrl-BiyKR5-x.js +0 -1
  368. package/dist/chunks/parser-BMIaRErw.js +0 -1
  369. package/dist/chunks/partition-DLcW5Oo_.js +0 -1
  370. package/dist/chunks/permissions-CaucYK3s.js +0 -3
  371. package/dist/chunks/pidLock-DgOBc1Xo.js +0 -3
  372. package/dist/chunks/plugin-BN-of1_H.js +0 -17
  373. package/dist/chunks/pluginAutoupdate-BBU9Jn4p.js +0 -1
  374. package/dist/chunks/pluginBlocklist-DXQlbG0P.js +0 -1
  375. package/dist/chunks/pluginCliCommands-CfdVNs8D.js +0 -1
  376. package/dist/chunks/pluginOperations-DnhzFbYI.js +0 -2
  377. package/dist/chunks/pluginStartupCheck-CpNB4jxG.js +0 -1
  378. package/dist/chunks/plugins-CBW7kPyp.js +0 -4
  379. package/dist/chunks/poorMode-yH1o41cQ.js +0 -1
  380. package/dist/chunks/print-BZOx09SU.js +0 -26
  381. package/dist/chunks/processBashCommand-dcCNCiBp.js +0 -1
  382. package/dist/chunks/processSlashCommand-YDiM63Qr.js +0 -5
  383. package/dist/chunks/prompt-CXGy0llt.js +0 -1
  384. package/dist/chunks/prompt-DovNDmcx.js +0 -1
  385. package/dist/chunks/rcDebugLog-CARUIORE.js +0 -1
  386. package/dist/chunks/reconciler-C2Nd_e4n.js +0 -1
  387. package/dist/chunks/refresh-B84H2Ezd.js +0 -1
  388. package/dist/chunks/rename-CSavuBIE.js +0 -1
  389. package/dist/chunks/resume-CROylN3J.js +0 -2
  390. package/dist/chunks/ripgrep-2M1GkXqJ.js +0 -1
  391. package/dist/chunks/sandbox-adapter-6UwMLh6e.js +0 -1
  392. package/dist/chunks/sandbox-toggle-YrQNWGsr.js +0 -1
  393. package/dist/chunks/searchExtraTools-Bdv5HJ74.js +0 -1
  394. package/dist/chunks/server-LdbAb0sV.js +0 -1
  395. package/dist/chunks/serverBanner-BdExKFHT.js +0 -1
  396. package/dist/chunks/serverLog-BFmvyJ93.js +0 -1
  397. package/dist/chunks/sessionFileAccessHooks-Czen7Ejz.js +0 -1
  398. package/dist/chunks/sessionManager-CPa049BO.js +0 -1
  399. package/dist/chunks/sessionObserver-B0zucj_c.js +0 -1
  400. package/dist/chunks/sessionStorage-BM1x51Z7.js +0 -1
  401. package/dist/chunks/sessionTitle-uCuYaNif.js +0 -14
  402. package/dist/chunks/settings-BG15IFYx.js +0 -1
  403. package/dist/chunks/settings-D4CpDv2y.js +0 -20
  404. package/dist/chunks/settingsSync-BSrpnyqo.js +0 -1
  405. package/dist/chunks/setup-C62oq4AZ.js +0 -3
  406. package/dist/chunks/sinks-WJ7nzLQs.js +0 -1
  407. package/dist/chunks/skillChangeDetector-U5kRU5nd.js +0 -1
  408. package/dist/chunks/skills-BgcFh0vy.js +0 -1
  409. package/dist/chunks/startupProfiler-B4HBBbHN.js +0 -1
  410. package/dist/chunks/state-BAGmpVBn.js +0 -1
  411. package/dist/chunks/state-D_lk6z-C.js +0 -1
  412. package/dist/chunks/status-D6KlRJmR.js +0 -2
  413. package/dist/chunks/statusNoticeHelpers-BMM8_uJ1.js +0 -1
  414. package/dist/chunks/subprocessEnv-CZkA9Cdp.js +0 -1
  415. package/dist/chunks/switcher-Ck9CrXrr.js +0 -1
  416. package/dist/chunks/switcher-DnAhkyIn.js +0 -1
  417. package/dist/chunks/teleport-DH3IuAUQ.js +0 -1
  418. package/dist/chunks/tmux-D5EvHWi3.js +0 -1
  419. package/dist/chunks/toolPool-69mfSPAs.js +0 -1
  420. package/dist/chunks/trustedDevice-B6AKlsl_.js +0 -1
  421. package/dist/chunks/useMainLoopModel-6w7mhwhU.js +0 -1
  422. package/dist/chunks/useManagePlugins-CjnsO-Of.js +0 -1
  423. package/dist/chunks/useSettingsErrors-CgPad-H0.js +0 -1
  424. package/dist/chunks/util-B4oMhJKh.js +0 -1
  425. package/dist/chunks/validatePlugin-y_O_tCEL.js +0 -1
  426. package/dist/chunks/windowsPaths-BY-IVNwQ.js +0 -1
  427. package/dist/chunks/workerRegistry-Bq9bS5pw.js +0 -6
  428. package/dist/chunks/worktree-4SUJ4dtz.js +0 -1
@@ -1,20 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{c as t,i as n,n as r,r as i,s as a,t as o}from"./isObject-C6qM3WEW.js";import{d as s,f as c,g as ee,h as l,l as te,n as u,t as d,u as f}from"./memoize-BK3gG5ob.js";import{l as p,n as m,o as ne}from"./envUtils-BDhHQY0-.js";import{n as re,t as ie}from"./defineProperty-C-QyHrDq.js";import{i as ae,r as oe}from"./isSymbol-BO6cdPI7.js";import{A as h,B as se,C as g,D as ce,E as le,M as ue,O as _,b as v,d as de,g as fe,j as y,k as pe,l as b,m as x,o as me,p as S,s as he,w as C,y as ge}from"./external-CEp-aPkt.js";import{i as _e,n as w,r as T,t as E}from"./lazySchema-B4D4qJVE.js";import{$r as ve,Di as ye,Ei as be,Jr as xe,Kr as Se,Lt as Ce,M as we,Mi as Te,N as Ee,Ni as De,Qr as Oe,Tr as ke,Wt as Ae,Xr as je,Yr as Me,Zr as Ne,_r as Pe,bi as Fe,ci as Ie,di as Le,ei as Re,et as ze,fr as Be,gr as Ve,hr as He,li as Ue,mr as We,oi as Ge,pr as Ke,qr as qe,si as Je,ti as Ye,ui as Xe,v as Ze,vr as Qe,wr as $e,xi as et,xr as tt,yr as nt}from"./state-BemZdQIl.js";import{n as rt,t as it}from"./cwd-Cfdf7z7s.js";import{B as at,C as ot,F as st,R as ct,S as lt,V as ut,b as dt,c as D,f as O,g as ft,i as pt,u as k,x as mt}from"./debug-BecbSVoN.js";import{O as ht,k as gt,m as _t,t as vt}from"./git-DBlOv64X.js";import{n as yt,r as bt}from"./execFileNoThrow-DHyW8FMX.js";import{o as xt,s as A}from"./log-Dauqle-Z.js";import{n as St,t as Ct}from"./which-BRWBO7Gu.js";import{i as j,o as wt}from"./platform-B0uTQc9P.js";import{a as Tt,i as Et}from"./windowsPaths-DtWHLjmE.js";import{l as Dt}from"./sessionStoragePortable-JZnGwqUM.js";import{a as Ot,f as kt,p as At,r as jt,s as Mt,u as M}from"./types-DafcFtmb.js";import{n as Nt,r as Pt}from"./analytics-DJobLaWP.js";import{n as Ft,r as It}from"./startupProfiler-CmH_aVy2.js";import{c as Lt,u as Rt}from"./oauth-C9VBDB0Y.js";import{r as zt,t as Bt}from"./bundledMode--fG1S62b.js";import{f as Vt,l as Ht,n as Ut,o as Wt,p as Gt}from"./stringUtils-C8PaYpQF.js";import{homedir as Kt,userInfo as qt}from"os";import{basename as Jt,dirname as N,extname as Yt,isAbsolute as Xt,join as P,normalize as Zt,posix as Qt,relative as $t,resolve as F,sep as en}from"path";import{chmodSync as tn,existsSync as nn,writeFileSync as rn}from"fs";import{appendFile as an,mkdir as on,readFile as sn,realpath as cn,stat as ln,writeFile as un}from"fs/promises";import{execFile as dn}from"child_process";var I,fn=e((()=>{c(),I=function(){try{var e=s(Object,`defineProperty`);return e({},``,{}),e}catch{}}()}));function pn(e,t,n){t==`__proto__`&&I?I(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n}var mn=e((()=>{fn()}));function hn(e,t,n){var r=e[t];(!(gn.call(e,t)&&te(r,n))||n===void 0&&!(t in e))&&pn(e,t,n)}var gn,_n=e((()=>{mn(),f(),gn=Object.prototype.hasOwnProperty}));function vn(e,t,n,r){var i=!n;n||(n={});for(var a=-1,o=t.length;++a<o;){var s=t[a],c=r?r(n[s],e[s],s,n,e):void 0;c===void 0&&(c=e[s]),i?pn(n,s,c):hn(n,s,c)}return n}var yn=e((()=>{_n(),mn()}));function bn(e){var t=[];if(e!=null)for(var n in Object(e))t.push(n);return t}var xn=e((()=>{}));function Sn(e){if(!r(e))return bn(e);var t=Ne(e),n=[];for(var i in e)i==`constructor`&&(t||!Cn.call(e,i))||n.push(i);return n}var Cn,wn=e((()=>{o(),je(),xn(),Cn=Object.prototype.hasOwnProperty}));function Tn(e){return qe(e)?Oe(e,!0):Sn(e)}var En=e((()=>{ve(),wn(),Se()}));function Dn(e,t){if(t)return e.slice();var n=e.length,r=jn?jn(n):new e.constructor(n);return e.copy(r),r}var On,kn,An,jn,Mn=e((()=>{a(),On=typeof exports==`object`&&exports&&!exports.nodeType&&exports,kn=On&&typeof module==`object`&&module&&!module.nodeType&&module,An=kn&&kn.exports===On?t.Buffer:void 0,jn=An?An.allocUnsafe:void 0}));function Nn(e,t){var n=-1,r=e.length;for(t||(t=Array(r));++n<r;)t[n]=e[n];return t}var Pn=e((()=>{})),Fn,In=e((()=>{xe(),Fn=Me(Object.getPrototypeOf,Object)}));function Ln(e){var t=new e.constructor(e.byteLength);return new be(t).set(new be(e)),t}var Rn=e((()=>{ye()}));function zn(e,t){var n=t?Ln(e.buffer):e.buffer;return new e.constructor(n,e.byteOffset,e.length)}var Bn=e((()=>{Rn()})),Vn,Hn,Un=e((()=>{o(),Vn=Object.create,Hn=function(){function e(){}return function(t){if(!r(t))return{};if(Vn)return Vn(t);e.prototype=t;var n=new e;return e.prototype=void 0,n}}()}));function Wn(e){return typeof e.constructor==`function`&&!Ne(e)?Hn(Fn(e)):{}}var Gn=e((()=>{Un(),In(),je()}));function Kn(e,t){let n=t??it()??k().cwd();if(typeof e!=`string`)throw TypeError(`Path must be a string, received ${typeof e}`);if(typeof n!=`string`)throw TypeError(`Base directory must be a string, received ${typeof n}`);if(e.includes(`\0`)||n.includes(`\0`))throw Error(`Path contains null bytes`);let r=e=>e.includes(`/`)&&!e.includes(`\\`)&&!/^[A-Za-z]:/.test(e),i=e.trim();if(!i)return j()===`windows`&&r(n)?Qt.normalize(n).normalize(`NFC`):Zt(n).normalize(`NFC`);if(i===`~`)return Kt().normalize(`NFC`);if(i.startsWith(`~/`))return P(Kt(),i.slice(2)).normalize(`NFC`);let a=i;if(j()===`windows`&&i.match(/^\/[a-z]\//i))try{a=Tt(i)}catch{a=i}return Xt(a)?j()===`windows`&&r(a)?Qt.normalize(a).normalize(`NFC`):Zt(a).normalize(`NFC`):j()===`windows`&&r(n)&&!/^[A-Za-z]:/.test(a)&&!a.startsWith(`\\\\`)?Qt.resolve(n,a).normalize(`NFC`):F(n,a).normalize(`NFC`)}function qn(e){let t=$t(it(),e);return t.startsWith(`..`)?e:t}function Jn(e){let t=Kn(e);if(t.startsWith(`\\\\`)||t.startsWith(`//`))return N(t);try{if(k().statSync(t).isDirectory())return t}catch{}return N(t)}function Yn(e){return/(?:^|[\\/])\.\.(?:[\\/]|$)/.test(e)}function Xn(e){return Zt(e).replace(/\\/g,`/`)}var Zn=e((()=>{rt(),O(),wt(),Et(),Dt()}));function Qn(e,t,n){(n!==void 0&&!te(e[t],n)||n===void 0&&!(t in e))&&pn(e,t,n)}var $n=e((()=>{mn(),f()}));function er(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}var tr=e((()=>{})),nr,rr=e((()=>{tr(),nr=er()}));function ir(e){return ae(e)&&qe(e)}var ar=e((()=>{Se(),oe()}));function or(e){if(!ae(e)||i(e)!=sr)return!1;var t=Fn(e);if(t===null)return!0;var n=dr.call(t,`constructor`)&&t.constructor;return typeof n==`function`&&n instanceof n&&ur.call(n)==fr}var sr,cr,lr,ur,dr,fr,pr=e((()=>{n(),In(),oe(),sr=`[object Object]`,cr=Function.prototype,lr=Object.prototype,ur=cr.toString,dr=lr.hasOwnProperty,fr=ur.call(Object)}));function mr(e,t){if(!(t===`constructor`&&typeof e[t]==`function`)&&t!=`__proto__`)return e[t]}var hr=e((()=>{}));function gr(e){return vn(e,Tn(e))}var _r=e((()=>{yn(),En()}));function vr(e,t,n,i,a,o,s){var c=mr(e,n),l=mr(t,n),te=s.get(l);if(te){Qn(e,n,te);return}var u=o?o(c,l,n+``,e,t,s):void 0,d=u===void 0;if(d){var f=et(l),p=!f&&Ue(l),m=!f&&!p&&Ye(l);u=l,f||p||m?et(c)?u=c:ir(c)?u=Nn(c):p?(d=!1,u=Dn(l,!0)):m?(d=!1,u=zn(l,!0)):u=[]:or(l)||Le(l)?(u=c,Le(c)?u=gr(c):(!r(c)||ee(c))&&(u=Wn(l))):d=!1}d&&(s.set(l,u),a(u,l,i,o,s),s.delete(l)),Qn(e,n,u)}var yr=e((()=>{$n(),Mn(),Bn(),Pn(),Gn(),Xe(),Fe(),ar(),Ie(),l(),o(),pr(),Re(),hr(),_r()}));function br(e,t,n,i,a){e!==t&&nr(t,function(o,s){if(a||(a=new Te),r(o))vr(e,t,s,n,br,i,a);else{var c=i?i(mr(e,s),o,s+``,e,t,a):void 0;c===void 0&&(c=o),Qn(e,s,c)}},Tn)}var xr=e((()=>{De(),$n(),rr(),yr(),o(),En(),hr()}));function Sr(e,t,n){switch(n.length){case 0:return e.call(t);case 1:return e.call(t,n[0]);case 2:return e.call(t,n[0],n[1]);case 3:return e.call(t,n[0],n[1],n[2])}return e.apply(t,n)}var Cr=e((()=>{}));function wr(e,t,n){return t=Tr(t===void 0?e.length-1:t,0),function(){for(var r=arguments,i=-1,a=Tr(r.length-t,0),o=Array(a);++i<a;)o[i]=r[t+i];i=-1;for(var s=Array(t+1);++i<t;)s[i]=r[i];return s[t]=n(o),Sr(e,this,s)}}var Tr,Er=e((()=>{Cr(),Tr=Math.max}));function Dr(e){return function(){return e}}var Or=e((()=>{})),kr,Ar=e((()=>{Or(),fn(),ke(),kr=I?function(e,t){return I(e,`toString`,{configurable:!0,enumerable:!1,value:Dr(t),writable:!0})}:$e}));function jr(e){var t=0,n=0;return function(){var r=Pr(),i=Nr-(r-n);if(n=r,i>0){if(++t>=Mr)return arguments[0]}else t=0;return e.apply(void 0,arguments)}}var Mr,Nr,Pr,Fr=e((()=>{Mr=800,Nr=16,Pr=Date.now})),Ir,Lr=e((()=>{Ar(),Fr(),Ir=jr(kr)}));function Rr(e,t){return Ir(wr(e,t,$e),e+``)}var zr=e((()=>{ke(),Er(),Lr()}));function Br(e,t,n){if(!r(n))return!1;var i=typeof t;return(i==`number`?qe(n)&&Je(t,n.length):i==`string`&&t in n)?te(n[t],e):!1}var Vr=e((()=>{f(),Se(),Ge(),o()}));function Hr(e){return Rr(function(t,n){var r=-1,i=n.length,a=i>1?n[i-1]:void 0,o=i>2?n[2]:void 0;for(a=e.length>3&&typeof a==`function`?(i--,a):void 0,o&&Br(n[0],n[1],o)&&(a=i<3?void 0:a,i=1),t=Object(t);++r<i;){var s=n[r];s&&e(t,s,r,a)}return t})}var Ur=e((()=>{zr(),Vr()})),L,Wr=e((()=>{xr(),Ur(),L=Hr(function(e,t,n,r){br(e,t,n,r)})}));function Gr(e){let{buffer:t,bytesRead:n}=k().readSync(e,{length:4096});return n===0?`utf8`:n>=2&&t[0]===255&&t[1]===254?`utf16le`:(n>=3&&t[0]===239&&t[1]===187&&t[2],`utf8`)}function Kr(e){let t=0,n=0;for(let r=0;r<e.length;r++)e[r]===`
2
- `&&(r>0&&e[r-1]===`\r`?t++:n++);return t>n?`CRLF`:`LF`}function qr(e){let t=k(),{resolvedPath:n,isSymlink:r}=ft(t,e);r&&D(`Reading through symlink: ${e} -> ${n}`);let i=Gr(n),a=t.readFileSync(n,{encoding:i}),o=Kr(a.slice(0,4096));return{content:a.replaceAll(`\r
3
- `,`
4
- `),encoding:i,lineEndings:o}}function R(e){return qr(e).content}var Jr=e((()=>{pt(),O()}));function Yr(e){z=e}function Xr(){z=null,ni=void 0}function Zr(e){return ni=e,e}function Qr(){return P(m(),ti)}function $r(){try{let e=lt(At(R(Qr())));return!e||typeof e!=`object`||Array.isArray(e)?null:e}catch{return null}}function ei(){if(ni!==!0)return null;if(z)return z;let e=$r();return e?(z=e,Pe(),e):null}var ti,z,ni,ri=e((()=>{ne(),Jr(),kt(),Ve(),mt(),ti=`remote-settings.json`,z=null}));function ii(e,t){return e.flatMap((e,n)=>n?[t(n),e]:[e])}function ai(e,t){let n=0;for(let r of e)n+=+!!t(r);return n}function oi(e){return[...new Set(e)]}var si=e((()=>{})),ci,li,ui=e((()=>{Pi(),O(),re(),ci=class{constructor(){ie(this,`cache`,new Map),ie(this,`maxCacheSize`,1e3)}readFile(e){let t=k(),n;try{n=t.statSync(e)}catch(t){throw this.cache.delete(e),t}let r=e,i=this.cache.get(r);if(i&&i.mtime===n.mtimeMs)return{content:i.content,encoding:i.encoding};let a=gi(e),o=t.readFileSync(e,{encoding:a}).replaceAll(`\r
5
- `,`
6
- `);if(this.cache.set(r,{content:o,encoding:a,mtime:n.mtimeMs}),this.cache.size>this.maxCacheSize){let e=this.cache.keys().next().value;e&&this.cache.delete(e)}return{content:o,encoding:a}}clear(){this.cache.clear()}invalidate(e){this.cache.delete(e)}getStats(){return{size:this.cache.size,entries:Array.from(this.cache.keys())}}},li=new ci}));async function di(e){try{return await ln(e),!0}catch{return!1}}function fi(e){try{return k().readFileSync(e,{encoding:`utf8`})}catch(e){return A(e),null}}function pi(e){let t=k();return Math.floor(t.statSync(e).mtimeMs)}async function mi(e){let t=await k().stat(e);return Math.floor(t.mtimeMs)}function hi(e,t,n,r){let i=t;r===`CRLF`&&(i=t.replaceAll(`\r
7
- `,`
8
- `).split(`
9
- `).join(`\r
10
- `)),Oi(e,i,{encoding:n})}function gi(e){try{let{resolvedPath:t}=ft(k(),e);return Gr(t)}catch(e){return ut(e)?D(`detectFileEncoding failed for expected reason: ${e.code}`,{level:`debug`}):A(e),`utf8`}}function _i(e,t=`utf8`){try{let n=k(),{resolvedPath:r}=ft(n,e),{buffer:i,bytesRead:a}=n.readSync(r,{length:4096});return Kr(i.toString(t,0,a))}catch(e){return A(e),`LF`}}function vi(e){return e.includes(` `)?e.replace(/^\t+/gm,e=>` `.repeat(e.length)):e}function yi(e){let t=e?Kn(e):void 0;return{absolutePath:t,relativePath:t?$t(it(),t):void 0}}function bi(e){let{relativePath:t}=yi(e);if(t&&!t.startsWith(`..`))return t;let n=Kt();return e.startsWith(n+en)?`~`+e.slice(n.length):e}function xi(e){let t=k();try{let n=N(e),r=Jt(e,Yt(e)),i=t.readdirSync(n).filter(t=>Jt(t.name,Yt(t.name))===r&&P(n,t.name)!==e)[0];return i?i.name:void 0}catch(e){at(e)||A(e);return}}async function Si(e){let t=it(),n=N(t),r=e;try{r=P(await cn(N(e)),Jt(e))}catch{}let i=n===en?en:n+en;if(!r.startsWith(i)||r.startsWith(t+en)||r===t)return;let a=P(t,$t(n,r));try{return await ln(a),a}catch{return}}function Ci(){return!0}function wi({content:e,startLine:t}){if(!e)return``;let n=e.split(/\r?\n/);return Ci()?n.map((e,n)=>`${n+t}\t${e}`).join(`
11
- `):n.map((e,n)=>{let r=String(n+t);return r.length>=6?`${r}→${e}`:`${r.padStart(6,` `)}→${e}`}).join(`
12
- `)}function Ti(e){return e.match(/^\s*\d+[\u2192\t](.*)$/)?.[1]??e}function Ei(e){try{return k().isDirEmptySync(e)}catch(e){return at(e)}}function Di(e){let{content:t}=li.readFile(e);return t}function Oi(e,t,n={encoding:`utf-8`}){let r=k(),i=e;try{let t=r.readlinkSync(e);i=Xt(t)?t:F(N(e),t),D(`Writing through symlink: ${e} -> ${i}`)}catch{}let a=`${i}.tmp.${process.pid}.${Date.now()}`,o,s=!1;try{o=r.statSync(i).mode,s=!0,D(`Preserving file permissions: ${o.toString(8)}`)}catch(e){if(!at(e))throw e;n.mode!==void 0&&(o=n.mode,D(`Setting permissions for new file: ${o.toString(8)}`))}try{D(`Writing to temp file: ${a}`);let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),rn(a,t,e),D(`Temp file written successfully, size: ${t.length} bytes`),s&&o!==void 0&&(tn(a,o),D(`Applied original permissions to temp file`)),D(`Renaming ${a} to ${i}`),r.renameSync(a,i),D(`File ${i} written atomically`)}catch(e){D(`Failed to write file atomically: ${e}`,{level:`error`}),Pt(`tengu_atomic_write_error`,{});try{D(`Cleaning up temp file: ${a}`),r.unlinkSync(a)}catch(e){D(`Failed to clean up temp file: ${e}`)}D(`Falling back to non-atomic write for ${i}`);try{let e={encoding:n.encoding,flush:!0};!s&&n.mode!==void 0&&(e.mode=n.mode),rn(i,t,e),D(`File ${i} written successfully with non-atomic fallback`)}catch(e){throw D(`Non-atomic write also failed: ${e}`),e}}}function ki(e,t=Mi){try{return k().statSync(e).size<=t}catch{return!1}}function Ai(e){let t=Zt(e);return t=t.replace(/\\/g,`/`),j()===`windows`&&(t=t.toLowerCase()),t}function ji(e,t){return Ai(e)===Ai(t)}var Mi,Ni,Pi=e((()=>{Nt(),rt(),pt(),ct(),Jr(),ui(),O(),xt(),Zn(),wt(),Mi=.25*1024*1024,Ni=`Note: your current working directory is`}));async function Fi(e,t){let{code:n}=await yt(`git`,[`check-ignore`,e],{preserveOutputOnError:!1,cwd:t});return n===0}function Ii(){return P(Kt(),`.config`,`git`,`ignore`)}async function Li(e,t=it()){try{if(!await vt(t))return;let n=`**/${e}`;if(await Fi(e.endsWith(`/`)?`${e}sample-file.txt`:e,t))return;let r=Ii();await on(N(r),{recursive:!0});try{if((await sn(r,{encoding:`utf-8`})).includes(n))return;await an(r,`\n${n}\n`)}catch(e){if(st(e)===`ENOENT`)await un(r,`${n}\n`,`utf-8`);else throw e}}catch(e){A(e)}}var Ri=e((()=>{rt(),ct(),bt(),_t(),xt()}));function zi(e){switch(e){case`userSettings`:return`user`;case`projectSettings`:return`project`;case`localSettings`:return`project, gitignored`;case`flagSettings`:return`cli flag`;case`policySettings`:return`managed`}}function Bi(e){switch(e){case`userSettings`:return`User`;case`projectSettings`:return`Project`;case`localSettings`:return`Local`;case`flagSettings`:return`Flag`;case`policySettings`:return`Managed`;case`plugin`:return`Plugin`;case`built-in`:return`Built-in`}}function Vi(e){switch(e){case`userSettings`:return`user settings`;case`projectSettings`:return`shared project settings`;case`localSettings`:return`project local settings`;case`flagSettings`:return`command line arguments`;case`policySettings`:return`enterprise managed settings`;case`cliArg`:return`CLI argument`;case`command`:return`command configuration`;case`session`:return`current session`}}function Hi(e){switch(e){case`userSettings`:return`User settings`;case`projectSettings`:return`Shared project settings`;case`localSettings`:return`Project local settings`;case`flagSettings`:return`Command line arguments`;case`policySettings`:return`Enterprise managed settings`;case`cliArg`:return`CLI argument`;case`command`:return`Command configuration`;case`session`:return`Current session`}}function Ui(e){if(e===``)return[];let t=e.split(`,`).map(e=>e.trim()),n=[];for(let e of t)switch(e){case`user`:n.push(`userSettings`);break;case`project`:n.push(`projectSettings`);break;case`local`:n.push(`localSettings`);break;default:throw Error(`Invalid setting source: ${e}. Valid options are: user, project, local`)}return n}function Wi(){let e=Ze(),t=new Set(e);return t.add(`policySettings`),t.add(`flagSettings`),Array.from(t)}function Gi(e){return Wi().includes(e)}var Ki,qi,Ji,Yi=e((()=>{Ae(),Ki=[`userSettings`,`projectSettings`,`localSettings`,`flagSettings`,`policySettings`],qi=[`localSettings`,`projectSettings`,`userSettings`],Ji=`https://json.schemastore.org/claude-code-settings.json`}));function Xi(e){$i.set(e,Date.now())}function Zi(e,t){let n=$i.get(e);return n!==void 0&&Date.now()-n<t?($i.delete(e),!0):!1}function Qi(){$i.clear()}var $i,ea=e((()=>{$i=new Map})),ta,na,ra=e((()=>{d(),wt(),ta=u(function(){switch(j()){case`macos`:return`/Library/Application Support/ClaudeCode`;case`windows`:return`C:\\Program Files\\ClaudeCode`;default:return`/etc/claude-code`}}),na=u(function(){return P(ta(),`managed-settings.d`)})})),ia,aa,oa,sa=e((()=>{T(),E(),ia=w(()=>C({allowedDomains:S(h()).optional(),allowManagedDomainsOnly:x().optional().describe(`When true (and set in managed settings), only allowedDomains and WebFetch(domain:...) allow rules from managed settings are respected. User, project, local, and flag settings domains are ignored. Denied domains are still respected from all sources.`),allowUnixSockets:S(h()).optional().describe(`macOS only: Unix socket paths to allow. Ignored on Linux (seccomp cannot filter by path).`),allowAllUnixSockets:x().optional().describe(`If true, allow all Unix sockets (disables blocking on both platforms).`),allowLocalBinding:x().optional(),httpProxyPort:g().optional(),socksProxyPort:g().optional()}).optional()),aa=w(()=>C({allowWrite:S(h()).optional().describe(`Additional paths to allow writing within the sandbox. Merged with paths from Edit(...) allow permission rules.`),denyWrite:S(h()).optional().describe(`Additional paths to deny writing within the sandbox. Merged with paths from Edit(...) deny permission rules.`),denyRead:S(h()).optional().describe(`Additional paths to deny reading within the sandbox. Merged with paths from Read(...) deny permission rules.`),allowRead:S(h()).optional().describe(`Paths to re-allow reading within denyRead regions. Takes precedence over denyRead for matching paths.`),allowManagedReadPathsOnly:x().optional().describe(`When true (set in managed settings), only allowRead paths from policySettings are used.`)}).optional()),oa=w(()=>C({enabled:x().optional(),failIfUnavailable:x().optional().describe(`Exit with an error at startup if sandbox.enabled is true but the sandbox cannot start (missing dependencies, unsupported platform, or platform not in enabledPlatforms). When false (default), a warning is shown and commands run unsandboxed. Intended for managed-settings deployments that require sandboxing as a hard gate.`),autoAllowBashIfSandboxed:x().optional(),allowUnsandboxedCommands:x().optional().describe(`Allow commands to run outside the sandbox via the dangerouslyDisableSandbox parameter. When false, the dangerouslyDisableSandbox parameter is completely ignored and all commands must run sandboxed. Default: true.`),network:ia(),filesystem:aa(),ignoreViolations:_(h(),S(h())).optional(),enableWeakerNestedSandbox:x().optional(),enableWeakerNetworkIsolation:x().optional().describe(`macOS only: Allow access to com.apple.trustd.agent in the sandbox. Needed for Go-based CLI tools (gh, gcloud, terraform, etc.) to verify TLS certificates when using httpProxyPort with a MITM proxy and custom CA. **Reduces security** — opens a potential data exfiltration vector through the trustd service. Default: false`),excludedCommands:S(h()).optional(),ripgrep:C({command:h(),args:S(h()).optional()}).optional().describe(`Custom ripgrep configuration for bundled ripgrep support`)}).passthrough())}));async function B(e){try{return!!await St(e)}catch{return!1}}function ca(){return process.env.__CFBundleIdentifier===`com.conductor.app`}function la(){if(process.env.CURSOR_TRACE_ID||process.env.VSCODE_GIT_ASKPASS_MAIN?.includes(`cursor`))return`cursor`;if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes(`windsurf`))return`windsurf`;if(process.env.VSCODE_GIT_ASKPASS_MAIN?.includes(`antigravity`))return`antigravity`;let e=process.env.__CFBundleIdentifier?.toLowerCase();if(e?.includes(`vscodium`))return`codium`;if(e?.includes(`windsurf`))return`windsurf`;if(e?.includes(`com.google.android.studio`))return`androidstudio`;if(e){for(let t of va)if(e.includes(t))return t}if(process.env.VisualStudioVersion)return`visualstudio`;if(process.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`)return process.platform,`pycharm`;if(process.env.TERM===`xterm-ghostty`)return`ghostty`;if(process.env.TERM?.includes(`kitty`))return`kitty`;if(process.env.TERM_PROGRAM)return process.env.TERM_PROGRAM;if(process.env.TMUX)return`tmux`;if(process.env.STY)return`screen`;if(process.env.KONSOLE_VERSION)return`konsole`;if(process.env.GNOME_TERMINAL_SERVICE)return`gnome-terminal`;if(process.env.XTERM_VERSION)return`xterm`;if(process.env.VTE_VERSION)return`vte-based`;if(process.env.TERMINATOR_UUID)return`terminator`;if(process.env.KITTY_WINDOW_ID)return`kitty`;if(process.env.ALACRITTY_LOG)return`alacritty`;if(process.env.TILIX_ID)return`tilix`;if(process.env.WT_SESSION)return`windows-terminal`;if(process.env.SESSIONNAME&&process.env.TERM===`cygwin`)return`cygwin`;if(process.env.MSYSTEM)return process.env.MSYSTEM.toLowerCase();if(process.env.ConEmuANSI||process.env.ConEmuPID||process.env.ConEmuTask)return`conemu`;if(process.env.WSL_DISTRO_NAME)return`wsl-${process.env.WSL_DISTRO_NAME}`;if(ua())return`ssh-session`;if(process.env.TERM){let e=process.env.TERM;return e.includes(`alacritty`)?`alacritty`:e.includes(`rxvt`)?`rxvt`:e.includes(`termite`)?`termite`:process.env.TERM}return process.stdout.isTTY?null:`non-interactive`}function ua(){return!!(process.env.SSH_CONNECTION||process.env.SSH_CLIENT||process.env.SSH_TTY)}function da(){let e=process.env.CLAUDE_CODE_HOST_PLATFORM;return e===`win32`||e===`darwin`||e===`linux`?e:V.platform}var fa,pa,ma,ha,ga,_a,va,ya,V,ba=e((()=>{d(),Rt(),Bt(),ne(),Gt(),O(),Ct(),fa=u(()=>{if(k().existsSync(P(m(),`.config.json`)))return P(m(),`.config.json`);let e=`.claude${Lt()}.json`;return P(process.env.CLAUDE_CONFIG_DIR||Kt(),e)}),pa=u(async()=>{try{let{default:e}=await import(`./axios-BHBm_hhU.js`);return await e.head(`http://1.1.1.1`,{signal:AbortSignal.timeout(1e3)}),!0}catch{return!1}}),ma=u(async()=>{let e=[];return await B(`npm`)&&e.push(`npm`),await B(`yarn`)&&e.push(`yarn`),await B(`pnpm`)&&e.push(`pnpm`),e}),ha=u(async()=>{let e=[];return await B(`bun`)&&e.push(`bun`),await B(`deno`)&&e.push(`deno`),await B(`node`)&&e.push(`node`),e}),ga=u(()=>{try{return k().existsSync(`/proc/sys/fs/binfmt_misc/WSLInterop`)}catch{return!1}}),_a=u(()=>{try{if(!ga())return!1;let{cmd:e}=Vt(`npm`,[]);return e.startsWith(`/mnt/c/`)}catch{return!1}}),va=[`pycharm`,`intellij`,`webstorm`,`phpstorm`,`rubymine`,`clion`,`goland`,`rider`,`datagrip`,`appcode`,`dataspell`,`aqua`,`gateway`,`fleet`,`jetbrains`,`androidstudio`],ya=u(()=>{if(p(process.env.CODESPACES))return`codespaces`;if(process.env.GITPOD_WORKSPACE_ID)return`gitpod`;if(process.env.REPL_ID||process.env.REPL_SLUG)return`replit`;if(process.env.PROJECT_DOMAIN)return`glitch`;if(p(process.env.VERCEL))return`vercel`;if(process.env.RAILWAY_ENVIRONMENT_NAME||process.env.RAILWAY_SERVICE_NAME)return`railway`;if(p(process.env.RENDER))return`render`;if(p(process.env.NETLIFY))return`netlify`;if(process.env.DYNO)return`heroku`;if(process.env.FLY_APP_NAME||process.env.FLY_MACHINE_ID)return`fly.io`;if(p(process.env.CF_PAGES))return`cloudflare-pages`;if(process.env.DENO_DEPLOYMENT_ID)return`deno-deploy`;if(process.env.AWS_LAMBDA_FUNCTION_NAME)return`aws-lambda`;if(process.env.AWS_EXECUTION_ENV===`AWS_ECS_FARGATE`)return`aws-fargate`;if(process.env.AWS_EXECUTION_ENV===`AWS_ECS_EC2`)return`aws-ecs`;try{if(k().readFileSync(`/sys/hypervisor/uuid`,{encoding:`utf8`}).trim().toLowerCase().startsWith(`ec2`))return`aws-ec2`}catch{}if(process.env.K_SERVICE)return`gcp-cloud-run`;if(process.env.GOOGLE_CLOUD_PROJECT)return`gcp`;if(process.env.WEBSITE_SITE_NAME||process.env.WEBSITE_SKU)return`azure-app-service`;if(process.env.AZURE_FUNCTIONS_ENVIRONMENT)return`azure-functions`;if(process.env.APP_URL?.includes(`ondigitalocean.app`))return`digitalocean-app-platform`;if(process.env.SPACE_CREATOR_USER_ID)return`huggingface-spaces`;if(p(process.env.GITHUB_ACTIONS))return`github-actions`;if(p(process.env.GITLAB_CI))return`gitlab-ci`;if(process.env.CIRCLECI)return`circleci`;if(process.env.BUILDKITE)return`buildkite`;if(p(process.env.CI))return`ci`;if(process.env.KUBERNETES_SERVICE_HOST)return`kubernetes`;try{if(k().existsSync(`/.dockerenv`))return`docker`}catch{}return V.platform===`darwin`?`unknown-darwin`:V.platform===`linux`?`unknown-linux`:V.platform===`win32`?`unknown-win32`:`unknown`}),V={hasInternetAccess:pa,isCI:p(process.env.CI),platform:[`win32`,`darwin`].includes(process.platform)?process.platform:`linux`,arch:process.arch,nodeVersion:process.version,terminal:la(),isSSH:ua,getPackageManagers:ma,getRuntimes:ha,isRunningWithBun:u(zt),isWslEnvironment:ga,isNpmFromWindowsPath:_a,isConductor:ca,detectDeploymentEnvironment:ya}})),xa,Sa,Ca=e((()=>{ba(),xa=V.platform===`darwin`?`⏺`:`●`,Sa=`·✔︎·`})),wa,Ta,Ea,Da=e((()=>{wa=[`acceptEdits`,`bypassPermissions`,`default`,`dontAsk`,`plan`],Ta=[...wa,`auto`],Ea=Ta}));function Oa(e){return!0}function ka(e){return Ra[e]??Ra.default}function Aa(e){return ka(e).external}function ja(e){return Ea.includes(e)?e:`default`}function Ma(e){return ka(e).title}function Na(e){return e==="default"||e===void 0}function Pa(e){return ka(e).shortTitle}function Fa(e){return ka(e).symbol}function Ia(e){return ka(e).color}var La,Ra,za=e((()=>{T(),Ca(),Da(),E(),w(()=>_e.enum(Ea)),La=w(()=>_e.enum(wa)),Ra={default:{title:`Default`,shortTitle:`Default`,symbol:``,color:`text`,external:`default`},plan:{title:`Plan Mode`,shortTitle:`Plan`,symbol:`⏸`,color:`planMode`,external:`plan`},acceptEdits:{title:`Accept edits`,shortTitle:`Accept`,symbol:`⏵⏵`,color:`autoAccept`,external:`acceptEdits`},bypassPermissions:{title:`Bypass`,shortTitle:`Bypass`,symbol:`⏵⏵`,color:`error`,external:`bypassPermissions`},dontAsk:{title:`Don't Ask`,shortTitle:`DontAsk`,symbol:`⏵⏵`,color:`error`,external:`dontAsk`},auto:{title:`Auto`,shortTitle:`Auto`,symbol:`⏵⏵`,color:`warning`,external:`default`}}})),Ba=e((()=>{})),Va,Ha=e((()=>{Ba(),Va=`PreToolUse.PostToolUse.PostToolUseFailure.Notification.UserPromptSubmit.SessionStart.SessionEnd.Stop.StopFailure.SubagentStart.SubagentStop.PreCompact.PostCompact.PermissionRequest.PermissionDenied.Setup.TeammateIdle.TaskCreated.TaskCompleted.Elicitation.ElicitationResult.ConfigChange.WorktreeCreate.WorktreeRemove.InstructionsLoaded.CwdChanged.FileChanged`.split(`.`)})),Ua=e((()=>{})),Wa=e((()=>{})),Ga=e((()=>{Ha(),Ua(),Wa()})),Ka,qa,Ja=e((()=>{Ka=[`bash`,`powershell`],qa=`bash`}));function Ya(){return{BashCommandHookSchema:C({type:v(`command`).describe(`Shell command hook type`),command:h().describe(`Shell command to execute`),if:Xa(),shell:b(Ka).optional().describe(`Shell interpreter. 'bash' uses your $SHELL (bash/zsh/sh); 'powershell' uses pwsh. Defaults to bash.`),timeout:g().positive().optional().describe(`Timeout in seconds for this specific command`),statusMessage:h().optional().describe(`Custom status message to display in spinner while hook runs`),once:x().optional().describe(`If true, hook runs once and is removed after execution`),async:x().optional().describe(`If true, hook runs in background without blocking`),asyncRewake:x().optional().describe(`If true, hook runs in background and wakes the model on exit code 2 (blocking error). Implies async.`)}),PromptHookSchema:C({type:v(`prompt`).describe(`LLM prompt hook type`),prompt:h().describe(`Prompt to evaluate with LLM. Use $ARGUMENTS placeholder for hook input JSON.`),if:Xa(),timeout:g().positive().optional().describe(`Timeout in seconds for this specific prompt evaluation`),model:h().optional().describe(`Model to use for this prompt hook (e.g., "claude-sonnet-4-6"). If not specified, uses the default small fast model.`),statusMessage:h().optional().describe(`Custom status message to display in spinner while hook runs`),once:x().optional().describe(`If true, hook runs once and is removed after execution`)}),HttpHookSchema:C({type:v(`http`).describe(`HTTP hook type`),url:h().url().describe(`URL to POST the hook input JSON to`),if:Xa(),timeout:g().positive().optional().describe(`Timeout in seconds for this specific request`),headers:_(h(),h()).optional().describe('Additional headers to include in the request. Values may reference environment variables using $VAR_NAME or ${VAR_NAME} syntax (e.g., "Authorization": "Bearer $MY_TOKEN"). Only variables listed in allowedEnvVars will be interpolated.'),allowedEnvVars:S(h()).optional().describe(`Explicit list of environment variable names that may be interpolated in header values. Only variables listed here will be resolved; all other $VAR references are left as empty strings. Required for env var interpolation to work.`),statusMessage:h().optional().describe(`Custom status message to display in spinner while hook runs`),once:x().optional().describe(`If true, hook runs once and is removed after execution`)}),AgentHookSchema:C({type:v(`agent`).describe(`Agentic verifier hook type`),prompt:h().describe(`Prompt describing what to verify (e.g. "Verify that unit tests ran and passed."). Use $ARGUMENTS placeholder for hook input JSON.`),if:Xa(),timeout:g().positive().optional().describe(`Timeout in seconds for agent execution (default 60)`),model:h().optional().describe(`Model to use for this agent hook (e.g., "claude-sonnet-4-6"). If not specified, uses Haiku.`),statusMessage:h().optional().describe(`Custom status message to display in spinner while hook runs`),once:x().optional().describe(`If true, hook runs once and is removed after execution`)})}}var Xa,Za,Qa,H,$a=e((()=>{Ga(),T(),E(),Ja(),Xa=w(()=>h().optional().describe(`Permission rule syntax to filter when this hook runs (e.g., "Bash(git *)"). Only runs if the tool call matches the pattern. Avoids spawning hooks for non-matching commands.`)),Za=w(()=>{let{BashCommandHookSchema:e,PromptHookSchema:t,AgentHookSchema:n,HttpHookSchema:r}=Ya();return fe(`type`,[e,t,n,r])}),Qa=w(()=>C({matcher:h().optional().describe(`String pattern to match (e.g. tool names like "Write")`),hooks:S(Za()).describe(`List of hooks to execute when the matcher matches`)})),H=w(()=>le(b(Va),S(Qa())))}));function eo(e,t){let n=e.toLowerCase();return t.autoUpdate??(U.has(n)&&!ao.has(n))}function to(e){return U.has(e.toLowerCase())?!1:so.test(e)?!0:oo.test(e)}function no(e,t){let n=e.toLowerCase();if(!U.has(n))return null;if(t.source===`github`)return(t.repo||``).toLowerCase().startsWith(`anthropics/`)?null:`The name '${e}' is reserved for official marketplaces. Only repositories from 'github.com/${co}/' can use this name.`;if(t.source===`git`&&t.url){let n=t.url.toLowerCase(),r=n.includes(`github.com/anthropics/`),i=n.includes(`git@github.com:anthropics/`);return r||i?null:`The name '${e}' is reserved for official marketplaces. Only repositories from 'github.com/${co}/' can use this name.`}return`The name '${e}' is reserved for official marketplaces and can only be used with GitHub sources from the '${co}' organization.`}function ro(e){return typeof e==`string`&&e.startsWith(`./`)}function io(e){return e.source===`file`||e.source===`directory`}var U,ao,oo,so,co,W,G,lo,uo,fo,po,mo,ho,go,_o,vo,yo,bo,xo,So,Co,wo,To,Eo,Do,Oo,ko,Ao,jo,Mo,No,Po,Fo,Io,Lo,Ro,zo,K,Bo,Vo,Ho,Uo,Wo,Go,Ko,qo,Jo,Yo=e((()=>{T(),$a(),Ot(),E(),U=new Set([`claude-code-marketplace`,`claude-code-plugins`,`claude-plugins-official`,`anthropic-marketplace`,`anthropic-plugins`,`agent-skills`,`life-sciences`,`knowledge-work-plugins`]),ao=new Set([`knowledge-work-plugins`]),oo=/(?:official[^a-z0-9]*(anthropic|claude)|(?:anthropic|claude)[^a-z0-9]*official|^(?:anthropic|claude)[^a-z0-9]*(marketplace|plugins|official))/i,so=/[^\u0020-\u007E]/,co=`anthropics`,W=w(()=>h().startsWith(`./`)),G=w(()=>W().endsWith(`.json`)),lo=w(()=>y([W().refine(e=>e.endsWith(`.mcpb`)||e.endsWith(`.dxt`),{message:`MCPB file path must end with .mcpb or .dxt`}).describe(`Path to MCPB file relative to plugin root`),h().url().refine(e=>e.endsWith(`.mcpb`)||e.endsWith(`.dxt`),{message:`MCPB URL must end with .mcpb or .dxt`}).describe(`URL to MCPB file`)])),uo=w(()=>W().endsWith(`.md`)),fo=w(()=>y([uo(),W()])),po=w(()=>h().min(1,`Marketplace must have a name`).refine(e=>!e.includes(` `),{message:`Marketplace name cannot contain spaces. Use kebab-case (e.g., "my-marketplace")`}).refine(e=>!e.includes(`/`)&&!e.includes(`\\`)&&!e.includes(`..`)&&e!==`.`,{message:`Marketplace name cannot contain path separators (/ or \\), ".." sequences, or be "."`}).refine(e=>!to(e),{message:`Marketplace name impersonates an official marketplace`}).refine(e=>e.toLowerCase()!==`inline`,{message:`Marketplace name "inline" is reserved for --plugin-dir session plugins`}).refine(e=>e.toLowerCase()!==`builtin`,{message:`Marketplace name "builtin" is reserved for built-in plugins`})),mo=w(()=>C({name:h().min(1,`Author name cannot be empty`).describe(`Display name of the plugin author or organization`),email:h().optional().describe(`Contact email for support or feedback`),url:h().optional().describe(`Website, GitHub profile, or organization URL`)})),ho=w(()=>C({name:h().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Unique identifier for the plugin, used for namespacing (prefer kebab-case)`),version:h().optional().describe(`Semantic version (e.g., 1.2.3) following semver.org specification`),description:h().optional().describe(`Brief, user-facing explanation of what the plugin provides`),author:mo().optional().describe(`Information about the plugin creator or maintainer`),homepage:h().url().optional().describe(`Plugin homepage or documentation URL`),repository:h().optional().describe(`Source code repository URL`),license:h().optional().describe(`SPDX license identifier (e.g., MIT, Apache-2.0)`),keywords:S(h()).optional().describe(`Tags for plugin discovery and categorization`),dependencies:S(Vo()).optional().describe(`Plugins that must be enabled for this plugin to function. Bare names (no "@marketplace") are resolved against the declaring plugin's own marketplace.`)})),go=w(()=>C({description:h().optional().describe(`Brief, user-facing explanation of what these hooks provide`),hooks:ge(()=>H()).describe(`The hooks provided by the plugin, in the same format as the one used for settings`)})),_o=w(()=>C({hooks:y([G().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),ge(()=>H()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`),S(y([G().describe(`Path to file with additional hooks (in addition to those in hooks/hooks.json, if it exists), relative to the plugin root`),ge(()=>H()).describe(`Additional hooks (in addition to those in hooks/hooks.json, if it exists)`)]))])})),vo=w(()=>C({source:fo().optional().describe(`Path to command markdown file, relative to plugin root`),content:h().optional().describe(`Inline markdown content for the command`),description:h().optional().describe(`Command description override`),argumentHint:h().optional().describe(`Hint for command arguments (e.g., "[file]")`),model:h().optional().describe(`Default model for this command`),allowedTools:S(h()).optional().describe(`Tools allowed when command runs`)}).refine(e=>e.source&&!e.content||!e.source&&e.content,{message:`Command must have either "source" (file path) or "content" (inline markdown), but not both`})),yo=w(()=>C({commands:y([fo().describe(`Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root`),S(fo().describe(`Path to additional command file or skill directory (in addition to those in the commands/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional command files or skill directories`),_(h(),vo()).describe(`Object mapping of command names to their metadata and source files. Command name becomes the slash command name (e.g., "about" → "/plugin:about")`)])})),bo=w(()=>C({agents:y([uo().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`),S(uo().describe(`Path to additional agent file (in addition to those in the agents/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional agent files`)])})),xo=w(()=>C({skills:y([W().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`),S(W().describe(`Path to additional skill directory (in addition to those in the skills/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional skill directories`)])})),So=w(()=>C({outputStyles:y([W().describe(`Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root`),S(W().describe(`Path to additional output styles directory or file (in addition to those in the output-styles/ directory, if it exists), relative to the plugin root`)).describe(`List of paths to additional output styles directories or files`)])})),Co=w(()=>h().min(1)),wo=w(()=>h().min(2).refine(e=>e.startsWith(`.`),{message:`File extensions must start with dot (e.g., ".ts", not "ts")`})),To=w(()=>C({mcpServers:y([G().describe(`MCP servers to include in the plugin (in addition to those in the .mcp.json file, if it exists)`),lo().describe(`Path or URL to MCPB file containing MCP server configuration`),_(h(),jt()).describe(`MCP server configurations keyed by server name`),S(y([G().describe(`Path to MCP servers configuration file`),lo().describe(`Path or URL to MCPB file`),_(h(),jt()).describe(`Inline MCP server configurations`)])).describe(`Array of MCP server configurations (paths, MCPB files, or inline definitions)`)])})),Eo=w(()=>C({type:b([`string`,`number`,`boolean`,`directory`,`file`]).describe(`Type of the configuration value`),title:h().describe(`Human-readable label shown in the config dialog`),description:h().describe(`Help text shown beneath the field in the config dialog`),required:x().optional().describe(`If true, validation fails when this field is empty`),default:y([h(),g(),x(),S(h())]).optional().describe(`Default value used when the user provides nothing`),multiple:x().optional().describe(`For string type: allow an array of strings`),sensitive:x().optional().describe(`If true, masks dialog input and stores value in secure storage (keychain/credentials file) instead of settings.json`),min:g().optional().describe(`Minimum value (number type only)`),max:g().optional().describe(`Maximum value (number type only)`)}).strict()),Do=w(()=>C({userConfig:_(h().regex(/^[A-Za-z_]\w*$/,`Option keys must be valid identifiers (letters, digits, underscore; no leading digit) — they become CLAUDE_PLUGIN_OPTION_<KEY> env vars in hooks`),Eo()).optional().describe("User-configurable values this plugin needs. Prompted at enable time. Non-sensitive values saved to settings.json; sensitive values to secure storage (macOS keychain or .credentials.json). Available as ${user_config.KEY} in MCP/LSP server config, hook commands, and (non-sensitive only) skill/agent content. Note: sensitive values share a single keychain entry with OAuth tokens — keep secret counts small to stay under the ~2KB stdin-safe limit (see INC-3028).")})),Oo=w(()=>C({channels:S(C({server:h().min(1).describe(`Name of the MCP server this channel binds to. Must match a key in this plugin's mcpServers.`),displayName:h().optional().describe(`Human-readable name shown in the config dialog title (e.g., "Telegram"). Defaults to the server name.`),userConfig:_(h(),Eo()).optional().describe("Fields to prompt the user for when enabling this plugin in assistant mode. Saved values are substituted into ${user_config.KEY} references in the mcpServers env.")}).strict()).describe(`Channels this plugin provides. Each entry declares an MCP server as a message channel and optionally specifies user configuration to prompt for at enable time.`)})),ko=w(()=>pe({command:h().min(1).refine(e=>!(e.includes(` `)&&!e.startsWith(`/`)),{message:`Command should not contain spaces. Use args array for arguments.`}).describe(`Command to execute the LSP server (e.g., "typescript-language-server")`),args:S(Co()).optional().describe(`Command-line arguments to pass to the server`),extensionToLanguage:_(wo(),Co()).refine(e=>Object.keys(e).length>0,{message:`extensionToLanguage must have at least one mapping`}).describe(`Mapping from file extension to LSP language ID. File extensions and languages are derived from this mapping.`),transport:b([`stdio`,`socket`]).default(`stdio`).describe(`Communication transport mechanism`),env:_(h(),h()).optional().describe(`Environment variables to set when starting the server`),initializationOptions:ue().optional().describe(`Initialization options passed to the server during initialization`),settings:ue().optional().describe(`Settings passed to the server via workspace/didChangeConfiguration`),workspaceFolder:h().optional().describe(`Workspace folder path to use for the server`),startupTimeout:g().int().positive().optional().describe(`Maximum time to wait for server startup (milliseconds)`),shutdownTimeout:g().int().positive().optional().describe(`Maximum time to wait for graceful shutdown (milliseconds)`),restartOnCrash:x().optional().describe(`Whether to restart the server if it crashes`),maxRestarts:g().int().nonnegative().optional().describe(`Maximum number of restart attempts before giving up`)})),Ao=w(()=>C({lspServers:y([G().describe(`Path to .lsp.json configuration file relative to plugin root`),_(h(),ko()).describe(`LSP server configurations keyed by server name`),S(y([G().describe(`Path to LSP configuration file`),_(h(),ko()).describe(`Inline LSP server configurations`)])).describe(`Array of LSP server configurations (paths or inline definitions)`)])})),jo=w(()=>h().refine(e=>!e.includes(`..`)&&!e.includes(`//`),`Package name cannot contain path traversal patterns`).refine(e=>/^@[a-z0-9][a-z0-9-._]*\/[a-z0-9][a-z0-9-._]*$/.test(e)||/^[a-z0-9][a-z0-9-._]*$/.test(e),`Invalid npm package name format`)),Mo=w(()=>C({settings:_(h(),ue()).optional().describe(`Settings to merge when plugin is enabled. Only allowlisted keys are kept (currently: agent)`)})),No=w(()=>C({...ho().shape,..._o().partial().shape,...yo().partial().shape,...bo().partial().shape,...xo().partial().shape,...So().partial().shape,...Oo().partial().shape,...To().partial().shape,...Ao().partial().shape,...Mo().partial().shape,...Do().partial().shape})),Po=w(()=>fe(`source`,[C({source:v(`url`),url:h().url().describe(`Direct URL to marketplace.json file`),headers:_(h(),h()).optional().describe(`Custom HTTP headers (e.g., for authentication)`)}),C({source:v(`github`),repo:h().describe(`GitHub repository in owner/repo format`),ref:h().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),path:h().optional().describe(`Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)`),sparsePaths:S(h()).optional().describe(`Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.`)}),C({source:v(`git`),url:h().describe(`Full git repository URL`),ref:h().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),path:h().optional().describe(`Path to marketplace.json within repo (defaults to .claude-plugin/marketplace.json)`),sparsePaths:S(h()).optional().describe(`Directories to include via git sparse-checkout (cone mode). Use for monorepos where the marketplace lives in a subdirectory. Example: [".claude-plugin", "plugins"]. If omitted, the full repository is cloned.`)}),C({source:v(`npm`),package:jo().describe(`NPM package containing marketplace.json`)}),C({source:v(`file`),path:h().describe(`Local file path to marketplace.json`)}),C({source:v(`directory`),path:h().describe(`Local directory containing .claude-plugin/marketplace.json`)}),C({source:v(`hostPattern`),hostPattern:h().describe(`Regex pattern to match the host/domain extracted from any marketplace source type. For github sources, matches against "github.com". For git sources (SSH or HTTPS), extracts the hostname from the URL. Use in strictKnownMarketplaces to allow all marketplaces from a specific host (e.g., "^github\\.mycompany\\.com$").`)}),C({source:v(`pathPattern`),pathPattern:h().describe(`Regex pattern matched against the .path field of file and directory sources. Use in strictKnownMarketplaces to allow filesystem-based marketplaces alongside hostPattern restrictions for network sources. Use ".*" to allow all filesystem paths, or a narrower pattern (e.g., "^/opt/approved/") to restrict to specific directories.`)}),C({source:v(`settings`),name:po().refine(e=>!U.has(e.toLowerCase()),{message:`Reserved official marketplace names cannot be used with settings sources. validateOfficialNameSource only accepts github/git sources from anthropics/* for these names; a settings source would be rejected after loadAndCacheMarketplace has already written to disk with cleanupNeeded=false.`}).describe(`Marketplace name. Must match the extraKnownMarketplaces key (enforced); the synthetic manifest is written under this name. Same validation as PluginMarketplaceSchema plus reserved-name rejection — validateOfficialNameSource runs after the disk write, too late to clean up.`),plugins:S(Lo()).describe(`Plugin entries declared inline in settings.json`),owner:mo().optional()}).describe(`Inline marketplace manifest defined directly in settings.json. The reconciler writes a synthetic marketplace.json to the cache; diffMarketplaces detects edits via isEqual on the stored source (the plugins array is inside this object, so edits surface as sourceChanged).`)])),Fo=w(()=>h().length(40).regex(/^[a-f0-9]{40}$/,`Must be a full 40-character lowercase git commit SHA`)),Io=w(()=>y([W().describe(`Path to the plugin root, relative to the marketplace root (the directory containing .claude-plugin/, not .claude-plugin/ itself)`),C({source:v(`npm`),package:jo().or(h()).describe("Package name (or url, or local path, or anything else that can be passed to `npm` as a package)"),version:h().optional().describe(`Specific version or version range (e.g., ^1.0.0, ~2.1.0)`),registry:h().url().optional().describe(`Custom NPM registry URL (defaults to using system default, likely npmjs.org)`)}).describe(`NPM package as plugin source`),C({source:v(`pip`),package:h().describe(`Python package name as it appears on PyPI`),version:h().optional().describe(`Version specifier (e.g., ==1.0.0, >=2.0.0, <3.0.0)`),registry:h().url().optional().describe(`Custom PyPI registry URL (defaults to using system default, likely pypi.org)`)}).describe(`Python package as plugin source`),C({source:v(`url`),url:h().describe(`Full git repository URL (https:// or git@)`),ref:h().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:Fo().optional().describe(`Specific commit SHA to use`)}),C({source:v(`github`),repo:h().describe(`GitHub repository in owner/repo format`),ref:h().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:Fo().optional().describe(`Specific commit SHA to use`)}),C({source:v(`git-subdir`),url:h().describe(`Git repository: GitHub owner/repo shorthand, https://, or git@ URL`),path:h().min(1).describe(`Subdirectory within the repo containing the plugin (e.g., "tools/claude-plugin"). Cloned sparsely using partial clone (--filter=tree:0) to minimize bandwidth for monorepos.`),ref:h().optional().describe(`Git branch or tag to use (e.g., "main", "v1.0.0"). Defaults to repository default branch.`),sha:Fo().optional().describe(`Specific commit SHA to use`)}).describe(`Plugin located in a subdirectory of a larger repository (monorepo). Only the specified subdirectory is materialized; the rest of the repo is not downloaded.`)])),Lo=w(()=>C({name:h().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Plugin name as it appears in the target repository`),source:Io().describe(`Where to fetch the plugin from. Must be a remote source — relative paths have no marketplace repository to resolve against.`),description:h().optional(),version:h().optional(),strict:x().optional()}).refine(e=>typeof e.source!=`string`,{message:`Plugins in a settings-sourced marketplace must use remote sources (github, git-subdir, npm, url, pip). Relative-path sources like "./foo" have no marketplace repository to resolve against.`})),Ro=w(()=>No().partial().extend({name:h().min(1,`Plugin name cannot be empty`).refine(e=>!e.includes(` `),{message:`Plugin name cannot contain spaces. Use kebab-case (e.g., "my-plugin")`}).describe(`Unique identifier matching the plugin name`),source:Io().describe(`Where to fetch the plugin from`),category:h().optional().describe(`Category for organizing plugins (e.g., "productivity", "development")`),tags:S(h()).optional().describe(`Tags for searchability and discovery`),strict:x().optional().default(!0).describe(`Require the plugin manifest to be present in the plugin folder. If false, the marketplace entry provides the manifest.`)})),zo=w(()=>C({name:po(),owner:mo().describe(`Marketplace maintainer or curator information`),plugins:S(Ro()).describe(`Collection of available plugins in this marketplace`),forceRemoveDeletedPlugins:x().optional().describe(`When true, plugins removed from this marketplace will be automatically uninstalled and flagged for users`),metadata:C({pluginRoot:h().optional().describe(`Base path for relative plugin sources`),version:h().optional().describe(`Marketplace version`),description:h().optional().describe(`Marketplace description`)}).optional().describe(`Optional marketplace metadata`),allowCrossMarketplaceDependenciesOn:S(h()).optional().describe(`Marketplace names whose plugins may be auto-installed as dependencies. Only the root marketplace's allowlist applies — no transitive trust.`)})),K=w(()=>h().regex(/^[a-z0-9][-a-z0-9._]*@[a-z0-9][-a-z0-9._]*$/i,`Plugin ID must be in format: plugin@marketplace`)),Bo=/^[a-z0-9][-a-z0-9._]*(@[a-z0-9][-a-z0-9._]*)?(@\^[^@]*)?$/i,Vo=w(()=>y([h().regex(Bo,`Dependency must be a plugin name, optionally qualified with @marketplace`).transform(e=>e.replace(/@\^[^@]*$/,``)),C({name:h().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i),marketplace:h().min(1).regex(/^[a-z0-9][-a-z0-9._]*$/i).optional()}).loose().transform(e=>e.marketplace?`${e.name}@${e.marketplace}`:e.name)])),w(()=>y([K(),C({id:K().describe(`Plugin identifier (e.g., "formatter@tools")`),version:h().optional().describe(`Version constraint (e.g., "^2.0.0")`),required:x().optional().describe(`If true, cannot be disabled`),config:_(h(),ue()).optional().describe(`Plugin-specific configuration`)})])),Ho=w(()=>C({version:h().describe(`Currently installed version`),installedAt:h().describe(`ISO 8601 timestamp of installation`),lastUpdated:h().optional().describe(`ISO 8601 timestamp of last update`),installPath:h().describe(`Absolute path to the installed plugin directory`),gitCommitSha:h().optional().describe(`Git commit SHA for git-based plugins (for version tracking)`)})),Uo=w(()=>C({version:v(1).describe(`Schema version 1`),plugins:_(K(),Ho()).describe(`Map of plugin IDs to their installation metadata`)})),Wo=w(()=>b([`managed`,`user`,`project`,`local`])),Go=w(()=>C({scope:Wo().describe(`Installation scope`),projectPath:h().optional().describe(`Project path (required for project/local scopes)`),installPath:h().describe(`Absolute path to the versioned plugin directory`),version:h().optional().describe(`Currently installed version`),installedAt:h().optional().describe(`ISO 8601 timestamp of installation`),lastUpdated:h().optional().describe(`ISO 8601 timestamp of last update`),gitCommitSha:h().optional().describe(`Git commit SHA for git-based plugins`)})),Ko=w(()=>C({version:v(2).describe(`Schema version 2`),plugins:_(K(),S(Go())).describe(`Map of plugin IDs to arrays of installation entries`)})),w(()=>y([Uo(),Ko()])),qo=w(()=>C({source:Po().describe(`Where to fetch the marketplace from`),installLocation:h().describe(`Local cache path where marketplace manifest is stored`),lastUpdated:h().describe(`ISO 8601 timestamp of last marketplace refresh`),autoUpdate:x().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Jo=w(()=>_(h(),qo()))}));function Xo(e){let t=e.replace(/[^a-zA-Z0-9_-]/g,`_`);return e.startsWith(Zo)&&(t=t.replace(/_+/g,`_`).replace(/^_|_$/g,``)),t}var Zo,Qo=e((()=>{Zo=`claude.ai `}));function $o(e){let[t,n,...r]=e.split(`__`);return t!==`mcp`||!n?null:{serverName:n,toolName:r.length>0?r.join(`__`):void 0}}function es(e){return`mcp__${Xo(e)}__`}function ts(e,t){return`${es(e)}${Xo(t)}`}function ns(e){return e.mcpInfo?ts(e.mcpInfo.serverName,e.mcpInfo.toolName):e.name}function rs(e,t){let n=`mcp__${Xo(t)}__`;return e.replace(n,``)}function is(e){let t=e.replace(/\s*\(MCP\)\s*$/,``);t=t.trim();let n=t.indexOf(` - `);return n===-1?t:t.substring(n+3).trim()}var as=e((()=>{Qo()})),os,ss,cs,ls,us=e((()=>{os=`Agent`,ss=`Task`,cs=`verification`,ls=new Set([`Explore`,`Plan`])})),ds,fs=e((()=>{ds=`TaskOutput`})),ps,ms,hs=e((()=>{ps=`TaskStop`,ms=`
13
- - Stops a running background task by its ID
14
- - Takes a task_id parameter identifying the task to stop
15
- - Returns a success or failure status
16
- - Use this tool when you need to terminate a long-running task
17
- `}));function q(e){return Cs[e]??e}function gs(e){let t=[];for(let[n,r]of Object.entries(Cs))r===e&&t.push(n);return t}function _s(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`)}function vs(e){return e.replace(/\\\(/g,`(`).replace(/\\\)/g,`)`).replace(/\\\\/g,`\\`)}function ys(e){let t=xs(e,`(`);if(t===-1)return{toolName:q(e)};let n=Ss(e,`)`);if(n===-1||n<=t||n!==e.length-1)return{toolName:q(e)};let r=e.substring(0,t),i=e.substring(t+1,n);if(!r)return{toolName:q(e)};if(i===``||i===`*`)return{toolName:q(r)};let a=vs(i);return{toolName:q(r),ruleContent:a}}function bs(e){if(!e.ruleContent)return e.toolName;let t=_s(e.ruleContent);return`${e.toolName}(${t})`}function xs(e,t){for(let n=0;n<e.length;n++)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}function Ss(e,t){for(let n=e.length-1;n>=0;n--)if(e[n]===t){let t=0,r=n-1;for(;r>=0&&e[r]===`\\`;)t++,r--;if(t%2==0)return n}return-1}var Cs,ws=e((()=>{us(),fs(),hs(),Cs={Task:os,KillShell:ps,AgentOutputTool:ds,BashOutputTool:ds}}));function Ts(e){return Os.filePatternTools.includes(e)}function Es(e){return Os.bashPrefixTools.includes(e)}function Ds(e){return Os.customValidation[e]}var Os,ks=e((()=>{Os={filePatternTools:[`Read`,`Write`,`Edit`,`Glob`,`NotebookRead`,`NotebookEdit`],bashPrefixTools:[`Bash`],customValidation:{WebSearch:e=>e.includes(`*`)||e.includes(`?`)?{valid:!1,error:`WebSearch does not support wildcards`,suggestion:`Use exact search terms without * or ?`,examples:[`WebSearch(claude ai)`,`WebSearch(typescript tutorial)`]}:{valid:!0},WebFetch:e=>e.includes(`://`)||e.startsWith(`http`)?{valid:!1,error:`WebFetch permissions use domain format, not URLs`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:github.com)`]}:e.startsWith(`domain:`)?{valid:!0}:{valid:!1,error:`WebFetch permissions must use "domain:" prefix`,suggestion:`Use "domain:hostname" format`,examples:[`WebFetch(domain:example.com)`,`WebFetch(domain:*.google.com)`]}}}}));function As(e,t){let n=0,r=t-1;for(;r>=0&&e[r]===`\\`;)n++,r--;return n%2!=0}function js(e,t){let n=0;for(let r=0;r<e.length;r++)e[r]===t&&!As(e,r)&&n++;return n}function Ms(e){for(let t=0;t<e.length-1;t++)if(e[t]===`(`&&e[t+1]===`)`&&!As(e,t))return!0;return!1}function Ns(e,t){if(!e||e.trim()===``)return{valid:!1,error:`Permission rule cannot be empty`};if(js(e,`(`)!==js(e,`)`))return{valid:!1,error:`Mismatched parentheses`,suggestion:`Ensure all opening parentheses have matching closing parentheses`};if(Ms(e)){let t=e.substring(0,e.indexOf(`(`));return t?{valid:!1,error:`Empty parentheses`,suggestion:`Either specify a pattern or use just "${t}" without parentheses`,examples:[`${t}`,`${t}(some-pattern)`]}:{valid:!1,error:`Empty parentheses with no tool name`,suggestion:`Specify a tool name before the parentheses`}}let n=ys(e),r=$o(n.toolName);if(r)return n.ruleContent!==void 0||js(e,`(`)>0?{valid:!1,error:`MCP rules do not support patterns in parentheses`,suggestion:`Use "${n.toolName}" without parentheses, or use "mcp__${r.serverName}__*" for all tools`,examples:[`mcp__${r.serverName}`,`mcp__${r.serverName}__*`,r.toolName&&r.toolName!==`*`?`mcp__${r.serverName}__${r.toolName}`:void 0].filter(Boolean)}:{valid:!0};if(!n.toolName||n.toolName.length===0)return{valid:!1,error:`Tool name cannot be empty`};if(n.toolName[0]!==n.toolName[0]?.toUpperCase())return{valid:!1,error:`Tool names must start with uppercase`,suggestion:`Use "${Ut(String(n.toolName))}"`};let i=Ds(n.toolName);if(i&&n.ruleContent!==void 0){let e=i(n.ruleContent);if(!e.valid)return e}if(Es(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`)&&!e.endsWith(`:*`))return{valid:!1,error:`The :* pattern must be at the end`,suggestion:`Move :* to the end for prefix matching, or use * for wildcard matching`,examples:[`Bash(npm run:*) - prefix matching (legacy)`,`Bash(npm run *) - wildcard matching`]};if(e===`:*`)return{valid:!1,error:`Prefix cannot be empty before :*`,suggestion:`Specify a command prefix before :*`,examples:[`Bash(npm:*)`,`Bash(git:*)`]}}if(Ts(n.toolName)&&n.ruleContent!==void 0){let e=n.ruleContent;if(e.includes(`:*`))return{valid:!1,error:`The ":*" syntax is only for Bash prefix rules`,suggestion:`Use glob patterns like "*" or "**" for file matching`,examples:[`${n.toolName}(*.ts) - matches .ts files`,`${n.toolName}(src/**) - matches all files in src`,`${n.toolName}(**/*.test.ts) - matches test files`]};if(e.includes(`*`)&&!e.match(/^\*|\*$|\*\*|\/\*|\*\.|\*\)/)&&!e.includes(`**`))return{valid:!1,error:`Wildcard placement might be incorrect`,suggestion:`Wildcards are typically used at path boundaries`,examples:[`${n.toolName}(*.js) - all .js files`,`${n.toolName}(src/*) - all files directly in src`,`${n.toolName}(src/**) - all files recursively in src`]}}return{valid:!0}}var Ps,Fs=e((()=>{T(),as(),E(),ws(),Wt(),ks(),Ps=w(()=>h().superRefine((e,t)=>{let n=Ns(e);if(!n.valid){let r=n.error;n.suggestion&&(r+=`. ${n.suggestion}`),n.examples&&n.examples.length>0&&(r+=`. Examples: ${n.examples.join(`, `)}`),t.addIssue({code:he.custom,message:r,params:{received:e}})}}))}));function Is(e){return`serverName`in e&&e.serverName!==void 0}function Ls(e){return`serverCommand`in e&&e.serverCommand!==void 0}function Rs(e){return`serverUrl`in e&&e.serverUrl!==void 0}var zs,Bs,Vs,Hs,Us,Ws,J,Gs=e((()=>{T(),sa(),ne(),E(),za(),Yo(),Yi(),Fs(),$a(),si(),zs=w(()=>_(h(),me())),Bs=w(()=>C({allow:S(Ps()).optional().describe(`List of permission rules for allowed operations`),deny:S(Ps()).optional().describe(`List of permission rules for denied operations`),ask:S(Ps()).optional().describe(`List of permission rules that should always prompt for confirmation`),defaultMode:b(Ea).optional().describe(`Default permission mode when Work Mate needs access`),disableBypassPermissionsMode:b([`disable`]).optional().describe(`Disable the ability to bypass permission prompts`),disableAutoMode:b([`disable`]).optional().describe(`Disable auto mode`),additionalDirectories:S(h()).optional().describe(`Additional directories to include in the permission scope`)}).passthrough()),Vs=w(()=>C({source:Po().describe(`Where to fetch the marketplace from`),installLocation:h().optional().describe(`Local cache path where marketplace manifest is stored (auto-generated if not provided)`),autoUpdate:x().optional().describe(`Whether to automatically update this marketplace and its installed plugins on startup`)})),Hs=w(()=>C({serverName:h().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that users are allowed to configure`),serverCommand:S(h()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for allowed stdio servers`),serverUrl:h().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for allowed remote MCP servers`)}).refine(e=>ai([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Us=w(()=>C({serverName:h().regex(/^[a-zA-Z0-9_-]+$/,`Server name can only contain letters, numbers, hyphens, and underscores`).optional().describe(`Name of the MCP server that is explicitly blocked`),serverCommand:S(h()).min(1,`Server command must have at least one element (the command)`).optional().describe(`Command array [command, ...args] to match exactly for blocked stdio servers`),serverUrl:h().optional().describe(`URL pattern with wildcard support (e.g., "https://*.example.com/*") for blocked remote MCP servers`)}).refine(e=>ai([e.serverName!==void 0,e.serverCommand!==void 0,e.serverUrl!==void 0],Boolean)===1,{message:`Entry must have exactly one of "serverName", "serverCommand", or "serverUrl"`})),Ws=[`skills`,`agents`,`hooks`,`mcp`],J=w(()=>C({$schema:v(Ji).optional().describe(`JSON Schema reference for Work Mate settings`),apiKeyHelper:h().optional().describe(`Path to a script that outputs authentication values`),awsCredentialExport:h().optional().describe(`Path to a script that exports AWS credentials`),awsAuthRefresh:h().optional().describe(`Path to a script that refreshes AWS authentication`),gcpAuthRefresh:h().optional().describe(`Command to refresh GCP authentication (e.g., gcloud auth application-default login)`),...p(process.env.CLAUDE_CODE_ENABLE_XAA)?{xaaIdp:C({issuer:h().url().describe(`IdP issuer URL for OIDC discovery`),clientId:h().describe(`Work Mate's client_id registered at the IdP`),callbackPort:g().int().positive().optional().describe(`Fixed loopback callback port for the IdP OIDC login. Only needed if the IdP does not honor RFC 8252 port-any matching.`)}).optional().describe(`XAA (SEP-990) IdP connection. Configure once; all XAA-enabled MCP servers reuse this.`)}:{},fileSuggestion:C({type:v(`command`),command:h()}).optional().describe(`Custom file suggestion configuration for @ mentions`),respectGitignore:x().optional().describe(`Whether file picker should respect .gitignore files (default: true). Note: .ignore files are always respected.`),cleanupPeriodDays:g().nonnegative().int().optional().describe(`Number of days to retain chat transcripts (default: 30). Setting to 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`),env:zs().optional().describe(`Environment variables to set for Work Mate sessions`),attribution:C({commit:h().optional().describe(`Attribution text for git commits, including any trailers. Empty string hides attribution.`),pr:h().optional().describe(`Attribution text for pull request descriptions. Empty string hides attribution.`)}).optional().describe(`Customize attribution text for commits and PRs. Each field defaults to the standard Work Mate attribution if not set.`),includeCoAuthoredBy:x().optional().describe(`Deprecated: Use attribution instead. Whether to include Claude's co-authored by attribution in commits and PRs (defaults to true)`),includeGitInstructions:x().optional().describe(`Include built-in commit and PR workflow instructions in Claude's system prompt (default: true)`),permissions:Bs().optional().describe(`Tool usage permissions configuration`),modelType:b([`anthropic`,`openai`,`gemini`,`grok`]).optional().describe(`API provider type. "anthropic" uses the first-party API (default), "openai" uses the OpenAI Chat Completions API, "gemini" uses the Gemini API, and "grok" uses the xAI Grok API (OpenAI-compatible). When set to "openai", configure OPENAI_API_KEY, OPENAI_BASE_URL, and OPENAI_MODEL. When set to "gemini", configure GEMINI_API_KEY and optional GEMINI_BASE_URL. When set to "grok", configure GROK_API_KEY (or XAI_API_KEY), optional GROK_BASE_URL, GROK_MODEL, and GROK_MODEL_MAP.`),activeProviderId:h().optional().describe(`Currently active API provider id (set by /provider use <id>). Authoritative source for the active-provider marker in /provider list.`),model:h().optional().describe(`Override the default model used by Work Mate`),availableModels:S(h()).optional().describe(`Allowlist of models that users can select. Accepts family aliases ("opus" allows any opus version), version prefixes ("opus-4-5" allows only that version), and full model IDs. If undefined, all models are available. If empty array, only the default model is available. Typically set in managed settings by enterprise administrators.`),modelOverrides:_(h(),h()).optional().describe(`Override mapping from Anthropic model ID (e.g. "claude-opus-4-6") to provider-specific model ID (e.g. a Bedrock inference profile ARN). Typically set in managed settings by enterprise administrators.`),enableAllProjectMcpServers:x().optional().describe(`Whether to automatically approve all MCP servers in the project`),enabledMcpjsonServers:S(h()).optional().describe(`List of approved MCP servers from .mcp.json`),disabledMcpjsonServers:S(h()).optional().describe(`List of rejected MCP servers from .mcp.json`),allowedMcpServers:S(Hs()).optional().describe(`Enterprise allowlist of MCP servers that can be used. Applies to all scopes including enterprise servers from managed-mcp.json. If undefined, all servers are allowed. If empty array, no servers are allowed. Denylist takes precedence - if a server is on both lists, it is denied.`),deniedMcpServers:S(Us()).optional().describe(`Enterprise denylist of MCP servers that are explicitly blocked. If a server is on the denylist, it will be blocked across all scopes including enterprise. Denylist takes precedence over allowlist - if a server is on both lists, it is denied.`),hooks:H().optional().describe(`Custom commands to run before/after tool executions`),worktree:C({symlinkDirectories:S(h()).optional().describe(`Directories to symlink from main repository to worktrees to avoid disk bloat. Must be explicitly configured - no directories are symlinked by default. Common examples: "node_modules", ".cache", ".bin"`),sparsePaths:S(h()).optional().describe(`Directories to include when creating worktrees, via git sparse-checkout (cone mode). Dramatically faster in large monorepos — only the listed paths are written to disk.`)}).optional().describe(`Git worktree configuration for --worktree flag.`),disableAllHooks:x().optional().describe(`Disable all hooks and statusLine execution`),defaultShell:b([`bash`,`powershell`]).optional().describe(`Default shell for input-box ! commands. Defaults to 'bash' on all platforms (no Windows auto-flip).`),allowManagedHooksOnly:x().optional().describe(`When true (and set in managed settings), only hooks from managed settings run. User, project, and local hooks are ignored.`),allowedHttpHookUrls:S(h()).optional().describe(`Allowlist of URL patterns that HTTP hooks may target. Supports * as a wildcard (e.g. "https://hooks.example.com/*"). When set, HTTP hooks with non-matching URLs are blocked. If undefined, all URLs are allowed. If empty array, no HTTP hooks are allowed. Arrays merge across settings sources (same semantics as allowedMcpServers).`),httpHookAllowedEnvVars:S(h()).optional().describe(`Allowlist of environment variable names HTTP hooks may interpolate into headers. When set, each hook's effective allowedEnvVars is the intersection with this list. If undefined, no restriction is applied. Arrays merge across settings sources (same semantics as allowedMcpServers).`),allowManagedPermissionRulesOnly:x().optional().describe(`When true (and set in managed settings), only permission rules (allow/deny/ask) from managed settings are respected. User, project, local, and CLI argument permission rules are ignored.`),allowManagedMcpServersOnly:x().optional().describe(`When true (and set in managed settings), allowedMcpServers is only read from managed settings. deniedMcpServers still merges from all sources, so users can deny servers for themselves. Users can still add their own MCP servers, but only the admin-defined allowlist applies.`),strictPluginOnlyCustomization:ce(e=>Array.isArray(e)?e.filter(e=>Ws.includes(e)):e,y([x(),S(b(Ws))])).optional().catch(void 0).describe('When set in managed settings, blocks non-plugin customization sources for the listed surfaces. Array form locks specific surfaces (e.g. ["skills", "hooks"]); `true` locks all four; `false` is an explicit no-op. Blocked: ~/.claude/{surface}/, .claude/{surface}/ (project), settings.json hooks, .mcp.json. NOT blocked: managed (policySettings) sources, plugin-provided customizations. Composes with strictKnownMarketplaces for end-to-end admin control — plugins gated by marketplace allowlist, everything else blocked here.'),statusLine:C({type:v(`command`),command:h(),padding:g().optional(),refreshInterval:g().optional()}).optional().describe(`Custom status line display configuration`),statusLineEnabled:x().optional().describe(`Whether to render the fork built-in status line (model + ctx + 5h/7d limits + cost + cache pill). Toggled with /statusline.`),enabledPlugins:_(h(),y([S(h()),x(),de()])).optional().describe(`Enabled plugins using plugin-id@marketplace-id format. Example: { "formatter@anthropic-tools": true }. Also supports extended format with version constraints.`),extraKnownMarketplaces:_(h(),Vs()).check(e=>{for(let[t,n]of Object.entries(e.value))n.source.source===`settings`&&n.source.name!==t&&e.issues.push({code:`custom`,input:n.source.name,path:[t,`source`,`name`],message:`Settings-sourced marketplace name must match its extraKnownMarketplaces key (got key "${t}" but source.name "${n.source.name}")`})}).optional().describe(`Additional marketplaces to make available for this repository. Typically used in repository .claude/settings.json to ensure team members have required plugin sources.`),strictKnownMarketplaces:S(Po()).optional().describe(`Enterprise strict list of allowed marketplace sources. When set in managed settings, ONLY these exact sources can be added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem. Note: this is a policy gate only — it does NOT register marketplaces. To pre-register allowed marketplaces for users, also set extraKnownMarketplaces.`),blockedMarketplaces:S(Po()).optional().describe(`Enterprise blocklist of marketplace sources. When set in managed settings, these exact sources are blocked from being added as marketplaces. The check happens BEFORE downloading, so blocked sources never touch the filesystem.`),forceLoginMethod:b([`claudeai`,`console`]).optional().describe(`Force a specific login method: "claudeai" for Claude Pro/Max, "console" for Console billing`),forceLoginOrgUUID:h().optional().describe(`Organization UUID to use for OAuth login`),otelHeadersHelper:h().optional().describe(`Path to a script that outputs OpenTelemetry headers`),outputStyle:h().optional().describe(`Controls the output style for assistant responses`),language:h().optional().describe(`Preferred language for Claude responses (e.g., "japanese", "spanish")`),skipWebFetchPreflight:x().optional().describe(`Skip the WebFetch blocklist check for enterprise environments with restrictive security policies`),webSearchAdapter:b([`api`,`bing`,`brave`,`exa`,`tavily`]).optional().describe(`Web search backend adapter. "tavily" uses Tavily Search API (default), "api" uses Anthropic server-side search, "bing" scrapes Bing HTML, "brave" uses Brave Search API, "exa" uses Exa AI.`),webFetchAdapter:b([`tavily`,`http`]).optional().describe(`Web fetch backend. "tavily" uses Tavily Extract API which returns Markdown directly (default), "http" fetches the URL directly via HTTP.`),tavilyEndpointUrl:h().optional().describe(`Custom Tavily API endpoint URL. Defaults to https://tavily.readmagic.workmate.win. Used by both WebSearch and WebFetch when tavily adapter is selected.`),braveApiKey:h().optional().describe(`Brave Search API key. Required when using the brave web search adapter.`),webFetchHttpTimeoutMs:g().int().positive().optional().describe(`HTTP timeout in milliseconds for the HTTP direct web fetch backend. Defaults to 60000 (60s).`),exaApiKey:h().optional().describe(`Exa AI API key. Required when using the exa web search adapter.`),exaEndpointUrl:h().optional().describe(`Custom Exa AI MCP endpoint URL. Defaults to https://mcp.exa.ai/mcp.`),sandbox:oa().optional(),feedbackSurveyRate:g().min(0).max(1).optional().describe(`Probability (0–1) that the session quality survey appears when eligible. 0.05 is a reasonable starting point.`),spinnerTipsEnabled:x().optional().describe(`Whether to show tips in the spinner`),spinnerVerbs:C({mode:b([`append`,`replace`]),verbs:S(h())}).optional().describe(`Customize spinner verbs. mode: "append" adds verbs to defaults, "replace" uses only your verbs.`),spinnerTipsOverride:C({excludeDefault:x().optional(),tips:S(h())}).optional().describe(`Override spinner tips. tips: array of tip strings. excludeDefault: if true, only show custom tips (default: false).`),syntaxHighlightingDisabled:x().optional().describe(`Whether to disable syntax highlighting in diffs`),terminalTitleFromRename:x().optional().describe(`Whether /rename updates the terminal tab title (defaults to true). Set to false to keep auto-generated topic titles.`),alwaysThinkingEnabled:x().optional().describe(`When false, thinking is disabled. When absent or true, thinking is enabled automatically for supported models.`),advisorModel:h().optional().describe(`Advisor model for the server-side advisor tool.`),fastMode:x().optional().describe(`When true, fast mode is enabled. When absent or false, fast mode is off.`),fastModePerSessionOptIn:x().optional().describe(`When true, fast mode does not persist across sessions. Each session starts with fast mode off.`),promptSuggestionEnabled:x().optional().describe(`When false, prompt suggestions are disabled. When absent or true, prompt suggestions are enabled.`),poorMode:x().optional().describe(`When true, poor mode is active — extract_memories and prompt_suggestion are disabled to save tokens.`),showClearContextOnPlanAccept:x().optional().describe(`When true, the plan-approval dialog offers a "clear context" option. Defaults to false.`),agent:h().optional().describe(`Name of an agent (built-in or custom) to use for the main thread. Applies the agent's system prompt, tool restrictions, and model.`),companyAnnouncements:S(h()).optional().describe(`Company announcements to display at startup (one will be randomly selected if multiple are provided)`),pluginConfigs:_(h(),C({mcpServers:_(h(),_(h(),y([h(),g(),x(),S(h())]))).optional().describe(`User configuration values for MCP servers keyed by server name`),options:_(h(),y([h(),g(),x(),S(h())])).optional().describe(`Non-sensitive option values from plugin manifest userConfig, keyed by option name. Sensitive values go to secure storage instead.`)})).optional().describe(`Per-plugin configuration including MCP server user configs, keyed by plugin ID (plugin@marketplace format)`),remote:C({defaultEnvironmentId:h().optional().describe(`Default environment ID to use for remote sessions`)}).optional().describe(`Remote session configuration`),autoUpdatesChannel:b([`latest`,`stable`]).optional().describe(`Release channel for auto-updates (latest or stable)`),disableDeepLinkRegistration:b([`disable`]).optional().describe(`Prevent claude-cli:// protocol handler registration with the OS`),minimumVersion:h().optional().describe(`Minimum version to stay on - prevents downgrades when switching to stable channel`),plansDirectory:h().optional().describe(`Custom directory for plan files, relative to project root. If not set, defaults to ~/.claude/plans/`),minSleepDurationMs:g().nonnegative().int().optional().describe(`Minimum duration in milliseconds that the Sleep tool must sleep for. Useful for throttling proactive tick frequency.`),maxSleepDurationMs:g().int().min(-1).optional().describe(`Maximum duration in milliseconds that the Sleep tool can sleep for. Set to -1 for indefinite sleep (waits for user input). Useful for limiting idle time in remote/managed environments.`),channelsEnabled:x().optional().describe(`Teams/Enterprise opt-in for channel notifications (MCP servers with the claude/channel capability pushing inbound messages). Default off. Set true to allow; users then select servers via --channels.`),allowedChannelPlugins:S(C({marketplace:h(),plugin:h()})).optional().describe(`Teams/Enterprise allowlist of channel plugins. When set, replaces the default allowlist — admins decide which plugins may push inbound messages. Undefined falls back to the default. Requires channelsEnabled: true.`),prefersReducedMotion:x().optional().describe(`Reduce or disable animations for accessibility (spinner shimmer, flash effects, etc.)`),autoMemoryEnabled:x().optional().describe(`Enable auto-memory for this project. When false, Claude will not read from or write to the auto-memory directory.`),autoMemoryDirectory:h().optional().describe(`Custom directory path for auto-memory storage. Supports ~/ prefix for home directory expansion. Ignored if set in projectSettings (checked-in .claude/settings.json) for security. When unset, defaults to ~/.claude/projects/<sanitized-cwd>/memory/.`),autoDreamEnabled:x().optional().describe(`Enable background memory consolidation (auto-dream). When set, overrides the server-side default.`),showThinkingSummaries:x().optional().describe(`Show thinking summaries in the transcript view (ctrl+o). Default: false.`),skipDangerousModePermissionPrompt:x().optional().describe(`Whether the user has accepted the bypass permissions mode dialog`),skipAutoPermissionPrompt:x().optional().describe(`Whether the user has accepted the auto mode opt-in dialog`),useAutoModeDuringPlan:x().optional().describe(`Whether plan mode uses auto mode semantics when auto mode is available (default: true)`),autoMode:C({allow:S(h()).optional().describe(`Rules for the auto mode classifier allow section`),soft_deny:S(h()).optional().describe(`Rules for the auto mode classifier deny section`),environment:S(h()).optional().describe(`Entries for the auto mode classifier environment section`)}).optional().describe(`Auto mode classifier prompt customization`),disableAutoMode:b([`disable`]).optional().describe(`Disable auto mode`),sshConfigs:S(C({id:h().describe(`Unique identifier for this SSH config. Used to match configs across settings sources.`),name:h().describe(`Display name for the SSH connection`),sshHost:h().describe(`SSH host in format "user@hostname" or "hostname", or a host alias from ~/.ssh/config`),sshPort:g().int().optional().describe(`SSH port (default: 22)`),sshIdentityFile:h().optional().describe(`Path to SSH identity file (private key)`),startDirectory:h().optional().describe("Default working directory on the remote host. Supports tilde expansion (e.g. ~/projects). If not specified, defaults to the remote user home directory. Can be overridden by the [dir] positional argument in `claude ssh <config> [dir]`.")})).optional().describe(`SSH connection configurations for remote environments. Typically set in managed settings by enterprise administrators to pre-configure SSH connections for team members.`),claudeMdExcludes:S(h()).optional().describe(`Glob patterns or absolute paths of CLAUDE.md files to exclude from loading. Patterns are matched against absolute file paths using picomatch. Only applies to User, Project, and Local memory types (Managed/policy files cannot be excluded). Examples: "/home/user/monorepo/CLAUDE.md", "**/code/CLAUDE.md", "**/some-dir/.claude/rules/**"`),cacheThreshold:g().int().min(0).max(100).optional().describe(`Prompt cache hit rate threshold (0-100). Warnings shown when cache hit rate falls below this percentage. Default: 80.`),cacheWarningEnabled:x().optional().describe(`Whether to show cache hit rate warnings in the message flow when the rate falls below cacheThreshold. Default: true.`),pluginTrustMessage:h().optional().describe(`Custom message to append to the plugin trust warning shown before installation. Only read from policy settings (managed-settings.json / MDM). Useful for enterprise administrators to add organization-specific context (e.g., "All plugins from our internal marketplace are vetted and approved.").`),workspaceApiKey:h().optional().describe(`Workspace API key (sk-ant-api03-*) saved via /login UI. Stored in plaintext — keep this file gitignored and restrict its permissions. ANTHROPIC_API_KEY environment variable takes precedence when both are set.`)}).passthrough())}));function Ks(){return ot(se(J(),{unrepresentable:`any`}),null,2)}var qs=e((()=>{T(),mt(),Gs()}));function Js(e){let t=Ys.find(t=>t.matches(e));if(!t)return null;let n={...t.tip};if(e.code===`invalid_value`&&e.enumValues&&!n.suggestion&&(n.suggestion=`Valid values: ${e.enumValues.map(e=>`"${e}"`).join(`, `)}`),!n.docLink&&e.path){let t=e.path.split(`.`)[0];t&&(n.docLink=Xs[t])}return n}var Y,Ys,Xs,Zs=e((()=>{Y=`https://code.claude.com/docs/en`,Ys=[{matches:e=>e.path===`permissions.defaultMode`&&e.code===`invalid_value`,tip:{suggestion:`Valid modes: "acceptEdits" (ask before file changes), "plan" (analysis only), "bypassPermissions" (auto-accept all), or "default" (standard behavior)`,docLink:`${Y}/iam#permission-modes`}},{matches:e=>e.path===`apiKeyHelper`&&e.code===`invalid_type`,tip:{suggestion:`Provide a shell command that outputs your API key to stdout. The script should output only the API key. Example: "/bin/generate_temp_api_key.sh"`}},{matches:e=>e.path===`cleanupPeriodDays`&&e.code===`too_small`&&e.expected===`0`,tip:{suggestion:`Must be 0 or greater. Set a positive number for days to retain transcripts (default is 30). Setting 0 disables session persistence entirely: no transcripts are written and existing transcripts are deleted at startup.`}},{matches:e=>e.path.startsWith(`env.`)&&e.code===`invalid_type`,tip:{suggestion:`Environment variables must be strings. Wrap numbers and booleans in quotes. Example: "DEBUG": "true", "PORT": "3000"`,docLink:`${Y}/settings#environment-variables`}},{matches:e=>(e.path===`permissions.allow`||e.path===`permissions.deny`)&&e.code===`invalid_type`&&e.expected===`array`,tip:{suggestion:`Permission rules must be in an array. Format: ["Tool(specifier)"]. Examples: ["Bash(npm run build)", "Edit(docs/**)", "Read(~/.zshrc)"]. Use * for wildcards.`}},{matches:e=>e.path.includes(`hooks`)&&e.code===`invalid_type`,tip:{suggestion:`Hooks use a matcher + hooks array. The matcher is a string: a tool name ("Bash"), pipe-separated list ("Edit|Write"), or empty to match all. Example: {"PostToolUse": [{"matcher": "Edit|Write", "hooks": [{"type": "command", "command": "echo Done"}]}]}`}},{matches:e=>e.code===`invalid_type`&&e.expected===`boolean`,tip:{suggestion:`Use true or false without quotes. Example: "includeCoAuthoredBy": true`}},{matches:e=>e.code===`unrecognized_keys`,tip:{suggestion:`Check for typos or refer to the documentation for valid fields`,docLink:`${Y}/settings`}},{matches:e=>e.code===`invalid_value`&&e.enumValues!==void 0,tip:{suggestion:void 0}},{matches:e=>e.code===`invalid_type`&&e.expected===`object`&&e.received===null&&e.path===``,tip:{suggestion:`Check for missing commas, unmatched brackets, or trailing commas. Use a JSON validator to identify the exact syntax error.`}},{matches:e=>e.path===`permissions.additionalDirectories`&&e.code===`invalid_type`,tip:{suggestion:`Must be an array of directory paths. Example: ["~/projects", "/tmp/workspace"]. You can also use --add-dir flag or /add-dir command`,docLink:`${Y}/iam#working-directories`}}],Xs={permissions:`${Y}/iam#configuring-permissions`,env:`${Y}/settings#environment-variables`,hooks:`${Y}/hooks`}}));function Qs(e){return e.code===`invalid_type`}function $s(e){return e.code===`invalid_value`}function ec(e){return e.code===`unrecognized_keys`}function tc(e){return e.code===`too_small`}function nc(e){return e===null?`null`:e===void 0?`undefined`:Array.isArray(e)?`array`:typeof e}function rc(e){let t=e.match(/received (\w+)/);return t?t[1]:void 0}function ic(e,t){return e.issues.map(e=>{let n=e.path.map(String).join(`.`),r=e.message,i,a,o,s,c;if($s(e))a=e.values.map(e=>String(e)),o=a.join(` | `),s=void 0,c=void 0;else if(Qs(e)){o=e.expected;let t=rc(e.message);s=t??nc(e.input),c=t??nc(e.input)}else tc(e)?o=String(e.minimum):e.code===`custom`&&`params`in e&&(s=e.params.received,c=s);let ee=Js({path:n,code:e.code,expected:o,received:s,enumValues:a,message:e.message,value:s});if($s(e))i=a?.map(e=>`"${e}"`).join(`, `),r=`Invalid value. Expected one of: ${i}`;else if(Qs(e)){let t=rc(e.message)??nc(e.input);r=e.expected===`object`&&t===`null`&&n===``?`Invalid or malformed JSON`:`Expected ${e.expected}, but received ${t}`}else if(ec(e)){let t=e.keys.join(`, `);r=`Unrecognized ${Ht(e.keys.length,`field`)}: ${t}`}else tc(e)&&(r=`Number must be greater than or equal to ${e.minimum}`,i=String(e.minimum));return{file:t,path:n,message:r,expected:i,invalidValue:c,suggestion:ee?.suggestion,docLink:ee?.docLink}})}function ac(e){try{let t=lt(e),n=J().strict().safeParse(t);return n.success?{isValid:!0}:{isValid:!1,error:`Settings validation failed:
18
- `+ic(n.error,`settings`).map(e=>`- ${e.path}: ${e.message}`).join(`
19
- `),fullSchema:Ks()}}catch(e){return{isValid:!1,error:`Invalid JSON: ${e instanceof Error?e.message:`Unknown parsing error`}`,fullSchema:Ks()}}}function oc(e,t){if(!e||typeof e!=`object`)return[];let n=e;if(!n.permissions||typeof n.permissions!=`object`)return[];let r=n.permissions,i=[];for(let e of[`allow`,`deny`,`ask`]){let n=r[e];Array.isArray(n)&&(r[e]=n.filter(n=>{if(typeof n!=`string`)return i.push({file:t,path:`permissions.${e}`,message:`Non-string value in ${e} array was removed`,invalidValue:n}),!1;let r=Ns(n,e);if(!r.valid){let a=`Invalid permission rule "${n}" was skipped`;return r.error&&(a+=`: ${r.error}`),r.suggestion&&(a+=`. ${r.suggestion}`),i.push({file:t,path:`permissions.${e}`,message:a,invalidValue:n}),!1}return!0}))}return i}var sc=e((()=>{mt(),Wt(),Fs(),qs(),Gs(),Zs()}));function cc(){let e=``;try{e=qt().username}catch{}let t=[];return e&&t.push({path:`/Library/Managed Preferences/${e}/${lc}.plist`,label:`per-user managed preferences`}),t.push({path:`/Library/Managed Preferences/${lc}.plist`,label:`device-level managed preferences`}),t}var lc,uc,dc,fc,pc,mc,hc,gc=e((()=>{lc=`com.anthropic.claudecode`,uc=`HKLM\\SOFTWARE\\Policies\\ClaudeCode`,dc=`HKCU\\SOFTWARE\\Policies\\ClaudeCode`,fc=`Settings`,pc=`/usr/bin/plutil`,mc=[`-convert`,`json`,`-o`,`-`,`--`],hc=5e3}));function _c(e,t){return new Promise(n=>{dn(e,t,{encoding:`utf-8`,timeout:hc},(e,t)=>{n({stdout:t??``,code:+!!e})})})}function vc(){return(async()=>{if(process.platform===`darwin`){let e=cc(),t=(await Promise.all(e.map(async({path:e,label:t})=>{if(!nn(e))return{stdout:``,label:t,ok:!1};let{stdout:n,code:r}=await _c(pc,[...mc,e]);return{stdout:n,label:t,ok:r===0&&!!n}}))).find(e=>e.ok);return{plistStdouts:t?[{stdout:t.stdout,label:t.label}]:[],hklmStdout:null,hkcuStdout:null}}if(process.platform===`win32`){let[e,t]=await Promise.all([_c(`reg`,[`query`,uc,`/v`,fc]),_c(`reg`,[`query`,dc,`/v`,fc])]);return{plistStdouts:null,hklmStdout:e.code===0?e.stdout:null,hkcuStdout:t.code===0?t.stdout:null}}return{plistStdouts:null,hklmStdout:null,hkcuStdout:null}})()}function yc(){xc||(xc=vc())}function bc(){return xc}var xc,Sc=e((()=>{gc(),xc=null}));function Cc(){Fc||(Fc=(async()=>{It(`mdm_load_start`);let e=Date.now(),{mdm:t,hkcu:n}=jc(await(bc()??vc()));Nc=t,Pc=n,It(`mdm_load_end`);let r=Date.now()-e;if(D(`MDM settings load completed in ${r}ms`),Object.keys(t.settings).length>0){D(`MDM settings found: ${Object.keys(t.settings).join(`, `)}`);try{gt(`info`,`mdm_settings_loaded`,{duration_ms:r,key_count:Object.keys(t.settings).length,error_count:t.errors.length})}catch{}}})())}async function wc(){Fc||Cc(),await Fc}function Tc(){return Nc??X}function Ec(){return Pc??X}function Dc(e,t){Nc=e,Pc=t}async function Oc(){return jc(await vc())}function kc(e,t){let n=M(e,!1);if(!n||typeof n!=`object`)return{settings:{},errors:[]};let r=oc(n,t),i=J().safeParse(n);if(!i.success){let e=ic(i.error,t);return{settings:{},errors:[...r,...e]}}return{settings:i.data,errors:r}}function Ac(e,t=`Settings`){let n=e.split(/\r?\n/),r=t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`^\\s+${r}\\s+REG_(?:EXPAND_)?SZ\\s+(.*)$`,`i`);for(let e of n){let t=e.match(i);if(t&&t[1])return t[1].trimEnd()}return null}function jc(e){if(e.plistStdouts&&e.plistStdouts.length>0){let{stdout:t,label:n}=e.plistStdouts[0],r=kc(t,n);if(Object.keys(r.settings).length>0)return{mdm:r,hkcu:X}}if(e.hklmStdout){let t=Ac(e.hklmStdout);if(t){let e=kc(t,`Registry: ${uc}\\${fc}`);if(Object.keys(e.settings).length>0)return{mdm:e,hkcu:X}}}if(Mc())return{mdm:X,hkcu:X};if(e.hkcuStdout){let t=Ac(e.hkcuStdout);if(t){let e=kc(t,`Registry: ${dc}\\${fc}`);return{mdm:X,hkcu:e}}}return{mdm:X,hkcu:X}}function Mc(){try{let e=M(R(P(ta(),`managed-settings.json`)),!1);if(e&&typeof e==`object`&&Object.keys(e).length>0)return!0}catch{}try{let e=na(),t=k().readdirSync(e);for(let n of t)if(!(!(n.isFile()||n.isSymbolicLink())||!n.name.endsWith(`.json`)||n.name.startsWith(`.`)))try{let t=M(R(P(e,n.name)),!1);if(t&&typeof t==`object`&&Object.keys(t).length>0)return!0}catch{}}catch{}return!1}var X,Nc,Pc,Fc,Ic=e((()=>{pt(),ht(),Jr(),O(),Mt(),Ft(),ra(),Gs(),sc(),gc(),Sc(),X=Object.freeze({settings:{},errors:[]}),Nc=null,Pc=null,Fc=null}));function Lc(){return P(ta(),`managed-settings.json`)}function Rc(){let e=[],t={},n=!1,{settings:r,errors:i}=Z(Lc());e.push(...i),r&&Object.keys(r).length>0&&(t=L(t,r,$),n=!0);let a=na();try{let r=k().readdirSync(a).filter(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`)).map(e=>e.name).sort();for(let i of r){let{settings:r,errors:o}=Z(P(a,i));e.push(...o),r&&Object.keys(r).length>0&&(t=L(t,r,$),n=!0)}}catch(e){let t=st(e);t!==`ENOENT`&&t!==`ENOTDIR`&&A(e)}return{settings:n?t:null,errors:e}}function zc(){let{settings:e}=Z(Lc()),t=!!e&&Object.keys(e).length>0,n=!1,r=na();try{n=k().readdirSync(r).some(e=>(e.isFile()||e.isSymbolicLink())&&e.name.endsWith(`.json`)&&!e.name.startsWith(`.`))}catch{}return{hasBase:t,hasDropIns:n}}function Bc(e,t){typeof e==`object`&&e&&`code`in e&&e.code===`ENOENT`?D(`Broken symlink or missing file encountered for settings.json at path: ${t}`):A(e)}function Z(e){let t=Be(e);if(t)return{settings:t.settings?dt(t.settings):null,errors:t.errors};let n=Vc(e);return Qe(e,n),{settings:n.settings?dt(n.settings):null,errors:n.errors}}function Vc(e){try{let{resolvedPath:t}=ft(k(),e),n=R(t);if(n.trim()===``)return{settings:{},errors:[]};let r=M(n,!1),i=oc(r,e),a=J().safeParse(r);if(!a.success){let t=ic(a.error,e);return{settings:null,errors:[...i,...t]}}return{settings:a.data,errors:i}}catch(t){return Bc(t,e),{settings:null,errors:[]}}}function Hc(e){switch(e){case`userSettings`:return F(m());case`policySettings`:case`projectSettings`:case`localSettings`:return F(ze());case`flagSettings`:{let e=Ee();return e?N(F(e)):F(ze())}}}function Uc(){return Ce()||p(process.env.CLAUDE_CODE_USE_COWORK_PLUGINS)?`cowork_settings.json`:`settings.json`}function Wc(e){switch(e){case`userSettings`:return P(Hc(e),Uc());case`projectSettings`:case`localSettings`:return P(Hc(e),Gc(e));case`policySettings`:return Lc();case`flagSettings`:return Ee()}}function Gc(e){switch(e){case`projectSettings`:return P(`.claude`,`settings.json`);case`localSettings`:return P(`.claude`,`settings.local.json`)}}function Q(e){let t=Ke(e);if(t!==void 0)return t;let n=Kc(e);return nt(e,n),n}function Kc(e){if(e===`policySettings`){let e=ei();if(e&&Object.keys(e).length>0)return e;let t=Tc();if(Object.keys(t.settings).length>0)return t.settings;let{settings:n}=Rc();if(n)return n;let r=Ec();return Object.keys(r.settings).length>0?r.settings:null}let t=Wc(e),{settings:n}=t?Z(t):{settings:null};if(e===`flagSettings`){let e=we();if(e){let t=J().safeParse(e);if(t.success)return L(n||{},t.data,$)}}return n}function qc(){let e=ei();if(e&&Object.keys(e).length>0)return`remote`;let t=Tc();if(Object.keys(t.settings).length>0)return j()===`macos`?`plist`:`hklm`;let{settings:n}=Rc();if(n)return`file`;let r=Ec();return Object.keys(r.settings).length>0?`hkcu`:null}function Jc(e,t){if(e===`policySettings`||e===`flagSettings`)return{error:null};let n=Wc(e);if(!n)return{error:null};try{k().mkdirSync(N(n));let r=Kc(e);if(!r){let e=null;try{e=R(n)}catch(e){if(!at(e))throw e}if(e!==null){let t=M(e);if(t===null)return{error:Error(`Invalid JSON syntax in settings file at ${n}`)};t&&typeof t==`object`&&(r=t,D(`Using raw settings from ${n} due to validation failure`))}}let i=L(r||{},t,(e,t,n,r)=>{if(t===void 0&&r&&typeof n==`string`){delete r[n];return}if(Array.isArray(t))return t});Xi(n),Oi(n,ot(i,null,2)+`
20
- `),Pe(),e===`localSettings`&&Li(Gc(`localSettings`),ze())}catch(e){let t=Error(`Failed to read raw settings from ${n}: ${e}`);return A(t),{error:t}}return{error:null}}function Yc(e,t){return oi([...e,...t])}function $(e,t){if(Array.isArray(e)&&Array.isArray(t))return Yc(e,t)}function Xc(e){let t=J().strip().parse(e),n=[`permissions`,`sandbox`,`hooks`],r=[],i={permissions:new Set([`allow`,`deny`,`ask`,`defaultMode`,`disableBypassPermissionsMode`,`disableAutoMode`,`additionalDirectories`]),sandbox:new Set([`enabled`,`failIfUnavailable`,`allowUnsandboxedCommands`,`network`,`filesystem`,`ignoreViolations`,`excludedCommands`,`autoAllowBashIfSandboxed`,`enableWeakerNestedSandbox`,`enableWeakerNetworkIsolation`,`ripgrep`]),hooks:new Set([`PreToolUse`,`PostToolUse`,`Notification`,`UserPromptSubmit`,`SessionStart`,`SessionEnd`,`Stop`,`SubagentStop`,`PreCompact`,`PostCompact`,`TeammateIdle`,`TaskCreated`,`TaskCompleted`])};for(let e of Object.keys(t))if(n.includes(e)&&t[e]&&typeof t[e]==`object`){let n=t[e],a=i[e];if(a)for(let t of Object.keys(n))a.has(t)&&r.push(`${e}.${t}`)}else r.push(e);return r.sort()}function Zc(){if(ol)return{settings:{},errors:[]};let e=Date.now();It(`loadSettingsFromDisk_start`),gt(`info`,`settings_load_started`),ol=!0;try{let t=We(),n={};t&&(n=L(n,t,$));let r=[],i=new Set,a=new Set;for(let e of Wi()){if(e===`policySettings`){let e=null,t=[],a=ei();if(a&&Object.keys(a).length>0){let n=J().safeParse(a);n.success?e=n.data:t.push(...ic(n.error,`remote managed settings`))}if(!e){let n=Tc();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}if(!e){let{settings:n,errors:r}=Rc();n&&(e=n),t.push(...r)}if(!e){let n=Ec();Object.keys(n.settings).length>0&&(e=n.settings),t.push(...n.errors)}e&&(n=L(n,e,$));for(let e of t){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}continue}let t=Wc(e);if(t){let e=F(t);if(!a.has(e)){a.add(e);let{settings:o,errors:s}=Z(t);for(let e of s){let t=`${e.file}:${e.path}:${e.message}`;i.has(t)||(i.add(t),r.push(e))}o&&(n=L(n,o,$))}}if(e===`flagSettings`){let e=we();if(e){let t=J().safeParse(e);t.success&&(n=L(n,t.data,$))}}}return gt(`info`,`settings_load_completed`,{duration_ms:Date.now()-e,source_count:a.size,error_count:r.length}),{settings:n,errors:r}}finally{ol=!1}}function Qc(){let{settings:e}=el();return e||{}}function $c(){Pe();let e=[];for(let t of Wi()){let n=Q(t);n&&Object.keys(n).length>0&&e.push({source:t,settings:n})}return{effective:Qc(),sources:e}}function el(){let e=He();if(e!==null)return e;let t=Zc();return It(`loadSettingsFromDisk_end`),tt(t),t}function tl(){return!!(Q(`userSettings`)?.skipDangerousModePermissionPrompt||Q(`localSettings`)?.skipDangerousModePermissionPrompt||Q(`flagSettings`)?.skipDangerousModePermissionPrompt||Q(`policySettings`)?.skipDangerousModePermissionPrompt)}function nl(){return!0}function rl(){return Q(`policySettings`)?.useAutoModeDuringPlan!==!1&&Q(`flagSettings`)?.useAutoModeDuringPlan!==!1&&Q(`userSettings`)?.useAutoModeDuringPlan!==!1&&Q(`localSettings`)?.useAutoModeDuringPlan!==!1}function il(){{let e=C({allow:S(h()).optional(),soft_deny:S(h()).optional(),deny:S(h()).optional(),environment:S(h()).optional()}),t=[],n=[],r=[];for(let i of[`userSettings`,`localSettings`,`flagSettings`,`policySettings`]){let a=Q(i);if(!a)continue;let o=e.safeParse(a.autoMode);o.success&&(o.data.allow&&t.push(...o.data.allow),o.data.soft_deny&&n.push(...o.data.soft_deny),o.data.environment&&r.push(...o.data.environment))}if(t.length>0||n.length>0||r.length>0)return{...t.length>0&&{allow:t},...n.length>0&&{soft_deny:n},...r.length>0&&{environment:r}}}}function al(e){for(let t of Wi()){if(t===`policySettings`)continue;let n=Wc(t);if(n)try{let{resolvedPath:t}=ft(k(),n),r=R(t);if(!r.trim())continue;let i=M(r,!1);if(i&&typeof i==`object`&&e in i)return!0}catch(e){Bc(e,n)}}return!1}var ol,sl,cl=e((()=>{Wr(),T(),Ae(),ri(),si(),pt(),ht(),ne(),ct(),Pi(),Jr(),O(),Ri(),Mt(),xt(),wt(),mt(),Ft(),Yi(),ea(),ra(),Ic(),Ve(),Gs(),sc(),ol=!1,sl=Qc}));export{ts as $,Er as $n,Qi as $t,sc as A,ji as An,mn as Ar,La as At,q as B,oi as Bn,Ea as Bt,Ec as C,mi as Cn,En as Cr,H as Ct,Dc as D,ki as Dn,hn as Dr,Ga as Dt,Oc as E,Ei as En,yn as Er,Ja as Et,Ls as F,Oi as Fn,ja as Ft,hs as G,Zr as Gn,va as Gt,bs as H,Qr as Hn,xa as Ht,Is as I,hi as In,Pa as It,os as J,Jr as Jn,da as Jt,ds as K,Yr as Kn,V as Kt,Rs as L,ai as Ln,Fa as Lt,Ws as M,Di as Mn,za as Mt,J as N,Ti as Nn,Na as Nt,Sc as O,Ai as On,_n as Or,Va as Ot,Gs as P,Si as Pn,Oa as Pt,us as Q,Ir as Qn,ra as Qt,gs as R,si as Rn,Ma as Rt,wc as S,pi as Sn,Mn as Sr,no as St,Ic as T,Ci as Tn,vn as Tr,qa as Tt,ms as U,ri as Un,Sa as Ut,ys as V,ei as Vn,Da as Vt,ps as W,Xr as Wn,Ca as Wt,ls as X,qr as Xn,ta as Xt,ss as Y,R as Yn,ba as Yt,cs as Z,Lr as Zn,na as Zt,Rc as _,vi as _n,Fn as _r,zo as _t,qc as a,Hi as an,Yn as ar,$o as at,$ as b,xi as bn,Pn as br,ro as bt,Q as c,Bi as cn,Zn as cr,U as ct,$c as d,Ui as dn,Wn as dr,Jo as dt,Zi as en,wr as er,is as et,sl as f,Ri as fn,Gn as fr,ko as ft,cl as g,wi as gn,Rn as gr,Ro as gt,tl as h,Mi as hn,Ln as hr,No as ht,Xc as i,Wi as in,rr as ir,as as it,ac as j,fi as jn,Ia as jt,yc as k,di as kn,pn as kr,Ha as kt,Hc as l,Yi as ln,Xn as lr,Uo as lt,nl as m,Ni as mn,Bn as mr,K as mt,Qc as n,Ki as nn,or as nr,es as nt,Gc as o,Vi as on,Kn as or,Qo as ot,rl as p,Fi as pn,zn as pr,go as pt,fs as q,Gr as qn,fa as qt,zc as r,qi as rn,nr as rr,ns as rt,Wc as s,zi as sn,Jn as sr,Xo as st,il as t,ea as tn,pr as tr,rs as tt,el as u,Gi as un,qn as ur,Ko as ut,Z as v,gi as vn,In as vr,Yo as vt,Tc as w,Pi as wn,Tn as wr,$a as wt,Jc as x,bi as xn,Dn as xr,eo as xt,al as y,_i as yn,Nn as yr,io as yt,ws as z,ii as zn,Aa as zt};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Sb as t,ry as n}from"./loadAgentsDir-BL93ulMm.js";import{A as r,C as i,O as a,w as o}from"./external-CEp-aPkt.js";import{n as s,r as c,t as l}from"./lazySchema-B4D4qJVE.js";import{Wt as u}from"./state-BemZdQIl.js";import{R as d}from"./debug-BecbSVoN.js";import{g as f}from"./settings-D4CpDv2y.js";import{h as p}from"./config-aRiTrtCv.js";import{O as m,m as h}from"./git-DBlOv64X.js";import{u as g}from"./oauth-C9VBDB0Y.js";import{Bt as _,si as v}from"./model-Bgh_r4lg.js";import"path";import"fs/promises";var y,b=e((()=>{c(),l(),y=s(()=>o({entries:a(r(),r())})),s(()=>o({userId:r(),version:i(),lastModified:r(),checksum:r(),content:y()}))})),x=e((()=>{u(),g(),_(),t(),p(),m(),d(),h(),v(),f(),n(),b()}));export{x as t};
@@ -1,3 +0,0 @@
1
- import{n as e,t}from"./memoize-BK3gG5ob.js";import{l as n,o as r,s as i}from"./envUtils-BDhHQY0-.js";import{$m as a,$v as o,AC as s,AE as c,Ba as l,Bi as u,Bv as d,Cr as f,Fi as ee,Fn as p,Fv as m,Gv as h,Hv as te,In as ne,Iv as re,Jm as ie,Lv as ae,ME as oe,Nt as g,Nv as _,Pn as se,Pv as ce,Qv as le,Ra as v,Rv as ue,Sb as de,Ta as fe,Tt as pe,Uv as me,Vv as he,Wv as ge,Ym as y,_b as b,_n as x,_v as S,_w as C,c_ as w,cc as T,dw as E,eh as D,fc as O,hw as k,kC as A,lc as j,lt as M,mc as N,mi as P,mw as F,s_ as I,th as L,ty as R,uw as _e,vm as ve,vn as ye,vt as be,vw as xe,xt as z,xv as Se,ym as Ce,yt as we,yw as Te,zv as Ee}from"./loadAgentsDir-BL93ulMm.js";import{di as De,ui as B}from"./src-P_wYS_NJ2.js";import{B as Oe,Bn as ke,Hn as Ae,Wt as V,it as je,or as Me,pt as Ne,z as H}from"./state-BemZdQIl.js";import{n as Pe,t as U}from"./cwd-Cfdf7z7s.js";import{F as Fe,P as Ie,R as W,f as G,u as Le}from"./debug-BecbSVoN.js";import{Kt as Re,Ln as ze,Rn as Be,Yt as Ve}from"./settings-D4CpDv2y.js";import{h as He,o as Ue}from"./config-aRiTrtCv.js";import{O as We,k as K,l as Ge,m as Ke,n as qe,r as Je}from"./git-DBlOv64X.js";import{o as Ye,s as Xe}from"./log-Dauqle-Z.js";import{n as q,r as J}from"./analytics-DJobLaWP.js";import{n as Ze,r as Y}from"./startupProfiler-CmH_aVy2.js";import{Bt as Qe,ei as $e,rn as et,ti as tt}from"./model-Bgh_r4lg.js";import{fn as X,hn as nt}from"./prompt-Dx7IWhBt.js";import{h as rt,l as it,p as at,u as ot}from"./terminalSetup-Cy19F1Js.js";import{ft as st,ut as Z}from"./esm-Ka3lhafK.js";import{c as ct,t as lt}from"./nativeInstaller-BEwayifa.js";import{l as ut,s as dt}from"./logoV2Utils-CkvOihX7.js";import{i as ft,r as pt}from"./runtimeObserver-L7pSIWBT.js";import{t as mt}from"./sinks-f7qYjbKJ.js";import{writeFile as Q}from"fs/promises";r(),De(),Pe(),We(),Ye(),Ke(),Ve(),He(),Qe(),oe(),xe(),F(),_e(),w(),u(),f(),ye(),t(),V(),M(),Se(),nt(),s(),Be(),O(),G(),ve(),l(),ne(),$e(),S(),o(),q(),ie(),D(),ue(),W();function ht(){return!1}function gt(){return{}}var $;function _t(e,t){let n=0,r=t==null;for(let i of e){if(!r){i.uuid===t&&(r=!0);continue}if(i.type===`assistant`){let e=i.message.content;Array.isArray(e)&&(n+=ze(e,e=>e.type===`tool_use`))}}return n}function vt(e){let t=R(e);if(!Ee()){if(!re(t))return!1;te()}let n=ae(t),r=_t(e,$)>=m(),i=v(e);if(n&&r||n&&!i){let t=e[e.length-1];return t?.uuid&&($=t.uuid),!0}return!1}async function yt(e){let t=Le(),n=se();await t.mkdir(n,{mode:448});let r=p();try{await Q(r,``,{encoding:`utf-8`,mode:384,flag:`wx`}),await Q(r,await L(),{encoding:`utf-8`,mode:384})}catch(e){if(Fe(e)!==`EEXIST`)throw e}e.readFileState.delete(r);let i=await A.call({file_path:r},e),a=``,o=i.data;return o.type===`text`&&(a=o.file.content),J(`tengu_session_memory_file_read`,{content_length:a.length}),{memoryPath:r,currentMemory:a}}var bt=e(()=>{let e=gt();h({minimumMessageTokensToInit:e.minimumMessageTokensToInit&&e.minimumMessageTokensToInit>0?e.minimumMessageTokensToInit:_.minimumMessageTokensToInit,minimumTokensBetweenUpdate:e.minimumTokensBetweenUpdate&&e.minimumTokensBetweenUpdate>0?e.minimumTokensBetweenUpdate:_.minimumTokensBetweenUpdate,toolCallsBetweenUpdates:e.toolCallsBetweenUpdates&&e.toolCallsBetweenUpdates>0?e.toolCallsBetweenUpdates:_.toolCallsBetweenUpdates})}),xt=tt(async function(e){let{messages:t,toolUseContext:n,querySource:r}=e;if(r!==`repl_main_thread`)return;{let{isPoorModeActive:e}=await import(`./poorMode-yH1o41cQ.js`);if(e())return}if(!ht()||(bt(),!vt(t)))return;he();let i=j(n),{memoryPath:o,currentMemory:s}=await yt(i);await N({promptMessages:[fe({content:await a(s,o)})],cacheSafeParams:T(e),canUseTool:Ct(o),querySource:`session_memory`,forkLabel:`session_memory`,overrides:{readFileState:i.readFileState}});let c=t[t.length-1],l=c?le(c):void 0,u=ce();J(`tengu_session_memory_extraction`,{input_tokens:l?.input_tokens,output_tokens:l?.output_tokens,cache_read_input_tokens:l?.cache_read_input_tokens??void 0,cache_creation_input_tokens:l?.cache_creation_input_tokens??void 0,config_min_message_tokens_to_init:u.minimumMessageTokensToInit,config_min_tokens_between_update:u.minimumTokensBetweenUpdate,config_tool_calls_between_updates:u.toolCallsBetweenUpdates}),me(R(t)),wt(t),d()});function St(){Oe()||y()&&Ce(xt)}function Ct(e){return async(t,n)=>{if(t.name===`Edit`&&typeof n==`object`&&n&&`file_path`in n){let t=n.file_path;if(typeof t==`string`&&t===e)return{behavior:`allow`,updatedInput:n}}return{behavior:`deny`,message:`only ${X} on ${e} is allowed`,decisionReason:{type:`other`,reason:`only ${X} on ${e} is allowed`}}}}function wt(e){if(!v(e)){let t=e[e.length-1];t?.uuid&&ge(t.uuid)}}q(),V(),ft(),ot(),de(),st(),W(),ut(),lt(),at(),Ze(),pe();async function Tt(e,t,r,a,o,s,l,u,d){K(`info`,`setup_started`);let f=process.version.match(/^v(\d+)\./)?.[1];if((!f||parseInt(f,10)<18)&&(console.error(B.bold.red(`Error: Work Mate requires Node.js version 18 or higher.`)),process.exit(1)),l&&Me(I(l)),!H())try{let e=await it();e.status===`restored`?console.log(B.yellow(`Detected an interrupted Terminal.app setup. Your original settings have been restored. You may need to restart Terminal.app for the changes to take effect.`)):e.status===`failed`&&console.error(B.red(`Failed to restore Terminal.app settings. Please manually restore your original settings with: defaults import com.apple.Terminal ${e.backupPath}.`))}catch(e){Xe(e)}E(e);let p=Date.now();if(C(),K(`info`,`setup_hooks_captured`,{duration_ms:Date.now()-p}),k(e),a){let t=x(),n=await Ge();!t&&!n&&(process.stderr.write(B.red(`Error: Can only use --worktree in a git repository, but ${B.bold(e)} is not a git repository. Configure a WorktreeCreate hook in settings.json to use --worktree with other VCS systems.\n`)),process.exit(1));let r=u?`pr-${u}`:o??c(),i;if(n){let e=qe(U());e||(process.stderr.write(B.red(`Error: Could not determine the main git repository root.
2
- `)),process.exit(1)),e!==(Je(U())??U())&&(K(`info`,`worktree_resolved_to_main_repo`),process.chdir(e),E(e)),i=s?z(e,g(r)):void 0}else i=s?z(U(),g(r)):void 0;let a;try{a=await we(Ne(),r,i,u?{prNumber:u}:void 0)}catch(e){process.stderr.write(B.red(`Error creating worktree: ${Ie(e)}\n`)),process.exit(1)}if(J(`tengu_worktree_created`,{tmux_enabled:s}),s&&i){let e=await be(i,a.worktreePath);e.created?console.log(B.green(`Created tmux session: ${B.bold(i)}\nTo attach: ${B.bold(`tmux attach -t ${i}`)}`)):console.error(B.yellow(`Warning: Failed to create tmux session: ${e.error}`))}process.chdir(a.worktreePath),E(a.worktreePath),ke(U()),Ae(U()),P(a),b(),Te()}K(`info`,`setup_background_jobs_starting`),i()||(St(),pt()),ct(),K(`info`,`setup_background_jobs_launched`),Y(`setup_before_prefetch`),K(`info`,`setup_prefetch_starting`);let m=H()&&n(process.env.CLAUDE_CODE_SYNC_PLUGIN_INSTALL)||i();if(m||ee(je()),import(`./loadPluginHooks-B0au35a4.js`).then(e=>{m||(e.loadPluginHooks(),e.setupPluginHookHotReload())}),i()||(setImmediate(()=>{import(`./attributionHooks-CUAoGkU6.js`).then(({registerAttributionHooks:e})=>{e()})}),import(`./sessionFileAccessHooks-Czen7Ejz.js`).then(e=>e.registerSessionFileAccessHooks())),mt(),J(`tengu_started`,{}),et(H()),Y(`setup_after_prefetch`),!i()&&rt()&&await dt(),t===`bypassPermissions`||r){if(process.platform!==`win32`&&typeof process.getuid==`function`&&process.getuid()===0&&process.env.IS_SANDBOX!==`1`&&!n(process.env.CLAUDE_CODE_BUBBLEWRAP))if(process.stdin.isTTY){console.error(B.bold.red(`WARNING: Running as root/sudo with bypass permissions mode is dangerous.`)),console.error(B.yellow(`Bypass mode skips ALL permission checks. Combined with root, any command (rm -rf /, chmod, dd) executes without review.`));let e=(await import(`readline`)).createInterface({input:process.stdin,output:process.stdout}),t=await new Promise(t=>{e.question(`
3
- I understand the risks. Continue? [y/N] `,t)});e.close(),t.trim().toLowerCase()!==`y`&&(console.error(`Aborted.`),process.exit(1))}else console.error(`--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons`),process.exit(1);if(process.env.CLAUDE_CODE_ENTRYPOINT!==`local-agent`&&process.env.CLAUDE_CODE_ENTRYPOINT!==`claude-desktop`){let[e,t]=await Promise.all([Z.getIsDocker(),Re.hasInternetAccess()]),n=Z.getIsBubblewrapSandbox(),r=process.env.IS_SANDBOX===`1`;(!(e||n||r)||t)&&(console.error(`--dangerously-skip-permissions can only be used in Docker/sandbox containers with no internet access but got Docker: ${e}, Bubblewrap: ${n}, IS_SANDBOX: ${r}, hasInternet: ${t}`),process.exit(1))}}let h=Ue();h.lastCost!==void 0&&h.lastDuration!==void 0&&J(`tengu_exit`,{last_session_cost:h.lastCost,last_session_api_duration:h.lastAPIDuration,last_session_tool_duration:h.lastToolDuration,last_session_duration:h.lastDuration,last_session_lines_added:h.lastLinesAdded,last_session_lines_removed:h.lastLinesRemoved,last_session_total_input_tokens:h.lastTotalInputTokens,last_session_total_output_tokens:h.lastTotalOutputTokens,last_session_total_cache_creation_input_tokens:h.lastTotalCacheCreationInputTokens,last_session_total_cache_read_input_tokens:h.lastTotalCacheReadInputTokens,last_session_fps_average:h.lastFpsAverage,last_session_fps_low_1_pct:h.lastFpsLow1Pct,last_session_id:h.lastSessionId,...h.lastSessionMetrics})}export{Tt as setup};
@@ -1 +0,0 @@
1
- import{t as e}from"./sinks-f7qYjbKJ.js";export{e as initSinks};
@@ -1 +0,0 @@
1
- import{a as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$i as t,A_ as n,Ai as r,As as i,Bi as a,CE as o,Cc as ee,Ch as s,Cr as c,DC as te,Ft as ne,Gg as re,Kh as ie,ME as ae,OC as oe,Qi as l,Sb as se,St as u,Tt as d,Ug as ce,Vn as le,Xh as ue,Xi as de,Xy as f,Yh as p,Zy as m,_b as h,_l as fe,ai as pe,c_ as me,di as he,dw as g,ea as ge,gl as _e,hn as ve,ii as ye,jE as _,js as be,jt as v,k_ as y,ki as b,mi as x,qr as S,s_ as C,uw as w,vc as T,vn as E,wE as D,wh as O}from"./loadAgentsDir-BL93ulMm.js";import{Bn as k,J as A,Mn as j,Nn as M,Wt as N,h as xe,lr as Se,or as Ce,pt as P,ur as we}from"./state-BemZdQIl.js";import{n as Te,t as F}from"./cwd-Cfdf7z7s.js";import{c as I,f as Ee,i as L,nt as De,tt as Oe,u as R}from"./debug-BecbSVoN.js";import{n as ke,r as Ae}from"./analytics-DJobLaWP.js";import{C as je,_ as Me}from"./model-Bgh_r4lg.js";import{Kt as Ne}from"./prompt-Dx7IWhBt.js";import*as z from"path";import{dirname as Pe}from"path";N(),n(),f(),Ne(),me(),se(),p(),T(),Te(),L(),re(),Me(),ae(),w(),c(),te(),O(),d();function Fe(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n?.type!==`assistant`)continue;let r=n.message.content.find(e=>e.type===`tool_use`&&e.name===`TodoWrite`);if(!r||r.type!==`tool_use`)continue;let i=r.input;if(typeof i!=`object`||!i)return[];let a=s().safeParse(i.todos);return a.success?a.data:[]}return[]}function Ie(e,t){if(e.fileHistorySnapshots&&e.fileHistorySnapshots.length>0&&ce(e.fileHistorySnapshots,e=>{t(t=>({...t,fileHistory:e}))}),e.attributionSnapshots&&e.attributionSnapshots.length>0&&ie(e.attributionSnapshots,e=>{t(t=>({...t,attribution:e}))}),!oe()&&e.messages&&e.messages.length>0){let n=Fe(e.messages);if(n.length>0){let e=P();t(t=>({...t,todos:{...t.todos,[e]:n}}))}}}function Le(e){if(e.attributionSnapshots&&e.attributionSnapshots.length>0)return ue(e.attributionSnapshots)}function B(e,t){if(!(!e&&!t))return{name:e??``,color:t==="default"?void 0:t}}function V(e,t,n){if(t)return{agentDefinition:t,agentType:void 0};if(!e)return M(void 0),{agentDefinition:void 0,agentType:void 0};let r=n.activeAgents.find(t=>t.agentType===e);return r?(M(r.agentType),!A()&&r.model&&r.model!==`inherit`&&j(je(r.model)),{agentDefinition:r,agentType:r.agentType}):(I(`Resumed session had agent "${e}" but it is no longer available. Using default behavior.`),M(void 0),{agentDefinition:void 0,agentType:void 0})}function H(e){let t=u();if(t){x(t);return}if(e){try{process.chdir(e.worktreePath)}catch{x(null);return}g(e.worktreePath),k(F()),v(e),h(),y(),_.cache.clear?.()}}function Re(){let e=u();if(e){v(null),h(),y(),_.cache.clear?.();try{process.chdir(e.originalCwd)}catch{return}g(e.originalCwd),k(F())}}async function ze(t,n,r){if(n.forkSession)t.contentReplacements?.length&&await S(t.contentReplacements);else{let e=n.sessionIdOverride??t.sessionId;e&&(Ce(C(e),n.transcriptPath?Pe(n.transcriptPath):null),await ye(),m(e))}if(pe(n.forkSession?{...t,worktreeSession:void 0}:t),t.goal){let{hydrateGoalFromTranscript:r}=(fe(),e(_e)),i=new Map,a=n.sessionIdOverride??t.sessionId??P();i.set(a,t.goal),r(i,a)}n.forkSession||(H(t.worktreeSession),le());let{agentDefinition:i,agentType:a}=V(t.agentSetting,r.mainThreadAgentDefinition,r.agentDefinitions);he(`normal`);let o=n.includeAttribution?Le(t):void 0,s=B(t.agentName,t.agentColor);ee(t.agentName);let c=r.agentDefinitions;return{messages:t.messages,fileHistorySnapshots:t.fileHistorySnapshots,contentReplacements:t.contentReplacements,agentName:t.agentName,agentColor:t.agentColor==="default"?void 0:t.agentColor,restoredAgentDef:i,initialState:{...r.initialState,...a&&{agent:a},...o&&{attribution:o},...s&&{standaloneAgentContext:s},agentDefinitions:c}}}D(),N(),a(),ke(),t(),i(),Oe(),L(),Ee(),E(),we();var Be=1e3,Ve=500,He=300,Ue=2e3,We=typeof Bun<`u`,U=null,W=null,G=new Set,K=!1,q=!1,J=!1,Y=null,X=Se(),Z=null;async function Ge(){if(K||q)return;K=!0,J||(J=!0,ge(()=>{b(),X.emit()}));let e=await qe();e.length!==0&&(I(`Watching for changes in skill/command directories: ${e.join(`, `)}...`),U=o.watch(e,{persistent:!0,ignoreInitial:!0,depth:2,awaitWriteFinish:{stabilityThreshold:Z?.stabilityThreshold??Be,pollInterval:Z?.pollInterval??Ve},ignored:(e,t)=>t&&!t.isFile()&&!t.isDirectory()?!0:e.split(z.sep).some(e=>e===`.git`),ignorePermissionErrors:!0,usePolling:We,interval:Z?.chokidarInterval??Ue,atomic:!0}),U.on(`add`,$),U.on(`change`,$),U.on(`unlink`,$),Y=De(async()=>{await Q()}))}function Q(){q=!0,Y&&(Y(),Y=null);let e=Promise.resolve();return U&&(e=U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),e}var Ke=X.subscribe;async function qe(){let e=R(),t=[],n=l(`userSettings`,`skills`);if(n)try{await e.stat(n),t.push(n)}catch{}let r=l(`userSettings`,`commands`);if(r)try{await e.stat(r),t.push(r)}catch{}let i=l(`projectSettings`,`skills`);if(i)try{let n=z.resolve(i);await e.stat(n),t.push(n)}catch{}let a=l(`projectSettings`,`commands`);if(a)try{let n=z.resolve(a);await e.stat(n),t.push(n)}catch{}for(let n of xe()){let r=z.join(n,`.claude`,`skills`);try{await e.stat(r),t.push(r)}catch{}}return t}function $(e){I(`Detected skill change: ${e}`),Ae(`tengu_skill_file_changed`,{source:`chokidar`}),Je(e)}function Je(e){G.add(e),W&&clearTimeout(W),W=setTimeout(async()=>{W=null;let e=[...G];if(G.clear(),ve(await ne(`skills`,e[0]))){I(`ConfigChange hook blocked skill reload (${e.length} paths)`);return}de(),r(),be(),X.emit()},Z?.reloadDebounce??He)}async function Ye(e){U&&(await U.close(),U=null),W&&(clearTimeout(W),W=null),G.clear(),X.clear(),K=!1,q=!1,Z=e??null}var Xe={initialize:Ge,dispose:Q,subscribe:Ke,resetForTesting:Ye};export{V as a,ze as i,B as n,Ie as o,Re as r,H as s,Xe as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{$i as n,Bi as r,Fp as i,Hi as a,Pp as o,Zi as s}from"./loadAgentsDir-BL93ulMm.js";import{I as c,P as l,fi as u,h as d,t as f,y as p}from"./src-P_wYS_NJ2.js";import{t as m}from"./jsx-runtime-Bb4Xn-E0.js";import{ln as h,sn as g}from"./settings-D4CpDv2y.js";import{_,v}from"./startupProfiler-CmH_aVy2.js";import{l as y,o as b}from"./stringUtils-C8PaYpQF.js";function x(e,t){let n=t.trim();if(n===``)return e.slice();let r=n.toLowerCase().split(/\s+/);return e.filter(e=>{let t=`${e.name} ${e.description}`.toLowerCase();return r.every(e=>t.includes(e))})}var S=e((()=>{}));function C(e){return e===`plugin`?`plugin`:e===`mcp`?`mcp`:g(e)}function w({onExit:e,commands:t}){let[n,r]=(0,T.useState)(``),i=(0,T.useMemo)(()=>t.filter(e=>e.type===`prompt`&&(e.loadedFrom===`skills`||e.loadedFrom===`commands_DEPRECATED`||e.loadedFrom===`plugin`||e.loadedFrom===`mcp`)),[t]),u=(0,T.useMemo)(()=>x(i.map(e=>({...e,name:a(e),description:e.description??``})),n),[i,n]),f=(0,T.useMemo)(()=>{let e={policySettings:[],userSettings:[],projectSettings:[],localSettings:[],flagSettings:[],plugin:[],mcp:[]};for(let t of u){let n=t.source;n in e&&e[n].push(t)}for(let t of Object.values(e))t.sort((e,t)=>a(e).localeCompare(a(t)));return e},[u]),m=()=>{e(`Skills dialog dismissed`,{display:`system`})};if(i.length===0)return(0,E.jsxs)(p,{title:`Skills`,subtitle:`No skills found`,onCancel:m,hideInputGuide:!0,children:[(0,E.jsx)(l,{dimColor:!0,children:`Create skills in .claude/skills/ or ~/.claude/skills/`}),(0,E.jsx)(l,{dimColor:!0,italic:!0,children:(0,E.jsx)(o,{action:`confirm:no`,context:`Confirmation`,fallback:`Esc`,description:`close`})})]});let h=e=>{switch(e){case`projectSettings`:case`localSettings`:return{label:`local`,color:`yellow`};case`userSettings`:return{label:`global`,color:`cyan`};case`policySettings`:return{label:`managed`,color:`magenta`};default:return}},g=(e,t)=>{let n=`~${_(s(e))}`,r=e.source===`plugin`?e.pluginInfo?.pluginManifest.name:void 0,i=h(e.source);return(0,E.jsxs)(c,{children:[(0,E.jsx)(l,{color:t?`suggestion`:void 0,children:a(e)}),i&&(0,E.jsxs)(l,{color:i.color,children:[` [`,i.label,`]`]}),(0,E.jsxs)(l,{dimColor:!0,children:[r?` · ${r}`:``,` · `,C(e.source),` · `,n,` tokens`]})]})};return(0,E.jsx)(d,{title:`Skills`,placeholder:`Type to filter skills…`,items:(0,T.useMemo)(()=>D.flatMap(e=>f[e]),[f]),getKey:e=>`${e.name}-${e.source}`,visibleCount:12,direction:`down`,onQueryChange:r,onSelect:t=>{e(`/${a(t)}`,{display:`user`})},onCancel:m,emptyMessage:e=>e.trim()?`No skills matching "${e.trim()}"`:`No skills found`,matchLabel:n.trim()===``?`${i.length} ${y(i.length,`skill`)}`:`${u.length}/${i.length} ${y(i.length,`skill`)}`,selectAction:`invoke skill`,renderItem:(e,t)=>g(e,t)})}var T,E,D,O=e((()=>{u(),T=t(u(),1),r(),f(),n(),v(),h(),b(),i(),S(),E=m(),D=[`projectSettings`,`localSettings`,`userSettings`,`flagSettings`,`policySettings`,`plugin`,`mcp`]}));async function k(e,t){return(0,A.jsx)(w,{onExit:e,commands:t.options.commands})}var A;e((()=>{u(),O(),A=m()}))();export{k as call};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./startupProfiler-CmH_aVy2.js";e();export{t as profileCheckpoint};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-BDhHQY0-.js";import{dirname as r,join as i}from"path";import{mkdirSync as a,readFileSync as o,unlinkSync as s,writeFileSync as c}from"fs";function l(e=`remote-control`){return i(t(),`daemon`,`${e}.json`)}function u(e,t=`remote-control`){let n=l(t);a(r(n),{recursive:!0}),c(n,JSON.stringify(e,null,2),`utf-8`)}function d(e=`remote-control`){let t=l(e);try{let e=o(t,`utf-8`);return JSON.parse(e)}catch{return null}}function f(e=`remote-control`){let t=l(e);try{s(t)}catch{}}function p(e){try{return process.kill(e,0),!0}catch{return!1}}function m(e=`remote-control`){let t=d(e);return t?p(t.pid)?{status:`running`,state:t}:(f(e),{status:`stale`}):{status:`stopped`}}async function h(e=`remote-control`,t=1e4){let n=d(e);if(!n)return!1;let{pid:r}=n;if(!p(r))return f(e),!1;try{process.kill(r,`SIGTERM`)}catch{return f(e),!1}let i=Date.now()+t;for(;Date.now()<i;){if(!p(r))return f(e),!0;await new Promise(e=>setTimeout(e,200))}try{process.kill(r,`SIGKILL`)}catch{}return await new Promise(e=>setTimeout(e,500)),f(e),!0}var g=e((()=>{n()}));export{u as a,h as i,m as n,f as r,g as t};
@@ -1 +0,0 @@
1
- import{Bn as e,Wt as t,dn as n,pt as r,t as i}from"./state-BemZdQIl.js";t();export{i as addInvokedSkill,r as getSessionId,n as setCwdState,e as setOriginalCwd};
@@ -1,2 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{l as t,o as n,r,t as i}from"./envUtils-BDhHQY0-.js";import{n as a,t as o}from"./figures-5ThXQEtq.js";import{Hb as s,Ib as c,Sb as l,bb as ee,gb as u,qb as d,yb as f,zb as p}from"./loadAgentsDir-BL93ulMm.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-D4CpDv2y.js";import{f as A,v as j}from"./startupProfiler-CmH_aVy2.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-Bgh_r4lg.js";import{h as z,l as B,o as V,p as H}from"./proxy-CVn7o19p.js";import{d as U,u as W}from"./pidLock-DgOBc1Xo.js";import{n as G,t as K}from"./nativeInstaller-BEwayifa.js";import{n as q,t as J}from"./allErrors-_cOQksHC.js";function Y(){return[]}function X(e,t=null,n){let r=e?.find(e=>e.name===`ide`);if(t){let e=d(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=c(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=f(await ee()),t=[];return e.forEach(e=>{let n=k(e.path);t.push(`Large ${n} will impact performance (${A(e.content.length)} chars > ${A(u)})`)}),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(),n=[];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];n.push({label:`API provider`,value:t})}if(e===`firstParty`){let e=process.env.ANTHROPIC_BASE_URL;e&&n.push({label:`API base URL`,value:e})}else if(e===`bedrock`){let e=process.env.BEDROCK_BASE_URL;e&&n.push({label:`Bedrock base URL`,value:e}),n.push({label:`AWS region`,value:i()}),t(process.env.CLAUDE_CODE_SKIP_BEDROCK_AUTH)&&n.push({value:`AWS auth skipped`})}else if(e===`vertex`){let e=process.env.VERTEX_BASE_URL;e&&n.push({label:`Vertex base URL`,value:e});let i=process.env.ANTHROPIC_VERTEX_PROJECT_ID;i&&n.push({label:`GCP project`,value:i}),n.push({label:`Default region`,value:r()}),t(process.env.CLAUDE_CODE_SKIP_VERTEX_AUTH)&&n.push({value:`GCP auth skipped`})}else if(e===`foundry`){let e=process.env.ANTHROPIC_FOUNDRY_BASE_URL;e&&n.push({label:`Microsoft Foundry base URL`,value:e});let r=process.env.ANTHROPIC_FOUNDRY_RESOURCE;r&&n.push({label:`Microsoft Foundry resource`,value:r}),t(process.env.CLAUDE_CODE_SKIP_FOUNDRY_AUTH)&&n.push({value:`Microsoft Foundry auth skipped`})}else if(e===`gemini`){let e=process.env.GEMINI_BASE_URL||`https://generativelanguage.googleapis.com/v1beta`;n.push({label:`Gemini base URL`,value:e})}else if(e===`grok`){let e=process.env.GROK_BASE_URL;n.push({label:`Grok base URL`,value:e})}else if(e===`openai`){let e=process.env.OPENAI_BASE_URL;n.push({label:`OpenAI base URL`,value:e})}let a=V();a&&n.push({label:`Proxy`,value:a});let o=H();return process.env.NODE_EXTRA_CA_CERTS&&n.push({label:`Additional CA cert(s)`,value:process.env.NODE_EXTRA_CA_CERTS}),o&&(o.cert&&process.env.CLAUDE_CODE_CLIENT_CERT&&n.push({label:`mTLS client cert`,value:process.env.CLAUDE_CODE_CLIENT_CERT}),o.key&&process.env.CLAUDE_CODE_CLIENT_KEY&&n.push({label:`mTLS client key`,value:process.env.CLAUDE_CODE_CLIENT_KEY})),n}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(),l(),U(),n(),O(),j(),p(),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{na as t,ta as n}from"./loadAgentsDir-BL93ulMm.js";function r(e){return e?e.activeAgents.filter(e=>e.source!==`built-in`).reduce((e,n)=>e+t(`${n.agentType}: ${n.whenToUse}`),0):0}var i,a=e((()=>{n(),i=15e3}));export{r as n,a as r,i as t};
@@ -1 +0,0 @@
1
- import{n as e,t}from"./subprocessEnv-Ci8VV_bi.js";t();export{e as registerUpstreamProxyEnvFn};
@@ -1 +0,0 @@
1
- import{n as e,r as t}from"./switcher-DnAhkyIn.js";e();export{t as restoreActiveProvider};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,o as n}from"./envUtils-BDhHQY0-.js";import{A as r,l as i,n as a,p as o,w as s}from"./external-CEp-aPkt.js";import{o as c,s as l}from"./log-Dauqle-Z.js";import{dirname as u,join as d}from"path";import{existsSync as f,readFileSync as p,renameSync as m,unlinkSync as h,writeFileSync as g}from"fs";import{randomBytes as _}from"node:crypto";var v=e((()=>{a(),a()})),y,b,x,S=e((()=>{v(),y=i([`openai-compat`,`anthropic-compat`]),b=s({id:r().min(1).regex(/^[a-z0-9-]+$/,`id must be kebab-case`),kind:y,baseUrl:r().url(),apiKey:r().min(1).optional(),apiKeyEnv:r().min(1).optional(),defaultModel:r().min(1).default(`gpt-4o-mini`)}).refine(e=>!!e.apiKey||!!e.apiKeyEnv,`either apiKey or apiKeyEnv is required`),x=o(b)}));function C(){return d(t(),`providers.json`)}function w(){k=null}function T(){if(k!==null)return k;let e=E();return k=e.providers,e.providers}function E(){let e=C();if(!f(e))return{providers:[]};let t;try{t=p(e,`utf-8`)}catch(t){let n=`loadProviders: failed to read ${e}: ${t instanceof Error?t.message:String(t)}`;return l(Error(n)),{providers:[],error:n}}if(!t.trim())return{providers:[]};let n;try{n=JSON.parse(t)}catch{let t=`loadProviders: ${e} is not valid JSON. Ignoring.`;return l(Error(t)),{providers:[],error:t}}let r=x.safeParse(n);if(!r.success){let t=`loadProviders: ${e} failed schema validation: ${r.error.message}. Ignoring.`;return l(Error(t)),{providers:[],error:t}}return{providers:r.data}}function D(e,t){return(t??T()).find(t=>t.id===e)}function O(e){let t=C(),n=d(u(t),`.providers-${_(8).toString(`hex`)}.tmp`);try{g(n,JSON.stringify(e,null,2),`utf-8`),m(n,t)}catch(e){try{h(n)}catch{}throw e}return w(),e}var k,A=e((()=>{c(),n(),S(),k=null}));function j(e){if(e.apiKey)return e.apiKey;if(e.apiKeyEnv)return process.env[e.apiKeyEnv]}function M(e,t){let n=t??T(),r=D(e,n);if(!r){let t=n.map(e=>e.id).join(`, `);throw Error(`switchProvider: provider "${e}" not found. Available: ${t}`)}let i=r.kind===`anthropic-compat`?{ANTHROPIC_BASE_URL:r.baseUrl,ANTHROPIC_MODEL:r.defaultModel}:{CLAUDE_CODE_USE_OPENAI:`1`,OPENAI_BASE_URL:r.baseUrl,OPENAI_MODEL:r.defaultModel},a=[];if(r.kind===`openai-compat`){let e=process.env.CLAUDE_CODE_USE_OPENAI===`1`||!!process.env.OPENAI_API_KEY,t=!!process.env.ANTHROPIC_API_KEY;e&&t&&a.push(`Both ANTHROPIC_API_KEY and OpenAI-compat mode are set. ANTHROPIC_API_KEY is for workspace endpoints (/v1/agents, /v1/vaults). OpenAI-compat mode routes /v1/messages to a third-party provider. These are separate planes — verify this is intentional.`)}return!r.apiKey&&!r.apiKeyEnv?a.push(`Provider "${r.id}" has neither apiKey nor apiKeyEnv configured. Edit ~/.claude/providers.json to add one.`):!r.apiKey&&r.apiKeyEnv&&!process.env[r.apiKeyEnv]&&a.push(`${r.apiKeyEnv} is not set in the current environment. Set it before starting Work Mate: export ${r.apiKeyEnv}=<your-api-key>`),{env:i,warnings:a,provider:r}}function N(e){return e.kind===`anthropic-compat`?`ANTHROPIC_API_KEY`:`OPENAI_API_KEY`}async function P(e,t){delete process.env.CLAUDE_CODE_USE_BEDROCK,delete process.env.CLAUDE_CODE_USE_VERTEX,delete process.env.CLAUDE_CODE_USE_FOUNDRY,delete process.env.CLAUDE_CODE_USE_GEMINI,delete process.env.CLAUDE_CODE_USE_GROK,e.kind===`anthropic-compat`?(delete process.env.CLAUDE_CODE_USE_OPENAI,delete process.env.OPENAI_BASE_URL,delete process.env.OPENAI_API_KEY,delete process.env.OPENAI_MODEL):(delete process.env.ANTHROPIC_BASE_URL,delete process.env.ANTHROPIC_API_KEY,delete process.env.ANTHROPIC_MODEL);let n=e.kind===`anthropic-compat`?{ANTHROPIC_BASE_URL:e.baseUrl,ANTHROPIC_API_KEY:t??``,ANTHROPIC_MODEL:e.defaultModel}:{CLAUDE_CODE_USE_OPENAI:`1`,OPENAI_BASE_URL:e.baseUrl,OPENAI_API_KEY:t??``,OPENAI_MODEL:e.defaultModel},{clearOpenAIClientCache:r}=await import(`./client-BCAbKdNz.js`);r();let{applyConfigEnvironmentVariables:i}=await import(`./managedEnv-CYepSnm8.js`);i(),Object.assign(process.env,n)}async function F(e,t){let{provider:n,warnings:r}=M(e,t),i=j(n),a=N(n);i||r.push(`No API key available for provider "${n.id}" — ${a} will be empty. Set ${n.apiKeyEnv??`an env var`} or add an apiKey field in ~/.claude/providers.json.`),await P(n,i);let{updateSettingsForSource:o}=await import(`./settings-BG15IFYx.js`);return o(`userSettings`,{activeProviderId:n.id,modelType:n.kind===`anthropic-compat`?`anthropic`:`openai`}),{provider:n,warnings:r}}async function I(){let{getSettingsForSource:e}=await import(`./settings-BG15IFYx.js`),t=e(`userSettings`)?.activeProviderId;if(!t)return null;let n=D(t);if(!n)return null;let r=[],i=j(n);if(!i){let e=N(n);r.push(`No API key available for provider "${n.id}" — ${e} will be empty. Set ${n.apiKeyEnv??`an env var`} or add an apiKey field in ~/.claude/providers.json.`)}return await P(n,i),{provider:n,warnings:r}}var L=e((()=>{A()}));export{A as a,v as c,M as i,L as n,T as o,I as r,O as s,F as t};
@@ -1 +0,0 @@
1
- import{du as e,hu as t,pu as n,uu as r,vu as i}from"./loadAgentsDir-BL93ulMm.js";e();export{r as checkOutTeleportedSessionBranch,n as processMessagesForTeleportResume,t as teleportResumeCodeSession,i as validateGitState};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{n as t,t as n}from"./defineProperty-C-QyHrDq.js";import{r,t as i}from"./execFileNoThrow-DHyW8FMX.js";import{a,i as o,t as s}from"./cliLaunch-BTpfAGGI.js";import{spawnSync as c}from"child_process";var l;e((()=>{r(),o(),t(),l=class{constructor(){n(this,`name`,`tmux`),n(this,`supportsInteractiveInput`,!0)}async available(){let{code:e}=await i(`tmux`,[`-V`],{useCwd:!1});return e===0}async start(e){let t=s(e.args,{env:{...e.env,CLAUDE_CODE_SESSION_KIND:`bg`,CLAUDE_CODE_SESSION_NAME:e.sessionName,CLAUDE_CODE_SESSION_LOG:e.logPath,CLAUDE_CODE_TMUX_SESSION:e.sessionName}}),n=a(t);if(c(`tmux`,[`new-session`,`-d`,`-s`,e.sessionName,n],{stdio:`inherit`,env:t.env}).status!==0)throw Error(`Failed to create tmux session.`);return{pid:0,sessionName:e.sessionName,logPath:e.logPath,engineUsed:`tmux`}}async attach(e){if(!e.tmuxSessionName)throw Error(`Session ${e.sessionId} has no tmux session name.`);if(c(`tmux`,[`attach-session`,`-t`,e.tmuxSessionName],{stdio:`inherit`}).status!==0)throw Error(`Failed to attach to tmux session '${e.tmuxSessionName}'.`)}}}))();export{l as TmuxEngine};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{$x as t,JT as n,eS as r,qT as i}from"./loadAgentsDir-BL93ulMm.js";import{n as a,t as o}from"./partition-DLcW5Oo_.js";function s(e,t,i){let[o,s]=a(n([...e,...t],`name`),r),c=(e,t)=>e.name.localeCompare(t.name);return[...s.sort(c),...o.sort(c)]}var c=e((()=>{o(),i(),t()}));export{s as n,c as t};
@@ -1 +0,0 @@
1
- import{r as e,t}from"./trustedDevice-DL0pWP4_.js";export{t as clearTrustedDeviceToken,e as enrollTrustedDevice};
@@ -1 +0,0 @@
1
- import{n as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Sg as t,xg as n}from"./loadAgentsDir-BL93ulMm.js";import{C as r,_ as i,s as a}from"./model-Bgh_r4lg.js";function o(){let e=t(e=>e.mainLoopModel);return r(t(e=>e.mainLoopModelForSession)??e??a())}var s=e((()=>{n(),i()}));export{o as n,s as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Bh as t,CS as n,Es as r,G_ as i,Hh as a,K_ as o,Qd as s,Rh as c,Sg as l,Ts as u,Uh as d,Zd as f,bs as p,do as m,fo as h,wS as g,wg as _,xg as v,xs as y}from"./loadAgentsDir-BL93ulMm.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-BecbSVoN.js";import{Ln as T,Rn as E}from"./settings-D4CpDv2y.js";import{O as D,k as O}from"./git-DBlOv64X.js";import{o as k,s as A}from"./log-Dauqle-Z.js";import{n as j,r as M}from"./analytics-DJobLaWP.js";import{n as N,r as P}from"./pluginFlagging-DcJ_FQuv.js";import{t as F}from"./pluginBlocklist-DXQlbG0P.js";var I=e(b(),1);f(),j(),c(),v(),E(),w(),D(),x(),k(),u(),y(),i(),a(),n(),P(),m();function L({enabled:e=!0}={}){let n=_(),i=l(e=>e.plugins.needsRefresh),{addNotification:a}=s(),c=(0,I.useCallback)(async()=>{try{let{enabled:e,disabled:i,errors:s}=await h();await F();let c=N();Object.keys(c).length>0&&a({key:`plugin-delisted-flagged`,text:`Plugins flagged. Check /plugins`,color:`warning`,priority:`high`});let l=[],u=[];try{l=await p()}catch(e){let t=e instanceof Error?e.message:String(e);s.push({type:`generic-error`,source:`plugin-commands`,error:`Failed to load plugin commands: ${t}`})}try{u=await r()}catch(e){let t=e instanceof Error?e.message:String(e);s.push({type:`generic-error`,source:`plugin-agents`,error:`Failed to load plugin agents: ${t}`})}try{await o()}catch(e){let t=e instanceof Error?e.message:String(e);s.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 g(e,s);return t&&(e.mcpServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0),m=(await Promise.all(e.map(async e=>{if(e.lspServers)return Object.keys(e.lspServers).length;let t=await d(e,s);return t&&(e.lspServers=t),t?Object.keys(t).length:0}))).reduce((e,t)=>e+t,0);t(),n(t=>{let n=t.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r=new Set(s.map(e=>e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`)),a=[...n.filter(e=>{let t=e.type===`generic-error`?`generic-error:${e.source}:${e.error}`:`${e.type}:${e.source}`;return!r.has(t)}),...s];return{...t,plugins:{...t.plugins,enabled:e,disabled:i,commands:l,errors:a}}}),C(`Loaded plugins - Enabled: ${e.length}, Disabled: ${i.length}, Commands: ${l.length}, Agents: ${u.length}, Errors: ${s.length}`);let _=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:i.length,inline_count:T(e,e=>e.source.endsWith(`@inline`)),marketplace_count:T(e,e=>!e.source.endsWith(`@inline`)),error_count:s.length,skill_count:l.length,agent_count:u.length,hook_count:_,mcp_count:f,lsp_count:m}}catch(e){let t=S(e);return A(t),C(`Error loading plugins: ${e}`),n(e=>{let n=e.plugins.errors.filter(e=>e.source===`lsp-manager`||e.source.startsWith(`plugin:`)),r={type:`generic-error`,source:`plugin-system`,error:t.message};return{...e,plugins:{...e.plugins,enabled:[],disabled:[],commands:[],errors:[...n,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}}},[n,a]);(0,I.useEffect)(()=>{e&&c().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)})},[c,e]),(0,I.useEffect)(()=>{!e||!i||a({key:`plugin-reload-pending`,text:`Plugins changed. Run /reload-plugins to activate.`,color:`suggestion`,priority:`low`})},[e,i,a])}export{L as t};
@@ -1 +0,0 @@
1
- import{n as e,o as t}from"./rolldown-runtime-DaDcL9Zw.js";import{Dg as n,Og as r,Qd as i,Zd as a}from"./loadAgentsDir-BL93ulMm.js";import{fi as o}from"./src-P_wYS_NJ2.js";import{B as s,Wt as c}from"./state-BemZdQIl.js";import{n as l,t as u}from"./allErrors-_cOQksHC.js";function d(){let{addNotification:e,removeNotification:t}=i(),[n,a]=(0,f.useState)(()=>{let{errors:e}=u();return e});return r((0,f.useCallback)(()=>{let{errors:e}=u();a(e)},[])),(0,f.useEffect)(()=>{if(!s())if(n.length>0){let t=`Found ${n.length} settings ${n.length===1?`issue`:`issues`} · /doctor for details`;e({key:p,text:t,color:`warning`,priority:`high`,timeoutMs:6e4})}else t(p)},[n,e,t]),n}var f,p,m=e((()=>{f=t(o(),1),a(),c(),l(),n(),p=`settings-errors`}));export{d as n,m as t};
@@ -1 +0,0 @@
1
- import{o as e}from"./rolldown-runtime-DaDcL9Zw.js";import{Au as t,bg as n,ju as r,xg as i}from"./loadAgentsDir-BL93ulMm.js";import{I as a,P as o,fi as s,t as c}from"./src-P_wYS_NJ2.js";import{t as l}from"./jsx-runtime-Bb4Xn-E0.js";import{n as u,r as d}from"./analytics-DJobLaWP.js";import{Bt as f,Ht as p}from"./model-Bgh_r4lg.js";import{t as m}from"./WelcomeV2-ZQRKlcT4.js";import{t as h}from"./useManagePlugins-CjnsO-Of.js";import{n as g,t as _}from"./MCPConnectionManager-B9n4SXN4.js";import{n as v}from"./onChangeAppState-ZdwI7boX.js";import{cwd as y}from"process";var b=e(s(),1);c(),r(),u(),g(),i(),f();var x=l();async function S(e){d(`tengu_setup_token_command`,{});let r=!p(),{ConsoleOAuthFlow:i}=await import(`./ConsoleOAuthFlow-CV6PcJOP.js`);await new Promise(s=>{e.render((0,x.jsx)(n,{onChangeAppState:v,children:(0,x.jsx)(t,{children:(0,x.jsxs)(a,{flexDirection:`column`,gap:1,children:[(0,x.jsx)(m,{}),r&&(0,x.jsxs)(a,{flexDirection:`column`,children:[(0,x.jsx)(o,{color:`warning`,children:`Warning: You already have authentication configured via environment variable or API key helper.`}),(0,x.jsx)(o,{color:`warning`,children:`The setup-token command will create a new OAuth token which you can use instead.`})]}),(0,x.jsx)(i,{onDone:()=>{s()}})]})})}))}),e.unmount(),process.exit(0)}var C=b.lazy(()=>import(`./Doctor-BcnUfJ4I.js`).then(e=>({default:e.Doctor})));function w({onDone:e}){return h(),(0,x.jsx)(b.Suspense,{fallback:null,children:(0,x.jsx)(C,{onDone:e})})}async function T(e){d(`tengu_doctor_command`,{}),await new Promise(r=>{e.render((0,x.jsx)(n,{children:(0,x.jsx)(t,{children:(0,x.jsx)(_,{dynamicMcpConfig:void 0,isStrictMcpConfig:!1,children:(0,x.jsx)(w,{onDone:()=>{r()}})})})}))}),e.unmount(),process.exit(0)}async function E(e,t){let{setup:n}=await import(`./setup-C62oq4AZ.js`);await n(y(),`default`,!1,!1,void 0,!1);let{install:r}=await import(`./install-Du-DSVzj.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{T as doctorHandler,E as installHandler,S as setupTokenHandler};
@@ -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{Jw as r,KE as i,UE as a,WE as o,Yw as s,eT as c,nT as l,qE as u,tT as d}from"./loadAgentsDir-BL93ulMm.js";import{p as f}from"./external-CEp-aPkt.js";import{r as p}from"./lazySchema-B4D4qJVE.js";import{B as m,C as ee,F as h,P as g,R as _,S as v,c as y,f as b,i as te,u as x,x as S}from"./debug-BecbSVoN.js";import{_t as C,gt as w,ht as T,pt as ne,vt as re}from"./settings-D4CpDv2y.js";import{o as ie,s as E}from"./log-Dauqle-Z.js";import{homedir as ae}from"os";import*as D from"path";import{join as oe,resolve as se}from"path";import{randomBytes as O}from"crypto";import{readFile as k,readdir as A,rename as j,stat as M,unlink as N,writeFile as P}from"fs/promises";function F(){return oe(r(),H)}async function I(){let e=F();try{let t=v(await k(e,{encoding:`utf-8`}));if(typeof t!=`object`||!t||!(`version`in t)||!(`fetchedAt`in t)||!(`counts`in t))return y(`Install counts cache has invalid structure`),null;let n=t;if(n.version!==V)return y(`Install counts cache version mismatch (got ${n.version}, expected ${V})`),null;if(typeof n.fetchedAt!=`string`||!Array.isArray(n.counts))return y(`Install counts cache has invalid structure`),null;let r=new Date(n.fetchedAt).getTime();return Number.isNaN(r)?(y(`Install counts cache has invalid fetchedAt timestamp`),null):n.counts.every(e=>typeof e==`object`&&!!e&&typeof e.plugin==`string`&&typeof e.unique_installs==`number`)?Date.now()-r>W?(y(`Install counts cache is stale (>24h old)`),null):{version:n.version,fetchedAt:n.fetchedAt,counts:n.counts}:(y(`Install counts cache has malformed entries`),null)}catch(e){return h(e)!==`ENOENT`&&y(`Failed to load install counts cache: ${g(e)}`),null}}async function L(e){let t=F(),n=`${t}.${O(8).toString(`hex`)}.tmp`;try{let i=r();await x().mkdir(i),await P(n,ee(e,null,2),{encoding:`utf-8`,mode:384}),await j(n,t),y(`Install counts cache saved successfully`)}catch(e){E(e);try{await N(n)}catch{}}}async function R(){y(`Fetching install counts from ${U}`);let e=performance.now();try{let n=await t.get(U,{timeout:1e4});if(!n.data?.plugins||!Array.isArray(n.data.plugins))throw Error(`Invalid response format from install counts API`);return l(`install_counts`,U,`success`,performance.now()-e),n.data.plugins}catch(t){throw l(`install_counts`,U,`failure`,performance.now()-e,c(t)),t}}async function z(){let e=await I();if(e){y(`Using cached install counts`),l(`install_counts`,U,`cache_hit`,0);let t=new Map;for(let n of e.counts)t.set(n.plugin,n.unique_installs);return t}try{let e=await R();await L({version:V,fetchedAt:new Date().toISOString(),counts:e});let t=new Map;for(let n of e)t.set(n.plugin,n.unique_installs);return t}catch(e){return E(e),y(`Failed to fetch install counts: ${g(e)}`),null}}function B(e){if(e<1e3)return String(e);if(e<1e6){let t=(e/1e3).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}K`:`${t}K`}let t=(e/1e6).toFixed(1);return t.endsWith(`.0`)?`${t.slice(0,-2)}M`:`${t}M`}var V,H,U,W,G=e((()=>{n(),te(),_(),b(),ie(),S(),d(),s(),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=se(t.startsWith(`~`)?t.replace(/^~/,ae()):t),r;try{r=await n.stat(e)}catch(t){let n=h(t);return{error:n===`ENOENT`?`Path does not exist: ${e}`:`Cannot access path: ${e} (${n??t})`}}return r.isFile()?e.endsWith(`.json`)?{source:`file`,path:e}:{error:`File path must point to a .json file (marketplace.json), but got: ${e}`}:r.isDirectory()?{source:`directory`,path:e}:{error:`Path is neither a file nor a directory: ${e}`}}if(t.includes(`/`)&&!t.startsWith(`@`)){if(t.includes(`:`))return null;let e=t.match(/^([^#@]+)(?:[#@](.+))?$/),n=e?.[1]||t,r=e?.[2];return r?{source:`github`,repo:n,ref:r}:{source:`github`,repo:n}}return null}var ce=e((()=>{_(),b()}));function le(e){let t=D.basename(e),n=D.basename(D.dirname(e));return t===`plugin.json`?`plugin`:t===`marketplace.json`?`marketplace`:n===`.claude-plugin`?`plugin`:`unknown`}function q(e){return e.issues.map(e=>({path:e.path.join(`.`)||`root`,message:e.message,code:e.code}))}function J(e,t,n,r){e.includes(`..`)&&n.push({path:t,message:r?`Path contains "..": ${e}. ${r}`:`Path contains ".." which could be a path traversal attempt: ${e}`})}function ue(e){let t=e.replace(/^(\.\.\/)+/,``);return`Plugin source paths are resolved relative to the marketplace root (the directory containing .claude-plugin/), not relative to marketplace.json. Use "${t===e?`./plugins/my-plugin`:`./${t}`}" instead of "${e}".`}async function Y(e){let t=[],n=[],r=D.resolve(e),i;try{i=await k(r,{encoding:`utf-8`})}catch(e){let t=h(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${g(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`plugin`}}let a;try{a=v(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${g(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=T().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=D.resolve(e),i;try{i=await k(r,{encoding:`utf-8`})}catch(e){let t=h(e),n;return n=t===`ENOENT`?`File not found: ${r}`:t===`EISDIR`?`Path is not a file: ${r}`:`Failed to read file: ${g(e)}`,{success:!1,errors:[{path:`file`,message:n,code:t}],warnings:[],filePath:r,fileType:`marketplace`}}let a;try{a=v(i)}catch(e){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${g(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:f(w().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=D.dirname(r),a=D.basename(i)===`.claude-plugin`?D.dirname(i):i;for(let[t,r]of e.plugins.entries()){if(!r.version||typeof r.source!=`string`||!r.source.startsWith(`./`))continue;let e=D.join(a,r.source,`.claude-plugin`,`plugin.json`),i;try{let t=v(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=[],o=t.match(a);if(!o)return i.push({path:`frontmatter`,message:`No frontmatter block found. Add YAML frontmatter between --- delimiters at the top of the file to set description and other metadata.`}),{success:!0,errors:r,warnings:i,filePath:e,fileType:n};let s=o[1]||``,c;try{c=u(s)}catch(t){return r.push({path:`frontmatter`,message:`YAML frontmatter failed to parse: ${g(t)}. At runtime this ${n} loads with empty metadata (all frontmatter fields silently dropped).`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n}}if(typeof c!=`object`||!c||Array.isArray(c))return r.push({path:`frontmatter`,message:`Frontmatter must be a YAML mapping (key: value pairs), got ${Array.isArray(c)?`an array`:c===null?`null`:typeof c}.`}),{success:!1,errors:r,warnings:i,filePath:e,fileType:n};let l=c;if(l.description!==void 0){let e=l.description;typeof e!=`string`&&typeof e!=`number`&&typeof e!=`boolean`&&e!==null&&r.push({path:`description`,message:`description must be a string, got ${Array.isArray(e)?`array`:typeof e}. At runtime this value is dropped.`})}else i.push({path:`description`,message:`No description in frontmatter. A description helps users and Claude understand when to use this ${n}.`});l.name!==void 0&&l.name!==null&&typeof l.name!=`string`&&r.push({path:`name`,message:`name must be a string, got ${typeof l.name}.`});let d=l[`allowed-tools`];d!=null&&(typeof d!=`string`&&!Array.isArray(d)?r.push({path:`allowed-tools`,message:`allowed-tools must be a string or array of strings, got ${typeof d}.`}):Array.isArray(d)&&d.some(e=>typeof e!=`string`)&&r.push({path:`allowed-tools`,message:`allowed-tools array must contain only strings.`}));let f=l.shell;if(f!=null)if(typeof f!=`string`)r.push({path:`shell`,message:`shell must be a string, got ${typeof f}.`});else{let e=f.trim().toLowerCase();e!==`bash`&&e!==`powershell`&&r.push({path:`shell`,message:`shell must be 'bash' or 'powershell', got '${f}'.`})}return{success:r.length===0,errors:r,warnings:i,filePath:e,fileType:n}}async function Z(e){let t;try{t=await k(e,{encoding:`utf-8`})}catch(t){return h(t)===`ENOENT`?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:[{path:`file`,message:`Failed to read file: ${g(t)}`}],warnings:[],filePath:e,fileType:`hooks`}}let n;try{n=v(t)}catch(t){return{success:!1,errors:[{path:`json`,message:`Invalid JSON syntax: ${g(t)}. At runtime this breaks the entire plugin load.`}],warnings:[],filePath:e,fileType:`hooks`}}let r=ne().safeParse(n);return r.success?{success:!0,errors:[],warnings:[],filePath:e,fileType:`hooks`}:{success:!1,errors:q(r.error),warnings:[],filePath:e,fileType:`hooks`}}async function Q(e,t){let n;try{n=await A(e,{withFileTypes:!0})}catch(e){let t=h(e);if(t===`ENOENT`||t===`ENOTDIR`)return[];throw e}if(t)return n.filter(e=>e.isDirectory()).map(t=>D.join(e,t.name,`SKILL.md`));let r=[];for(let t of n){let n=D.join(e,t.name);t.isDirectory()?r.push(...await Q(n,!1)):t.isFile()&&t.name.toLowerCase().endsWith(`.md`)&&r.push(n)}return r}async function fe(e){let t=[],n=[[`skill`,D.join(e,`skills`)],[`agent`,D.join(e,`agents`)],[`command`,D.join(e,`commands`)]];for(let[e,r]of n){let n=await Q(r,e===`skill`);for(let r of n){let n;try{n=await k(r,{encoding:`utf-8`})}catch(n){if(m(n))continue;t.push({success:!1,errors:[{path:`file`,message:`Failed to read: ${g(n)}`}],warnings:[],filePath:r,fileType:e});continue}let i=de(r,n,e);(i.errors.length>0||i.warnings.length>0)&&t.push(i)}}let r=await Z(D.join(e,`hooks`,`hooks.json`));return(r.errors.length>0||r.warnings.length>0)&&t.push(r),t}async function pe(e){let t=D.resolve(e),n=null;try{n=await M(t)}catch(e){if(!m(e))throw e}if(n?.isDirectory()){let e=await X(D.join(t,`.claude-plugin`,`marketplace.json`));if(e.errors[0]?.code!==`ENOENT`)return e;let n=await Y(D.join(t,`.claude-plugin`,`plugin.json`));return n.errors[0]?.code===`ENOENT`?{success:!1,errors:[{path:`directory`,message:`No manifest found in directory. Expected .claude-plugin/marketplace.json or .claude-plugin/plugin.json`}],warnings:[],filePath:t,fileType:`plugin`}:n}switch(le(e)){case`plugin`:return Y(e);case`marketplace`:return X(e);case`unknown`:try{let n=v(await k(t,{encoding:`utf-8`}));if(Array.isArray(n.plugins))return X(e)}catch(e){if(h(e)===`ENOENT`)return{success:!1,errors:[{path:`file`,message:`File not found: ${t}`}],warnings:[],filePath:t,fileType:`plugin`}}return Y(e)}}var $,me=e((()=>{p(),_(),o(),S(),i(),re(),$=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-DtWHLjmE.js";e();export{t as setShellIfWindows};
@@ -1,6 +0,0 @@
1
- import{l as e,o as t,u as n}from"./envUtils-BDhHQY0-.js";import{At as r,HS as i,Tt as a,VS as o,_t as s}from"./loadAgentsDir-BL93ulMm.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-BecbSVoN.js";import{Wt as g}from"./settings-D4CpDv2y.js";import{O as _,k as v}from"./git-DBlOv64X.js";import{o as y,s as b}from"./log-Dauqle-Z.js";import{n as x,r as S}from"./analytics-DJobLaWP.js";import{C,l as w,v as T}from"./startupProfiler-CmH_aVy2.js";import{Bt as E,Ot as D,_n as O,vn as k}from"./model-Bgh_r4lg.js";import{i as ee,t as A}from"./sessionIdCompat-DMayYBrf.js";import{n as j}from"./firstPartyEventLogger-BHjBQH0J.js";import{t as te}from"./datadog-bm551AVV.js";import{n as M,o as N,r as P}from"./debugUtils-CmJfIUxW.js";import{t as F}from"./pollConfig-BgpfHQPJ.js";import{n as I,t as L}from"./rcDebugLog-CARUIORE.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-BOySRJUJ.js";import{a as ie,i as ae,n as oe,r as se,t as ce}from"./workSecret-BEhXgH2M.js";import{i as U}from"./trustedDevice-DL0pWP4_.js";import{t as le}from"./jwtUtils-OzxN2zts.js";import{i as W,n as G,r as K}from"./cliLaunch-BTpfAGGI.js";import"./bridgeStatusUtil-C36w15ge.js";import{t as q}from"./lib-BlVGipXx.js";import{hostname as J,tmpdir as ue}from"os";import{dirname as Y,join as de,resolve as X}from"path";import{createWriteStream as Z}from"fs";import{randomUUID as fe}from"crypto";import{spawn as pe}from"child_process";import{createInterface as Q}from"readline";t(),d(),h(),_(),y(),x(),T(),O(),i(),te(),j(),a(),L(),W(),q(),g(),c(),m(),A(),N();var me=10,he=10;function ge(e){return e.replace(/[^a-zA-Z0-9_-]/g,`_`)}var $={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(e,t){let n=$[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 ve(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(e,i);a.push({type:`tool_start`,summary:s,timestamp:o}),n(`[bridge:activity] sessionId=${t} tool_use name=${e} ${be(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 ye(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 be(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 xe(e){return{spawn(t,n){let r=ge(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(Y(e.debugFile),`bridge-transcript-${r}.jsonl`),a=Z(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=pe(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>=he&&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=ve(n,t.sessionId,e.onDebug);for(let n of r)d.length>=me&&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=ye(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 Se={connInitialMs:2e3,connCapMs:12e4,connGiveUpMs:6e5,generalInitialMs:500,generalCapMs:3e4,generalGiveUpMs:6e5},Ce=1e3;function we(e){return e.connCapMs*2}function Te(){let e=[...G()],t=K();return t&&e.push(t),e}function Ee(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 De(t,i,a,c,l,d,f,m=Se,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[r]of x){let a=T.get(r),o=D.get(r);if(!(!a||!o))try{await c.heartbeatWork(i,a,o),e=!0}catch(e){p(`[bridge:heartbeat] Failed for sessionId=${r} 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(r):t=!0)}}for(let e of n){d.logVerbose(`Session ${e} token expired — re-queuing via bridge/reconnect`);try{await c.reconnectSession(i,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(i,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=${i}`),v(`info`,`bridge_loop_started`,{max_sessions:t.maxSessions,spawn_mode:t.spawnMode}),d.printBanner(t,i),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 pe(){Q(),fe(),Z=setInterval(fe,Ce)}function Q(){Z&&(clearInterval(Z),Z=null)}function me(e,n,a){return o=>{let s=T.get(e);I(`session done: sessionId=${e} workId=${s??`none`} status=${o} wasTimedOut=${te.has(e)} duration=${Math.round((Date.now()-n)/1e3)}s stderr=${a.lastStderr.length>0?a.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&&o===`interrupted`?`failed`:o,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(),Q();let ee=a.lastStderr.length>0?a.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(Ne(c,i,s,d,m.stopWorkBaseDelayMs)),A.add(s));let F=j.get(e);if(F&&(j.delete(e),G(r(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||pe()}}for(h||pe();!y.aborted;){let f=F();try{I(`poll: envId=${i} activeSessions=${x.size}`);let g=await c.pollForWork(i,a,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(Ne(c,i,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(i,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 a=g.data.id;I(`work received: type=session sessionId=${a} workId=${g.id}`);try{ne(a,`session_id`)}catch{await R(),d.logError(`Invalid session_id received: ${a}`);break}let f=x.get(a);if(f){f.updateAccessToken(P.session_ingress_token),D.set(a,P.session_ingress_token),T.set(a,g.id),V?.schedule(a,P.session_ingress_token),p(`[bridge:work] Updated access token for existing sessionId=${a} 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,a);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=${a} 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 ${a}: ${n}`),b(Error(`registerWorker failed: ${n}`)),A.add(g.id),G(Ne(c,i,g.id,d,m.stopWorkBaseDelayMs))}if(!N)break}else w=oe(t.sessionIngressUrl,a);let L=t.spawnMode,z=t.dir,B=0;if(L===`worktree`&&(h===void 0||!ie(a,h))){let e=Date.now();try{let t=await s(`bridge-${ge(a)}`);B=Date.now()-e,j.set(a,{worktreePath:t.worktreePath,worktreeBranch:t.worktreeBranch,gitRoot:t.gitRoot,hookBased:t.hookBased}),z=t.worktreePath,p(`[bridge:session] Created worktree for sessionId=${a} at ${t.worktreePath}`)}catch(e){let t=u(e);d.logError(`Failed to create worktree for session ${a}: ${t}`),b(Error(`Worktree creation failed: ${t}`)),A.add(g.id),G(Ne(c,i,g.id,d,m.stopWorkBaseDelayMs));break}}p(`[bridge:session] Spawning sessionId=${a} sdkUrl=${w}`);let H=ee(a);I(`spawning session: sessionId=${a} sdkUrl=${w} useCcrV2=${N} workerEpoch=${F} dir=${z} accessToken=${P.session_ingress_token?P.session_ingress_token.slice(0,8)+`...`:`NONE`}`);let se=Ee(l,{sessionId:a,sdkUrl:w,accessToken:P.session_ingress_token,useCcrV2:N,workerEpoch:F,onFirstUserMessage:e=>{if(M.has(H))return;M.add(H);let n=Ie(e);d.setSessionTitle(H,n),p(`[bridge:title] derived title for ${H}: ${n}`),import(`./createSession-D27zvmOs.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 ${a}: ${se}`);let e=j.get(a);e&&(j.delete(a),G(r(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(Ne(c,i,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(a),spawn_duration_ms:le,worktree_create_ms:B,inProtectedNamespace:n()}),v(`info`,`bridge_session_started`,{spawn_mode:L,in_worktree:j.has(a),spawn_duration_ms:le,worktree_create_ms:B}),x.set(a,U),T.set(a,g.id),D.set(a,P.session_ingress_token),E.set(a,H);let W=Date.now();C.set(a,W),d.logSessionStart(a,`Session ${a}`);let K=ge(a),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,o(H,t.sessionIngressUrl)),pe(),d.setAttached(H),Le(H,t.apiBaseUrl).then(e=>{e&&x.has(a)&&(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(Pe,J,a,J,d,te,U);O.set(a,e)}N&&re.add(a),V?.schedule(a,P.session_ingress_token),U.done.then(me(a,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=${ke(e)} isServer=${Ae(e)} activeSessions=${x.size}`),ke(e)||Ae(e)){let e=Date.now();X!==null&&e-X>we(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=je(K);d.logVerbose(`Connection error, retrying in ${Me(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),d.updateReconnectingStatus(Me(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>we(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=je(q);d.logVerbose(`Poll failed, retrying in ${Me(r)} (${Math.round(n/1e3)}s elapsed): ${t}`),d.updateReconnectingStatus(Me(r),w(n)),F().non_exclusive_heartbeat_interval_ms>0&&await L(),await k(r,y)}}}Q(),d.clearStatus();let he=Date.now()-U;S(`tengu_bridge_shutdown`,{active_sessions:x.size,loop_duration_ms:he}),v(`info`,`bridge_shutdown`,{active_sessions:x.size,loop_duration_ms:he});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=>r(e.worktreePath,e.worktreeBranch,e.gitRoot,e.hookBased)))}await Promise.allSettled([...e.entries()].map(([e,t])=>c.stopWork(i,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(i),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-BL8-lGvN.js`);await ve(t.dir),d.logVerbose(`Environment offline.`)}var Oe=new Set([`ECONNREFUSED`,`ECONNRESET`,`ETIMEDOUT`,`ENETUNREACH`,`EHOSTUNREACH`]);function ke(e){return!!(e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&Oe.has(e.code))}function Ae(e){return!!e&&typeof e==`object`&&`code`in e&&typeof e.code==`string`&&e.code===`ERR_BAD_RESPONSE`}function je(e){return Math.max(0,e+e*.25*(2*Math.random()-1))}function Me(e){return e>=1e3?`${(e/1e3).toFixed(1)}s`:`${Math.round(e)}ms`}async function Ne(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=je(i*2**(a-1));r.logVerbose(`Failed to stop work ${n} (attempt ${a}/3), retrying in ${Me(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 Pe(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 Fe=80;function Ie(e){return C(e.replace(/\s+/g,` `).trim(),Fe)}async function Le(e,t){let{getBridgeSession:n}=await import(`./createSession-D27zvmOs.js`);return(await n(e,{baseUrl:t}))?.title||void 0}var Re=class extends Error{constructor(e){super(e),this.name=`BridgeHeadlessPermanentError`}};async function ze(e,t){let{dir:n,log:r}=e;process.chdir(n);let{setOriginalCwd:i,setCwdState:a}=await import(`./state-D_lk6z-C.js`);i(n),a(n);let{enableConfigs:o,checkHasTrustDialogAccepted:s}=await import(`./config-kB2eazPX.js`);o();let{initSinks:c}=await import(`./sinks-WJ7nzLQs.js`);if(c(),!s())throw new Re(`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-CzRUPn-D.js`),d=l();if(d.startsWith(`http://`)&&!d.includes(`localhost`)&&!d.includes(`127.0.0.1`))throw new Re(`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-DF4RFFaT.js`),{hasWorktreeCreateHook:g}=await import(`./hooks-DT80Arzc.js`);if(e.spawnMode===`worktree`&&!(g()||h(n)!==null))throw new Re(`Worktree mode requires a git repository or WorktreeCreate hooks. Directory ${n} has neither.`);let _=await p(),v=await m(),y=J(),b=fe(),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:fe(),apiBaseUrl:d,sessionIngressUrl:f,sessionTimeoutMs:e.sessionTimeoutMs},S=re({baseUrl:d,getAccessToken:e.getAccessToken,runnerVersion:`0.0.11`,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=xe({execPath:process.execPath,scriptArgs:Te(),env:process.env,verbose:!1,sandbox:e.sandbox,permissionMode:e.permissionMode,onDebug:r}),E=Be(r);E.printBanner(x,C);let D;if(e.createSessionOnStart){let{createBridgeSession:n}=await import(`./createSession-D27zvmOs.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 De(x,C,w,S,T,E,t,void 0,D,async()=>e.getAccessToken())}function Be(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 Ve=78,He=1;async function Ue(e){if(!e){console.error(`Error: --daemon-worker requires a worker kind`),process.exitCode=Ve;return}switch(e){case`remoteControl`:await We();break;default:console.error(`Error: unknown daemon worker kind '${e}'`),process.exitCode=Ve}}async function We(){let e=process.env.DAEMON_WORKER_DIR||X(`.`),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 ze(d,c.signal)}catch(e){e instanceof Re?(console.error(`[remoteControl] permanent error: ${e.message}`),process.exitCode=Ve):(console.error(`[remoteControl] transient error: ${u(e)}`),process.exitCode=He)}finally{process.off(`SIGTERM`,l),process.off(`SIGINT`,l)}}export{Ue as runDaemonWorker};
@@ -1 +0,0 @@
1
- import{Tt as e,bt as t}from"./loadAgentsDir-BL93ulMm.js";e();export{t as execIntoTmuxWorktree};